Commit 44c02fcb authored by Benjamin Otte's avatar Benjamin Otte

API: gdk: Change get_drag_window() API

The previous function gdk_drag_get_protocol_for_display() took native
window handles, so it had to be changed. Because it didn't do what it
was named to do (it didn't return a protocol even though it was named
get_protocol) and because it doesn't operate on the display anymore but
on the actual window, it's now called gdk_window_get_drag_protocol().
parent 92103476
......@@ -882,11 +882,11 @@ gdk_drag_begin
gdk_drag_begin_for_device
gdk_drag_motion
gdk_drop_finish
gdk_drag_get_protocol_for_display
GdkDragProtocol
GdkDragAction
gdk_drag_status
gdk_drag_drop_succeeded
gdk_window_get_drag_protocol
gdk_drag_context_get_actions
gdk_drag_context_get_suggested_action
......
......@@ -143,7 +143,6 @@ gdk_drag_context_set_device
gdk_drag_drop
gdk_drag_drop_succeeded
gdk_drag_find_window_for_screen
gdk_drag_get_protocol_for_display
gdk_drag_get_selection
gdk_drag_motion
gdk_drag_protocol_get_type G_GNUC_CONST
......@@ -390,6 +389,7 @@ gdk_window_get_device_cursor
gdk_window_get_device_events
gdk_window_get_device_position
gdk_window_get_display
gdk_window_get_drag_protocol
gdk_window_get_effective_parent
gdk_window_get_effective_toplevel
gdk_window_get_events
......
......@@ -1663,28 +1663,6 @@ gdk_display_get_app_launch_context (GdkDisplay *display)
return GDK_DISPLAY_GET_CLASS(display)->get_app_launch_context (display);
}
/**
* gdk_drag_get_protocol_for_display:
* @display: the #GdkDisplay where the destination window resides
* @xid: the windowing system id of the destination window.
* @protocol: (out): location where the supported DND protocol is returned.
*
* Finds out the DND protocol supported by a window.
*
* Return value: the windowing system id of the window where the drop
* should happen. This may be @xid or the id of a proxy window,
* or zero if @xid does not support Drag and Drop.
*
* Since: 2.2
*/
GdkNativeWindow
gdk_drag_get_protocol_for_display (GdkDisplay *display,
GdkNativeWindow xid,
GdkDragProtocol *protocol)
{
return GDK_DISPLAY_GET_CLASS (display)->get_drag_protocol (display, xid, protocol, NULL);
}
/**
* gdk_display_open:
* @display_name: the name of the display to open
......
......@@ -164,10 +164,6 @@ struct _GdkDisplayClass
GList * (*list_devices) (GdkDisplay *display);
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);
GdkNativeWindow (*get_drag_protocol) (GdkDisplay *display,
GdkNativeWindow winid,
GdkDragProtocol *protocol,
guint *version);
void (*before_process_all_updates) (GdkDisplay *display);
void (*after_process_all_updates) (GdkDisplay *display);
......
......@@ -128,10 +128,6 @@ GdkDragContext * gdk_drag_begin_for_device (GdkWindow *window,
GdkDevice *device,
GList *targets);
GdkNativeWindow gdk_drag_get_protocol_for_display (GdkDisplay *display,
GdkNativeWindow xid,
GdkDragProtocol *protocol);
void gdk_drag_find_window_for_screen (GdkDragContext *context,
GdkWindow *drag_window,
GdkScreen *screen,
......
......@@ -10657,6 +10657,28 @@ 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.
......
......@@ -780,6 +780,10 @@ void gdk_window_set_opacity (GdkWindow *window,
gdouble opacity);
void gdk_window_register_dnd (GdkWindow *window);
GdkDragProtocol
gdk_window_get_drag_protocol(GdkWindow *window,
GdkWindow **target);
void gdk_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
gint button,
......
......@@ -248,6 +248,8 @@ struct _GdkWindowImplClass
void (* set_composited) (GdkWindow *window,
gboolean composited);
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,
......
......@@ -2556,13 +2556,6 @@ gdk_x11_display_error_trap_pop_ignored (GdkDisplay *display)
gdk_x11_display_error_trap_pop_internal (display, FALSE);
}
extern GdkAppLaunchContext *_gdk_x11_display_get_app_launch_context (GdkDisplay *display);
extern GdkNativeWindow _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
GdkNativeWindow xid,
GdkDragProtocol *protocol,
guint *version);
/**
* gdk_x11_set_sm_client_id:
* @sm_client_id: the client id assigned by the session manager when the
......@@ -2665,7 +2658,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->supports_composite = gdk_x11_display_supports_composite;
display_class->list_devices = gdk_x11_display_list_devices;
display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context;
display_class->get_drag_protocol = _gdk_x11_display_get_drag_protocol;
display_class->get_cursor_for_type = _gdk_x11_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_x11_display_get_cursor_for_name;
display_class->get_cursor_for_pixbuf = _gdk_x11_display_get_cursor_for_pixbuf;
......
......@@ -182,6 +182,12 @@ void _gdk_x11_display_update_grab_info_ungrab (GdkDisplay *display,
void _gdk_x11_display_queue_events (GdkDisplay *display);
GdkAppLaunchContext *_gdk_x11_display_get_app_launch_context (GdkDisplay *display);
GdkNativeWindow _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
GdkNativeWindow xid,
GdkDragProtocol *protocol,
guint *version);
gboolean _gdk_x11_display_set_selection_owner (GdkDisplay *display,
GdkWindow *owner,
GdkAtom selection,
......
......@@ -1108,6 +1108,32 @@ 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)
......@@ -4779,6 +4805,7 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
impl_class->set_opacity = gdk_x11_window_set_opacity;
impl_class->set_composited = gdk_x11_window_set_composited;
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->process_updates_recurse = gdk_x11_window_process_updates_recurse;
......
......@@ -1112,7 +1112,8 @@ gtk_socket_add_window (GtkSocket *socket,
private->need_map = private->is_mapped;
if (gdk_drag_get_protocol_for_display (display, xid, &protocol))
protocol = gdk_window_get_drag_protocol (private->plug_window, NULL);
if (protocol)
gtk_drag_dest_set_proxy (GTK_WIDGET (socket), private->plug_window,
protocol, TRUE);
......@@ -1524,9 +1525,8 @@ gtk_socket_filter_func (GdkXEvent *gdk_xevent,
(xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (display, "_MOTIF_DRAG_RECEIVER_INFO")))
{
gdk_error_trap_push ();
if (gdk_drag_get_protocol_for_display (display,
xevent->xproperty.window,
&protocol))
protocol = gdk_window_get_drag_protocol (private->plug_window, NULL);
if (protocol)
gtk_drag_dest_set_proxy (GTK_WIDGET (socket),
private->plug_window,
protocol, TRUE);
......
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