aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-12-01 23:22:17 +0100
committerSven Gothel <[email protected]>2013-12-01 23:22:17 +0100
commit4cb35d98a1b25fb8347584b0ab6534c7cfc5946c (patch)
tree22dfeb282997bb79f5184c457aa5838f974ed2eb /src/newt/classes/jogamp
parent11a4a3a7b120c6f7c34a717828da49e3a13f4a3b (diff)
Bug 914 - Don't allow 'alwaysontop' in fullscreen mode, always allow switching to other applications via ALT-TAB
As described @ <http://forum.jogamp.org/Regression-of-alwaysOnTopBug-tp4030735p4030738.html>, we shall not steal the desktop in fullscreen mode via 'alwaysontop'. Latest tests on X11/GNU/Linux and Windows7 - before this patch: With default settings, i.e. alwaysontop (atop) disabled, it works as expected here, i.e.: - ALT-TAB triggers WM dialog, switching between apps. - ALT-TAB can actually switch to other apps. However, with enabled atop: - ALT-TAB triggers WM dialog, switching between apps. - ALT-TAB does _not_ switch to other apps. (*) I consider this a serious issue, since we shall not steal the desktop in fullscreen mode. This patch disables atop in fullscreen mode, i.e. (*) will switch to other apps again!
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 51740cb8d..d62a19f44 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -164,6 +164,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private boolean autoPosition = true; // default: true (allow WM to choose top-level position, if not set by user)
private int nfs_width, nfs_height, nfs_x, nfs_y; // non fullscreen client-area size/pos w/o insets
+ private boolean nfs_alwaysOnTop; // non fullscreen alwaysOnTop setting
private NativeWindow nfs_parent = null; // non fullscreen parent, in case explicit reparenting is performed (offscreen)
private String title = "Newt Window";
private boolean undecorated = false;
@@ -1610,7 +1611,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final void setAlwaysOnTop(boolean value) {
- runOnEDTIfAvail(true, new AlwaysOnTopAction(value));
+ if( isFullscreen() ) {
+ nfs_alwaysOnTop = value;
+ } else {
+ runOnEDTIfAvail(true, new AlwaysOnTopAction(value));
+ }
}
@Override
@@ -2012,6 +2017,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final RectangleImmutable sviewport = screen.getViewport();
final RectangleImmutable viewport;
final int fs_span_flag;
+ final boolean alwaysOnTopChange;
if(fullscreen) {
if( null == fullscreenMonitors ) {
if( fullscreenUseMainMonitor ) {
@@ -2032,10 +2038,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
nfs_y = oldY;
nfs_width = oldWidth;
nfs_height = oldHeight;
+ nfs_alwaysOnTop = alwaysOnTop;
x = viewport.getX();
y = viewport.getY();
w = viewport.getWidth();
h = viewport.getHeight();
+ alwaysOnTop = false;
+ alwaysOnTopChange = nfs_alwaysOnTop != alwaysOnTop;
} else {
fullscreenUseMainMonitor = true;
fullscreenMonitors = null;
@@ -2045,6 +2054,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
y = nfs_y;
w = nfs_width;
h = nfs_height;
+ alwaysOnTopChange = nfs_alwaysOnTop != alwaysOnTop;
+ alwaysOnTop = nfs_alwaysOnTop;
if(null!=parentWindow) {
// reset position to 0/0 within parent space
@@ -2063,7 +2074,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window fs: "+fullscreen+" "+x+"/"+y+" "+w+"x"+h+", "+isUndecorated()+
", virtl-screenSize: "+sviewport+", monitorsViewport "+viewport+
- ", spanning "+(0!=fs_span_flag)+" @ "+Thread.currentThread().getName());
+ ", spanning "+(0!=fs_span_flag)+
+ ", alwaysOnTop "+alwaysOnTop+(alwaysOnTopChange?"*":"")+
+ " @ "+Thread.currentThread().getName());
}
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
@@ -2090,9 +2103,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
parentWindowLocked = null;
}
try {
+ if(alwaysOnTopChange && fullscreen) {
+ // Enter fullscreen - Disable alwaysOnTop
+ reconfigureWindowImpl(nfs_x, nfs_y, nfs_width, nfs_height, getReconfigureFlags(FLAG_CHANGE_ALWAYSONTOP, isVisible()));
+ }
reconfigureWindowImpl(x, y, w, h,
getReconfigureFlags( ( ( null != parentWindowLocked ) ? FLAG_CHANGE_PARENTING : 0 ) |
fs_span_flag | FLAG_CHANGE_FULLSCREEN | FLAG_CHANGE_DECORATION, isVisible()) );
+ if(alwaysOnTopChange && !fullscreen) {
+ // Leave fullscreen - Restore alwaysOnTop
+ reconfigureWindowImpl(x, y, w, h, getReconfigureFlags(FLAG_CHANGE_ALWAYSONTOP, isVisible()));
+ }
} finally {
if(null!=parentWindowLocked) {
parentWindowLocked.unlockSurface();