[gnome-terminal/wip/restore-geometry: 1/3] Fix chunked resize and --geometry option



commit 6dfc24c440482d6f663c315e1096686d27ddbcce
Author: Sorokin Alexei <sor alexei meowr ru>
Date:   Mon Mar 7 21:45:46 2016 +0000

    Fix chunked resize and --geometry option
    
    Was caused by https://git.gnome.org/browse/gtk+/commit/?id=08974a1
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760944

 src/terminal-options.c |    4 ----
 src/terminal-window.c  |   19 +++++++++++++------
 2 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/src/terminal-options.c b/src/terminal-options.c
index cc51cf6..723ecfe 100644
--- a/src/terminal-options.c
+++ b/src/terminal-options.c
@@ -583,10 +583,6 @@ option_geometry_callback (const gchar *option_name,
 {
   TerminalOptions *options = data;
 
-  /* See https://bugzilla.gnome.org/show_bug.cgi?id=760944 */
-  if (gtk_check_version (3, 19, 5) == NULL)
-    return unsupported_option_callback (option_name, value, data, error);
-
   if (options->initial_windows)
     {
       InitialWindow *iw;
diff --git a/src/terminal-window.c b/src/terminal-window.c
index 80e54b0..1e60697 100644
--- a/src/terminal-window.c
+++ b/src/terminal-window.c
@@ -3571,8 +3571,9 @@ terminal_window_update_geometry (TerminalWindow *window)
   GtkWidget *widget;
   GdkGeometry hints;
   GtkBorder padding;
-  int char_width;
-  int char_height;
+  GtkRequisition toplevel_request, widget_request;
+  int base_width, base_height;
+  int char_width, char_height;
   
   if (priv->active_screen == NULL)
     return;
@@ -3596,8 +3597,14 @@ terminal_window_update_geometry (TerminalWindow *window)
       padding.top + padding.bottom != priv->old_base_height ||
       widget != (GtkWidget*) priv->old_geometry_widget)
     {
-      hints.base_width = padding.left + padding.right;
-      hints.base_height = padding.top + padding.bottom;
+      gtk_widget_get_preferred_size (GTK_WIDGET (window), NULL, &toplevel_request);
+      gtk_widget_get_preferred_size (widget, NULL, &widget_request);
+
+      base_width = toplevel_request.width - widget_request.width;
+      base_height = toplevel_request.height - widget_request.height;
+
+      hints.base_width = base_width + padding.left + padding.right;
+      hints.base_height = base_height + padding.top + padding.bottom;
 
 #define MIN_WIDTH_CHARS 4
 #define MIN_HEIGHT_CHARS 1
@@ -3605,12 +3612,12 @@ terminal_window_update_geometry (TerminalWindow *window)
       hints.width_inc = char_width;
       hints.height_inc = char_height;
 
-      /* min size is min size of just the geometry widget, remember. */
+      /* min size is min size of the whole window, remember. */
       hints.min_width = hints.base_width + hints.width_inc * MIN_WIDTH_CHARS;
       hints.min_height = hints.base_height + hints.height_inc * MIN_HEIGHT_CHARS;
       
       gtk_window_set_geometry_hints (GTK_WINDOW (window),
-                                     widget,
+                                     NULL,
                                      &hints,
                                      GDK_HINT_RESIZE_INC |
                                      GDK_HINT_MIN_SIZE |


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]