diff --git a/panel.js b/panel.js index 4f13dba..a8c1a58 100644 --- a/panel.js +++ b/panel.js @@ -1175,7 +1175,7 @@ var dtpPanel = Utils.defineClass({ _setVertical: function(actor, isVertical) { let _set = (actor, isVertical) => { - if (!actor || actor instanceof Dash.DashItemContainer) { + if (!actor || actor instanceof Dash.DashItemContainer || actor instanceof Taskbar.TaskbarItemContainer) { return; } diff --git a/panelManager.js b/panelManager.js index 27efd70..0ddc641 100755 --- a/panelManager.js +++ b/panelManager.js @@ -166,12 +166,7 @@ var dtpPanelManager = Utils.defineClass({ this._oldGetShowAppsButton = Main.overview.getShowAppsButton; Main.overview.getShowAppsButton = this._newGetShowAppsButton.bind(this); - this._needsDashItemContainerAllocate = !Dash.DashItemContainer.prototype.hasOwnProperty('vfunc_allocate'); - - if (this._needsDashItemContainerAllocate) { - Utils.hookVfunc(Dash.DashItemContainer.prototype, 'allocate', this._newDashItemContainerAllocate); - } - + // Since Gnome 3.8 dragging an app without having opened the overview before cause the attemp to //animate a null target since some variables are not initialized when the viewSelector is created if(Main.overview.viewSelector._activePage == null) @@ -355,10 +350,6 @@ var dtpPanelManager = Utils.defineClass({ Utils.getPanelGhost().set_size(-1, -1); - if (this._needsDashItemContainerAllocate) { - Utils.hookVfunc(Dash.DashItemContainer.prototype, 'allocate', function(box, flags) { this.vfunc_allocate(box, flags); }); - } - if (this._oldDoSpringAnimation) { AppDisplay.BaseAppView.prototype._doSpringAnimation = this._oldDoSpringAnimation; } @@ -584,30 +575,7 @@ var dtpPanelManager = Utils.defineClass({ let focusedMonitorIndex = Utils.findIndex(this.allPanels, p => this.checkIfFocusedMonitor(p.monitor)); return this.allPanels[focusedMonitorIndex].taskbar.showAppsButton; - }, - - _newDashItemContainerAllocate: function(box, flags) { - if (this.child == null) - return; - - Utils.setAllocation(this, box, flags); - - let availWidth = box.x2 - box.x1; - let availHeight = box.y2 - box.y1; - let [minChildWidth, minChildHeight, natChildWidth, natChildHeight] = this.child.get_preferred_size(); - let [childScaleX, childScaleY] = this.child.get_scale(); - - let childWidth = Math.min(natChildWidth * childScaleX, availWidth); - let childHeight = Math.min(natChildHeight * childScaleY, availHeight); - let childBox = new Clutter.ActorBox(); - - childBox.x1 = (availWidth - childWidth) / 2; - childBox.y1 = (availHeight - childHeight) / 2; - childBox.x2 = childBox.x1 + childWidth; - childBox.y2 = childBox.y1 + childHeight; - - Utils.allocate(this.child, childBox, flags); - }, + } }); // This class drives long-running icon animations, to keep them running in sync diff --git a/taskbar.js b/taskbar.js index 7ff8404..5feb1a9 100644 --- a/taskbar.js +++ b/taskbar.js @@ -1377,6 +1377,29 @@ const TaskbarItemContainer = Utils.defineClass({ Name: 'DashToPanel-TaskbarItemContainer', Extends: Dash.DashItemContainer, + vfunc_allocate: function(box, flags) { + if (this.child == null) + return; + + Utils.setAllocation(this, box, flags); + + let availWidth = box.x2 - box.x1; + let availHeight = box.y2 - box.y1; + let [minChildWidth, minChildHeight, natChildWidth, natChildHeight] = this.child.get_preferred_size(); + let [childScaleX, childScaleY] = this.child.get_scale(); + + let childWidth = Math.min(natChildWidth * childScaleX, availWidth); + let childHeight = Math.min(natChildHeight * childScaleY, availHeight); + let childBox = new Clutter.ActorBox(); + + childBox.x1 = (availWidth - childWidth) / 2; + childBox.y1 = (availHeight - childHeight) / 2; + childBox.x2 = childBox.x1 + childWidth; + childBox.y2 = childBox.y1 + childHeight; + + Utils.allocate(this.child, childBox, flags); + }, + // In case appIcon is removed from the taskbar while it is hovered, // restore opacity before dashItemContainer.animateOutAndDestroy does the destroy animation. animateOutAndDestroy: function() {