Xquartz: Force sending mouse clicks to AppKit if we're over the menu bar
(cherry picked from commit 7dff93ec1ac92aeaf3b70d5cfe787fa4a28c0dba)
This commit is contained in:
parent
3c12483264
commit
1d7049f8fd
|
@ -221,6 +221,34 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
|||
[self activateX:YES];
|
||||
}
|
||||
}
|
||||
|
||||
/* We want to force sending to appkit if we're over the menu bar */
|
||||
if(!for_appkit) {
|
||||
NSPoint NSlocation = [e locationInWindow];
|
||||
NSWindow *window = [e window];
|
||||
|
||||
if (window != nil) {
|
||||
NSRect frame = [window frame];
|
||||
NSlocation.x += frame.origin.x;
|
||||
NSlocation.y += frame.origin.y;
|
||||
}
|
||||
|
||||
NSRect NSframe = [[NSScreen mainScreen] frame];
|
||||
NSRect NSvisibleFrame = [[NSScreen mainScreen] visibleFrame];
|
||||
|
||||
CGRect CGframe = CGRectMake(NSframe.origin.x, NSframe.origin.y,
|
||||
NSframe.size.width, NSframe.size.height);
|
||||
CGRect CGvisibleFrame = CGRectMake(NSvisibleFrame.origin.x,
|
||||
NSvisibleFrame.origin.y,
|
||||
NSvisibleFrame.size.width,
|
||||
NSvisibleFrame.size.height);
|
||||
CGPoint CGlocation = CGPointMake(NSlocation.x, NSlocation.y);
|
||||
|
||||
if(CGRectContainsPoint(CGframe, CGlocation) &&
|
||||
!CGRectContainsPoint(CGvisibleFrame, CGlocation))
|
||||
for_appkit = YES;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case NSKeyDown: case NSKeyUp:
|
||||
|
@ -880,8 +908,8 @@ extern int darwin_modifier_flags; // darwinEvents.c
|
|||
if (window != nil) {
|
||||
NSRect frame = [window frame];
|
||||
pointer_x = location.x + frame.origin.x;
|
||||
pointer_y = (((screen.origin.y + screen.size.height)
|
||||
- location.y) - frame.origin.y);
|
||||
pointer_y = (screen.origin.y + screen.size.height)
|
||||
- (location.y + frame.origin.y);
|
||||
} else {
|
||||
pointer_x = location.x;
|
||||
pointer_y = (screen.origin.y + screen.size.height) - location.y;
|
||||
|
|
Loading…
Reference in New Issue