winemac.drv: Stop cursor clipping when all windows are minimized.

There's no analogous state on Windows, where an app is focused but has no
visible windows, but this seems like the best behavior.

Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Tim Clem 2021-10-19 14:21:12 -07:00 committed by Alexandre Julliard
parent 184048042e
commit 5e543fee7a
6 changed files with 50 additions and 0 deletions

View File

@ -1553,6 +1553,17 @@ - (void) windowWillOrderOut:(WineWindow*)window
}
}
- (BOOL) isAnyWineWindowVisible
{
for (WineWindow* w in [NSApp windows])
{
if ([w isKindOfClass:[WineWindow class]] && ![w isMiniaturized] && [w isVisible])
return YES;
}
return NO;
}
- (void) handleWindowDrag:(WineWindow*)window begin:(BOOL)begin
{
macdrv_event* event;
@ -2823,3 +2834,14 @@ void macdrv_set_cocoa_retina_mode(int new_mode)
[[WineApplicationController sharedController] setRetinaMode:new_mode];
});
}
int macdrv_is_any_wine_window_visible(void)
{
__block int ret = FALSE;
OnMainThread(^{
ret = [[WineApplicationController sharedController] isAnyWineWindowVisible];
});
return ret;
}

View File

@ -2896,9 +2896,16 @@ - (void) windowDidFailToExitFullScreen:(NSWindow*)window
- (void)windowDidMiniaturize:(NSNotification *)notification
{
macdrv_event* event;
if (fullscreen && [self isOnActiveSpace])
[[WineApplicationController sharedController] updateFullscreenWindows];
[self checkWineDisplayLink];
event = macdrv_create_event(WINDOW_DID_MINIMIZE, self);
[queue postEvent:event];
macdrv_release_event(event);
}
- (void)windowDidMove:(NSNotification *)notification

View File

@ -275,6 +275,9 @@ void macdrv_handle_event(const macdrv_event *event)
case WINDOW_CLOSE_REQUESTED:
macdrv_window_close_requested(hwnd);
break;
case WINDOW_DID_MINIMIZE:
macdrv_window_did_minimize(hwnd);
break;
case WINDOW_DID_UNMINIMIZE:
macdrv_window_did_unminimize(hwnd);
break;

View File

@ -170,6 +170,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
extern void macdrv_app_quit_requested(const macdrv_event *event) DECLSPEC_HIDDEN;
extern void macdrv_window_maximize_requested(HWND hwnd) DECLSPEC_HIDDEN;
extern void macdrv_window_minimize_requested(HWND hwnd) DECLSPEC_HIDDEN;
extern void macdrv_window_did_minimize(HWND hwnd) DECLSPEC_HIDDEN;
extern void macdrv_window_did_unminimize(HWND hwnd) DECLSPEC_HIDDEN;
extern void macdrv_window_brought_forward(HWND hwnd) DECLSPEC_HIDDEN;
extern void macdrv_window_resize_ended(HWND hwnd) DECLSPEC_HIDDEN;

View File

@ -339,6 +339,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display,
STATUS_ITEM_MOUSE_MOVE,
WINDOW_BROUGHT_FORWARD,
WINDOW_CLOSE_REQUESTED,
WINDOW_DID_MINIMIZE,
WINDOW_DID_UNMINIMIZE,
WINDOW_DRAG_BEGIN,
WINDOW_DRAG_END,
@ -598,6 +599,7 @@ extern void macdrv_set_window_color_key(macdrv_window w, CGFloat keyRed, CGFloat
extern uint32_t macdrv_window_background_color(void) DECLSPEC_HIDDEN;
extern void macdrv_send_text_input_event(int pressed, unsigned int flags, int repeat, int keyc,
void* data, int* done) DECLSPEC_HIDDEN;
extern int macdrv_is_any_wine_window_visible(void) DECLSPEC_HIDDEN;
/* keyboard */

View File

@ -2438,6 +2438,21 @@ void macdrv_window_minimize_requested(HWND hwnd)
}
/***********************************************************************
* macdrv_window_did_minimize
*
* Handler for WINDOW_DID_MINIMIZE events.
*/
void macdrv_window_did_minimize(HWND hwnd)
{
TRACE("win %p\n", hwnd);
/* If all our windows are minimized, disable cursor clipping. */
if (!macdrv_is_any_wine_window_visible())
ClipCursor(NULL);
}
/***********************************************************************
* macdrv_window_did_unminimize
*