From 97ef840803e61d425cf18f260caa06ddbd068797 Mon Sep 17 00:00:00 2001
From: Andre Miranda <andreldm@xfce.org>
Date: Mon, 16 Jul 2018 13:04:13 -0300
Subject: [PATCH] Fix standard view border during drag and drop (Bug #14523)

Also make gtk_render_frame work properly, so there's no
need to use cairo directly.
---
 thunar/thunar-application.c   |  4 +++-
 thunar/thunar-standard-view.c | 13 ++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c
index 01c03f1e0..d26364c26 100644
--- a/thunar/thunar-application.c
+++ b/thunar/thunar-application.c
@@ -585,8 +585,10 @@ thunar_application_load_css (void)
   gtk_css_provider_load_from_data (css_provider, ".path-bar-button { margin-right: 0; }"
 
                                                  /* remove extra border between side pane and view */
+                                                 /* also make border thicker during DnD */
                                                  ".shortcuts-pane { border-right-width: 0px; }"
-                                                 ".standard-view { border-left-width: 0px; }", -1, NULL);
+                                                 ".standard-view { border-left-width: 0px; }"
+                                                 ".standard-view:drop(active) { border-width: 2px; }", -1, NULL);
   screen = gdk_screen_get_default ();
   gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (css_provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
   g_object_unref (css_provider);
diff --git a/thunar/thunar-standard-view.c b/thunar/thunar-standard-view.c
index cd6924d6d..044b9e9c7 100644
--- a/thunar/thunar-standard-view.c
+++ b/thunar/thunar-standard-view.c
@@ -1141,6 +1141,7 @@ thunar_standard_view_draw (GtkWidget      *widget,
 {
   gboolean result = FALSE;
   GtkAllocation a;
+  GtkStyleContext *context;
 
   /* let the scrolled window do it's work */
   cairo_save (cr);
@@ -1152,14 +1153,12 @@ thunar_standard_view_draw (GtkWidget      *widget,
     {
       gtk_widget_get_allocation (widget, &a);
 
-      gtk_render_frame (gtk_widget_get_style_context (widget),
-                        cr, a.x, a.y, a.width, a.height);
+      context = gtk_widget_get_style_context (widget);
 
-      /* the cairo version looks better here, so we use it if possible */
-      cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
-      cairo_set_line_width (cr, 1.0);
-      cairo_rectangle (cr, a.x + 0.5, a.y + 0.5, a.width - 1, a.height - 1);
-      cairo_stroke (cr);
+      gtk_style_context_save (context);
+      gtk_style_context_set_state (context, GTK_STATE_FLAG_DROP_ACTIVE);
+      gtk_render_frame (context, cr, 0, 0, a.width, a.height);
+      gtk_style_context_restore (context);
     }
 
   return result;
-- 
GitLab