[PATCH] If a top level windows gets the focus it must be marked so in the CacioKeyboardFocusManagerPeer

Ingo Proetel proetel at aicas.de
Fri Feb 18 03:48:33 PST 2011


# HG changeset patch
# User Ingo Proetel <proetel at aicas.de>
# Date 1298023290 -3600
# Node ID e606da242732304bc9311f223bea6646932039d8
# Parent  3183b179210686cde36e60f0a645920e2505a358
If a top level windows gets the focus it must be marked so in the CacioKeyboardFocusManagerPeer.
An alternative would be to let native systems replace CacioKeyboardFocusManagerPeer with a specialized version that reflects the acutal state of the native system.

diff -r 3183b1792106 -r e606da242732 src/share/classes/sun/awt/peer/cacio/CacioWindowPeer.java
--- a/src/share/classes/sun/awt/peer/cacio/CacioWindowPeer.java	Fri Feb 18 11:01:30 2011 +0100
+++ b/src/share/classes/sun/awt/peer/cacio/CacioWindowPeer.java	Fri Feb 18 11:01:30 2011 +0100
@@ -207,6 +207,8 @@
 
         case FocusEvent.FOCUS_GAINED:
             {
+                // Simulate what the native system thinks is the currently focused window.
+                CacioKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(w);
                 WindowEvent we =
                     new WindowEvent(w, WindowEvent.WINDOW_GAINED_FOCUS);
                 super.handlePeerEvent(we);
@@ -215,6 +217,8 @@
             break;
         case FocusEvent.FOCUS_LOST:
             {
+                // Simulate what the native system thinks is the currently focused window.
+                CacioKeyboardFocusManagerPeer.getInstance().setCurrentFocusedWindow(null);
                 super.handlePeerEvent(ev);
                 WindowEvent we =
                     new WindowEvent(w, WindowEvent.WINDOW_LOST_FOCUS);



More information about the caciocavallo-dev mailing list