aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-02-09 17:51:01 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-02-09 17:51:01 +0100
commit0c58364ee4dd32d5e8b65440d09b586d458d3a9c (patch)
tree5c327ce2943bda399387390203c4e77a23f15d11 /XMonad/Layout
parent279239e4b6ad9f6c559deb456a13856113f614a7 (diff)
downloadXMonadContrib-0c58364ee4dd32d5e8b65440d09b586d458d3a9c.tar.gz
XMonadContrib-0c58364ee4dd32d5e8b65440d09b586d458d3a9c.tar.xz
XMonadContrib-0c58364ee4dd32d5e8b65440d09b586d458d3a9c.zip
Decoration: change mouseEventHook to decoEventHook and more
Fix also the problem with window's movement when the grabbing starts darcs-hash:20080209165101-32816-9309b3cf4be37f3e33c893e5520780f356f48831.gz
Diffstat (limited to 'XMonad/Layout')
-rw-r--r--XMonad/Layout/Decoration.hs33
1 files changed, 18 insertions, 15 deletions
diff --git a/XMonad/Layout/Decoration.hs b/XMonad/Layout/Decoration.hs
index eb5be36..72051fe 100644
--- a/XMonad/Layout/Decoration.hs
+++ b/XMonad/Layout/Decoration.hs
@@ -36,8 +36,8 @@ import XMonad
import qualified XMonad.StackSet as W
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.LayoutModifier
-import XMonad.Layout.WindowArranger
-import XMonad.Util.NamedWindows
+import XMonad.Layout.WindowArranger (WindowArrangerMsg (..), diff, listFromList)
+import XMonad.Util.NamedWindows (getName)
import XMonad.Util.Invisible
import XMonad.Util.XUtils
import XMonad.Util.Font
@@ -105,18 +105,21 @@ class (Read (ds a), Show (ds a)) => DecorationStyle ds a where
shrink :: ds a -> Rectangle -> Rectangle -> Rectangle
shrink _ (Rectangle _ _ _ dh) (Rectangle x y w h) = Rectangle x (y + fi dh) w (h - dh)
- mouseEventHook :: ds a -> DecorationState -> Event -> X ()
- mouseEventHook _ (DS dwrs@(((_,r),(dw,_)):_) _) e
- | ButtonEvent {ev_window = ew, ev_event_type = ty} <- e
- , ty == buttonPress, dw == ew = mouseDrag (\ex ey -> do
- let rect = Rectangle ex ey (rect_width r) (rect_height r)
- sendMessage (SetGeometry rect))
- (return ())
- | ButtonEvent {ev_window = ew, ev_event_type = ty} <- e
- , ty == buttonPress
+ decoEventHook :: ds a -> DecorationState -> Event -> X ()
+ decoEventHook _ (DS dwrs@(((_,r),(dw,_)):_) _) ButtonEvent { ev_window = ew
+ , ev_event_type = et
+ , ev_x_root = ex
+ , ev_y_root = ey }
+ | et == buttonPress
+ , ew == dw = mouseDrag (\x y -> do
+ let rect = Rectangle (x - (fi ex - rect_x r))
+ (y - (fi ey - rect_y r))
+ (rect_width r)
+ (rect_height r)
+ sendMessage (SetGeometry rect)) (return ())
+ | et == buttonPress
, Just ((mainw,_),_) <- lookFor ew dwrs = focus mainw
-
- mouseEventHook _ _ _ = return ()
+ decoEventHook _ _ _ = return ()
pureDecoration :: ds a -> Dimension -> Dimension -> Rectangle
-> W.Stack a -> [(a,Rectangle)] -> (a,Rectangle) -> Maybe Rectangle
@@ -171,8 +174,8 @@ instance (DecorationStyle ds Window, Shrinker s) => LayoutModifier (Decoration d
return (insert_dwr [] ndwrs, Just (Decoration (I (Just (s {decos = ndwrs}))) sh t ds))
handleMess (Decoration (I (Just s@(DS {decos = dwrs}))) sh t ds) m
- | Just e <- fromMessage m :: Maybe Event = do mouseEventHook ds s e
- handleEvent sh t s e
+ | Just e <- fromMessage m :: Maybe Event = do decoEventHook ds s e
+ handleEvent sh t s e
return Nothing
| Just Hide <- fromMessage m = do hideWindows (getDWs dwrs)
return Nothing