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,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,
......
......@@ -509,7 +509,7 @@ gtk_drag_get_event_actions (GdkEvent *event,
default:
break;
}
if ((button == 2 || button == 3) && (actions & GDK_ACTION_ASK))
{
*suggested_action = GDK_ACTION_ASK;
......@@ -1789,7 +1789,7 @@ gtk_drag_begin (GtkWidget *widget,
gtk_drag_get_event_actions (event, info->button, actions,
&suggested_action, &possible_actions);
info->cursor = gtk_drag_get_cursor (suggested_action);
/* Set cur_x, cur_y here so if the "drag_begin" signal shows
......@@ -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;
}
......@@ -2741,7 +2741,7 @@ gtk_drag_update (GtkDragSourceInfo *info,
gdk_drag_find_window (info->context,
window, x_root, y_root,
&dest_window, &protocol);
if (gdk_drag_motion (info->context, dest_window, protocol,
x_root, y_root, action,
possible_actions,
......
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