diff options
author | Sven Gothel <[email protected]> | 2011-10-13 03:38:39 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-10-13 03:38:39 +0200 |
commit | e7329d99aa6b44b976d0a5d2dd6f0d19c25d661c (patch) | |
tree | 398ff0b0f97a0b71d4f93e6851c522317cf32058 /src/newt/classes/jogamp | |
parent | 01ba2ee689a87996301afe2b37ad919cb052882b (diff) |
NEWT: Filter Window focusChanged() and visibleChanged() [test if value changed]
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/WindowImpl.java | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 637f36594..caa91fd7c 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -2192,24 +2192,28 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer /** Triggered by implementation's WM events to update the focus state. */ protected void focusChanged(boolean defer, boolean focusGained) { - if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.focusChanged: ("+getThreadName()+"): (defer: "+defer+") "+this.hasFocus+" -> "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); - } - hasFocus = focusGained; - final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ; - if(!defer) { - sendWindowEvent(evt); - } else { - enqueueWindowEvent(false, evt); + if(hasFocus != focusGained) { + if(DEBUG_IMPLEMENTATION) { + System.err.println("Window.focusChanged: ("+getThreadName()+"): (defer: "+defer+") "+this.hasFocus+" -> "+focusGained+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); + } + hasFocus = focusGained; + final int evt = focusGained ? WindowEvent.EVENT_WINDOW_GAINED_FOCUS : WindowEvent.EVENT_WINDOW_LOST_FOCUS ; + if(!defer) { + sendWindowEvent(evt); + } else { + enqueueWindowEvent(false, evt); + } } } /** Triggered by implementation's WM events to update the visibility state. */ protected void visibleChanged(boolean defer, boolean visible) { - if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.visibleChanged ("+getThreadName()+"): (defer: "+defer+") "+this.visible+" -> "+visible+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); + if(this.visible != visible) { + if(DEBUG_IMPLEMENTATION) { + System.err.println("Window.visibleChanged ("+getThreadName()+"): (defer: "+defer+") "+this.visible+" -> "+visible+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); + } + this.visible = visible ; } - this.visible = visible ; } private boolean waitForVisible(boolean visible, boolean failFast) { |