winemac: Tell Wine when Cocoa has brought a window to the front.
This commit is contained in:
parent
9779f0ace4
commit
c043587d56
|
@ -1629,9 +1629,13 @@ - (void) handleMouseButton:(NSEvent*)theEvent
|
|||
|
||||
macdrv_release_event(event);
|
||||
}
|
||||
else if (broughtWindowForward && ![window isKeyWindow])
|
||||
else if (broughtWindowForward)
|
||||
{
|
||||
[[window ancestorWineWindow] postBroughtForwardEvent];
|
||||
if (![window isKeyWindow])
|
||||
[self windowGotFocus:window];
|
||||
}
|
||||
}
|
||||
|
||||
// Since mouse button events deliver absolute cursor position, the
|
||||
// accumulating delta from move events is invalidated. Make sure
|
||||
|
|
|
@ -73,5 +73,8 @@ - (NSInteger) minimumLevelForActive:(BOOL)active;
|
|||
- (void) updateFullscreen;
|
||||
|
||||
- (void) postKeyEvent:(NSEvent *)theEvent;
|
||||
- (void) postBroughtForwardEvent;
|
||||
|
||||
- (WineWindow*) ancestorWineWindow;
|
||||
|
||||
@end
|
||||
|
|
|
@ -1268,6 +1268,27 @@ - (void) setWineMinSize:(NSSize)minSize maxSize:(NSSize)maxSize
|
|||
}
|
||||
}
|
||||
|
||||
- (WineWindow*) ancestorWineWindow
|
||||
{
|
||||
WineWindow* ancestor = self;
|
||||
for (;;)
|
||||
{
|
||||
WineWindow* parent = (WineWindow*)[ancestor parentWindow];
|
||||
if ([parent isKindOfClass:[WineWindow class]])
|
||||
ancestor = parent;
|
||||
else
|
||||
break;
|
||||
}
|
||||
return ancestor;
|
||||
}
|
||||
|
||||
- (void) postBroughtForwardEvent
|
||||
{
|
||||
macdrv_event* event = macdrv_create_event(WINDOW_BROUGHT_FORWARD, self);
|
||||
[queue postEvent:event];
|
||||
macdrv_release_event(event);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* ---------- NSWindow method overrides ----------
|
||||
|
@ -1313,12 +1334,13 @@ - (BOOL) validateMenuItem:(NSMenuItem *)menuItem
|
|||
/* We don't call this. It's the action method of the items in the Window menu. */
|
||||
- (void) makeKeyAndOrderFront:(id)sender
|
||||
{
|
||||
if (![self isKeyWindow] && !self.disabled && !self.noActivate)
|
||||
[[WineApplicationController sharedController] windowGotFocus:self];
|
||||
|
||||
if ([self isMiniaturized])
|
||||
[self deminiaturize:nil];
|
||||
[self orderBelow:nil orAbove:nil activate:NO];
|
||||
[[self ancestorWineWindow] postBroughtForwardEvent];
|
||||
|
||||
if (![self isKeyWindow] && !self.disabled && !self.noActivate)
|
||||
[[WineApplicationController sharedController] windowGotFocus:self];
|
||||
}
|
||||
|
||||
- (void) sendEvent:(NSEvent*)event
|
||||
|
@ -1480,6 +1502,9 @@ - (void)windowDidDeminiaturize:(NSNotification *)notification
|
|||
[controller updateFullscreenWindows];
|
||||
[controller adjustWindowLevels];
|
||||
|
||||
if (![self parentWindow])
|
||||
[self postBroughtForwardEvent];
|
||||
|
||||
if (!self.disabled && !self.noActivate)
|
||||
{
|
||||
causing_becomeKeyWindow = self;
|
||||
|
|
|
@ -48,6 +48,7 @@ static const char *dbgstr_event(int type)
|
|||
"RELEASE_CAPTURE",
|
||||
"STATUS_ITEM_MOUSE_BUTTON",
|
||||
"STATUS_ITEM_MOUSE_MOVE",
|
||||
"WINDOW_BROUGHT_FORWARD",
|
||||
"WINDOW_CLOSE_REQUESTED",
|
||||
"WINDOW_DID_UNMINIMIZE",
|
||||
"WINDOW_FRAME_CHANGED",
|
||||
|
@ -111,6 +112,7 @@ static macdrv_event_mask get_event_mask(DWORD mask)
|
|||
{
|
||||
event_mask |= event_mask_for_type(QUERY_EVENT);
|
||||
event_mask |= event_mask_for_type(RELEASE_CAPTURE);
|
||||
event_mask |= event_mask_for_type(WINDOW_BROUGHT_FORWARD);
|
||||
event_mask |= event_mask_for_type(WINDOW_MINIMIZE_REQUESTED);
|
||||
}
|
||||
|
||||
|
@ -234,6 +236,9 @@ void macdrv_handle_event(const macdrv_event *event)
|
|||
case STATUS_ITEM_MOUSE_MOVE:
|
||||
macdrv_status_item_mouse_move(event);
|
||||
break;
|
||||
case WINDOW_BROUGHT_FORWARD:
|
||||
macdrv_window_brought_forward(hwnd);
|
||||
break;
|
||||
case WINDOW_CLOSE_REQUESTED:
|
||||
macdrv_window_close_requested(hwnd);
|
||||
break;
|
||||
|
|
|
@ -162,6 +162,7 @@ static inline RECT rect_from_cgrect(CGRect cgrect)
|
|||
extern void macdrv_app_quit_requested(const macdrv_event *event) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_window_minimize_requested(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_window_did_unminimize(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern void macdrv_window_brought_forward(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern BOOL query_resize_end(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern BOOL query_resize_start(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
extern BOOL query_min_max_info(HWND hwnd) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -185,6 +185,7 @@ extern int macdrv_set_display_mode(const struct macdrv_display* display,
|
|||
RELEASE_CAPTURE,
|
||||
STATUS_ITEM_MOUSE_BUTTON,
|
||||
STATUS_ITEM_MOUSE_MOVE,
|
||||
WINDOW_BROUGHT_FORWARD,
|
||||
WINDOW_CLOSE_REQUESTED,
|
||||
WINDOW_DID_UNMINIMIZE,
|
||||
WINDOW_FRAME_CHANGED,
|
||||
|
|
|
@ -1862,6 +1862,18 @@ done:
|
|||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* macdrv_window_brought_forward
|
||||
*
|
||||
* Handler for WINDOW_BROUGHT_FORWARD events.
|
||||
*/
|
||||
void macdrv_window_brought_forward(HWND hwnd)
|
||||
{
|
||||
TRACE("win %p\n", hwnd);
|
||||
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
|
||||
struct quit_info {
|
||||
HWND *wins;
|
||||
UINT capacity;
|
||||
|
|
Loading…
Reference in New Issue