From db39ba3b9f5905f03949860433202c2e93b6ce69 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Sat, 27 Aug 2011 23:04:56 -0400 Subject: [PATCH] modalDialog: add mode that leaves shell reactive A modal dialog in the shell blocks anything but that dialog from receiving user input. Applications within the session and other parts of UI are rendered non-reactive. When GDM gets changed to use the shell for its greeter, the user list will be presented as a shell dialog. That dialog shouldn't block access to the panel menus, etc. This commit adds a shellReactive property that makes the ModalDialog class continue to block access to applications, but allow the user to interact with the shell itself. https://bugzilla.gnome.org/show_bug.cgi?id=657082 --- js/ui/modalDialog.js | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index effc5bed6..49f086b2c 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -35,10 +35,12 @@ function ModalDialog() { ModalDialog.prototype = { _init: function(params) { - params = Params.parse(params, { styleClass: null }); + params = Params.parse(params, { shellReactive: false, + styleClass: null }); this.state = State.CLOSED; this._hasModal = false; + this._shellReactive = params.shellReactive; this._group = new St.Group({ visible: false, x: 0, @@ -54,26 +56,30 @@ ModalDialog.prototype = { this._actionKeys = {}; this._group.connect('key-press-event', Lang.bind(this, this._onKeyPressEvent)); - this._lightbox = new Lightbox.Lightbox(this._group, - { inhibitEvents: true }); - this._backgroundBin = new St.Bin(); - this._group.add_actor(this._backgroundBin); - this._lightbox.highlight(this._backgroundBin); - - this._backgroundStack = new Shell.Stack(); - this._backgroundBin.child = this._backgroundStack; - - this._eventBlocker = new Clutter.Group({ reactive: true }); - this._backgroundStack.add_actor(this._eventBlocker); this._dialogLayout = new St.BoxLayout({ style_class: 'modal-dialog', vertical: true }); if (params.styleClass != null) { this._dialogLayout.add_style_class_name(params.styleClass); } - this._backgroundStack.add_actor(this._dialogLayout); + + if (!this._shellReactive) { + this._lightbox = new Lightbox.Lightbox(this._group, + { inhibitEvents: true }); + this._lightbox.highlight(this._backgroundBin); + + let stack = new Shell.Stack(); + this._backgroundBin.child = stack; + + this._eventBlocker = new Clutter.Group({ reactive: true }); + stack.add_actor(this._eventBlocker); + stack.add_actor(this._dialogLayout); + } else { + this._backgroundBin.child = this._dialogLayout; + } + this.contentLayout = new St.BoxLayout({ vertical: true }); this._dialogLayout.add(this.contentLayout, @@ -179,7 +185,8 @@ ModalDialog.prototype = { this.state = State.OPENING; this._dialogLayout.opacity = 255; - this._lightbox.show(); + if (this._lightbox) + this._lightbox.show(); this._group.opacity = 0; this._group.show(); Tweener.addTween(this._group, @@ -245,7 +252,8 @@ ModalDialog.prototype = { global.gdk_screen.get_display().sync(); this._hasModal = false; - this._eventBlocker.raise_top(); + if (!this._shellReactive) + this._eventBlocker.raise_top(); }, pushModal: function (timestamp) { @@ -261,7 +269,8 @@ ModalDialog.prototype = { } else this._initialKeyFocus.grab_key_focus(); - this._eventBlocker.lower_bottom(); + if (!this._shellReactive) + this._eventBlocker.lower_bottom(); return true; },