aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-06-20 17:29:57 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-06-20 18:56:11 +0000
commit2e4da6fbf69eb9edafdd74923fc155d16fde2133 (patch)
tree5eb11374c714bae3f23b654051f313b5c6040657
parentshm-formats: #ifdef on formats added in 1.20 (diff)
selection: ignore drag-and-drops with unsupported mime-types
Specifically, make sure we do *not* call wl_data_offer_receive() with a NULL mime-type, as this causes libwayland to error out, which in turn causes foot to exit. Closes #1092
-rw-r--r--CHANGELOG.md7
-rw-r--r--selection.c6
2 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7a84bc13..dec74bc1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -74,10 +74,15 @@
* Graphical corruption when viewport is at the top of the scrollback,
and the output is scrolling.
-* Improved text reflow of logical lines with trailing empty cells ([#1055][1055])
+* Improved text reflow of logical lines with trailing empty cells
+ ([#1055][1055])
* IME focus is now tracked independently from keyboard focus.
+* Workaround for buggy compositors (e.g. some versions of GNOME)
+ allowing drag-and-drops even though foot has reported it does not
+ support the offered mime-types ([#1092][1092]).
[1055]: https://codeberg.org/dnkl/foot/issues/1055
+[1092]: https://codeberg.org/dnkl/foot/issues/1092
### Security
diff --git a/selection.c b/selection.c
index 37dd2c8d..20e2d8d8 100644
--- a/selection.c
+++ b/selection.c
@@ -2392,6 +2392,12 @@ drop(void *data, struct wl_data_device *wl_data_device)
struct wl_clipboard *clipboard = &seat->clipboard;
+ if (clipboard->mime_type == DATA_OFFER_MIME_UNSET) {
+ LOG_WARN("compositor called data_device::drop() "
+ "even though we rejected the drag-and-drop");
+ return;
+ }
+
struct dnd_context *ctx = xmalloc(sizeof(*ctx));
*ctx = (struct dnd_context){
.term = term,