Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 59 additions & 6 deletions js/ui/expoThumbnail.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,39 @@ var ExpoWorkspaceThumbnail = GObject.registerClass({
this.doRemoveWindow(metaWin);
}

syncWindow(metaWin) {
if (this.state > ThumbnailState.NORMAL) {
return;
}

let win = metaWin.get_compositor_private();
let index = this.lookupIndex(metaWin);
let shouldHaveWindow = win && this.isMyWindow(win) && this.isExpoWindow(win);

if (shouldHaveWindow) {
if (index === -1) {
this.doAddWindow(metaWin);
} else {
this.windows[index].origX = win.x;
this.windows[index].origY = win.y;
}
this.restack(true);
return;
}

if (index === -1) {
return;
}

let clone = this.windows[index];
this.windows.splice(index, 1);
clone.destroy();

if (this.overviewMode) {
this.overviewModeOn();
}
}

onDestroy(actor) {
actor.remove_all_transitions();
if (this._collapseId) {
Expand Down Expand Up @@ -699,11 +732,14 @@ var ExpoWorkspaceThumbnail = GObject.registerClass({
});
clone.connect('drag-end', (clone) => {
this.box.emit('drag-end');
this.box.queueWindowSync(clone.metaWindow);
if (clone.dragCancelled) {
// stacking order may have been disturbed
this.restack();
}
this.overviewModeOn();
if (clone.visible) {
this.overviewModeOn();
}
});
this.contents.add_actor(clone);

Expand Down Expand Up @@ -1006,11 +1042,6 @@ var ExpoWorkspaceThumbnail = GObject.registerClass({

handleDragOverOrDrop(dropping, source, actor, x, y, time) {
this.hovering = false; // normal hover logic is off during dnd
if (dropping) {
let draggable = source._draggable;
actor.opacity = draggable._dragOrigOpacity;
global.reparentActor(actor, draggable._dragOrigParent);
}

if (source == Main.xdndHandler) {
return DND.DragMotionResult.CONTINUE;
Expand Down Expand Up @@ -1064,6 +1095,16 @@ var ExpoWorkspaceThumbnail = GObject.registerClass({
}
}

if (dropping && canDrop) {
let draggable = source._draggable;
actor.opacity = draggable._dragOrigOpacity;
global.reparentActor(actor, draggable._dragOrigParent);

if (movingWorkspaces) {
actor.hide();
}
}

return canDrop ? DND.DragMotionResult.MOVE_DROP : DND.DragMotionResult.CONTINUE;
}

Expand Down Expand Up @@ -1187,6 +1228,7 @@ var ExpoThumbnailsBox = GObject.registerClass({

this._initialAllocTimeoutId = 0;
this._updateStatesLaterId = 0;
this._windowSyncIdleIds = new Set();

let allocId = this.connect('notify::allocation', () => {
this.disconnect(allocId);
Expand All @@ -1209,6 +1251,8 @@ var ExpoThumbnailsBox = GObject.registerClass({
Meta.later_remove(this._updateStatesLaterId);
this._updateStatesLaterId = 0;
}
this._windowSyncIdleIds.forEach(id => GLib.source_remove(id));
this._windowSyncIdleIds.clear();
});

this.toggleGlobalOverviewMode = function() {
Expand Down Expand Up @@ -1320,6 +1364,15 @@ var ExpoThumbnailsBox = GObject.registerClass({
this.thumbnails[this.kbThumbnailIndex].removeWorkspace();
}

queueWindowSync(metaWin) {
let id = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
this._windowSyncIdleIds.delete(id);
this.thumbnails.forEach(thumbnail => thumbnail.syncWindow(metaWin));
return GLib.SOURCE_REMOVE;
});
this._windowSyncIdleIds.add(id);
}

_startWorkspaceDrag(sourceIndex) {
this._wsSourceIndex = sourceIndex;
this._wsDropIndex = sourceIndex;
Expand Down
Loading