Commit 5e543fee authored by Tim Clem's avatar Tim Clem Committed by Alexandre Julliard

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: 's avatarTim Clem <tclem@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 18404804
......@@ -1553,6 +1553,17 @@ static NSString* WineLocalizedString(unsigned int stringID)
}
}
- (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;
}
......@@ -2896,9 +2896,16 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (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
......
......@@ -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;
......
......@@ -170,6 +170,7 @@ extern void macdrv_app_deactivated(void) DECLSPEC_HIDDEN;
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;
......
......@@ -339,6 +339,7 @@ enum {
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_view_backing_size(macdrv_view v, const int backing_size[2
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 */
......
......@@ -2439,6 +2439,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
*
* Handler for WINDOW_DID_UNMINIMIZE events.
......
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