[gtk/wip/chergert/for-macos-1] macos: add helper to check if surface is opaque
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/for-macos-1] macos: add helper to check if surface is opaque
- Date: Wed, 16 Feb 2022 11:09:09 +0000 (UTC)
commit 3c9687fcf1efb5f999320b1130d824b70c0d2283
Author: Christian Hergert <christian hergert me>
Date: Mon Feb 14 02:18:51 2022 -0800
macos: add helper to check if surface is opaque
gdk/macos/gdkmacossurface-private.h | 1 +
gdk/macos/gdkmacossurface.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
---
diff --git a/gdk/macos/gdkmacossurface-private.h b/gdk/macos/gdkmacossurface-private.h
index ccb8a83179..61ea1ba00d 100644
--- a/gdk/macos/gdkmacossurface-private.h
+++ b/gdk/macos/gdkmacossurface-private.h
@@ -131,6 +131,7 @@ void _gdk_macos_surface_set_opacity (GdkMacosSurface
void _gdk_macos_surface_get_root_coords (GdkMacosSurface *self,
int *x,
int *y);
+gboolean _gdk_macos_surface_is_opaque (GdkMacosSurface *self);
G_END_DECLS
diff --git a/gdk/macos/gdkmacossurface.c b/gdk/macos/gdkmacossurface.c
index a2c7bb485d..42ac59d059 100644
--- a/gdk/macos/gdkmacossurface.c
+++ b/gdk/macos/gdkmacossurface.c
@@ -603,6 +603,27 @@ _gdk_macos_surface_get_shadow (GdkMacosSurface *self,
*right = self->shadow_right;
}
+gboolean
+_gdk_macos_surface_is_opaque (GdkMacosSurface *self)
+{
+ g_return_val_if_fail (GDK_IS_MACOS_SURFACE (self), FALSE);
+
+ if (self->opaque_region != NULL &&
+ cairo_region_num_rectangles (self->opaque_region) == 1)
+ {
+ cairo_rectangle_int_t extents;
+
+ cairo_region_get_extents (self->opaque_region, &extents);
+
+ return (extents.x == 0 &&
+ extents.y == 0 &&
+ extents.width == GDK_SURFACE (self)->width &&
+ extents.height == GDK_SURFACE (self)->height);
+ }
+
+ return FALSE;
+}
+
const char *
_gdk_macos_surface_get_title (GdkMacosSurface *self)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]