display: Fix crash due to shortcut propagation phase
For a managed GtkShortcutController, changing its propagation phase away from `GTK_PHASE_BUBBLE` currently results in a lingering reference due to a bug in GTK (gtk#6246). This means the Escape key shortcut remains active even after leaving the Display panel, resulting in a crash when pressing Escape in any panel after leaving the Display panel. This is now fixed in GTK (gtk!7115), but there seems to be no reason for changing the propagation phase at all anyways. Since the callback returns `GDK_EVENT_PROPAGATE` when it does not activate, the event should still make it to other handlers. So, to speed up the fix for gnome-control-center, we remove the propagation phase changes althogether. There is also no need to let the shortcut have global scope, managed is enough. Closes #2768
This commit is contained in:
parent
08b23771f1
commit
e7e9753aac
2 changed files with 2 additions and 9 deletions
|
@ -104,7 +104,6 @@ struct _CcDisplayPanel
|
|||
AdwComboRow *primary_display_row;
|
||||
AdwPreferencesGroup *single_display_settings_group;
|
||||
|
||||
GtkShortcutController *toplevel_shortcuts;
|
||||
GtkShortcut *escape_shortcut;
|
||||
|
||||
GSettings *display_settings;
|
||||
|
@ -406,8 +405,6 @@ dialog_toplevel_is_active_changed (CcDisplayPanel *self)
|
|||
static void
|
||||
reset_titlebar (CcDisplayPanel *self)
|
||||
{
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (self->toplevel_shortcuts),
|
||||
GTK_PHASE_NONE);
|
||||
self->showing_apply_titlebar = FALSE;
|
||||
g_object_notify (G_OBJECT (self), "showing-apply-titlebar");
|
||||
}
|
||||
|
@ -618,7 +615,6 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
|
|||
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, night_light_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, primary_display_row);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, single_display_settings_group);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, toplevel_shortcuts);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, apply_current_configuration);
|
||||
gtk_widget_class_bind_template_callback (widget_class, cancel_current_configuration);
|
||||
|
@ -939,9 +935,6 @@ show_apply_titlebar (CcDisplayPanel *self, gboolean is_applicable)
|
|||
_("This could be due to hardware limitations."));
|
||||
}
|
||||
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (self->toplevel_shortcuts),
|
||||
GTK_PHASE_BUBBLE);
|
||||
|
||||
self->showing_apply_titlebar = TRUE;
|
||||
g_object_notify (G_OBJECT (self), "showing-apply-titlebar");
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<template class="CcDisplayPanel" parent="CcPanel">
|
||||
|
||||
<child>
|
||||
<object class="GtkShortcutController" id="toplevel_shortcuts">
|
||||
<property name="scope">global</property>
|
||||
<object class="GtkShortcutController">
|
||||
<property name="scope">managed</property>
|
||||
<property name="name">Display Panel Globals Shortcuts</property>
|
||||
<child>
|
||||
<object class="GtkShortcut" id="escape_shortcut">
|
||||
|
|
Loading…
Add table
Reference in a new issue