aboutsummaryrefslogtreecommitdiffstats
path: root/Main.hs
diff options
context:
space:
mode:
authorStefan O'Rear <stefanor@cox.net>2007-06-03 22:31:53 +0200
committerStefan O'Rear <stefanor@cox.net>2007-06-03 22:31:53 +0200
commitfed0b6d56eeb2e68447f1b3a6d5bebd742463291 (patch)
tree6c71a5545fb3556cf36b1f4d8d63483d148f985a /Main.hs
parent05525798cb71fcb931b2b991b57ff06e4e533ec8 (diff)
downloadxmonad-fed0b6d56eeb2e68447f1b3a6d5bebd742463291.tar.gz
xmonad-fed0b6d56eeb2e68447f1b3a6d5bebd742463291.tar.xz
xmonad-fed0b6d56eeb2e68447f1b3a6d5bebd742463291.zip
Correctly handle resize requests (-12 +22)
Xmonad now implements resize requests in a consistent manner. * If the window is FLOATING, we implement the program's request, and correctly update the StackSet; so it will keep the new size. This should work correctly even for non-current windows. * Otherwise, we ignore the request. As per ICCCM, we send a fake ConfigureNotify containing the new (unchanged) geometry. This is perfectly ICCCM compliant, and if it breaks your client, it's your own fault. This patch requires setConfigureEvent, which is added to X11-extras by a patch approximately contemporaneous with this one. darcs-hash:20070603203153-e3110-48f345cd3686f06fbe8ba30a6d851e7c8f44fe98.gz
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs34
1 files changed, 22 insertions, 12 deletions
diff --git a/Main.hs b/Main.hs
index 1d759e9..467c630 100644
--- a/Main.hs
+++ b/Main.hs
@@ -16,6 +16,7 @@
import Data.Bits
import qualified Data.Map as M
import Control.Monad.Reader
+import Control.Monad.State
import System.Environment (getArgs)
@@ -25,7 +26,7 @@ import Graphics.X11.Xinerama (getScreenInfo)
import XMonad
import Config
-import StackSet (new)
+import StackSet (new, floating)
import Operations
--
@@ -181,17 +182,26 @@ handle e@(CrossingEvent {ev_event_type = t})
when (ev_window e == rootw && not (ev_same_screen e)) $ setFocusX rootw
-- configure a window
-handle e@(ConfigureRequestEvent {}) = withDisplay $ \dpy -> do
- io $ configureWindow dpy (ev_window e) (ev_value_mask e) $ WindowChanges
- { wc_x = ev_x e
- , wc_y = ev_y e
- , wc_width = ev_width e
- , wc_height = ev_height e
- , wc_border_width = ev_border_width e
- , wc_sibling = ev_above e
- -- this fromIntegral is only necessary with the old X11 version that uses
- -- Int instead of CInt. TODO delete it when there is a new release of X11
- , wc_stack_mode = fromIntegral $ ev_detail e }
+handle e@(ConfigureRequestEvent {ev_window = w}) = withDisplay $ \dpy -> do
+ floating <- gets $ M.member w . floating . windowset
+ rootw <- asks theRoot
+ wa <- io $ getWindowAttributes dpy w
+
+ if floating
+ then do io $ configureWindow dpy w (ev_value_mask e) $ WindowChanges
+ { wc_x = ev_x e
+ , wc_y = ev_y e
+ , wc_width = ev_width e
+ , wc_height = ev_height e
+ , wc_border_width = fromIntegral borderWidth
+ , wc_sibling = ev_above e
+ , wc_stack_mode = ev_detail e }
+ float w
+ else io $ allocaXEvent $ \ev -> do
+ setEventType ev configureNotify
+ setConfigureEvent ev w w
+ (wa_x wa) (wa_y wa) (wa_width wa) (wa_height wa) (ev_border_width e) none (wa_override_redirect wa)
+ sendEvent dpy w False 0 ev
io $ sync dpy False
-- the root may have configured