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
This commit is contained in:
Giovanni Campagna 2013-05-22 18:05:24 +02:00
parent a259016436
commit f0113c5ff5
2 changed files with 22 additions and 28 deletions

View File

@ -189,11 +189,13 @@ const LayoutManager = new Lang.Class({
this.uiGroup.add_actor(global.window_group); this.uiGroup.add_actor(global.window_group);
global.stage.remove_actor(global.overlay_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); 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', this.screenShieldGroup = new St.Widget({ name: 'screenShieldGroup',
visible: false, visible: false,
clip_to_allocation: true, clip_to_allocation: true,
@ -244,24 +246,24 @@ const LayoutManager = new Lang.Class({
this._monitorsChanged(); this._monitorsChanged();
}, },
// This is called by Main after everything else is constructed; // 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.
init: function() { 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)); Main.sessionMode.connect('updated', Lang.bind(this, this._sessionUpdated));
this._prepareStartupAnimation(); this._prepareStartupAnimation();
}, },
_overviewShowing: function() { showOverview: function() {
this.overviewGroup.show();
this._inOverview = true; this._inOverview = true;
this._updateVisibility(); this._updateVisibility();
this._queueUpdateRegions(); this._queueUpdateRegions();
}, },
_overviewHidden: function() { hideOverview: function() {
this.overviewGroup.hide();
this._inOverview = false; this._inOverview = false;
this._updateVisibility(); this._updateVisibility();
this._queueUpdateRegions(); this._queueUpdateRegions();

View File

@ -133,7 +133,6 @@ const Overview = new Lang.Class({
this._backgroundGroup = new Meta.BackgroundGroup(); this._backgroundGroup = new Meta.BackgroundGroup();
Main.layoutManager.overviewGroup.add_child(this._backgroundGroup); Main.layoutManager.overviewGroup.add_child(this._backgroundGroup);
this._backgroundGroup.hide();
this._bgManagers = []; this._bgManagers = [];
this._activationTime = 0; this._activationTime = 0;
@ -152,7 +151,6 @@ const Overview = new Lang.Class({
this._overview.add_actor(this._coverPane); this._overview.add_actor(this._coverPane);
this._coverPane.connect('event', Lang.bind(this, function (actor, event) { return true; })); this._coverPane.connect('event', Lang.bind(this, function (actor, event) { return true; }));
this._stack.hide();
this._stack.add_actor(this._overview); this._stack.add_actor(this._overview);
Main.layoutManager.overviewGroup.add_child(this._stack); Main.layoutManager.overviewGroup.add_child(this._stack);
@ -464,16 +462,17 @@ const Overview = new Lang.Class({
// show: // show:
// //
// Animates the overview visible and grabs mouse and keyboard input // Animates the overview visible and grabs mouse and keyboard input
show : function() { show: function() {
if (this.isDummy) if (this.isDummy)
return; return;
if (this._shown) if (this._shown)
return; return;
this._shown = true; this._shown = true;
if (!this._syncInputMode()) if (!this._syncGrab())
return; return;
Main.layoutManager.showOverview();
this._animateVisible(); this._animateVisible();
}, },
@ -523,8 +522,6 @@ const Overview = new Lang.Class({
// //
// Disable unredirection while in the overview // Disable unredirection while in the overview
Meta.disable_unredirect_for_screen(global.screen); Meta.disable_unredirect_for_screen(global.screen);
this._stack.show();
this._backgroundGroup.show();
this._viewSelector.show(); this._viewSelector.show();
this._stack.opacity = 0; this._stack.opacity = 0;
@ -565,7 +562,7 @@ const Overview = new Lang.Class({
this._animateNotVisible(); this._animateNotVisible();
this._shown = false; this._shown = false;
this._syncInputMode(); this._syncGrab();
}, },
toggle: function() { toggle: function() {
@ -596,8 +593,8 @@ const Overview = new Lang.Class({
//// Private methods //// //// Private methods ////
_syncInputMode: function() { _syncGrab: function() {
// We delay input mode changes during animation so that when removing the // 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 // overview we don't have a problem with the release of a press/release
// going to an application. // going to an application.
if (this.animationInProgress) if (this.animationInProgress)
@ -615,16 +612,12 @@ const Overview = new Lang.Class({
return false; return false;
} }
} }
} else {
global.stage_input_mode = Shell.StageInputMode.FULLSCREEN;
} }
} else { } else {
if (this._modal) { if (this._modal) {
Main.popModal(this._overview); Main.popModal(this._overview);
this._modal = false; this._modal = false;
} }
else if (global.stage_input_mode == Shell.StageInputMode.FULLSCREEN)
global.stage_input_mode = Shell.StageInputMode.NORMAL;
} }
return true; return true;
}, },
@ -663,7 +656,7 @@ const Overview = new Lang.Class({
if (!this._shown) if (!this._shown)
this._animateNotVisible(); this._animateNotVisible();
this._syncInputMode(); this._syncGrab();
global.sync_pointer(); global.sync_pointer();
}, },
@ -673,20 +666,19 @@ const Overview = new Lang.Class({
this._viewSelector.hide(); this._viewSelector.hide();
this._desktopFade.hide(); this._desktopFade.hide();
this._backgroundGroup.hide(); this._coverPane.hide();
this._stack.hide();
this.visible = false; this.visible = false;
this.animationInProgress = false; this.animationInProgress = false;
this._coverPane.hide();
this.emit('hidden'); this.emit('hidden');
// Handle any calls to show* while we were hiding // Handle any calls to show* while we were hiding
if (this._shown) if (this._shown)
this._animateVisible(); this._animateVisible();
else
Main.layoutManager.hideOverview();
this._syncInputMode(); this._syncGrab();
// Fake a pointer event if requested // Fake a pointer event if requested
if (this._needsFakePointerEvent) { if (this._needsFakePointerEvent) {