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
This commit is contained in:
parent
239a9e4816
commit
db39ba3b9f
@ -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,6 +185,7 @@ ModalDialog.prototype = {
|
||||
this.state = State.OPENING;
|
||||
|
||||
this._dialogLayout.opacity = 255;
|
||||
if (this._lightbox)
|
||||
this._lightbox.show();
|
||||
this._group.opacity = 0;
|
||||
this._group.show();
|
||||
@ -245,6 +252,7 @@ ModalDialog.prototype = {
|
||||
global.gdk_screen.get_display().sync();
|
||||
this._hasModal = false;
|
||||
|
||||
if (!this._shellReactive)
|
||||
this._eventBlocker.raise_top();
|
||||
},
|
||||
|
||||
@ -261,6 +269,7 @@ ModalDialog.prototype = {
|
||||
} else
|
||||
this._initialKeyFocus.grab_key_focus();
|
||||
|
||||
if (!this._shellReactive)
|
||||
this._eventBlocker.lower_bottom();
|
||||
return true;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user