From cbf5046f8de5b420c734903c7a4a46e9e3897293 Mon Sep 17 00:00:00 2001 From: Richard Molitor Date: Sat, 14 Nov 2015 23:53:02 +0100 Subject: events: also react to ConfigureNotify after mapping --- src/events.c | 3 +-- src/events.h | 2 ++ src/winwidget.c | 10 ++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/events.c b/src/events.c index 2142408..876c7c4 100644 --- a/src/events.c +++ b/src/events.c @@ -41,7 +41,6 @@ feh_event_handler *ev_handler[LASTEvent]; static void feh_event_handle_ButtonPress(XEvent * ev); static void feh_event_handle_ButtonRelease(XEvent * ev); -static void feh_event_handle_ConfigureNotify(XEvent * ev); static void feh_event_handle_LeaveNotify(XEvent * ev); static void feh_event_handle_MotionNotify(XEvent * ev); static void feh_event_handle_ClientMessage(XEvent * ev); @@ -416,7 +415,7 @@ static void feh_event_handle_ButtonRelease(XEvent * ev) return; } -static void feh_event_handle_ConfigureNotify(XEvent * ev) +void feh_event_handle_ConfigureNotify(XEvent * ev) { while (XCheckTypedWindowEvent(disp, ev->xconfigure.window, ConfigureNotify, ev)); if (!menu_root) { diff --git a/src/events.h b/src/events.h index 195f268..f334c58 100644 --- a/src/events.h +++ b/src/events.h @@ -32,4 +32,6 @@ extern feh_event_handler *ev_handler[]; void feh_event_init(void); +void feh_event_handle_ConfigureNotify(XEvent * ev); + #endif diff --git a/src/winwidget.c b/src/winwidget.c index 8bf1dbb..7f0a0d9 100644 --- a/src/winwidget.c +++ b/src/winwidget.c @@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "filelist.h" #include "winwidget.h" #include "options.h" +#include "events.h" static void winwidget_unregister(winwidget win); static void winwidget_register(winwidget win); @@ -776,6 +777,15 @@ void winwidget_show(winwidget winwid) /* wait for the window to map */ D(("Waiting for window to map\n")); XMaskEvent(disp, StructureNotifyMask, &ev); + /* Unfortunately, StructureNotifyMask does not only mask + * the events of type MapNotify (which we want to mask here) + * but also such of type ConfigureNotify (and others, see + * https://tronche.com/gui/x/xlib/events/processing-overview.html), + * which should be handled, especially on tiling wm's. To + * remedy this, the handler is executed explicitly: + */ + if (ev.type == ConfigureNotify) + feh_event_handle_ConfigureNotify(&ev); D(("Window mapped\n")); winwid->visible = 1; } -- cgit v1.2.3