def on_button_press(self, target, event, user_data): if event.button == 3: # First send to background process if handled, do nothing else if not event.get_state() & Gdk.ModifierType.SHIFT_MASK: if Vte.Terminal.do_button_press_event(self.terminal, event): return True menu = mk_terminal_context_menu( self.terminal, self.get_window(), self.get_settings(), TerminalContextMenuCallbacks( self.terminal, self.get_window(), self.get_settings(), self.get_root_box().get_notebook() ) ) menu.connect("hide", MenuHideCallback(self.get_window()).on_hide) HidePrevention(self.get_window()).prevent() try: menu.popup_at_pointer(event) except AttributeError: # Gtk 3.18 fallback ("'Menu' object has no attribute 'popup_at_pointer'") menu.popup(None, None, None, None, event.button, event.time) self.terminal.grab_focus() return True self.terminal.grab_focus() return False
def on_button_press(self, target, event, user_data): if event.button == 3: # First send to background process if handled, do nothing else if (not event.get_state() & Gdk.ModifierType.SHIFT_MASK and Vte.Terminal.do_button_press_event( self.terminal, event)): return True menu = mk_terminal_context_menu( self.terminal, self.get_window(), self.get_settings(), TerminalContextMenuCallbacks( self.terminal, self.get_window(), self.get_settings(), self.get_root_box().get_notebook(), ), ) menu.connect("hide", MenuHideCallback(self.get_window()).on_hide) HidePrevention(self.get_window()).prevent() try: menu.popup_at_pointer(event) except AttributeError: # Gtk 3.18 fallback ("'Menu' object has no attribute 'popup_at_pointer'") menu.popup(None, None, None, None, event.button, event.time) self.terminal.grab_focus() return True self.terminal.grab_focus() return False