From 4f87e8660304405cabe987e5949e54096b8009d5 Mon Sep 17 00:00:00 2001 From: Joost Verdoorn Date: Tue, 13 Mar 2012 01:58:34 +0100 Subject: [PATCH] overview: Don't show workspaces when entering the overview If the user has their mouse over the workspace thumbnails while entering the overview, it's more likely that it's a coincidence that their mouse pointer is in the area. Avoid expanding the thumbnails box in that case. https://bugzilla.gnome.org/show_bug.cgi?id=651092 --- js/ui/workspacesView.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index eed675eb6..272aa47f3 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -509,6 +509,7 @@ const WorkspacesDisplay = new Lang.Class({ this._inDrag = false; this._cancelledDrag = false; + this._controlsInitiallyHovered = false; this._alwaysZoomOut = false; this._zoomOut = false; this._zoomFraction = 0; @@ -543,6 +544,19 @@ const WorkspacesDisplay = new Lang.Class({ }, show: function() { + if(!this._alwaysZoomOut) { + let [mouseX, mouseY] = global.get_pointer(); + let [x, y] = this._controls.get_transformed_position(); + let [width, height] = this._controls.get_transformed_size(); + let visibleWidth = this._controls.get_theme_node().get_length('visible-width'); + let rtl = (Clutter.get_default_text_direction () == Clutter.TextDirection.RTL); + if(rtl) + x = x + width - visibleWidth; + if(mouseX > x - 0.5 && mouseX < x + visibleWidth + 0.5 && + mouseY > y - 0.5 && mouseY < y + height + 0.5) + this._controlsInitiallyHovered = true; + } + this._zoomOut = this._alwaysZoomOut; this._zoomFraction = this._alwaysZoomOut ? 1 : 0; this._updateZoom(); @@ -591,6 +605,9 @@ const WorkspacesDisplay = new Lang.Class({ this._controls.hide(); this._thumbnailsBox.hide(); + if (!this._alwaysZoomOut) + this.zoomFraction = 0; + if (this._restackedNotifyId > 0){ global.screen.disconnect(this._restackedNotifyId); this._restackedNotifyId = 0; @@ -996,7 +1013,10 @@ const WorkspacesDisplay = new Lang.Class({ }, _onControlsHoverChanged: function() { - this._updateZoom(); + if(!this._controls.hover) + this._controlsInitiallyHovered = false; + if(!this._controlsInitiallyHovered) + this._updateZoom(); }, _dragBegin: function() {