Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mRemoteNG/PuTTYNG.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/unix
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2022-05-12 21:38:45 +0300
committerSimon Tatham <anakin@pobox.com>2022-05-12 21:38:45 +0300
commit80a87df618af3072dbf8a0a74828a4f14d16f937 (patch)
tree15e6c221c6084e038b228e18593accf3dde65a34 /unix
parent4da67d8fa6cf056cb3c9527c59e5a2559bd73e97 (diff)
GTK: don't try to change font size in mid-window-resize.
If the user holds down Alt-> so that the key repeats, then a second call to change_font_size can occur while the window resize from the previous one has yet to complete. This leads to the new pixel size of the window from resize #1 being interpreted in the light of the font size from reesize #2, so that the two get out of step and the _character_ size of the terminal changes as a result. The simplest fix is to disallow starting a second font-size-based window resize while the first is still in flight - which, now that the 'win_resize_pending' flag lives in window.c and not terminal.c, is easy to achieve.
Diffstat (limited to 'unix')
-rw-r--r--unix/window.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/unix/window.c b/unix/window.c
index 4fca971a..167020b4 100644
--- a/unix/window.c
+++ b/unix/window.c
@@ -1278,7 +1278,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
#ifdef KEY_EVENT_DIAGNOSTICS
debug(" - Ctrl->: increase font size\n");
#endif
- change_font_size(inst, +1);
+ if (!inst->win_resize_pending)
+ change_font_size(inst, +1);
return true;
}
if (event->keyval == GDK_KEY_less &&
@@ -1286,7 +1287,8 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
#ifdef KEY_EVENT_DIAGNOSTICS
debug(" - Ctrl-<: increase font size\n");
#endif
- change_font_size(inst, -1);
+ if (!inst->win_resize_pending)
+ change_font_size(inst, -1);
return true;
}
@@ -2513,10 +2515,9 @@ static void gtkwin_timer(void *vctx, unsigned long now)
}
}
-static void gtkwin_request_resize(TermWin *tw, int w, int h)
+static void request_resize_internal(GtkFrontend *inst, bool from_terminal,
+ int w, int h)
{
- GtkFrontend *inst = container_of(tw, GtkFrontend, termwin);
-
#if GTK_CHECK_VERSION(2,0,0)
/*
* Initial check: don't even try to resize a window if it's in one
@@ -2648,11 +2649,17 @@ static void gtkwin_request_resize(TermWin *tw, int w, int h)
#endif
inst->win_resize_pending = true;
- inst->term_resize_notification_required = true;
+ inst->term_resize_notification_required = from_terminal;
inst->win_resize_timeout = schedule_timer(
WIN_RESIZE_TIMEOUT, gtkwin_timer, inst);
}
+static void gtkwin_request_resize(TermWin *tw, int w, int h)
+{
+ GtkFrontend *inst = container_of(tw, GtkFrontend, termwin);
+ request_resize_internal(inst, true, w, h);
+}
+
#if GTK_CHECK_VERSION(3,0,0)
char *colour_to_css(const GdkColor *col)
{
@@ -4834,9 +4841,9 @@ static void after_change_settings_dialog(void *vctx, int retval)
conf_get_int(newconf, CONF_window_border) ||
need_size) {
set_geom_hints(inst);
- win_request_resize(&inst->termwin,
- conf_get_int(newconf, CONF_width),
- conf_get_int(newconf, CONF_height));
+ request_resize_internal(inst, false,
+ conf_get_int(newconf, CONF_width),
+ conf_get_int(newconf, CONF_height));
} else {
/*
* The above will have caused a call to term_size() for
@@ -4909,8 +4916,8 @@ static void change_font_size(GtkFrontend *inst, int increment)
}
set_geom_hints(inst);
- win_request_resize(&inst->termwin, conf_get_int(inst->conf, CONF_width),
- conf_get_int(inst->conf, CONF_height));
+ request_resize_internal(inst, false, conf_get_int(inst->conf, CONF_width),
+ conf_get_int(inst->conf, CONF_height));
term_invalidate(inst->term);
gtk_widget_queue_draw(inst->area);