diff options
Diffstat (limited to 'XMonad/Operations.hs')
-rw-r--r-- | XMonad/Operations.hs | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs index 1723ed8..294d4a8 100644 --- a/XMonad/Operations.hs +++ b/XMonad/Operations.hs @@ -169,12 +169,12 @@ setWMState w v = withDisplay $ \dpy -> do -- | hide. Hide a window by unmapping it, and setting Iconified. hide :: Window -> X () hide w = whenX (getsWindowState wsMapped w) $ withDisplay $ \d -> do - cMask <- asks $ clientMask . config + (cMask,fMask) <- asks $ (clientMask &&& frameMask) . config frame <- getsWindowState wsFrame w io $ do selectInput d w (cMask .&. complement structureNotifyMask) - selectInput d frame (cMask .&. complement structureNotifyMask) + selectInput d frame (fMask .&. complement structureNotifyMask) unmapWindow d frame - selectInput d frame cMask + selectInput d frame fMask selectInput d w cMask setWMState w iconicState -- this part is key: we increment the waitingUnmap counter to distinguish @@ -182,6 +182,26 @@ hide w = whenX (getsWindowState wsMapped w) $ withDisplay $ \d -> do modifyWindowState (\ws -> ws { wsMapped = False , wsWaitingUnmap = (wsWaitingUnmap ws) + 1 }) w +configureClientWindow :: Window -> X () +configureClientWindow w = withDisplay $ \d -> do + (frame, bw) <- getsWindowState (wsFrame &&& wsBorderWidth) w + (_, x, y, width, height, _, _) <- io $ getGeometry d frame + let least1 n = max 1 n + x' = x + (fi $ bwLeft bw) + y' = y + (fi $ bwTop bw) + width' = least1 (width - bwLeft bw - bwRight bw) + height' = least1 (height - bwTop bw - bwBottom bw) + io $ do + moveResizeWindow d w (fi $ bwLeft bw) (fi $ bwTop bw) width' height' + -- send absolute ConfigureNotify + allocaXEvent $ \event -> do + setEventType event configureNotify + setConfigureEvent event w w (fi x') (fi y') (fi width') (fi height') 0 none False + sendEvent d w False 0 event + where + fi :: (Integral a, Num b) => a -> b + fi = fromIntegral + -- | reveal. Show a window by mapping it and setting Normal -- this is harmless if the window was already visible reveal :: Window -> X () @@ -189,25 +209,9 @@ reveal w = withDisplay $ \d -> do setWMState w normalState io $ mapWindow d w whenX (isClient w) $ do - (frame, bw) <- getsWindowState (wsFrame &&& wsBorderWidth) w - io $ do - mapWindow d frame - (_, x, y, width, height, _, _) <- getGeometry d frame - let least1 n = max 1 n - x' = x + (fi $ bwLeft bw) - y' = y + (fi $ bwTop bw) - width' = least1 (width - bwLeft bw - bwRight bw) - height' = least1 (height - bwTop bw - bwBottom bw) - moveResizeWindow d w (fi $ bwLeft bw) (fi $ bwTop bw) width' height' - -- send absolute ConfigureNotify - allocaXEvent $ \event -> do - setEventType event configureNotify - setConfigureEvent event w w (fi x') (fi y') (fi width') (fi height') 0 none False - sendEvent d w False structureNotifyMask event - modifyWindowState (\ws -> ws { wsMapped = True }) w - where - fi :: (Integral a, Num b) => a -> b - fi = fromIntegral + configureClientWindow w + getsWindowState wsFrame w >>= io . mapWindow d + modifyWindowState (\ws -> ws { wsMapped = True }) w -- | Set some properties when we initially gain control of a window setInitialProperties :: Window -> X () |