aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native/X11Window.c
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-08-11 01:59:15 +0200
committerSven Gothel <[email protected]>2015-08-11 01:59:15 +0200
commit4a9f65b176d618a8816eff6d24e683c56a4d8086 (patch)
tree079a2e1d82acc9d9f924fcb3429d8309ece23b58 /src/newt/native/X11Window.c
parentfe90427a84bbea6f23f59a533db300b3832a6a21 (diff)
Bug 1188: Fix regression on X11 setVisible: in-visibility never reached on child windows
It has been experienced that UnmapNotify is not sent for child windows when using IconicState! Hence the visible:=false event never reaches the Window, causing an error. This patch only uses IconicState for top-level windows and if requested.
Diffstat (limited to 'src/newt/native/X11Window.c')
-rw-r--r--src/newt/native/X11Window.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c
index ca768240f..778b71cc5 100644
--- a/src/newt/native/X11Window.c
+++ b/src/newt/native/X11Window.c
@@ -689,9 +689,11 @@ static Bool WaitForUnmapNotify( Display *dpy, XEvent *event, XPointer arg ) {
return (event->type == UnmapNotify) && (event->xmap.window == (Window) arg);
}
-static void NewtWindows_setVisible(Display *dpy, Window root, JavaWindow* jw, Bool visible, Bool useWM, Bool waitForMapNotify) {
+static void NewtWindows_setVisible(Display *dpy, Window root, JavaWindow* jw, Bool visible, Bool useWM, Bool waitForNotify) {
XEvent event;
if( !visible && useWM && 0 != ( _MASK_NET_WM_STATE_HIDDEN & jw->supportedAtoms ) ) {
+ DBG_PRINT( "X11: setVisible -> %d, method: IconicState, wait %d, window %p\n", (int)visible, (int)waitForNotify, (void*)jw->window);
+ // It has been experienced that UnmapNotify is not sent for child windows when using IconicState!
XEvent xev;
memset ( &xev, 0, sizeof(xev) );
xev.type = ClientMessage;
@@ -701,18 +703,19 @@ static void NewtWindows_setVisible(Display *dpy, Window root, JavaWindow* jw, Bo
xev.xclient.data.l[0] = IconicState;
XSendEvent ( dpy, root, False, SubstructureNotifyMask | SubstructureRedirectMask, &xev );
// NewtWindows_sendNET_WM_STATE(dpy, root, jw, _NET_WM_STATE_HIDDEN_IDX, 0, !visible);
- if(waitForMapNotify) {
+ if(waitForNotify) {
XIfEvent( dpy, &event, WaitForUnmapNotify, (XPointer) jw->window );
}
} else {
+ DBG_PRINT( "X11: setVisible -> %d, method: Map/Unmap, wait %d, window %p\n", (int)visible, (int)waitForNotify, (void*)jw->window);
if( visible ) {
XMapRaised(dpy, jw->window);
- if(waitForMapNotify) {
+ if(waitForNotify) {
XIfEvent( dpy, &event, WaitForMapNotify, (XPointer) jw->window );
}
} else {
XUnmapWindow(dpy, jw->window);
- if(waitForMapNotify) {
+ if(waitForNotify) {
XIfEvent( dpy, &event, WaitForUnmapNotify, (XPointer) jw->window );
}
}
@@ -1193,7 +1196,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_WindowDriver_reconfigureWindo
NewtWindows_setVisible(dpy, root, jw, True /* visible */, False /* useWM */, True /* wait */);
// no need to notify the java side .. just temp change
} else if( TST_FLAG_CHANGE_VISIBILITY(flags) ) {
- Bool useWM = TST_FLAG_CHANGE_VISIBILITY_FAST(flags) ? False : True;
+ Bool useWM = ( TST_FLAG_CHANGE_VISIBILITY_FAST(flags) || TST_FLAG_IS_CHILD(flags) ) ? False : True;
if( TST_FLAG_IS_VISIBLE(flags) ) {
DBG_PRINT( "X11: reconfigureWindow0 VISIBLE ON\n");
NewtWindows_setVisible(dpy, root, jw, True /* visible */, useWM, False /* wait */);