From f3606efc44b3b039f4c5d4773e81298408942def Mon Sep 17 00:00:00 2001 From: Adam Vogt Date: Fri, 2 Oct 2009 00:57:36 +0200 Subject: Use U.XUtils.fi to make WindowMenu clearer Ignore-this: 63e73cd7c5de22b3e30e63c1e588e403 darcs-hash:20091001225736-1499c-f4a5094a0cd4b718906e34e8ad1c47f963acc37a.gz --- XMonad/Actions/WindowMenu.hs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/XMonad/Actions/WindowMenu.hs b/XMonad/Actions/WindowMenu.hs index 6183c35..24858e7 100644 --- a/XMonad/Actions/WindowMenu.hs +++ b/XMonad/Actions/WindowMenu.hs @@ -25,6 +25,7 @@ import qualified XMonad.StackSet as W import XMonad.Actions.GridSelect import XMonad.Layout.Maximize import XMonad.Layout.Minimize +import XMonad.Util.XUtils (fi) -- $usage -- @@ -47,14 +48,12 @@ windowMenu = withFocused $ \w -> do tags <- asks (workspaces . config) Rectangle x y wh ht <- getSize w Rectangle sx sy swh sht <- gets $ screenRect . W.screenDetail . W.current . windowset - let originFractX = (fromIntegral x - fromIntegral sx + (fromIntegral wh / 2)) - / fromIntegral swh - originFractY = (fromIntegral y -fromIntegral sy + (fromIntegral ht / 2)) - / fromIntegral sht + let originFractX = (fi x - fi sx + fi wh / 2) / fi swh + originFractY = (fi y - fi sy + fi ht / 2) / fi sht colorizer = simpleColorizer nBC fBC - gsConfig = buildDefaultGSConfig colorizer - gsConfig' = gsConfig { gs_originFractX = originFractX, - gs_originFractY = originFractY } + gsConfig = (buildDefaultGSConfig colorizer) + { gs_originFractX = originFractX + , gs_originFractY = originFractY } actions = [ ("Cancel menu", return ()) , ("Close" , kill) , ("Maximize" , sendMessage $ maximizeRestore w) @@ -62,14 +61,14 @@ windowMenu = withFocused $ \w -> do ] ++ [ ("Move to " ++ tag, windows $ W.shift tag) | tag <- tags ] - runSelectedAction gsConfig' actions + runSelectedAction gsConfig actions getSize :: Window -> X (Rectangle) getSize w = do d <- asks display wa <- io $ getWindowAttributes d w - let x = fromIntegral $ wa_x wa - y = fromIntegral $ wa_y wa - wh = fromIntegral $ wa_width wa - ht = fromIntegral $ wa_height wa + let x = fi $ wa_x wa + y = fi $ wa_y wa + wh = fi $ wa_width wa + ht = fi $ wa_height wa return (Rectangle x y wh ht) -- cgit v1.2.3