temp/gtk4.0: Fork from alpine, add transient window patches (MR 3894)

[ci:skip-build] already built successfully in CI
This commit is contained in:
Teemu Ikonen 2023-02-20 20:46:32 +02:00 committed by Clayton Craft
parent ccbc7f8a1a
commit 9369c05ae9
No known key found for this signature in database
GPG key ID: 4A4CED6D7EDF950A
6 changed files with 253 additions and 0 deletions

View file

@ -0,0 +1,60 @@
From 1f2a4d3bda07d9dce1bc577ef8b9a86007bdabdc Mon Sep 17 00:00:00 2001
From: Teemu Ikonen <tpikonen@mailbox.org>
Date: Mon, 20 Feb 2023 19:35:17 +0200
Subject: [PATCH 1/2] window: Maximize resizable transient windows on small
screens
Based on Purism adaptive patches by Alexander Mikhaylenko,
https://source.puri.sm/Librem5/debs/gtk4/-/blob/pureos/byzantium/debian/patches/pureos/adaptive/
Only maximize transients on small (< 120 mm) screens
---
gtk/gtkwindow.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index dced97168b..a3f62b5923 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -32,6 +32,7 @@
#include "gtkbuildable.h"
#include "gtkcheckbutton.h"
#include "gtkcssshadowvalueprivate.h"
+#include "deprecated/gtkdialog.h"
#include "gtkdroptargetasync.h"
#include "gtkeventcontrollerlegacy.h"
#include "gtkeventcontrollerkey.h"
@@ -64,6 +65,7 @@
#include "inspector/window.h"
+#include "gdk/gdkmonitor.h"
#include "gdk/gdkprofilerprivate.h"
#include "gdk/gdksurfaceprivate.h"
#include "gdk/gdktextureprivate.h"
@@ -3924,6 +3926,8 @@ gtk_window_map (GtkWidget *widget)
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = gtk_window_get_instance_private (window);
GtkWidget *child = priv->child;
+ GdkMonitor *monitor;
+ gboolean is_dialog, on_small_screen;
GTK_WIDGET_CLASS (gtk_window_parent_class)->map (widget);
@@ -3937,6 +3941,13 @@ gtk_window_map (GtkWidget *widget)
gtk_window_present_toplevel (window);
+ /* Transient windows can be considered pseudo-dialogs. */
+ monitor = gdk_display_get_monitor_at_surface (priv->display, priv->surface);
+ on_small_screen = gdk_monitor_get_width_mm (monitor) < 120;
+ is_dialog = GTK_IS_DIALOG (widget) || !!gtk_window_get_transient_for (window);
+ if (on_small_screen && is_dialog && gtk_window_get_resizable (window))
+ gtk_window_maximize (window);
+
if (priv->minimize_initially)
gdk_toplevel_minimize (GDK_TOPLEVEL (priv->surface));
--
2.39.2

View file

@ -0,0 +1,46 @@
From ec91be7b61e5f82222976f789f731c4060b2cecf Mon Sep 17 00:00:00 2001
From: Teemu Ikonen <tpikonen@mailbox.org>
Date: Mon, 20 Feb 2023 19:43:24 +0200
Subject: [PATCH 2/2] windowcontrols: Force close buttons for transient windows
Based on Purism adaptive patches by Alexander Mikhaylenko,
https://source.puri.sm/Librem5/debs/gtk4/-/blob/pureos/byzantium/debian/patches/pureos/adaptive/
---
gtk/gtkwindowcontrols.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/gtk/gtkwindowcontrols.c b/gtk/gtkwindowcontrols.c
index 52ba2f8b32..34cf80a213 100644
--- a/gtk/gtkwindowcontrols.c
+++ b/gtk/gtkwindowcontrols.c
@@ -25,6 +25,7 @@
#include "gtkboxlayout.h"
#include "gtkbutton.h"
#include "gtkenums.h"
+#include "deprecated/gtkdialog.h"
#include "gtkicontheme.h"
#include "gtkimage.h"
#include <glib/gi18n-lib.h>
@@ -125,9 +126,16 @@ get_layout (GtkWindowControls *self)
if (self->decoration_layout)
layout_desc = g_strdup (self->decoration_layout);
else
- g_object_get (gtk_widget_get_settings (widget),
- "gtk-decoration-layout", &layout_desc,
- NULL);
+ {
+ gboolean is_mobile_dialog = GTK_IS_DIALOG (root) || !!gtk_window_get_transient_for (GTK_WINDOW (root));
+
+ if (is_mobile_dialog)
+ layout_desc = g_strdup (":close");
+ else
+ g_object_get (gtk_widget_get_settings (widget),
+ "gtk-decoration-layout", &layout_desc,
+ NULL);
+ }
tokens = g_strsplit (layout_desc, ":", 2);
--
2.39.2

139
temp/gtk4.0/APKBUILD Normal file
View file

