Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
-
e3366360
by wurstsalat at 2023-05-19T22:11:18+02:00
1 changed file:
Changes:
| ... | ... | @@ -107,9 +107,18 @@ def _on_key_press(self, |
| 107 | 107 | return False
|
| 108 | 108 | |
| 109 | 109 | def _on_focus_out(self, *args: Any) -> bool:
|
| 110 | - # Add 100 ms timeout in order to process potential menu item click
|
|
| 111 | - # events (which will emit focus-out-event on the message input)
|
|
| 112 | - GLib.timeout_add(100, self.popdown)
|
|
| 110 | + win = self.get_window()
|
|
| 111 | + default_display = Gdk.Display.get_default()
|
|
| 112 | + if default_display is not None:
|
|
| 113 | + pointer = default_display.get_default_seat().get_pointer()
|
|
| 114 | + if win is not None and pointer is not None:
|
|
| 115 | + _win, x_pos, y_pos, _mod = win.get_device_position(pointer)
|
|
| 116 | + rect = self.get_allocation()
|
|
| 117 | + if (x_pos not in range(0, rect.width) or
|
|
| 118 | + y_pos not in range(0, rect.height)):
|
|
| 119 | + # Only popdown if click is outside of Popover's Rectangle
|
|
| 120 | + self.popdown()
|
|
| 121 | + |
|
| 113 | 122 | return False
|
| 114 | 123 | |
| 115 | 124 | def _on_popover_closed(self, _popover: Gtk.Popover) -> None:
|