summaryrefslogtreecommitdiff
path: root/media-gfx/inkscape/files/inkscape-1.1.2-automagic-libX11.patch
blob: fe104415fb8906b961f4372f6b2116ab7202751f (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
From 6d0ace0518f0da18c7e81be1edecd50d997230b1 Mon Sep 17 00:00:00 2001
From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
Date: Tue, 11 May 2021 10:43:27 +0200
Subject: [PATCH] CMake: Fix automagic dependency on X11

Related: https://bugs.gentoo.org/768663
Related: https://github.com/gentoo/gentoo/pull/20181
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,6 +36,7 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME inkscape) # needs to be before any inst
 
 include(GNUInstallDirs) # for the CMAKE_INSTALL_LIBDIR variable
 include(CMakeScripts/ConfigPaths.cmake)
+include(CMakeDependentOption)
 
 set(PROJECT_NAME inkscape)
 
@@ -126,6 +127,7 @@ option(WITH_GSPELL "Compile with support of gspell" ON)
 option(WITH_NLS "Compile with Native Language Support (using gettext)" ON)
 option(WITH_JEMALLOC "Compile with JEMALLOC support" OFF)
 option(WITH_ASAN "Compile with Clang's AddressSanitizer (for debugging purposes)" OFF)
+cmake_dependent_option(WITH_X11 "Compile with X11 support" ON "UNIX; NOT APPLE" OFF)
 option(WITH_INTERNAL_2GEOM "Prefer internal copy of lib2geom" OFF)
 
 option(WITH_FUZZ "Compile for fuzzing purpose (use 'make fuzz' only)" OFF)
@@ -285,6 +287,7 @@ message("WITH_LIBWPG:             ${WITH_LIBWPG}")
 message("WITH_NLS:                ${WITH_NLS}")
 message("WITH_OPENMP:             ${WITH_OPENMP}")
 message("WITH_JEMALLOC:           ${WITH_JEMALLOC}")
+message("WITH_X11:                ${WITH_X11}")
 message("WITH_INTERNAL_2GEOM:     ${WITH_INTERNAL_2GEOM}")
 
 message("WITH_PROFILING:          ${WITH_PROFILING}")
--- a/CMakeScripts/DefineDependsandFlags.cmake
+++ b/CMakeScripts/DefineDependsandFlags.cmake
@@ -403,12 +403,17 @@ sanitize_ldflags_for_libs(SIGC++_LDFLAGS)
 list(APPEND INKSCAPE_LIBS ${SIGC++_LDFLAGS})
 list(APPEND INKSCAPE_CXX_FLAGS ${SIGC++_CFLAGS_OTHER})
 
-# Some linkers, like gold, don't find symbols recursively. So we have to link against X11 explicitly
-find_package(X11)
-if(X11_FOUND)
+if(WITH_X11)
+    find_package(X11 REQUIRED)
     list(APPEND INKSCAPE_INCS_SYS ${X11_INCLUDE_DIRS})
     list(APPEND INKSCAPE_LIBS ${X11_LIBRARIES})
-endif(X11_FOUND)
+    add_definitions(-DHAVE_X11)
+
+    pkg_get_variable(GTK3_TARGETS gtk+-3.0 targets)
+    if(NOT("${GTK3_TARGETS}" MATCHES "x11"))
+        message(FATAL_ERROR "GTK+3 doesn't targets X11, this is required for WITH_X11")
+    endif()
+endif(WITH_X11)
 
 # end Dependencies
 
--- a/src/ege-color-prof-tracker.cpp
+++ b/src/ege-color-prof-tracker.cpp
@@ -46,11 +46,11 @@
 
 #include <gtk/gtk.h>
 
-#ifdef GDK_WINDOWING_X11
+#ifdef HAVE_X11
 #include <X11/Xlib.h>
 
 #include <gdk/gdkx.h>
-#endif /* GDK_WINDOWING_X11 */
+#endif /* HAVE_X11 */
 
 #include "ege-color-prof-tracker.h"
 #include "helper/sp-marshal.h"
