From c04271bf6b9126f635b9b9baf173b2af5380fd84 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 17 Sep 2013 01:36:14 +0200 Subject: Add layout modifier for floating layer support --- MetaTile/Operations.hs | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) (limited to 'MetaTile/Operations.hs') diff --git a/MetaTile/Operations.hs b/MetaTile/Operations.hs index b45403f..4edf67b 100644 --- a/MetaTile/Operations.hs +++ b/MetaTile/Operations.hs @@ -25,7 +25,6 @@ import Data.Maybe import Data.Monoid (Endo(..)) import Data.List (nub, (\\), find) import Data.Bits ((.|.), (.&.), complement, testBit) -import Data.Ratio import qualified Data.Map as M import Control.Applicative @@ -160,12 +159,6 @@ windows f = do setWindowBackground d frame p clearWindow d frame --- | Produce the actual rectangle from a screen and a ratio on that screen. -scaleRationalRect :: Rectangle -> W.RationalRect -> Rectangle -scaleRationalRect (Rectangle sx sy sw sh) (W.RationalRect rx ry rw rh) - = Rectangle (sx + scale sw rx) (sy + scale sh ry) (scale sw rw) (scale sh rh) - where scale s r = floor (toRational s * r) - -- | setWMState. set the WM_STATE property setWMState :: Window -> Int -> X () setWMState w v = withDisplay $ \dpy -> do @@ -255,6 +248,7 @@ tileWindow w r bw = withDisplay $ \d -> do modifyFrameState (\fs -> fs {fsBorderWidth = bw}) frame io $ moveResizeWindow d frame (rect_x r) (rect_y r) (least $ rect_width r) (least $ rect_height r) + -- --------------------------------------------------------------------- -- | Returns 'True' if the first rectangle is contained within, but not equal @@ -453,22 +447,6 @@ restart prog resume = do -- | 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 w = withDisplay $ \d -> do - ws <- gets windowset - wa <- io $ getWindowAttributes d w - let bw = (fromIntegral . wa_border_width) wa - sc <- fromMaybe (W.current ws) <$> pointScreen (fi $ wa_x wa) (fi $ wa_y wa) - - 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)) - (fi (wa_height wa + bw*2) % fi (rect_height sr)) - - 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)) @@ -483,17 +461,6 @@ pointWithin x y r = x >= rect_x r && y >= rect_y r && y < rect_y r + fromIntegral (rect_height r) --- | Make a tiled window floating, using its suggested rectangle -{-float :: Window -> X () -float w = do - (sc, rr) <- floatLocation w - windows $ \ws -> W.float w rr . fromMaybe ws $ do - i <- W.findTag w ws - guard $ i `elem` concatMap (map W.tag . W.screenWorkspaces) (W.screens ws) - f <- W.peek ws - sw <- W.lookupWorkspace sc ws - return (W.focusWindow f . W.shiftWin sw w $ ws)-} - -- --------------------------------------------------------------------- -- Mouse handling -- cgit v1.2.3