Re: mouse regression caused by x11ddraw.c revision 1.98 changes

Tim Beckmann <[email protected]>
Newsgroups gmane.comp.emulators.winex.devel
Message-ID <[email protected]>
Ove,

The patch fixes the problem (ran it several times to make sure it was 
consistently fixed since threads were involved).

It does have one unusual side effect.  After one fullscreen window is 
destroyed and before the next is created, the display flickers really 
rapidly.  It flickered before the patch, but just a couple times.  With 
the patch seems to flicker about a dozen times in the same time frame. 
It doesn't cause any trouble except for looking a little bizzare.

Thanks!
Tim


Ove Kaaven wrote:
> Thanks. I think I see the problem in here. It is absolutely imperative
> that the XSelectInput calls I added in 1.98 not get accidentally called
> from any other thread than the one that runs X11DRV_DD_ThreadProc, as
> they could otherwise completely disable input events, like mouse button
> events, for the window. The trace shows that, unfortunately, if a
> fullscreen window is created and then immediately destroyed before the
> window manager gets around to processing the events from the creation, a
> code path leading to a XSelectInput from the wrong thread may be taken.
> Can you try the following patch that tries to safeguard this from
> happening? I'm not 100% decided whether the if in front of the
> XDeleteProperty should check for -1 or not. Perhaps code to properly
> track windows awaiting reparenting should be written someday.
> 
> Index: x11ddraw.c
> ===================================================================
> RCS file: /home/cvs/cvsroot/winex/dlls/x11drv/x11ddraw.c,v
> retrieving revision 1.104
> diff -u -r1.104 x11ddraw.c
> --- x11ddraw.c	16 Apr 2004 18:21:47 -0000	1.104
> +++ x11ddraw.c	21 Apr 2004 00:49:34 -0000
> @@ -815,14 +815,14 @@
>        unsigned long items, remain;
>        unsigned char *props;
>  
> -      if (lParam && lParam != win) {
> +      if (lParam != (LPARAM)0 && lParam != (LPARAM)-1 && lParam != win) {
>          TRACE("skipping %08lx (wants %08lx)\n", win, lParam);
>          WIN_ReleasePtr(wnd);
>          return TRUE;
>        }
>  
>        wine_tsx11_lock();
> -      if (!lParam &&
> +      if (lParam == (LPARAM)0 &&
>            XGetWindowProperty(display, win, wmState, 0, sizeof(long), False, wmState,
>                               &type, &fmt, &items, &remain, &props) == Success &&
>            type != None) {
> @@ -848,7 +848,7 @@
>          wine_tsx11_unlock();
>          X11DRV_DD_Reparent(hwnd, 0);
>          wine_tsx11_lock();
> -        if (lParam) {
> +        if (lParam != (LPARAM)0 && lParam != (LPARAM)-1) {
>            /* So we got here while entering fullscreen by unmapping the window and waiting
>             * for WM_STATE to go away. However, metacity sets the property to WithdrawnState
>             * instead of deleting it, so let's make sure the property is really gone
> @@ -867,7 +867,7 @@
>      }
>      else {
>        /* window is not mapped, reparent window immediately. */
> -      if (!lParam) {
> +      if (lParam == (LPARAM)0 || lParam == (LPARAM)-1) {
>          X11DRV_DD_Reparent(hwnd, 0);
>        }
>      }
> @@ -896,7 +896,7 @@
>  
>      /* Reparent all top level windows to our new root window */
>      TSXSync(gdi_display, False);
> -    EnumWindows(X11DRV_DD_StartReparent, 0);
> +    EnumWindows(X11DRV_DD_StartReparent, (LPARAM)0);
>      TSXSync(thread_display(), False);
>    }
>  }
> @@ -914,7 +914,7 @@
>  
>      /* Reparent all top level windows to our new root window */
>      TSXSync(gdi_display, False);
> -    EnumWindows(X11DRV_DD_StartReparent, 0);
> +    EnumWindows(X11DRV_DD_StartReparent, (LPARAM)-1);
>      TSXSync(thread_display(), False);
>    }
>    if (root_window != DefaultRootWindow(gdi_display)) {
> 
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.