phosh-arch/gtk3-mobile/window-Maximize-resizable-pseudo-dialogs-on-mobile.patch
2024-08-13 08:17:11 -07:00

41 lines
1.3 KiB
Diff

From: Adrien Plazas <kekun.plazas@laposte.net>
Date: Thu, 11 Jul 2019 14:18:39 +0200
Subject: window: Maximize resizable pseudo-dialogs on mobile
This will make them look better on phone screens.
---
gtk/gtkwindow.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 39b01ee..d7f8e26 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -39,6 +39,7 @@
#include "gtkcssiconthemevalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
+#include "gtkdialog.h"
#include "gtkkeyhash.h"
#include "gtkmain.h"
#include "gtkmnemonichash.h"
@@ -6317,6 +6318,7 @@ gtk_window_map (GtkWidget *widget)
GdkWindow *gdk_window;
GList *link;
GdkDisplay *display;
+ gboolean is_dialog;
if (!_gtk_widget_is_toplevel (widget))
{
@@ -6341,7 +6343,10 @@ gtk_window_map (GtkWidget *widget)
gdk_window = _gtk_widget_get_window (widget);
- if (priv->maximize_initially)
+ /* Transient windows can be considered pseudo-dialogs. */
+ is_dialog = GTK_IS_DIALOG (widget) || !!gtk_window_get_transient_for (window);
+ if (priv->maximize_initially ||
+ (is_dialog && gtk_window_get_resizable (window) && _gtk_get_is_phone ()))
gdk_window_maximize (gdk_window);
else
gdk_window_unmaximize (gdk_window);