Commit a25314c6 authored by Christian Hergert's avatar Christian Hergert
Browse files

omnibar: use :hover instead of cursor to indicate clickability

Based on discussion on https://bugzilla.gnome.org/show_bug.cgi?id=767487
parent 3b303bee
......@@ -150,6 +150,10 @@ popover.perspectives-selector list row image {
omnibar entry {
background-color: @theme_bg_color;
}
omnibar:hover entry {
background-color: mix(@theme_bg_color, @theme_view_color, 0.9);
}
popover.omnibar list row {
border-bottom: 1px solid alpha(@borders, 0.4);
......
......@@ -220,6 +220,46 @@ ide_omni_bar_context_set (GtkWidget *widget,
IDE_EXIT;
}
static gboolean
event_box_enter_notify (IdeOmniBar *self,
GdkEvent *event,
GtkEventBox *event_box)
{
GtkStyleContext *style_context;
GtkStateFlags state_flags;
g_assert (IDE_IS_OMNI_BAR (self));
g_assert (event != NULL);
g_assert (GTK_IS_EVENT_BOX (event_box));
style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
state_flags = gtk_style_context_get_state (style_context);
gtk_style_context_set_state (style_context, state_flags | GTK_STATE_FLAG_PRELIGHT);
return GDK_EVENT_PROPAGATE;
}
static gboolean
event_box_leave_notify (IdeOmniBar *self,
GdkEvent *event,
GtkEventBox *event_box)
{
GtkStyleContext *style_context;
GtkStateFlags state_flags;
g_assert (IDE_IS_OMNI_BAR (self));
g_assert (event != NULL);
g_assert (GTK_IS_EVENT_BOX (event_box));
style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
state_flags = gtk_style_context_get_state (style_context);
gtk_style_context_set_state (style_context, state_flags & ~GTK_STATE_FLAG_PRELIGHT);
return GDK_EVENT_PROPAGATE;
}
static void
ide_omni_bar_build_result_notify_mode (IdeOmniBar *self,
GParamSpec *pspec,
......@@ -392,22 +432,6 @@ multipress_pressed_cb (GtkGestureMultiPress *gesture,
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
static void
event_box_realize (GtkWidget *event_box,
IdeOmniBar *self)
{
GdkWindow *window;
GdkCursor *cursor;
g_assert (GTK_IS_EVENT_BOX (event_box));
g_assert (IDE_IS_OMNI_BAR (self));
window = gtk_widget_get_window (event_box);
cursor = gdk_cursor_new_from_name (gdk_window_get_display (window), "pointer");
gdk_window_set_cursor (window, cursor);
g_clear_object (&cursor);
}
static void
ide_omni_bar_finalize (GObject *object)
{
......@@ -470,10 +494,16 @@ ide_omni_bar_init (IdeOmniBar *self)
gtk_widget_add_events (GTK_WIDGET (self->event_box), GDK_BUTTON_PRESS_MASK);
g_signal_connect_after (self->event_box,
"realize",
G_CALLBACK (event_box_realize),
self);
g_signal_connect_object (self->event_box,
"enter-notify-event",
G_CALLBACK (event_box_enter_notify),
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (self->event_box,
"leave-notify-event",
G_CALLBACK (event_box_leave_notify),
self,
G_CONNECT_SWAPPED);
self->gesture = gtk_gesture_multi_press_new (GTK_WIDGET (self->event_box));
g_signal_connect (self->gesture, "pressed", G_CALLBACK (multipress_pressed_cb), self);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment