Added option to disable ctrl+mousewheel zoom

This commit is contained in:
Filip Kilibarda 2020-04-28 22:57:15 -07:00
parent 827b926df8
commit e4160dddc9
4 changed files with 29 additions and 0 deletions

View File

@ -118,6 +118,7 @@ DEFAULTS = {
'title_font' : 'Sans 9', 'title_font' : 'Sans 9',
'putty_paste_style' : False, 'putty_paste_style' : False,
'smart_copy' : True, 'smart_copy' : True,
'disable_mousewheel_zoom': False,
}, },
'keybindings': { 'keybindings': {
'zoom_in' : '<Control>plus', 'zoom_in' : '<Control>plus',

View File

@ -552,6 +552,24 @@
<property name="width">2</property> <property name="width">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="disablemousewheelzoom">
<property name="label" translatable="yes">Disable Ctrl+mousewheel zoom</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0.5</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_disable_mousewheel_zoom_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="width">2</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="expand">True</property> <property name="expand">True</property>

View File

@ -286,6 +286,9 @@ class PrefsEditor:
else: else:
active = 1 active = 1
widget.set_active(active) widget.set_active(active)
# Disable Ctrl+mousewheel zoom
widget = guiget('disablemousewheelzoom')
widget.set_active(self.config['disable_mousewheel_zoom'])
# scroll_tabbar # scroll_tabbar
widget = guiget('scrolltabbarcheck') widget = guiget('scrolltabbarcheck')
widget.set_active(self.config['scroll_tabbar']) widget.set_active(self.config['scroll_tabbar'])
@ -695,6 +698,11 @@ class PrefsEditor:
self.config['dbus'] = widget.get_active() self.config['dbus'] = widget.get_active()
self.config.save() self.config.save()
def on_disable_mousewheel_zoom_toggled(self, widget):
"""Ctrl+mousewheel zoom setting changed"""
self.config['disable_mousewheel_zoom'] = widget.get_active()
self.config.save()
def on_winbordercheck_toggled(self, widget): def on_winbordercheck_toggled(self, widget):
"""Window border setting changed""" """Window border setting changed"""
self.config['borderless'] = not widget.get_active() self.config['borderless'] = not widget.get_active()

View File

@ -972,6 +972,8 @@ class Terminal(Gtk.VBox):
def on_mousewheel(self, widget, event): def on_mousewheel(self, widget, event):
"""Handler for modifier + mouse wheel scroll events""" """Handler for modifier + mouse wheel scroll events"""
if self.config["disable_mousewheel_zoom"] is True:
return (True)
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: