9369c05ae9
[ci:skip-build] already built successfully in CI
60 lines
2 KiB
Diff
60 lines
2 KiB
Diff
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
|
|
|