Compare commits

...

10 Commits

Author SHA1 Message Date
Matthias Clasen
3bc68b39ab 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-08-26 22:15:17 -04:00
Matthias Clasen
c084ff23f8 Drop api that is only for unmanaged dnd
These functions are not needed as public api anymore.
2017-08-26 22:15:17 -04:00
Matthias Clasen
6c56d04cee x11: Fix managed dnd
We need to actually trigger the drop from the gdk side.
2017-08-26 22:15:17 -04:00
Matthias Clasen
14811925b7 Stop making unneeded calls
These calls are documented as not necessary for managed
dnd, and testing confirms that.
2017-08-26 22:15:17 -04:00
Matthias Clasen
fa7f48cbfd Handle rootwin drop in gdk
This lets us drop the only use of the drag protocol in gtk.
2017-08-26 22:15:17 -04:00
Matthias Clasen
a61aeb389d Stop handling source-side dnd events
These are now all consumed by the managed dnd implementation
at the gdk level, and are only propagated as signals on
the drag context.
2017-08-26 20:06:18 -04:00
Matthias Clasen
273570a81f clean up includes 2017-08-26 20:06:18 -04:00
Matthias Clasen
a317be51d0 cut out more leftovers 2017-08-26 20:06:18 -04:00
Matthias Clasen
9ad9444e78 Remove much of the unmanaged dnd 2017-08-26 20:06:18 -04:00
Matthias Clasen
b35f51e4b7 dnd: drop keyboard grabs 2017-08-26 20:06:18 -04:00
16 changed files with 108 additions and 953 deletions

View File

@@ -903,15 +903,12 @@ gdk_cursor_get_type
GdkDragContext
GdkDragCancelReason
gdk_drag_get_selection
gdk_drag_abort
gdk_drop_reply
gdk_drag_drop
gdk_drag_drop_done
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
GdkDragAction

View File

