From f0113c5ff53ee9bc9f7c8fc91f26cd9f910f0952 Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Wed, 22 May 2013 18:05:24 +0200 Subject: [PATCH] Overview: use a normal chrome actor to handle events during XDND Instead of using the input mode, when the overview is not modal it should use a Chrome-tracked actor, that is added to the input region. Because the overview always takes pointer input when visible, the actor is added at startup, and it is shown and hidden as needed. https://bugzilla.gnome.org/show_bug.cgi?id=700735 --- js/ui/layout.js | 20 +++++++++++--------- js/ui/overview.js | 30 +++++++++++------------------- 2 files changed, 22 insertions(+), 28 deletions(-) diff --git a/js/ui/layout.js b/js/ui/layout.js index bf9edbd5d..11b62ca60 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -189,11 +189,13 @@ const LayoutManager = new Lang.Class({ this.uiGroup.add_actor(global.window_group); global.stage.remove_actor(global.overlay_group); - this.overviewGroup = new St.Widget({ name: 'overviewGroup' }); - this.uiGroup.add_actor(this.overviewGroup); global.stage.add_child(this.uiGroup); + this.overviewGroup = new St.Widget({ name: 'overviewGroup', + visible: false }); + this.addChrome(this.overviewGroup); + this.screenShieldGroup = new St.Widget({ name: 'screenShieldGroup', visible: false, clip_to_allocation: true, @@ -244,24 +246,24 @@ const LayoutManager = new Lang.Class({ this._monitorsChanged(); }, - // This is called by Main after everything else is constructed; - // it needs access to Main.overview, which didn't exist - // yet when the LayoutManager was constructed. + // This is called by Main after everything else is constructed init: function() { - Main.overview.connect('showing', Lang.bind(this, this._overviewShowing)); - Main.overview.connect('hidden', Lang.bind(this, this._overviewHidden)); Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated)); this._prepareStartupAnimation(); }, - _overviewShowing: function() { + showOverview: function() { + this.overviewGroup.show(); + this._inOverview = true; this._updateVisibility(); this._queueUpdateRegions(); }, - _overviewHidden: function() { + hideOverview: function() { + this.overviewGroup.hide(); + this._inOverview = false; this._updateVisibility(); this._queueUpdateRegions(); diff --git a/js/ui/overview.js b/js/ui/overview.js index bc8e8979d..6165158b3 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -133,7 +133,6 @@ const Overview = new Lang.Class({ this._backgroundGroup = new Meta.BackgroundGroup(); Main.layoutManager.overviewGroup.add_child(this._backgroundGroup); - this._backgroundGroup.hide(); this._bgManagers = []; this._activationTime = 0; @@ -152,7 +151,6 @@ const Overview = new Lang.Class({ this._overview.add_actor(this._coverPane); this._coverPane.connect('event', Lang.bind(this, function (actor, event) { return true; })); - this._stack.hide(); this._stack.add_actor(this._overview); Main.layoutManager.overviewGroup.add_child(this._stack); @@ -464,16 +462,17 @@ const Overview = new Lang.Class({ // show: // // Animates the overview visible and grabs mouse and keyboard input - show : function() { + show: function() { if (this.isDummy) return; if (this._shown) return; this._shown = true; - if (!this._syncInputMode()) + if (!this._syncGrab()) return; + Main.layoutManager.showOverview(); this._animateVisible(); }, @@ -523,8 +522,6 @@ const Overview = new Lang.Class({ // // Disable unredirection while in the overview Meta.disable_unredirect_for_screen(global.screen); - this._stack.show(); - this._backgroundGroup.show(); this._viewSelector.show(); this._stack.opacity = 0; @@ -565,7 +562,7 @@ const Overview = new Lang.Class({ this._animateNotVisible(); this._shown = false; - this._syncInputMode(); + this._syncGrab(); }, toggle: function() { @@ -596,8 +593,8 @@ const Overview = new Lang.Class({ //// Private methods //// - _syncInputMode: function() { - // We delay input mode changes during animation so that when removing the + _syncGrab: function() { + // We delay grab changes during animation so that when removing the // overview we don't have a problem with the release of a press/release // going to an application. if (this.animationInProgress) @@ -615,16 +612,12 @@ const Overview = new Lang.Class({ return false; } } - } else { - global.stage_input_mode = Shell.StageInputMode.FULLSCREEN; } } else { if (this._modal) { Main.popModal(this._overview); this._modal = false; } - else if (global.stage_input_mode == Shell.StageInputMode.FULLSCREEN) - global.stage_input_mode = Shell.StageInputMode.NORMAL; } return true; }, @@ -663,7 +656,7 @@ const Overview = new Lang.Class({ if (!this._shown) this._animateNotVisible(); - this._syncInputMode(); + this._syncGrab(); global.sync_pointer(); }, @@ -673,20 +666,19 @@ const Overview = new Lang.Class({ this._viewSelector.hide(); this._desktopFade.hide(); - this._backgroundGroup.hide(); - this._stack.hide(); + this._coverPane.hide(); this.visible = false; this.animationInProgress = false; - this._coverPane.hide(); - this.emit('hidden'); // Handle any calls to show* while we were hiding if (this._shown) this._animateVisible(); + else + Main.layoutManager.hideOverview(); - this._syncInputMode(); + this._syncGrab(); // Fake a pointer event if requested if (this._needsFakePointerEvent) {