Commit Graph

60049 Commits

Author SHA1 Message Date
Matthias Clasen
e9067ae2db Replace gtk_drop_target_attach/detach
Since drop targets are now just event controller,
gtk_widget_add/remove_controller works just fine
for them.
2020-01-08 18:48:21 -05:00
Matthias Clasen
f898bee032 Use normal event propagation for DND events
This works just fine, now that drop targets are
event controllers. There is only a very vestigial
gtk_drag_dest_handle_event() left that deals with
corner cases.
2020-01-08 18:48:21 -05:00
Matthias Clasen
6a7f39e6d2 Get rid of GtkDragDestInfo
We can just attach the GtkDropTarget directly to
the GdkDrop.
2020-01-08 18:48:21 -05:00
Matthias Clasen
dfb2cbdfdb Turn GtkDropTarget into an event controller
We are still propagating the drag events manually,
but we are now calling gtk_widget_run_controllers
to pass them to drop targets.
2020-01-08 18:48:21 -05:00
Matthias Clasen
f960eb6ab4 More internal restructuring 2020-01-08 18:48:21 -05:00
Matthias Clasen
60fc2c6a7a dnd: Another internal refactoring step 2020-01-08 18:48:21 -05:00
Matthias Clasen
3080592234 gdk: Make gdk_event_set_coords support dnd events
GTK event propagation code relies on this working.
2020-01-08 18:48:21 -05:00
Matthias Clasen
532fdde720 dnd: More internal restructuring 2020-01-08 18:48:21 -05:00
Matthias Clasen
f8399588e9 dnd: Some internal restructuring
Nudge the code towards being like event controllers.
2020-01-08 18:48:20 -05:00
Matthias Clasen
ad019be75b Drop an unused define 2020-01-08 18:48:20 -05:00
Matthias Clasen
e505dab487 Stop passing timestamps around
We were not using these in a useful way in the end,
so stop passing them around.
2020-01-08 18:48:20 -05:00
Matthias Clasen
1262184269 droptarget: Drop the track-motion property
It does not have any effect anymore.

Update all callers
2020-01-08 18:48:20 -05:00
Matthias Clasen
46f42fc53d droptarget: Drop defaults flags
These no longer have any effect.

Update all callers.
2020-01-08 18:48:20 -05:00
Matthias Clasen
cb26cd7391 Simplify some drag dest internals
Change things around to make the default handler
of GtkDropTarget::drag-motion implement the default
handling. Always emit ::drag-motion and ::drag-leave,
and always arm the drop target.

This makes the GTK_DEST_DEFAULT_MOTION flag and
the ::track-motion property unnecessary.

Drop targets that are purely after track-motion
handling for ui switching purposes, such as
GtkStackSwitcher, will have to undo the automatic
arming in a notify::armed handler.
2020-01-08 18:48:20 -05:00
Matthias Clasen
1a3eeb1233 Drop GTK_DEST_DEFAULT_HIGHLIGHT
Redo highlight handling slightly. GtkDropTarget now has
a ::armed property that can be tracked to do custom highlighting,
and we always add the dnd style class to armed drop sites.
2020-01-08 18:48:20 -05:00
Matthias Clasen
e1f74c8f69 dragdest: Clean up internals
Remove the no-longer needed GtkDragDest struct
and just attach the GtkDropTarget directly.
2020-01-08 18:48:20 -05:00
Matthias Clasen
58106af54d testdnd2: Add a test for ASK handling
It is a bit unfortunate that we need to extend the
lifespan of the drop object by keeping our own
ref, but I don't see a better way of doing it.
2020-01-08 18:48:20 -05:00
Matthias Clasen
1e000c3dac Remove gtkdnd.h 2020-01-08 18:48:20 -05:00
Matthias Clasen
19ee9b4c57 Remove gdk_drag_get_data
This is not used anymore, so we can remove it,
and the GtkDropTarget::drag-data-received signal
that it emits.
2020-01-08 18:48:20 -05:00
Matthias Clasen
1075607528 treeview: Stop using ::drag-data-received 2020-01-08 18:48:20 -05:00
Matthias Clasen
d2bd9b0850 iconview: Avoid drag-data-received 2020-01-08 18:48:20 -05:00
Matthias Clasen
74d445636c testtreednd: Use the new asyn selection read 2020-01-08 18:48:20 -05:00
Matthias Clasen
7048790931 testlist3: Use async read api for selection 2020-01-08 18:48:20 -05:00
Matthias Clasen
b9034015d7 filechooser: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
c7b70b122a placessidebar: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
6e01a49d10 iconview: Port to GtkDropTarget
A small api change here is that
gtk_icon_view_enable_model_drag_dest now returns
a GtkDropTarget that can be used to connect signals.
2020-01-08 18:48:20 -05:00
Matthias Clasen
c290bd6367 Add an async read function for selection
This is meant as a replacement for ::drag-data-received
in cases where a #GtkSelectionData object is still needed,
such as when using GtkTreeModel DND support.
2020-01-08 18:48:20 -05:00
Matthias Clasen
853063bea7 Remove old drag dest api 2020-01-08 18:48:20 -05:00
Matthias Clasen
69e3fee5e2 Move some remaining api over 2020-01-08 18:48:20 -05:00
Matthias Clasen
aa276a181e listbox: Remove unhighlighting
This will have to be done differently, if necessary.
2020-01-08 18:48:20 -05:00
Matthias Clasen
583705b4ae notebook: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
cd7303d47c testtreednd: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
0f9cbf49ac testnotebookdnd: Fix, partially
Make this mostly work again.
2020-01-08 18:48:20 -05:00
Matthias Clasen
a309e74be7 testtoolbar: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
ccaf70e1b7 testlist3: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
2fd9431f23 testdnd: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
3f33a0ed27 testdnd2: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
4ea18a22e6 treeview: Port to GtkDropTarget
A small api change here is that
gtk_tree_view_enable_model_drag_dest now returns
a GtkDropTarget that can be used to connect signals.
2020-01-08 18:48:20 -05:00
Matthias Clasen
746dc5c3a2 textview: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
17131f1137 filechoserbutton: Convert to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
07c889c5ea stackswitcher: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
b0d9a6ff20 expander: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
802c7975e2 window: Port to GtkDragDest 2020-01-08 18:48:20 -05:00
Matthias Clasen
6e602e052b text: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
025eee112c colorswatch: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
70cdd4e951 colorbutton: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
75b789f20f calendar: Port to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
ac09500d74 gtk-demo: Convert clipboard demo to GtkDropTarget 2020-01-08 18:48:20 -05:00
Matthias Clasen
a76b187a5b drop: Add a convenience api
This is a question that drag-drop handlers frequently
need to answer, so make it easy.
2020-01-08 18:48:20 -05:00
Matthias Clasen
45679d7bc3 dragdest: doc improvements 2020-01-08 18:48:20 -05:00