forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
c97e2af23b
commit
f8cad19829
@ -898,7 +898,7 @@ gdk_drag_abort
|
||||
gdk_drop_reply
|
||||
gdk_drag_drop
|
||||
gdk_drag_drop_done
|
||||
gdk_drag_find_window_for_screen
|
||||
gdk_drag_find_window
|
||||
gdk_drag_begin
|
||||
gdk_drag_begin_for_device
|
||||
gdk_drag_begin_from_point
|
||||
|
@ -113,7 +113,6 @@ _gdk_broadway_window_get_drag_protocol (GdkWindow *window,
|
||||
static GdkWindow *
|
||||
gdk_broadway_drag_context_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
GdkScreen *screen,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol)
|
||||
|
18
gdk/gdkdnd.c
18
gdk/gdkdnd.c
@ -362,11 +362,10 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_find_window_for_screen:
|
||||
* gdk_drag_find_window:
|
||||
* @context: a #GdkDragContext
|
||||
* @drag_window: a window which may be at the pointer position, but
|
||||
* should be ignored, since it is put up by the drag source as an icon
|
||||
* @screen: the screen where the destination window is sought
|
||||
* @x_root: the x position of the pointer in root coordinates
|
||||
* @y_root: the y position of the pointer in root coordinates
|
||||
* @dest_window: (out): location to store the destination window in
|
||||
@ -381,18 +380,17 @@ gdk_drag_context_class_init (GdkDragContextClass *klass)
|
||||
* Since: 2.2
|
||||
*/
|
||||
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_drag_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkWindow **dest_window,
|
||||
GdkDragProtocol *protocol)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
|
||||
*dest_window = GDK_DRAG_CONTEXT_GET_CLASS (context)
|
||||
->find_window (context, drag_window, screen, x_root, y_root, protocol);
|
||||
->find_window (context, drag_window, x_root, y_root, protocol);
|
||||
}
|
||||
|
||||
/**
|
||||
|
13
gdk/gdkdnd.h
13
gdk/gdkdnd.h
@ -168,13 +168,12 @@ 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);
|
||||
void gdk_drag_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkWindow **dest_window,
|
||||
GdkDragProtocol *protocol);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_drag_motion (GdkDragContext *context,
|
||||
|
@ -35,7 +35,6 @@ struct _GdkDragContextClass {
|
||||
|
||||
GdkWindow * (*find_window) (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
GdkScreen *screen,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol);
|
||||
|
@ -74,7 +74,6 @@ gdk_quartz_drag_context_drag_motion (GdkDragContext *context,
|
||||
static GdkWindow *
|
||||
gdk_quartz_drag_context_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
GdkScreen *screen,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol)
|
||||
|
@ -140,7 +140,6 @@ _gdk_wayland_drag_context_emit_event (GdkDragContext *context,
|
||||
static GdkWindow *
|
||||
gdk_wayland_drag_context_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
GdkScreen *screen,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol)
|
||||
|
@ -2013,7 +2013,6 @@ find_window_enum_proc (HWND hwnd,
|
||||
static GdkWindow *
|
||||
gdk_win32_drag_context_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
GdkScreen *screen,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol)
|
||||
@ -2039,7 +2038,7 @@ gdk_win32_drag_context_find_window (GdkDragContext *context,
|
||||
g_object_ref (dest_window);
|
||||
}
|
||||
else
|
||||
dest_window = gdk_win32_window_foreign_new_for_display (gdk_screen_get_display (screen), a.result);
|
||||
dest_window = gdk_win32_window_foreign_new_for_display (context->display, a.result);
|
||||
|
||||
if (use_ole2_dnd)
|
||||
*protocol = GDK_DRAG_PROTO_OLE2;
|
||||
|
@ -65,7 +65,7 @@ typedef struct {
|
||||
GList *children;
|
||||
GHashTable *child_hash;
|
||||
guint old_event_mask;
|
||||
GdkScreen *screen;
|
||||
GdkDisplay *display;
|
||||
gint ref_count;
|
||||
} GdkWindowCache;
|
||||
|
||||
@ -83,7 +83,7 @@ struct _GdkX11DragContext
|
||||
GdkDragAction xdnd_actions; /* What is currently set in XdndActionList */
|
||||
guint version; /* Xdnd protocol version */
|
||||
|
||||
GSList *window_caches;
|
||||
GdkWindowCache *cache;
|
||||
|
||||
GdkWindow *drag_window;
|
||||
|
||||
@ -141,7 +141,7 @@ static GrabKey grab_keys[] = {
|
||||
|
||||
/* Forward declarations */
|
||||
|
||||
static GdkWindowCache *gdk_window_cache_get (GdkScreen *screen);
|
||||
static GdkWindowCache *gdk_window_cache_get (GdkDisplay *display);
|
||||
static GdkWindowCache *gdk_window_cache_ref (GdkWindowCache *cache);
|
||||
static void gdk_window_cache_unref (GdkWindowCache *cache);
|
||||
|
||||
@ -200,7 +200,6 @@ gdk_x11_drag_context_init (GdkX11DragContext *context)
|
||||
static void gdk_x11_drag_context_finalize (GObject *object);
|
||||
static GdkWindow * gdk_x11_drag_context_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
GdkScreen *screen,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol);
|
||||
@ -284,8 +283,8 @@ gdk_x11_drag_context_finalize (GObject *object)
|
||||
xdnd_manage_source_filter (context, context->source_window, FALSE);
|
||||
}
|
||||
|
||||
g_slist_free_full (x11_context->window_caches, (GDestroyNotify)gdk_window_cache_unref);
|
||||
x11_context->window_caches = NULL;
|
||||
if (x11_context->cache)
|
||||
gdk_window_cache_unref (x11_context->cache);
|
||||
|
||||
contexts = g_list_remove (contexts, context);
|
||||
|
||||
@ -411,7 +410,7 @@ gdk_window_cache_shape_filter (GdkXEvent *xev,
|
||||
XEvent *xevent = (XEvent *)xev;
|
||||
GdkWindowCache *cache = data;
|
||||
|
||||
GdkX11Display *display = GDK_X11_DISPLAY (gdk_screen_get_display (cache->screen));
|
||||
GdkX11Display *display = GDK_X11_DISPLAY (cache->display);
|
||||
|
||||
if (display->have_shapes &&
|
||||
xevent->type == display->shape_event_base + ShapeNotify)
|
||||
@ -560,9 +559,10 @@ gdk_window_cache_filter (GdkXEvent *xev,
|
||||
}
|
||||
|
||||
static GdkWindowCache *
|
||||
gdk_window_cache_new (GdkScreen *screen)
|
||||
gdk_window_cache_new (GdkDisplay *display)
|
||||
{
|
||||
XWindowAttributes xwa;
|
||||
GdkScreen *screen = gdk_display_get_default_screen (display);
|
||||
Display *xdisplay = GDK_SCREEN_XDISPLAY (screen);
|
||||
GdkWindow *root_window = gdk_screen_get_root_window (screen);
|
||||
GdkChildInfoX11 *children;
|
||||
@ -575,7 +575,7 @@ gdk_window_cache_new (GdkScreen *screen)
|
||||
|
||||
result->children = NULL;
|
||||
result->child_hash = g_hash_table_new (g_direct_hash, NULL);
|
||||
result->screen = screen;
|
||||
result->display = display;
|
||||
result->ref_count = 1;
|
||||
|
||||
XGetWindowAttributes (xdisplay, GDK_WINDOW_XID (root_window), &xwa);
|
||||
@ -649,8 +649,7 @@ gdk_window_cache_new (GdkScreen *screen)
|
||||
static void
|
||||
gdk_window_cache_destroy (GdkWindowCache *cache)
|
||||
{
|
||||
GdkWindow *root_window = gdk_screen_get_root_window (cache->screen);
|
||||
GdkDisplay *display;
|
||||
GdkWindow *root_window = gdk_screen_get_root_window (gdk_display_get_default_screen (cache->display));
|
||||
|
||||
XSelectInput (GDK_WINDOW_XDISPLAY (root_window),
|
||||
GDK_WINDOW_XID (root_window),
|
||||
@ -658,11 +657,9 @@ gdk_window_cache_destroy (GdkWindowCache *cache)
|
||||
gdk_window_remove_filter (root_window, gdk_window_cache_filter, cache);
|
||||
gdk_window_remove_filter (NULL, gdk_window_cache_shape_filter, cache);
|
||||
|
||||
display = gdk_screen_get_display (cache->screen);
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
g_list_foreach (cache->children, (GFunc)free_cache_child, display);
|
||||
gdk_x11_display_error_trap_pop_ignored (display);
|
||||
gdk_x11_display_error_trap_push (cache->display);
|
||||
g_list_foreach (cache->children, (GFunc)free_cache_child, cache->display);
|
||||
gdk_x11_display_error_trap_pop_ignored (cache->display);
|
||||
|
||||
g_list_free (cache->children);
|
||||
g_hash_table_destroy (cache->child_hash);
|
||||
@ -693,7 +690,7 @@ gdk_window_cache_unref (GdkWindowCache *cache)
|
||||
}
|
||||
|
||||
GdkWindowCache *
|
||||
gdk_window_cache_get (GdkScreen *screen)
|
||||
gdk_window_cache_get (GdkDisplay *display)
|
||||
{
|
||||
GSList *list;
|
||||
GdkWindowCache *cache;
|
||||
@ -701,11 +698,11 @@ gdk_window_cache_get (GdkScreen *screen)
|
||||
for (list = window_caches; list; list = list->next)
|
||||
{
|
||||
cache = list->data;
|
||||
if (cache->screen == screen)
|
||||
if (cache->display == display)
|
||||
return gdk_window_cache_ref (cache);
|
||||
}
|
||||
|
||||
cache = gdk_window_cache_new (screen);
|
||||
cache = gdk_window_cache_new (display);
|
||||
|
||||
window_caches = g_slist_prepend (window_caches, cache);
|
||||
|
||||
@ -822,7 +819,7 @@ get_client_window_at_coords (GdkWindowCache *cache,
|
||||
Window retval = None;
|
||||
GdkDisplay *display;
|
||||
|
||||
display = gdk_screen_get_display (cache->screen);
|
||||
display = cache->display;
|
||||
|
||||
gdk_x11_display_error_trap_push (display);
|
||||
|
||||
@ -861,7 +858,7 @@ get_client_window_at_coords (GdkWindowCache *cache,
|
||||
if (retval)
|
||||
return retval;
|
||||
else
|
||||
return GDK_WINDOW_XID (gdk_screen_get_root_window (cache->screen));
|
||||
return GDK_WINDOW_XID (gdk_screen_get_root_window (gdk_display_get_default_screen (cache->display)));
|
||||
}
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
@ -2099,33 +2096,22 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
|
||||
|
||||
static GdkWindowCache *
|
||||
drag_context_find_window_cache (GdkX11DragContext *context_x11,
|
||||
GdkScreen *screen)
|
||||
GdkDisplay *display)
|
||||
{
|
||||
GSList *list;
|
||||
GdkWindowCache *cache;
|
||||
if (!context_x11->cache)
|
||||
context_x11->cache = gdk_window_cache_get (display);
|
||||
|
||||
for (list = context_x11->window_caches; list; list = list->next)
|
||||
{
|
||||
cache = list->data;
|
||||
if (cache->screen == screen)
|
||||
return cache;
|
||||
}
|
||||
|
||||
cache = gdk_window_cache_get (screen);
|
||||
context_x11->window_caches = g_slist_prepend (context_x11->window_caches, cache);
|
||||
|
||||
return cache;
|
||||
return context_x11->cache;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
gdk_x11_drag_context_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
GdkScreen *screen,
|
||||
gint x_root,
|
||||
gint y_root,
|
||||
GdkDragProtocol *protocol)
|
||||
{
|
||||
GdkX11Screen *screen_x11 = GDK_X11_SCREEN(screen);
|
||||
GdkX11Screen *screen_x11 = GDK_X11_SCREEN(gdk_display_get_default_screen (context->display));
|
||||
GdkX11DragContext *context_x11 = GDK_X11_DRAG_CONTEXT (context);
|
||||
GdkWindowCache *window_cache;
|
||||
GdkDisplay *display;
|
||||
@ -2134,7 +2120,7 @@ gdk_x11_drag_context_find_window (GdkDragContext *context,
|
||||
|
||||
display = GDK_WINDOW_DISPLAY (context->source_window);
|
||||
|
||||
window_cache = drag_context_find_window_cache (context_x11, screen);
|
||||
window_cache = drag_context_find_window_cache (context_x11, display);
|
||||
|
||||
dest = get_client_window_at_coords (window_cache,
|
||||
drag_window && GDK_WINDOW_IS_X11 (drag_window) ?
|
||||
@ -2215,10 +2201,10 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context,
|
||||
{
|
||||
/* This ugly hack is necessary since GTK+ doesn't know about
|
||||
* the XDND protocol version, and in particular doesn't know
|
||||
* that gdk_drag_find_window_for_screen() has the side-effect
|
||||
* that gdk_drag_find_window() has the side-effect
|
||||
* of setting context_x11->version, and therefore sometimes call
|
||||
* gdk_drag_motion() without a prior call to
|
||||
* gdk_drag_find_window_for_screen(). This happens, e.g.
|
||||
* gdk_drag_find_window(). This happens, e.g.
|
||||
* when GTK+ is proxying DND events to embedded windows.
|
||||
*/
|
||||
if (dest_window)
|
||||
@ -2955,10 +2941,9 @@ gdk_drag_update (GdkDragContext *context,
|
||||
gdk_drag_get_current_actions (mods, GDK_BUTTON_PRIMARY, x11_context->actions,
|
||||
&action, &possible_actions);
|
||||
|
||||
gdk_drag_find_window_for_screen (context,
|
||||
x11_context->drag_window,
|
||||
gdk_display_get_default_screen (gdk_display_get_default ()),
|
||||
x_root, y_root, &dest_window, &protocol);
|
||||
gdk_drag_find_window (context,
|
||||
x11_context->drag_window,
|
||||
x_root, y_root, &dest_window, &protocol);
|
||||
|
||||
gdk_drag_motion (context, dest_window, protocol, x_root, y_root,
|
||||
action, possible_actions, evtime);
|
||||
|
10
gtk/gtkdnd.c
10
gtk/gtkdnd.c
@ -2077,15 +2077,15 @@ gtk_drag_update_idle (gpointer data)
|
||||
{
|
||||
time = gdk_event_get_time (info->last_event);
|
||||
gtk_drag_get_event_actions (info->last_event,
|
||||
info->button,
|
||||
info->button,
|
||||
info->possible_actions,
|
||||
&action, &possible_actions);
|
||||
|
||||
gtk_drag_update_icon_window (info);
|
||||
gdk_drag_find_window_for_screen (info->context,
|
||||
info->icon_window ? gtk_widget_get_window (info->icon_window) : NULL,
|
||||
info->cur_screen, info->cur_x, info->cur_y,
|
||||
&dest_window, &protocol);
|
||||
gdk_drag_find_window (info->context,
|
||||
info->icon_window ? gtk_widget_get_window (info->icon_window) : NULL,
|
||||
info->cur_x, info->cur_y,
|
||||
&dest_window, &protocol);
|
||||
|
||||
if (!gdk_drag_motion (info->context, dest_window, protocol,
|
||||
info->cur_x, info->cur_y, action,
|
||||
|
Loading…
Reference in New Issue
Block a user