gnome-shell/SOURCES/0001-shellEntry-Determine-if-password-entry-from-content-.patch
2021-11-11 08:19:46 +00:00

92 lines
2.8 KiB
Diff

From e6cd96a9f6a89f77ca0fab72aff8c56354b59f38 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 21 Aug 2019 15:01:34 -0400
Subject: [PATCH 1/4] shellEntry: Determine if password entry from content
purpose not menu item
Right now shellEntry decides whether or not it's a password entry based
on whether or not it has a "Show Text" context menu.
That's a little roundabout, and gets in the way off providing lockdown
that disables the menu.
This commit changes shellEntry to base whether or not it's a password
entry from it's input content purpose instead of from the presence
or absence of a context menu.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/687
---
js/ui/shellEntry.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index 53bd1daa1..cac4ec9c2 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -14,61 +14,61 @@ var EntryMenu = class extends PopupMenu.PopupMenu {
this._entry = entry;
this._clipboard = St.Clipboard.get_default();
// Populate menu
let item;
item = new PopupMenu.PopupMenuItem(_("Copy"));
item.connect('activate', this._onCopyActivated.bind(this));
this.addMenuItem(item);
this._copyItem = item;
item = new PopupMenu.PopupMenuItem(_("Paste"));
item.connect('activate', this._onPasteActivated.bind(this));
this.addMenuItem(item);
this._pasteItem = item;
this._passwordItem = null;
Main.uiGroup.add_actor(this.actor);
this.actor.hide();
}
_makePasswordItem() {
let item = new PopupMenu.PopupMenuItem('');
item.connect('activate', this._onPasswordActivated.bind(this));
this.addMenuItem(item);
this._passwordItem = item;
}
get isPassword() {
- return this._passwordItem != null;
+ return this._entry.input_purpose == Clutter.InputContentPurpose.PASSWORD;
}
set isPassword(v) {
if (v == this.isPassword)
return;
if (v) {
this._makePasswordItem();
this._entry.input_purpose = Clutter.InputContentPurpose.PASSWORD;
} else {
this._passwordItem.destroy();
this._passwordItem = null;
this._entry.input_purpose = Clutter.InputContentPurpose.NORMAL;
}
}
open(animate) {
this._updatePasteItem();
this._updateCopyItem();
if (this._passwordItem)
this._updatePasswordItem();
super.open(animate);
this._entry.add_style_pseudo_class('focus');
let direction = St.DirectionType.TAB_FORWARD;
if (!this.actor.navigate_focus(null, direction, false))
this.actor.grab_key_focus();
}
--
2.27.0