r47848 - in /desktop/experimental/gnome-terminal/debian: changelog patches/Replace-no-op-gtk_window_resize_to_geometry-by-calcu.patch

smcv at users.alioth.debian.org smcv at users.alioth.debian.org
Mon Apr 4 09:05:38 UTC 2016


Author: smcv
Date: Mon Apr  4 09:05:37 2016
New Revision: 47848

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=47848
Log:
* Team upload.
* Improve patch for #819712 to account for client-side decorations
  under Wayland or with GTK_CSD=1 under X11 (Closes: #819732)

Modified:
    desktop/experimental/gnome-terminal/debian/changelog
    desktop/experimental/gnome-terminal/debian/patches/Replace-no-op-gtk_window_resize_to_geometry-by-calcu.patch

Modified: desktop/experimental/gnome-terminal/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/gnome-terminal/debian/changelog?rev=47848&op=diff
==============================================================================
--- desktop/experimental/gnome-terminal/debian/changelog	[utf-8] (original)
+++ desktop/experimental/gnome-terminal/debian/changelog	[utf-8] Mon Apr  4 09:05:37 2016
@@ -1,3 +1,11 @@
+gnome-terminal (3.20.0-3) experimental; urgency=medium
+
+  * Team upload.
+  * Improve patch for #819712 to account for client-side decorations
+    under Wayland or with GTK_CSD=1 under X11 (Closes: #819732)
+
+ -- Simon McVittie <smcv at debian.org>  Mon, 04 Apr 2016 10:04:39 +0100
+
 gnome-terminal (3.20.0-2) experimental; urgency=medium
 
   * Team upload.

Modified: desktop/experimental/gnome-terminal/debian/patches/Replace-no-op-gtk_window_resize_to_geometry-by-calcu.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/gnome-terminal/debian/patches/Replace-no-op-gtk_window_resize_to_geometry-by-calcu.patch?rev=47848&op=diff
==============================================================================
--- desktop/experimental/gnome-terminal/debian/patches/Replace-no-op-gtk_window_resize_to_geometry-by-calcu.patch	[utf-8] (original)
+++ desktop/experimental/gnome-terminal/debian/patches/Replace-no-op-gtk_window_resize_to_geometry-by-calcu.patch	[utf-8] Mon Apr  4 09:05:37 2016
@@ -1,7 +1,6 @@
 From: Simon McVittie <smcv at debian.org>
-Date: Fri, 1 Apr 2016 08:22:31 +0100
-Subject: Replace no-op gtk_window_resize_to_geometry by calculating
- new size
+Date: Mon, 4 Apr 2016 09:09:13 +0100
+Subject: Replace no-op gtk_window_resize_to_geometry by calculating new size
 
 Together with the previous commit, this fixes a regression in
 GNOME 3.20: anything that would alter the Terminal size, for example
@@ -10,30 +9,248 @@
 Signed-off-by: Simon McVittie <smcv at debian.org>
 Bug: https://bugzilla.gnome.org/show_bug.cgi?id=760944
 ---
- src/terminal-window.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
+ src/terminal-window.c | 136 +++++++++++++++++++++++++++++++++++++-------------
+ 1 file changed, 102 insertions(+), 34 deletions(-)
 
 diff --git a/src/terminal-window.c b/src/terminal-window.c
-index ccfceaa..646e01a 100644
+index ccfceaa..a306ff6 100644
 --- a/src/terminal-window.c
 +++ b/src/terminal-window.c
-@@ -3200,13 +3200,18 @@ terminal_window_update_size (TerminalWindow *window)
+@@ -72,11 +72,26 @@ struct _TerminalWindowPrivate
+ 
+   GtkWidget *menubar;
+   TerminalMdiContainer *mdi_container;
++  GtkWidget *main_vbox;
+   TerminalScreen *active_screen;
++
++  /* Size of a character cell in pixels */
+   int old_char_width;
+   int old_char_height;
+-  int old_base_width;
+-  int old_base_height;
++
++  /* Width and height added to the actual terminal grid by "chrome" inside
++   * what was traditionally the X11 window: menu bar, title bar,
++   * style-provided padding. This must be included when resizing the window
++   * and also included in geometry hints. */
++  int old_chrome_width;
++  int old_chrome_height;
++
++  /* Width and height added to the window by client-side decorations.
++   * This must be included in geometry hints but must not be included when
++   * resizing the window. */
++  int old_csd_width;
++  int old_csd_height;
++
+   void *old_geometry_widget; /* only used for pointer value as it may be freed */
+ 
+   GtkWidget *confirm_close_dialog;
+@@ -87,6 +102,7 @@ struct _TerminalWindowPrivate
+ 
+   guint disposed : 1;
+   guint present_on_insert : 1;
++  guint realized : 1;
+ 
+   /* Workaround until gtk+ bug #535557 is fixed */
+   guint icon_title_set : 1;
+@@ -2285,6 +2301,12 @@ terminal_window_realize (GtkWidget *widget)
+   /* Need to do this now since this requires the window to be realized */
+   if (priv->active_screen != NULL)
+     sync_screen_icon_title (priv->active_screen, NULL, window);
++
++  /* Now that we've been realized, we should know precisely how large the
++   * client-side decorations are going to be. Recalculate the geometry hints,
++   * export them to the windowing system, and resize the window accordingly. */
++  priv->realized = TRUE;
++  terminal_window_update_size (window);
+ }
+ 
+ static gboolean
+@@ -2619,7 +2641,6 @@ terminal_window_init (TerminalWindow *window)
+   GtkActionGroup *action_group;
+   GtkAction *action;
+   GtkUIManager *manager;
+-  GtkWidget *main_vbox;
+   GError *error;
+   GtkWindowGroup *window_group;
+   GtkAccelGroup *accel_group;
+@@ -2649,7 +2670,7 @@ terminal_window_init (TerminalWindow *window)
+ 
+   priv->active_screen = NULL;
+ 
+-  main_vbox = gtk_bin_get_child (GTK_BIN (window));
++  priv->main_vbox = gtk_bin_get_child (GTK_BIN (window));
+ 
+   priv->mdi_container = TERMINAL_MDI_CONTAINER (terminal_notebook_new ());
+ 
+@@ -2684,13 +2705,15 @@ terminal_window_init (TerminalWindow *window)
+     g_signal_connect (priv->mdi_container, "create-window",
+                       G_CALLBACK (handle_tab_droped_on_desktop), window);
+ 
+-  gtk_box_pack_end (GTK_BOX (main_vbox), GTK_WIDGET (priv->mdi_container), TRUE, TRUE, 0);
++  gtk_box_pack_end (GTK_BOX (priv->main_vbox), GTK_WIDGET (priv->mdi_container), TRUE, TRUE, 0);
+   gtk_widget_show (GTK_WIDGET (priv->mdi_container));
+ 
+   priv->old_char_width = -1;
+   priv->old_char_height = -1;
+-  priv->old_base_width = -1;
+-  priv->old_base_height = -1;
++  priv->old_chrome_width = -1;
++  priv->old_chrome_height = -1;
++  priv->old_csd_width = -1;
++  priv->old_csd_height = -1;
+   priv->old_geometry_widget = NULL;
+ 
+   /* GAction setup */
+@@ -2751,7 +2774,7 @@ terminal_window_init (TerminalWindow *window)
+ #endif
+ 
+   priv->menubar = gtk_ui_manager_get_widget (manager, "/menubar");
+-  gtk_box_pack_start (GTK_BOX (main_vbox),
++  gtk_box_pack_start (GTK_BOX (priv->main_vbox),
+ 		      priv->menubar,
+ 		      FALSE, FALSE, 0);
+ 
+@@ -3200,13 +3223,29 @@ terminal_window_update_size (TerminalWindow *window)
  {
    TerminalWindowPrivate *priv = window->priv;
    int grid_width, grid_height;
 +  int pixel_width, pixel_height;
++
  
    /* be sure our geometry is up-to-date */
    terminal_window_update_geometry (window);
  
    terminal_screen_get_size (priv->active_screen, &grid_width, &grid_height);
++  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
++                         "[window %p] size is %dx%d cells of %dx%d px\n",
++                         window, grid_width, grid_height,
++                         priv->old_char_width, priv->old_char_height);
  
 -  gtk_window_resize_to_geometry (GTK_WINDOW (window), grid_width, grid_height);
 +  /* the "old" struct members were updated by update_geometry */
-+  pixel_width = priv->old_base_width + grid_width * priv->old_char_width;
-+  pixel_height = priv->old_base_height + grid_height * priv->old_char_height;
++  pixel_width = priv->old_chrome_width + grid_width * priv->old_char_width;
++  pixel_height = priv->old_chrome_height + grid_height * priv->old_char_height;
++  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY,
++                         "[window %p] %dx%d + %dx%d = %dx%d\n",
++                         window, grid_width * priv->old_char_width,
++                         grid_height * priv->old_char_height,
++                         priv->old_chrome_width, priv->old_chrome_height,
++                         pixel_width, pixel_height);
 +
 +  gtk_window_resize (GTK_WINDOW (window), pixel_width, pixel_height);
  }
  
  void
