diff options
author | Philipp Hörist <philipp@hoerist.com> | 2022-09-28 21:24:42 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2022-09-28 21:26:29 +0300 |
commit | 986cfb9c85106ac103f52ace17032b607338225f (patch) | |
tree | 6d2df6422850c1324c6751c298c4800b098ec1eb | |
parent | 0baa4d801382251c9fe61ae5a38ffd5c4ed35c10 (diff) |
fix: ChatList: Show context menu in correct position
When the context menu was triggered with the mouse over the close
button, the menu would show far away from the mouse.
Fixes #11165
-rw-r--r-- | gajim/gtk/chat_list.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gajim/gtk/chat_list.py b/gajim/gtk/chat_list.py index fe215fd16..649fe9d46 100644 --- a/gajim/gtk/chat_list.py +++ b/gajim/gtk/chat_list.py @@ -872,6 +872,15 @@ class ChatRow(Gtk.ListBoxRow): rectangle.y = int(event.y) rectangle.width = rectangle.height = 1 + event_widget = Gtk.get_event_widget(event) + if isinstance(event_widget, Gtk.Button): + # When the event is triggered by pressing the close button we get + # a x coordinate relative to the window of the close button, which + # would be a very low x integer as the close button is small, this + # leads to opening the menu far away from the mouse. We overwrite + # the x coordinate with an approx. position of the close button. + rectangle.x = int(self.get_allocated_width() - 10) + popover = Gtk.Popover.new_from_model(self, menu) popover.set_relative_to(self) popover.set_position(Gtk.PositionType.RIGHT) |