diff --git a/gdk/macos/gdkmacoscairocontext.c b/gdk/macos/gdkmacoscairocontext.c index 17c2b32811..31a9091b75 100644 --- a/gdk/macos/gdkmacoscairocontext.c +++ b/gdk/macos/gdkmacoscairocontext.c @@ -188,6 +188,14 @@ copy_surface_data (GdkMacosBuffer *from, } } +static void +clamp_region_to_surface (cairo_region_t *region, + GdkSurface *surface) +{ + cairo_rectangle_int_t rectangle = {0, 0, surface->width, surface->height}; + cairo_region_intersect_rectangle (region, &rectangle); +} + static void _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context, GdkMemoryDepth depth, @@ -205,6 +213,8 @@ _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context, surface = GDK_MACOS_SURFACE (gdk_draw_context_get_surface (draw_context)); buffer = _gdk_macos_surface_get_buffer (surface); + clamp_region_to_surface (region, GDK_SURFACE (surface)); + _gdk_macos_buffer_set_damage (buffer, region); _gdk_macos_buffer_set_flipped (buffer, FALSE); diff --git a/gdk/macos/gdkmacosdisplay-private.h b/gdk/macos/gdkmacosdisplay-private.h index a1acaaf31d..15508faee1 100644 --- a/gdk/macos/gdkmacosdisplay-private.h +++ b/gdk/macos/gdkmacosdisplay-private.h @@ -90,7 +90,7 @@ struct _GdkMacosDisplay /* Note if we have a key window that is not a GdkMacosWindow * such as a NSPanel used for native dialogs. */ - guint key_window_is_foregin : 1; + guint key_window_is_foreign : 1; }; struct _GdkMacosDisplayClass diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c index e73c012aeb..04de6f1748 100644 --- a/gdk/macos/gdkmacosdisplay.c +++ b/gdk/macos/gdkmacosdisplay.c @@ -424,7 +424,7 @@ select_key_in_idle_cb (gpointer data) self->select_key_in_idle = 0; /* Don't steal focus from NSPanel, etc */ - if (self->key_window_is_foregin) + if (self->key_window_is_foreign) return G_SOURCE_REMOVE; if (self->keyboard_surface == NULL) @@ -941,7 +941,7 @@ _gdk_macos_display_get_surfaces (GdkMacosDisplay *self) NSArray *array = [NSApp orderedWindows]; GQueue sorted = G_QUEUE_INIT; - self->key_window_is_foregin = FALSE; + self->key_window_is_foreign = FALSE; for (id obj in array) { @@ -949,7 +949,7 @@ _gdk_macos_display_get_surfaces (GdkMacosDisplay *self) GdkMacosSurface *surface; if ([nswindow isKeyWindow]) - self->key_window_is_foregin = !GDK_IS_MACOS_WINDOW (nswindow); + self->key_window_is_foreign = !GDK_IS_MACOS_WINDOW (nswindow); if (!GDK_IS_MACOS_WINDOW (nswindow)) continue;