From cb427a44505bbbbbd753abf6b2e29a5639693907 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ga=C3=ABl=20Bonithon?= <gael@xfce.org>
Date: Wed, 6 Dec 2023 21:05:34 +0100
Subject: [PATCH] build: Check for libxext

---
 configure.ac        | 13 ++-----------
 src/gs-window-x11.c | 10 ----------
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/configure.ac b/configure.ac
index e595242..3814d6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,6 +55,7 @@ GLIB_REQUIRED_VERSION=glib_required_version
 GTK_REQUIRED_VERSION=3.24.0
 DBUS_REQUIRED_VERSION=0.30
 X11_REQUIRED_VERSION=1.0
+XEXT_REQUIRED_VERSION=1.0
 LIBXKLAVIER_REQUIRED=5.2
 XRANDR_REQUIRED=1.3
 LIBXFCONF_REQUIRED=4.12.1
@@ -94,6 +95,7 @@ XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [glib_required_version])
 AC_CHECK_FUNCS([setresuid setenv unsetenv clearenv])
 PKG_CHECK_MODULES(XFCE_SCREENSAVER,
         x11 >= $X11_REQUIRED_VERSION
+        xext >= $XEXT_REQUIRED_VERSION
         xscrnsaver
         gtk+-3.0 >= $GTK_REQUIRED_VERSION
         dbus-glib-1 >= $DBUS_REQUIRED_VERSION
@@ -342,17 +344,6 @@ AC_DEFUN([HANDLE_X_PATH_ARG], [
    esac
   ])
 
-dnl ---------------------------------------------------------------------------
-dnl - Check for shaped window extension
-dnl ---------------------------------------------------------------------------
-
-have_shape=no
-AC_CHECK_X_HEADER(X11/extensions/shape.h, [have_shape=yes],,
-                    [#include <X11/Xlib.h>])
-if test "$have_shape" = yes; then
-  AC_DEFINE(HAVE_SHAPE_EXT, 1, [Define if shape extension is available])
-fi
-
 dnl ---------------------------------------------------------------------------
 dnl - Check for the XF86VMODE server extension (for gamma fading.)
 dnl ---------------------------------------------------------------------------
diff --git a/src/gs-window-x11.c b/src/gs-window-x11.c
index 89e92a6..0fae1fc 100644
--- a/src/gs-window-x11.c
+++ b/src/gs-window-x11.c
@@ -33,9 +33,7 @@
 #include <gtk/gtk.h>
 #include <gtk/gtkx.h>
 
-#ifdef HAVE_SHAPE_EXT
 #include <X11/extensions/shape.h>
-#endif
 
 #include "gs-debug.h"
 #include "gs-marshal.h"
@@ -104,9 +102,7 @@ struct GSWindowPrivate {
 
     GTimer          *timer;
 
-#ifdef HAVE_SHAPE_EXT
     int              shape_event_base;
-#endif
 };
 
 enum {
@@ -466,7 +462,6 @@ x11_window_is_ours (Window window) {
     return ret;
 }
 
-#ifdef HAVE_SHAPE_EXT
 static void
 unshape_window (GSWindow *window) {
     gdk_window_shape_combine_region (gtk_widget_get_window (GTK_WIDGET (window)),
@@ -474,7 +469,6 @@ unshape_window (GSWindow *window) {
                                      0,
                                      0);
 }
-#endif
 
 static void
 gs_window_xevent (GSWindow  *window,
@@ -512,13 +506,11 @@ gs_window_xevent (GSWindow  *window,
         }
         default:
             /* extension events */
-#ifdef HAVE_SHAPE_EXT
             if (ev->xany.type == (window->priv->shape_event_base + ShapeNotify)) {
                 /*XShapeEvent *xse = (XShapeEvent *) ev;*/
                 unshape_window (window);
                 gs_debug ("Window was reshaped!");
             }
-#endif
 
             break;
     }
@@ -554,7 +546,6 @@ select_popup_events (void) {
 
 static void
 window_select_shape_events (GSWindow *window) {
-#ifdef HAVE_SHAPE_EXT
     int            shape_error_base;
     GdkDisplay    *display;
 
@@ -570,7 +561,6 @@ window_select_shape_events (GSWindow *window) {
     }
 
     gdk_x11_display_error_trap_pop_ignored (display);
-#endif
 }
 
 static gboolean
-- 
GitLab