From 680cfd2278dfdb9e337451e272e86014eb1db8e6 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Tue, 1 Dec 2015 00:14:33 +0100 Subject: [PATCH] Fix PuTTY paste mode so Ctrl-Right-Drag, and application mouse handling in terminal still works --- terminatorlib/terminal.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 5ad8a1b6..851eb805 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -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)