[gnome-flashback/wip/segeiger/gnome-3-18-inputmethods: 2/2] input-sources: add styles for hover states
- From: Sebastian Geiger <segeiger src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback/wip/segeiger/gnome-3-18-inputmethods: 2/2] input-sources: add styles for hover states
- Date: Sun, 17 Jan 2016 10:12:21 +0000 (UTC)
commit 6683c50f1a9918617d1f33915ef580e8cbb068a1
Author: Sebastian Geiger <sbastig gmx net>
Date: Sun Jan 17 10:36:10 2016 +0100
input-sources: add styles for hover states
gnome-flashback/Adwaita.css | 4 ++
.../libinput-sources/gf-candidate-area.c | 34 ++++++++++++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/gnome-flashback/Adwaita.css b/gnome-flashback/Adwaita.css
index b03f1ae..f3aba1e 100644
--- a/gnome-flashback/Adwaita.css
+++ b/gnome-flashback/Adwaita.css
@@ -22,3 +22,7 @@ FlashbackLabelWindow
.candidate-box.selected {
background: #7b7b7b;
}
+
+.hover .candidate-box {
+ background: #8a8a8a;
+}
diff --git a/gnome-flashback/libinput-sources/gf-candidate-area.c
b/gnome-flashback/libinput-sources/gf-candidate-area.c
index c7ee744..a9549f0 100644
--- a/gnome-flashback/libinput-sources/gf-candidate-area.c
+++ b/gnome-flashback/libinput-sources/gf-candidate-area.c
@@ -96,6 +96,36 @@ next_button_clicked_cb (GtkButton *button,
return GDK_EVENT_PROPAGATE;
}
+static gboolean
+box_mouse_enter_cb (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ GtkStyleContext *context;
+
+ g_message ("box entered");
+
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_add_class (context, "hover");
+
+ return GDK_EVENT_PROPAGATE;
+}
+
+static gboolean
+box_mouse_leave_cb (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ GtkStyleContext *context;
+
+ g_message ("box left");
+
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_remove_class (context, "hover");
+
+ return GDK_EVENT_PROPAGATE;
+}
+
void
gf_candidate_area_set_orientation (GfCandidateArea *area,
IBusOrientation orientation)
@@ -272,6 +302,10 @@ gf_candidate_area_init (GfCandidateArea *area)
g_signal_connect (event_box, "button-release-event",
G_CALLBACK (button_clicked_cb), area);
+ g_signal_connect (event_box, "enter-notify-event",
+ G_CALLBACK (box_mouse_enter_cb), area);
+ g_signal_connect (event_box, "leave-notify-event",
+ G_CALLBACK (box_mouse_leave_cb), area);
}
area->button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]