X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=unix%2Fgtkwin.c;h=f3a17d58434c2fdb1453fac5ea2ce95e794ce227;hb=f004bcca17a789356c32527a396b68b71a773db2;hp=8996b2e5a37cb93e7a7d0d76c31bd3823b65e7b5;hpb=df1eee6027bcbf1fd3a2ac27241db9742cadcab5;p=PuTTY.git diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 8996b2e5..f3a17d58 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -194,7 +194,7 @@ int platform_default_i(const char *name, int def) } /* Dummy routine, only required in plink. */ -void ldisc_update(void *frontend, int echo, int edit) +void frontend_echoedit_update(void *frontend, int echo, int edit) { } @@ -1234,26 +1234,32 @@ gboolean button_internal(struct gui_data *inst, guint32 timestamp, GdkEventType type, guint ebutton, guint state, gdouble ex, gdouble ey) { - int shift, ctrl, alt, x, y, button, act; + int shift, ctrl, alt, x, y, button, act, raw_mouse_mode; /* Remember the timestamp. */ inst->input_event_time = timestamp; show_mouseptr(inst, 1); - if (ebutton == 4 && type == GDK_BUTTON_PRESS) { - term_scroll(inst->term, 0, -5); - return TRUE; - } - if (ebutton == 5 && type == GDK_BUTTON_PRESS) { - term_scroll(inst->term, 0, +5); - return TRUE; - } - shift = state & GDK_SHIFT_MASK; ctrl = state & GDK_CONTROL_MASK; alt = state & GDK_MOD1_MASK; + raw_mouse_mode = + send_raw_mouse && !(shift && conf_get_int(inst->conf, + CONF_mouse_override)); + + if (!raw_mouse_mode) { + if (ebutton == 4 && type == GDK_BUTTON_PRESS) { + term_scroll(inst->term, 0, -5); + return TRUE; + } + if (ebutton == 5 && type == GDK_BUTTON_PRESS) { + term_scroll(inst->term, 0, +5); + return TRUE; + } + } + if (ebutton == 3 && ctrl) { gtk_menu_popup(GTK_MENU(inst->menu), NULL, NULL, NULL, NULL, ebutton, timestamp); @@ -1266,6 +1272,10 @@ gboolean button_internal(struct gui_data *inst, guint32 timestamp, button = MBT_MIDDLE; else if (ebutton == 3) button = MBT_RIGHT; + else if (ebutton == 4) + button = MBT_WHEEL_UP; + else if (ebutton == 5) + button = MBT_WHEEL_DOWN; else return FALSE; /* don't even know what button! */ @@ -1277,9 +1287,7 @@ gboolean button_internal(struct gui_data *inst, guint32 timestamp, default: return FALSE; /* don't know this event type */ } - if (send_raw_mouse && !(shift && conf_get_int(inst->conf, - CONF_mouse_override)) && - act != MA_CLICK && act != MA_RELEASE) + if (raw_mouse_mode && act != MA_CLICK && act != MA_RELEASE) return TRUE; /* we ignore these in raw mouse mode */ x = (ex - inst->window_border) / inst->font_width; @@ -1468,7 +1476,21 @@ static gint timer_trigger(gpointer data) unsigned long next, then; long ticks; - if (run_timers(now, &next)) { + /* + * Destroy the timer we got here on. + */ + if (timer_id) { + gtk_timeout_remove(timer_id); + timer_id = 0; + } + + /* + * run_timers() may cause a call to timer_change_notify, in which + * case a new timer will already have been set up and left in + * timer_id. If it hasn't, and run_timers reports that some timing + * still needs to be done, we do it ourselves. + */ + if (run_timers(now, &next) && !timer_id) { then = now; now = GETTICKCOUNT(); if (now - then > next - then) @@ -1480,8 +1502,9 @@ static gint timer_trigger(gpointer data) } /* - * Never let a timer resume. If we need another one, we've - * asked for it explicitly above. + * Returning FALSE means 'don't call this timer again', which + * _should_ be redundant given that we removed it above, but just + * in case, return FALSE anyway. */ return FALSE; } @@ -2997,7 +3020,7 @@ void reset_terminal_menuitem(GtkMenuItem *item, gpointer data) struct gui_data *inst = (struct gui_data *)data; term_pwron(inst->term, TRUE); if (inst->ldisc) - ldisc_send(inst->ldisc, NULL, 0, 0); + ldisc_echoedit_update(inst->ldisc); } void copy_all_menuitem(GtkMenuItem *item, gpointer data) @@ -3065,7 +3088,7 @@ void change_settings_menuitem(GtkMenuItem *item, gpointer data) */ if (inst->ldisc) { ldisc_configure(inst->ldisc, inst->conf); - ldisc_send(inst->ldisc, NULL, 0, 0); + ldisc_echoedit_update(inst->ldisc); } /* Pass new config data to the terminal */ term_reconfig(inst->term, inst->conf); @@ -3901,7 +3924,7 @@ int pt_main(int argc, char **argv) start_backend(inst); - ldisc_send(inst->ldisc, NULL, 0, 0);/* cause ldisc to notice changes */ + ldisc_echoedit_update(inst->ldisc); /* cause ldisc to notice changes */ /* now we're reday to deal with the child exit handler being * called */