Skip to content

Commit

Permalink
Update for 3.38
Browse files Browse the repository at this point in the history
  • Loading branch information
RensAlthuis committed Oct 8, 2020
1 parent 473fa02 commit b1a3571
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 58 deletions.
54 changes: 15 additions & 39 deletions workspaces-to-dock@passingthru67.gmail.com/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 All @@ -2395,7 +2374,9 @@ var DockedWorkspaces = class WorkspacesToDock_DockedWorkspaces {

// Update position of main actor (used to detect window overlaps)
this.actor.set_position(x, y);
this.actor.set_pivot_point(x, y);
this._struts.set_position(x, y);
this._struts.set_pivot_point(x, y);
if (_DEBUG_) global.log("dockedWorkspaces: _updateSize new x = "+x+" y = "+y);

// Update size of the main actor as well as the _dock & _panels inside
Expand Down Expand Up @@ -2473,11 +2454,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
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
34 changes: 18 additions & 16 deletions workspaces-to-dock@passingthru67.gmail.com/myWorkspaceThumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,8 @@ var MyWorkspaceThumbnail = GObject.registerClass({
}

// Tests if @actor belongs to this workspace and monitor
_isMyWindow(actor, isMetaWin) {
let win;
if (isMetaWin)
win = actor;
else
win = actor.meta_window;
_isMyWindow(actor) {
let win = actor.meta_window;

return win.located_on_workspace(this.metaWorkspace) &&
(win.get_monitor() == this.monitorIndex);
Expand Down Expand Up @@ -696,8 +692,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 +1106,7 @@ var MyThumbnailsBox = GObject.registerClass({

// Draggable target interface
handleDragOver(source, actor, x, y, time) {
if (!source._caption && !source.realWindow &&
if (!source.metaWindow &&
(!source.app || !source.app.can_open_new_window()) &&
(source.app || !source.shellWorkspaceLaunch) &&
source != Main.xdndHandler)
Expand Down Expand Up @@ -1654,8 +1656,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 +1811,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 +1841,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 +1887,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 +1919,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 +1946,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
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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 @@ -334,7 +335,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

0 comments on commit b1a3571

Please sign in to comment.