forked from AuroraMiddleware/gtk
listbox: Listen to ::stopped on the press gesture
Otherwise, we end up interpreting grab notify's as button releases, which is not right. This matches what GtkFlowBox does.
This commit is contained in:
parent
2f9d980c93
commit
4d0a57fe0b
@ -243,6 +243,8 @@ static void gtk_list_box_multipress_gesture_released (GtkGestureMultiPress *gest
|
|||||||
gdouble x,
|
gdouble x,
|
||||||
gdouble y,
|
gdouble y,
|
||||||
GtkListBox *box);
|
GtkListBox *box);
|
||||||
|
static void gtk_list_box_multipress_gesture_stopped (GtkGestureMultiPress *gesture,
|
||||||
|
GtkListBox *box);
|
||||||
|
|
||||||
static void gtk_list_box_update_row_styles (GtkListBox *box);
|
static void gtk_list_box_update_row_styles (GtkListBox *box);
|
||||||
static void gtk_list_box_update_row_style (GtkListBox *box,
|
static void gtk_list_box_update_row_style (GtkListBox *box,
|
||||||
@ -599,6 +601,8 @@ gtk_list_box_init (GtkListBox *box)
|
|||||||
G_CALLBACK (gtk_list_box_multipress_gesture_pressed), box);
|
G_CALLBACK (gtk_list_box_multipress_gesture_pressed), box);
|
||||||
g_signal_connect (priv->multipress_gesture, "released",
|
g_signal_connect (priv->multipress_gesture, "released",
|
||||||
G_CALLBACK (gtk_list_box_multipress_gesture_released), box);
|
G_CALLBACK (gtk_list_box_multipress_gesture_released), box);
|
||||||
|
g_signal_connect (priv->multipress_gesture, "stopped",
|
||||||
|
G_CALLBACK (gtk_list_box_multipress_gesture_stopped), box);
|
||||||
|
|
||||||
|
|
||||||
g_signal_connect (box, "notify::parent", G_CALLBACK (gtk_list_box_parent_cb), NULL);
|
g_signal_connect (box, "notify::parent", G_CALLBACK (gtk_list_box_parent_cb), NULL);
|
||||||
@ -1783,6 +1787,7 @@ gtk_list_box_multipress_gesture_released (GtkGestureMultiPress *gesture,
|
|||||||
*/
|
*/
|
||||||
g_object_ref (box);
|
g_object_ref (box);
|
||||||
|
|
||||||
|
g_print ("released\n");
|
||||||
if (priv->active_row != NULL &&
|
if (priv->active_row != NULL &&
|
||||||
priv->active_row == gtk_list_box_get_row_at_y (box, y))
|
priv->active_row == gtk_list_box_get_row_at_y (box, y))
|
||||||
{
|
{
|
||||||
@ -1816,14 +1821,28 @@ gtk_list_box_multipress_gesture_released (GtkGestureMultiPress *gesture,
|
|||||||
|
|
||||||
if (priv->active_row)
|
if (priv->active_row)
|
||||||
{
|
{
|
||||||
gtk_widget_unset_state_flags (GTK_WIDGET (priv->active_row),
|
gtk_widget_unset_state_flags (GTK_WIDGET (priv->active_row), GTK_STATE_FLAG_ACTIVE);
|
||||||
GTK_STATE_FLAG_ACTIVE);
|
|
||||||
priv->active_row = NULL;
|
priv->active_row = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (box);
|
g_object_unref (box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gtk_list_box_multipress_gesture_stopped (GtkGestureMultiPress *gesture,
|
||||||
|
GtkListBox *box)
|
||||||
|
{
|
||||||
|
GtkListBoxPrivate *priv = BOX_PRIV (box);
|
||||||
|
|
||||||
|
g_print ("stopped\n");
|
||||||
|
if (priv->active_row)
|
||||||
|
{
|
||||||
|
gtk_widget_unset_state_flags (GTK_WIDGET (priv->active_row), GTK_STATE_FLAG_ACTIVE);
|
||||||
|
priv->active_row = NULL;
|
||||||
|
gtk_widget_queue_draw (GTK_WIDGET (box));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_list_box_show (GtkWidget *widget)
|
gtk_list_box_show (GtkWidget *widget)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user