Xquartz: Force sending mouse clicks to AppKit if we're over the menu bar
(cherry picked from commit 7dff93ec1a
)
This commit is contained in:
parent
84c68a9699
commit
b5bb6dbc8f
|
@ -221,6 +221,34 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
|
||||||
[self activateX:YES];
|
[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;
|
break;
|
||||||
|
|
||||||
case NSKeyDown: case NSKeyUp:
|
case NSKeyDown: case NSKeyUp:
|
||||||
|
@ -880,8 +908,8 @@ extern int darwin_modifier_flags; // darwinEvents.c
|
||||||
if (window != nil) {
|
if (window != nil) {
|
||||||
NSRect frame = [window frame];
|
NSRect frame = [window frame];
|
||||||
pointer_x = location.x + frame.origin.x;
|
pointer_x = location.x + frame.origin.x;
|
||||||
pointer_y = (((screen.origin.y + screen.size.height)
|
pointer_y = (screen.origin.y + screen.size.height)
|
||||||
- location.y) - frame.origin.y);
|
- (location.y + frame.origin.y);
|
||||||
} else {
|
} else {
|
||||||
pointer_x = location.x;
|
pointer_x = location.x;
|
||||||
pointer_y = (screen.origin.y + screen.size.height) - location.y;
|
pointer_y = (screen.origin.y + screen.size.height) - location.y;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user