Added config for 'putty paste style' and handle mouse click
This commit is contained in:
parent
d833e5b8df
commit
1e89dc3064
|
@ -242,6 +242,7 @@ DEFAULTS = {
|
||||||
'force_no_bell' : False,
|
'force_no_bell' : False,
|
||||||
'cycle_term_tab' : True,
|
'cycle_term_tab' : True,
|
||||||
'copy_on_selection' : False,
|
'copy_on_selection' : False,
|
||||||
|
'putty_paste_style' : False,
|
||||||
'alternate_screen_scroll': True,
|
'alternate_screen_scroll': True,
|
||||||
'split_to_group' : False,
|
'split_to_group' : False,
|
||||||
'autoclean_groups' : True,
|
'autoclean_groups' : True,
|
||||||
|
|
|
@ -77,6 +77,10 @@ class Terminal(gtk.VBox):
|
||||||
|
|
||||||
TARGET_TYPE_VTE = 8
|
TARGET_TYPE_VTE = 8
|
||||||
|
|
||||||
|
LEFT_CLICK = 1
|
||||||
|
MIDDLE_CLICK = 2
|
||||||
|
RIGHT_CLICK = 3
|
||||||
|
|
||||||
terminator = None
|
terminator = None
|
||||||
vte = None
|
vte = None
|
||||||
terminalbox = None
|
terminalbox = None
|
||||||
|
@ -896,17 +900,25 @@ class Terminal(gtk.VBox):
|
||||||
# Suppress double-click behavior
|
# Suppress double-click behavior
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if event.button == 1:
|
if self.config['putty_paste_style']:
|
||||||
|
btn_to_paste = self.RIGHT_CLICK
|
||||||
|
btn_to_context_menu = self.MIDDLE_CLICK
|
||||||
|
else:
|
||||||
|
btn_to_paste = self.MIDDLE_CLICK
|
||||||
|
btn_to_context_menu = self.RIGHT_CLICK
|
||||||
|
|
||||||
|
|
||||||
|
if event.button == self.LEFT_CLICK:
|
||||||
# Ctrl+leftclick on a URL should open it
|
# Ctrl+leftclick on a URL should open it
|
||||||
if event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK:
|
if event.state & gtk.gdk.CONTROL_MASK == gtk.gdk.CONTROL_MASK:
|
||||||
url = self.check_for_url(event)
|
url = self.check_for_url(event)
|
||||||
if url:
|
if url:
|
||||||
self.open_url(url, prepare=True)
|
self.open_url(url, prepare=True)
|
||||||
elif event.button == 2:
|
elif event.button == btn_to_paste:
|
||||||
# middleclick should paste the clipboard
|
# middleclick should paste the clipboard
|
||||||
self.paste_clipboard(True)
|
self.paste_clipboard(True)
|
||||||
return(True)
|
return(True)
|
||||||
elif event.button == 3:
|
elif event.button == btn_to_context_menu:
|
||||||
# rightclick should display a context menu if Ctrl is not pressed
|
# rightclick should display a context menu if Ctrl is not pressed
|
||||||
if event.state & gtk.gdk.CONTROL_MASK == 0:
|
if event.state & gtk.gdk.CONTROL_MASK == 0:
|
||||||
self.popup_menu(widget, event)
|
self.popup_menu(widget, event)
|
||||||
|
|
Loading…
Reference in New Issue