winemac: Activate an app if it sets focus on a window shortly after a hot key is pressed.

The Mac driver doesn't normally steal focus, but a press of a hot key counts
as the user giving permission.
This commit is contained in:
Ken Thomases 2013-09-25 17:10:50 -05:00 committed by Alexandre Julliard
parent 6bae7cf796
commit 12e0b0577c
3 changed files with 14 additions and 2 deletions

View file

@ -940,6 +940,8 @@ void macdrv_hotkey_press(const macdrv_event *event)
0x15B, 0x15C, event->hotkey_press.time_ms, FALSE);
}
activate_on_following_focus();
flags = (scan & 0x100) ? KEYEVENTF_EXTENDEDKEY : 0;
macdrv_send_keyboard_input(NULL, event->hotkey_press.vkey, scan & 0xff,
flags, event->key.time_ms);

View file

@ -145,6 +145,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
extern void release_win_data(struct macdrv_win_data *data) DECLSPEC_HIDDEN;
extern macdrv_window macdrv_get_cocoa_window(HWND hwnd, BOOL require_on_screen) DECLSPEC_HIDDEN;
extern RGNDATA *get_region_data(HRGN hrgn, HDC hdc_lptodp) DECLSPEC_HIDDEN;
extern void activate_on_following_focus(void) DECLSPEC_HIDDEN;
extern struct window_surface *create_surface(macdrv_window window, const RECT *rect,
struct window_surface *old_surface, BOOL use_alpha) DECLSPEC_HIDDEN;
extern void set_window_surface(macdrv_window window, struct window_surface *window_surface) DECLSPEC_HIDDEN;

View file

@ -910,6 +910,16 @@ static void move_window_bits(HWND hwnd, macdrv_window window, const RECT *old_re
}
/**********************************************************************
* activate_on_following_focus
*/
void activate_on_following_focus(void)
{
activate_on_focus_time = GetTickCount();
if (!activate_on_focus_time) activate_on_focus_time = 1;
}
/**********************************************************************
* CreateDesktopWindow (MACDRV.@)
*/
@ -1384,8 +1394,7 @@ LRESULT CDECL macdrv_WindowMessage(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
SendMessageW(hwnd, WM_DISPLAYCHANGE, wp, lp);
return 0;
case WM_MACDRV_ACTIVATE_ON_FOLLOWING_FOCUS:
activate_on_focus_time = GetTickCount();
if (!activate_on_focus_time) activate_on_focus_time = 1;
activate_on_following_focus();
TRACE("WM_MACDRV_ACTIVATE_ON_FOLLOWING_FOCUS time %u\n", activate_on_focus_time);
return 0;
}