[gnome-shell] modal-dialog: Don't let buttons steal manually-set focus



commit 6d92af17fd2b7d4928827111f1ea19b9f1e315d9
Author: Florian MÃllner <fmuellner gnome org>
Date:   Thu Sep 15 14:02:42 2011 +0200

    modal-dialog: Don't let buttons steal manually-set focus
    
    ModalDialog provides a method to set the initial focus. However,
    when adding buttons, the initial focus is always set to the last
    button, thus overwriting a previously set manual focus.
    Instead, only set the initial key focus if setInitialKeyFocus()
    has not been called manually before.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=659133

 js/ui/modalDialog.js |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js
index 8061587..270423a 100644
--- a/js/ui/modalDialog.js
+++ b/js/ui/modalDialog.js
@@ -131,7 +131,9 @@ ModalDialog.prototype = {
             else
                 x_alignment = St.Align.MIDDLE;
 
-            this._initialKeyFocus = buttonInfo.button;
+            if (this._initialKeyFocus == this._dialogLayout ||
+                this._buttonLayout.contains(this._initialKeyFocus))
+                this._initialKeyFocus = buttonInfo.button;
             this._buttonLayout.add(buttonInfo.button,
                                    { expand: true,
                                      x_fill: false,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]