[gnome-flashback/wip/segeiger/gnome-3-18-inputmethods: 6/7] 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: 6/7] input-sources: add styles for hover states
- Date: Sun, 17 Jan 2016 23:18:25 +0000 (UTC)
commit 9a075e8b1acf3c9b27f041b8b7111d78c1ee05a2
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 | 5 +++
.../libinput-sources/gf-candidate-area.c | 30 ++++++++++++++++++++
2 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/gnome-flashback/Adwaita.css b/gnome-flashback/Adwaita.css
index 253b543..29dda4e 100644
--- a/gnome-flashback/Adwaita.css
+++ b/gnome-flashback/Adwaita.css
@@ -22,3 +22,8 @@ FlashbackLabelWindow
GfCandidateBox.selected {
background: #7b7b7b;
}
+
+GfCandidateBox.hover {
+ background: #ccc;
+ border: 1px solid #aaa;
+}
diff --git a/gnome-flashback/libinput-sources/gf-candidate-area.c
b/gnome-flashback/libinput-sources/gf-candidate-area.c
index a5bdb9b..392d65e 100644
--- a/gnome-flashback/libinput-sources/gf-candidate-area.c
+++ b/gnome-flashback/libinput-sources/gf-candidate-area.c
@@ -87,6 +87,32 @@ 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;
+
+ 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;
+
+ 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)
@@ -258,6 +284,10 @@ gf_candidate_area_init (GfCandidateArea *area)
g_signal_connect (candidate_box, "button-release-event",
G_CALLBACK (button_clicked_cb), area);
+ g_signal_connect (candidate_box, "enter-notify-event",
+ G_CALLBACK (box_mouse_enter_cb), area);
+ g_signal_connect (candidate_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]