Commit Graph

54 Commits

Author SHA1 Message Date
Corentin Noël
076b2f11d2 docs: Fix several missing references in the documentation
This fixes several typos and missing references
2020-05-11 19:26:20 +02:00
Benjamin Otte
2a697827e1 dragicon: Add gtk_drag_icon_create_widget_for_value()
... and use it to set a drag icon.
2020-03-02 04:43:56 +01:00
Benjamin Otte
03882e1f96 dragicon: Change how to acquire drag icons
Before, gtk_drag_icon_new_for_drag() allowed creating new drag icons.
This could cause multiple drag icons to exist for a single drag.

Now, gtk_drag_icon_get_for_drag() makes sure that only one drag icon is
created.
2020-03-02 04:43:56 +01:00
Matthias Clasen
b1eaa502df events: reorganize getters
Restructure the getters for event fields to
be more targeted at particular event types.

Update all callers, and replace all direct
event struct access with getters.

As a side-effect, this drops some unused getters.
2020-02-21 00:51:03 -05:00
Matthias Clasen
31bf9da63a Strip const from GdkEvent
Events are refcounted structs, and we generally don't
pass these as const.
2020-02-21 00:51:02 -05:00
Benjamin Otte
571021cbc1 icontheme: Pass fallbacks as optional argument to lookup_icon()
This way, we can remove gtk_icon_theme_choose_icon() completely.
2020-02-04 16:51:54 +01:00
Benjamin Otte
bbbe39fb44 icontheme: Make text direction a lookup argument
Most users were just forgetting to set the proper flags.
And flags aren't the right way to set this anyway, it was just
acceptable as a workaround during GTK3 to not break API.
2020-02-04 16:41:36 +01:00
Alexander Larsson
b087f9ca51 icon-theme: Drop the _for_scale() versions and always take scale 2020-01-30 10:53:43 +01:00
Alexander Larsson
c42977af04 Convert trivial users of icon theme loading to use info as paintable 2020-01-29 19:06:16 +01:00
Robert Ancell
9e9eae3ad4 Add missing transfer notation for function return types. 2020-01-13 12:14:08 +13:00
Matthias Clasen
8a521accbc dragsource: Change the ::prepare return type
Make it return the content provider to use for
the next drag. This allows just-in-time provision
of the content provider. The default handler just
returns the value of the ::content property.
2020-01-08 18:48:22 -05:00
Matthias Clasen
a053d7ddb1 dragsource: Drop gtk_drag_source_drag_begin
No longer used. Also, minor cleanups all over.
2020-01-08 18:48:22 -05:00
Matthias Clasen
c878f650ce dragksource: Small doc fix 2020-01-08 18:48:22 -05:00
Matthias Clasen
1eefaf8b41 dragsource: Fix cancellation
We need to properly end the drag.
2020-01-08 18:48:22 -05:00
Matthias Clasen
865fc9c925 dragsource: Rename ::drag-failed to ::drag-cancel
This matches the names of the GdkDrag signals.
2020-01-08 18:48:22 -05:00
Matthias Clasen
a1f4f52fcb dragsource: Tweak docs more 2020-01-08 18:48:22 -05:00
Matthias Clasen
bdb4bf00c5 dragsource: Document prepare 2020-01-08 18:48:22 -05:00
Matthias Clasen
aca252837d dragsource: Make ::prepare return a boolean
Make ::prepare return TRUE to start a drag.
The default handler simply checks that we
have a content provider and actions.
2020-01-08 18:48:22 -05:00
Matthias Clasen
8b058572f0 dragsource: Drop gtk_drag_get_source 2020-01-08 18:48:22 -05:00
Matthias Clasen
bd20ae4fa5 dragsource: Drop gtk_drag_source_get_origin 2020-01-08 18:48:21 -05:00
Matthias Clasen
deb16c1a00 Make GtkDragSource a gesture 2020-01-08 18:48:21 -05:00
Matthias Clasen
8c73f882af dragsource: Use public drag icon api 2020-01-08 18:48:21 -05:00
Matthias Clasen
e8b830a3dd dragsource: Reshuffle api a bit
Remove arguments from the constructor.

For actions, we now default to COPY, which is the most common one
that we should enable by default (MOVE requires handling deletion
on the the source side, and ASK only makes sense if we have
multiple actions).

