screenshot: Only enable window screenshots when allowed by mode

We currently don't take the session mode's `hasWindows` property
into account when deciding whether window screenshots should be
allowed. Right now that doesn't matter in practice, because all
the ways to bring up the screenshot UI are blocked in those modes
anyway. This is about to change though, so take the property into
account to prevent an information leak.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2439>
This commit is contained in:
Florian Müllner 2022-08-21 21:07:52 +02:00 committed by Marge Bot
parent aa7bc4cfa3
commit f9135cdc86

View File

@ -1469,7 +1469,9 @@ var ScreenshotUI = GObject.registerClass({
}
this._windowButton.reactive =
windows.length > 0 && !this._castButton.checked;
Main.sessionMode.hasWindows &&
windows.length > 0 &&
!this._castButton.checked;
if (!this._windowButton.reactive)
this._selectionButton.checked = true;