@ -0,0 +1,139 @@
# Maintainer: Teemu Ikonen <tpikonen@mailbox.org>
# Forked from Alpine to apply patches for adaptive transient window handling
pkgname=gtk4.0
pkgver=9999.4.10.4
_pkgver=4.10.4
pkgrel=0
pkgdesc="The GTK Toolkit (v4)"
url="https://www.gtk.org/"
install="$pkgname.post-install $pkgname.post-upgrade $pkgname.post-deinstall"
arch="all"
options="!check" # Test suite is known to fail upstream
license="LGPL-2.1-or-later"
subpackages="$pkgname-dbg $pkgname-demo $pkgname-dev $pkgname-doc $pkgname-lang"
depends="shared-mime-info gtk-update-icon-cache tzdata iso-codes"
depends_dev="
at-spi2-core-dev
gdk-pixbuf-dev
glib-dev
libepoxy-dev
libxext-dev
libxi-dev
libxinerama-dev
libxkbcommon-dev
vulkan-headers
wayland-dev
wayland-protocols
"
makedepends="
$depends_dev
cairo-dev
colord-dev
cups-dev
expat-dev
fontconfig-dev
gettext-dev
gi-docgen
gnutls-dev
gobject-introspection-dev
graphene-dev
gst-plugins-bad-dev
gstreamer-dev
gtk-doc>=1.33
iso-codes-dev
libice-dev
libx11-dev
libxcomposite-dev
libxcursor-dev
libxdamage-dev
libxfixes-dev
libxrandr-dev
meson
pango-dev
perl
py3-docutils
sassc
tiff-dev
vulkan-loader-dev
zlib-dev
zstd-dev
"
source="
https://download.gnome.org/sources/gtk/${_pkgver%.*}/gtk-${_pkgver}.tar.xz
0001-window-Maximize-resizable-transient-windows-on-small.patch
0002-windowcontrols-Force-close-buttons-for-transient-win.patch
"
builddir="$srcdir/gtk-${_pkgver}"
prepare() {
default_prepare
sed -i "s/ version: '.*',/ version: '4.90.99',/g" meson.build
sed -i "s/^gtk_interface_age = .*/gtk_interface_age = 90/g" meson.build
}
build() {
CFLAGS="$CFLAGS -O2" \
abuild-meson \
-Dgtk_doc=true \
-Dintrospection=enabled \
-Dbroadway-backend=true \
-Dman-pages=true \
-Dbuild-tests=false \
-Dbuild-testsuite=false \
. output
meson compile ${JOBS:+-j ${JOBS}} -C output
}
package() {
DESTDIR="$pkgdir" meson install --no-rebuild -C output
# use gtk-update-icon-cache from gtk+2.0 for now. The icon cache is forward
# compatible so this is fine.
# do the same for gtk4-update-icon-cache
rm -f "$pkgdir"/usr/bin/gtk-update-icon-cache
rm -f "$pkgdir"/usr/bin/gtk4-update-icon-cache
rm -f "$pkgdir"/usr/share/man/man1/gtk-update-icon-cache.1
}
demo() {
pkgdesc="$pkgdesc (demonstration application)"
amove \
usr/bin/gtk4-demo \
usr/bin/gtk4-demo-application \
usr/bin/gtk4-icon-browser \
usr/bin/gtk4-node-editor \
usr/bin/gtk4-print-editor \
usr/bin/gtk4-widget-factory \
usr/share/applications/org.gtk.Demo4.desktop \
usr/share/applications/org.gtk.IconBrowser4.desktop \
usr/share/applications/org.gtk.PrintEditor4.desktop \
usr/share/applications/org.gtk.WidgetFactory4.desktop \
usr/share/applications/org.gtk.gtk4.NodeEditor.desktop \
usr/share/glib-2.0/schemas/org.gtk.Demo4.gschema.xml \
usr/share/gtk-4.0/gtk4builder.rng \
usr/share/icons \
usr/share/metainfo
}
dev() {
default_dev
amove \
usr/bin/gtk4-builder-tool \
usr/bin/gtk4-encode-symbolic-svg \
usr/bin/gtk4-query-settings \
usr/share/gtk-4.0/valgrind
}
lang() {
default_lang
# These are some localized emoji labels.
amove usr/share/gtk-4.0/emoji
}
sha512sums="
0c5db3af72227977e11fea3adddec1321b82bcace3c3d10a7c914b8d98b0bdb7994084c0a9e883b24815038bf4a0efe1eb1c4ff79e6838e83cadb6ddf2a1239f gtk-4.10.4.tar.xz
e7b1e11207ea56c4173210d9a92f4a7b5ab41323b55366a69fd7e333d13c09aa872ec5ef1e1527fda068f0fbe91b1b9ba933fe9a8b0961efa5f32eaba2c7482b 0001-window-Maximize-resizable-transient-windows-on-small.patch
d2f09af3965eee592602819be6ed9240b6467f6409ca9ab892a757760af504ac4a7551ff89389659e2602a6e12489080dadc444c9d7e0665e7038dc4b409a68a 0002-windowcontrols-Force-close-buttons-for-transient-win.patch
"

View file

@ -0,0 +1,3 @@
#!/bin/sh
rm -f etc/gtk-4.0/gdk-pixbuf.loaders

View file

@ -0,0 +1,4 @@
#!/bin/sh
/usr/bin/gdk-pixbuf-query-loaders --update-cache

View file

@ -0,0 +1 @@
gtk4.0.post-install