Closed Bug 229471 Opened 21 years ago Closed 21 years ago

close window widget on unfocused window focuses window

Categories

(Core :: DOM: UI Events & Focus Handling, defect)

x86
OS/2
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: mrmazda, Assigned: grajaman)

Details

To reproduce:
1-Open some app
2-Open Mozilla
3-Focus the other app
4-Click the close window widget on the Mozilla titlebar

Actual behavior:
1-Mozilla window is focused (OS/2 trunk 2003122508)

Expected behavior:
1-Mozilla window is closed (OS/2 1.5, Win32 1.6b, Linux trunk 2003122208)
Warpzilla trunk 2003121708 (and older) -> WFM (Warpzilla gets closed)
Warpzilla trunk 2003121808 (and newer) -> bug (Warpzilla gets focused)
Win98SE Moz trunk 2003122608 (and 2003121508) -> WFM

Ganesh, take a look.
Assignee: pedemont → grajaman
I just checked in a fix for this.

I had missed part of the IWB patch for the new focus code.

Index: nsFrameWindow.cpp
===================================================================
RCS file: /cvsroot/mozilla/widget/src/os2/nsFrameWindow.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- nsFrameWindow.cpp	17 Dec 2003 21:02:26 -0000	1.42
+++ nsFrameWindow.cpp	7 Jan 2004 22:07:23 -0000	1.43
@@ -442,10 +442,18 @@
          }
          break;
       /* To simulate Windows better, we need to send a focus message to the */
-      /* client when the frame is activated */
+      /* client when the frame is activated if there is a non mozilla window
focused */
       case WM_ACTIVATE:
-         if (SHORT1FROMMP(mp1))
-           WinPostMsg(mWnd, WM_FOCUSCHANGED, 0, MPFROM2SHORT(1,0));
+         if (SHORT1FROMMP(mp1)) {
+            char className[19];
+            ::WinQueryClassName(WinQueryFocus(HWND_DESKTOP), 19, className);
+            if (strcmp(className, WindowClass()) != 0) {
+#ifdef DEBUG_FOCUS
+              printf("Extra WM_FOCUSCHANGED because className was %s on
WM_ACTIVATE\n", className);
+#endif
+              WinSendMsg(mWnd, WM_FOCUSCHANGED, 0, MPFROM2SHORT(1,0));
+            }
+         }
          break;
    }
 
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
verified in 2004010908 trunk
Status: RESOLVED → VERIFIED
Component: Event Handling → User events and focus handling
You need to log in before you can comment on or make changes to this bug.