Commit Graph

52 Commits

Author SHA1 Message Date
Matthias Clasen
014adb841e gdk: Add an annotation
We are returning interned strings here, and
g-i seems to have trouble interpreting the const,
so lets help it out by being more explicit with
our annotations.

Fixes: #6167
2023-10-19 10:06:53 -04:00
Matthias Clasen
98ff6c0d4d gdk: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
4aabc45685 Drop gdkintl.h
This header was merely including gi18n-lib.h.
Just do that directly.
2022-09-23 23:33:42 -04:00
Sophie Herold
a546ae32d7 Remove all nicks and blurbs from param specs
Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.

Closes #4904
2022-05-11 18:16:29 +02:00
Benjamin Otte
a29474567a gdk: Remove gdkinternals.h 2021-09-24 22:50:29 +02:00
Matthias Clasen
92c6485adf docs: Tweak wording
Instead of drag'n'drop, say drag-and-drop. That is easier
to read, and less unclear on the markdown syntax implications.
2021-06-19 08:03:47 -07:00
Matthias Clasen
c8ad4d5deb dnd: Add another assertion
Assert that gdk_drop_finish() is called after the
drop is performed.
2021-06-19 07:50:41 -07:00
Matthias Clasen
4a0d3d7acc docs: Reduce redundancy
Remove a boatload of "or %NULL" from nullable parameters
and return values. gi-docgen generates suitable text from
the annotation that we don't need to duplicate.

This adds a few missing nullable annotations too.
2021-05-20 20:45:06 -04:00
Matthias Clasen
7fe0610b68 introspection: Stop using allow-none
allow-none has been deprecated for a long time
already. Instead use optional and nullable everywhere.
2021-05-20 19:17:49 -04:00
Matthias Clasen
8ba16eb4f1 Documentation fixes
Mostly fixing up indentation of continuation lines,
and other small cleanups.
2021-05-20 19:17:49 -04:00
Matthias Clasen
74e2bb4cf1 dnd: Add some warnings to the docs
Add some warnings about pitfalls of the async dnd api.
2021-03-16 14:48:44 -04:00
Matthias Clasen
d92647a92b drop: Add property annotations
Connect properties, getters, and setters with annotations.
2021-03-11 16:37:32 +00:00
Matthias Clasen
9132f1831c docs: Rework the gdk docs
Convert links, make things more concise.
2021-03-11 16:37:31 +00:00
Emmanuele Bassi
04fb95ce9f docs: Split GdkDrag and GdkDrop sections
This way we have a section for each class.
2021-03-11 16:37:30 +00:00
Matthias Clasen
71373ff6fb drop: Don't leak the surface and formats 2020-08-06 20:02:33 -04:00
Matthias Clasen
1d7b273669 docs: Clean up dangling links in gdk docs
Clean up references to no-longer-existing APIs.
2020-08-05 15:45:43 -04:00
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
Emmanuele Bassi
f28aa1ba02 Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 19:54:02 +01:00
Benjamin Otte
7427f4f311 drop: Don't use g_object_get() 2020-03-02 21:45:42 +01:00
Benjamin Otte
0e72adf6dd drop: Remove unused convenience APIs
With the new event controllers, these are unused.
2020-03-02 04:43:56 +01:00
Benjamin Otte
7cd728a0ea gdk: Make gdk_drop_status() take preferred action
This allows textview/text dnd to properly display a MOVE icon when in
the widget the drag started from but a COPY icon otherwise.
2020-03-02 04:43:56 +01:00
Benjamin Otte
e3aee62b18 drop: Guard variable with correct compiler flags 2020-02-22 07:33:40 +01:00
Benjamin Otte
808961564c gdk: Make DRAG_ENTER event take x/y coordinates
Make it mirror the behavior of ENTER/LEAVE events.
2020-02-21 18:19:16 +01:00
Matthias Clasen
c343031a0e Stop using g_object_ref/unref on events
Use gdk_event_ref/unref instead of g_object_ref/unref.
Events will stop being object soon.
2020-02-21 00:47:53 -05:00
Matthias Clasen
d6c5ecbea3 gdk: Use event constructors for dnd 2020-02-21 00:40:50 -05:00
Matthias Clasen
7e80c39aee Remove root coords from the GdkDrop api 2020-02-21 00:39:41 -05:00
Benjamin Otte
5a726bc665 drop: Add a state machine for tracking events 2020-02-16 20:10:30 +01:00
Benjamin Otte
a824da66d9 drop: Ensure all relevant formats are available
1. GdkDrop does deserialization, so add the deserialize formats

