From 7337ce50c2cd5767a02d27276983e3768db8d333 Mon Sep 17 00:00:00 2001 From: Dominik Bruhn Date: Wed, 12 Nov 2008 13:46:30 +0000 Subject: [PATCH] Simplify code for restriction-calculation and remove compiletime warnings --- XMonad/Actions/GridSelect.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/XMonad/Actions/GridSelect.hs b/XMonad/Actions/GridSelect.hs index 3ea97a44..05dde607 100644 --- a/XMonad/Actions/GridSelect.hs +++ b/XMonad/Actions/GridSelect.hs @@ -237,8 +237,10 @@ gridselect gsconfig = screenHeight = toInteger $ rect_height s; selectedWindow <- if (status == grabSuccess) then do - let restrictX = floor $ ((fromInteger screenWidth)/(fromInteger $ gs_cellwidth gsconfig)-1)/2 ; - restrictY = floor $ ((fromInteger screenHeight)/(fromInteger $ gs_cellheight gsconfig)-1)/2 ; + let restriction :: Integer -> (GSConfig -> Integer) -> Double + restriction ss cs = ((fromInteger ss)/(fromInteger $ cs gsconfig)-1)/2 + restrictX = floor $ restriction screenWidth gs_cellwidth + restrictY = floor $ restriction screenHeight gs_cellheight winmap = zipWith (,) (diamondRestrict restrictX restrictY) windowList selectedWindow <- evalStateT (do updateAllWindows; eventLoop) (TwoDState (0,0)