From d6aa67a7a262231a56237e14607dd950dff7ccd0 Mon Sep 17 00:00:00 2001 From: robreim Date: Sat, 8 Mar 2008 02:58:29 +0100 Subject: Change floats to always use the current screen darcs-hash:20080308015829-d4c7e-f805bfa622e5fc0dfe054bd12c827ca666351794 --- XMonad/Operations.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'XMonad/Operations.hs') diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs index 46eebf8..33368f4 100644 --- a/XMonad/Operations.hs +++ b/XMonad/Operations.hs @@ -56,7 +56,7 @@ manage w = whenX (not <$> isClient w) $ withDisplay $ \d -> do let isFixedSize = sh_min_size sh /= Nothing && sh_min_size sh == sh_max_size sh isTransient <- isJust <$> io (getTransientForHint d w) - (sc, rr) <- floatLocation w + rr <- floatLocation w -- ensure that float windows don't go over the edge of the screen let adjust (W.RationalRect x y wid h) | x + wid > 1 || y + h > 1 || x < 0 || y < 0 = W.RationalRect (0.5 - wid/2) (0.5 - h/2) wid h @@ -64,7 +64,7 @@ manage w = whenX (not <$> isClient w) $ withDisplay $ \d -> do f ws | isFixedSize || isTransient = W.float w (adjust rr) . W.insertUp w . W.view i $ ws | otherwise = W.insertUp w ws - where i = fromMaybe (W.tag . W.workspace . W.current $ ws) $ W.lookupWorkspace sc ws + where i = W.tag $ W.workspace $ W.current ws mh <- asks (manageHook . config) g <- fmap appEndo (runQuery mh w) `catchX` return id @@ -392,7 +392,7 @@ initColor dpy c = C.handle (\_ -> return Nothing) $ -- | Given a window, find the screen it is located on, and compute -- the geometry of that window wrt. that screen. -floatLocation :: Window -> X (ScreenId, W.RationalRect) +floatLocation :: Window -> X (W.RationalRect) floatLocation w = withDisplay $ \d -> do ws <- gets windowset wa <- io $ getWindowAttributes d w @@ -406,7 +406,7 @@ floatLocation w = withDisplay $ \d -> do (fi (wa_width wa + bw*2) % fi (rect_width sr)) (fi (wa_height wa + bw*2) % fi (rect_height sr)) - return (W.screen $ sc, rr) + return rr where fi x = fromIntegral x pointWithin :: Integer -> Integer -> Rectangle -> Bool pointWithin x y r = x >= fi (rect_x r) && @@ -417,8 +417,9 @@ floatLocation w = withDisplay $ \d -> do -- | Make a tiled window floating, using its suggested rectangle float :: Window -> X () float w = do - (sc, rr) <- floatLocation w + rr <- floatLocation w windows $ \ws -> W.float w rr . fromMaybe ws $ do + let sc = W.screen $ W.current ws i <- W.findTag w ws guard $ i `elem` map (W.tag . W.workspace) (W.screens ws) f <- W.peek ws -- cgit v1.2.3