Commit Graph

28 Commits

Author SHA1 Message Date
Alexander Larsson
9a7e721181 GdkSurface: Rename various functions and variables
This is an automatic rename of various things related
to the window->surface rename.

Public symbols changed by this is:
 GDK_MODE_WINDOW
 gdk_device_get_window_at_position
 gdk_device_get_window_at_position_double
 gdk_device_get_last_event_window
 gdk_display_get_monitor_at_window
 gdk_drag_context_get_source_window
 gdk_drag_context_get_dest_window
 gdk_drag_context_get_drag_window
 gdk_draw_context_get_window
 gdk_drawing_context_get_window
 gdk_gl_context_get_window
 gdk_synthesize_window_state
 gdk_surface_get_window_type
 gdk_x11_display_set_window_scale
 gsk_renderer_new_for_window
 gsk_renderer_get_window
 gtk_text_view_buffer_to_window_coords
 gtk_tree_view_convert_widget_to_bin_window_coords
 gtk_tree_view_convert_tree_to_bin_window_coords

The commands that generated this are:

git sed -f g "GDK window" "GDK surface"
git sed -f g window_impl surface_impl
(cd gdk; git sed -f g impl_window impl_surface)
git sed -f g WINDOW_IMPL SURFACE_IMPL
git sed -f g GDK_MODE_WINDOW GDK_MODE_SURFACE
git sed -f g gdk_draw_context_get_window gdk_draw_context_get_surface
git sed -f g gdk_drawing_context_get_window gdk_drawing_context_get_surface
git sed -f g gdk_gl_context_get_window gdk_gl_context_get_surface
git sed -f g gsk_renderer_get_window gsk_renderer_get_surface
git sed -f g gsk_renderer_new_for_window gsk_renderer_new_for_surface

(cd gdk; git sed -f g window_type surface_type)
git sed -f g gdk_surface_get_window_type gdk_surface_get_surface_type

git sed -f g window_at_position surface_at_position
git sed -f g event_window event_surface
git sed -f g window_coord surface_coord
git sed -f g window_state surface_state
git sed -f g window_cursor surface_cursor
git sed -f g window_scale surface_scale
git sed -f g window_events surface_events
git sed -f g monitor_at_window monitor_at_surface
git sed -f g window_under_pointer surface_under_pointer
(cd gdk; git sed -f g for_window for_surface)
git sed -f g window_anchor surface_anchor
git sed -f g WINDOW_IS_TOPLEVEL SURFACE_IS_TOPLEVEL
git sed -f g native_window native_surface
git sed -f g source_window source_surface
git sed -f g dest_window dest_surface
git sed -f g drag_window drag_surface
git sed -f g input_window input_surface

git checkout NEWS* po-properties po docs/reference/gtk/migrating-3to4.xml
2018-03-20 12:05:26 +01:00
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Benjamin Otte
02892c59d1 dnd: Remove unused member variable 2018-01-31 13:21:26 +01:00
Benjamin Otte
bdd2f68ab5 dnd: Move GdkDragProtocol to X11
It's not needed in the generic implementation, so don't have it there.
2018-01-31 13:21:26 +01:00
Benjamin Otte
3e0fab6b93 dnd: Remove 2 vfuncs that aren't needed
They're only used inside the X11 backend, and the backend can just call
its own function.
2018-01-31 13:21:26 +01:00
Benjamin Otte
b49a9b9933 dnd: Remove gdk_drag_get_selection()
Without selections, drags can't have them either.

Also included is removing the selection from GtkSelectionData.

Includes a bunch of crude cleanups to Wayland code that no longer has to
care about selection atoms.
2017-12-14 04:39:22 +01:00
Benjamin Otte
8648d5409e dnd: Pass content to gdk_drag_begin()
Instead of just passing the GdkContentFormats, we are now passing the
GdkContentProvider to gdk_drag_begin().
This means that GDK itself can now query the data from the provider
directly instead of having to send selection events.

Use this to provide the private API gdk_drag_context_write() that allows
backends to pass an output stream that this data will be written to.
Implement this as the mechanism for providing drag data on Wayland.

And to make this all work, implement a content provider named
GtkDragContent that is implemented by reverting to the old DND
drag-data-get machinery inside GTK, so for widgets everything works just
like before.
2017-12-13 15:05:27 +01:00
Benjamin Otte
80dcdd3df6 gdk: Remove unused function
Fun fact: This function was never used.
2017-12-13 00:56:52 +01:00
Benjamin Otte
643a6c2311 gdk: Remove gdk_drag_manage_dnd()
Instead, pass the actions as part of gdk_drag_begin() and insist DND is
always managed.

A new side effect is that gdk_drag_begin() can now return %NULL.
2017-12-11 01:46:33 +01:00
Benjamin Otte
a7c3c794df dnd: Make gdk_drag_context_set_device() private
There's no need to call it from GTK anymore, because we pass the device
to gdk_drag_begin().
2017-12-11 01:02:31 +01:00
Benjamin Otte
803cbd576f dnd: Introduce gdk_drop_read_async() and use it
This is the replacement for selection usage.

Backend implementations for X11 (missing support for backwards compat
formats like COMPOUND_TEXT) and Wayland are included.