+@@ -3560,12 +3599,13 @@ terminal_window_update_geometry (TerminalWindow *window)
+ {
+   TerminalWindowPrivate *priv = window->priv;
+   GtkWidget *widget;
++  GtkRequisition toplevel_request, vbox_request;
+   GdkGeometry hints;
+-  GtkBorder padding;
+-  GtkRequisition toplevel_request, widget_request;
+-  int base_width, base_height;
++  int grid_width, grid_height;
+   int char_width, char_height;
+-  
++  int chrome_width, chrome_height;
++  int csd_width, csd_height;
++
+   if (priv->active_screen == NULL)
+     return;
+ 
+@@ -3577,25 +3617,48 @@ terminal_window_update_geometry (TerminalWindow *window)
+    * window, but that doesn't make too much sense.
+    */
+   terminal_screen_get_cell_size (priv->active_screen, &char_width, &char_height);
+-  
+-  gtk_style_context_get_padding(gtk_widget_get_style_context(widget),
+-                                gtk_widget_get_state_flags(widget),
+-                                &padding);
+-
+-  if (char_width != priv->old_char_width ||
++  terminal_screen_get_size (priv->active_screen, &grid_width, &grid_height);
++  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "%dx%d cells of %dx%d px = %dx%d px\n",
++                         grid_width, grid_height, char_width, char_height,
++                         char_width * grid_width, char_height * grid_height);
++
++  gtk_widget_get_preferred_size (priv->main_vbox, NULL, &vbox_request);
++  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "content area requests %dx%d px\n",
++                         vbox_request.width, vbox_request.height);
++
++  gtk_widget_get_preferred_size (GTK_WIDGET (window), NULL, &toplevel_request);
++  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "window requests %dx%d px\n",
++                         toplevel_request.width, toplevel_request.height);
++
++  chrome_width = vbox_request.width - (char_width * grid_width);
++  chrome_height = vbox_request.height - (char_height * grid_height);
++  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "chrome: %dx%d px\n",
++                         chrome_width, chrome_height);
++
++  csd_width = toplevel_request.width - vbox_request.width;
++  csd_height = toplevel_request.height - vbox_request.height;
++  _terminal_debug_print (TERMINAL_DEBUG_GEOMETRY, "CSDs: %dx%d px%s\n",
++                         csd_width, csd_height,
++                         priv->realized ? "" : " (just a guess)");
++
++  if (!priv->realized)
++    {
++      /* Don't actually set the geometry hints until we have been realized,
++       * because we don't know precisely how large the client-side decorations
++       * are going to be. We also avoid setting priv->old_csd_width or
++       * priv->old_csd_height, so that next time through this function we'll
++       * definitely recalculate the hints. */
++    }
++  else if (char_width != priv->old_char_width ||
+       char_height != priv->old_char_height ||
+-      padding.left + padding.right != priv->old_base_width ||
+-      padding.top + padding.bottom != priv->old_base_height ||
++      chrome_width != priv->old_chrome_width ||
++      chrome_height != priv->old_chrome_height ||
++      csd_width != priv->old_csd_width ||
++      csd_height != priv->old_csd_height ||
+       widget != (GtkWidget*) priv->old_geometry_widget)
+     {
+-      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;
++      hints.base_width = chrome_width + csd_width;
++      hints.base_height = chrome_height + csd_height;
+ 
+ #define MIN_WIDTH_CHARS 4
+ #define MIN_HEIGHT_CHARS 1
+@@ -3623,11 +3686,9 @@ terminal_window_update_geometry (TerminalWindow *window)
+                              hints.min_height,
+                              hints.width_inc,
+                              hints.height_inc);
+-      
+-      priv->old_char_width = hints.width_inc;
+-      priv->old_char_height = hints.height_inc;
+-      priv->old_base_width = hints.base_width;
+-      priv->old_base_height = hints.base_height;
++
++      priv->old_csd_width = csd_width;
++      priv->old_csd_height = csd_height;
+       priv->old_geometry_widget = widget;
+     }
+   else
+@@ -3636,6 +3697,13 @@ terminal_window_update_geometry (TerminalWindow *window)
+                              "[window %p] hints: increment unchanged, not setting\n",
+                              window);
+     }
++
++  /* We need these for the size calculation in terminal_window_update_size(),
++   * so we set them unconditionally. */
++  priv->old_char_width = char_width;
++  priv->old_char_height = char_height;
++  priv->old_chrome_width = chrome_width;
++  priv->old_chrome_height = chrome_height;
+ }
+ 
+ static void




More information about the pkg-gnome-commits mailing list