#import "GdkMacosLayer.h"
#import "GdkMacosView.h"
+#import "GdkMacosWindow.h"
@implementation GdkMacosView
return NO;
}
+-(void)mouseDown:(NSEvent *)nsevent
+{
+ if ([(GdkMacosWindow *)[self window] needsMouseDownQuirk])
+ /* We should only hit this when we are trying to click through
+ * the shadow of a window into another window. Just request
+ * that the application not activate this window on mouseUp.
+ * See gdkmacosdisplay-translate.c for the other half of this.
+ */
+ [NSApp preventWindowOrdering];
+ else
+ [super mouseDown:nsevent];
+}
+
-(void)setFrame:(NSRect)rect
{
[super setFrame:rect];
inShowOrHide = YES;
if (makeKey && [self canBecomeKeyWindow])
- [self makeKeyAndOrderFront:nil];
+ [self makeKeyAndOrderFront:self];
else
- [self orderFront:nil];
+ [self orderFront:self];
if (makeKey && [self canBecomeMainWindow])
[self makeMainWindow];
[(GdkMacosView *)[self contentView] swapBuffer:buffer withDamage:damage];
}
+-(BOOL)needsMouseDownQuirk
+{
+ return GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface) &&
+ !GDK_MACOS_TOPLEVEL_SURFACE (gdk_surface)->decorated;
+}
+
@end
-(BOOL)trackManualResize;
-(void)setDecorated:(BOOL)decorated;
-(void)swapBuffer:(GdkMacosBuffer *)buffer withDamage:(const cairo_region_t *)damage;
+-(BOOL)needsMouseDownQuirk;
@end
if (test_resize (nsevent, surface, x, y))
return NULL;
- if ((event_type == NSEventTypeRightMouseDown ||
- event_type == NSEventTypeOtherMouseDown ||
- event_type == NSEventTypeLeftMouseDown))
+ if (event_type == NSEventTypeRightMouseDown ||
+ event_type == NSEventTypeOtherMouseDown ||
+ event_type == NSEventTypeLeftMouseDown)
{
if (![NSApp isActive])
[NSApp activateIgnoringOtherApps:YES];
if (![window isKeyWindow])
- [window makeKeyWindow];
+ {
+ NSWindow *orig_window = [nsevent window];
+
+ /* To get NSApp to supress activating the window we might
+ * have clicked through the shadow of, we need to dispatch
+ * the event and handle it in GdkMacosView:mouseDown to call
+ * [NSApp preventWindowOrdering]. Calling it here will not
+ * do anything as the event is not registered.
+ */
+ if (orig_window &&
+ GDK_IS_MACOS_WINDOW (orig_window) &&
+ [(GdkMacosWindow *)orig_window needsMouseDownQuirk])
+ [NSApp sendEvent:nsevent];
+
+ [window showAndMakeKey:YES];
+ _gdk_macos_display_clear_sorting (self);
+ }
}
switch ((int)event_type)