[gnome-calendar] month-view: fix DnD highlight



commit 7104c95ffbde94e8cb200ed7bd8e8de1604a13e3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Sep 14 14:01:37 2016 -0300

    month-view: fix DnD highlight
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771115

 data/theme/gtk-styles.css |    4 ----
 src/gcal-month-view.c     |   10 +++++++++-
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/data/theme/gtk-styles.css b/data/theme/gtk-styles.css
index 7fc5f11..6f1ce56 100644
--- a/data/theme/gtk-styles.css
+++ b/data/theme/gtk-styles.css
@@ -32,10 +32,6 @@ calendar-view.current {
     background-color: alpha(@theme_selected_bg_color, 0.3);
 }
 
-calendar-view.current:drop(active) {
-    background-color: black;
-}
-
 calendar-view:selected {
     color: @theme_selected_bg_color;
     font-weight: bold;
diff --git a/src/gcal-month-view.c b/src/gcal-month-view.c
index bb8fde2..166b9f1 100644
--- a/src/gcal-month-view.c
+++ b/src/gcal-month-view.c
@@ -1776,12 +1776,20 @@ gcal_month_view_draw (GtkWidget *widget,
       if (priv->date->year == priv->current_date->year && priv->date->month == priv->current_date->month &&
           j == priv->current_date->day)
         {
-          PangoLayout *clayout;
           PangoFontDescription *cfont_desc;
+          PangoLayout *clayout;
 
           gtk_style_context_save (context);
           gtk_style_context_add_class (context, "current");
 
+          /*
+           * If the current day is not under a DnD, it's actually not possible
+           * to *not* show the DnD indicator using only CSS. So we have to fake
+           * the "I'm not under DnD" state.
+           */
+          if (j != priv->dnd_cell)
+            gtk_style_context_set_state (context, state & ~GTK_STATE_FLAG_DROP_ACTIVE);
+
           clayout = gtk_widget_create_pango_layout (widget, nr_day);
           gtk_style_context_get (context, state, "font", &cfont_desc, NULL);
           pango_layout_set_font_description (clayout, cfont_desc);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]