summaryrefslogtreecommitdiffstats
path: root/Operations.hs
diff options
context:
space:
mode:
authorJason Creighton <jcreigh@gmail.com>2007-03-31 02:34:42 +0200
committerJason Creighton <jcreigh@gmail.com>2007-03-31 02:34:42 +0200
commit9a248e6bd9493099b6dd6db56c0b89a123dc522e (patch)
tree0601c8f67e29d1075b9bcb475678a8c8c80dfe8d /Operations.hs
parentf88d0f781cfe2a7d4e530ace9ccf81303b838010 (diff)
downloadmetatile-9a248e6bd9493099b6dd6db56c0b89a123dc522e.tar
metatile-9a248e6bd9493099b6dd6db56c0b89a123dc522e.zip
removed refocus; moved functionality to setFocus
darcs-hash:20070331003442-b9aa7-98dbb2a95ac070ced1efe307317fdd4732c1e38e
Diffstat (limited to 'Operations.hs')
-rw-r--r--Operations.hs24
1 files changed, 9 insertions, 15 deletions
diff --git a/Operations.hs b/Operations.hs
index bf792da..9b0a229 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -56,16 +56,6 @@ refresh = do
zipWithM_ (\i a -> move a (sx + lw) (sy + i * rh) rw (fromIntegral rh)) [0..] s
whenJust (W.peek ws) (io . raiseWindow d) -- this is always Just
whenJust (W.peek ws) setFocus
- refocus
-
-refocus :: X ()
-refocus = do
- ws2sc <- gets wsOnScreen
- ws <- gets workspace
- flip mapM_ (M.keys ws2sc) $ \n -> do
- mapM_ (setButtonGrab True) (W.index n ws)
- when (n == W.current ws) $
- maybe (return ()) (setButtonGrab False) (W.peekStack n ws)
-- | switchLayout. Switch to another layout scheme. Switches the current workspace.
switchLayout :: X ()
@@ -149,16 +139,20 @@ withServerX f = withDisplay $ \dpy -> do
-- | Explicitly set the keyboard focus to the given window
setFocus :: Window -> X ()
setFocus w = do
- -- Remove the border for the window no longer in focus.
ws <- gets workspace
- whenJust (W.peek ws) (\oldw -> setBorder oldw 0xdddddd)
- -- Set focus to the given window.
+ ws2sc <- gets wsOnScreen
+ -- clear mouse button grab and border on other windows
+ flip mapM_ (M.keys ws2sc) $ \n -> do
+ flip mapM_ (W.index n ws) $ \otherw -> do
+ setButtonGrab True otherw
+ setBorder otherw 0xdddddd
+
withDisplay $ \d -> io $ setInputFocus d w revertToPointerRoot 0
+ setButtonGrab False w
+ setBorder w 0xff0000
-- This does not use 'windows' intentionally. 'windows' calls refresh,
-- which means infinite loops.
modify (\s -> s { workspace = W.raiseFocus w (workspace s) })
- -- Set new border for raised window.
- setBorder w 0xff0000
-- | Set the focus to the window on top of the stack, or root
setTopFocus :: X ()