[gnome-build-meta/jjardon/wayland_only] elements/core/gnome-desktop.bst: Apply patches to build without gdkx



commit 4dc724a27e0a62a06a4014c8ac7f4a9d98a16894
Author: Javier Jardón <jjardon gnome org>
Date:   Sun Nov 24 18:38:28 2019 +0900

    elements/core/gnome-desktop.bst: Apply patches to build without gdkx

 elements/core/gnome-desktop.bst                    |   8 +
 .../0001-crossfade-remove-gdkx-x-dependency.patch  |  66 ++++
 ...ome-idle-monitor.c-Remove-gdkx-dependency.patch |  41 +++
 ...sktop-gnome-rr-config.c-Remove-unneded-gd.patch |  27 ++
 .../0002-gnomebg-remove-gdkx-x-dependency.patch    | 364 +++++++++++++++++++++
 5 files changed, 506 insertions(+)
---
diff --git a/elements/core/gnome-desktop.bst b/elements/core/gnome-desktop.bst
index 06e75aa0..69a54763 100644
--- a/elements/core/gnome-desktop.bst
+++ b/elements/core/gnome-desktop.bst
@@ -3,6 +3,14 @@ sources:
 - kind: git_tag
   url: gitlab_gnome_org:GNOME/gnome-desktop.git
   track: master
+- kind: patch
+  path: files/gnome-desktop/0001-crossfade-remove-gdkx-x-dependency.patch
+- kind: patch
+  path: files/gnome-desktop/0002-gnomebg-remove-gdkx-x-dependency.patch
+- kind: patch
+  path: files/gnome-desktop/0001-libgnome-desktop-gnome-rr-config.c-Remove-unneded-gd.patch
+- kind: patch
+  path: files/gnome-desktop/0001-gnome-idle-monitor.c-Remove-gdkx-dependency.patch
 build-depends:
 - sdk/gtk-doc.bst
 - freedesktop-sdk.bst:public-stacks/buildsystem-meson.bst
