Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
62996c6a by mesonium at 2025-03-07T22:01:46+00:00
fix: Make dragged chat stick to cursor

- - - - -


1 changed file:

- gajim/gtk/chat_list_row.py


Changes:

=====================================
gajim/gtk/chat_list_row.py
=====================================
@@ -121,9 +121,6 @@ def __init__(
         )
         self._on_mute_setting_changed()
 
-        self._drag_hotspot_x: float = 0
-        self._drag_hotspot_y: float = 0
-
         drag_source = Gtk.DragSource(actions=Gdk.DragAction.MOVE)
         self._connect(drag_source, "prepare", self._on_prepare)
         self._connect(drag_source, "drag-begin", self._on_drag_begin)
@@ -491,11 +488,8 @@ def _on_context_popover_closed(self, _popover: 
Gtk.Popover) -> None:
         self.emit("context-menu-state-changed", False)
 
     def _on_prepare(
-        self, _drag_source: Gtk.DragSource, x: float, y: float
+        self, _drag_source: Gtk.DragSource, _x: float, _y: float
     ) -> Gdk.ContentProvider:
-        self._drag_hotspot_x = x
-        self._drag_hotspot_y = y
-
         value = GObject.Value()
         value.init(ChatListRow)
         value.set_object(self)
@@ -504,11 +498,14 @@ def _on_prepare(
 
     def _on_drag_begin(self, _drag_source: Gtk.DragSource, drag: Gdk.Drag) -> 
None:
         assert not isinstance(self.contact, ResourceContact)
+
+        is_LTR = bool(self.get_direction() == Gtk.TextDirection.LTR)
+
         Gtk.DragIcon.set_from_paintable(
             drag,
             Gtk.WidgetPaintable().new(self),
-            int(self._drag_hotspot_x),
-            int(self._drag_hotspot_y),
+            hot_x=0 if is_LTR else self.get_width(),
+            hot_y=0,
         )
 
         app.window.highlight_dnd_targets(self, True)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/62996c6a4af7f6500fb7a1d005e5687dfde50e27

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/62996c6a4af7f6500fb7a1d005e5687dfde50e27
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to