Commit e5561940 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Move the grabs up earlier, so we don't get a big pile of uncompressed

Sat Jul  5 00:49:32 2003  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkdnd.c (gtk_drag_begin): Move the grabs up
        earlier, so we don't get a big pile of uncompressed
        motion events before the grab takes effect.

        * gtk/gtkdnd.c (gtk_drag_update_icon): Call
        gdk_window_process_all_updates() so that the area
        we are dragging over gets a change to redraw.

        * gtk/gtkdnd.c (_gtk_drag_dest_handle_event): Use
        gdk_window_get_position(), not gdk_window_get_origin().

        * gdk/x11/gdkwindow-x11.[ch] (gdk_window_have_shape_ext)
        gdkdisplay-x11.h: use XShapeQueryExtension to
        avoid duplicate XQueryExtension when we actually
        use it. Remove unnecessary caching in GdkDisplayX11.
parent 58a7f9f7
......@@ -180,7 +180,6 @@ gdk_display_open (const gchar *display_name)
10, 10, 10, 10, 0, 0, 0);
display_x11->leader_window_title_set = FALSE;
display_x11->have_shape = GDK_UNKNOWN;
display_x11->gravity_works = GDK_UNKNOWN;
display_x11->have_render = GDK_UNKNOWN;
......
......@@ -77,7 +77,6 @@ struct _GdkDisplayX11
gboolean use_xshm;
gboolean have_shm_pixmaps;
GdkTristate have_shape;
GdkTristate gravity_works;
GdkTristate have_render;
......
......@@ -3033,22 +3033,14 @@ gdk_window_add_colormap_windows (GdkWindow *window)
static gboolean
gdk_window_have_shape_ext (GdkDisplay *display)
{
GdkDisplayX11 *display_x11;
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
#ifdef HAVE_SHAPE_EXT
int ignore;
display_x11 = GDK_DISPLAY_X11 (display);
if (display_x11->have_shape == GDK_UNKNOWN)
{
int ignore;
if (XQueryExtension (display_x11->xdisplay, "SHAPE", &ignore, &ignore, &ignore))
display_x11->have_shape = GDK_YES;
else
display_x11->have_shape = GDK_NO;
}
return (display_x11->have_shape == GDK_YES);
return XShapeQueryExtension (GDK_DISPLAY_XDISPLAY (display),
&ignore, &ignore);
#else
return 0;
#endif
}
#define WARN_SHAPE_TOO_BIG() g_warning ("GdkWindow is too large to allow the use of shape masks or shape regions.")
......
......@@ -1077,7 +1077,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel,
}
}
gdk_window_get_origin (toplevel->window, &tx, &ty);
gdk_window_get_position (toplevel->window, &tx, &ty);
data.x = event->dnd.x_root - tx;
data.y = event->dnd.y_root - ty;
......@@ -1838,14 +1838,42 @@ gtk_drag_begin (GtkWidget *widget,
GdkDragAction possible_actions, suggested_action;
GdkDragContext *context;
GtkWidget *ipc_widget;
GdkCursor *cursor;
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
g_return_val_if_fail (target_list != NULL, NULL);
ipc_widget = gtk_drag_get_ipc_widget (gtk_widget_get_screen (widget));
gtk_drag_get_event_actions (event, button, actions,
&suggested_action, &possible_actions);
cursor = gtk_drag_get_cursor (gtk_widget_get_display (widget), suggested_action);
if (event)
time = gdk_event_get_time (event);
if (gdk_pointer_grab (ipc_widget->window, FALSE,
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_RELEASE_MASK, NULL,
cursor, time) != 0)
{
gtk_drag_release_ipc_widget (ipc_widget);
return NULL;
}
if (gdk_keyboard_grab (ipc_widget->window, FALSE, time) != 0)
{
gtk_drag_release_ipc_widget (ipc_widget);
return NULL;
}
/* We use a GTK grab here to override any grabs that the widget
* we are dragging from might have held
*/
gtk_grab_add (ipc_widget);
tmp_list = g_list_last (target_list->list);
while (tmp_list)
{
......@@ -1855,7 +1883,6 @@ gtk_drag_begin (GtkWidget *widget,
tmp_list = tmp_list->prev;
}
ipc_widget = gtk_drag_get_ipc_widget (gtk_widget_get_screen (widget));
source_widgets = g_slist_prepend (source_widgets, ipc_widget);
context = gdk_drag_begin (ipc_widget->window, targets);
......@@ -1869,23 +1896,18 @@ gtk_drag_begin (GtkWidget *widget,
info->widget = gtk_widget_ref (widget);
info->button = button;
info->cursor = cursor;
info->target_list = target_list;
gtk_target_list_ref (target_list);
info->possible_actions = actions;
info->cursor = NULL;
info->status = GTK_DRAG_STATUS_DRAG;
info->last_event = NULL;
info->selections = NULL;
info->icon_window = NULL;
info->destroy_icon = FALSE;
gtk_drag_get_event_actions (event, info->button, actions,
&suggested_action, &possible_actions);
info->cursor = gtk_drag_get_cursor (gtk_widget_get_display (widget), suggested_action);
/* Set cur_x, cur_y here so if the "drag_begin" signal shows
* the drag icon, it will be in the right place
*/
......@@ -1921,22 +1943,6 @@ gtk_drag_begin (GtkWidget *widget,
g_signal_connect (info->ipc_widget, "selection_get",
G_CALLBACK (gtk_drag_selection_get), info);
/* We use a GTK grab here to override any grabs that the widget
* we are dragging from might have held
*/
gtk_grab_add (info->ipc_widget);
if (gdk_pointer_grab (info->ipc_widget->window, FALSE,
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_RELEASE_MASK, NULL,
info->cursor, time) == 0)
{
if (gdk_keyboard_grab (info->ipc_widget->window, FALSE, time) != 0)
{
gtk_drag_cancel (info, time);
return NULL;
}
}
info->have_grab = TRUE;
info->grab_time = time;
......@@ -2242,6 +2248,8 @@ gtk_drag_update_icon (GtkDragSourceInfo *info)
gdk_window_raise (icon_window->window);
else
gtk_widget_show (icon_window);
gdk_window_process_all_updates ();
}
}
......
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