diff options
author | Benjamin Otte <otte@redhat.com> | 2020-02-29 03:47:17 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2020-03-02 03:18:55 +0100 |
commit | a411959c910fbf86754b38ffcd7b9615d7788a74 (patch) | |
tree | 86e43f40dc05fa41108d667dfbe5f82f3fb47c02 /gtk/gtkdropprivate.h | |
parent | f4ac74795c41b2901b5b204aa76ec77010e59f95 (diff) | |
download | gtk+-a411959c910fbf86754b38ffcd7b9615d7788a74.tar.gz |
droptarget: Redo
This is a huge reorganization of GtkDropTarget. I did not know how to
split this up, so it's unfortunately all one commit.
Highlights:
- Split GtkDropTarget into GtkDropTarget and GtkDropTargetAsync
GtkDropTarget is the simple one that only works with GTypes and offers
a synchronous interface.
GtkDropTargetAsync retains the full old functionality and allows
handling mime types.
- Drop events are handled differently
Instead of picking a single drop target and sending all DND events to
it, every event is sent to every drop target. The first one to handle
the event gets to call gdk_drop_status(), further handlers do not
interact with the GdkDrop.
Of course, for the ultimate GDK_DROP_STARTING event, only the first
one to accept the drop gets to handle it.
This allows stacking DND event controllers that aren't necessarily
interested in handling the event or that might decide later to drop
it.
- Port all widgets to either of those
Both have a somewhat changed API due to the new event handling.
For the ones who should use the sync version, lots of cleanup was
involved to operate on a sync API.
Diffstat (limited to 'gtk/gtkdropprivate.h')
-rw-r--r-- | gtk/gtkdropprivate.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gtk/gtkdropprivate.h b/gtk/gtkdropprivate.h new file mode 100644 index 0000000000..769013bfcd --- /dev/null +++ b/gtk/gtkdropprivate.h @@ -0,0 +1,38 @@ +/* + * Copyright © 2020 Benjamin Otte + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see <http://www.gnu.org/licenses/>. + * + * Authors: Benjamin Otte <otte@gnome.org> + */ + +#ifndef __GTK_DROP_PRIVATE_H__ +#define __GTK_DROP_PRIVATE_H__ + +#include <gdk/gdk.h> + +G_BEGIN_DECLS + + +void gtk_drop_begin_event (GdkDrop *drop, + GdkEventType event_type); +void gtk_drop_end_event (GdkDrop *drop); + +gboolean gtk_drop_status (GdkDrop *drop, + GdkDragAction actions, + GdkDragAction preferred_action); + +G_END_DECLS + +#endif |