diff --git a/js/ui/altTab.js b/js/ui/altTab.js index f8fdb0095..9d2727e44 100644 --- a/js/ui/altTab.js +++ b/js/ui/altTab.js @@ -172,7 +172,7 @@ const AltTabPopup = new Lang.Class({ if (!Main.pushModal(this.actor)) { // Probably someone else has a pointer grab, try again with keyboard only - if (!Main.pushModal(this.actor, global.get_current_time(), Meta.ModalOptions.POINTER_ALREADY_GRABBED)) { + if (!Main.pushModal(this.actor, { options: Meta.ModalOptions.POINTER_ALREADY_GRABBED })) { return false; } } diff --git a/js/ui/main.js b/js/ui/main.js index db7698bd3..cc0587c79 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -20,6 +20,7 @@ const Keyboard = imports.ui.keyboard; const MessageTray = imports.ui.messageTray; const Overview = imports.ui.overview; const Panel = imports.ui.panel; +const Params = imports.misc.params; const RunDialog = imports.ui.runDialog; const Layout = imports.ui.layout; const LookingGlass = imports.ui.lookingGlass; @@ -478,7 +479,7 @@ function isInModalStack(actor) { /** * pushModal: * @actor: #ClutterActor which will be given keyboard focus - * @timestamp: optional timestamp + * @params: optional parameters * * Ensure we are in a mode where all keyboard and mouse input goes to * the stage, and focus @actor. Multiple calls to this function act in @@ -489,21 +490,22 @@ function isInModalStack(actor) { * modal stack returns to this actor, reset the focus to the actor * which was focused at the time pushModal() was invoked. * - * @timestamp is optionally used to associate the call with a specific user - * initiated event. If not provided then the value of - * global.get_current_time() is assumed. + * @params may be used to provide the following parameters: + * - timestamp: used to associate the call with a specific user initiated + * event. If not provided then the value of + * global.get_current_time() is assumed. * - * @options: optional Meta.ModalOptions flags to indicate that the - * pointer is alrady grabbed + * - options: Meta.ModalOptions flags to indicate that the pointer is + * already grabbed * * Returns: true iff we successfully acquired a grab or already had one */ -function pushModal(actor, timestamp, options) { - if (timestamp == undefined) - timestamp = global.get_current_time(); +function pushModal(actor, params) { + params = Params.parse(params, { timestamp: global.get_current_time(), + options: 0 }); if (modalCount == 0) { - if (!global.begin_modal(timestamp, options ? options : 0)) { + if (!global.begin_modal(params.timestamp, params.options)) { log('pushModal: invocation of begin_modal failed'); return false; } diff --git a/js/ui/modalDialog.js b/js/ui/modalDialog.js index 3045daf1c..cb0a15f1b 100644 --- a/js/ui/modalDialog.js +++ b/js/ui/modalDialog.js @@ -226,7 +226,7 @@ const ModalDialog = new Lang.Class({ if (this.state == State.OPENED || this.state == State.OPENING) return true; - if (!this.pushModal(timestamp)) + if (!this.pushModal({ timestamp: timestamp })) return false; this._fadeOpen(onPrimary); @@ -276,7 +276,7 @@ const ModalDialog = new Lang.Class({ pushModal: function (timestamp) { if (this._hasModal) return true; - if (!Main.pushModal(this._group, timestamp)) + if (!Main.pushModal(this._group, { timestamp: timestamp })) return false; this._hasModal = true;