[gnome-shell] Add hover style property
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Add hover style property
- Date: Mon, 8 Mar 2010 18:27:35 +0000 (UTC)
commit 5f8391314a14574aad82b2ba02cc091a031c663f
Author: Florian Müllner <fmuellner src gnome org>
Date: Sat Feb 27 20:51:15 2010 +0100
Add hover style property
Set the entry's pseudo class to "hover" when the pointer enters the
inactive widget and reset it appropriately on leave.
https://bugzilla.gnome.org/show_bug.cgi?id=611095
src/st/st-entry.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index 77e61ab..fa10489 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -38,6 +38,10 @@
* <listitem>
* <para>indeterminate: the widget is showing the hint text</para>
* </listitem>
+ * <listitem>
+ * <para>hover: the widget is showing the hint text and is underneath the
+ * pointer</para>
+ * </listitem>
* </itemizedlist>
*/
@@ -570,6 +574,38 @@ st_entry_key_focus_in (ClutterActor *actor)
clutter_actor_grab_key_focus (priv->entry);
}
+static gboolean
+st_entry_enter_event (ClutterActor *actor,
+ ClutterCrossingEvent *event)
+{
+ StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
+
+ if (priv->hint && priv->hint_visible)
+ {
+ st_widget_set_style_pseudo_class (ST_WIDGET (actor), "hover");
+ }
+
+ return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->enter_event (actor, event);
+}
+
+static gboolean
+st_entry_leave_event (ClutterActor *actor,
+ ClutterCrossingEvent *event)
+{
+ StEntryPrivate *priv = ST_ENTRY_PRIV (actor);
+
+ if (priv->hint && priv->hint_visible)
+ {
+ st_widget_set_style_pseudo_class (ST_WIDGET (actor), "indeterminate");
+ }
+ else
+ {
+ st_widget_set_style_pseudo_class (ST_WIDGET (actor), "focus");
+ }
+
+ return CLUTTER_ACTOR_CLASS (st_entry_parent_class)->leave_event (actor, event);
+}
+
static void
st_entry_class_init (StEntryClass *klass)
{
@@ -595,6 +631,8 @@ st_entry_class_init (StEntryClass *klass)
actor_class->key_press_event = st_entry_key_press_event;
actor_class->key_focus_in = st_entry_key_focus_in;
+ actor_class->enter_event = st_entry_enter_event;
+ actor_class->leave_event = st_entry_leave_event;
widget_class->style_changed = st_entry_style_changed;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]