Commit 268c7a3e authored by Matthias Clasen's avatar Matthias Clasen

gdk: Allow passing the start coordinates in drag_begin

Add a variant of gdk_drag_begin that takes the start position
in addition to the device. All backend implementation have been
updated to accept (and ignore) the new arguments.

Subsequent commits will make use of the data in some backends.
parent eb97ef05
......@@ -950,6 +950,7 @@ gdk_drag_drop
gdk_drag_find_window_for_screen
gdk_drag_begin
gdk_drag_begin_for_device
gdk_drag_begin_from_point
gdk_drag_motion
gdk_drop_finish
GdkDragProtocol
......
......@@ -87,7 +87,9 @@ gdk_broadway_drag_context_finalize (GObject *object)
GdkDragContext *
_gdk_broadway_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets)
GList *targets,
gint x_root,
gint y_root)
{
GdkDragContext *new_context;
......
......@@ -44,7 +44,9 @@ void _gdk_broadway_resync_windows (void);
void _gdk_broadway_window_register_dnd (GdkWindow *window);
GdkDragContext * _gdk_broadway_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets);
GList *targets,
gint x_root,
gint y_root);
void _gdk_broadway_window_translate (GdkWindow *window,
cairo_region_t *area,
gint dx,
......
......@@ -31,6 +31,7 @@
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkevents.h>
G_BEGIN_DECLS
......@@ -143,6 +144,12 @@ GDK_AVAILABLE_IN_ALL
GdkDragContext * gdk_drag_begin_for_device (GdkWindow *window,
GdkDevice *device,
GList *targets);
GDK_AVAILABLE_IN_3_20
GdkDragContext * gdk_drag_begin_from_point (GdkWindow *window,
GdkDevice *device,
GList *targets,
gint x_root,
gint y_root);
GDK_AVAILABLE_IN_ALL
void gdk_drag_find_window_for_screen (GdkDragContext *context,
......
......@@ -11014,11 +11014,42 @@ gdk_drag_begin (GdkWindow *window,
* Returns: (transfer full): a newly created #GdkDragContext
*/
GdkDragContext *
gdk_drag_begin_for_device (GdkWindow *window,
GdkDevice *device,
GList *targets)
gdk_drag_begin_for_device (GdkWindow *window,
GdkDevice *device,
GList *targets)
{
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->drag_begin (window, device, targets);
gint x, y;
gdk_device_get_position (device, NULL, &x, &y);
return gdk_drag_begin_from_point (window, device, targets, x, y);
}
/**
* gdk_drag_begin_from_point:
* @window: the source window for this drag
* @device: the device that controls this drag
* @targets: (transfer none) (element-type GdkAtom): the offered targets,
* as list of #GdkAtoms
* @x_root: the x coordinate where the drag nominally started
* @y_root: the y coordinate where the drag nominally started
*
* Starts a drag and creates a new drag context for it.
*
* This function is called by the drag source.
*
* Returns: (transfer full): a newly created #GdkDragContext
*
* Since: 3.20
*/
GdkDragContext *
gdk_drag_begin_from_point (GdkWindow *window,
GdkDevice *device,
GList *targets,
gint x_root,
gint y_root)
{
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->drag_begin (window, device, targets, x_root, y_root);
}
/**
......
......@@ -239,7 +239,9 @@ struct _GdkWindowImplClass
void (* register_dnd) (GdkWindow *window);
GdkDragContext * (*drag_begin) (GdkWindow *window,
GdkDevice *device,
GList *targets);
GList *targets,
gint x_root,
gint y_root);
void (*process_updates_recurse) (GdkWindow *window,
cairo_region_t *region);
......
......@@ -35,7 +35,9 @@ gdk_quartz_drag_source_context ()
GdkDragContext *
_gdk_quartz_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets)
GList *targets,
gint x_root,
gint y_root)
{
g_assert (_gdk_quartz_drag_source_context == NULL);
......
......@@ -80,7 +80,9 @@ void _gdk_quartz_synthesize_null_key_event (GdkWindow *window);
void _gdk_quartz_window_register_dnd (GdkWindow *window);
GdkDragContext * _gdk_quartz_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets);
GList *targets,
gint x_root,
gint y_root);
/* Display */
......
......@@ -375,7 +375,9 @@ create_dnd_window (GdkScreen *screen)
GdkDragContext *
_gdk_wayland_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets)
GList *targets,
gint x_root,
gint y_root)
{
GdkWaylandDragContext *context_wayland;
GdkWaylandDisplay *display_wayland;
......
......@@ -103,11 +103,12 @@ GdkDragProtocol _gdk_wayland_window_get_drag_protocol (GdkWindow *window,
void _gdk_wayland_window_register_dnd (GdkWindow *window);
GdkDragContext *_gdk_wayland_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets);
GList *targets,
gint x_root,
gint y_root);
void _gdk_wayland_window_offset_next_wl_buffer (GdkWindow *window,
int x,
int y);
GdkDragContext * _gdk_wayland_drop_context_new (struct wl_data_device *data_device);
void _gdk_wayland_drag_context_set_source_window (GdkDragContext *context,
GdkWindow *window);
......
......@@ -1807,7 +1807,9 @@ gdk_drag_do_leave (GdkDragContext *context,
GdkDragContext *
_gdk_win32_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets)
GList *targets,
gint x_root,
gint y_root)
{
if (!use_ole2_dnd)
{
......
......@@ -484,7 +484,7 @@ void _gdk_win32_display_create_window_impl (GdkDisplay *display,
/* stray GdkWindowImplWin32 members */
void _gdk_win32_window_register_dnd (GdkWindow *window);
GdkDragContext *_gdk_win32_window_drag_begin (GdkWindow *window, GdkDevice *device, GList *targets);
GdkDragContext *_gdk_win32_window_drag_begin (GdkWindow *window, GdkDevice *device, GList *targets, gint x_root, gint y_root);
gboolean _gdk_win32_window_simulate_key (GdkWindow *window,
gint x,
gint y,
......
......@@ -1948,7 +1948,9 @@ create_drag_window (GdkScreen *screen)
GdkDragContext *
_gdk_x11_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets)
GList *targets,
gint x_root,
gint y_root)
{
GdkDragContext *context;
......
......@@ -312,7 +312,9 @@ void _gdk_x11_window_register_dnd (GdkWindow *window);
GdkDragContext * _gdk_x11_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets);
GList *targets,
gint x_root,
gint y_root);
gboolean _gdk_x11_get_xft_setting (GdkScreen *screen,
const gchar *name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment