summaryrefslogtreecommitdiffstats
path: root/lib/Phi/Widget.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Phi/Widget.hs')
-rw-r--r--lib/Phi/Widget.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Phi/Widget.hs b/lib/Phi/Widget.hs
index 6a2a9f6..7bce659 100644
--- a/lib/Phi/Widget.hs
+++ b/lib/Phi/Widget.hs
@@ -3,6 +3,7 @@
module Phi.Widget ( Display(..)
, withDisplay
, getAtoms
+ , getScreenWindows
, getScreens
, unionArea
, Widget(..)
@@ -28,7 +29,7 @@ import Phi.Phi
import Phi.X11.Atoms
-data Display = Display (MVar Xlib.Display) Atoms [Xlib.Rectangle]
+data Display = Display (MVar Xlib.Display) Atoms [(Xlib.Rectangle, Xlib.Window)]
withDisplay :: MonadIO m => Display -> (Xlib.Display -> m a) -> m a
withDisplay (Display dispvar _ _) f = do
@@ -40,8 +41,12 @@ withDisplay (Display dispvar _ _) f = do
getAtoms :: Display -> Atoms
getAtoms (Display _ atoms _) = atoms
+getScreenWindows :: Display -> [(Xlib.Rectangle, Xlib.Window)]
+getScreenWindows (Display _ _ screenWindows) = screenWindows
+
getScreens :: Display -> [Xlib.Rectangle]
-getScreens (Display _ _ screens) = screens
+getScreens = map fst . getScreenWindows
+
unionArea :: Xlib.Rectangle -> Xlib.Rectangle -> Int
unionArea a b = fromIntegral $ uw*uh