Commit e5a9055d authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

winemac: Update the clipboard when the process activates.

If another app grabbed the clipboard, that most likely happened while it was active and the Wine process was inactive. Our process being made active again is a good opportunity to check for that. Signed-off-by: 's avatarKen Thomases <ken@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent cd8c09b3
...@@ -2314,6 +2314,19 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -2314,6 +2314,19 @@ static NSString* WineLocalizedString(unsigned int stringID)
return ret; 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 - (void)applicationWillResignActive:(NSNotification *)notification
{ {
[self adjustWindowLevels:NO]; [self adjustWindowLevels:NO];
......
...@@ -32,6 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(event); ...@@ -32,6 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(event);
static const char *dbgstr_event(int type) static const char *dbgstr_event(int type)
{ {
static const char * const event_names[] = { static const char * const event_names[] = {
"APP_ACTIVATED",
"APP_DEACTIVATED", "APP_DEACTIVATED",
"APP_QUIT_REQUESTED", "APP_QUIT_REQUESTED",
"DISPLAYS_CHANGED", "DISPLAYS_CHANGED",
...@@ -104,6 +105,7 @@ static macdrv_event_mask get_event_mask(DWORD mask) ...@@ -104,6 +105,7 @@ static macdrv_event_mask get_event_mask(DWORD mask)
if (mask & QS_POSTMESSAGE) 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_DEACTIVATED);
event_mask |= event_mask_for_type(APP_QUIT_REQUESTED); event_mask |= event_mask_for_type(APP_QUIT_REQUESTED);
event_mask |= event_mask_for_type(DISPLAYS_CHANGED); event_mask |= event_mask_for_type(DISPLAYS_CHANGED);
...@@ -210,6 +212,9 @@ void macdrv_handle_event(const macdrv_event *event) ...@@ -210,6 +212,9 @@ void macdrv_handle_event(const macdrv_event *event)
switch (event->type) switch (event->type)
{ {
case APP_ACTIVATED:
macdrv_app_activated();
break;
case APP_DEACTIVATED: case APP_DEACTIVATED:
macdrv_app_deactivated(); macdrv_app_deactivated();
break; break;
......
...@@ -165,6 +165,7 @@ extern void macdrv_window_close_requested(HWND hwnd) DECLSPEC_HIDDEN; ...@@ -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_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_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_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_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;
...@@ -194,6 +195,7 @@ extern HKL macdrv_get_hkl_from_source(TISInputSourceRef input_source) DECLSPEC_H ...@@ -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 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 void macdrv_init_clipboard(void) DECLSPEC_HIDDEN;
extern BOOL query_pasteboard_data(HWND hwnd, CFStringRef type) DECLSPEC_HIDDEN; extern BOOL query_pasteboard_data(HWND hwnd, CFStringRef type) DECLSPEC_HIDDEN;
extern void macdrv_lost_pasteboard_ownership(HWND hwnd) DECLSPEC_HIDDEN; extern void macdrv_lost_pasteboard_ownership(HWND hwnd) DECLSPEC_HIDDEN;
......
...@@ -259,6 +259,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display, ...@@ -259,6 +259,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display,
/* event */ /* event */
enum { enum {
APP_ACTIVATED,
APP_DEACTIVATED, APP_DEACTIVATED,
APP_QUIT_REQUESTED, APP_QUIT_REQUESTED,
DISPLAYS_CHANGED, DISPLAYS_CHANGED,
...@@ -301,7 +302,7 @@ enum { ...@@ -301,7 +302,7 @@ enum {
QUIT_REASON_SHUTDOWN, QUIT_REASON_SHUTDOWN,
}; };
typedef uint32_t macdrv_event_mask; typedef uint64_t macdrv_event_mask;
typedef struct macdrv_event { typedef struct macdrv_event {
int refs; int refs;
......
...@@ -2279,6 +2279,18 @@ void macdrv_window_lost_focus(HWND hwnd, const macdrv_event *event) ...@@ -2279,6 +2279,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 * macdrv_app_deactivated
* *
* Handler for APP_DEACTIVATED events. * Handler for APP_DEACTIVATED 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