Commit c3883497 authored by Ernestas Kulik's avatar Ernestas Kulik 🦑

floating-bar: Stop handling ::enter-notify-event

And replace it with a handler for ::event.
parent f692a93d
......@@ -9522,7 +9522,7 @@ nautilus_files_view_init (NautilusFilesView *view)
gtk_container_add (GTK_CONTAINER (view), priv->overlay);
gtk_widget_show (priv->overlay);
/* NautilusFloatingBar listen to its parent's 'enter-notify-event' signal
/* NautilusFloatingBar listen to its parent's 'event' signal
* and GtkOverlay doesn't have it enabled by default, so we have to add them
* here.
*/
......
......@@ -227,27 +227,31 @@ check_pointer_timeout (gpointer user_data)
}
static gboolean
overlay_enter_notify_cb (GtkWidget *parent,
GdkEventCrossing *event,
gpointer user_data)
overlay_event_cb (GtkWidget *parent,
GdkEvent *event,
gpointer user_data)
{
NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (user_data);
GtkWidget *widget = user_data;
CheckPointerData *data;
gint y_pos;
NautilusFloatingBar *self = NAUTILUS_FLOATING_BAR (widget);
if (gdk_event_get_event_type (event) != GDK_ENTER_NOTIFY)
{
return GDK_EVENT_PROPAGATE;
}
if (self->hover_timeout_id != 0)
{
g_source_remove (self->hover_timeout_id);
}
if (event->window != gtk_widget_get_window (widget))
if (gdk_event_get_window (event) != gtk_widget_get_window (widget))
{
return GDK_EVENT_PROPAGATE;
}
if (NAUTILUS_FLOATING_BAR (widget)->is_interactive)
if (self->is_interactive)
{
return GDK_EVENT_PROPAGATE;
}
......@@ -257,7 +261,7 @@ overlay_enter_notify_cb (GtkWidget *parent,
data = g_slice_new (CheckPointerData);
data->overlay = parent;
data->floating_bar = widget;
data->device = gdk_event_get_device ((GdkEvent *) event);
data->device = gdk_event_get_device (event);
data->y_down_limit = y_pos;
data->y_upper_limit = y_pos + gtk_widget_get_allocated_height (widget);
......@@ -265,7 +269,7 @@ overlay_enter_notify_cb (GtkWidget *parent,
check_pointer_timeout, data,
check_pointer_data_free);
g_source_set_name_by_id (self->hover_timeout_id, "[nautilus-floating-bar] overlay_enter_notify_cb");
g_source_set_name_by_id (self->hover_timeout_id, "[nautilus-floating-bar] overlay_event_cb");
return GDK_EVENT_STOP;
}
......@@ -281,13 +285,13 @@ nautilus_floating_bar_parent_set (GtkWidget *widget,
if (old_parent != NULL)
{
g_signal_handlers_disconnect_by_func (old_parent,
overlay_enter_notify_cb, widget);
overlay_event_cb, widget);
}
if (parent != NULL)
{
g_signal_connect (parent, "enter-notify-event",
G_CALLBACK (overlay_enter_notify_cb), widget);
g_signal_connect (parent, "event",
G_CALLBACK (overlay_event_cb), widget);
}
}
......
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