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

Alexandre Julliard julliard at winehq.org
Fri Sep 27 11:33:13 CDT 2013


Module: wine
Branch: master
Commit: 12e0b0577c8809711f0302bcd931856097adcb6d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=12e0b0577c8809711f0302bcd931856097adcb6d

Author: Ken Thomases <ken at codeweavers.com>
Date:   Wed Sep 25 17:10:50 2013 -0500

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.

---

 dlls/winemac.drv/keyboard.c |    2 ++
 dlls/winemac.drv/macdrv.h   |    1 +
 dlls/winemac.drv/window.c   |   13 +++++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c
index 2c883cc..d4a3090 100644
--- a/dlls/winemac.drv/keyboard.c
+++ b/dlls/winemac.drv/keyboard.c
@@ -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);
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h
index 9925a51..bcd38ed 100644
--- a/dlls/winemac.drv/macdrv.h
+++ b/dlls/winemac.drv/macdrv.h
@@ -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;
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
index 7b01fe3..9ab5abe 100644
--- a/dlls/winemac.drv/window.c
+++ b/dlls/winemac.drv/window.c
@@ -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;
     }




More information about the wine-cvs mailing list