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) ...@@ -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 - (void) handleWindowDrag:(WineWindow*)window begin:(BOOL)begin
{ {
macdrv_event* event; macdrv_event* event;
...@@ -2823,3 +2834,14 @@ void macdrv_set_cocoa_retina_mode(int new_mode) ...@@ -2823,3 +2834,14 @@ void macdrv_set_cocoa_retina_mode(int new_mode)
[[WineApplicationController sharedController] setRetinaMode: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 ...@@ -2896,9 +2896,16 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi
- (void)windowDidMiniaturize:(NSNotification *)notification - (void)windowDidMiniaturize:(NSNotification *)notification
{ {
macdrv_event* event;
if (fullscreen && [self isOnActiveSpace]) if (fullscreen && [self isOnActiveSpace])
[[WineApplicationController sharedController] updateFullscreenWindows]; [[WineApplicationController sharedController] updateFullscreenWindows];
[self checkWineDisplayLink]; [self checkWineDisplayLink];
event = macdrv_create_event(WINDOW_DID_MINIMIZE, self);
[queue postEvent:event];
macdrv_release_event(event);
} }
- (void)windowDidMove:(NSNotification *)notification - (void)windowDidMove:(NSNotification *)notification
......
...@@ -275,6 +275,9 @@ void macdrv_handle_event(const macdrv_event *event) ...@@ -275,6 +275,9 @@ void macdrv_handle_event(const macdrv_event *event)
case WINDOW_CLOSE_REQUESTED: case WINDOW_CLOSE_REQUESTED:
macdrv_window_close_requested(hwnd); macdrv_window_close_requested(hwnd);
break; break;
case WINDOW_DID_MINIMIZE:
macdrv_window_did_minimize(hwnd);
break;
case WINDOW_DID_UNMINIMIZE: case WINDOW_DID_UNMINIMIZE:
macdrv_window_did_unminimize(hwnd); macdrv_window_did_unminimize(hwnd);
break; break;
......
...@@ -170,6 +170,7 @@ extern void macdrv_app_deactivated(void) DECLSPEC_HIDDEN; ...@@ -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_app_quit_requested(const macdrv_event *event) DECLSPEC_HIDDEN;
extern void macdrv_window_maximize_requested(HWND hwnd) 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_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_did_unminimize(HWND hwnd) DECLSPEC_HIDDEN;
extern void macdrv_window_brought_forward(HWND hwnd) DECLSPEC_HIDDEN; extern void macdrv_window_brought_forward(HWND hwnd) DECLSPEC_HIDDEN;
extern void macdrv_window_resize_ended(HWND hwnd) DECLSPEC_HIDDEN; extern void macdrv_window_resize_ended(HWND hwnd) DECLSPEC_HIDDEN;
......
...@@ -339,6 +339,7 @@ enum { ...@@ -339,6 +339,7 @@ enum {
STATUS_ITEM_MOUSE_MOVE, STATUS_ITEM_MOUSE_MOVE,
WINDOW_BROUGHT_FORWARD, WINDOW_BROUGHT_FORWARD,
WINDOW_CLOSE_REQUESTED, WINDOW_CLOSE_REQUESTED,
WINDOW_DID_MINIMIZE,
WINDOW_DID_UNMINIMIZE, WINDOW_DID_UNMINIMIZE,
WINDOW_DRAG_BEGIN, WINDOW_DRAG_BEGIN,
WINDOW_DRAG_END, WINDOW_DRAG_END,
...@@ -598,6 +599,7 @@ extern void macdrv_set_view_backing_size(macdrv_view v, const int backing_size[2 ...@@ -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 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, extern void macdrv_send_text_input_event(int pressed, unsigned int flags, int repeat, int keyc,
void* data, int* done) DECLSPEC_HIDDEN; void* data, int* done) DECLSPEC_HIDDEN;
extern int macdrv_is_any_wine_window_visible(void) DECLSPEC_HIDDEN;
/* keyboard */ /* keyboard */
......
...@@ -2439,6 +2439,21 @@ void macdrv_window_minimize_requested(HWND hwnd) ...@@ -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 * macdrv_window_did_unminimize
* *
* Handler for WINDOW_DID_UNMINIMIZE events. * 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