GTK code should be adapted to use gdk_drop_read_*() functions instead
of gtk_drag_get_data().
2017-12-10 01:09:14 +01:00
Matthias Clasen
6ab72b2653 Remove GdkDragProtocol from the api
...together with apis that return it. We were not using this
information in GTK+ at all, so no need to provide it.
2017-12-03 06:41:08 +01:00
Matthias Clasen
8b1b9f8c55 Drop api that is only for unmanaged dnd
These functions are not needed as public api anymore.
2017-12-03 06:24:24 +01:00
Benjamin Otte
d6a209816b gdkdnd: Make GdkDragContext->formats a GdkContentFormats
Instead of it being a GList of GdkAtoms.
2017-11-20 23:12:33 +01:00
Matthias Clasen
f8cad19829 dnd: Drop GdkScreen from apis
Drop the screen argument from gdk_dnd_find_window_for_screen
and rename the function to gdk_dnd_find_window. The screen
argument does not add anything here since the drag context
is already tied to the display. Update all backends, and
update all callers.
2017-10-31 10:18:10 -04:00
Jonas Ådahl
1a4f000f3b gdk/dnd: Don't use default display when getting cursor
Always associate a drag context with a GdkDisplay and use that when
getting a cursor for a given action.

If we don't do this, dragging on a window that doesn't use the default
display will make us use cursors from the wrong display.

https://bugzilla.gnome.org/show_bug.cgi?id=765565
2016-04-26 23:03:24 +08:00
Carlos Garnacho
2923f69d3c gdkdnd: Add private means to commit the drag status
The way gdk_drag_status() may be called multiple times during the
processing of drag and drop events throughout the widget hierarchy
brings some superfluous messaging going in, esp. when it's the last
request the one we want to honor, yet we emit messaging requests on
all.

This is barely appreciable in the X11 backend, but due to the design
of the wayland protocol, quick series of changes like this it have
some self-amplificating consequences which may end up flooding the
connection.

We can delegate this to a late "commit" call, performed within GDK
event management. This way gdk_drag_status() calls may be cached
and only result in windowing messaging once per ::drag-motion or
::drag-data-received event. Emitting the final status will also
avoid spurious action changes on the compositor and the other peer.

https://bugzilla.gnome.org/show_bug.cgi?id=763298
2016-03-14 16:50:36 +01:00
Carlos Garnacho
38d0d0a687 gdkdnd: Stick to the first gdk_drag_drop_done() result
That way we can let ::cancel callers to override the visual
result of the operation (eg. when detaching notebook tabs on
NO_TARGET).

Also, document gdk_drag_drop_done() so it is mentioned that
this is a one-shot call.

https://bugzilla.gnome.org/show_bug.cgi?id=761954
2016-02-15 19:04:22 +01:00
Carlos Garnacho
aad3135e4c gdk: Add GdkDragCancelReason enum as argument to GdkDragContext::cancel
We should conform to a minimal set of reasons for the gtk side to emit
a better GtkDragResult than GTK_DRAG_RESULT_ERROR. This fixes the notebook
tab DnD feature, where we rely on GTK_DRAG_RESULT_NO_TARGET.

In the wayland side, unfortunately we can't honor either NO_TARGET nor
USER_CANCELLED, we don't know of the latter, so we could return false
positives on the former.

https://bugzilla.gnome.org/show_bug.cgi?id=761954
2016-02-15 18:35:51 +01:00
Carlos Garnacho
ed5da43afb gdk: Add gdk_drag_get_cursor()
This function (most similar to gtk_drag_get_cursor() helps figure out
the right cursor that applies to a given action. To be used by the
various backends.
2016-01-19 14:17:35 +01:00
Carlos Garnacho
edc4374a63 gdk: Allow internal management of source-side DnD
We've traditionally left GTK+ to handle the input side of things,
letting GDK only manage the windowing-specific messaging. This
way of splitting responsibilities is not compatible however with
some backends, we must fold then input management at the DnD stage
into GDK (and backends) domain.

The gdk_drag_context_manage_dnd() call is meant to be the entry
point for this mode of operation, if the drag and drop operation
becomes managed, the caller (i.e. gtkdnd.c) doesn't need to perform
grabs, nor manage input events itself.

As a consequence of this, different aspects now belong to the
backend GdkDragContext implementation:
- Because the caller doesn't see keyboard events anymore,
  keyboard navigation must be managed in GDK, so is the decision
  of the current action based on modifiers/button pressed.
- Because the caller won't see input events in general, the lifetime
  of the drag and drop operation is now communicated through the
  ::drop-performed, ::dnd-finished and ::cancel events
- Because the caller doesn't participate anymore on the action
  being chosen, the pointer cursor must be set by the backend.
  The caller is rather notified of the final action through the
  ::action signal.

The caller is still responsible of dealing with the corresponding
GdkSelection, ensuring its ownership and communicating the supported
mimetypes.
2016-01-19 14:17:35 +01:00
Matthias Clasen
c590b83397 gdk: Add gdk_drag_drop_done
This will allow us to move the drag cancel animation to GDK.
For now, it does nothing.
2015-12-13 10:39:43 -05:00
Matthias Clasen
f4ebdb64ee gdk: Add api to set drag window hotspot
With GdkDragContext now being in charge of placing the window,
it needs to know about the hotspot to place under the cursor.
2015-12-07 21:52:03 -05:00
Matthias Clasen
fff8297a50 Add gdk_drag_context_get_drag_window
This makes gdk_wayland_drag_context_get_dnd_window
backend-independent API and adds an implementation
for X11.
2015-12-01 23:47:56 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
27ce9421d0 Fix up GDK docs 2010-12-25 00:02:39 -05:00
Matthias Clasen
92f163d40a Consistently hide class structs
And, since we've decided to keep the structs private, there is
no point in having the standard GObject clas macros anymore either.
2010-12-24 15:54:12 -05:00
Matthias Clasen
ea96e5e16f Explode gdkinternals.h into per-class private headers
At the same time, move some more class and instance structs
out of public headers.
2010-12-21 12:06:58 -05:00