New function for getting toplevel window at position.
2001-05-07 Alexander Larsson <alexl@redhat.com> * gdk/linux-fb/gdkdnd-fb.c (get_toplevel_window_at): New function for getting toplevel window at position. (gdk_drag_find_window): Use get_toplevel_window () instead of gdk_window_get_pointer(). (gdk_drag_status): Use correct context for getting window. * gdk/linux-fb/gdkproperty-fb.c (gdk_atom_name): g_strdup the atom name. * gdk/linux-fb/gdkwindow-fb.c: Costmetic fix. * gtk/gtkdnd.c (gtk_drag_source_handle_event): Add code for changing cursor on linux-fb backend (same as win32).
This commit is contained in:
committed by
Alexander Larsson
parent
b19d0812ef
commit
404d1a2d7e
@ -63,7 +63,7 @@ GdkDragContext *current_dest_drag = NULL;
|
||||
static void
|
||||
gdk_drag_context_init (GdkDragContext *dragcontext)
|
||||
{
|
||||
dragcontext->windowing_data = g_new (GdkDragContextPrivate, 1);
|
||||
dragcontext->windowing_data = g_new0 (GdkDragContextPrivate, 1);
|
||||
|
||||
contexts = g_list_prepend (contexts, dragcontext);
|
||||
}
|
||||
@ -395,6 +395,54 @@ gdk_drag_get_protocol (guint32 xid,
|
||||
return GDK_NONE;
|
||||
}
|
||||
|
||||
static GdkWindow *
|
||||
get_toplevel_window_at (GdkWindow *ignore,
|
||||
gint x_root,
|
||||
gint y_root)
|
||||
{
|
||||
|
||||
GdkWindowObject *private;
|
||||
GdkWindowObject *sub;
|
||||
GdkWindowObject *child;
|
||||
GList *ltmp, *ltmp2;
|
||||
|
||||
private = (GdkWindowObject *)gdk_parent_root;
|
||||
|
||||
for (ltmp = private->children; ltmp; ltmp = ltmp->next)
|
||||
{
|
||||
sub = ltmp->data;
|
||||
|
||||
if ((GDK_WINDOW (sub) != ignore) &&
|
||||
(GDK_WINDOW_IS_MAPPED (sub)) &&
|
||||
(x_root >= sub->x) &&
|
||||
(x_root < sub->x + GDK_DRAWABLE_IMPL_FBDATA (sub)->width) &&
|
||||
(y_root >= sub->y) &&
|
||||
(y_root < sub->y + GDK_DRAWABLE_IMPL_FBDATA (sub)->height))
|
||||
{
|
||||
if (g_object_get_data (G_OBJECT (sub), "gdk-window-child-handler"))
|
||||
{
|
||||
/* Managed window, check children */
|
||||
for (ltmp2 = sub->children; ltmp2; ltmp2 = ltmp2->next)
|
||||
{
|
||||
child = ltmp2->data;
|
||||
|
||||
if ((GDK_WINDOW (child) != ignore) &&
|
||||
(GDK_WINDOW_IS_MAPPED (child)) &&
|
||||
(x_root >= sub->x + child->x) &&
|
||||
(x_root < sub->x + child->x + GDK_DRAWABLE_IMPL_FBDATA (child)->width) &&
|
||||
(y_root >= sub->y + child->y) &&
|
||||
(y_root < sub->y + child->y + GDK_DRAWABLE_IMPL_FBDATA (child)->height))
|
||||
return GDK_WINDOW (child);
|
||||
}
|
||||
}
|
||||
else
|
||||
return GDK_WINDOW (sub);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gdk_drag_find_window (GdkDragContext *context,
|
||||
GdkWindow *drag_window,
|
||||
@ -407,8 +455,10 @@ gdk_drag_find_window (GdkDragContext *context,
|
||||
|
||||
g_return_if_fail (context != NULL);
|
||||
|
||||
dest = gdk_window_get_pointer (NULL, &x_root, &y_root, NULL);
|
||||
|
||||
dest = get_toplevel_window_at (drag_window, x_root, y_root);
|
||||
if (dest == NULL)
|
||||
dest = gdk_parent_root;
|
||||
|
||||
if (context->dest_window != dest)
|
||||
{
|
||||
guint32 recipient;
|
||||
@ -589,13 +639,13 @@ gdk_drag_status (GdkDragContext *context,
|
||||
private->drag_status = GDK_DRAG_STATUS_DRAG;
|
||||
|
||||
tmp_event.dnd.type = GDK_DRAG_STATUS;
|
||||
tmp_event.dnd.window = src_context->source_window;
|
||||
tmp_event.dnd.window = context->source_window;
|
||||
tmp_event.dnd.send_event = FALSE;
|
||||
tmp_event.dnd.context = src_context;
|
||||
gdk_drag_context_ref (src_context);
|
||||
|
||||
tmp_event.dnd.time = GDK_CURRENT_TIME; /* FIXME? */
|
||||
|
||||
|
||||
src_context->action = action;
|
||||
|
||||
gdk_event_put (&tmp_event);
|
||||
|
||||
@ -44,7 +44,7 @@ gdk_atom_intern (const gchar *atom_name,
|
||||
gchar*
|
||||
gdk_atom_name (GdkAtom atom)
|
||||
{
|
||||
return g_quark_to_string (atom);
|
||||
return g_strdup (g_quark_to_string (atom));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -1586,7 +1586,7 @@ gdk_window_fb_get_visible_region (GdkDrawable *drawable)
|
||||
return gdk_region_rectangle (&result_rect);
|
||||
}
|
||||
|
||||
GdkWindow*
|
||||
GdkWindow *
|
||||
gdk_window_get_pointer (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
|
||||
Reference in New Issue
Block a user