[Xfce4-commits] [apps/xfce4-terminal] 01/01: Set window hints properly; showes columns/rows when resizing
noreply at xfce.org
noreply at xfce.org
Tue Oct 18 13:58:19 CEST 2016
This is an automated email from the git hooks/post-receive script.
f2404 pushed a commit to branch master
in repository apps/xfce4-terminal.
commit 980003baf92afed64c7958dbaf1a92c3aca402cb
Author: Igor <f2404 at yandex.ru>
Date: Tue Oct 18 14:56:47 2016 +0300
Set window hints properly; showes columns/rows when resizing
Fixes https://bugzilla.xfce.org/show_bug.cgi?id=12793
---
terminal/terminal-screen.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/terminal/terminal-screen.c b/terminal/terminal-screen.c
index 0351437..311f02f 100644
--- a/terminal/terminal-screen.c
+++ b/terminal/terminal-screen.c
@@ -1673,35 +1673,47 @@ terminal_screen_get_geometry (TerminalScreen *screen,
*
* I don't like this way, but its required to work-around a Gtk+
* bug (maybe also caused by a Vte bug, not sure).
+ *
+ * Code borrowed from gnome-terminal (terminal_window_update_geometry).
**/
void
terminal_screen_set_window_geometry_hints (TerminalScreen *screen,
GtkWindow *window)
{
- GdkGeometry hints;
- gint xpad;
- gint ypad;
- glong char_width;
- glong char_height;
+ GdkGeometry hints;
+ GtkRequisition vbox_request;
+ GtkAllocation toplevel_allocation, vbox_allocation;
+ glong char_width, char_height;
+ glong grid_width, grid_height;
+ glong chrome_width, chrome_height;
+ gint csd_width, csd_height;
terminal_return_if_fail (TERMINAL_IS_SCREEN (screen));
terminal_return_if_fail (VTE_IS_TERMINAL (screen->terminal));
terminal_return_if_fail (gtk_widget_get_realized (screen));
terminal_return_if_fail (gtk_widget_get_realized (window));
- terminal_screen_get_geometry (screen,
- &char_width, &char_height,
- &xpad, &ypad);
+ terminal_screen_get_geometry (screen, &char_width, &char_height, NULL, NULL);
+ terminal_screen_get_size (screen, &grid_width, &grid_height);
+
+ gtk_widget_get_preferred_size (TERMINAL_WINDOW (window)->vbox, NULL, &vbox_request);
+ chrome_width = vbox_request.width - (char_width * grid_width);
+ chrome_height = vbox_request.height - (char_height * grid_height);
+
+ gtk_widget_get_allocation (TERMINAL_WINDOW (window)->vbox, &vbox_allocation);
+ gtk_widget_get_allocation (GTK_WIDGET (window), &toplevel_allocation);
+ csd_width = toplevel_allocation.width - vbox_allocation.width;
+ csd_height = toplevel_allocation.height - vbox_allocation.height;
- hints.base_width = xpad;
- hints.base_height = ypad;
+ hints.base_width = chrome_width + csd_width;
+ hints.base_height = chrome_height + csd_height;
hints.width_inc = char_width;
hints.height_inc = char_height;
hints.min_width = hints.base_width + hints.width_inc * 4;
hints.min_height = hints.base_height + hints.height_inc * 2;
- gtk_window_set_geometry_hints (GTK_WINDOW (window),
- screen->terminal,
+ gtk_window_set_geometry_hints (window,
+ NULL,
&hints,
GDK_HINT_RESIZE_INC
| GDK_HINT_MIN_SIZE
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list