Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for 3.38 #214

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
52 changes: 13 additions & 39 deletions [email protected]/dockedWorkspaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Clutter = imports.gi.Clutter;
const Graphene = imports.gi.Graphene;
const Lang = imports.lang;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
Expand Down Expand Up @@ -133,8 +134,8 @@ var MyThumbnailsSlider = GObject.registerClass({
super._init(params);
}

vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
vfunc_allocate(box) {
this.set_allocation(box);

if (this.child == null)
return;
Expand Down Expand Up @@ -168,7 +169,7 @@ var MyThumbnailsSlider = GObject.registerClass({
childBox.y2 = slideoutSize + this._slidex * (childHeight - slideoutSize);
}

this.child.allocate(childBox, flags);
this.child.allocate(childBox);
this.child.set_clip(-childBox.x1, -childBox.y1,
-childBox.x1+availWidth, -childBox.y1 + availHeight);
}
Expand Down Expand Up @@ -523,14 +524,14 @@ var DockedWorkspaces = class WorkspacesToDock_DockedWorkspaces {

// Connect DashToDock hover signal if the extension is already loaded and enabled
this._hoveringDash = false;

DashToDockExtension = Main.extensionManager.lookup(DashToDock_UUID);
UbuntuDockExtension = Main.extensionManager.lookup(UbuntuDock_UUID);

if (UbuntuDockExtension) {
DashToDockExtension = UbuntuDockExtension;
}

if (DashToDockExtension) {
if (DashToDockExtension.state == ExtensionUtils.ExtensionState.ENABLED) {
if (_DEBUG_) global.log("dockeWorkspaces: init - DashToDock extension is installed and enabled");
Expand Down Expand Up @@ -1005,29 +1006,11 @@ var DockedWorkspaces = class WorkspacesToDock_DockedWorkspaces {
geometry.height -= controlsHeight;
if (_DEBUG_) global.log("WORKSPACESDISPLAY - FINAL GEOMETRY.X = "+geometry.x+" Y = "+geometry.y+" W = "+geometry.width+" H = "+geometry.height);

this._workspacesViews[i].setMyActualGeometry(geometry);
const { gx, gy, gwidth, gheight } = geometry;
this._workspacesViews[i].set({ gx, gy, gwidth, gheight });
}
};

// This override is needed to prevent calls from updateWorkspacesActualGeometry bound to the workspacesDisplay object
// without destroying and recreating Main.overview.viewSelector._workspacesDisplay.
// We replace this function with a new setMyActualGeometry function (see below)
// TODO: This is very hackish. We need to find a better way to accomplish this
GSFunctions['WorkspacesViewBase_setActualGeometry'] = WorkspacesView.WorkspacesViewBase.prototype.setActualGeometry;
WorkspacesView.WorkspacesViewBase.prototype.setActualGeometry = function(geom) {
if (_DEBUG_) global.log("WORKSPACESVIEW - setActualGeometry");
//GSFunctions['WorkspacesView_setActualGeometry'].call(this, geom);
return;
};

// This additional function replaces the WorkspacesView setActualGeometry function above.
// TODO: This is very hackish. We need to find a better way to accomplish this
WorkspacesView.WorkspacesViewBase.prototype.setMyActualGeometry = function(geom) {
if (_DEBUG_) global.log("WORKSPACESVIEW - setMyActualGeometry");
this._actualGeometry = geom;
this._syncActualGeometry();
};

this._overrideComplete = true;
}

Expand Down Expand Up @@ -2353,25 +2336,21 @@ var DockedWorkspaces = class WorkspacesToDock_DockedWorkspaces {
width = this._monitor.width - (margin * 2);
}

// Get y position, height, and anchorpoint
// Get y position and height
height = this._thumbnailsBox._thumbnailsBoxHeight + shortcutsPanelThickness + screenEdgePadding;
if (this._position == St.Side.TOP) {
y = this._monitor.y;
anchorPoint = Clutter.Gravity.NORTH_WEST;
} else {
y = this._monitor.y + this._monitor.height;
anchorPoint = Clutter.Gravity.SOUTH_WEST;
y = this._monitor.y + this._monitor.height - (height + 1);
}

} else {
// Get x position, width, and anchorpoint
// Get x position and widtht
width = this._thumbnailsBox._thumbnailsBoxWidth + shortcutsPanelThickness + screenEdgePadding;
if (this._position == St.Side.LEFT) {
x = this._monitor.x;
anchorPoint = Clutter.Gravity.NORTH_WEST;
} else {
x = this._monitor.x + this._monitor.width;
anchorPoint = Clutter.Gravity.NORTH_EAST;
x = this._monitor.x + this._monitor.width - (width + 1);
}

// Get y position and height
Expand Down Expand Up @@ -2473,11 +2452,6 @@ var DockedWorkspaces = class WorkspacesToDock_DockedWorkspaces {
this.actor.set_size(width + this._triggerWidth, height);
}
}

// Set anchor points
this.actor.move_anchor_point_from_gravity(anchorPoint);
this._struts.move_anchor_point_from_gravity(anchorPoint);

// Update slider slideout width
let slideoutSize = this._settings.get_boolean('dock-edge-visible') ? this._triggerWidth + DOCK_EDGE_VISIBLE_WIDTH : this._triggerWidth;
this._slider.slideoutSize = slideoutSize;
Expand Down
26 changes: 14 additions & 12 deletions [email protected]/intellihide.js
Original file line number Diff line number Diff line change
Expand Up @@ -854,28 +854,30 @@ var Intellihide = class WorkspacesToDock_Intellihide {
let rect = win.get_frame_rect();
let [dx, dy] = this._dock.actor.get_position();
let [dw, dh] = this._dock.actor.get_size();
let [dcx, dcy] = this._dock.actor.get_transformed_position();
let [dcw, dch] = this._dock.actor.get_size();

// SANITY CHECK
// global.log("dx="+dx+" dy="+dy+" || dcx="+Math.round(dcx)+" dcy="+dcy);
// global.log("dw="+dw+" dh="+dh+" || dcw="+dcw+" dch="+dch);

if (this._dock._isHorizontal) {
dx = dcx;
dw = dcw;
let intellihideAction = this._settings.get_enum('intellihide-action');
if (intellihideAction == IntellihideAction.SHOW_PARTIAL || intellihideAction == IntellihideAction.SHOW_PARTIAL_FIXED) {
if (this._dock._slider.partialSlideoutSize)
dh = this._dock._slider.partialSlideoutSize;
if (this._dock._slider.partialSlideoutSize){
if(this._dock._position == St.Side.BOTTOM) {
dy += (dh - this._dock._slider.partialSlideoutSize);
}
dh -= (dh - this._dock._slider.partialSlideoutSize);
}
}
} else {
dy = dcy;
dh = dch;
let intellihideAction = this._settings.get_enum('intellihide-action');
if (intellihideAction == IntellihideAction.SHOW_PARTIAL || intellihideAction == IntellihideAction.SHOW_PARTIAL_FIXED) {
if (this._dock._slider.partialSlideoutSize)
dw = this._dock._slider.partialSlideoutSize;
if (this._dock._slider.partialSlideoutSize){
if(this._dock._position == St.Side.RIGHT) {
dx += (dw - this._dock._slider.partialSlideoutSize);
}
dw -= (dw - this._dock._slider.partialSlideoutSize);
}
}
}

Expand All @@ -884,9 +886,9 @@ var Intellihide = class WorkspacesToDock_Intellihide {
if (this._dock._position == St.Side.LEFT || this._dock._position == St.Side.TOP) {
test = (rect.x < dx + dw) && (rect.x + rect.width > dx) && (rect.y < dy + dh) && (rect.y + rect.height > dy);
} else if (this._dock._position == St.Side.RIGHT) {
test = (rect.x < dx) && (rect.x + rect.width > dx - dw) && (rect.y < dy + dh) && (rect.y + rect.height > dy);
test = (rect.x < dx + dw) && (rect.x + rect.width > dx) && (rect.y < dy + dh) && (rect.y + rect.height > dy);
} else if (this._dock._position == St.Side.BOTTOM) {
test = (rect.x < dx + dw) && (rect.x + rect.width > dx) && (rect.y + rect.height > dy - dh) && (rect.y < dy);
test = (rect.x < dx + dw) && (rect.x + rect.width > dx) && (rect.y + rect.height > dy) && (rect.y < dy + dy);
}
if (test) {
overlaps = true;
Expand Down
4 changes: 2 additions & 2 deletions [email protected]/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "Workspaces to Dock",
"description": "Transform Gnome Shell's overview workspaces into an intelligent dock.",
"original-author": "[email protected]",
"shell-version": ["3.36"],
"shell-version": ["3.38"],
"url": "https://github.com/passingthru67/workspaces-to-dock",
"uuid": "[email protected]",
"gettext-domain": "workspacestodock",
"version": 53
"version": 54
}
1 change: 0 additions & 1 deletion [email protected]/myWorkspaceSwitcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const Lang = imports.lang;
const Main = imports.ui.main;
const WorkspacesView = imports.ui.workspacesView;
const WindowManager = imports.ui.windowManager;
const Tweener = imports.ui.tweener;

const Me = imports.misc.extensionUtils.getCurrentExtension();
const Convenience = Me.imports.convenience;
Expand Down
26 changes: 16 additions & 10 deletions [email protected]/myWorkspaceThumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,14 @@ var MyWorkspaceThumbnail = GObject.registerClass({
if (this.state > ThumbnailState.NORMAL)
return false;

if (source.realWindow) {
let win = source.realWindow;
if (source.metaWindow) {
var win;
if(source.realWindow) {
win = source.realWindow;
} else {
win = source.metaWindow.get_compositor_private();
}

if (this._isMyWindow(win))
return false;

Expand Down Expand Up @@ -1104,7 +1110,7 @@ var MyThumbnailsBox = GObject.registerClass({

// Draggable target interface
handleDragOver(source, actor, x, y, time) {
if (!source._caption && !source.realWindow &&
if (!source._caption && !source.metaWindow &&
(!source.app || !source.app.can_open_new_window()) &&
(source.app || !source.shellWorkspaceLaunch) &&
source != Main.xdndHandler)
Expand Down Expand Up @@ -1654,8 +1660,8 @@ var MyThumbnailsBox = GObject.registerClass({
this.queue_relayout();
}

vfunc_allocate(box, flags) {
this.set_allocation(box, flags);
vfunc_allocate(box) {
this.set_allocation(box);

this._thumbnailsBoxWidth = this.width;
this._thumbnailsBoxHeight = this.height;
Expand Down Expand Up @@ -1809,7 +1815,7 @@ var MyThumbnailsBox = GObject.registerClass({
childBox.y2 = y2;
childBox.x1 = Math.round(x);
childBox.x2 = Math.round(x + placeholderWidth);
this._dropPlaceholder.allocate(childBox, flags);
this._dropPlaceholder.allocate(childBox);
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._dropPlaceholder.show();
});
Expand Down Expand Up @@ -1839,7 +1845,7 @@ var MyThumbnailsBox = GObject.registerClass({
childBox.y2 = y1 + portholeHeight + (captionBackgroundHeight/roundedVScale);

thumbnail.set_scale(roundedHScale, roundedVScale);
thumbnail.allocate(childBox, flags);
thumbnail.allocate(childBox);

// passingthru67 - set myWorkspaceThumbnail labels
if (this._mySettings.get_boolean('workspace-captions'))
Expand Down Expand Up @@ -1885,7 +1891,7 @@ var MyThumbnailsBox = GObject.registerClass({
childBox.x2 = x2;
childBox.y1 = Math.round(y);
childBox.y2 = Math.round(y + placeholderHeight);
this._dropPlaceholder.allocate(childBox, flags);
this._dropPlaceholder.allocate(childBox);
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, () => {
this._dropPlaceholder.show();
});
Expand Down Expand Up @@ -1917,7 +1923,7 @@ var MyThumbnailsBox = GObject.registerClass({
childBox.y2 = y1 + portholeHeight + (captionBackgroundHeight/roundedVScale);

thumbnail.set_scale(roundedHScale, roundedVScale);
thumbnail.allocate(childBox, flags);
thumbnail.allocate(childBox);

// passingthru67 - set myWorkspaceThumbnail labels
if (this._mySettings.get_boolean('workspace-captions'))
Expand All @@ -1944,7 +1950,7 @@ var MyThumbnailsBox = GObject.registerClass({
childBox.y2 = (indicatorY2 ? indicatorY2 + captionBackgroundHeight : (indicatorY1 + thumbnailHeight + captionBackgroundHeight)) + indicatorBottomFullBorder;
}

this._indicator.allocate(childBox, flags);
this._indicator.allocate(childBox);
}

_activeWorkspaceChanged(_wm, _from, _to, _direction) {
Expand Down
2 changes: 1 addition & 1 deletion [email protected]/shortcutsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ var ShortcutButton = GObject.registerClass({
// Adjust 'places' symbolic icons by reducing their size
// and setting a special class for button padding
this._iconSize -= 4;
this.actor.add_style_class_name('workspacestodock-shortcut-button-symbolic');
this.add_style_class_name('workspacestodock-shortcut-button-symbolic');
return new St.Icon({gicon: this.app.icon, icon_size: iconSize});
} else if (this._type == ApplicationType.RECENT) {
let gicon = Gio.content_type_get_icon(this.app.mime);
Expand Down
61 changes: 31 additions & 30 deletions [email protected]/thumbnailCaption.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ const _DEBUG_ = false;

const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Clutter = imports.gi.Clutter;
const Lang = imports.lang;
const Meta = imports.gi.Meta;
const Shell = imports.gi.Shell;
const Signals = imports.signals;
const St = imports.gi.St;
const Graphene = imports.gi.Graphene;

const Main = imports.ui.main;
const WorkspacesView = imports.ui.workspacesView;
Expand Down Expand Up @@ -55,8 +57,10 @@ function getPosition(settings) {
return position;
}

var TaskbarIcon = class WorkspacesToDock_TaskbarIcon {
constructor(app, metaWin, caption) {

var TaskbarIcon = GObject.registerClass({},
class WorkspacesToDock_TaskbarIcon extends GObject.Object {
_init(app, metaWin, caption) {
this._caption = caption;
this._mySettings = caption._mySettings;
this._app = app;
Expand Down Expand Up @@ -227,7 +231,7 @@ var TaskbarIcon = class WorkspacesToDock_TaskbarIcon {
}
});
}
};
});

var MenuTaskListItem = class WorkspacesToDock_MenuTaskListItem {
constructor(app, metaWin, caption) {
Expand Down Expand Up @@ -334,7 +338,6 @@ var ThumbnailCaption = class WorkspacesToDock_ThumbnailCaption {
name: 'workspacestodockCaptionContainer',
reactive: false,
style_class: 'workspacestodock-workspace-caption-container',
x_fill: true,
y_align: this._captionYAlign,
x_align: Clutter.ActorAlign.START
});
Expand Down Expand Up @@ -643,23 +646,22 @@ var ThumbnailCaption = class WorkspacesToDock_ThumbnailCaption {
let app = tracker.get_window_app(metaWin);
if (app) {
if (_DEBUG_) global.log("myWorkspaceThumbnail: _initTaskbar - window button app = "+app.get_name());
let button = new TaskbarIcon(app, metaWin, this);
if (metaWin.has_focus()) {
button.actor.add_style_class_name('workspacestodock-caption-windowapps-button-active');
}
if(this._taskBarBox){
let button = new TaskbarIcon(app, metaWin, this);
if (metaWin.has_focus()) {
button.actor.add_style_class_name('workspacestodock-caption-windowapps-button-active');
}

if ((this._isMyWindow(windows[i]) && this._isOverviewWindow(windows[i])) ||
(this._isMyWindow(windows[i]) && this._isMinimizedWindow(windows[i])) ||
this._showWindowAppOnThisWorkspace(windows[i])) {
button.actor.visible = true;
} else {
button.actor.visible = false;
}
if ((this._isMyWindow(windows[i]) && this._isOverviewWindow(windows[i])) ||
(this._isMyWindow(windows[i]) && this._isMinimizedWindow(windows[i])) ||
this._showWindowAppOnThisWorkspace(windows[i])) {
button.actor.visible = true;
} else {
button.actor.visible = false;
}

if (this._taskBarBox) {
this._taskBarBox.add_actor(button.actor);
}

let winInfo = {};
winInfo.app = app;
winInfo.metaWin = metaWin;
Expand Down Expand Up @@ -914,20 +916,19 @@ var ThumbnailCaption = class WorkspacesToDock_ThumbnailCaption {
let app = tracker.get_window_app(metaWin);
if (app) {
if (_DEBUG_) global.log("myWorkspaceThumbnail: updateTaskbar - window button app = "+app.get_name());
let button = new TaskbarIcon(app, metaWin, this);
if (metaWin.has_focus()) {
button.actor.add_style_class_name('workspacestodock-caption-windowapps-button-active');
}

if ((this._isMyWindow(metaWin, true) && this._isOverviewWindow(metaWin, true)) ||
(this._isMyWindow(metaWin, true) && this._isMinimizedWindow(metaWin, true)) ||
this._showWindowAppOnThisWorkspace(metaWin, true)) {
button.actor.visible = true;
} else {
button.actor.visible = false;
}

if (this._taskBarBox) {
let button = new TaskbarIcon(app, metaWin, this);
if (metaWin.has_focus()) {
button.actor.add_style_class_name('workspacestodock-caption-windowapps-button-active');
}

if ((this._isMyWindow(metaWin, true) && this._isOverviewWindow(metaWin, true)) ||
(this._isMyWindow(metaWin, true) && this._isMinimizedWindow(metaWin, true)) ||
this._showWindowAppOnThisWorkspace(metaWin, true)) {
button.actor.visible = true;
} else {
button.actor.visible = false;
}
this._taskBarBox.add_actor(button.actor);
}

Expand Down