[gnome-shell] shellEntry: Show popup menu at cursor position when pressing menu key
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] shellEntry: Show popup menu at cursor position when pressing menu key
- Date: Thu, 16 Jan 2020 17:38:41 +0000 (UTC)
commit d27638e37e17435709840e0927616d335b0bdb59
Author: Jonas Dreßler <verdre v0yd nl>
Date: Sun Dec 8 21:56:46 2019 +0100
shellEntry: Show popup menu at cursor position when pressing menu key
When pressing the menu key to show the popupMenu inside a ShellEntry,
the menu is currently aligned with the end of the entered text, this
causes a bug in case the text is overflowing the width of the entry: The
menu will be shown outside of the entry field, because it's aligned with
the (invisible) end of the text.
Fix that by simply aligning the popup menu with the cursor of the entry,
which is a behavior that makes sense when pressing the menu-key anyway.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/934
js/ui/shellEntry.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/shellEntry.js b/js/ui/shellEntry.js
index 884efc6b5f..c6e35fa83c 100644
--- a/js/ui/shellEntry.js
+++ b/js/ui/shellEntry.js
@@ -116,7 +116,8 @@ function _onButtonPressEvent(actor, event, entry) {
}
function _onPopup(actor, entry) {
- let [success, textX, textY_, lineHeight_] = entry.clutter_text.position_to_coords(-1);
+ let cursorPosition = entry.clutter_text.get_cursor_position();
+ let [success, textX, textY_, lineHeight_] = entry.clutter_text.position_to_coords(cursorPosition);
if (success)
entry.menu.setSourceAlignment(textX / entry.width);
entry.menu.open(BoxPointer.PopupAnimation.FULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]