summaryrefslogtreecommitdiff
path: root/gtk/gtkdnd.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-09-08 21:21:59 +0200
committerBenjamin Otte <otte@redhat.com>2010-09-26 15:11:40 +0200
commit729f80b5546bff1aa26dda61656eb5721f35fe19 (patch)
tree1c9d148c62e0b2eb9ac462143bf408138d5f1d2a /gtk/gtkdnd.c
parent830cda9e324e9837a3b52e81c2af6da6380b7897 (diff)
downloadgtk+-729f80b5546bff1aa26dda61656eb5721f35fe19.tar.gz
dnd: Connect to raw func for drag hilight
Diffstat (limited to 'gtk/gtkdnd.c')
-rw-r--r--gtk/gtkdnd.c68
1 files changed, 19 insertions, 49 deletions
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 55c483c4cf..85e5dd1548 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -192,10 +192,6 @@ static GtkWidget *gtk_drag_get_ipc_widget (GtkWidget *widget);
static GtkWidget *gtk_drag_get_ipc_widget_for_screen (GdkScreen *screen);
static void gtk_drag_release_ipc_widget (GtkWidget *widget);
-static gboolean gtk_drag_highlight_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data);
-
static void gtk_drag_selection_received (GtkWidget *widget,
GtkSelectionData *selection_data,
guint time,
@@ -1096,7 +1092,7 @@ gtk_drag_finish (GdkDragContext *context,
}
/*************************************************************
- * gtk_drag_highlight_expose:
+ * gtk_drag_highlight_draw:
* Callback for expose_event for highlighted widgets.
* arguments:
* widget:
@@ -1106,50 +1102,24 @@ gtk_drag_finish (GdkDragContext *context,
*************************************************************/
static gboolean
-gtk_drag_highlight_expose (GtkWidget *widget,
- GdkEventExpose *event,
- gpointer data)
+gtk_drag_highlight_draw (GtkWidget *widget,
+ cairo_t *cr,
+ gpointer data)
{
- gint x, y, width, height;
-
- if (gtk_widget_is_drawable (widget))
- {
- GdkWindow *window;
- cairo_t *cr;
+ int width = gtk_widget_get_allocated_width (widget);
+ int height = gtk_widget_get_allocated_height (widget);
- window = gtk_widget_get_window (widget);
+ gtk_cairo_paint_shadow (gtk_widget_get_style (widget), cr,
+ GTK_STATE_NORMAL, GTK_SHADOW_OUT,
+ widget, "dnd",
+ 0, 0, width, height);
- if (!gtk_widget_get_has_window (widget))
- {
- GtkAllocation allocation;
-
- gtk_widget_get_allocation (widget, &allocation);
- x = allocation.x;
- y = allocation.y;
- width = allocation.width;
- height = allocation.height;
- }
- else
- {
- x = 0;
- y = 0;
- gdk_drawable_get_size (window, &width, &height);
- }
-
- gtk_paint_shadow (gtk_widget_get_style (widget), window,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT,
- &event->area, widget, "dnd",
- x, y, width, height);
-
- cr = gdk_cairo_create (window);
- cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
- cairo_set_line_width (cr, 1.0);
- cairo_rectangle (cr,
- x + 0.5, y + 0.5,
- width - 1, height - 1);
- cairo_stroke (cr);
- cairo_destroy (cr);
- }
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0); /* black */
+ cairo_set_line_width (cr, 1.0);
+ cairo_rectangle (cr,
+ 0.5, 0.5,
+ width - 1, height - 1);
+ cairo_stroke (cr);
return FALSE;
}
@@ -1167,8 +1137,8 @@ gtk_drag_highlight (GtkWidget *widget)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
- g_signal_connect_after (widget, "expose-event",
- G_CALLBACK (gtk_drag_highlight_expose),
+ g_signal_connect_after (widget, "draw",
+ G_CALLBACK (gtk_drag_highlight_draw),
NULL);
gtk_widget_queue_draw (widget);
@@ -1188,7 +1158,7 @@ gtk_drag_unhighlight (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (widget));
g_signal_handlers_disconnect_by_func (widget,
- gtk_drag_highlight_expose,
+ gtk_drag_highlight_draw,
NULL);
gtk_widget_queue_draw (widget);