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: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Ken Thomases 2016-12-09 16:25:08 -06:00 committed by Alexandre Julliard
parent cd8c09b3e3
commit e5a9055dac
5 changed files with 34 additions and 1 deletions

View File

@ -2314,6 +2314,19 @@ - (NSApplicationTerminateReply) applicationShouldTerminate:(NSApplication *)send
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];

View File

@ -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;

View File

@ -165,6 +165,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
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 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
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;

View File

@ -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 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display,
QUIT_REASON_SHUTDOWN,
};
typedef uint32_t macdrv_event_mask;
typedef uint64_t macdrv_event_mask;
typedef struct macdrv_event {
int refs;

View File

@ -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
*