winemac: Move a window to the front when its Mac title bar is clicked.
Cocoa does this automatically for non-owned windows and informs the back end via a different mechanism (WINDOW_BROUGHT_FORWARD). However, for owned windows (child windows in Cocoa parlance), Cocoa does not change their z-order relative to the owner (parent) or sibling owned windows when clicked. So, we have to move the window in user32's z-order so that it gets moved appropriately on screen in response. Signed-off-by: Ken Thomases <ken@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
af2690ab06
commit
49bb11fef2
|
@ -2023,6 +2023,8 @@ - (BOOL) handleEvent:(NSEvent*)anEvent
|
|||
[self updateCursorClippingState];
|
||||
|
||||
event = macdrv_create_event(eventType, window);
|
||||
if (eventType == WINDOW_DRAG_BEGIN)
|
||||
event->window_drag_begin.no_activate = [NSEvent wine_commandKeyDown];
|
||||
[window.queue postEvent:event];
|
||||
macdrv_release_event(event);
|
||||
}
|
||||
|
|
|
@ -2236,9 +2236,10 @@ - (void) sendEvent:(NSEvent*)event
|
|||
|
||||
if (draggingPhase == 2)
|
||||
{
|
||||
macdrv_event* event = macdrv_create_event(WINDOW_DRAG_BEGIN, self);
|
||||
[queue postEvent:event];
|
||||
macdrv_release_event(event);
|
||||
macdrv_event* mevent = macdrv_create_event(WINDOW_DRAG_BEGIN, self);
|
||||
mevent->window_drag_begin.no_activate = [event wine_commandKeyDown];
|
||||
[queue postEvent:mevent];
|
||||
macdrv_release_event(mevent);
|
||||
|
||||
draggingPhase = 3;
|
||||
}
|
||||
|
|
|
@ -279,7 +279,7 @@ void macdrv_handle_event(const macdrv_event *event)
|
|||
macdrv_window_did_unminimize(hwnd);
|
||||
break;
|
||||
case WINDOW_DRAG_BEGIN:
|
||||
macdrv_window_drag_begin(hwnd);
|
||||
macdrv_window_drag_begin(hwnd, event);
|
||||
break;
|
||||
case WINDOW_DRAG_END:
|
||||
macdrv_window_drag_end(hwnd);
|
||||
|
|
|
@ -174,7 +174,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
|
|||
extern void macdrv_window_brought_forward(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_window_resize_ended(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_window_restore_requested(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_window_drag_begin(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_window_drag_begin(HWND hwnd, const macdrv_event *event) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_window_drag_end(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_reassert_window_position(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern BOOL query_resize_size(HWND hwnd, macdrv_query *query) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -375,6 +375,9 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display,
|
|||
struct {
|
||||
macdrv_status_item item;
|
||||
} status_item_mouse_move;
|
||||
struct {
|
||||
int no_activate;
|
||||
} window_drag_begin;
|
||||
struct {
|
||||
CGRect frame;
|
||||
int fullscreen;
|
||||
|
|
|
@ -2482,7 +2482,7 @@ void macdrv_window_restore_requested(HWND hwnd, const macdrv_event *event)
|
|||
*
|
||||
* Handler for WINDOW_DRAG_BEGIN events.
|
||||
*/
|
||||
void macdrv_window_drag_begin(HWND hwnd)
|
||||
void macdrv_window_drag_begin(HWND hwnd, const macdrv_event *event)
|
||||
{
|
||||
DWORD style = GetWindowLongW(hwnd, GWL_STYLE);
|
||||
struct macdrv_win_data *data;
|
||||
|
@ -2499,6 +2499,18 @@ void macdrv_window_drag_begin(HWND hwnd)
|
|||
data->being_dragged = TRUE;
|
||||
release_win_data(data);
|
||||
|
||||
if (!event->window_drag_begin.no_activate && can_activate_window(hwnd) && GetForegroundWindow() != hwnd)
|
||||
{
|
||||
/* ask whether the window wants to be activated */
|
||||
LRESULT ma = SendMessageW(hwnd, WM_MOUSEACTIVATE, (WPARAM)GetAncestor(hwnd, GA_ROOT),
|
||||
MAKELONG(HTCAPTION, WM_LBUTTONDOWN));
|
||||
if (ma != MA_NOACTIVATEANDEAT && ma != MA_NOACTIVATE)
|
||||
{
|
||||
TRACE("setting foreground window to %p\n", hwnd);
|
||||
SetForegroundWindow(hwnd);
|
||||
}
|
||||
}
|
||||
|
||||
ClipCursor(NULL);
|
||||
SendMessageW(hwnd, WM_ENTERSIZEMOVE, 0, 0);
|
||||
ReleaseCapture();
|
||||
|
|
Loading…
Reference in New Issue