Adding button release event; fixing multi markers

This commit is contained in:
itdominator 2024-09-20 21:09:49 -05:00
parent 3fd4750b2d
commit 765a60d154
2 changed files with 15 additions and 4 deletions

View File

@ -88,6 +88,7 @@ class SourceView(SourceViewControllerMixin, GtkSource.View):
self.connect("key-press-event", self._key_press_event) self.connect("key-press-event", self._key_press_event)
self.connect("key-release-event", self._key_release_event) self.connect("key-release-event", self._key_release_event)
self.connect("button-press-event", self._button_press_event) self.connect("button-press-event", self._button_press_event)
self.connect("button-release-event", self._button_release_event)
self.connect("scroll-event", self._scroll_event) self.connect("scroll-event", self._scroll_event)
buffer = self.get_buffer() buffer = self.get_buffer()

View File

@ -47,13 +47,23 @@ class SourceViewEvents(SourceViewDnDMixin, MarkEventsMixin, FileEventsMixin):
def _button_press_event(self, widget = None, eve = None, user_data = None): def _button_press_event(self, widget = None, eve = None, user_data = None):
if eve.type == Gdk.EventType.BUTTON_PRESS and eve.button == 1 : # l-click if eve.button == 1 : # l-click
...
elif eve.button == 2: # m-click
...
elif eve.button == 3: # r-click
...
def _button_release_event(self, widget = None, eve = None, user_data = None):
if eve.button == 1 : # l-click
self.keyboard_clear_marks()
if eve.state & Gdk.ModifierType.CONTROL_MASK:
self.go_to_call()
elif eve.button == 2: # m-click
if eve.state & Gdk.ModifierType.CONTROL_MASK: if eve.state & Gdk.ModifierType.CONTROL_MASK:
self.button_press_insert_mark(eve) self.button_press_insert_mark(eve)
return True return True
else: elif eve.button == 3: # r-click
self.keyboard_clear_marks()
elif eve.type == Gdk.EventType.BUTTON_RELEASE and eve.button == 3: # r-click
... ...
def _scroll_event(self, widget, eve): def _scroll_event(self, widget, eve):