[gnome-flashback] input-sources: update pseudo class handling



commit b190c04eafae7fbc9c7bf8b3a88994e6ebca772c
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Jan 18 14:03:49 2016 +0200

    input-sources: update pseudo class handling

 .../libinput-sources/gf-candidate-box.c            |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/gnome-flashback/libinput-sources/gf-candidate-box.c 
b/gnome-flashback/libinput-sources/gf-candidate-box.c
index 298e2a1..ae06a33 100644
--- a/gnome-flashback/libinput-sources/gf-candidate-box.c
+++ b/gnome-flashback/libinput-sources/gf-candidate-box.c
@@ -29,6 +29,8 @@ struct _GfCandidateBox
   GtkWidget   *candidate_label;
 
   gboolean     selected;
+
+  gboolean     is_mouse_over;
 };
 
 enum
@@ -70,6 +72,11 @@ static gboolean
 gf_candidate_box_enter_notify_event (GtkWidget        *widget,
                                      GdkEventCrossing *event)
 {
+  GfCandidateBox *box;
+
+  box = GF_CANDIDATE_BOX (widget);
+  box->is_mouse_over = TRUE;
+
   gtk_widget_set_state_flags (widget, GTK_STATE_FLAG_PRELIGHT, TRUE);
 
   return GDK_EVENT_PROPAGATE;
@@ -83,10 +90,11 @@ gf_candidate_box_leave_notify_event (GtkWidget        *widget,
   GtkStateFlags flags;
 
   box = GF_CANDIDATE_BOX (widget);
-  flags = GTK_STATE_FLAG_NORMAL;
+  box->is_mouse_over = FALSE;
 
+  flags = GTK_STATE_FLAG_NORMAL;
   if (box->selected)
-    flags |= GTK_STATE_FLAG_SELECTED;
+    flags = GTK_STATE_FLAG_SELECTED;
 
   gtk_widget_set_state_flags (widget, flags, TRUE);
 
@@ -167,7 +175,12 @@ gf_candidate_box_set_selected (GfCandidateBox *box,
 
   box->selected = selected;
 
-  flags = selected ? GTK_STATE_FLAG_SELECTED : GTK_STATE_FLAG_NORMAL;
+  if (selected)
+    flags = GTK_STATE_FLAG_SELECTED;
+  else if (box->is_mouse_over)
+    flags = GTK_STATE_FLAG_PRELIGHT;
+  else
+    flags = GTK_STATE_FLAG_NORMAL;
 
   gtk_widget_set_state_flags (GTK_WIDGET (box), flags, TRUE);
 }


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