For the content provider, we add a new ::prepare signal where
it should be provided just-in-time.
2020-01-08 18:48:21 -05:00
Matthias Clasen
38974d7d2b dragsource: Tweak api, update all callers
Add GdkDrag back to signals, drop ::drag-data-delete,
and replace it with a boolean in ::drag-end.
2020-01-08 18:48:21 -05:00
Matthias Clasen
f3be49838f Move code over
Move remaining code from gtkdnd.c to gtkdragdest.c
and nuke gtkdnd.c and gtkdndprivate.h.
2020-01-08 18:48:21 -05:00
Matthias Clasen
1e000c3dac Remove gtkdnd.h 2020-01-08 18:48:20 -05:00
Matthias Clasen
6dc8fc3a4d Add a GtkDropTarget object
Add an explicit GtkDropTarget object, and move the destination-side
DND signals here. The object is used by connecting to its signals
and attaching it to a widget with gtk_drop_target_attach().
2020-01-08 18:48:20 -05:00
Matthias Clasen
37b849b808 Move the rest of the drag-source api over
Just reshuffling some source.
2020-01-08 18:48:20 -05:00
Matthias Clasen
9b01d9a784 Remove traditional drag source API
gtk_drag_source_set, gtk_drag_begin, related apis
and the GtkWidget source-side signals have all been
replaced by GtkDragSource.
2020-01-08 18:48:20 -05:00
Matthias Clasen
303c9becf8 Add a GtkDragSource object
Add an explicit GtkDragSource object, and move the source-side
DND signals here. The object can be used on the spot, by calling
gtk_drag_source_drag_begin() yourself, or for static drag-source
configuration, by calling gtk_drag_source_attach(). In the latter
case, we set up and conect a drag gesture to trigger the drag_begin
call.
2020-01-08 18:48:19 -05:00
Matthias Clasen
1dcb76bc26 Merge branch 'wip/carlosg/controller' into 'master'
carlosg/controller

See merge request GNOME/gtk!131
2018-05-01 12:35:53 +00:00
Benjamin Otte
56cc470663 dragsource: Use capture phase for gesture
Otherwise buttons don't work as drag sources, and we like to do that.
2018-04-27 14:32:28 +02:00
Benjamin Otte
1e6eb1f8b9 draggesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
a8608618a9 dragsource: Replace gtk_drag_source_set_icon_surface()
... with gtk_drag_source_set_icon_paintable().
2018-03-16 06:04:45 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Matthias Clasen
9aba77e31b Redo drag source event handling
Let the gesture itself handle the events.
2017-12-13 18:56:42 -05:00
Benjamin Otte
04ac4c66ae dnd: Pass device, not event
You don't start a dnd operation with a device, you start it with an
event.
2017-12-12 00:31:49 +01:00
Benjamin Otte
756b276070 dnd: Remove button argument from drag_begin()
It was unused.
2017-12-12 00:29:51 +01:00
Matthias Clasen
c2a38612a9 Drop gtk_drag_source_set_icon_pixbuf
Part of removing GdkPixbuf from the API.
2017-11-29 20:02:47 -05:00
Benjamin Otte
fc2ce5a925 gdk: Make GdkContentFormats immutable 2017-11-20 23:13:10 +01:00
Benjamin Otte
9a6ec4e959 contentformats: Rename GtkTargetList
It's now called GdkContentsFormat
2017-11-20 23:12:33 +01:00
Benjamin Otte
3f5178dc21 selection: Remove the info uint
Instead of allowing people to pass a uint user-data, insist on them
comparing mime types.

The user data was a uint instead of a pointer anyway, so uniqueness
could not be guaranteed and it caused more issues than it was worth.
And that's ignoring the fact that it basically wasn't used.
2017-11-16 22:59:43 +01:00
Benjamin Otte
5a1a11bcde dnd: Make GtkDragDest and GtkDragSource use GtkTargetList
This gets rid of GtkTargetEntry in the API and consistently uses
GtkTargetList.
2017-11-15 19:07:17 +01:00
Alexander Larsson
61b2ab5d90 GtkDragSource: Don't use gtk_image_definition_new_pixbuf
We want to get rid of pixbuf image definitions.

Long term this should probably be gtk_drag_source_set_icon_surface instead.
2017-10-23 15:28:33 +02:00
Matthias Clasen
493f5d6b18 dnd: Add more surface apis
The new function, gtk_drag_source_set_icon_surface, is for setting
a drag source icon without using GdkPixbuf.
2017-10-23 14:16:31 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Timm Bäder
f4a24babd4 gdkdragsource: Ensure button >= 1
So the left shift later doesn't overflow.
2017-03-21 19:04:58 +01:00
Matthias Clasen
0037d4d257 Don't leak a pixbuf reference in dnd
https://bugzilla.gnome.org/show_bug.cgi?id=775316
2016-11-29 14:42:35 -05:00
Timm Bäder
ad155fb26c Remove GtkStock API from GtkImage 2016-10-16 18:17:21 +02:00
Matthias Clasen
358eec2972 DND: Avoid a use-after-free
Cancelling the gesture causes the last_event pointer to become
invalid. Make a copy of the event so we can keep using it
regardless of the gesture state.
2016-05-11 13:24:04 -04:00