From 52bb6a3fe25c3f31d476291c197180c0f567e102 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 8 Sep 2024 17:20:16 +0100 Subject: [PATCH] Fix warnings building on Ubuntu 24.04. --- terminal/terminal.c | 17 ++++++++++------- unix/main-gtk-application.c | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/terminal/terminal.c b/terminal/terminal.c index 5798bb14..f36df17a 100644 --- a/terminal/terminal.c +++ b/terminal/terminal.c @@ -7276,8 +7276,7 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked, (term->selstate != ABOUT_TO) && (term->selstate != DRAGGING)) { int encstate = 0, r, c; bool wheel; - char abuf[32]; - int len = 0; + char *response = NULL; if (term->ldisc) { @@ -7368,14 +7367,18 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked, /* Check the extensions in decreasing order of preference. Encoding the release event above assumes that 1006 comes first. */ if (term->xterm_extended_mouse) { - len = sprintf(abuf, "\033[<%d;%d;%d%c", encstate, c, r, a == MA_RELEASE ? 'm' : 'M'); + response = dupprintf("\033[<%d;%d;%d%c", encstate, c, r, + a == MA_RELEASE ? 'm' : 'M'); } else if (term->urxvt_extended_mouse) { - len = sprintf(abuf, "\033[%d;%d;%dM", encstate + 32, c, r); + response = dupprintf("\033[%d;%d;%dM", encstate + 32, c, r); } else if (c <= 223 && r <= 223) { - len = sprintf(abuf, "\033[M%c%c%c", encstate + 32, c + 32, r + 32); + response = dupprintf("\033[M%c%c%c", encstate + 32, + c + 32, r + 32); + } + if (response) { + ldisc_send(term->ldisc, response, strlen(response), false); + sfree(response); } - if (len > 0) - ldisc_send(term->ldisc, abuf, len, false); } return; } diff --git a/unix/main-gtk-application.c b/unix/main-gtk-application.c index 963c93fc..2bc1371a 100644 --- a/unix/main-gtk-application.c +++ b/unix/main-gtk-application.c @@ -311,7 +311,7 @@ int main(int argc, char **argv) gtkcomm_setup(); app = gtk_application_new("org.tartarus.projects.putty.macputty", - G_APPLICATION_FLAGS_NONE); + G_APPLICATION_DEFAULT_FLAGS); g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); g_signal_connect(app, "startup", G_CALLBACK(startup), NULL); g_action_map_add_action_entries(G_ACTION_MAP(app),