summaryrefslogtreecommitdiff
path: root/media-gfx/shotwell/files/0.30.16-optional-wayland.patch
blob: 5cc82e67dc7dddfa557f84d005366b7d0363994e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Make wayland backend optional

* Unfortunately, upstream is hostile to making wayland optional:
  https://gitlab.gnome.org/GNOME/shotwell/-/merge_requests/57#note_1500284

See: https://bugs.gentoo.org/836831

--- a/meson.build
+++ b/meson.build
@@ -64,7 +64,14 @@
 libraw = dependency('libraw', version : '>= 0.13.2')
 libexif = dependency('libexif', version : '>= 0.6.16')
 unity = dependency('unity', required : false)
-gdk = [ dependency('gdk-x11-3.0'), dependency('gdk-wayland-3.0') ]
+gdk = [ dependency('gdk-x11-3.0') ]
+add_global_arguments(['--define=HAVE_X11_BACKEND'],
+                     language : 'vala')
+if get_option('wayland')
+  gdk += [dependency('gdk-wayland-3.0')]
+  add_global_arguments(['--define=HAVE_WAYLAND_BACKEND'],
+                       language : 'vala')
+endif
 
 unity_available = false
 if unity.found() and get_option('unity-support')
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,3 +8,4 @@
 option('install-apport-hook', type : 'boolean', value : 'true', description: 'Enable Ubuntu apport hook')
 option('face-detection', type:'boolean', value:false, description: 'Enable face detection and recognition features')
 option('fatal_warnings', type:'boolean', value:false)
+option('wayland', type: 'boolean', value: true, description: 'Enable Wayland support')
--- a/src/Portal.vala
+++ b/src/Portal.vala
@@ -53,6 +53,7 @@
     private static async string get_parent_window () {
         var window = AppWindow.get_instance().get_window ();
 
+#if HAVE_WAYLAND_BACKEND
         if (window is Gdk.Wayland.Window) {
             var handle = "wayland:";
             ((Gdk.Wayland.Window) window).export_handle ((w, h) => {
@@ -61,9 +62,14 @@
             });
             yield;
             return handle;
-        } else if (window is Gdk.X11.Window) {
+        } else
+#endif
+#if HAVE_X11_BACKEND
+        if (window is Gdk.X11.Window) {
             return "x11:%x".printf ((uint) ((Gdk.X11.Window) window).get_xid ());
-        } else {
+        } else
+#endif
+        {
             warning ("Could not get parent window");
             return "";
         }