aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-03-16 16:13:53 +0100
committerDavid Robillard <d@drobilla.net>2020-03-16 16:13:53 +0100
commit67a348548f34d9d2a75ee886002d4fd839988044 (patch)
treeb239152b1ea3a2791430709829679fff9d165f83
parentaee7dd61cce24125f07156ba2c726eb65b9c26d9 (diff)
X11: Dispatch a configure event before the map for child windows
It does not seem to be guaranteed that child windows receive a ConfigureNotify at all. Work around this by explicitly dispatching one first, so child views receive events consistently with how top level views do.
-rw-r--r--pugl/detail/x11.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c
index 72dcf59..3684e46 100644
--- a/pugl/detail/x11.c
+++ b/pugl/detail/x11.c
@@ -822,6 +822,15 @@ puglDispatchX11Events(PuglWorld* world)
view->frame.y = event.configure.y;
view->frame.width = event.configure.width;
view->frame.height = event.configure.height;
+ } else if (event.type == PUGL_MAP && view->parent) {
+ XWindowAttributes attrs;
+ XGetWindowAttributes(view->impl->display, view->impl->win, &attrs);
+
+ const PuglEventConfigure configure = {
+ PUGL_CONFIGURE, 0, attrs.x, attrs.y, attrs.width, attrs.height};
+
+ puglDispatchEvent(view, (const PuglEvent*)&configure);
+ puglDispatchEvent(view, &event);
} else {
// Dispatch event to application immediately
puglDispatchEvent(view, &event);