From e4160dddc90ad2a83f18161ed2450d65f15b364f Mon Sep 17 00:00:00 2001 From: Filip Kilibarda Date: Tue, 28 Apr 2020 22:57:15 -0700 Subject: [PATCH] Added option to disable ctrl+mousewheel zoom --- terminatorlib/config.py | 1 + terminatorlib/preferences.glade | 18 ++++++++++++++++++ terminatorlib/prefseditor.py | 8 ++++++++ terminatorlib/terminal.py | 2 ++ 4 files changed, 29 insertions(+) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index fbfcb84e..be0fa223 100644 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -118,6 +118,7 @@ DEFAULTS = { 'title_font' : 'Sans 9', 'putty_paste_style' : False, 'smart_copy' : True, + 'disable_mousewheel_zoom': False, }, 'keybindings': { 'zoom_in' : 'plus', diff --git a/terminatorlib/preferences.glade b/terminatorlib/preferences.glade index 518a08e6..487de81c 100644 --- a/terminatorlib/preferences.glade +++ b/terminatorlib/preferences.glade @@ -552,6 +552,24 @@ 2 + + + Disable Ctrl+mousewheel zoom + False + True + True + False + 0.5 + True + True + + + + 0 + 7 + 2 + + True diff --git a/terminatorlib/prefseditor.py b/terminatorlib/prefseditor.py index 6b923905..69951acd 100755 --- a/terminatorlib/prefseditor.py +++ b/terminatorlib/prefseditor.py @@ -286,6 +286,9 @@ class PrefsEditor: else: active = 1 widget.set_active(active) + # Disable Ctrl+mousewheel zoom + widget = guiget('disablemousewheelzoom') + widget.set_active(self.config['disable_mousewheel_zoom']) # scroll_tabbar widget = guiget('scrolltabbarcheck') widget.set_active(self.config['scroll_tabbar']) @@ -695,6 +698,11 @@ class PrefsEditor: self.config['dbus'] = widget.get_active() 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): """Window border setting changed""" self.config['borderless'] = not widget.get_active() diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 2f22dfb9..bbb06696 100644 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -972,6 +972,8 @@ class Terminal(Gtk.VBox): def on_mousewheel(self, widget, event): """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_DOWN = event.direction == Gdk.ScrollDirection.SMOOTH and event.delta_y > 0. if event.state & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK: