diff options
author | Christopher Campbell <[email protected]> | 2009-05-26 22:29:17 +0000 |
---|---|---|
committer | Christopher Campbell <[email protected]> | 2009-05-26 22:29:17 +0000 |
commit | 8be32669ddc283c9b1b71a98391a711d526eab52 (patch) | |
tree | 88d8a0a1a9f97ced98f8ac7bdc574ea7c68a3ab1 /src/newt/classes | |
parent | 90c95605aa73985289600ad1f70d5ae29e69dcfc (diff) |
Newt: implemented simple window focus management for Mac OS X
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1917 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/newt/classes')
-rwxr-xr-x | src/newt/classes/com/sun/javafx/newt/macosx/MacWindow.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/newt/classes/com/sun/javafx/newt/macosx/MacWindow.java b/src/newt/classes/com/sun/javafx/newt/macosx/MacWindow.java index 598313fcd..39f7a5bba 100755 --- a/src/newt/classes/com/sun/javafx/newt/macosx/MacWindow.java +++ b/src/newt/classes/com/sun/javafx/newt/macosx/MacWindow.java @@ -182,6 +182,7 @@ public class MacWindow extends Window { if (created) { sendWindowEvent(WindowEvent.EVENT_WINDOW_MOVED); sendWindowEvent(WindowEvent.EVENT_WINDOW_RESIZED); + sendWindowEvent(WindowEvent.EVENT_WINDOW_GAINED_FOCUS); } } else { if (nativeWindow != 0) { @@ -198,6 +199,13 @@ public class MacWindow extends Window { setTitle0(nativeWindow, title); } } + + public void requestFocus() { + super.requestFocus(); + if (nativeWindow != 0) { + makeKey(nativeWindow); + } + } public void setSize(int width, int height) { this.width = width; @@ -248,6 +256,14 @@ public class MacWindow extends Window { } } + private void focusChanged(boolean focusGained) { + if (focusGained) { + sendWindowEvent(WindowEvent.EVENT_WINDOW_GAINED_FOCUS); + } else { + sendWindowEvent(WindowEvent.EVENT_WINDOW_LOST_FOCUS); + } + } + private char convertKeyChar(char keyChar) { if (keyChar == '\r') { // Turn these into \n @@ -343,6 +359,7 @@ public class MacWindow extends Window { int backingStoreType, boolean deferCreation); private native void makeKeyAndOrderFront(long window); + private native void makeKey(long window); private native void orderOut(long window); private native void close0(long window); private native void setTitle0(long window, String title); |