Fix PuTTY paste mode so Ctrl-Right-Drag, and application mouse handling in terminal still works

This commit is contained in:
Stephen Boddy 2015-12-01 00:14:33 +01:00
parent 942915dc08
commit 680cfd2278

View File

@ -923,11 +923,11 @@ class Terminal(Gtk.VBox):
return True
if self.config['putty_paste_style']:
btn_to_paste = self.MOUSEBUTTON_RIGHT
btn_to_context_menu = self.MOUSEBUTTON_MIDDLE
middle_click = [self.popup_menu, (widget, event)]
right_click = [self.paste_clipboard, (True, )]
else:
btn_to_paste = self.MOUSEBUTTON_MIDDLE
btn_to_context_menu = self.MOUSEBUTTON_RIGHT
middle_click = [self.paste_clipboard, (True, )]
right_click = [self.popup_menu, (widget, event)]
if event.button == self.MOUSEBUTTON_LEFT:
# Ctrl+leftclick on a URL should open it
@ -935,19 +935,19 @@ class Terminal(Gtk.VBox):
url = self.vte.match_check_event(event)
if url[0]:
self.open_url(url, prepare=True)
elif event.button == btn_to_paste:
elif event.button == self.MOUSEBUTTON_MIDDLE:
# middleclick should paste the clipboard
self.paste_clipboard(True)
middle_click[0](*middle_click[1])
return(True)
elif event.button == btn_to_context_menu:
elif event.button == self.MOUSEBUTTON_RIGHT:
# rightclick should display a context menu if Ctrl is not pressed,
# plus either the app is not interested in mouse events or Shift is pressed
if event.get_state() & Gdk.ModifierType.CONTROL_MASK == 0:
if event.get_state() & Gdk.ModifierType.SHIFT_MASK == 0:
if not Vte.Terminal.do_button_press_event(self.vte, event):
self.popup_menu(widget, event)
right_click[0](*right_click[1])
else:
self.popup_menu(widget, event)
right_click[0](*right_click[1])
return(True)
return(False)