Commit ecf217bb authored by Alexandre Julliard's avatar Alexandre Julliard

winex11: Update the cursor on the clipping window while it's mapped.

parent 886ae4c3
......@@ -91,6 +91,7 @@ static void X11DRV_FocusIn( HWND hwnd, XEvent *event );
static void X11DRV_FocusOut( HWND hwnd, XEvent *event );
static void X11DRV_Expose( HWND hwnd, XEvent *event );
static void X11DRV_MapNotify( HWND hwnd, XEvent *event );
static void X11DRV_UnmapNotify( HWND hwnd, XEvent *event );
static void X11DRV_ReparentNotify( HWND hwnd, XEvent *event );
static void X11DRV_ConfigureNotify( HWND hwnd, XEvent *event );
static void X11DRV_PropertyNotify( HWND hwnd, XEvent *event );
......@@ -124,7 +125,7 @@ static struct event_handler handlers[MAX_EVENT_HANDLERS] =
/* VisibilityNotify */
/* CreateNotify */
{ DestroyNotify, X11DRV_DestroyNotify },
/* UnmapNotify */
{ UnmapNotify, X11DRV_UnmapNotify },
{ MapNotify, X11DRV_MapNotify },
/* MapRequest */
{ ReparentNotify, X11DRV_ReparentNotify },
......@@ -801,6 +802,11 @@ static void X11DRV_MapNotify( HWND hwnd, XEvent *event )
{
struct x11drv_win_data *data;
if (event->xany.window == clip_window)
{
clipping_cursor = 1;
return;
}
if (!(data = X11DRV_get_win_data( hwnd ))) return;
if (!data->mapped || data->embedded) return;
......@@ -812,6 +818,15 @@ static void X11DRV_MapNotify( HWND hwnd, XEvent *event )
}
/**********************************************************************
* X11DRV_UnmapNotify
*/
static void X11DRV_UnmapNotify( HWND hwnd, XEvent *event )
{
if (event->xany.window == clip_window) clipping_cursor = 0;
}
/***********************************************************************
* is_net_wm_state_maximized
*/
......
......@@ -884,7 +884,8 @@ void CDECL X11DRV_SetCursor( HCURSOR handle )
GetTickCount() - last_cursor_change > 100)
{
last_cursor_change = GetTickCount();
if (cursor_window) SendNotifyMessageW( cursor_window, WM_X11DRV_SET_CURSOR, 0, (LPARAM)handle );
if (clipping_cursor) set_window_cursor( clip_window, handle );
else if (cursor_window) SendNotifyMessageW( cursor_window, WM_X11DRV_SET_CURSOR, 0, (LPARAM)handle );
}
}
......@@ -958,12 +959,14 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
if (!XGrabPointer( display, clip_window, False,
PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, clip_window, None, CurrentTime ))
clipping_cursor = 1;
wine_tsx11_unlock();
if (clipping_cursor)
{
wine_tsx11_unlock();
clip_rect = *clip;
return TRUE;
}
wine_tsx11_unlock();
}
}
......@@ -972,6 +975,7 @@ BOOL CDECL X11DRV_ClipCursor( LPCRECT clip )
wine_tsx11_lock();
XUnmapWindow( display, clip_window );
wine_tsx11_unlock();
clipping_cursor = 0;
return TRUE;
}
......
......@@ -70,6 +70,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(x11drv);
/* cursor clipping window */
Window clip_window = 0;
int clipping_cursor = 0;
/* X context to associate a hwnd to an X window */
XContext winContext = 0;
......
......@@ -586,6 +586,7 @@ static inline size_t get_property_size( int format, unsigned long count )
extern Visual *visual;
extern Window root_window;
extern Window clip_window;
extern int clipping_cursor;
extern unsigned int screen_width;
extern unsigned int screen_height;
extern unsigned int screen_bpp;
......
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