centerWindowHorizontally: Animate and use whole pixels

This commit is contained in:
Tor Hedin Brønner
2018-06-23 12:48:46 +02:00
parent 0eade6d5cd
commit c991ce3765
+3 -3
View File
@@ -1453,11 +1453,11 @@ function centerWindowHorizontally(metaWindow) {
const frame = metaWindow.get_frame_rect();
const space = spaces.spaceOfWindow(metaWindow);
const monitor = space.monitor;
const targetX = (monitor.width/2 - frame.width/2)
const targetX = Math.round(monitor.width/2 - frame.width/2);
const dx = (targetX + monitor.x) - frame.x;
utils.warpPointerRelative(dx, 0);
move_to(space, metaWindow, { x: targetX, y: frame.y });
space.emit('move-done');
move_to(space, metaWindow, { x: targetX, y: frame.y,
onComplete: () => space.emit('move-done')});
Tweener.removeTweens(space.selection);
space.selection.width = frame.width + prefs.window_gap;
space.selection.x = targetX + monitor.x - Math.round(prefs.window_gap/2);