[mutter/bilelmoussaoui/ctx-options: 1/2] cleanup: Make GDK dependency specific to X11
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/bilelmoussaoui/ctx-options: 1/2] cleanup: Make GDK dependency specific to X11
- Date: Thu, 26 May 2022 12:54:27 +0000 (UTC)
commit 7c75aadd7c1481e0f1b44e043e821b5a1db4587b
Author: Bilal Elmoussaoui <belmouss redhat com>
Date: Sun May 8 17:50:11 2022 +0200
cleanup: Make GDK dependency specific to X11
This way, the dependencies on GTK/GDK could be completely dropped if
built with Wayland only.
src/backends/x11/meta-input-settings-x11.c | 1 -
src/compositor/meta-dnd.c | 2 --
src/compositor/meta-shaped-texture.c | 48 ++++++++++++++++++++++++++++--
src/compositor/meta-window-actor.c | 2 ++
src/compositor/meta-window-group.c | 1 -
src/core/place.c | 1 -
src/x11/meta-x11-window-control.h | 1 -
7 files changed, 48 insertions(+), 8 deletions(-)
---
diff --git a/src/backends/x11/meta-input-settings-x11.c b/src/backends/x11/meta-input-settings-x11.c
index 0cfbb0aff3..3d51dc79e8 100644
--- a/src/backends/x11/meta-input-settings-x11.c
+++ b/src/backends/x11/meta-input-settings-x11.c
@@ -25,7 +25,6 @@
#include "backends/x11/meta-input-settings-x11.h"
-#include <gdk/gdkx.h>
#include <string.h>
#include <X11/Xatom.h>
#include <X11/extensions/XInput2.h>
diff --git a/src/compositor/meta-dnd.c b/src/compositor/meta-dnd.c
index 4053ccaeaf..629eebf473 100644
--- a/src/compositor/meta-dnd.c
+++ b/src/compositor/meta-dnd.c
@@ -19,8 +19,6 @@
#include "config.h"
-#include <gdk/gdkx.h>
-
#include "meta/meta-backend.h"
#include "compositor/compositor-private.h"
#include "core/display-private.h"
diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c
index 34fec6852a..c4f540b01b 100644
--- a/src/compositor/meta-shaped-texture.c
+++ b/src/compositor/meta-shaped-texture.c
@@ -36,7 +36,6 @@
#include "compositor/meta-shaped-texture-private.h"
#include "core/boxes-private.h"
-#include <gdk/gdk.h>
#include <math.h>
#include "cogl/cogl.h"
@@ -652,6 +651,51 @@ flip_ints (int *x,
*y = tmp;
}
+/**
+ * rectangle_intersect:
+ *
+ * Copied from GDK
+ * <https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkrectangle.c#L108>
+ */
+static gboolean
+rectangle_intersect (const cairo_rectangle_int_t *src1,
+ const cairo_rectangle_int_t *src2,
+ cairo_rectangle_int_t *dest)
+{
+ int dest_x, dest_y;
+ int dest_x2, dest_y2;
+ int return_val;
+
+ g_return_val_if_fail (src1 != NULL, FALSE);
+ g_return_val_if_fail (src2 != NULL, FALSE);
+
+ return_val = FALSE;
+
+ dest_x = MAX (src1->x, src2->x);
+ dest_y = MAX (src1->y, src2->y);
+ dest_x2 = MIN (src1->x + src1->width, src2->x + src2->width);
+ dest_y2 = MIN (src1->y + src1->height, src2->y + src2->height);
+
+ if (dest_x2 > dest_x && dest_y2 > dest_y)
+ {
+ if (dest)
+ {
+ dest->x = dest_x;
+ dest->y = dest_y;
+ dest->width = dest_x2 - dest_x;
+ dest->height = dest_y2 - dest_y;
+ }
+ return_val = TRUE;
+ }
+ else if (dest)
+ {
+ dest->width = 0;
+ dest->height = 0;
+ }
+
+ return return_val;
+}
+
static void
do_paint_content (MetaShapedTexture *stex,
ClutterPaintNode *root_node,
@@ -846,7 +890,7 @@ do_paint_content (MetaShapedTexture *stex,
cairo_rectangle_int_t rect;
cairo_region_get_rectangle (blended_tex_region, i, &rect);
- if (!gdk_rectangle_intersect (&content_rect, &rect, &rect))
+ if (!rectangle_intersect (&content_rect, &rect, &rect))
continue;
paint_clipped_rectangle_node (stex, root_node,
diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c
index ae1fa4d903..d9495ca401 100644
--- a/src/compositor/meta-window-actor.c
+++ b/src/compositor/meta-window-actor.c
@@ -21,7 +21,9 @@
#include "config.h"
+#if 0
#include <gdk/gdk.h>
+#endif
#include <math.h>
#include <string.h>
diff --git a/src/compositor/meta-window-group.c b/src/compositor/meta-window-group.c
index 16ff2db097..23958045d2 100644
--- a/src/compositor/meta-window-group.c
+++ b/src/compositor/meta-window-group.c
@@ -2,7 +2,6 @@
#include "config.h"
-#include <gdk/gdk.h>
#include <math.h>
#include "compositor/clutter-utils.h"
diff --git a/src/core/place.c b/src/core/place.c
index 1075fe20d5..f19d45f238 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -26,7 +26,6 @@
#include "core/place.h"
-#include <gdk/gdk.h>
#include <math.h>
#include <stdlib.h>
diff --git a/src/x11/meta-x11-window-control.h b/src/x11/meta-x11-window-control.h
index dfb66f262c..6f378f3359 100644
--- a/src/x11/meta-x11-window-control.h
+++ b/src/x11/meta-x11-window-control.h
@@ -23,7 +23,6 @@
#ifndef META_X11_WINDOW__CONTROL_H
#define META_X11_WINDOW__CONTROL_H
-#include <gdk/gdkx.h>
#include "meta/boxes.h"
#include "meta/common.h"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]