diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 80625265161..ff8f15553bb 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -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; +} diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 80cb2693409..812b46bee2c 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -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 diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 7ec59c0f903..f197af0808e 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -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; diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index a7c0b4cac87..3f986901b2c 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -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; diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 81840e067a9..2c903bfb12a 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -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 */ diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index eb23812d57c..07f04993ee8 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -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 *