From 9934529a0b67ed1d1e8506b9e2af29609b20b7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Fri, 20 Mar 2015 14:29:40 +0100 Subject: [PATCH] loginDialog: Move long session-list menus to the side Currently the menu position below the button means that the menu can extend to roughly half the screen height before ending up partly off-screen. This is plenty of space for commonly installed sessions, but some users have a significantly higher number of sessions in the list. Move the menu to the side of the button in that case to maximize the vertical space the menu may take up. https://bugzilla.gnome.org/show_bug.cgi?id=734352 --- js/gdm/loginDialog.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index 8da1b5501..eed43d711 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -49,6 +49,7 @@ const _FADE_ANIMATION_TIME = 0.25; const _SCROLL_ANIMATION_TIME = 0.5; const _TIMED_LOGIN_IDLE_THRESHOLD = 5.0; const _LOGO_ICON_HEIGHT = 48; +const _MAX_BOTTOM_MENU_ITEMS = 5; const UserListItem = new Lang.Class({ Name: 'UserListItem', @@ -283,7 +284,16 @@ const SessionMenuButton = new Lang.Class({ this.actor = new St.Bin({ child: this._button }); - this._menu = new PopupMenu.PopupMenu(this._button, 0, St.Side.TOP); + let side = St.Side.TOP; + let align = 0; + if (Gdm.get_session_ids().length > _MAX_BOTTOM_MENU_ITEMS) { + if (this.actor.text_direction == Clutter.TextDirection.RTL) + side = St.Side.RIGHT; + else + side = St.Side.LEFT; + align = 0.5; + } + this._menu = new PopupMenu.PopupMenu(this._button, align, side); Main.uiGroup.add_actor(this._menu.actor); this._menu.actor.hide();