mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-05 06:31:54 -07:00
Revert float location patch. Not Xinerama safe
This commit is contained in:
@@ -71,7 +71,7 @@ doF = return . Endo
|
|||||||
|
|
||||||
-- | Move the window to the floating layer.
|
-- | Move the window to the floating layer.
|
||||||
doFloat :: ManageHook
|
doFloat :: ManageHook
|
||||||
doFloat = ask >>= \w -> doF . W.float w =<< liftX (floatLocation w)
|
doFloat = ask >>= \w -> doF . W.float w . snd =<< liftX (floatLocation w)
|
||||||
|
|
||||||
-- | Map the window and remove it from the 'WindowSet'.
|
-- | Map the window and remove it from the 'WindowSet'.
|
||||||
doIgnore :: ManageHook
|
doIgnore :: ManageHook
|
||||||
|
@@ -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
|
let isFixedSize = sh_min_size sh /= Nothing && sh_min_size sh == sh_max_size sh
|
||||||
isTransient <- isJust <$> io (getTransientForHint d w)
|
isTransient <- isJust <$> io (getTransientForHint d w)
|
||||||
|
|
||||||
rr <- floatLocation w
|
(sc, rr) <- floatLocation w
|
||||||
-- ensure that float windows don't go over the edge of the screen
|
-- 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
|
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
|
= 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
|
f ws | isFixedSize || isTransient = W.float w (adjust rr) . W.insertUp w . W.view i $ ws
|
||||||
| otherwise = W.insertUp w ws
|
| otherwise = W.insertUp w ws
|
||||||
where i = W.tag $ W.workspace $ W.current ws
|
where i = fromMaybe (W.tag . W.workspace . W.current $ ws) $ W.lookupWorkspace sc ws
|
||||||
|
|
||||||
mh <- asks (manageHook . config)
|
mh <- asks (manageHook . config)
|
||||||
g <- fmap appEndo (runQuery mh w) `catchX` return id
|
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
|
-- | Given a window, find the screen it is located on, and compute
|
||||||
-- the geometry of that window wrt. that screen.
|
-- the geometry of that window wrt. that screen.
|
||||||
floatLocation :: Window -> X (W.RationalRect)
|
floatLocation :: Window -> X (ScreenId, W.RationalRect)
|
||||||
floatLocation w = withDisplay $ \d -> do
|
floatLocation w = withDisplay $ \d -> do
|
||||||
ws <- gets windowset
|
ws <- gets windowset
|
||||||
wa <- io $ getWindowAttributes d w
|
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_width wa + bw*2) % fi (rect_width sr))
|
||||||
(fi (wa_height wa + bw*2) % fi (rect_height sr))
|
(fi (wa_height wa + bw*2) % fi (rect_height sr))
|
||||||
|
|
||||||
return rr
|
return (W.screen $ sc, rr)
|
||||||
where fi x = fromIntegral x
|
where fi x = fromIntegral x
|
||||||
pointWithin :: Integer -> Integer -> Rectangle -> Bool
|
pointWithin :: Integer -> Integer -> Rectangle -> Bool
|
||||||
pointWithin x y r = x >= fi (rect_x r) &&
|
pointWithin x y r = x >= fi (rect_x r) &&
|
||||||
@@ -417,12 +417,12 @@ floatLocation w = withDisplay $ \d -> do
|
|||||||
-- | Make a tiled window floating, using its suggested rectangle
|
-- | Make a tiled window floating, using its suggested rectangle
|
||||||
float :: Window -> X ()
|
float :: Window -> X ()
|
||||||
float w = do
|
float w = do
|
||||||
rr <- floatLocation w
|
(sc, rr) <- floatLocation w
|
||||||
windows $ \ws -> W.float w rr . fromMaybe ws $ do
|
windows $ \ws -> W.float w rr . fromMaybe ws $ do
|
||||||
i <- W.findTag w ws
|
i <- W.findTag w ws
|
||||||
guard $ i `elem` map (W.tag . W.workspace) (W.screens ws)
|
guard $ i `elem` map (W.tag . W.workspace) (W.screens ws)
|
||||||
f <- W.peek ws
|
f <- W.peek ws
|
||||||
sw <- W.lookupWorkspace (W.screen $ W.current ws) ws
|
sw <- W.lookupWorkspace sc ws
|
||||||
return (W.focusWindow f . W.shiftWin sw w $ ws)
|
return (W.focusWindow f . W.shiftWin sw w $ ws)
|
||||||
|
|
||||||
-- ---------------------------------------------------------------------
|
-- ---------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user