Skip to content

Commit

Permalink
fix tiling bug
Browse files Browse the repository at this point in the history
  • Loading branch information
PapyElGringo committed Jul 9, 2019
1 parent d03e3e2 commit c092c5f
Showing 1 changed file with 28 additions and 22 deletions.
50 changes: 28 additions & 22 deletions tilingManager/tilingLayouts/baseTilingLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,35 +80,41 @@ var BaseTilingLayout = class BaseTilingLayout {
});
}

moveMetaWindow(metaWindow, x, y, alreadyDelayed) {
let actor = metaWindow.get_compositor_private();
if (actor && actor.mapped) {
metaWindow.move_frame(false, x, y);
} else if (!alreadyDelayed) {
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this.moveMetaWindow(metaWindow, x, y, true);
});
} else {
log(`failed to tile ${metaWindow.get_title()}`);
}
moveMetaWindow(metaWindow, x, y) {
this.callSafely(metaWindow, metaWindowInside => {
metaWindowInside.move_frame(false, x, y);
});
}

moveAndResizeMetaWindow(metaWindow, x, y, width, height) {
this.callSafely(metaWindow, metaWindowInside => {
metaWindowInside.move_resize_frame(false, x, y, width, height);
});
}

moveAndResizeMetaWindow(metaWindow, x, y, width, height, alreadyDelayed) {
callSafely(metaWindow, callback, alreadyDelayed) {
let actor = metaWindow.get_compositor_private();
if (actor && actor.mapped) {
metaWindow.move_resize_frame(false, x, y, width, height);
//First check if the metaWindow got an actor
if (actor) {
// We need the actor to be mapped to remove random crashes
if (actor.mapped) {
callback(metaWindow);
} else {
// Wait for it to be mapped
if (actor.waitToBeMappedId) return;
actor.waitToBeMappedId = actor.connect('notify::mapped', () => {
callback(metaWindow);
actor.disconnect(actor.waitToBeMappedId);
delete actor.waitToBeMappedId;
});
}
} else if (!alreadyDelayed) {
//If we don't have actor we hope to get it in the next loop
GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
this.moveAndResizeMetaWindow(
metaWindow,
x,
y,
width,
height,
true
);
this.callSafely(metaWindow, callback, true);
});
} else {
// Can't do shit for now
log(`failed to tile ${metaWindow.get_title()}`);
}
}
Expand Down

0 comments on commit c092c5f

Please sign in to comment.