From 9f6fb161e2f8dfea0e99abf98d2f39adeb994b56 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 1 Apr 2021 17:59:18 +0200 Subject: [PATCH 1/6] build: Set proper defaults for media backends GTK supports webm playback, which means a backend should always be compiled. The ffmpeg backend however is incomplete (no audio) and as such, we don't want people to end up with it accidentally. Since we don't want to drag an entire gstreamer build into our ci on MacOs or msvc, explicitly disable the gstreame media backend there. --- .gitlab-ci.yml | 1 + .gitlab-ci/test-msvc.bat | 2 +- meson_options.txt | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c100755896..8fddbcf284 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -172,6 +172,7 @@ macos: - meson -Dx11-backend=false -Dbroadway-backend=true -Dmacos-backend=true + -Dmedia-gstreamer=disabled -Dintrospection=disabled -Dcpp_std=c++11 -Dpixman:tests=disabled diff --git a/.gitlab-ci/test-msvc.bat b/.gitlab-ci/test-msvc.bat index 294e9480df..c6833f0c0e 100644 --- a/.gitlab-ci/test-msvc.bat +++ b/.gitlab-ci/test-msvc.bat @@ -6,7 +6,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar :: FIXME: make warnings fatal pip3 install --upgrade --user meson==0.56.2 || goto :error -meson _build || goto :error +meson -Dmedia-gstreamer=disabled _build || goto :error ninja -C _build || goto :error goto :EOF diff --git a/meson_options.txt b/meson_options.txt index 402caec5fb..2223cb7964 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -26,15 +26,17 @@ option('macos-backend', description : 'Enable the macOS gdk backend (only when building on macOS)') # Media backends +# For distros: GTK guarantees support for WebM video (VP8 and VP9), so a supported build +# should provide that. option('media-ffmpeg', type: 'feature', - value: 'auto', - description : 'Build the ffmpeg media backend') + value: 'disabled', + description : 'Build the experimental ffmpeg media backend') option('media-gstreamer', type: 'feature', - value: 'auto', + value: 'enabled', description : 'Build the gstreamer media backend') # Print backends From 4d5dc18a575ce76b5f2469832c8d0d805b355bd9 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 1 Apr 2021 18:08:19 +0200 Subject: [PATCH 2/6] build: disable Vulkan by default We don't want people to build Vulkan support when they just want to get GTK built. This is in particular true for GTK as a CI subproject or for people using jhbuild. Worse, just having Vulkan support compiled in tends to cause crashes in the Inspector, even if you are not using it. --- .gitlab-ci/test-docker.sh | 2 +- meson_options.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci/test-docker.sh b/.gitlab-ci/test-docker.sh index ada8edaba6..1df2da094a 100755 --- a/.gitlab-ci/test-docker.sh +++ b/.gitlab-ci/test-docker.sh @@ -15,7 +15,7 @@ meson \ -Dx11-backend=true \ -Dwayland-backend=true \ -Dbroadway-backend=true \ - -Dvulkan=yes \ + -Dvulkan=enabled \ -Dprofiler=true \ --werror \ ${EXTRA_MESON_FLAGS:-} \ diff --git a/meson_options.txt b/meson_options.txt index 2223cb7964..3a471a2025 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -50,8 +50,8 @@ option('print-cups', option('vulkan', type: 'feature', - value: 'auto', - description : 'Enable support for the Vulkan graphics API') + value: 'disabled', + description : 'Enable support for the experimental Vulkan graphics API') option('xinerama', type: 'feature', From af0c95c11a5039967cdeb6101ec467ac75f1ccfb Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 1 Apr 2021 21:29:41 +0200 Subject: [PATCH 3/6] build: Remove sassc option Instead, ensure that sassc is made madatory on git builds (because it is, we don't ship CSS files anymore) and not even looked for in release builds (because do ship CSS files there). --- gtk/meson.build | 30 ++++++++++++++++-------------- meson.build | 1 + meson_options.txt | 5 ----- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/gtk/meson.build b/gtk/meson.build index b42d793c86..bf108df11a 100644 --- a/gtk/meson.build +++ b/gtk/meson.build @@ -839,23 +839,25 @@ gtk_gresources_xml = configure_file(output: 'gtk.gresources.xml', ], ) -# Build the theme files -sassc = find_program('sassc', required: false) -if not sassc.found() and not get_option('sassc').disabled() - subproject('sassc') - sassc = find_program('sassc', required: get_option('sassc').enabled()) -endif +theme_deps = [] +# For git checkouts, but not for tarballs... +if not fs.exists('theme/Adwaita/Adwaita.css') + # ... build the theme files + sassc = find_program('sassc', required: false) + if not sassc.found() + subproject('sassc') + sassc = find_program('sassc', required: true) + endif -if sassc.found() - sassc_opts = [ '-a', '-M', '-t', 'compact' ] + if sassc.found() + sassc_opts = [ '-a', '-M', '-t', 'compact' ] - subdir('theme/Default') + subdir('theme/Default') - theme_deps = [ - default_theme_deps, - ] -else - theme_deps = [] + theme_deps += [ + default_theme_deps, + ] + endif endif gtkresources = gnome.compile_resources('gtkresources', diff --git a/meson.build b/meson.build index 1b5740a53c..10665b855d 100644 --- a/meson.build +++ b/meson.build @@ -24,6 +24,7 @@ cloudproviders_req = '>= 0.3.1' xkbcommon_req = '>= 0.2.0' sysprof_req = '>= 3.38.0' +fs = import('fs') gnome = import('gnome') pkg_config = import('pkgconfig') diff --git a/meson_options.txt b/meson_options.txt index 3a471a2025..29d1862031 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -78,11 +78,6 @@ option('colord', value: 'disabled', description : 'Build colord support for the CUPS printing backend') -option('sassc', - type: 'feature', - value: 'auto', - description: 'Rebuild themes using sassc') - option('f16c', type: 'feature', value: 'enabled', From e544c891ca2505339e33d96740f373414fa6c14e Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 2 Apr 2021 02:13:49 +0200 Subject: [PATCH 4/6] build: Make all X11 extensions mandatory It's not 2011 anymore, and we shouldn't randomly build one of 10.000 different combinations of X11 backends (I counted the possibilities) but exactly the one we expect people to use. --- meson.build | 65 ++++++++++++++++++++--------------------------- meson_options.txt | 5 ---- 2 files changed, 28 insertions(+), 42 deletions(-) diff --git a/meson.build b/meson.build index 10665b855d..f3e4fa1a2a 100644 --- a/meson.build +++ b/meson.build @@ -497,46 +497,36 @@ if x11_enabled xrender_dep = dependency('xrender') xi_dep = dependency('xi') xext_dep = dependency('xext') - xcursor_dep = dependency('xcursor', required: false) - xdamage_dep = dependency('xdamage', required: false) - xfixes_dep = dependency('xfixes', required: false) - xcomposite_dep = dependency('xcomposite', required: false) + xcursor_dep = dependency('xcursor') + xdamage_dep = dependency('xdamage') + xfixes_dep = dependency('xfixes') + xcomposite_dep = dependency('xcomposite') fontconfig_dep = dependency('fontconfig') - x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr'] + x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr', 'xcursor', 'xdamage', 'xfixes', 'xcomposite', 'xinerama'] - if xcursor_dep.found() - x11_pkgs += ['xcursor'] - endif - if xdamage_dep.found() - x11_pkgs += ['xdamage'] - endif - if xfixes_dep.found() - x11_pkgs += ['xfixes'] - endif - if xcomposite_dep.found() - x11_pkgs += ['xcomposite'] - endif + cdata.set('HAVE_XCURSOR', 1) + cdata.set('HAVE_XDAMAGE', 1) + cdata.set('HAVE_XCOMPOSITE', 1) + cdata.set('HAVE_XFIXES', 1) - cdata.set('HAVE_XCURSOR', xcursor_dep.found()) - cdata.set('HAVE_XDAMAGE', xdamage_dep.found()) - cdata.set('HAVE_XCOMPOSITE', xcomposite_dep.found()) - cdata.set('HAVE_XFIXES', xfixes_dep.found()) - - if cc.has_function('XkbQueryExtension', dependencies: x11_dep, - prefix : '#include ') - cdata.set('HAVE_XKB', 1) + if not cc.has_function('XkbQueryExtension', dependencies: x11_dep, + prefix : '#include ') + error('X11 backend enabled, but Xkb not found.') endif + cdata.set('HAVE_XKB', 1) - if cc.has_function('XSyncQueryExtension', dependencies: xext_dep, - prefix: '''#include - #include ''') - cdata.set('HAVE_XSYNC', 1) + if not cc.has_function('XSyncQueryExtension', dependencies: xext_dep, + prefix: '''#include + #include ''') + error('X11 backend enabled, but Xsync not found.') endif + cdata.set('HAVE_XSYNC', 1) - if cc.has_function('XGetEventData', dependencies: x11_dep) - cdata.set('HAVE_XGENERICEVENTS', 1) + if not cc.has_function('XGetEventData', dependencies: x11_dep) + error('X11 backend enabled, but no generic event support.') endif + cdata.set('HAVE_XGENERICEVENTS', 1) if not xi_dep.found() or not cc.has_header('X11/extensions/XInput2.h', dependencies: xi_dep) error('X11 backend enabled, but XInput2 not found.') @@ -549,15 +539,16 @@ if x11_enabled has_scroll_class_info = cc.has_member('XIScrollClassInfo', 'number', dependencies: xi_dep, prefix: '''#include #include ''') - if has_allow_touch_events and has_scroll_class_info - cdata.set('XINPUT_2_2', 1) + if not has_allow_touch_events or not has_scroll_class_info + error('X11 backend enabled, but XInput2.2 not found.') endif + cdata.set('XINPUT_2_2', 1) - xinerama_dep = dependency('xinerama', required: get_option('xinerama')) - if xinerama_dep.found() and cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep) - cdata.set('HAVE_XFREE_XINERAMA', 1) - x11_pkgs += ['xinerama'] + xinerama_dep = dependency('xinerama') + if not cc.has_header_symbol('X11/extensions/Xinerama.h', 'XineramaQueryExtension', dependencies: xinerama_dep) + error('X11 backend enabled, but Xinerama extension does not work.') endif + cdata.set('HAVE_XFREE_XINERAMA', 1) cdata.set('HAVE_RANDR', xrandr_dep.found()) cdata.set('HAVE_RANDR15', xrandr15_dep.found()) diff --git a/meson_options.txt b/meson_options.txt index 29d1862031..61878ceba4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -53,11 +53,6 @@ option('vulkan', value: 'disabled', description : 'Enable support for the experimental Vulkan graphics API') -option('xinerama', - type: 'feature', - value: 'auto', - description : 'Enable support for the X11 Xinerama extension') - option('cloudproviders', type: 'feature', value: 'disabled', From afc5f46ca90e65009522946fdc929d259e0d51ec Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 2 Apr 2021 02:52:49 +0200 Subject: [PATCH 5/6] x11: Remove unused headers --- gdk/x11/gdkdrop-x11.c | 3 --- gdk/x11/gdksurface-x11.c | 8 -------- 2 files changed, 11 deletions(-) diff --git a/gdk/x11/gdkdrop-x11.c b/gdk/x11/gdkdrop-x11.c index d9c1c4157f..3470382da7 100644 --- a/gdk/x11/gdkdrop-x11.c +++ b/gdk/x11/gdkdrop-x11.c @@ -45,9 +45,6 @@ #include #include #include -#ifdef HAVE_XCOMPOSITE -#include -#endif #include diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c index e4952f2c7b..8b5ea3c424 100644 --- a/gdk/x11/gdksurface-x11.c +++ b/gdk/x11/gdksurface-x11.c @@ -65,14 +65,6 @@ #include #endif -#ifdef HAVE_XCOMPOSITE -#include -#endif - -#ifdef HAVE_XFIXES -#include -#endif - const int _gdk_x11_event_mask_table[21] = { ExposureMask, From 0ae2acfb1a72675ed994fed7900e2a57e02bc733 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 2 Apr 2021 03:05:40 +0200 Subject: [PATCH 6/6] x11: Remove XComposite It's only used during DND to allow use of the root window's cow window as a DND target, because apparently gnome-shell used to think that was a great idea to DND to the overview. Somebody complain to gnome-shell devs about it not being a good idea if they want it fixed. Potentially using Wayland is a better idea though. This reverts 85ae875dcbfcfa3fbdca857dc90467d39b9ff0c5 Related: https://bugzilla.gnome.org/show_bug.cgi?id=601731 --- config.h.meson | 3 --- gdk/x11/gdkdisplay-x11.c | 22 ---------------------- gdk/x11/gdkdisplay-x11.h | 2 -- gdk/x11/gdkdrag-x11.c | 27 --------------------------- gdk/x11/meson.build | 1 - meson.build | 4 +--- 6 files changed, 1 insertion(+), 58 deletions(-) diff --git a/config.h.meson b/config.h.meson index 56b215b012..f4f55122ee 100644 --- a/config.h.meson +++ b/config.h.meson @@ -124,9 +124,6 @@ /* Define to 1 if you have the header file. */ #mesondefine HAVE_UNISTD_H -/* Have the XCOMPOSITE X extension */ -#mesondefine HAVE_XCOMPOSITE - /* Have the Xcursor library */ #mesondefine HAVE_XCURSOR diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 67ffa7b09c..703219a912 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -69,10 +69,6 @@ #include -#ifdef HAVE_XCOMPOSITE -#include -#endif - #ifdef HAVE_RANDR #include #endif @@ -1454,24 +1450,6 @@ gdk_x11_display_open (const char *display_name) #endif display_x11->have_xfixes = FALSE; -#ifdef HAVE_XCOMPOSITE - if (XCompositeQueryExtension (display_x11->xdisplay, - &ignore, &ignore)) - { - int major, minor; - - XCompositeQueryVersion (display_x11->xdisplay, &major, &minor); - - /* Prior to Composite version 0.4, composited windows clipped their - * parents, so you had to use IncludeInferiors to draw to the parent - * This isn't useful for our purposes, so require 0.4 - */ - display_x11->have_xcomposite = major > 0 || (major == 0 && minor >= 4); - } - else -#endif - display_x11->have_xcomposite = FALSE; - display_x11->have_shapes = FALSE; display_x11->have_input_shapes = FALSE; diff --git a/gdk/x11/gdkdisplay-x11.h b/gdk/x11/gdkdisplay-x11.h index 5ffae57b74..8eada4a8db 100644 --- a/gdk/x11/gdkdisplay-x11.h +++ b/gdk/x11/gdkdisplay-x11.h @@ -71,8 +71,6 @@ struct _GdkX11Display gboolean have_xfixes; int xfixes_event_base; - gboolean have_xcomposite; - gboolean have_randr12; gboolean have_randr13; gboolean have_randr15; diff --git a/gdk/x11/gdkdrag-x11.c b/gdk/x11/gdkdrag-x11.c index 515848bd5e..88e65a2a2c 100644 --- a/gdk/x11/gdkdrag-x11.c +++ b/gdk/x11/gdkdrag-x11.c @@ -47,9 +47,6 @@ #include #include #include -#ifdef HAVE_XCOMPOSITE -#include -#endif #include @@ -518,9 +515,6 @@ gdk_surface_cache_new (GdkDisplay *display) Window xroot_window = GDK_DISPLAY_XROOTWIN (display); GdkChildInfoX11 *children; guint nchildren, i; -#ifdef HAVE_XCOMPOSITE - Window cow; -#endif GdkSurfaceCache *result = g_new (GdkSurfaceCache, 1); @@ -571,27 +565,6 @@ gdk_surface_cache_new (GdkDisplay *display) g_free (children); -#ifdef HAVE_XCOMPOSITE - /* - * Add the composite overlay window to the cache, as this can be a reasonable - * Xdnd proxy as well. - * This is only done when the screen is composited in order to avoid mapping - * the COW. We assume that the CM is using the COW (which is true for pretty - * much any CM currently in use). - */ - if (gdk_display_is_composited (display)) - { - gdk_x11_display_error_trap_push (display); - cow = XCompositeGetOverlayWindow (xdisplay, xroot_window); - gdk_surface_cache_add (result, cow, 0, 0, - WidthOfScreen (GDK_X11_SCREEN (screen)->xscreen), - HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen), - TRUE); - XCompositeReleaseOverlayWindow (xdisplay, xroot_window); - gdk_x11_display_error_trap_pop_ignored (display); - } -#endif - return result; } diff --git a/gdk/x11/meson.build b/gdk/x11/meson.build index 082fc9803a..725570a1dc 100644 --- a/gdk/x11/meson.build +++ b/gdk/x11/meson.build @@ -69,7 +69,6 @@ gdk_x11_deps = [ xcursor_dep, xdamage_dep, xfixes_dep, - xcomposite_dep, xrandr_dep, xinerama_dep, ] diff --git a/meson.build b/meson.build index f3e4fa1a2a..8cabfefe7d 100644 --- a/meson.build +++ b/meson.build @@ -500,14 +500,12 @@ if x11_enabled xcursor_dep = dependency('xcursor') xdamage_dep = dependency('xdamage') xfixes_dep = dependency('xfixes') - xcomposite_dep = dependency('xcomposite') fontconfig_dep = dependency('fontconfig') - x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr', 'xcursor', 'xdamage', 'xfixes', 'xcomposite', 'xinerama'] + x11_pkgs = ['fontconfig', 'x11', 'xext', 'xi', 'xrandr', 'xcursor', 'xdamage', 'xfixes', 'xinerama'] cdata.set('HAVE_XCURSOR', 1) cdata.set('HAVE_XDAMAGE', 1) - cdata.set('HAVE_XCOMPOSITE', 1) cdata.set('HAVE_XFIXES', 1) if not cc.has_function('XkbQueryExtension', dependencies: x11_dep,