Merge
authordav
Mon, 07 Jul 2008 16:32:38 +0400
changeset 1182 9590bc50fe0f
parent 1181 c5971dbeaaaa (current diff)
parent 1180 3493ec3df55d (diff)
child 1183 80d6aafba03a
Merge
--- a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java	Mon Jul 07 16:09:39 2008 +0400
+++ b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java	Mon Jul 07 16:32:38 2008 +0400
@@ -257,21 +257,27 @@
         Set toTest;
         Component currentFocused = e.getComponent();
 
-        Component last = getFocusTraversalPolicy().getLastComponent(this);
         toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
-        if (toTest.contains(stroke) && (currentFocused == last || last == null)) {
-            if (traverseOut(FORWARD)) {
-                e.consume();
-                return true;
+        if (toTest.contains(stroke)) {
+            // 6581899: performance improvement for SortingFocusTraversalPolicy
+            Component last = getFocusTraversalPolicy().getLastComponent(this);
+            if (currentFocused == last || last == null) {
+                if (traverseOut(FORWARD)) {
+                    e.consume();
+                    return true;
+                }
             }
         }
 
-        Component first = getFocusTraversalPolicy().getFirstComponent(this);
         toTest = getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
-        if (toTest.contains(stroke) && (currentFocused == first || first == null)) {
-            if (traverseOut(BACKWARD)) {
-                e.consume();
-                return true;
+        if (toTest.contains(stroke)) {
+            // 6581899: performance improvement for SortingFocusTraversalPolicy
+            Component first = getFocusTraversalPolicy().getFirstComponent(this);
+            if (currentFocused == first || first == null) {
+                if (traverseOut(BACKWARD)) {
+                    e.consume();
+                    return true;
+                }
             }
         }
         return false;
--- a/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c	Mon Jul 07 16:09:39 2008 +0400
+++ b/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c	Mon Jul 07 16:32:38 2008 +0400
@@ -40,6 +40,7 @@
 #include <langinfo.h>
 #include <locale.h>
 #include <fcntl.h>
+#include <poll.h>
 
 static Bool shapeSupported;
 static int shapeEventBase, shapeErrorBase;
@@ -534,40 +535,34 @@
 SplashEventLoop(Splash * splash) {
 
     /*      Different from win32 implementation - this loop
-       uses select timeouts instead of a timer */
+       uses poll timeouts instead of a timer */
     /* we should have splash _locked_ on entry!!! */
 
     int xconn = XConnectionNumber(splash->display);
 
     while (1) {
+        struct pollfd pfd[2];
+        int timeout = -1;
         int ctl = splash->controlpipe[0];
-        fd_set fds[2];
-        int n = 0;
-        struct timeval tv, *ptv;
         int rc;
-        int time;
         int pipes_empty;
 
-        FD_ZERO(fds);
-        FD_SET(xconn, fds);
-        if (xconn+1 > n)
-            n = xconn+1;
-        FD_SET(ctl, fds);
-        if (ctl+1 > n)
-            n = ctl+1;
+        pfd[0].fd = xconn;
+        pfd[0].events = POLLIN | POLLPRI;
+
+        pfd[1].fd = ctl;
+        pfd[1].events = POLLIN | POLLPRI;
+
         errno = 0;
         if (splash->isVisible>0 && SplashIsStillLooping(splash)) {
-            time = splash->time + splash->frames[splash->currentFrame].delay
+            timeout = splash->time + splash->frames[splash->currentFrame].delay
                 - SplashTime();
-            if (time < 0)
-                time = 0;
-            msec2timeval(time, &tv);
-            ptv = &tv;
-        } else {
-            ptv = NULL;
+            if (timeout < 0) {
+                timeout = 0;
+            }
         }
         SplashUnlock(splash);
-        rc = select(n, fds, NULL, NULL, ptv);
+        rc = poll(pfd, 2, timeout);
         SplashLock(splash);
         if (splash->isVisible>0 && SplashTime() >= splash->time +
                 splash->frames[splash->currentFrame].delay) {
--- a/jdk/src/windows/native/sun/windows/ComCtl32Util.cpp	Mon Jul 07 16:09:39 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/ComCtl32Util.cpp	Mon Jul 07 16:32:38 2008 +0400
@@ -49,6 +49,9 @@
             m_bNewSubclassing = (m_lpfnSetWindowSubclass != NULL) &&
                                 (m_lpfnRemoveWindowSubclass != NULL) &&
                                 (m_lpfnDefSubclassProc != NULL);
+
+            fn_InitCommonControlsEx = (ComCtl32Util::InitCommonControlsExType)::GetProcAddress(hModComCtl32, "InitCommonControlsEx");
+            InitCommonControls();
         }
     }
 }
@@ -108,3 +111,15 @@
 
     CATCH_BAD_ALLOC_RET(0);
 }
+
+void ComCtl32Util::InitCommonControls()
+{
+    if (fn_InitCommonControlsEx == NULL) {
+        return;
+    }
+
+    INITCOMMONCONTROLSEX iccex;
+    memset(&iccex, 0, sizeof(INITCOMMONCONTROLSEX));
+    iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
+    fn_InitCommonControlsEx(&iccex);
+}
--- a/jdk/src/windows/native/sun/windows/ComCtl32Util.h	Mon Jul 07 16:09:39 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/ComCtl32Util.h	Mon Jul 07 16:32:38 2008 +0400
@@ -25,6 +25,8 @@
 
 #include "awt_Component.h"
 
+#include <commctrl.h>
+
 #ifndef _COMCTL32UTIL_H
 #define _COMCTL32UTIL_H
 
@@ -81,6 +83,11 @@
         PFNREMOVEWINDOWSUBCLASS m_lpfnRemoveWindowSubclass;
         PFNDEFSUBCLASSPROC m_lpfnDefSubclassProc;
 
+        typedef BOOL (WINAPI * InitCommonControlsExType)(const LPINITCOMMONCONTROLSEX lpInitCtrls);
+        InitCommonControlsExType fn_InitCommonControlsEx;
+
+        void InitCommonControls();
+
         BOOL m_bNewSubclassing;
 
         // comctl32.dll version 6 window proc
--- a/jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp	Mon Jul 07 16:09:39 2008 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Win32GraphicsDevice.cpp	Mon Jul 07 16:32:38 2008 +0400
@@ -1107,6 +1107,10 @@
             }
         }
     } else {
+        jobject target = env->GetObjectField(windowPeer, AwtObject::targetID);
+        jboolean alwaysOnTop = JNU_GetFieldByName(env, NULL, target, "alwaysOnTop", "Z").z;
+        env->DeleteLocalRef(target);
+
         if (!::SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0,
                             SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOSIZE))
         {
@@ -1114,6 +1118,9 @@
                         "Error %d unsetting topmost attribute to fs window",
                         ::GetLastError());
         }
+
+        // We should restore alwaysOnTop state as it's anyway dropped here
+        Java_sun_awt_windows_WWindowPeer_setAlwaysOnTopNative(env, windowPeer, alwaysOnTop);
     }
 
     CATCH_BAD_ALLOC;