2. If the drop is local, we can copy straight from the drag, so we can
   also copy all its formats. This fixes cases where the backend would
   drop formats it doesn't support.
2020-02-15 20:02:44 +01:00
Robert Ancell
2b6162116d Fix docstring errors with drag and drop code 2020-01-13 12:30:17 +13: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
814d20d61a docs: Small clarifications to DND docs
Clear up the documentation around ASK handling
a bit.
2020-01-04 12:48:39 -05:00
Matthias Clasen
94a0bc01f9 gdk: Populate dnd event coords
The GdkDrop emit... apis take root coordinates.
That should be changed to surface coordinates,
eventually. For now, make the functions fill
the x, y fields.
2019-12-30 11:58:11 -05:00
Matthias Clasen
64fd5158bf gdk: Change some async dnd api
The pattern we generally follow is to put the
async result right after the source object, in
finish functions. Do this for gdk_drop_read_finish.
2019-04-02 15:11:06 +00:00
Piotr Drąg
2b8e30a8ed Use Unicode apostrophes in new strings
See https://developer.gnome.org/hig/stable/typography.html

https://bugzilla.gnome.org/show_bug.cgi?id=772371
2018-09-20 19:01:14 +02:00
Matthias Clasen
98ccb67277 drop: stop accessing GdkDrag fields 2018-07-15 16:43:28 -04:00
Matthias Clasen
bc2f484ae9 Revert "GdkDrop: drop the priv struct"
This reverts commit d927c3bee0.

I was wrong. Better to hide the struct fields from subclasses.
2018-07-15 15:58:05 -04:00
Matthias Clasen
d927c3bee0 GdkDrop: drop the priv struct
Its not needed.
2018-07-12 13:02:42 +02:00
Matthias Clasen
7733f646d6 gdk: Rename GdkDragContext to GdkDrag
This is to go along with the newly introduced GdkDrop.

This commit includes the necessary updates to the X11, Wayland
and Broadway backends. Other backends have to be updated separately.
2018-07-02 14:59:26 +02:00
Benjamin Otte
6633d4130a dnd: Make the base Drag/Drop types abstract
This way, they'll be ignored by the testsuite.

And we don't want to instantiate them anyway, the backends have
their own subclasses.
2018-06-18 23:49:52 +02:00
Benjamin Otte
a960641ace dnd: GdkDragContext is no longer a GdkDrop subclass
This includes a bunch of header cleanup
2018-06-18 23:49:52 +02:00
Benjamin Otte
dcf432d7d0 dnd: Add read_value() and read_text() functions to GdkDrop
These just copy what GdkClipboard does.
2018-06-18 23:49:52 +02:00
Benjamin Otte
ea9d6f0a95 drop: Implement shortcut for local DND
Now that we have the drop->drag, we can use the same shortcut we use in
the clipboard code to shortcut DND operations.
2018-06-18 23:49:52 +02:00
Benjamin Otte
c67fb57881 events: Make GdkEventDND have a GdkDrop member
... instead of a GdkDragContext.
2018-06-18 23:49:52 +02:00
Benjamin Otte
657ebd2a78 drop: Add private API for event emission 2018-06-18 23:49:52 +02:00
Benjamin Otte
05bf87cf14 drop: Add GdkDrop:surface property
This replaces gdk_drag_context_get_dest_surface().
2018-06-18 23:49:52 +02:00
Benjamin Otte
a862ca41c5 drop: Add gdk_drop_get_drag()
For now, it'll always return NULL. We'll fix that later.
2018-06-18 23:49:20 +02:00
Benjamin Otte
316bd6a333 dnd: Add gdk_drop_finish()
and move the vfunc into GdkDrop.
2018-06-18 23:49:20 +02:00
Benjamin Otte
13ae11ee01 dnd: Rename gdk_drop_finish() => gdk_drag_finish()
This is a simple rename, so that we can reintroduce gdk_drop_finish()
with the GdkDrop object.
2018-06-18 23:49:19 +02:00
Benjamin Otte
a05af1f0f3 dnd: Move the gdk_drag_status() function
It's now gdk_drop_status().

Also clarify the intended semantics.
2018-06-18 23:49:19 +02:00
Benjamin Otte
b2dc303e5e dnd: Add gdk_drop_get_actions()
This uses the new method without GDK_ACTION_ASK:

Either it is a single action (queryable via gdk_drag_action_is_unique())
or it is not and then the drop target has to make a decision
(potentially by asking someone).
2018-06-18 23:49:19 +02:00