Commit 12e0b057 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

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.
parent 6bae7cf7
......@@ -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);
......
......@@ -145,6 +145,7 @@ extern struct macdrv_win_data *get_win_data(HWND hwnd) DECLSPEC_HIDDEN;
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;
......
......@@ -911,6 +911,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.@)
*/
BOOL CDECL macdrv_CreateDesktopWindow(HWND hwnd)
......@@ -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;
}
......
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