We don't need the window anymore, it was only used to send ClipCursor notifications. This improves cursor clipping performance a lot as it avoids re-creating a window every time.
From: Rémi Bernon rbernon@codeweavers.com
We don't need the window anymore, it was only used to send ClipCursor notifications. This improves cursor clipping performance a lot as it avoids re-creating a window every time. --- dlls/winex11.drv/mouse.c | 28 +++++++--------------------- dlls/winex11.drv/x11drv.h | 2 +- 2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index 46d26726264..3248639f1f3 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -351,11 +351,8 @@ static void disable_xinput2(void) static BOOL grab_clipping_window( const RECT *clip ) { #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H - static const WCHAR messageW[] = {'M','e','s','s','a','g','e',0}; struct x11drv_thread_data *data = x11drv_thread_data(); - UNICODE_STRING class_name = RTL_CONSTANT_STRING( messageW ); Window clip_window; - HWND msg_hwnd = 0; HCURSOR cursor; POINT pos;
@@ -365,11 +362,6 @@ static BOOL grab_clipping_window( const RECT *clip ) if (!data) return FALSE; if (!(clip_window = init_clip_window())) return TRUE;
- if (!(msg_hwnd = NtUserCreateWindowEx( 0, &class_name, &class_name, NULL, 0, 0, 0, 0, 0, - HWND_MESSAGE, 0, NtCurrentTeb()->Peb->ImageBaseAddress, - NULL, 0, NULL, 0, FALSE ))) - return TRUE; - if (keyboard_grabbed) { WARN( "refusing to clip to %s\n", wine_dbgstr_rect(clip) ); @@ -384,26 +376,25 @@ static BOOL grab_clipping_window( const RECT *clip ) }
/* enable XInput2 unless we are already clipping */ - if (!data->clip_hwnd) enable_xinput2(); + if (!data->clipping_cursor) enable_xinput2();
if (data->xi2_state != xi_enabled) { WARN( "XInput2 not supported, refusing to clip to %s\n", wine_dbgstr_rect(clip) ); - NtUserDestroyWindow( msg_hwnd ); NtUserClipCursor( NULL ); return TRUE; }
TRACE( "clipping to %s win %lx\n", wine_dbgstr_rect(clip), clip_window );
- if (!data->clip_hwnd) XUnmapWindow( data->display, clip_window ); + if (!data->clipping_cursor) XUnmapWindow( data->display, clip_window ); pos = virtual_screen_to_root( clip->left, clip->top ); XMoveResizeWindow( data->display, clip_window, pos.x, pos.y, max( 1, clip->right - clip->left ), max( 1, clip->bottom - clip->top ) ); XMapWindow( data->display, clip_window );
/* if the rectangle is shrinking we may get a pointer warp */ - if (!data->clip_hwnd || clip->left > clip_rect.left || clip->top > clip_rect.top || + if (!data->clipping_cursor || clip->left > clip_rect.left || clip->top > clip_rect.top || clip->right < clip_rect.right || clip->bottom < clip_rect.bottom) data->warp_serial = NextRequest( data->display );
@@ -426,11 +417,10 @@ static BOOL grab_clipping_window( const RECT *clip ) if (!clipping_cursor) { disable_xinput2(); - NtUserDestroyWindow( msg_hwnd ); return FALSE; } clip_rect = *clip; - data->clip_hwnd = msg_hwnd; + data->clipping_cursor = TRUE; return TRUE; #else WARN( "XInput2 was not available at compile time\n" ); @@ -454,8 +444,7 @@ static void ungrab_clipping_window(void) XUnmapWindow( data->display, clip_window ); if (clipping_cursor) XUngrabPointer( data->display, CurrentTime ); clipping_cursor = FALSE; - NtUserDestroyWindow( data->clip_hwnd ); - data->clip_hwnd = 0; + data->clipping_cursor = FALSE; disable_xinput2(); }
@@ -505,7 +494,7 @@ static void map_event_coords( HWND hwnd, Window window, Window event_root, int x if (!hwnd) { thread_data = x11drv_thread_data(); - if (!thread_data->clip_hwnd) return; + if (!thread_data->clipping_cursor) return; if (thread_data->clip_window != window) return; pt.x += clip_rect.left; pt.y += clip_rect.top; @@ -549,10 +538,7 @@ static void send_mouse_input( HWND hwnd, Window window, unsigned int state, INPU if (!hwnd) { struct x11drv_thread_data *thread_data = x11drv_thread_data(); - HWND clip_hwnd = thread_data->clip_hwnd; - - if (!clip_hwnd) return; - if (thread_data->clip_window != window) return; + if (!thread_data->clipping_cursor || thread_data->clip_window != window) return; __wine_send_input( hwnd, input, NULL ); return; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index 8827d0cc0c2..8ab7903fb51 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -388,7 +388,7 @@ struct x11drv_thread_data Window selection_wnd; /* window used for selection interactions */ unsigned long warp_serial; /* serial number of last pointer warp request */ Window clip_window; /* window used for cursor clipping */ - HWND clip_hwnd; /* message window stored in desktop while clipping is active */ + BOOL clipping_cursor; /* whether thread is currently clipping the cursor */ #ifdef HAVE_X11_EXTENSIONS_XINPUT2_H enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */ void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=133811
Your paranoid android.
=== debian11 (32 bit report) ===
Report validation errors: quartz:vmr9 has no test summary line (early exit of the main process?) quartz:vmr9 has unaccounted for todo messages