[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: Focus to deleted windows
From:       gerard patel <g.patel () wanadoo ! fr>
Date:       2000-10-29 16:53:11
[Download RAW message or body]

At 03:15 PM 10/29/00 +0100, you wrote:

>I just wanted to go and create a revised that does (only for the toplevel
>destroyed window), that does check the destroyed window tree ONCE for
>containing the focus:
>
>	hwnd = GetFocus16();
>	while (hwnd && (GetWindowLongA(hwnd,GWL_STYLE) & WS_CHILD)) {
>		if (hwnd == topdestroyedhwnd) {
>			SetFocus(GetWindowLongA(topdestroyedhwnd,GWL_HWNDPARENT);
>			break;
>		}
>		hwnd = GetWindowLongA(hwnd,GWL_HWNDPARENT);
>	}
>  
>This would be a bit cleaner than my first approach. ;)

I have tried your revised approach and it fixes also my problem :

--- win.c.orig  Sun Oct 29 19:03:12 2000
+++ win.c       Sun Oct 29 19:01:36 2000
@@ -1335,16 +1335,35 @@
 {
     WND * wndPtr;
     BOOL retvalue;
+    HWND h;
+    BOOL bFocusSet = FALSE;
 
     TRACE("(%04x)\n", hwnd);
-
-      /* Initialization */
+
+    /* Initialization */
 
     if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
     if (wndPtr == pWndDesktop)
     {
         retvalue = FALSE; /* Can't destroy desktop */
        goto end;
+    }
+
+    h = GetFocus16();
+    while (h && (GetWindowLongA(h,GWL_STYLE) & WS_CHILD))
+    {
+       if (h == hwnd)
+        {
+            SetFocus(GetWindowLongA(hwnd,GWL_HWNDPARENT));
+            bFocusSet = TRUE;
+           break;
+       }
+       h = GetWindowLongA(h,GWL_HWNDPARENT);
+    }
+    if (! bFocusSet && h && (h == hwnd))
+    {                   
+        if (!(GetWindowLongA(h,GWL_STYLE) & WS_CHILD))
+            SetFocus(0);
     }
 
       /* Call hooks */

If you want to send something along these lines, it will probably
be good enough for me. The rest will be at the committing pleasure
of Alexandre Julliard (who could also ignore both patches :-))

>> The 2 points where I have tried to extend his patch are :
>
>Not addressed by above approach.
>
>How does Windows USER does this? Hmm :/

No, no, I don't want to know ;-)

Gerard

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic