workspaces-view: Handle clip rectangle separately
After completing the overview transition, the workspace view is clipped to avoid overlapping the search entry/view selector titles while switching workspaces. For clipping, the view's position and size was used, which works well assuming that the workspace pager will start hidden or stay zoomed out while the overview is visible. However, that assumption holds no longer true, as auto-hiding the pager now depends on the number of workspaces, and thus may change while in the overview. For instance, when starting with the pager being visible, the clip area ends up being too small when moving all windows to the first workspace (and thus triggering auto-hide). As a fix, handle the clip rectangle separately from the view's geometry, and set it always to the area the workspaces would occupy with the pager hidden. https://bugzilla.gnome.org/show_bug.cgi?id=653142
This commit is contained in:
parent
e39e539ee9
commit
6ce07abf50
@ -49,6 +49,10 @@ WorkspacesView.prototype = {
|
|||||||
this._height = 0;
|
this._height = 0;
|
||||||
this._x = 0;
|
this._x = 0;
|
||||||
this._y = 0;
|
this._y = 0;
|
||||||
|
this._clipX = 0;
|
||||||
|
this._clipY = 0;
|
||||||
|
this._clipWidth = 0;
|
||||||
|
this._clipHeight = 0;
|
||||||
this._workspaceRatioSpacing = 0;
|
this._workspaceRatioSpacing = 0;
|
||||||
this._spacing = 0;
|
this._spacing = 0;
|
||||||
this._animating = false; // tweening
|
this._animating = false; // tweening
|
||||||
@ -92,7 +96,8 @@ WorkspacesView.prototype = {
|
|||||||
this._overviewShownId =
|
this._overviewShownId =
|
||||||
Main.overview.connect('shown',
|
Main.overview.connect('shown',
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
this.actor.set_clip(this._x, this._y, this._width, this._height);
|
this.actor.set_clip(this._clipX, this._clipY,
|
||||||
|
this._clipWidth, this._clipHeight);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._scrollAdjustment = new St.Adjustment({ value: activeWorkspaceIndex,
|
this._scrollAdjustment = new St.Adjustment({ value: activeWorkspaceIndex,
|
||||||
@ -136,6 +141,13 @@ WorkspacesView.prototype = {
|
|||||||
this._workspaces[i].setGeometry(x, y, width, height);
|
this._workspaces[i].setGeometry(x, y, width, height);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setClipRect: function(x, y, width, height) {
|
||||||
|
this._clipX = x;
|
||||||
|
this._clipY = y;
|
||||||
|
this._clipWidth = width;
|
||||||
|
this._clipHeight = height;
|
||||||
|
},
|
||||||
|
|
||||||
_lookupWorkspaceForMetaWindow: function (metaWindow) {
|
_lookupWorkspaceForMetaWindow: function (metaWindow) {
|
||||||
for (let i = 0; i < this._workspaces.length; i++) {
|
for (let i = 0; i < this._workspaces.length; i++) {
|
||||||
if (this._workspaces[i].containsMetaWindow(metaWindow))
|
if (this._workspaces[i].containsMetaWindow(metaWindow))
|
||||||
@ -751,6 +763,13 @@ WorkspacesDisplay.prototype = {
|
|||||||
|
|
||||||
let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL);
|
let rtl = (St.Widget.get_default_direction () == St.TextDirection.RTL);
|
||||||
|
|
||||||
|
let clipWidth = width - controlsVisible;
|
||||||
|
let clipHeight = (fullHeight / fullWidth) * clipWidth;
|
||||||
|
let clipX = rtl ? x + controlsVisible : x;
|
||||||
|
let clipY = y + (fullHeight - clipHeight) / 2;
|
||||||
|
|
||||||
|
this.workspacesView.setClipRect(clipX, clipY, clipWidth, clipHeight);
|
||||||
|
|
||||||
if (this._zoomOut) {
|
if (this._zoomOut) {
|
||||||
width -= controlsNatural;
|
width -= controlsNatural;
|
||||||
if (rtl)
|
if (rtl)
|
||||||
|
Loading…
Reference in New Issue
Block a user