summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2022-08-09 19:45:07 +0000
committerAntónio Fernandes <antoniof@gnome.org>2022-08-09 19:45:07 +0000
commite3955ef6be3e7ce93daf0556f03f678c0d6516e2 (patch)
treec49f6d12bcc54d14d706d5eea87f458a55c4cd8b
parent5919027200de51c5f0a0cee7d47753fc66edd0fe (diff)
downloadnautilus-e3955ef6be3e7ce93daf0556f03f678c0d6516e2.tar.gz
compress-dialog-controller: Really fix the cropped popover on X11
The commit 441124c tried to fix the cropped popover on X11 with twice the height window. This is still not enough with some translations, or when the larger font is used. Let's resize the window using the preferred popover size to avoid those issues. Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2018
-rw-r--r--src/nautilus-compress-dialog-controller.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/nautilus-compress-dialog-controller.c b/src/nautilus-compress-dialog-controller.c
index 6c5b6964c..9de328f08 100644
--- a/src/nautilus-compress-dialog-controller.c
+++ b/src/nautilus-compress-dialog-controller.c
@@ -400,13 +400,20 @@ popover_on_show (GtkWidget *widget,
}
#ifdef GDK_WINDOWING_X11
+ /* Workaround for https://gitlab.gnome.org/GNOME/nautilus/-/issues/2018 */
if (GDK_IS_X11_DISPLAY (gdk_display_get_default ()))
{
- int w, h;
+ GtkWidget *vbox;
+ int w, h, y;
- /* Workaround for https://gitlab.gnome.org/GNOME/nautilus/-/issues/2018 */
- gtk_window_get_default_size (GTK_WINDOW (self->compress_dialog), &w, &h);
- gtk_window_resize (GTK_WINDOW (self->compress_dialog), w, h * 2);
+ /* The vbox child is used instead of the dialog itself to get size
+ * without the title bar, client side decorations etc. */
+ vbox = gtk_bin_get_child (GTK_BIN (self->compress_dialog));
+ gtk_widget_translate_coordinates (widget, vbox, 0, gtk_widget_get_margin_top (vbox), NULL, &y);
+
+ gtk_widget_get_preferred_width (widget, NULL, &w);
+ gtk_widget_get_preferred_height (widget, NULL, &h);
+ gtk_window_resize (GTK_WINDOW (self->compress_dialog), w, y + h);
}
#endif
}