Gentoo Archives: gentoo-commits

From: Pacho Ramos <pacho@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: gui-libs/gtk/, gui-libs/gtk/files/
Date: Thu, 26 May 2022 09:44:13
Message-Id: 1653558232.3595434921b923d7f67e33c08e8e1f231dab9afc.pacho@gentoo
1 commit: 3595434921b923d7f67e33c08e8e1f231dab9afc
2 Author: Pacho Ramos <pacho <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 26 09:42:34 2022 +0000
4 Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org>
5 CommitDate: Thu May 26 09:43:52 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35954349
7
8 gui-libs/gtk: Fix default window sizes in X11
9
10 Upstream fix to prevent gtk4 windows from growing forever in X sessions
11
12 Closes: https://bugs.gentoo.org/844913
13 Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
14
15 .../gtk/files/gtk-4.6.4-update-shadow-size.patch | 33 ++++
16 gui-libs/gtk/gtk-4.6.4-r1.ebuild | 217 +++++++++++++++++++++
17 2 files changed, 250 insertions(+)
18
19 diff --git a/gui-libs/gtk/files/gtk-4.6.4-update-shadow-size.patch b/gui-libs/gtk/files/gtk-4.6.4-update-shadow-size.patch
20 new file mode 100644
21 index 000000000000..af69d4ad64e9
22 --- /dev/null
23 +++ b/gui-libs/gtk/files/gtk-4.6.4-update-shadow-size.patch
24 @@ -0,0 +1,33 @@
25 +From 213490099b7d24664ac635f25c9cf224d6a3e702 Mon Sep 17 00:00:00 2001
26 +From: Benjamin Otte <otte@××××××.com>
27 +Date: Thu, 26 May 2022 04:36:14 +0200
28 +Subject: [PATCH] x11: Always update shadow size
29 +
30 +Not updating shadow size unconditionally would lead to shadow size not
31 +being set on map, which would lead mutter to think that we are a Window
32 +without extents and then become confused when we suddenly set some.
33 +
34 +Make sure that doesn't happen by always having shadows set on map, just
35 +like GTK3.
36 +
37 +Fixes #4136
38 +---
39 + gdk/x11/gdksurface-x11.c | 2 +-
40 + 1 file changed, 1 insertion(+), 1 deletion(-)
41 +
42 +diff --git a/gdk/x11/gdksurface-x11.c b/gdk/x11/gdksurface-x11.c
43 +index 8567d83eb8..fb3b0bd7df 100644
44 +--- a/gdk/x11/gdksurface-x11.c
45 ++++ b/gdk/x11/gdksurface-x11.c
46 +@@ -280,7 +280,7 @@ compute_toplevel_size (GdkSurface *surface,
47 + gdk_toplevel_size_init (&size, bounds_width, bounds_height);
48 + gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
49 +
50 +- if (size.shadow.is_valid && update_geometry)
51 ++ if (size.shadow.is_valid)
52 + {
53 + update_shadow_size (surface,
54 + size.shadow.left,
55 +--
56 +GitLab
57 +
58
59 diff --git a/gui-libs/gtk/gtk-4.6.4-r1.ebuild b/gui-libs/gtk/gtk-4.6.4-r1.ebuild
60 new file mode 100644
61 index 000000000000..4abc0da0b05b
62 --- /dev/null
63 +++ b/gui-libs/gtk/gtk-4.6.4-r1.ebuild
64 @@ -0,0 +1,217 @@
65 +# Copyright 1999-2022 Gentoo Authors
66 +# Distributed under the terms of the GNU General Public License v2
67 +
68 +EAPI=8
69 +
70 +PYTHON_COMPAT=( python3_{8..10} )
71 +inherit gnome.org gnome2-utils meson optfeature python-any-r1 virtualx xdg
72 +
73 +DESCRIPTION="GTK is a multi-platform toolkit for creating graphical user interfaces"
74 +HOMEPAGE="https://www.gtk.org/ https://gitlab.gnome.org/GNOME/gtk/"
75 +
76 +LICENSE="LGPL-2+"
77 +SLOT="4"
78 +IUSE="aqua broadway colord cups examples ffmpeg gstreamer +introspection sysprof test vulkan wayland +X cpu_flags_x86_f16c"
79 +REQUIRED_USE="
80 + || ( aqua wayland X )
81 + test? ( introspection )
82 +"
83 +
84 +KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
85 +
86 +COMMON_DEPEND="
87 + >=dev-libs/fribidi-0.19.7
88 + >=dev-libs/glib-2.66.0:2
89 + >=media-libs/graphene-1.9.1[introspection?]
90 + >=media-libs/libepoxy-1.4[X(+)?]
91 + >=x11-libs/cairo-1.14[aqua?,glib,svg,X?]
92 + >=x11-libs/gdk-pixbuf-2.30:2[introspection?]
93 + >=x11-libs/pango-1.50.0[introspection?]
94 + media-libs/libpng:0=
95 + media-libs/tiff:0=
96 + media-libs/libjpeg-turbo:0=
97 + >=media-libs/harfbuzz-2.1.0:=
98 + x11-misc/shared-mime-info
99 +
100 + colord? ( >=x11-misc/colord-0.1.9:0= )
101 + cups? ( >=net-print/cups-2.0 )
102 + ffmpeg? ( media-video/ffmpeg )
103 + gstreamer? (
104 + >=media-libs/gst-plugins-bad-1.12.3
105 + >=media-libs/gst-plugins-base-1.12.3[opengl]
106 + )
107 + introspection? ( >=dev-libs/gobject-introspection-1.39:= )
108 + vulkan? ( media-libs/vulkan-loader:= )
109 + wayland? (
110 + >=dev-libs/wayland-1.20.0
111 + >=dev-libs/wayland-protocols-1.23
112 + media-libs/mesa[wayland]
113 + >=x11-libs/libxkbcommon-0.2
114 + )
115 + X? (
116 + >=app-accessibility/at-spi2-atk-2.5.3
117 + media-libs/fontconfig
118 + media-libs/mesa[X(+)]
119 + x11-libs/libX11
120 + >=x11-libs/libXi-1.8
121 + x11-libs/libXext
122 + >=x11-libs/libXrandr-1.5
123 + x11-libs/libXcursor
124 + x11-libs/libXfixes
125 + x11-libs/libXdamage
126 + x11-libs/libXinerama
127 + )
128 +"
129 +DEPEND="${COMMON_DEPEND}
130 + sysprof? ( >=dev-util/sysprof-capture-3.40.1:4 )
131 + X? ( x11-base/xorg-proto )
132 +"
133 +RDEPEND="${COMMON_DEPEND}
134 + >=dev-util/gtk-update-icon-cache-3
135 +"
136 +# librsvg for svg icons (PDEPEND to avoid circular dep), bug #547710
137 +PDEPEND="
138 + gnome-base/librsvg
139 + >=x11-themes/adwaita-icon-theme-3.14
140 +"
141 +BDEPEND="
142 + dev-libs/gobject-introspection-common
143 + introspection? (
144 + ${PYTHON_DEPS}
145 + $(python_gen_any_dep '
146 + dev-python/pygobject:3[${PYTHON_USEDEP}]
147 + ')
148 + )
149 + dev-python/docutils
150 + >=dev-util/gdbus-codegen-2.48
151 + dev-util/glib-utils
152 + >=sys-devel/gettext-0.19.7
153 + virtual/pkgconfig
154 + test? (
155 + dev-libs/glib:2
156 + wayland? ( dev-libs/weston[headless] )
157 + )
158 +"
159 +
160 +PATCHES=(
161 + # Fix https://gitlab.gnome.org/GNOME/gtk/-/issues/4136
162 + "${FILESDIR}/${P}-update-shadow-size.patch"
163 +)
164 +
165 +python_check_deps() {
166 + python_has_version "dev-python/pygobject:3[${PYTHON_USEDEP}]" || return
167 +}
168 +
169 +pkg_setup() {
170 + use introspection && python-any-r1_pkg_setup
171 +}
172 +
173 +src_prepare() {
174 + default
175 + xdg_environment_reset
176 +
177 + # dev-python/docutils installs rst2man.py, not rst2man
178 + sed -i -e "s/'rst2man'/'rst2man.py'/" docs/reference/gtk/meson.build || die
179 + # Nothing should use gtk4-update-icon-cache and an unversioned one is shipped by dev-util/gtk-update-icon-cache
180 + sed -i -e '/gtk4-update-icon-cache/d' tools/meson.build || die
181 + # Workaround RWX ELF sections, https://gitlab.gnome.org/GNOME/gtk/-/issues/4598
182 + sed -i -e 's/^ld =.*/ld = disabler()/g' gtk/meson.build demos/gtk-demo/meson.build demos/widget-factory/meson.build || die
183 + sed -i -e 's/^objcopy =.*/objcopy = disabler()/g' gtk/meson.build demos/gtk-demo/meson.build demos/widget-factory/meson.build || die
184 +}
185 +
186 +src_configure() {
187 + local emesonargs=(
188 + # GDK backends
189 + $(meson_use X x11-backend)
190 + $(meson_use wayland wayland-backend)
191 + $(meson_use broadway broadway-backend)
192 + -Dwin32-backend=false
193 + $(meson_use aqua macos-backend)
194 +
195 + # Media backends
196 + $(meson_feature ffmpeg media-ffmpeg)
197 + $(meson_feature gstreamer media-gstreamer)
198 +
199 + # Print backends
200 + $(meson_feature cups print-cups)
201 +
202 + # Optional dependencies
203 + $(meson_feature vulkan)
204 + -Dcloudproviders=disabled # cloudprovider is not packaged in Gentoo yet
205 + $(meson_feature sysprof)
206 + -Dtracker=disabled # tracker3 is not packaged in Gentoo yet
207 + $(meson_feature colord)
208 + # Expected to fail with GCC < 11
209 + # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71993
210 + $(meson_feature cpu_flags_x86_f16c f16c)
211 +
212 + # Documentation and introspection
213 + -Dgtk_doc=false # we ship pregenerated API docs from tarball
214 + -Dman-pages=true
215 + $(meson_feature introspection)
216 +
217 + # Demos and binaries
218 + $(meson_use examples build-examples)
219 + $(meson_use examples demos)
220 + $(meson_use test build-tests)
221 + -Dinstall-tests=false
222 + )
223 + meson_src_configure
224 +}
225 +
226 +src_test() {
227 + "${BROOT}${GLIB_COMPILE_SCHEMAS}" --allow-any-name "${S}/gtk" || die
228 +
229 + if use X; then
230 + einfo "Running tests under X"
231 + GSETTINGS_SCHEMA_DIR="${S}/gtk" virtx meson_src_test --setup=x11
232 + fi
233 +
234 + if use wayland; then
235 + einfo "Running tests under Weston"
236 +
237 + export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
238 +
239 + weston --backend=headless-backend.so --socket=wayland-5 --idle-time=0 &
240 + compositor=$!
241 + export WAYLAND_DISPLAY=wayland-5
242 +
243 + GSETTINGS_SCHEMA_DIR="${S}/gtk" meson_src_test --setup=wayland
244 +
245 + exit_code=$?
246 + kill ${compositor}
247 + fi
248 +}
249 +
250 +src_install() {
251 + meson_src_install
252 +
253 + insinto /usr/share/gtk-doc/html
254 + # This will install API docs specific to X11 and wayland regardless of USE flags, but this is intentional
255 + doins -r "${S}"/docs/reference/{gtk/gtk4,gsk/gsk4,gdk/gdk4{,-wayland,-x11}}
256 +}
257 +
258 +pkg_preinst() {
259 + xdg_pkg_preinst
260 + gnome2_schemas_savelist
261 +}
262 +
263 +pkg_postinst() {
264 + xdg_pkg_postinst
265 + gnome2_schemas_update
266 +
267 + if ! has_version "app-text/evince"; then
268 + elog "Please install app-text/evince for print preview functionality."
269 + elog "Alternatively, check \"gtk-print-preview-command\" documentation and"
270 + elog "add it to your settings.ini file."
271 + fi
272 +
273 + if use examples ; then
274 + optfeature "syntax highlighting in gtk4-demo" app-text/highlight
275 + fi
276 +}
277 +
278 +pkg_postrm() {
279 + xdg_pkg_postrm
280 + gnome2_schemas_update
281 +}