Commit 404d1a2d authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

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).
parent b19d0812
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).
2001-05-07 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus): Test for bin->child being
......
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).
2001-05-07 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus): Test for bin->child being
......
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).
2001-05-07 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus): Test for bin->child being
......
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).
2001-05-07 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus): Test for bin->child being
......
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).
2001-05-07 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus): Test for bin->child being
......
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).
2001-05-07 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus): Test for bin->child being
......
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).
2001-05-07 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkwindow.c (gtk_window_focus): Test for bin->child being
......
......@@ -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,7 +455,9 @@ 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)
{
......@@ -589,7 +639,7 @@ 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);
......
......@@ -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,
......
......@@ -2242,13 +2242,13 @@ gtk_drag_source_handle_event (GtkWidget *widget,
PointerMotionMask | PointerMotionHintMask | ButtonReleaseMask,
((GdkCursorPrivate *)cursor)->xcursor,
event->dnd.time);
#elif defined (GDK_WINDOWING_WIN32)
#elif defined (GDK_WINDOWING_WIN32) || defined (GDK_WINDOWING_FB)
gdk_pointer_grab (widget->window, FALSE,
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL,
info->cursor, event->dnd.time);
cursor, event->dnd.time);
#endif
info->cursor = cursor;
}
......
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