1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-09 15:18:06 -05:00

Merge branch 'stuck' of /home/simon-win/src/putty into main

This commit is contained in:
Simon Tatham 2022-03-29 18:09:43 +01:00
commit 35638a2631
4 changed files with 23 additions and 0 deletions

View File

@ -2137,6 +2137,7 @@ void term_pwron(Terminal *, bool);
void term_clrsb(Terminal *);
void term_mouse(Terminal *, Mouse_Button, Mouse_Button, Mouse_Action,
int, int, bool, bool, bool);
void term_cancel_selection_drag(Terminal *);
void term_key(Terminal *, Key_Sym, wchar_t *, size_t, unsigned int,
unsigned int);
void term_lost_clipboard_ownership(Terminal *, int clipboard);

View File

@ -7299,6 +7299,23 @@ void term_mouse(Terminal *term, Mouse_Button braw, Mouse_Button bcooked,
term_schedule_update(term);
}
void term_cancel_selection_drag(Terminal *term)
{
/*
* In unusual circumstances, a mouse drag might be interrupted by
* something that steals the rest of the mouse gesture. An example
* is the GTK popup menu appearing. In that situation, we'll never
* receive the MA_RELEASE that finishes the DRAGGING state, which
* means terminal output could be suppressed indefinitely. Call
* this function from the front end in such situations to restore
* sensibleness.
*/
if (term->selstate == DRAGGING)
term->selstate = NO_SELECTION;
term_out(term, false);
term_schedule_update(term);
}
static int shift_bitmap(bool shift, bool ctrl, bool alt, bool *consumed_alt)
{
int bitmap = (shift ? 1 : 0) + (alt ? 2 : 0) + (ctrl ? 4 : 0);

View File

@ -2162,6 +2162,8 @@ static gboolean button_internal(GtkFrontend *inst, GdkEventButton *event)
}
if (event->button == 3 && ctrl) {
/* Just in case this happened in mid-select */
term_cancel_selection_drag(inst->term);
#if GTK_CHECK_VERSION(3,22,0)
gtk_menu_popup_at_pointer(GTK_MENU(inst->menu), (GdkEvent *)event);
#else

View File

@ -2625,6 +2625,9 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
(conf_get_int(conf, CONF_mouse_is_xterm) == 2))) {
POINT cursorpos;
/* Just in case this happened in mid-select */
term_cancel_selection_drag(term);
show_mouseptr(true); /* make sure pointer is visible */
GetCursorPos(&cursorpos);
TrackPopupMenu(popup_menus[CTXMENU].menu,