aboutsummaryrefslogtreecommitdiffstats
path: root/Warp.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-06-30 08:59:16 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-06-30 08:59:16 +0200
commitccaac642dea074e397058f1a6a877673e54a86fe (patch)
treeb302bd348a5d1131452f770d6faffb934c31a2b5 /Warp.hs
parent279e1da8e4e1cef7cd5eb71de2c1bb80c389c871 (diff)
downloadXMonadContrib-ccaac642dea074e397058f1a6a877673e54a86fe.tar.gz
XMonadContrib-ccaac642dea074e397058f1a6a877673e54a86fe.tar.xz
XMonadContrib-ccaac642dea074e397058f1a6a877673e54a86fe.zip
More ScreenDetails fixes
darcs-hash:20070630065916-a5988-433e92903a6530e5efe8f36c3af60339cb9876ec.gz
Diffstat (limited to 'Warp.hs')
-rw-r--r--Warp.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/Warp.hs b/Warp.hs
index 43a833f..df186e6 100644
--- a/Warp.hs
+++ b/Warp.hs
@@ -22,11 +22,13 @@ module XMonadContrib.Warp (
import Data.Ratio
import Data.Maybe
+import Data.List
import Control.Monad.RWS
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras
import Operations
import XMonad
+import StackSet as W
{- $usage
This can be used to make a keybinding that warps the pointer to a given
@@ -59,10 +61,11 @@ warpToWindow h v =
wa <- io $ getWindowAttributes d w
warp w (fraction h (wa_width wa)) (fraction v (wa_height wa))
-warpToScreen :: Int -> Rational -> Rational -> X ()
+warpToScreen :: ScreenId -> Rational -> Rational -> X ()
warpToScreen n h v = do
- xScreens <- gets xineScreens
- root <- asks theRoot
- whenJust (ix n xScreens) $ \r ->
- warp root (rect_x r + fraction h (rect_width r))
- (rect_y r + fraction v (rect_height r))
+ root <- asks theRoot
+ (StackSet {current = x, visible = xs}) <- gets windowset
+ whenJust (fmap (screenRect . W.screenDetail) . find ((n==) . W.screen) $ x : xs)
+ $ \r ->
+ warp root (rect_x r + fraction h (rect_width r))
+ (rect_y r + fraction v (rect_height r))