From 67a348548f34d9d2a75ee886002d4fd839988044 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 16 Mar 2020 16:13:53 +0100 Subject: 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. --- pugl/detail/x11.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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); -- cgit v1.2.1