diff --git a/files/gnome-desktop/0001-crossfade-remove-gdkx-x-dependency.patch 
b/files/gnome-desktop/0001-crossfade-remove-gdkx-x-dependency.patch
new file mode 100644
index 00000000..f0668a16
--- /dev/null
+++ b/files/gnome-desktop/0001-crossfade-remove-gdkx-x-dependency.patch
@@ -0,0 +1,66 @@
+From 021f97d9be50a857f0cfa1859fc77785d2b7e1f7 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts muktupavels gmail com>
+Date: Fri, 31 Oct 2014 23:09:10 +0200
+Subject: [PATCH 1/2] crossfade: remove gdkx/x dependency
+
+---
+ libgnome-desktop/gnome-bg-crossfade.c | 29 +--------------------------
+ 1 file changed, 1 insertion(+), 28 deletions(-)
+
+diff --git a/libgnome-desktop/gnome-bg-crossfade.c b/libgnome-desktop/gnome-bg-crossfade.c
+index 77098423..f254b313 100644
+--- a/libgnome-desktop/gnome-bg-crossfade.c
++++ b/libgnome-desktop/gnome-bg-crossfade.c
+@@ -27,13 +27,9 @@
+ #include <gio/gio.h>
+ 
+ #include <gdk/gdk.h>
+-#include <gdk/gdkx.h>
+-#include <X11/Xlib.h>
+-#include <X11/Xatom.h>
+ #include <gtk/gtk.h>
+ 
+ #include <cairo.h>
+-#include <cairo-xlib.h>
+ 
+ #define GNOME_DESKTOP_USE_UNSTABLE_API
+ #include "gnome-bg.h"
+@@ -365,34 +361,11 @@ animations_are_disabled (GnomeBGCrossfade *fade)
+       return !are_enabled;
+ }
+ 
+-static void
+-send_root_property_change_notification (GnomeBGCrossfade *fade)
+-{
+-        long zero_length_pixmap;
+-
+-        /* We do a zero length append to force a change notification,
+-         * without changing the value */
+-        XChangeProperty (GDK_WINDOW_XDISPLAY (fade->priv->window),
+-                         GDK_WINDOW_XID (fade->priv->window),
+-                         gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
+-                         XA_PIXMAP, 32, PropModeAppend,
+-                         (guchar *) &zero_length_pixmap, 0);
+-}
+-
+ static void
+ draw_background (GnomeBGCrossfade *fade)
+ {
+       if (gdk_window_get_window_type (fade->priv->window) == GDK_WINDOW_ROOT) {
+-                XClearArea (GDK_WINDOW_XDISPLAY (fade->priv->window),
+-                            GDK_WINDOW_XID (fade->priv->window),
+-                            0, 0,
+-                            gdk_window_get_width (fade->priv->window),
+-                            gdk_window_get_height (fade->priv->window),
+-                            False);
+-
+-                send_root_property_change_notification (fade);
+-
+-              gdk_flush ();
++              g_warning ("Crossfade is not supported on ROOT window!");
+       } else {
+               gdk_window_invalidate_rect (fade->priv->window, NULL, FALSE);
+               gdk_window_process_updates (fade->priv->window, FALSE);
+-- 
+2.23.0
+
diff --git a/files/gnome-desktop/0001-gnome-idle-monitor.c-Remove-gdkx-dependency.patch 
b/files/gnome-desktop/0001-gnome-idle-monitor.c-Remove-gdkx-dependency.patch
new file mode 100644
index 00000000..2ee6a51b
--- /dev/null
+++ b/files/gnome-desktop/0001-gnome-idle-monitor.c-Remove-gdkx-dependency.patch
@@ -0,0 +1,41 @@
+From 7a4234dd62d20544f0aae51131690ee8152fd729 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Javier=20Jard=C3=B3n?= <jjardon gnome org>
+Date: Sun, 24 Nov 2019 19:47:16 +0900
+Subject: [PATCH] gnome-idle-monitor.c: Remove gdkx dependency
+
+---
+ libgnome-desktop/gnome-idle-monitor.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/libgnome-desktop/gnome-idle-monitor.c b/libgnome-desktop/gnome-idle-monitor.c
+index d7583a2b..2f8c5485 100644
+--- a/libgnome-desktop/gnome-idle-monitor.c
++++ b/libgnome-desktop/gnome-idle-monitor.c
+@@ -25,7 +25,9 @@
+ 
+ #include <glib.h>
+ #include <glib/gi18n-lib.h>
++#ifdef GDK_WINDOWING_X11
+ #include <gdk/gdkx.h>
++#endif
+ #include <gdk/gdk.h>
+ #if defined(GDK_WINDOWING_WAYLAND)
+ #include <gdk/gdkwayland.h>
+@@ -208,8 +210,14 @@ gnome_idle_monitor_set_property (GObject      *object,
+ 
+               g_free (monitor->priv->path);
+               if (monitor->priv->device) {
++#ifdef GDK_WINDOWING_X11
++              if(GDK_IS_X11_DISPLAY(gdk_display_get_default())){
+                       monitor->priv->path = g_strdup_printf ("/org/gnome/Mutter/IdleMonitor/Device%d",
+                                                              gdk_x11_device_get_id (monitor->priv->device));
++#else
++                      monitor->priv->path = g_strdup_printf ("/org/gnome/Mutter/IdleMonitor/Device%s",
++                                                             gdk_device_get_product_id 
(monitor->priv->device));
++#endif
+               } else {
+                       monitor->priv->path = g_strdup ("/org/gnome/Mutter/IdleMonitor/Core");
+               }
+-- 
+2.23.0
+
diff --git a/files/gnome-desktop/0001-libgnome-desktop-gnome-rr-config.c-Remove-unneded-gd.patch 
b/files/gnome-desktop/0001-libgnome-desktop-gnome-rr-config.c-Remove-unneded-gd.patch
new file mode 100644
index 00000000..80b751e9
--- /dev/null
+++ b/files/gnome-desktop/0001-libgnome-desktop-gnome-rr-config.c-Remove-unneded-gd.patch
@@ -0,0 +1,27 @@
+From 8a7e90c2082746426a1cef3a852c51d9e7e1b64f Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Javier=20Jard=C3=B3n?= <jjardon gnome org>
+Date: Sun, 24 Nov 2019 18:56:15 +0900
+Subject: [PATCH] libgnome-desktop/gnome-rr-config.c: Remove unneded gdkx
+ headers
+
+---
+ libgnome-desktop/gnome-rr-config.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c
+index 610cb43c..d30d7ea9 100644
+--- a/libgnome-desktop/gnome-rr-config.c
++++ b/libgnome-desktop/gnome-rr-config.c
+@@ -33,9 +33,6 @@
+ #include <glib.h>
+ #include <glib/gstdio.h>
+ 
+-#include <X11/Xlib.h>
+-#include <gdk/gdkx.h>
+-
+ #include "gnome-rr-config.h"
+ 
+ #include "gnome-rr-private.h"
+-- 
+2.23.0
+
diff --git a/files/gnome-desktop/0002-gnomebg-remove-gdkx-x-dependency.patch 
b/files/gnome-desktop/0002-gnomebg-remove-gdkx-x-dependency.patch
new file mode 100644
index 00000000..a1b61303
--- /dev/null
+++ b/files/gnome-desktop/0002-gnomebg-remove-gdkx-x-dependency.patch
@@ -0,0 +1,364 @@
+From 1d235bfcd335613762aeb5fb39a5f6b457cf5b43 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= <alberts muktupavels gmail com>
+Date: Sun, 24 Nov 2019 18:19:44 +0900
+Subject: [PATCH 2/2] gnomebg: remove gdkx/x dependency
+
+---
+ libgnome-desktop/gnome-bg.c | 291 ++----------------------------------
+ 1 file changed, 9 insertions(+), 282 deletions(-)
+
+diff --git a/libgnome-desktop/gnome-bg.c b/libgnome-desktop/gnome-bg.c
+index 230a2f29..35e9c568 100644
+--- a/libgnome-desktop/gnome-bg.c
++++ b/libgnome-desktop/gnome-bg.c
+@@ -35,12 +35,7 @@ Author: Soren Sandmann <sandmann redhat com>
+ #include <glib/gstdio.h>
+ #include <gio/gio.h>
+ 
+-#include <gdk/gdkx.h>
+-#include <X11/Xlib.h>
+-#include <X11/Xatom.h>
+-
+ #include <cairo.h>
+-#include <cairo-xlib.h>
+ 
+ #define GNOME_DESKTOP_USE_UNSTABLE_API
+ #include "gnome-bg.h"
+@@ -111,10 +106,6 @@ static guint signals[N_SIGNALS] = { 0 };
+ 
+ G_DEFINE_TYPE (GnomeBG, gnome_bg, G_TYPE_OBJECT)
+ 
+-static cairo_surface_t *make_root_pixmap     (GdkScreen  *screen,
+-                                              gint        width,
+-                                              gint        height);
+-
+ /* Pixbuf utils */
+ static void       pixbuf_average_value (GdkPixbuf  *pixbuf,
+                                         GdkRGBA    *result);
+@@ -1062,6 +1053,9 @@ gnome_bg_create_surface (GnomeBG     *bg,
+       g_return_val_if_fail (bg != NULL, NULL);
+       g_return_val_if_fail (window != NULL, NULL);
+ 
++      if (root)
++              return NULL;
++
+         if (bg->pixbuf_cache &&
+             gdk_pixbuf_get_width (bg->pixbuf_cache) != width &&
+             gdk_pixbuf_get_height (bg->pixbuf_cache) != height) {
+@@ -1071,16 +1065,10 @@ gnome_bg_create_surface (GnomeBG           *bg,
+ 
+       /* has the side effect of loading and caching pixbuf only when in tile mode */
+       gnome_bg_get_pixmap_size (bg, width, height, &pm_width, &pm_height);
+-      
+-      if (root) {
+-              surface = make_root_pixmap (gdk_window_get_screen (window),
+-                                         pm_width, pm_height);
+-      }
+-      else {
+-              surface = gdk_window_create_similar_surface (window,
+-                                                             CAIRO_CONTENT_COLOR,
+-                                                             pm_width, pm_height);
+-      }
++
++      surface = gdk_window_create_similar_surface (window,
++                                                     CAIRO_CONTENT_COLOR,
++                                                     pm_width, pm_height);
+ 
+       if (surface == NULL)
+               return NULL;
+@@ -1153,57 +1141,6 @@ gnome_bg_is_dark (GnomeBG *bg,
+       return intensity < 160; /* biased slightly to be dark */
+ }
+ 
+-/* 
+- * Create a persistent pixmap. We create a separate display
+- * and set the closedown mode on it to RetainPermanent.
+- */
+-static cairo_surface_t *
+-make_root_pixmap (GdkScreen *screen, gint width, gint height)
+-{
+-      Display *display;
+-        const char *display_name;
+-      Pixmap result;
+-        cairo_surface_t *surface;
+-      int screen_num;
+-      int depth;
+-      
+-      screen_num = gdk_screen_get_number (screen);
+-      
+-      gdk_flush ();
+-      
+-      display_name = gdk_display_get_name (gdk_screen_get_display (screen));
+-      display = XOpenDisplay (display_name);
+-      
+-        if (display == NULL) {
+-                g_warning ("Unable to open display '%s' when setting "
+-                         "background pixmap\n",
+-                           (display_name) ? display_name : "NULL");
+-                return NULL;
+-        }
+-      
+-      /* Desktop background pixmap should be created from 
+-       * dummy X client since most applications will try to
+-       * kill it with XKillClient later when changing pixmap
+-       */
+-      
+-      XSetCloseDownMode (display, RetainPermanent);
+-      
+-      depth = DefaultDepth (display, screen_num);
+-
+-      result = XCreatePixmap (display,
+-                              RootWindow (display, screen_num),
+-                              width, height, depth);
+-      
+-      XCloseDisplay (display);
+-      
+-      surface = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (screen),
+-                                             result,
+-                                             GDK_VISUAL_XVISUAL (gdk_screen_get_system_visual (screen)),
+-                                           width, height);
+-
+-      return surface;
+-}
+-
+ static gboolean
+ get_original_size (const char *filename,
+                  int        *orig_width,
+@@ -1329,168 +1266,7 @@ gnome_bg_create_thumbnail (GnomeBG               *bg,
+ cairo_surface_t *
+ gnome_bg_get_surface_from_root (GdkScreen *screen)
+ {
+-      int result;
+-      gint format;
+-      gulong nitems;
+-      gulong bytes_after;
+-      gpointer data;
+-      Atom type;
+-      Display *display;
+-      int screen_num;
+-      cairo_surface_t *surface;
+-      cairo_surface_t *source_pixmap;
+-      int width, height;
+-      cairo_t *cr;
+-
+-      display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+-      screen_num = gdk_screen_get_number (screen);
+-
+-      result = XGetWindowProperty (display,
+-                                   RootWindow (display, screen_num),
+-                                   gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"),
+-                                   0L, 1L, False, XA_PIXMAP,
+-                                   &type, &format, &nitems, &bytes_after,
+-                                   (guchar **) &data);
+-      surface = NULL;
+-      source_pixmap = NULL;
+-
+-      if (result != Success || type != XA_PIXMAP ||
+-          format != 32 || nitems != 1) {
+-              XFree (data);
+-              data = NULL;
+-      }
+-
+-      if (data != NULL) {
+-                Pixmap xpixmap = *(Pixmap *) data;
+-                Window root_return;
+-                int x_ret, y_ret;
+-                unsigned int w_ret, h_ret, bw_ret, depth_ret;
+-
+-              gdk_error_trap_push ();
+-                if (XGetGeometry (GDK_SCREEN_XDISPLAY (screen),
+-                                  xpixmap,
+-                                  &root_return,
+-                                  &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret, &depth_ret)) {
+-                        source_pixmap = cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (screen),
+-                                                                   xpixmap,
+-                                                                   GDK_VISUAL_XVISUAL 
(gdk_screen_get_system_visual (screen)),
+-                                                                   w_ret, h_ret);
+-                }
+-
+-                gdk_error_trap_pop_ignored ();
+-      }
+-
+-      width = gdk_screen_get_width (screen);
+-      height = gdk_screen_get_height (screen);
+-
+-        if (source_pixmap) {
+-                surface = cairo_surface_create_similar (source_pixmap,
+-                                                        CAIRO_CONTENT_COLOR,
+-                                                        width, height);
+-
+-                cr = cairo_create (surface);
+-                cairo_set_source_surface (cr, source_pixmap, 0, 0);
+-                cairo_paint (cr);
+-
+-                if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) {
+-                        cairo_surface_destroy (surface);
+-                        surface = NULL;
+-                }
+-
+-                cairo_destroy (cr);
+-        }
+-
+-        if (surface == NULL) {
+-              surface = gdk_window_create_similar_surface (gdk_screen_get_root_window (screen),
+-                                                             CAIRO_CONTENT_COLOR,
+-                                                             width, height);
+-        }
+-
+-      if (source_pixmap != NULL)
+-              cairo_surface_destroy (source_pixmap);
+-
+-      if (data != NULL)
+-              XFree (data);
+-
+-      return surface;
+-}
+-
+-static void
+-gnome_bg_set_root_pixmap_id (GdkScreen       *screen,
+-                           cairo_surface_t *surface)
+-{
+-      int      result;
+-      gint     format;
+-      gulong   nitems;
+-      gulong   bytes_after;
+-      gpointer data_esetroot;
+-      Pixmap   pixmap_id;
+-      Atom     type;
+-      Display *display;
+-      int      screen_num;
+-      GdkRGBA *average;
+-
+-      screen_num = gdk_screen_get_number (screen);
+-      data_esetroot = NULL;
+-
+-      display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+-
+-      result = XGetWindowProperty (display,
+-                                   RootWindow (display, screen_num),
+-                                   gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"),
+-                                   0L, 1L, False, XA_PIXMAP,
+-                                   &type, &format, &nitems,
+-                                   &bytes_after,
+-                                   (guchar **) &data_esetroot);
+-
+-      if (data_esetroot != NULL) {
+-              if (result == Success && type == XA_PIXMAP &&
+-                  format == 32 &&
+-                  nitems == 1) {
+-                      gdk_error_trap_push ();
+-                      XKillClient (display, *(Pixmap *)data_esetroot);
+-                        gdk_error_trap_pop_ignored ();
+-              }
+-              XFree (data_esetroot);
+-      }
+-      
+-      pixmap_id = cairo_xlib_surface_get_drawable (surface);
+-      
+-      XChangeProperty (display, RootWindow (display, screen_num),
+-                       gdk_x11_get_xatom_by_name ("ESETROOT_PMAP_ID"),
+-                       XA_PIXMAP, 32, PropModeReplace,
+-                       (guchar *) &pixmap_id, 1);
+-      XChangeProperty (display, RootWindow (display, screen_num),
+-                       gdk_x11_get_xatom_by_name ("_XROOTPMAP_ID"), XA_PIXMAP,
+-                       32, PropModeReplace,
+-                       (guchar *) &pixmap_id, 1);
+-
+-      average = cairo_surface_get_user_data (surface, &average_color_key);
+-      if (average != NULL) {
+-              gchar *string;
+-
+-              string = gdk_rgba_to_string (average);
+-
+-              /* X encodes string lists as one big string with a nul
+-               * terminator after each item in the list.  That's why
+-               * the strlen has to be given; scanning for nul would
+-               * only find the first item.
+-               *
+-               * For now, we only want to set a single string.
+-               * Fortunately, since this is C, it comes with its own
+-               * nul and we can just give strlen + 1 for the size of
+-               * our "list".
+-               */
+-              XChangeProperty (display, RootWindow (display, screen_num),
+-                               gdk_x11_get_xatom_by_name ("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS"),
+-                               XA_STRING, 8, PropModeReplace,
+-                               (guchar *) string, strlen (string) + 1);
+-              g_free (string);
+-      } else {
+-              /* Could happen if we didn't create the surface... */
+-              XDeleteProperty (display, RootWindow (display, screen_num),
+-                               gdk_x11_get_xatom_by_name ("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS"));
+-      }
++      return NULL;
+ }
+ 
+ /**
+@@ -1509,27 +1285,6 @@ gnome_bg_set_root_pixmap_id (GdkScreen       *screen,
+ void
+ gnome_bg_set_surface_as_root (GdkScreen *screen, cairo_surface_t *surface)
+ {
+-      Display *display;
+-      int      screen_num;
+-
+-      g_return_if_fail (screen != NULL);
+-      g_return_if_fail (surface != NULL);
+-      g_return_if_fail (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_XLIB);
+-
+-      screen_num = gdk_screen_get_number (screen);
+-
+-      display = GDK_DISPLAY_XDISPLAY (gdk_screen_get_display (screen));
+-
+-      gdk_x11_display_grab (gdk_screen_get_display (screen));
+-
+-      gnome_bg_set_root_pixmap_id (screen, surface);
+-
+-      XSetWindowBackgroundPixmap (display, RootWindow (display, screen_num),
+-                                  cairo_xlib_surface_get_drawable (surface));
+-      XClearWindow (display, RootWindow (display, screen_num));
+-
+-      gdk_display_flush (gdk_screen_get_display (screen));
+-      gdk_x11_display_ungrab (gdk_screen_get_display (screen));
+ }
+ 
+ /**
+@@ -1548,35 +1303,7 @@ GnomeBGCrossfade *
+ gnome_bg_set_surface_as_root_with_crossfade (GdkScreen       *screen,
+                                            cairo_surface_t *surface)
+ {
+-      GdkDisplay *display;
+-      GdkWindow *root_window;
+-      cairo_surface_t *old_surface;
+-      int      width, height;
+-      GnomeBGCrossfade *fade;
+-
+-      g_return_val_if_fail (screen != NULL, NULL);
+-      g_return_val_if_fail (surface != NULL, NULL);
+-
+-      root_window = gdk_screen_get_root_window (screen);
+-
+-      width = gdk_screen_get_width (screen);
+-      height = gdk_screen_get_height (screen);
+-
+-      fade = gnome_bg_crossfade_new (width, height);
+-
+-      display = gdk_screen_get_display (screen);
+-      gdk_x11_display_grab (display);
+-      old_surface = gnome_bg_get_surface_from_root (screen);
+-      gnome_bg_set_root_pixmap_id (screen, surface);
+-      gnome_bg_crossfade_set_start_surface (fade, old_surface);
+-      cairo_surface_destroy (old_surface);
+-      gnome_bg_crossfade_set_end_surface (fade, surface);
+-      gdk_display_flush (display);
+-      gdk_x11_display_ungrab (display);
+-
+-      gnome_bg_crossfade_start (fade, root_window);
+-
+-      return fade;
++      return NULL;
+ }
+ 
+ /* Implementation of the pixbuf cache */
+-- 
+2.23.0
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]