mirror of
https://github.com/reactos/wine.git
synced 2025-01-24 04:45:18 +00:00
winemac: Also activate if a window is ordered front shortly after tray icon clicked.
... in addition to if one is focused.
This commit is contained in:
parent
92a67d4259
commit
1d10457aee
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user