From 571706c6fb2142cd1dcad9d21fbf04bfaca66af1 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 21 Aug 2019 15:01:34 -0400 Subject: [PATCH 1/3] 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. --- 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 9db5136e6..159357eb3 100644 --- a/js/ui/shellEntry.js +++ b/js/ui/shellEntry.js @@ -19,61 +19,61 @@ var EntryMenu = new Lang.Class({ 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(); this.parent(animate); this._entry.add_style_pseudo_class('focus'); let direction = Gtk.DirectionType.TAB_FORWARD; if (!this.actor.navigate_focus(null, direction, false)) this.actor.grab_key_focus(); }, -- 2.21.0