@@ -180,24 +180,6 @@ gdk_drag_context_get_dest_window (GdkDragContext *context)
return context->dest_window;
}
/**
* gdk_drag_context_get_protocol:
* @context: a #GdkDragContext
*
* Returns the drag protocol thats used by this context.
*
* Returns: the drag protocol
*
* Since: 3.0
*/
GdkDragProtocol
gdk_drag_context_get_protocol (GdkDragContext *context)
{
g_return_val_if_fail (GDK_IS_DRAG_CONTEXT (context), GDK_DRAG_PROTO_NONE);
return context->protocol;
}
/**
* gdk_drag_context_set_device:
* @context: a #GdkDragContext
@@ -360,7 +342,7 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
G_TYPE_NONE, 1, GDK_TYPE_DRAG_ACTION);
}
/**
/*
* gdk_drag_find_window_for_screen:
* @context: a #GdkDragContext
* @drag_window: a window which may be at the pointer position, but
@@ -416,7 +398,7 @@ gdk_drag_status (GdkDragContext *context,
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_status (context, action, time_);
}
/**
/*
* gdk_drag_motion:
* @context: a #GdkDragContext
* @dest_window: the new destination window, obtained by
@@ -433,9 +415,6 @@ gdk_drag_status (GdkDragContext *context,
*
* This function is called by the drag source.
*
* This function does not need to be called in managed drag and drop
* operations. See gdk_drag_context_manage_dnd() for more information.
*
* Returns:
*/
gboolean
@@ -461,7 +440,7 @@ gdk_drag_motion (GdkDragContext *context,
time_);
}
/**
/*
* gdk_drag_abort:
* @context: a #GdkDragContext
* @time_: the timestamp for this operation
@@ -469,9 +448,6 @@ gdk_drag_motion (GdkDragContext *context,
* Aborts a drag without dropping.
*
* This function is called by the drag source.
*
* This function does not need to be called in managed drag and drop
* operations. See gdk_drag_context_manage_dnd() for more information.
*/
void
gdk_drag_abort (GdkDragContext *context,
@@ -482,7 +458,7 @@ gdk_drag_abort (GdkDragContext *context,
GDK_DRAG_CONTEXT_GET_CLASS (context)->drag_abort (context, time_);
}
/**
/*
* gdk_drag_drop:
* @context: a #GdkDragContext
* @time_: the timestamp for this operation
@@ -490,9 +466,6 @@ gdk_drag_abort (GdkDragContext *context,
* Drops on the current destination.
*
* This function is called by the drag source.
*
* This function does not need to be called in managed drag and drop
* operations. See gdk_drag_context_manage_dnd() for more information.
*/
void
gdk_drag_drop (GdkDragContext *context,

View File

@@ -80,34 +80,6 @@ typedef enum {
GDK_DRAG_CANCEL_ERROR
} GdkDragCancelReason;
/**
* GdkDragProtocol:
* @GDK_DRAG_PROTO_NONE: no protocol.
* @GDK_DRAG_PROTO_MOTIF: The Motif DND protocol. No longer supported
* @GDK_DRAG_PROTO_XDND: The Xdnd protocol.
* @GDK_DRAG_PROTO_ROOTWIN: An extension to the Xdnd protocol for
* unclaimed root window drops.
* @GDK_DRAG_PROTO_WIN32_DROPFILES: The simple WM_DROPFILES protocol.
* @GDK_DRAG_PROTO_OLE2: The complex OLE2 DND protocol (not implemented).
* @GDK_DRAG_PROTO_LOCAL: Intra-application DND.
* @GDK_DRAG_PROTO_WAYLAND: Wayland DND protocol.
*
* Used in #GdkDragContext to indicate the protocol according to
* which DND is done.
*/
typedef enum
{
GDK_DRAG_PROTO_NONE = 0,
GDK_DRAG_PROTO_MOTIF,
GDK_DRAG_PROTO_XDND,
GDK_DRAG_PROTO_ROOTWIN,
GDK_DRAG_PROTO_WIN32_DROPFILES,
GDK_DRAG_PROTO_OLE2,
GDK_DRAG_PROTO_LOCAL,
GDK_DRAG_PROTO_WAYLAND
} GdkDragProtocol;
GDK_AVAILABLE_IN_ALL
GType gdk_drag_context_get_type (void) G_GNUC_CONST;
@@ -130,11 +102,8 @@ GDK_AVAILABLE_IN_ALL
GdkWindow *gdk_drag_context_get_source_window (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkWindow *gdk_drag_context_get_dest_window (GdkDragContext *context);
GDK_AVAILABLE_IN_ALL
GdkDragProtocol gdk_drag_context_get_protocol (GdkDragContext *context);
/* Destination side */
GDK_AVAILABLE_IN_ALL
void gdk_drag_status (GdkDragContext *context,
GdkDragAction action,
@@ -168,30 +137,6 @@ GdkDragContext * gdk_drag_begin_from_point (GdkWindow *window,
gint y_root);
GDK_AVAILABLE_IN_ALL
void gdk_drag_find_window_for_screen (GdkDragContext *context,
GdkWindow *drag_window,
GdkScreen *screen,
gint x_root,
gint y_root,
GdkWindow **dest_window,
GdkDragProtocol *protocol);
GDK_AVAILABLE_IN_ALL
gboolean gdk_drag_motion (GdkDragContext *context,
GdkWindow *dest_window,
GdkDragProtocol protocol,
gint x_root,
gint y_root,
GdkDragAction suggested_action,
GdkDragAction possible_actions,
guint32 time_);
GDK_AVAILABLE_IN_ALL
void gdk_drag_drop (GdkDragContext *context,
guint32 time_);
GDK_AVAILABLE_IN_ALL
void gdk_drag_abort (GdkDragContext *context,
guint32 time_);
GDK_AVAILABLE_IN_ALL
gboolean gdk_drag_drop_succeeded (GdkDragContext *context);
GDK_AVAILABLE_IN_3_20

View File

@@ -23,6 +23,33 @@
G_BEGIN_DECLS
/*
* GdkDragProtocol:
* @GDK_DRAG_PROTO_NONE: no protocol.
* @GDK_DRAG_PROTO_MOTIF: The Motif DND protocol. No longer supported
* @GDK_DRAG_PROTO_XDND: The Xdnd protocol.
* @GDK_DRAG_PROTO_ROOTWIN: An extension to the Xdnd protocol for
* unclaimed root window drops.
* @GDK_DRAG_PROTO_WIN32_DROPFILES: The simple WM_DROPFILES protocol.
* @GDK_DRAG_PROTO_OLE2: The complex OLE2 DND protocol (not implemented).
* @GDK_DRAG_PROTO_LOCAL: Intra-application DND.
* @GDK_DRAG_PROTO_WAYLAND: Wayland DND protocol.
*
* Used in #GdkDragContext to indicate the protocol according to
* which DND is done.
*/
typedef enum
{
GDK_DRAG_PROTO_NONE = 0,
GDK_DRAG_PROTO_MOTIF,
GDK_DRAG_PROTO_XDND,
GDK_DRAG_PROTO_ROOTWIN,
GDK_DRAG_PROTO_WIN32_DROPFILES,
GDK_DRAG_PROTO_OLE2,
GDK_DRAG_PROTO_LOCAL,
GDK_DRAG_PROTO_WAYLAND
} GdkDragProtocol;
#define GDK_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
#define GDK_IS_DRAG_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_DRAG_CONTEXT))
#define GDK_DRAG_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_DRAG_CONTEXT, GdkDragContextClass))
@@ -124,6 +151,29 @@ gboolean gdk_drag_context_handle_dest_event (GdkEvent *event);
GdkCursor * gdk_drag_get_cursor (GdkDragContext *context,
GdkDragAction action);
gboolean gdk_drag_motion (GdkDragContext *context,
GdkWindow *dest_window,
GdkDragProtocol protocol,
gint x_root,
gint y_root,
GdkDragAction suggested_action,
GdkDragAction possible_actions,
guint32 time_);
void gdk_drag_abort (GdkDragContext *context,
guint32 time_);
void gdk_drag_drop (GdkDragContext *context,
guint32 time_);
void gdk_drag_find_window_for_screen (GdkDragContext *context,
GdkWindow *drag_window,
GdkScreen *screen,
gint x_root,
gint y_root,
GdkWindow **dest_window,
GdkDragProtocol *protocol);
G_END_DECLS
#endif

View File

@@ -31,6 +31,7 @@
#include "gdkwindowimpl.h"
#include "gdkdisplay.h"
#include "gdkprivate.h"
#include "gdkdndprivate.h"
G_BEGIN_DECLS

View File

@@ -7724,28 +7724,6 @@ gdk_window_register_dnd (GdkWindow *window)
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->register_dnd (window);
}
/**
* gdk_window_get_drag_protocol:
* @window: the destination window
* @target: (out) (allow-none) (transfer full): location of the window
* where the drop should happen. This may be @window or a proxy window,
* or %NULL if @window does not support Drag and Drop.
*
* Finds out the DND protocol supported by a window.
*
* Returns: the supported DND protocol.
*
* Since: 3.0
*/
GdkDragProtocol
gdk_window_get_drag_protocol (GdkWindow *window,
GdkWindow **target)
{
g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_DRAG_PROTO_NONE);
return GDK_WINDOW_IMPL_GET_CLASS (window->impl)->get_drag_protocol (window, target);
}
/**
* gdk_drag_begin:
* @window: the source window for this drag.

View File

@@ -800,11 +800,6 @@ void gdk_window_set_opacity (GdkWindow *window,
GDK_AVAILABLE_IN_ALL
void gdk_window_register_dnd (GdkWindow *window);
GDK_AVAILABLE_IN_ALL
GdkDragProtocol
gdk_window_get_drag_protocol(GdkWindow *window,
GdkWindow **target);
GDK_AVAILABLE_IN_ALL
void gdk_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,

View File

@@ -219,8 +219,6 @@ struct _GdkWindowImplClass
void (* set_opacity) (GdkWindow *window,
gdouble opacity);
void (* destroy_notify) (GdkWindow *window);
GdkDragProtocol (* get_drag_protocol) (GdkWindow *window,
GdkWindow **target);
void (* register_dnd) (GdkWindow *window);
GdkDragContext * (*drag_begin) (GdkWindow *window,
GdkDevice *device,

View File

@@ -486,12 +486,6 @@ gdk_wayland_drag_context_class_init (GdkWaylandDragContextClass *klass)
context_class->commit_drag_status = gdk_wayland_drag_context_commit_status;
}
GdkDragProtocol
_gdk_wayland_window_get_drag_protocol (GdkWindow *window, GdkWindow **target)
{
return GDK_DRAG_PROTO_WAYLAND;
}
void
_gdk_wayland_window_register_dnd (GdkWindow *window)
{

View File

@@ -101,8 +101,6 @@ void _gdk_wayland_cursor_set_scale (GdkCursor *cursor,
guint scale);
void gdk_wayland_window_sync (GdkWindow *window);
GdkDragProtocol _gdk_wayland_window_get_drag_protocol (GdkWindow *window,
GdkWindow **target);
void _gdk_wayland_window_register_dnd (GdkWindow *window);
GdkDragContext *_gdk_wayland_window_drag_begin (GdkWindow *window,

View File

@@ -3653,7 +3653,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
impl_class->begin_move_drag = gdk_wayland_window_begin_move_drag;
impl_class->set_opacity = gdk_wayland_window_set_opacity;
impl_class->destroy_notify = gdk_wayland_window_destroy_notify;
impl_class->get_drag_protocol = _gdk_wayland_window_get_drag_protocol;
impl_class->register_dnd = _gdk_wayland_window_register_dnd;
impl_class->drag_begin = _gdk_wayland_window_drag_begin;
impl_class->get_property = gdk_wayland_window_get_property;

View File

@@ -2396,7 +2396,30 @@ gdk_x11_drag_context_drag_drop (GdkDragContext *context,
break;
case GDK_DRAG_PROTO_ROOTWIN:
g_warning ("Drops for GDK_DRAG_PROTO_ROOTWIN must be handled internally");
{
GdkEvent *temp_event;
/* GTK+ traditionally has used application/x-rootwin-drop,
* but the XDND spec specifies x-rootwindow-drop.
*/
GdkAtom target1 = gdk_atom_intern_static_string ("application/x-rootwindow-drop");
GdkAtom target2 = gdk_atom_intern_static_string ("application/x-rootwin-drop");
if (g_list_find (context->targets, GDK_ATOM_TO_POINTER (target1)) ||
g_list_find (context->targets, GDK_ATOM_TO_POINTER (target2)))
{
temp_event = gdk_event_new (GDK_SELECTION_REQUEST);
temp_event->selection.window = g_object_ref (context->source_window);
temp_event->selection.send_event = FALSE;
temp_event->selection.selection = gdk_atom_intern_static_string ("XdndSelection");
temp_event->selection.target = target1;
temp_event->selection.property = GDK_NONE;
temp_event->selection.requestor = g_object_ref (context->source_window);
gdk_event_set_device (temp_event, gdk_drag_context_get_device (context));
gdk_event_put (temp_event);
gdk_event_free (temp_event);
}
}
break;
case GDK_DRAG_PROTO_NONE:
g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_drop()");
@@ -2855,6 +2878,7 @@ static void
gdk_x11_drag_context_drop_performed (GdkDragContext *context,
guint32 time_)
{
gdk_drag_drop (context, time_);
drag_context_ungrab (context);
}

View File

@@ -1250,32 +1250,6 @@ gdk_x11_window_destroy_notify (GdkWindow *window)
g_object_unref (window);
}
static GdkDragProtocol
gdk_x11_window_get_drag_protocol (GdkWindow *window,
GdkWindow **target)
{
GdkDragProtocol protocol;
GdkDisplay *display;
guint version;
Window xid;
display = gdk_window_get_display (window);
xid = _gdk_x11_display_get_drag_protocol (display,
GDK_WINDOW_XID (window->impl_window),
&protocol,
&version);
if (target)
{
if (xid != None)
*target = gdk_x11_window_foreign_new_for_display (display, xid);
else
*target = NULL;
}
return protocol;
}
static void
update_wm_hints (GdkWindow *window,
gboolean force)
@@ -5059,7 +5033,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
impl_class->begin_move_drag = gdk_x11_window_begin_move_drag;
impl_class->set_opacity = gdk_x11_window_set_opacity;
impl_class->destroy_notify = gdk_x11_window_destroy_notify;
impl_class->get_drag_protocol = gdk_x11_window_get_drag_protocol;
impl_class->register_dnd = _gdk_x11_window_register_dnd;
impl_class->drag_begin = _gdk_x11_window_drag_begin;
impl_class->get_property = _gdk_x11_window_get_property;

File diff suppressed because it is too large Load Diff

View File

@@ -52,8 +52,6 @@ void gtk_drag_set_icon_definition (GdkDragContext
GtkImageDefinition *def,
gint hot_x,
gint hot_y);
void _gtk_drag_source_handle_event (GtkWidget *widget,
GdkEvent *event);
void _gtk_drag_dest_handle_event (GtkWidget *toplevel,
GdkEvent *event);

View File

@@ -1846,7 +1846,8 @@ gtk_main_do_event (GdkEvent *event)
case GDK_DRAG_STATUS:
case GDK_DROP_FINISHED:
_gtk_drag_source_handle_event (event_widget, event);
g_warning ("These events are no longer handled by GTK+.\n"
"DND needs to be managed by the backend");
break;
case GDK_DRAG_ENTER:
case GDK_DRAG_LEAVE: