winemac: Implement an APP_DEACTIVATED event.

This commit is contained in:
Ken Thomases 2013-01-27 16:19:56 -06:00 committed by Alexandre Julliard
parent 3c5973139f
commit b564d97229
5 changed files with 33 additions and 0 deletions

View File

@ -179,7 +179,18 @@ - (void) windowRejectedFocusEvent:(const macdrv_event*)event
*/ */
- (void)applicationDidResignActive:(NSNotification *)notification - (void)applicationDidResignActive:(NSNotification *)notification
{ {
macdrv_event event;
WineEventQueue* queue;
[self invalidateGotFocusEvents]; [self invalidateGotFocusEvents];
event.type = APP_DEACTIVATED;
event.window = NULL;
[eventQueuesLock lock];
for (queue in eventQueues)
[queue postEvent:&event];
[eventQueuesLock unlock];
} }
- (void)applicationWillFinishLaunching:(NSNotification *)notification - (void)applicationWillFinishLaunching:(NSNotification *)notification

View File

@ -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_DEACTIVATED",
"MOUSE_BUTTON", "MOUSE_BUTTON",
"WINDOW_CLOSE_REQUESTED", "WINDOW_CLOSE_REQUESTED",
"WINDOW_FRAME_CHANGED", "WINDOW_FRAME_CHANGED",
@ -58,6 +59,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_DEACTIVATED);
event_mask |= event_mask_for_type(WINDOW_CLOSE_REQUESTED); event_mask |= event_mask_for_type(WINDOW_CLOSE_REQUESTED);
event_mask |= event_mask_for_type(WINDOW_FRAME_CHANGED); event_mask |= event_mask_for_type(WINDOW_FRAME_CHANGED);
event_mask |= event_mask_for_type(WINDOW_GOT_FOCUS); event_mask |= event_mask_for_type(WINDOW_GOT_FOCUS);
@ -85,6 +87,9 @@ void macdrv_handle_event(macdrv_event *event)
switch (event->type) switch (event->type)
{ {
case APP_DEACTIVATED:
macdrv_app_deactivated();
break;
case MOUSE_BUTTON: case MOUSE_BUTTON:
macdrv_mouse_button(hwnd, event); macdrv_mouse_button(hwnd, event);
break; break;

View File

@ -121,6 +121,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
extern void macdrv_window_frame_changed(HWND hwnd, CGRect frame) DECLSPEC_HIDDEN; extern void macdrv_window_frame_changed(HWND hwnd, CGRect frame) 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_deactivated(void) DECLSPEC_HIDDEN;
extern void macdrv_mouse_button(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN; extern void macdrv_mouse_button(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN;

View File

@ -124,6 +124,7 @@
/* event */ /* event */
enum { enum {
APP_DEACTIVATED,
MOUSE_BUTTON, MOUSE_BUTTON,
WINDOW_CLOSE_REQUESTED, WINDOW_CLOSE_REQUESTED,
WINDOW_FRAME_CHANGED, WINDOW_FRAME_CHANGED,

View File

@ -1469,3 +1469,18 @@ void macdrv_window_lost_focus(HWND hwnd, const macdrv_event *event)
if (hwnd == GetForegroundWindow()) if (hwnd == GetForegroundWindow())
SendMessageW(hwnd, WM_CANCELMODE, 0, 0); SendMessageW(hwnd, WM_CANCELMODE, 0, 0);
} }
/***********************************************************************
* macdrv_app_deactivated
*
* Handler for APP_DEACTIVATED events.
*/
void macdrv_app_deactivated(void)
{
if (GetActiveWindow() == GetForegroundWindow())
{
TRACE("setting fg to desktop\n");
SetForegroundWindow(GetDesktopWindow());
}
}