mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 10:20:07 +00:00
macos: use input_region to specify tracking areas
We want our tracking area to be limited to the input region so that we don't pass along events outside of them for the window. This improves the chances we click-out of a popover with a large shadow. This still doesn't let us pass-through clicks for large shadows on top- level windows though.
This commit is contained in:
parent
a080f1197a
commit
f207402228
@ -45,7 +45,6 @@
|
||||
|
||||
options = (NSTrackingMouseEnteredAndExited |
|
||||
NSTrackingMouseMoved |
|
||||
NSTrackingInVisibleRect |
|
||||
NSTrackingActiveAlways);
|
||||
trackingArea = [[NSTrackingArea alloc] initWithRect:rect
|
||||
options:options
|
||||
@ -57,9 +56,26 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)setInputArea:(const cairo_rectangle_int_t *)area
|
||||
{
|
||||
NSRect rect = NSMakeRect (area->x, area->y, area->width, area->height);
|
||||
NSTrackingAreaOptions options;
|
||||
|
||||
[self removeTrackingArea:trackingArea];
|
||||
|
||||
options = (NSTrackingMouseEnteredAndExited |
|
||||
NSTrackingMouseMoved |
|
||||
NSTrackingActiveAlways);
|
||||
trackingArea = [[NSTrackingArea alloc] initWithRect:rect
|
||||
options:options
|
||||
owner:(id)self
|
||||
userInfo:nil];
|
||||
[self addTrackingArea:trackingArea];
|
||||
}
|
||||
|
||||
-(void)setOpaqueRegion:(cairo_region_t *)region
|
||||
{
|
||||
/* Do nothing */
|
||||
/* Handled in Subclass */
|
||||
}
|
||||
|
||||
-(BOOL)acceptsFirstMouse
|
||||
|
@ -42,5 +42,6 @@
|
||||
-(void)setNeedsInvalidateShadow: (BOOL)invalidate;
|
||||
-(NSTrackingArea *)trackingArea;
|
||||
-(void)setOpaqueRegion:(cairo_region_t *)region;
|
||||
-(void)setInputArea:(const cairo_rectangle_int_t *)area;
|
||||
|
||||
@end
|
||||
|
@ -94,6 +94,17 @@ static void
|
||||
gdk_macos_surface_set_input_region (GdkSurface *surface,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkMacosSurface *self = (GdkMacosSurface *)surface;
|
||||
cairo_rectangle_int_t rect;
|
||||
|
||||
g_assert (GDK_IS_MACOS_SURFACE (self));
|
||||
|
||||
if (self->window == NULL)
|
||||
return;
|
||||
|
||||
cairo_region_get_extents (region, &rect);
|
||||
|
||||
[(GdkMacosBaseView *)[self->window contentView] setInputArea:&rect];
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user