winemac.drv: Use -setMouseConfinementRect: for cursor clipping by default.

On macOS 10.13+, use this private NSWindow method for ClipCursor
calls. The old behavior can be restored by setting the per-app Mac
Driver registry key UseConfinementCursorClipping to N.

Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Tim Clem 2022-01-19 11:40:28 -08:00 committed by Alexandre Julliard
parent 648fcd1882
commit 599ecd97a8
4 changed files with 15 additions and 2 deletions

View File

@ -1211,8 +1211,12 @@ - (void) updateWindowsForCursorClipping
- (BOOL) startClippingCursor:(CGRect)rect - (BOOL) startClippingCursor:(CGRect)rect
{ {
if (!clipCursorHandler) if (!clipCursorHandler) {
clipCursorHandler = [[WineEventTapClipCursorHandler alloc] init]; if (use_confinement_cursor_clipping && [WineConfinementClipCursorHandler isAvailable])
clipCursorHandler = [[WineConfinementClipCursorHandler alloc] init];
else
clipCursorHandler = [[WineEventTapClipCursorHandler alloc] init];
}
if (self.clippingCursor && CGRectEqualToRect(rect, clipCursorHandler.cursorClipRect)) if (self.clippingCursor && CGRectEqualToRect(rect, clipCursorHandler.cursorClipRect))
return TRUE; return TRUE;

View File

@ -34,6 +34,10 @@
* -[NSWindow setMouseConfinementRect:]. It comes with its own drawbacks, * -[NSWindow setMouseConfinementRect:]. It comes with its own drawbacks,
* but is generally far simpler. It is described and implemented in * but is generally far simpler. It is described and implemented in
* the WineConfinementClipCursorHandler class. * the WineConfinementClipCursorHandler class.
*
* On macOS 10.13+, WineConfinementClipCursorHandler is the default.
* The Mac driver registry key UseConfinementCursorClipping can be set
* to "n" to use the event tap implementation.
*/ */

View File

@ -162,6 +162,7 @@
extern int left_command_is_ctrl DECLSPEC_HIDDEN; extern int left_command_is_ctrl DECLSPEC_HIDDEN;
extern int right_command_is_ctrl DECLSPEC_HIDDEN; extern int right_command_is_ctrl DECLSPEC_HIDDEN;
extern int allow_immovable_windows DECLSPEC_HIDDEN; extern int allow_immovable_windows DECLSPEC_HIDDEN;
extern int use_confinement_cursor_clipping DECLSPEC_HIDDEN;
extern int cursor_clipping_locks_windows DECLSPEC_HIDDEN; extern int cursor_clipping_locks_windows DECLSPEC_HIDDEN;
extern int use_precise_scrolling DECLSPEC_HIDDEN; extern int use_precise_scrolling DECLSPEC_HIDDEN;
extern int gl_surface_mode DECLSPEC_HIDDEN; extern int gl_surface_mode DECLSPEC_HIDDEN;

View File

@ -57,6 +57,7 @@ int right_command_is_ctrl = 0;
BOOL allow_software_rendering = FALSE; BOOL allow_software_rendering = FALSE;
BOOL disable_window_decorations = FALSE; BOOL disable_window_decorations = FALSE;
int allow_immovable_windows = TRUE; int allow_immovable_windows = TRUE;
int use_confinement_cursor_clipping = TRUE;
int cursor_clipping_locks_windows = TRUE; int cursor_clipping_locks_windows = TRUE;
int use_precise_scrolling = TRUE; int use_precise_scrolling = TRUE;
int gl_surface_mode = GL_SURFACE_IN_FRONT_OPAQUE; int gl_surface_mode = GL_SURFACE_IN_FRONT_OPAQUE;
@ -194,6 +195,9 @@ static void setup_options(void)
if (!get_config_key(hkey, appkey, "AllowImmovableWindows", buffer, sizeof(buffer))) if (!get_config_key(hkey, appkey, "AllowImmovableWindows", buffer, sizeof(buffer)))
allow_immovable_windows = IS_OPTION_TRUE(buffer[0]); allow_immovable_windows = IS_OPTION_TRUE(buffer[0]);
if (!get_config_key(hkey, appkey, "UseConfinementCursorClipping", buffer, sizeof(buffer)))
use_confinement_cursor_clipping = IS_OPTION_TRUE(buffer[0]);
if (!get_config_key(hkey, appkey, "CursorClippingLocksWindows", buffer, sizeof(buffer))) if (!get_config_key(hkey, appkey, "CursorClippingLocksWindows", buffer, sizeof(buffer)))
cursor_clipping_locks_windows = IS_OPTION_TRUE(buffer[0]); cursor_clipping_locks_windows = IS_OPTION_TRUE(buffer[0]);