@@ -69,24 +69,24 @@ static void ege_color_prof_tracker_dispose(GObject *);
 
 class ScreenTrack {
     public:
-#ifdef GDK_WINDOWING_X11
+#ifdef HAVE_X11
     gboolean zeroSeen;
     gboolean otherSeen;
-#endif /* GDK_WINDOWING_X11 */
+#endif /* HAVE_X11 */
     std::vector<EgeColorProfTracker *> *trackers;
     GPtrArray* profiles;
     ~ScreenTrack(){ delete trackers; }
 };
 
 
-#ifdef GDK_WINDOWING_X11
+#ifdef HAVE_X11
 GdkFilterReturn x11_win_filter(GdkXEvent *xevent, GdkEvent *event, gpointer data);
 void handle_property_change(GdkScreen* screen, const gchar* name);
 void add_x11_tracking_for_screen(GdkScreen* screen);
 static void fire(gint monitor);
 static void clear_profile( guint monitor );
 static void set_profile( guint monitor, const guint8* data, guint len );
-#endif /* GDK_WINDOWING_X11 */
+#endif /* HAVE_X11 */
 
 static guint signals[LAST_SIGNAL] = {0};
 
@@ -323,10 +323,10 @@ void track_screen( GdkScreen* screen, EgeColorProfTracker* tracker )
 
         int numMonitors = gdk_display_get_n_monitors(display);
 
-#ifdef GDK_WINDOWING_X11
+#ifdef HAVE_X11
         tracked_screen->zeroSeen = FALSE;
         tracked_screen->otherSeen = FALSE;
-#endif /* GDK_WINDOWING_X11 */
+#endif /* HAVE_X11 */
         tracked_screen->trackers= new std::vector<EgeColorProfTracker *>;
         tracked_screen->trackers->push_back(tracker );
         tracked_screen->profiles = g_ptr_array_new();
@@ -336,14 +336,14 @@ void track_screen( GdkScreen* screen, EgeColorProfTracker* tracker )
 
         g_signal_connect( G_OBJECT(screen), "size-changed", G_CALLBACK( screen_size_changed_cb ), tracker );
 
-#ifdef GDK_WINDOWING_X11
+#ifdef HAVE_X11
         if (GDK_IS_X11_DISPLAY (display) ) {
             // printf( "track_screen: Display is using X11\n" );
             add_x11_tracking_for_screen(screen);
         } else {
             // printf( "track_screen: Display is not using X11\n" );
         }
-#endif // GDK_WINDOWING_X11
+#endif // HAVE_X11
     }
 }
 
@@ -411,13 +411,13 @@ void screen_size_changed_cb(GdkScreen* screen, gpointer user_data)
         if ( numMonitors > (gint)tracked_screen->profiles->len ) {
             for ( guint i = tracked_screen->profiles->len; i < (guint)numMonitors; i++ ) {
                 g_ptr_array_add( tracked_screen->profiles, nullptr );
-#ifdef GDK_WINDOWING_X11
+#ifdef HAVE_X11
                 if (GDK_IS_X11_DISPLAY (display) ) {
                     gchar* name = g_strdup_printf( "_ICC_PROFILE_%d", i );
                     handle_property_change( screen, name );
                     g_free(name);
                 }
-#endif /* GDK_WINDOWING_X11 */
+#endif /* HAVE_X11 */
             }
         } else if ( numMonitors < (gint)tracked_screen->profiles->len ) {
 /*             g_message("The count of monitors decreased, remove some"); */
@@ -425,7 +425,7 @@ void screen_size_changed_cb(GdkScreen* screen, gpointer user_data)
     }
 }
 
-#ifdef GDK_WINDOWING_X11
+#ifdef HAVE_X11
 GdkFilterReturn x11_win_filter(GdkXEvent *xevent,
                                GdkEvent *event,
                                gpointer data)
@@ -618,7 +618,7 @@ static void set_profile( guint monitor, const guint8* data, guint len )
         }
     }
 }
-#endif /* GDK_WINDOWING_X11 */
+#endif /* HAVE_X11 */
 /*
   Local Variables:
   mode:c++