You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/06/24 00:39:11 UTC

svn commit: r787859 - in /incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk: Window.java skin/MenuButtonSkin.java

Author: gbrown
Date: Tue Jun 23 22:39:10 2009
New Revision: 787859

URL: http://svn.apache.org/viewvc?rev=787859&view=rev
Log:
Minor fixes & cleanup.

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuButtonSkin.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java?rev=787859&r1=787858&r2=787859&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Window.java Tue Jun 23 22:39:10 2009
@@ -734,7 +734,7 @@
      * Restores the focus to the focus descendant. If the window does not
      * have a focus descendant, the focus is cleared.
      */
-    public void restoreFocus() {
+    protected void restoreFocus() {
         // If this window is still an ancestor of the focus descendant
         // and the focus descendant can be focused, restore focus to it;
         // otherwise, clear the focus descendant
@@ -810,11 +810,10 @@
             } else {
                 // Activate the window
                 if (window.isShowing()
-                    && !window.isBlocked()) {
-                    if (!window.isAuxilliary()) {
-                        setActiveWindow(window);
-                        window.restoreFocus();
-                    }
+                    && !window.isBlocked()
+                    && !window.isAuxilliary()) {
+                    setActiveWindow(window);
+                    restoreFocus();
                 }
 
                 // This was the last owned window for the current window; move
@@ -851,7 +850,9 @@
             setActiveWindow(null);
         }
 
-        clearFocus(true);
+        if (containsFocus()) {
+            clearFocus(true);
+        }
 
         Display display = getDisplay();
 

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuButtonSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuButtonSkin.java?rev=787859&r1=787858&r2=787859&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuButtonSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/MenuButtonSkin.java Tue Jun 23 22:39:10 2009
@@ -118,6 +118,10 @@
         MenuButton menuButton = (MenuButton)getComponent();
         menuButton.press();
 
+        if (menuPopup.isShowing()) {
+            menuPopup.requestFocus();
+        }
+
         return true;
     }