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


Commits:
eba84277 by wurstsalat at 2025-08-16T11:51:52+02:00
fix: Disable drag and drop for files on X11

This is a workaround preventing a cresh, see:
https://dev.gajim.org/gajim/gajim/-/issues/12313

- - - - -


3 changed files:

- gajim/gtk/avatar_selector.py
- gajim/gtk/chat_stack.py
- gajim/gtk/file_transfer_selector.py


Changes:

=====================================
gajim/gtk/avatar_selector.py
=====================================
@@ -23,6 +23,7 @@
 
 from gajim.common import app
 from gajim.common.const import AvatarSize
+from gajim.common.const import Display
 from gajim.common.i18n import _
 from gajim.common.util.image import scale_with_ratio
 from gajim.common.util.uri import get_file_path_from_uri
@@ -117,6 +118,11 @@ def _on_path_picked(
         self.prepare_crop_area(str(paths[0]))
 
     def _on_drop_accept(self, _target: Gtk.DropTarget, drop: Gdk.Drop) -> bool:
+        if app.is_display(Display.X11):
+            # DND on X11 freezes due to a GTK bug:
+            # https://dev.gajim.org/gajim/gajim/-/issues/12313
+            return False
+
         formats = drop.get_formats()
         return bool(formats.contain_gtype(Gdk.FileList))
 


=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -23,6 +23,7 @@
 from gajim.common import ged
 from gajim.common.commands import ChatCommands
 from gajim.common.const import CallType
+from gajim.common.const import Display
 from gajim.common.ged import EventHelper
 from gajim.common.i18n import _
 from gajim.common.modules.contacts import BareContact
@@ -122,6 +123,7 @@ def __init__(self):
         drop_target = Gtk.DropTarget(
             actions=Gdk.DragAction.COPY, formats=format_builder.to_formats()
         )
+        self._connect(drop_target, "accept", self._on_drop_accept)
         self._connect(drop_target, "drop", self._on_file_drop)
         self._connect(drop_target, "enter", self._on_drag_enter)
         self._connect(drop_target, "leave", self._on_drag_leave)
@@ -749,6 +751,11 @@ def _on_drag_enter(
     def _on_drag_leave(self, _drop_target: Gtk.DropTarget) -> None:
         self._drop_area.set_visible(False)
 
+    def _on_drop_accept(self, _target: Gtk.DropTarget, _drop: Gdk.Drop) -> 
bool:
+        # DND on X11 freezes due to a GTK bug:
+        # https://dev.gajim.org/gajim/gajim/-/issues/12313
+        return not app.is_display(Display.X11)
+
     def _on_file_drop(
         self,
         target: Gtk.DropTargetAsync,


=====================================
gajim/gtk/file_transfer_selector.py
=====================================
@@ -18,6 +18,7 @@
 
 from gajim.common import app
 from gajim.common import types
+from gajim.common.const import Display
 from gajim.common.helpers import load_file_async
 from gajim.common.i18n import _
 from gajim.common.modules.contacts import BareContact
@@ -197,6 +198,11 @@ def _get_file_paths(self) -> list[Path]:
         return paths
 
     def _on_drop_accept(self, _target: Gtk.DropTarget, drop: Gdk.Drop) -> bool:
+        if app.is_display(Display.X11):
+            # DND on X11 freezes due to a GTK bug:
+            # https://dev.gajim.org/gajim/gajim/-/issues/12313
+            return False
+
         formats = drop.get_formats()
         return bool(formats.contain_gtype(Gdk.FileList))
 



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

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/eba84277d631b7c653962745d0226ba585efa375
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