diff options
author | Spencer Janssen <spencerjanssen@gmail.com> | 2008-10-07 11:42:07 +0200 |
---|---|---|
committer | Spencer Janssen <spencerjanssen@gmail.com> | 2008-10-07 11:42:07 +0200 |
commit | dc4906849164ff1bfbeb75decd91f5aac1b6db06 (patch) | |
tree | 0d7e2666feed1d951f0b1cb508324c31fc03c0ab | |
parent | 6ebe2fb77eebdc2b0b9baa5d56a4e2061153abe9 (diff) | |
download | xmonad-dc4906849164ff1bfbeb75decd91f5aac1b6db06.tar.gz xmonad-dc4906849164ff1bfbeb75decd91f5aac1b6db06.tar.xz xmonad-dc4906849164ff1bfbeb75decd91f5aac1b6db06.zip |
Move screen locating code into pointScreen
darcs-hash:20081007094207-25a6b-8575bf757041b0d1bf2afb879fccf3a6a73b7763.gz
-rw-r--r-- | XMonad/Operations.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/XMonad/Operations.hs b/XMonad/Operations.hs index 41e5790..8c10e13 100644 --- a/XMonad/Operations.hs +++ b/XMonad/Operations.hs @@ -412,10 +412,9 @@ floatLocation w = withDisplay $ \d -> do ws <- gets windowset wa <- io $ getWindowAttributes d w bw <- fi <$> asks (borderWidth . config) + sc <- fromMaybe (W.current ws) <$> pointScreen (fi $ wa_x wa) (fi $ wa_y wa) - -- XXX horrible - let sc = fromMaybe (W.current ws) $ find (pointWithin (fi $ wa_x wa) (fi $ wa_y wa) . screenRect . W.screenDetail) $ W.screens ws - sr = screenRect . W.screenDetail $ sc + let sr = screenRect . W.screenDetail $ sc rr = W.RationalRect ((fi (wa_x wa) - fi (rect_x sr)) % fi (rect_width sr)) ((fi (wa_y wa) - fi (rect_y sr)) % fi (rect_height sr)) (fi (wa_width wa + bw*2) % fi (rect_width sr)) @@ -424,6 +423,12 @@ floatLocation w = withDisplay $ \d -> do return (W.screen $ sc, rr) where fi x = fromIntegral x +-- | Given a point, determine the screen (if any) that contains it. +pointScreen :: Position -> Position + -> X (Maybe (W.Screen WorkspaceId (Layout Window) Window ScreenId ScreenDetail)) +pointScreen x y = withWindowSet $ return . find p . W.screens + where p = pointWithin x y . screenRect . W.screenDetail + -- | 'pointWithin x y r' returns 'True' if the '(x, y)' co-ordinate is within -- the 'Rectangle'. pointWithin :: Position -> Position -> Rectangle -> Bool |