1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Use new GTK3 API call for server-controlled window resize.

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.
This commit is contained in:
Simon Tatham 2015-08-24 18:59:13 +01:00
parent 80259e85c2
commit a98b1cc03b

View 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)