]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Use new GTK3 API call for server-controlled window resize.
authorSimon Tatham <anakin@pobox.com>
Mon, 24 Aug 2015 17:59:13 +0000 (18:59 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 24 Aug 2015 18:34:23 +0000 (19:34 +0100)
gtk_window_resize_to_geometry() allows us to make use of the already-
set-up WM resize hints to immediately figure out how to resize the
window to a particular character cell size, and hence makes a much
simpler implementation of request_resize() than the previous hackery.

unix/gtkwin.c

index bb71089b084fb7af3fb8baa5918e5fcc2f0e8173..90e7d52b3218cab599a55090ca632912eb06a53d 100644 (file)
@@ -1747,6 +1747,9 @@ void set_raw_mouse_mode(void *frontend, int activate)
 void request_resize(void *frontend, int w, int h)
 {
     struct gui_data *inst = (struct gui_data *)frontend;
+
+#if !GTK_CHECK_VERSION(3,0,0)
+
     int large_x, large_y;
     int offset_x, offset_y;
     int area_x, area_y;
@@ -1819,6 +1822,20 @@ void request_resize(void *frontend, int w, int h)
     gdk_window_resize(gtk_widget_get_window(inst->window),
                      area_x + offset_x, area_y + offset_y);
 #endif
+
+#else /* GTK_CHECK_VERSION(3,0,0) */
+
+    /*
+     * In GTK3, we can do this by using gtk_window_resize_to_geometry,
+     * which uses the fact that we've already set up the main window's
+     * WM hints to reflect the terminal drawing area's resize
+     * increment (i.e. character cell) and the fixed amount of stuff
+     * round the edges.
+     */
+    gtk_window_resize_to_geometry(GTK_WINDOW(inst->window), w, h);
+
+#endif
+
 }
 
 static void real_palette_set(struct gui_data *inst, int n, int r, int g, int b)