Commit ecf9e913 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winex11.drv: Use grabbed window display in SetCapture.

parent aeefbdff
......@@ -602,7 +602,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU
/* update the wine server Z-order */
if (window != x11drv_thread_data()->grab_window &&
if (hwnd != x11drv_thread_data()->grab_hwnd &&
/* ignore event if a button is pressed, since the mouse is then grabbed too */
!(state & (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask|Button6Mask|Button7Mask)))
{
......@@ -1611,7 +1611,7 @@ void X11DRV_EnterNotify( HWND hwnd, XEvent *xev )
TRACE( "hwnd %p/%lx pos %d,%d detail %d\n", hwnd, event->window, event->x, event->y, event->detail );
if (event->detail == NotifyVirtual) return;
if (event->window == x11drv_thread_data()->grab_window) return;
if (hwnd == x11drv_thread_data()->grab_hwnd) return;
/* simulate a mouse motion event */
input.u.mi.dx = event->x;
......
......@@ -2116,27 +2116,31 @@ BOOL CDECL X11DRV_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
void CDECL X11DRV_SetCapture( HWND hwnd, UINT flags )
{
struct x11drv_thread_data *thread_data = x11drv_thread_data();
struct x11drv_win_data *data;
if (!thread_data) return;
if (!(flags & (GUI_INMOVESIZE | GUI_INMENUMODE))) return;
if (hwnd)
{
Window grab_win = X11DRV_get_whole_window( GetAncestor( hwnd, GA_ROOT ) );
if (!grab_win) return;
XFlush( gdi_display );
XGrabPointer( thread_data->display, grab_win, False,
PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime );
thread_data->grab_window = grab_win;
if (!(data = get_win_data( GetAncestor( hwnd, GA_ROOT )))) return;
if (data->whole_window)
{
XFlush( gdi_display );
XGrabPointer( data->display, data->whole_window, False,
PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime );
thread_data->grab_hwnd = data->hwnd;
}
release_win_data( data );
}
else /* release capture */
{
if (!(data = get_win_data( thread_data->grab_hwnd ))) return;
XFlush( gdi_display );
XUngrabPointer( thread_data->display, CurrentTime );
XFlush( thread_data->display );
thread_data->grab_window = None;
XUngrabPointer( data->display, CurrentTime );
XFlush( data->display );
thread_data->grab_hwnd = NULL;
release_win_data( data );
}
}
......
......@@ -308,7 +308,7 @@ struct x11drv_thread_data
{
Display *display;
XEvent *current_event; /* event currently being processed */
Window grab_window; /* window that currently grabs the mouse */
HWND grab_hwnd; /* window that currently grabs the mouse */
HWND last_focus; /* last window that had focus */
XIM xim; /* input method */
HWND last_xic_hwnd; /* last xic window */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment