window: Only clear last_focused_widget if the widget has been focused
When opening the event editor dialog as a new event, `set_new_event_mode()` immediately tries to focus the last focused widget, which won't work because it is unfocusable. `focus_last_focused_widget()` then clears clears the pointer regardless of whether the widget has successfully grabbed focus or not. So, we want to only clear focus if the widget has successfully grabbed focus. Related: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1566 Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/730>
This commit is contained in:
@@ -223,11 +223,8 @@ update_today_action_enabled (GcalWindow *window)
|
||||
static void
|
||||
focus_last_focused_widget (GcalWindow *self)
|
||||
{
|
||||
if (self->last_focused_widget)
|
||||
{
|
||||
gtk_widget_grab_focus (self->last_focused_widget);
|
||||
g_clear_weak_pointer (&self->last_focused_widget);
|
||||
}
|
||||
if (self->last_focused_widget && gtk_widget_grab_focus (self->last_focused_widget))
|
||||
g_clear_weak_pointer (&self->last_focused_widget);
|
||||
}
|
||||
|
||||
static gchar*
|
||||
|
||||
Reference in New Issue
Block a user