From 51161b199d8c281ec19130565954353303cf44c6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 1 Sep 2011 06:12:50 +0200 Subject: NEWT/X11/Fullscreen: Fix Leaving FullScreen NativeCode: "XChangeProperty( dpy, w, _NET_WM_STATE, XA_ATOM, 32, PropModeReplace, [ FULLSCREEN, ABOVE ] .." shall only be issued if entering FS, otherwise [ FULLSCREEN, ABOVE ] will be set on the client side at leaving FS, which is not intended. This caused a size reset to fullscreen size/mode. WindowImpl: Used WindowImpl.this.width and WindowImpl.this.height, where w and h should be used, the FS and pre-FS values. --- src/newt/classes/jogamp/newt/WindowImpl.java | 10 +++++----- src/newt/native/X11Window.c | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/newt') diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 8e638c3b1..415de22fa 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -1031,7 +1031,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } // set visible again, and revalidate 'ok', - // since it has been experience that in some cases the reparented window gets hidden + // since it has been experienced that in some cases the reparented window gets hidden if(ok) { display.dispatchMessagesNative(); // status up2date if(wasVisible) { @@ -1459,10 +1459,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date boolean wasVisible = isVisible(); - setVisibleImpl(false, x, y, width, height); + setVisibleImpl(false, x, y, w, h); WindowImpl.this.waitForVisible(false, true); display.dispatchMessagesNative(); // status up2date - + // write back mirrored values, to be able to detect satisfaction WindowImpl.this.x = x; WindowImpl.this.y = y; @@ -1472,7 +1472,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer display.dispatchMessagesNative(); // status up2date if(wasVisible) { - setVisibleImpl(true, x, y, width, height); + setVisibleImpl(true, x, y, w, h); boolean ok = WindowImpl.this.waitForVisible(true, true, Screen.SCREEN_MODE_CHANGE_TIMEOUT); display.dispatchMessagesNative(); // status up2date if( ok && @@ -1485,7 +1485,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer System.err.println("Window fs (reconfig): "+x+"/"+y+" "+w+"x"+h+", "+screen); } // reset pos/size .. due to some native impl flakyness - reconfigureWindowImpl(x, y, width, height, false, 0, 0); + reconfigureWindowImpl(x, y, w, h, false, 0, 0); display.dispatchMessagesNative(); // status up2date } requestFocusImpl(true); diff --git a/src/newt/native/X11Window.c b/src/newt/native/X11Window.c index 377675887..a18efbdb8 100644 --- a/src/newt/native/X11Window.c +++ b/src/newt/native/X11Window.c @@ -60,7 +60,7 @@ #include "NewtCommon.h" -#define VERBOSE_ON 1 +// #define VERBOSE_ON 1 #ifdef VERBOSE_ON #define DBG_PRINT(...) fprintf(stderr, __VA_ARGS__); fflush(stderr) @@ -522,6 +522,7 @@ static void NewtWindows_setFullscreen (Display *dpy, Window root, Window w, Bool xev.xclient.data.l[1] = _NET_WM_STATE_FULLSCREEN; xev.xclient.data.l[2] = _NET_WM_STATE_ABOVE; xev.xclient.data.l[3] = 1; //source indication for normal applications + XChangeProperty( dpy, w, _NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *)&types, ntypes); } else { xev.xclient.data.l[0] = _NET_WM_STATE_REMOVE; xev.xclient.data.l[1] = _NET_WM_STATE_FULLSCREEN; @@ -529,7 +530,6 @@ static void NewtWindows_setFullscreen (Display *dpy, Window root, Window w, Bool xev.xclient.data.l[3] = 1; //source indication for normal applications } - XChangeProperty( dpy, w, _NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *)&types, ntypes); XSync(dpy, False); XSendEvent (dpy, root, False, SubstructureRedirectMask | SubstructureNotifyMask, &xev ); } @@ -1460,7 +1460,7 @@ static void NewtWindows_setPosSize(Display *dpy, Window w, jint x, jint y, jint XWindowChanges xwc; unsigned int mod_flags = ( (x>=0)?CWX:0 ) | ( (y>=0)?CWY:0 ) | ( (width>0)?CWWidth:0 ) | ( (height>0)?CWHeight:0 ) ; - DBG_PRINT( "X11: reconfigureWindow0 pos/size mod: 0x%X\n", mod_flags); + DBG_PRINT( "X11: reconfigureWindow0 %d/%d %dx%d, mod: 0x%X\n", x, y, width, height, mod_flags); memset(&xwc, 0, sizeof(XWindowChanges)); xwc.x=x; xwc.y=y; @@ -1481,7 +1481,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Window_setVisible0 { Display * dpy = (Display *) (intptr_t) display; Window w = (Window)window; - DBG_PRINT( "X11: setVisible0 vis %d\n", visible); + DBG_PRINT( "X11: setVisible0 vis %d - %d/%d %dx%d\n", visible, x, y, width, height); if(dpy==NULL) { NewtCommon_FatalError(env, "invalid display connection.."); @@ -1524,7 +1524,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Window_reconfigureWindow0 (void*)dpy, screen_index, (void*)scrn, (void*) jparent, (void*)parent, (void*) topParentParent, (void*)w, (void*)topParentWindow, x, y, width, height, isVisible, parentChange, fullscreenChange, decorationChange); - if(parentChange && JNI_TRUE == isVisible) { // unmap window if visible, reduce X11 internal signaling (WM unmap) + if(JNI_TRUE == isVisible) { // unmap window if visible, reduce X11 internal signaling (WM unmap) XUnmapWindow(dpy, w); XSync(dpy, False); } @@ -1556,7 +1556,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_x11_X11Window_reconfigureWindow0 XSync(dpy, False); } - if(parentChange && JNI_TRUE == isVisible) { // map window + if(JNI_TRUE == isVisible) { // map window XMapRaised(dpy, w); XSync(dpy, False); } -- cgit v1.2.3