winemac: Implement a WINDOW_LOST_FOCUS event.

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

View File

@ -556,6 +556,17 @@ - (void)windowDidMove:(NSNotification *)notification
[self windowDidResize:notification];
}
- (void)windowDidResignKey:(NSNotification *)notification
{
macdrv_event event;
if (causing_becomeKeyWindow) return;
event.type = WINDOW_LOST_FOCUS;
event.window = (macdrv_window)[self retain];
[queue postEvent:&event];
}
- (void)windowDidResize:(NSNotification *)notification
{
macdrv_event event;

View File

@ -36,6 +36,7 @@ static const char *dbgstr_event(int type)
"WINDOW_CLOSE_REQUESTED",
"WINDOW_FRAME_CHANGED",
"WINDOW_GOT_FOCUS",
"WINDOW_LOST_FOCUS",
};
if (0 <= type && type < NUM_EVENT_TYPES) return event_names[type];
@ -60,6 +61,7 @@ static macdrv_event_mask get_event_mask(DWORD mask)
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_GOT_FOCUS);
event_mask |= event_mask_for_type(WINDOW_LOST_FOCUS);
}
return event_mask;
@ -95,6 +97,9 @@ void macdrv_handle_event(macdrv_event *event)
case WINDOW_GOT_FOCUS:
macdrv_window_got_focus(hwnd, event);
break;
case WINDOW_LOST_FOCUS:
macdrv_window_lost_focus(hwnd, event);
break;
default:
TRACE(" ignoring\n");
break;

View File

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

View File

@ -128,6 +128,7 @@
WINDOW_CLOSE_REQUESTED,
WINDOW_FRAME_CHANGED,
WINDOW_GOT_FOCUS,
WINDOW_LOST_FOCUS,
NUM_EVENT_TYPES
};

View File

@ -1453,3 +1453,19 @@ void macdrv_window_got_focus(HWND hwnd, const macdrv_event *event)
TRACE("win %p/%p rejecting focus\n", hwnd, event->window);
macdrv_window_rejected_focus(event);
}
/***********************************************************************
* macdrv_window_lost_focus
*
* Handler for WINDOW_LOST_FOCUS events.
*/
void macdrv_window_lost_focus(HWND hwnd, const macdrv_event *event)
{
if (!hwnd) return;
TRACE("win %p/%p fg %p\n", hwnd, event->window, GetForegroundWindow());
if (hwnd == GetForegroundWindow())
SendMessageW(hwnd, WM_CANCELMODE, 0, 0);
}