From 3cfd3a498b90fe9e7132b42ccaa79f94afa0086b Mon Sep 17 00:00:00 2001 From: Cameron Leger Date: Sun, 21 Oct 2018 17:02:08 -0600 Subject: [PATCH] Reorder XWindow creation, callback, and reparent --- dep/lglw/lglw_linux.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/dep/lglw/lglw_linux.c b/dep/lglw/lglw_linux.c index 0498f1d7..fd1109b7 100644 --- a/dep/lglw/lglw_linux.c +++ b/dep/lglw/lglw_linux.c @@ -658,6 +658,18 @@ lglw_bool_t lglw_window_open (lglw_t _lglw, void *_parentHWNDOrNull, int32_t _x, NULL/*XSizeHints*/ ); + // Setup the event proc now, on the parent window as well just for the debug host + // It was simpler to do this than check in the debug host for the reparent event + lglw_log("lglw:lglw_window_open: 7\n"); + loc_setEventProc(lglw->xdsp, lglw->win.xwnd); + loc_setProperty(lglw->xdsp, lglw->win.xwnd, "_lglw", (void*)lglw); // set instance pointer + + if(0 != _parentHWNDOrNull) + { + loc_setEventProc(lglw->xdsp, lglw->parent_xwnd); + loc_setProperty(lglw->xdsp, lglw->parent_xwnd, "_lglw", (void*)lglw); // set instance pointer + } + // Some hosts only check and store the callback when the Window is reparented // Since creating the Window with a Parent may or may not do that, but the callback is not set, // ... it's created as a root window, the callback is set, and then it's reparented @@ -665,7 +677,7 @@ lglw_bool_t lglw_window_open (lglw_t _lglw, void *_parentHWNDOrNull, int32_t _x, // (note) [cameronleger] In Ardour's code-base, the only time it looks for the _XEventProc is during a ReparentNotify event if (0 != _parentHWNDOrNull) { - lglw_log("lglw:lglw_window_open: 7\n"); + lglw_log("lglw:lglw_window_open: 8\n"); XReparentWindow(lglw->xdsp, lglw->win.xwnd, lglw->parent_xwnd, 0, 0); } #endif @@ -675,18 +687,6 @@ lglw_bool_t lglw_window_open (lglw_t _lglw, void *_parentHWNDOrNull, int32_t _x, lglw->win.b_owner = LGLW_FALSE; #endif - // Setup the event proc now, on the parent window as well just for the debug host - // It was simpler to do this than check in the debug host for the reparent event - lglw_log("lglw:lglw_window_open: 8\n"); - loc_setEventProc(lglw->xdsp, lglw->win.xwnd); - - if(NULL != _parentHWNDOrNull) - { - loc_setEventProc(lglw->xdsp, lglw->parent_xwnd); - loc_setProperty(lglw->xdsp, lglw->parent_xwnd, "_lglw", (void*)lglw); // set instance pointer - } - loc_setProperty(lglw->xdsp, lglw->win.xwnd, "_lglw", (void*)lglw); // set instance pointer - lglw_log("lglw:lglw_window_open: 9\n"); if(lglw->win.b_owner) {