From 80814b7dba92d831dce66c81d04320af15be8023 Mon Sep 17 00:00:00 2001 From: "Carlos R. Mafra" Date: Wed, 22 Sep 2010 16:21:11 +0200 Subject: [PATCH] XRandR temporary amendments If we Restart() directly, the windows with titlebars come back N pixels below their original positions before the xrandr-induced restart, where N is the titlebar height. To avoid this issue, let's do the proper restart preparation before actually calling Restart(). Let's also grab ConfigureNotify in the event loop as in the patch here: http://lists.kde.org/?l=kwin&m=116429907520188&w=2 (thanks to Tamas for pointing it out). Signed-off-by: Carlos R. Mafra --- src/event.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/event.c b/src/event.c index 45e4122c..80df6efc 100644 --- a/src/event.c +++ b/src/event.c @@ -292,6 +292,15 @@ void DispatchEvent(XEvent * event) case VisibilityNotify: handleVisibilityNotify(event); break; + + case ConfigureNotify: + if (event->xconfigure.window == DefaultRootWindow(dpy)) { +#ifdef HAVE_XRANDR + XRRUpdateConfiguration(event); +#endif + } + break; + default: handleExtensions(event); break; @@ -572,8 +581,15 @@ static void handleExtensions(XEvent * event) } #endif /*KEEP_XKB_LOCK_STATUS */ #ifdef HAVE_XRANDR - if (has_randr && event->type == (randr_event_base + RRScreenChangeNotify)) + if (has_randr && event->type == (randr_event_base + RRScreenChangeNotify)) { + /* From xrandr man page: "Clients must call back into Xlib using + * XRRUpdateConfiguration when screen configuration change notify + * events are generated */ + XRRUpdateConfiguration(event); + WCHANGE_STATE(WSTATE_RESTARTING); + Shutdown(WSRestartPreparationMode); Restart(NULL,True); + } #endif }