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
1 changed files with 9 additions and 9 deletions

View File

@ -923,11 +923,11 @@ class Terminal(Gtk.VBox):
return True return True
if self.config['putty_paste_style']: if self.config['putty_paste_style']:
btn_to_paste = self.MOUSEBUTTON_RIGHT middle_click = [self.popup_menu, (widget, event)]
btn_to_context_menu = self.MOUSEBUTTON_MIDDLE right_click = [self.paste_clipboard, (True, )]
else: else:
btn_to_paste = self.MOUSEBUTTON_MIDDLE middle_click = [self.paste_clipboard, (True, )]
btn_to_context_menu = self.MOUSEBUTTON_RIGHT right_click = [self.popup_menu, (widget, event)]
if event.button == self.MOUSEBUTTON_LEFT: if event.button == self.MOUSEBUTTON_LEFT:
# Ctrl+leftclick on a URL should open it # Ctrl+leftclick on a URL should open it
@ -935,19 +935,19 @@ class Terminal(Gtk.VBox):
url = self.vte.match_check_event(event) url = self.vte.match_check_event(event)
if url[0]: if url[0]:
self.open_url(url, prepare=True) self.open_url(url, prepare=True)
elif event.button == btn_to_paste: elif event.button == self.MOUSEBUTTON_MIDDLE:
# middleclick should paste the clipboard # middleclick should paste the clipboard
self.paste_clipboard(True) middle_click[0](*middle_click[1])
return(True) 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, # 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 # 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.CONTROL_MASK == 0:
if event.get_state() & Gdk.ModifierType.SHIFT_MASK == 0: if event.get_state() & Gdk.ModifierType.SHIFT_MASK == 0:
if not Vte.Terminal.do_button_press_event(self.vte, event): if not Vte.Terminal.do_button_press_event(self.vte, event):
self.popup_menu(widget, event) right_click[0](*right_click[1])
else: else:
self.popup_menu(widget, event) right_click[0](*right_click[1])
return(True) return(True)
return(False) return(False)