diff --git a/dlls/winemac.drv/cocoa_app.m b/dlls/winemac.drv/cocoa_app.m index 09c95d069e..27ebdc4c28 100644 --- a/dlls/winemac.drv/cocoa_app.m +++ b/dlls/winemac.drv/cocoa_app.m @@ -2314,6 +2314,19 @@ static NSString* WineLocalizedString(unsigned int stringID) return ret; } + - (void)applicationWillBecomeActive:(NSNotification *)notification + { + macdrv_event* event = macdrv_create_event(APP_ACTIVATED, nil); + event->deliver = 1; + + [eventQueuesLock lock]; + for (WineEventQueue* queue in eventQueues) + [queue postEvent:event]; + [eventQueuesLock unlock]; + + macdrv_release_event(event); + } + - (void)applicationWillResignActive:(NSNotification *)notification { [self adjustWindowLevels:NO]; diff --git a/dlls/winemac.drv/event.c b/dlls/winemac.drv/event.c index 7d3aab3cd0..26d2b64b7f 100644 --- a/dlls/winemac.drv/event.c +++ b/dlls/winemac.drv/event.c @@ -32,6 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(event); static const char *dbgstr_event(int type) { static const char * const event_names[] = { + "APP_ACTIVATED", "APP_DEACTIVATED", "APP_QUIT_REQUESTED", "DISPLAYS_CHANGED", @@ -104,6 +105,7 @@ static macdrv_event_mask get_event_mask(DWORD mask) if (mask & QS_POSTMESSAGE) { + event_mask |= event_mask_for_type(APP_ACTIVATED); event_mask |= event_mask_for_type(APP_DEACTIVATED); event_mask |= event_mask_for_type(APP_QUIT_REQUESTED); event_mask |= event_mask_for_type(DISPLAYS_CHANGED); @@ -210,6 +212,9 @@ void macdrv_handle_event(const macdrv_event *event) switch (event->type) { + case APP_ACTIVATED: + macdrv_app_activated(); + break; case APP_DEACTIVATED: macdrv_app_deactivated(); break; diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h index a3ded739d0..bffd5552e1 100644 --- a/dlls/winemac.drv/macdrv.h +++ b/dlls/winemac.drv/macdrv.h @@ -165,6 +165,7 @@ extern void macdrv_window_close_requested(HWND hwnd) DECLSPEC_HIDDEN; extern void macdrv_window_frame_changed(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN; extern void macdrv_window_got_focus(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN; extern void macdrv_window_lost_focus(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN; +extern void macdrv_app_activated(void) DECLSPEC_HIDDEN; 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; @@ -194,6 +195,7 @@ extern HKL macdrv_get_hkl_from_source(TISInputSourceRef input_source) DECLSPEC_H extern void macdrv_displays_changed(const macdrv_event *event) DECLSPEC_HIDDEN; +extern void CDECL macdrv_UpdateClipboard(void) DECLSPEC_HIDDEN; extern void macdrv_init_clipboard(void) DECLSPEC_HIDDEN; extern BOOL query_pasteboard_data(HWND hwnd, CFStringRef type) DECLSPEC_HIDDEN; extern void macdrv_lost_pasteboard_ownership(HWND hwnd) DECLSPEC_HIDDEN; diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h index 21e9565437..e016b3ecd9 100644 --- a/dlls/winemac.drv/macdrv_cocoa.h +++ b/dlls/winemac.drv/macdrv_cocoa.h @@ -259,6 +259,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, /* event */ enum { + APP_ACTIVATED, APP_DEACTIVATED, APP_QUIT_REQUESTED, DISPLAYS_CHANGED, @@ -301,7 +302,7 @@ enum { QUIT_REASON_SHUTDOWN, }; -typedef uint32_t macdrv_event_mask; +typedef uint64_t macdrv_event_mask; typedef struct macdrv_event { int refs; diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index 40aa4399bb..9824d9971f 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -2278,6 +2278,18 @@ void macdrv_window_lost_focus(HWND hwnd, const macdrv_event *event) } +/*********************************************************************** + * macdrv_app_activated + * + * Handler for APP_ACTIVATED events. + */ +void macdrv_app_activated(void) +{ + TRACE("\n"); + macdrv_UpdateClipboard(); +} + + /*********************************************************************** * macdrv_app_deactivated *