Add Ctrl+Shift+mousewheel and Ctrl+Super+mousewheel actions to zoom receivers or all terminals

This commit is contained in:
Stephen Boddy 2015-06-21 20:38:03 +02:00
parent d9ba9c41cf
commit e4edaa1ffa
1 changed files with 11 additions and 3 deletions

View File

@ -848,12 +848,20 @@ class Terminal(Gtk.VBox):
SMOOTH_SCROLL_UP = event.direction == Gdk.ScrollDirection.SMOOTH and event.delta_y <= 0. SMOOTH_SCROLL_UP = event.direction == Gdk.ScrollDirection.SMOOTH and event.delta_y <= 0.
SMOOTH_SCROLL_DOWN = event.direction == Gdk.ScrollDirection.SMOOTH and event.delta_y > 0. SMOOTH_SCROLL_DOWN = event.direction == Gdk.ScrollDirection.SMOOTH and event.delta_y > 0.
if event.state & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK: if event.state & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK:
# Ctrl + mouse wheel up/down # Ctrl + mouse wheel up/down with Shift and Super additions
if event.state & Gdk.ModifierType.MOD4_MASK == Gdk.ModifierType.MOD4_MASK:
targets=self.terminator.terminals
elif event.state & Gdk.ModifierType.SHIFT_MASK == Gdk.ModifierType.SHIFT_MASK:
targets=self.terminator.get_target_terms(self)
else:
targets=[self]
if event.direction == Gdk.ScrollDirection.UP or SMOOTH_SCROLL_UP: if event.direction == Gdk.ScrollDirection.UP or SMOOTH_SCROLL_UP:
self.zoom_in() for target in targets:
target.zoom_in()
return (True) return (True)
elif event.direction == Gdk.ScrollDirection.DOWN or SMOOTH_SCROLL_DOWN: elif event.direction == Gdk.ScrollDirection.DOWN or SMOOTH_SCROLL_DOWN:
self.zoom_out() for target in targets:
target.zoom_out()
return (True) return (True)
if event.state & Gdk.ModifierType.SHIFT_MASK == Gdk.ModifierType.SHIFT_MASK: if event.state & Gdk.ModifierType.SHIFT_MASK == Gdk.ModifierType.SHIFT_MASK:
# Shift + mouse wheel up/down # Shift + mouse wheel up/down