From 24e01570bc776f20fb9e26f995bdfc22517fad04 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Fri, 8 Feb 2008 09:36:02 +0100 Subject: Decoration: enable mouse dragging of windows darcs-hash:20080208083602-32816-a0078da982c632ab686ec368b5055dca63ce0180.gz --- XMonad/Layout/Decoration.hs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'XMonad/Layout/Decoration.hs') 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 -- cgit v1.2.3