1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Make send_raw_mouse a field of GtkFrontend.

I came across this unexplained static variable in my boolification
trawl. It seems clearly unintentional that it has only one instance
instead of one per terminal window - the code in question closely
resembles the Windows front end, and I think this must just be a
variable that I never swept up into 'inst' in the very early days when
I was making gtkwin.c out of a cloned-and-hacked window.c in the first
place.

These days it's even a bug, now that the OS X port actually does run
multiple terminal windows in the same process: if one goes into mouse
reporting mode, I'm pretty sure this would have done confusing things
to the effects of mouse actions in the other.
This commit is contained in:
Simon Tatham 2018-11-03 08:17:44 +00:00
parent f9cb4eb568
commit 3933a27d93

View File

@ -181,6 +181,7 @@ struct GtkFrontend {
#ifdef OSX_META_KEY_CONFIG
int system_mod_mask;
#endif
bool send_raw_mouse;
unifont_drawctx uctx;
Seat seat;
@ -205,8 +206,6 @@ static void cache_conf_values(GtkFrontend *inst)
#endif
}
static bool send_raw_mouse;
static void start_backend(GtkFrontend *inst);
static void exit_callback(void *vinst);
static void destroy_inst_connection(GtkFrontend *inst);
@ -665,7 +664,7 @@ static void update_mouseptr(GtkFrontend *inst)
if (!inst->mouseptr_visible) {
gdk_window_set_cursor(gtk_widget_get_window(inst->area),
inst->blankcursor);
} else if (send_raw_mouse) {
} else if (inst->send_raw_mouse) {
gdk_window_set_cursor(gtk_widget_get_window(inst->area),
inst->rawcursor);
} else {
@ -2259,9 +2258,9 @@ gboolean scroll_internal(GtkFrontend *inst, gdouble delta, guint state,
x = (ex - inst->window_border) / inst->font_width;
y = (ey - inst->window_border) / inst->font_height;
raw_mouse_mode =
send_raw_mouse && !(shift && conf_get_bool(inst->conf,
CONF_mouse_override));
raw_mouse_mode = (inst->send_raw_mouse &&
!(shift && conf_get_bool(inst->conf,
CONF_mouse_override)));
inst->cumulative_scroll += delta * SCROLL_INCREMENT_LINES;
@ -2311,9 +2310,9 @@ static gboolean button_internal(GtkFrontend *inst, GdkEventButton *event)
ctrl = event->state & GDK_CONTROL_MASK;
alt = event->state & inst->meta_mod_mask;
raw_mouse_mode =
send_raw_mouse && !(shift && conf_get_bool(inst->conf,
CONF_mouse_override));
raw_mouse_mode = (inst->send_raw_mouse &&
!(shift && conf_get_bool(inst->conf,
CONF_mouse_override)));
if (!raw_mouse_mode) {
if (event->button == 4 && event->type == GDK_BUTTON_PRESS) {
@ -2607,7 +2606,7 @@ static void gtkwin_set_raw_mouse_mode(TermWin *tw, bool activate)
{
GtkFrontend *inst = container_of(tw, GtkFrontend, termwin);
activate = activate && !conf_get_bool(inst->conf, CONF_no_mouse_rep);
send_raw_mouse = activate;
inst->send_raw_mouse = activate;
update_mouseptr(inst);
}