winex11: Update the cursor from the thread input status instead of caching it per-thread in x11drv.
This commit is contained in:
parent
cd28e2be7c
commit
eed9c63ac7
|
@ -194,7 +194,7 @@ static Cursor get_empty_cursor(void)
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* get_x11_cursor
|
* get_x11_cursor
|
||||||
*/
|
*/
|
||||||
static Cursor get_x11_cursor( HCURSOR handle )
|
Cursor get_x11_cursor( HCURSOR handle )
|
||||||
{
|
{
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
|
||||||
|
@ -216,15 +216,7 @@ static void update_mouse_state( HWND hwnd, Window window, int x, int y, unsigned
|
||||||
|
|
||||||
get_coords( hwnd, window, x, y, pt );
|
get_coords( hwnd, window, x, y, pt );
|
||||||
|
|
||||||
/* update the cursor */
|
data->cursor_window = hwnd;
|
||||||
|
|
||||||
if (data->cursor_window != window)
|
|
||||||
{
|
|
||||||
data->cursor_window = window;
|
|
||||||
wine_tsx11_lock();
|
|
||||||
if (data->cursor) XDefineCursor( data->display, window, data->cursor );
|
|
||||||
wine_tsx11_unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update the wine server Z-order */
|
/* update the wine server Z-order */
|
||||||
|
|
||||||
|
@ -279,6 +271,7 @@ static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
|
||||||
DWORD data, DWORD time, DWORD extra_info, UINT injected_flags )
|
DWORD data, DWORD time, DWORD extra_info, UINT injected_flags )
|
||||||
{
|
{
|
||||||
MSLLHOOKSTRUCT hook;
|
MSLLHOOKSTRUCT hook;
|
||||||
|
HCURSOR cursor;
|
||||||
|
|
||||||
hook.pt.x = x;
|
hook.pt.x = x;
|
||||||
hook.pt.y = y;
|
hook.pt.y = y;
|
||||||
|
@ -302,9 +295,20 @@ static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
|
||||||
req->time = time;
|
req->time = time;
|
||||||
req->info = extra_info;
|
req->info = extra_info;
|
||||||
wine_server_call( req );
|
wine_server_call( req );
|
||||||
|
cursor = (reply->count >= 0) ? wine_server_ptr_handle(reply->cursor) : 0;
|
||||||
}
|
}
|
||||||
SERVER_END_REQ;
|
SERVER_END_REQ;
|
||||||
|
|
||||||
|
if (hwnd)
|
||||||
|
{
|
||||||
|
struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
|
||||||
|
if (data && cursor != data->cursor)
|
||||||
|
{
|
||||||
|
Cursor xcursor = get_x11_cursor( cursor );
|
||||||
|
if (xcursor) XDefineCursor( gdi_display, data->whole_window, xcursor );
|
||||||
|
data->cursor = cursor;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1005,29 +1009,20 @@ void CDECL X11DRV_DestroyCursorIcon( HCURSOR handle )
|
||||||
*/
|
*/
|
||||||
void CDECL X11DRV_SetCursor( HCURSOR handle, CURSORICONINFO *lpCursor )
|
void CDECL X11DRV_SetCursor( HCURSOR handle, CURSORICONINFO *lpCursor )
|
||||||
{
|
{
|
||||||
struct x11drv_thread_data *data = x11drv_init_thread_data();
|
struct x11drv_thread_data *thread_data = x11drv_init_thread_data();
|
||||||
|
struct x11drv_win_data *data;
|
||||||
Cursor cursor;
|
Cursor cursor;
|
||||||
|
|
||||||
if (lpCursor)
|
if (!(data = X11DRV_get_win_data( thread_data->cursor_window ))) return;
|
||||||
TRACE("%ux%u, planes %u, bpp %u\n",
|
|
||||||
lpCursor->nWidth, lpCursor->nHeight, lpCursor->bPlanes, lpCursor->bBitsPerPixel);
|
|
||||||
else
|
|
||||||
TRACE("NULL\n");
|
|
||||||
|
|
||||||
/* set the same cursor for all top-level windows of the current thread */
|
|
||||||
|
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
cursor = create_cursor( data->display, lpCursor );
|
if ((cursor = get_x11_cursor( handle )))
|
||||||
if (cursor)
|
|
||||||
{
|
{
|
||||||
if (data->cursor) XFreeCursor( data->display, data->cursor );
|
TRACE( "%p xid %lx\n", handle, cursor );
|
||||||
data->cursor = cursor;
|
XDefineCursor( gdi_display, data->whole_window, cursor );
|
||||||
if (data->cursor_window)
|
/* Make the change take effect immediately */
|
||||||
{
|
XFlush( gdi_display );
|
||||||
XDefineCursor( data->display, data->cursor_window, cursor );
|
data->cursor = handle;
|
||||||
/* Make the change take effect immediately */
|
|
||||||
XFlush( data->display );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,7 +328,6 @@ static int get_window_attributes( Display *display, struct x11drv_win_data *data
|
||||||
attr->override_redirect = !data->managed;
|
attr->override_redirect = !data->managed;
|
||||||
attr->colormap = X11DRV_PALETTE_PaletteXColormap;
|
attr->colormap = X11DRV_PALETTE_PaletteXColormap;
|
||||||
attr->save_under = ((GetClassLongW( data->hwnd, GCL_STYLE ) & CS_SAVEBITS) != 0);
|
attr->save_under = ((GetClassLongW( data->hwnd, GCL_STYLE ) & CS_SAVEBITS) != 0);
|
||||||
attr->cursor = x11drv_thread_data()->cursor;
|
|
||||||
attr->bit_gravity = NorthWestGravity;
|
attr->bit_gravity = NorthWestGravity;
|
||||||
attr->win_gravity = StaticGravity;
|
attr->win_gravity = StaticGravity;
|
||||||
attr->backing_store = NotUseful;
|
attr->backing_store = NotUseful;
|
||||||
|
@ -338,7 +337,7 @@ static int get_window_attributes( Display *display, struct x11drv_win_data *data
|
||||||
KeymapStateMask | StructureNotifyMask);
|
KeymapStateMask | StructureNotifyMask);
|
||||||
if (data->managed) attr->event_mask |= PropertyChangeMask;
|
if (data->managed) attr->event_mask |= PropertyChangeMask;
|
||||||
|
|
||||||
return (CWOverrideRedirect | CWSaveUnder | CWColormap | CWCursor |
|
return (CWOverrideRedirect | CWSaveUnder | CWColormap |
|
||||||
CWEventMask | CWBitGravity | CWBackingStore);
|
CWEventMask | CWBitGravity | CWBackingStore);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,8 +387,6 @@ static Window create_client_window( Display *display, struct x11drv_win_data *da
|
||||||
|
|
||||||
if (data->client_window)
|
if (data->client_window)
|
||||||
{
|
{
|
||||||
struct x11drv_thread_data *thread_data = x11drv_thread_data();
|
|
||||||
if (thread_data->cursor_window == data->client_window) thread_data->cursor_window = None;
|
|
||||||
XDeleteContext( display, data->client_window, winContext );
|
XDeleteContext( display, data->client_window, winContext );
|
||||||
XDestroyWindow( display, data->client_window );
|
XDestroyWindow( display, data->client_window );
|
||||||
}
|
}
|
||||||
|
@ -800,8 +797,6 @@ static Window create_icon_window( Display *display, struct x11drv_win_data *data
|
||||||
static void destroy_icon_window( Display *display, struct x11drv_win_data *data )
|
static void destroy_icon_window( Display *display, struct x11drv_win_data *data )
|
||||||
{
|
{
|
||||||
if (!data->icon_window) return;
|
if (!data->icon_window) return;
|
||||||
if (x11drv_thread_data()->cursor_window == data->icon_window)
|
|
||||||
x11drv_thread_data()->cursor_window = None;
|
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
XDeleteContext( display, data->icon_window, winContext );
|
XDeleteContext( display, data->icon_window, winContext );
|
||||||
XDestroyWindow( display, data->icon_window );
|
XDestroyWindow( display, data->icon_window );
|
||||||
|
@ -1057,6 +1052,7 @@ static void set_initial_wm_hints( Display *display, struct x11drv_win_data *data
|
||||||
Atom dndVersion = WINE_XDND_VERSION;
|
Atom dndVersion = WINE_XDND_VERSION;
|
||||||
XClassHint *class_hints;
|
XClassHint *class_hints;
|
||||||
char *process_name = get_process_name();
|
char *process_name = get_process_name();
|
||||||
|
Cursor cursor;
|
||||||
|
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
|
|
||||||
|
@ -1089,6 +1085,9 @@ static void set_initial_wm_hints( Display *display, struct x11drv_win_data *data
|
||||||
XChangeProperty( display, data->whole_window, x11drv_atom(XdndAware),
|
XChangeProperty( display, data->whole_window, x11drv_atom(XdndAware),
|
||||||
XA_ATOM, 32, PropModeReplace, (unsigned char*)&dndVersion, 1 );
|
XA_ATOM, 32, PropModeReplace, (unsigned char*)&dndVersion, 1 );
|
||||||
|
|
||||||
|
if ((cursor = get_x11_cursor( data->cursor )))
|
||||||
|
XDefineCursor( gdi_display, data->whole_window, cursor );
|
||||||
|
|
||||||
data->wm_hints = XAllocWMHints();
|
data->wm_hints = XAllocWMHints();
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
|
|
||||||
|
@ -1694,14 +1693,9 @@ done:
|
||||||
*/
|
*/
|
||||||
static void destroy_whole_window( Display *display, struct x11drv_win_data *data, BOOL already_destroyed )
|
static void destroy_whole_window( Display *display, struct x11drv_win_data *data, BOOL already_destroyed )
|
||||||
{
|
{
|
||||||
struct x11drv_thread_data *thread_data = x11drv_thread_data();
|
|
||||||
|
|
||||||
if (!data->whole_window) return;
|
if (!data->whole_window) return;
|
||||||
|
|
||||||
TRACE( "win %p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window );
|
TRACE( "win %p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window );
|
||||||
if (thread_data->cursor_window == data->whole_window ||
|
|
||||||
thread_data->cursor_window == data->client_window)
|
|
||||||
thread_data->cursor_window = None;
|
|
||||||
wine_tsx11_lock();
|
wine_tsx11_lock();
|
||||||
XDeleteContext( display, data->whole_window, winContext );
|
XDeleteContext( display, data->whole_window, winContext );
|
||||||
XDeleteContext( display, data->client_window, winContext );
|
XDeleteContext( display, data->client_window, winContext );
|
||||||
|
|
|
@ -548,8 +548,7 @@ struct x11drv_thread_data
|
||||||
{
|
{
|
||||||
Display *display;
|
Display *display;
|
||||||
XEvent *current_event; /* event currently being processed */
|
XEvent *current_event; /* event currently being processed */
|
||||||
Cursor cursor; /* current cursor */
|
HWND cursor_window; /* current window that contains the cursor */
|
||||||
Window cursor_window; /* current window that contains the cursor */
|
|
||||||
Window grab_window; /* window that currently grabs the mouse */
|
Window grab_window; /* window that currently grabs the mouse */
|
||||||
HWND last_focus; /* last window that had focus */
|
HWND last_focus; /* last window that had focus */
|
||||||
XIM xim; /* input method */
|
XIM xim; /* input method */
|
||||||
|
@ -747,6 +746,7 @@ struct x11drv_win_data
|
||||||
RECT whole_rect; /* X window rectangle for the whole window relative to parent */
|
RECT whole_rect; /* X window rectangle for the whole window relative to parent */
|
||||||
RECT client_rect; /* client area relative to parent */
|
RECT client_rect; /* client area relative to parent */
|
||||||
XIC xic; /* X input context */
|
XIC xic; /* X input context */
|
||||||
|
HCURSOR cursor; /* current cursor */
|
||||||
XWMHints *wm_hints; /* window manager hints */
|
XWMHints *wm_hints; /* window manager hints */
|
||||||
BOOL managed : 1; /* is window managed? */
|
BOOL managed : 1; /* is window managed? */
|
||||||
BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */
|
BOOL mapped : 1; /* is window mapped? (in either normal or iconic state) */
|
||||||
|
@ -783,6 +783,7 @@ extern int CDECL X11DRV_AcquireClipboard(HWND hWndClipWindow);
|
||||||
extern void X11DRV_Clipboard_Cleanup(void);
|
extern void X11DRV_Clipboard_Cleanup(void);
|
||||||
extern void X11DRV_ResetSelectionOwner(void);
|
extern void X11DRV_ResetSelectionOwner(void);
|
||||||
extern void CDECL X11DRV_SetFocus( HWND hwnd );
|
extern void CDECL X11DRV_SetFocus( HWND hwnd );
|
||||||
|
extern Cursor get_x11_cursor( HCURSOR handle );
|
||||||
extern Cursor X11DRV_GetCursor( Display *display, struct tagCURSORICONINFO *ptr );
|
extern Cursor X11DRV_GetCursor( Display *display, struct tagCURSORICONINFO *ptr );
|
||||||
extern void CDECL X11DRV_SetCursor( HCURSOR cursor, struct tagCURSORICONINFO *lpCursor );
|
extern void CDECL X11DRV_SetCursor( HCURSOR cursor, struct tagCURSORICONINFO *lpCursor );
|
||||||
extern BOOL CDECL X11DRV_ClipCursor( LPCRECT clip );
|
extern BOOL CDECL X11DRV_ClipCursor( LPCRECT clip );
|
||||||
|
|
|
@ -197,7 +197,10 @@ static inline BOOL ignore_error( Display *display, XErrorEvent *event )
|
||||||
/* ignore a number of errors on gdi display caused by creating/destroying windows */
|
/* ignore a number of errors on gdi display caused by creating/destroying windows */
|
||||||
if (display == gdi_display)
|
if (display == gdi_display)
|
||||||
{
|
{
|
||||||
if (event->error_code == BadDrawable || event->error_code == BadGC) return TRUE;
|
if (event->error_code == BadDrawable ||
|
||||||
|
event->error_code == BadGC ||
|
||||||
|
event->error_code == BadWindow)
|
||||||
|
return TRUE;
|
||||||
#ifdef HAVE_X11_EXTENSIONS_XRENDER_H
|
#ifdef HAVE_X11_EXTENSIONS_XRENDER_H
|
||||||
if (xrender_error_base) /* check for XRender errors */
|
if (xrender_error_base) /* check for XRender errors */
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue