Commit cd10a0df authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Consolidate the logic for deciding if cursor clipping should be active.

parent e3dd2775
......@@ -1316,7 +1316,7 @@ int macdrv_err_on;
- (void) activateCursorClipping
{
if (clippingCursor)
if (cursorClippingEventTap && !CGEventTapIsEnabled(cursorClippingEventTap))
{
CGEventTapEnable(cursorClippingEventTap, TRUE);
[self setCursorPosition:NSPointToCGPoint([self flippedMouseLocation:[NSEvent mouseLocation]])];
......@@ -1325,7 +1325,7 @@ int macdrv_err_on;
- (void) deactivateCursorClipping
{
if (clippingCursor)
if (cursorClippingEventTap && CGEventTapIsEnabled(cursorClippingEventTap))
{
CGEventTapEnable(cursorClippingEventTap, FALSE);
[warpRecords removeAllObjects];
......@@ -1333,6 +1333,14 @@ int macdrv_err_on;
}
}
- (void) updateCursorClippingState
{
if (clippingCursor && [NSApp isActive])
[self activateCursorClipping];
else
[self deactivateCursorClipping];
}
- (BOOL) startClippingCursor:(CGRect)rect
{
CGError err;
......@@ -1346,8 +1354,7 @@ int macdrv_err_on;
clippingCursor = TRUE;
cursorClipRect = rect;
if ([NSApp isActive])
[self activateCursorClipping];
[self updateCursorClippingState];
return TRUE;
}
......@@ -1358,8 +1365,8 @@ int macdrv_err_on;
if (err != kCGErrorSuccess)
return FALSE;
[self deactivateCursorClipping];
clippingCursor = FALSE;
[self updateCursorClippingState];
return TRUE;
}
......@@ -2012,7 +2019,7 @@ int macdrv_err_on;
}
[latentDisplayModes removeAllObjects];
[self activateCursorClipping];
[self updateCursorClippingState];
[self updateFullscreenWindows];
[self adjustWindowLevels:YES];
......@@ -2056,6 +2063,8 @@ int macdrv_err_on;
macdrv_event* event;
WineEventQueue* queue;
[self updateCursorClippingState];
[self invalidateGotFocusEvents];
event = macdrv_create_event(APP_DEACTIVATED, nil);
......@@ -2123,8 +2132,6 @@ int macdrv_err_on;
- (void)applicationWillResignActive:(NSNotification *)notification
{
[self deactivateCursorClipping];
[self adjustWindowLevels:NO];
}
......
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