event-editor/multi-choice: Focus widget if increment/decrement buttons are pressed
This also re-sets the state flags of the buttons, because otherwise the increment/decrement buttons lose their hovered state after the widget gains focus. Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/616>
This commit is contained in:
@@ -226,12 +226,21 @@ static void
|
|||||||
button_clicked_cb (GtkWidget *button,
|
button_clicked_cb (GtkWidget *button,
|
||||||
GcalMultiChoice *self)
|
GcalMultiChoice *self)
|
||||||
{
|
{
|
||||||
|
GtkStateFlags state_flags;
|
||||||
|
|
||||||
|
state_flags = gtk_widget_get_state_flags (button);
|
||||||
|
|
||||||
if (button == self->down_button)
|
if (button == self->down_button)
|
||||||
go_down (self);
|
go_down (self);
|
||||||
else if (button == self->up_button)
|
else if (button == self->up_button)
|
||||||
go_up (self);
|
go_up (self);
|
||||||
else
|
else
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
|
|
||||||
|
if (!gtk_widget_grab_focus (GTK_WIDGET (self)))
|
||||||
|
g_assert_not_reached ();
|
||||||
|
|
||||||
|
gtk_widget_set_state_flags (button, state_flags, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
Reference in New Issue
Block a user