6867293: switching TAB in a browser doesn't deactivate EmbeddedFrame
authorant
Fri, 03 Sep 2010 11:08:41 +0400
changeset 6487 d6ad2c68a522
parent 6486 85f30f8aa7f3
child 6488 404882083757
child 6634 439221465ac5
6867293: switching TAB in a browser doesn't deactivate EmbeddedFrame Reviewed-by: dcherepanov, art
jdk/src/windows/native/sun/windows/awt_Window.h
--- a/jdk/src/windows/native/sun/windows/awt_Window.h	Thu Sep 02 12:17:21 2010 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_Window.h	Fri Sep 03 11:08:41 2010 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -193,12 +193,17 @@
 
     // Execute on Toolkit only.
     INLINE static LRESULT SynthesizeWmActivate(BOOL doActivate, HWND targetHWnd, HWND oppositeHWnd) {
-        if (::IsWindowVisible(targetHWnd)) {
-            return ::SendMessage(targetHWnd, WM_ACTIVATE,
-                                 MAKEWPARAM(doActivate ? WA_ACTIVE : WA_INACTIVE, FALSE),
-                                 (LPARAM) oppositeHWnd);
+        if (doActivate &&
+            (!::IsWindowVisible(targetHWnd) || ::IsIconic(::GetAncestor(targetHWnd, GA_ROOT))))
+        {
+            // The activation is rejected if either:
+            // - The toplevel is not visible
+            // - The toplevel (or its embedder) is minimised
+            return 1;
         }
-        return 1; // if not processed
+        return ::SendMessage(targetHWnd, WM_ACTIVATE,
+                             MAKEWPARAM(doActivate ? WA_ACTIVE : WA_INACTIVE, FALSE),
+                             (LPARAM) oppositeHWnd);
     }
 
     void moveToDefaultLocation(); /* moves Window to X,Y specified by Window Manger */