aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-02-08 09:36:02 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-02-08 09:36:02 +0100
commit24e01570bc776f20fb9e26f995bdfc22517fad04 (patch)
treefdfd29e33e140c0e1a9b5cdb49144da9a5731ab9 /XMonad
parentfa152381f4e0922fa5b2641eb495775a44463925 (diff)
downloadXMonadContrib-24e01570bc776f20fb9e26f995bdfc22517fad04.tar.gz
XMonadContrib-24e01570bc776f20fb9e26f995bdfc22517fad04.tar.xz
XMonadContrib-24e01570bc776f20fb9e26f995bdfc22517fad04.zip
Decoration: enable mouse dragging of windows
darcs-hash:20080208083602-32816-a0078da982c632ab686ec368b5055dca63ce0180.gz
Diffstat (limited to 'XMonad')
-rw-r--r--XMonad/Layout/Decoration.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/XMonad/Layout/Decoration.hs b/XMonad/Layout/Decoration.hs
index 3323e37..eb5be36 100644
--- a/XMonad/Layout/Decoration.hs
+++ b/XMonad/Layout/Decoration.hs
@@ -26,7 +26,7 @@ module XMonad.Layout.Decoration
, shrinkText, CustomShrink ( CustomShrink )
, Shrinker (..), DefaultShrinker
, module XMonad.Layout.LayoutModifier
- , isDecoration, fi
+ , isDecoration, fi, lookFor
) where
import Data.Maybe
@@ -106,10 +106,16 @@ class (Read (ds a), Show (ds a)) => DecorationStyle ds a where
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 _) e
- | ButtonEvent {ev_window = w,ev_event_type = ty} <- e,
- ty == buttonPress,
- Just ((mainw,_),_) <- lookFor w dwrs = focus mainw
+ 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
+ , Just ((mainw,_),_) <- lookFor ew dwrs = focus mainw
+
mouseEventHook _ _ _ = return ()
pureDecoration :: ds a -> Dimension -> Dimension -> Rectangle