summaryrefslogtreecommitdiff
path: root/gtk/gtkdnd.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-04-22 21:19:21 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-04-22 21:19:21 -0400
commit6193b9b640af2e57a24c0d420f15b7572f5955c3 (patch)
treeed84d24aa54eee6f370add797dab301c84a08e53 /gtk/gtkdnd.c
parent75f90ee4245172f4522868d3780219d19e546d6f (diff)
downloadgtk+-6193b9b640af2e57a24c0d420f15b7572f5955c3.tar.gz
csd: Fix drag hightlight drawing
When making the entire window a drop target, as file-roller does, we don't want to draw the drag highlight around the CSD window decorations. https://bugzilla.gnome.org/show_bug.cgi?id=728526 Please enter the commit message for your changes. Lines starting
Diffstat (limited to 'gtk/gtkdnd.c')
-rw-r--r--gtk/gtkdnd.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 46644dd15b..ce928f9d3f 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -1246,24 +1246,38 @@ gtk_drag_highlight_draw (GtkWidget *widget,
cairo_t *cr,
gpointer data)
{
- int width = gtk_widget_get_allocated_width (widget);
- int height = gtk_widget_get_allocated_height (widget);
+ GtkAllocation alloc;
GtkStyleContext *context;
+ if (GTK_IS_WINDOW (widget))
+ {u
+ /* We don't want to draw the drag highlight around the
+ * CSD window decorations
+ */
+ gtk_widget_get_allocation (gtk_bin_get_child (GTK_BIN (widget)), &alloc);
+ }
+ else
+ {
+ alloc.x = 0;
+ alloc.y = 0;
+ alloc.width = gtk_widget_get_allocated_width (widget);
+ alloc.height = gtk_widget_get_allocated_height (widget);
+ }
+
context = gtk_widget_get_style_context (widget);
gtk_style_context_save (context);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_DND);
- gtk_render_frame (context, cr, 0, 0, width, height);
+ gtk_render_frame (context, cr, alloc.x, alloc.y, alloc.width, alloc.height);
gtk_style_context_restore (context);
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);
+ alloc.x + 0.5, alloc.y + 0.5,
+ alloc.width - 1, alloc.height - 1);
cairo_stroke (cr);
return FALSE;