window: Only accept drops of correct type
This got lost with having a custom "accept" signal handler since the signal uses g_signal_accumulator_first_wins. Fixing this also works around GTK not properly checking the drops and ending up in criticals. Fixes #234
This commit is contained in:
parent
4994ec9b59
commit
896508deee
1 changed files with 6 additions and 2 deletions
|
|
@ -379,10 +379,14 @@ mod imp {
|
||||||
|
|
||||||
self.drop_target.set_types(&[gdk::FileList::static_type()]);
|
self.drop_target.set_types(&[gdk::FileList::static_type()]);
|
||||||
|
|
||||||
// Only accept drops from external sources or different windows
|
|
||||||
self.drop_target.connect_accept(
|
self.drop_target.connect_accept(
|
||||||
clone!(@weak obj => @default-return false, move |_drop_target, drop| {
|
clone!(@weak obj => @default-return false, move |_drop_target, drop| {
|
||||||
drop.drag().is_none() || drop.drag() != obj.image_view().drag_source().drag()
|
// Only accept drops from external sources or different windows
|
||||||
|
let different_source = drop.drag().is_none() || drop.drag() != obj.image_view().drag_source().drag();
|
||||||
|
// We have to do this manually since we are overwriting the default handler
|
||||||
|
let correct_format = drop.formats().contains_type(gdk::FileList::static_type());
|
||||||
|
|
||||||
|
different_source && correct_format
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue