messageList: Only close messages via delete key if they can be closed

If the delete key is pressed while a message/MPRIS indicator is focused
GNOME now asks whether the message/MPRIS indicator is closable.
If yes it will be closed but if not it won't be closed.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5536

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2323>
This commit is contained in:
PhilProg 2022-06-03 04:53:11 +00:00 committed by Florian Müllner
parent caebb5a35e
commit 795723fe85

View File

@ -535,8 +535,10 @@ var Message = GObject.registerClass({
if (keysym == Clutter.KEY_Delete ||
keysym == Clutter.KEY_KP_Delete) {
this.close();
return Clutter.EVENT_STOP;
if (this.canClose()) {
this.close();
return Clutter.EVENT_STOP;
}
}
return super.vfunc_key_press_event(keyEvent);
}