Ken Thomases : winemac: Also activate if a window is ordered front shortly after tray icon clicked .
Alexandre Julliard
julliard at winehq.org
Thu Jun 20 15:31:16 CDT 2013
Module: wine
Branch: master
Commit: 1d10457aee5833d460bb3f9d2747add51f5d97a5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1d10457aee5833d460bb3f9d2747add51f5d97a5
Author: Ken Thomases <ken at codeweavers.com>
Date: Wed Jun 19 19:09:18 2013 -0500
winemac: Also activate if a window is ordered front shortly after tray icon clicked.
... in addition to if one is focused.
---
dlls/winemac.drv/cocoa_window.m | 10 +++++++---
dlls/winemac.drv/macdrv.h | 1 +
dlls/winemac.drv/macdrv_cocoa.h | 2 +-
dlls/winemac.drv/window.c | 8 +++++++-
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m
index d926635..d0ee81f 100644
--- a/dlls/winemac.drv/cocoa_window.m
+++ b/dlls/winemac.drv/cocoa_window.m
@@ -761,7 +761,7 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
/* Returns whether or not the window was ordered in, which depends on if
its frame intersects any screen. */
- - (BOOL) orderBelow:(WineWindow*)prev orAbove:(WineWindow*)next
+ - (BOOL) orderBelow:(WineWindow*)prev orAbove:(WineWindow*)next activate:(BOOL)activate
{
WineApplicationController* controller = [WineApplicationController sharedController];
BOOL on_screen = frame_intersects_screens([self frame], [NSScreen screens]);
@@ -772,6 +772,9 @@ static inline void fix_generic_modifiers_by_device(NSUInteger* modifiers)
[controller transformProcessToForeground];
+ if (activate)
+ [NSApp activateIgnoringOtherApps:YES];
+
NSDisableScreenUpdates();
if (latentParentWindow)
@@ -1627,14 +1630,15 @@ void macdrv_set_cocoa_window_title(macdrv_window w, const unsigned short* title,
* (i.e. if its frame intersects with a screen). Otherwise, false.
*/
int macdrv_order_cocoa_window(macdrv_window w, macdrv_window prev,
- macdrv_window next)
+ macdrv_window next, int activate)
{
WineWindow* window = (WineWindow*)w;
__block BOOL on_screen;
OnMainThread(^{
on_screen = [window orderBelow:(WineWindow*)prev
- orAbove:(WineWindow*)next];
+ orAbove:(WineWindow*)next
+ activate:activate];
});
return on_screen;
diff --git a/dlls/winemac.drv/macdrv.h b/dlls/winemac.drv/macdrv.h
index 085f786..0f39e5d 100644
--- a/dlls/winemac.drv/macdrv.h
+++ b/dlls/winemac.drv/macdrv.h
@@ -162,6 +162,7 @@ extern void macdrv_window_did_unminimize(HWND hwnd) DECLSPEC_HIDDEN;
extern void macdrv_mouse_button(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN;
extern void macdrv_mouse_moved(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN;
extern void macdrv_mouse_scroll(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN;
+extern void macdrv_release_capture(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN;
extern void macdrv_compute_keyboard_layout(struct macdrv_thread_data *thread_data) DECLSPEC_HIDDEN;
extern void macdrv_keyboard_changed(const macdrv_event *event) DECLSPEC_HIDDEN;
diff --git a/dlls/winemac.drv/macdrv_cocoa.h b/dlls/winemac.drv/macdrv_cocoa.h
index 92e9892..cdfe85b 100644
--- a/dlls/winemac.drv/macdrv_cocoa.h
+++ b/dlls/winemac.drv/macdrv_cocoa.h
@@ -350,7 +350,7 @@ extern void macdrv_set_cocoa_window_state(macdrv_window w,
extern void macdrv_set_cocoa_window_title(macdrv_window w, const UniChar* title,
size_t length) DECLSPEC_HIDDEN;
extern int macdrv_order_cocoa_window(macdrv_window w, macdrv_window prev,
- macdrv_window next) DECLSPEC_HIDDEN;
+ macdrv_window next, int activate) DECLSPEC_HIDDEN;
extern void macdrv_hide_cocoa_window(macdrv_window w) DECLSPEC_HIDDEN;
extern int macdrv_set_cocoa_window_frame(macdrv_window w, const CGRect* new_frame) DECLSPEC_HIDDEN;
extern void macdrv_get_cocoa_window_frame(macdrv_window w, CGRect* out_frame) DECLSPEC_HIDDEN;
diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c
index 3c0041b..5e03936 100644
--- a/dlls/winemac.drv/window.c
+++ b/dlls/winemac.drv/window.c
@@ -587,6 +587,7 @@ static void show_window(struct macdrv_win_data *data)
HWND next = NULL;
macdrv_window prev_window = NULL;
macdrv_window next_window = NULL;
+ BOOL activate = FALSE;
/* find window that this one must be after */
prev = GetWindow(data->hwnd, GW_HWNDPREV);
@@ -605,12 +606,16 @@ static void show_window(struct macdrv_win_data *data)
TRACE("win %p/%p below %p/%p above %p/%p\n",
data->hwnd, data->cocoa_window, prev, prev_window, next, next_window);
- data->on_screen = macdrv_order_cocoa_window(data->cocoa_window, prev_window, next_window);
+ if (!prev_window)
+ activate = activate_on_focus_time && (GetTickCount() - activate_on_focus_time < 2000);
+ data->on_screen = macdrv_order_cocoa_window(data->cocoa_window, prev_window, next_window, activate);
if (data->on_screen)
{
HWND hwndFocus = GetFocus();
if (hwndFocus && (data->hwnd == hwndFocus || IsChild(data->hwnd, hwndFocus)))
macdrv_SetFocus(hwndFocus);
+ if (activate)
+ activate_on_focus_time = 0;
}
}
@@ -861,6 +866,7 @@ void CDECL macdrv_SetFocus(HWND hwnd)
BOOL activate = activate_on_focus_time && (GetTickCount() - activate_on_focus_time < 2000);
/* Set Mac focus */
macdrv_give_cocoa_window_focus(data->cocoa_window, activate);
+ activate_on_focus_time = 0;
}
release_win_data(data);
More information about the wine-cvs
mailing list