private void MoveWindow(Window window, WindowGravity gravity) { if (gravity == WindowGravity.None) { return; } int x = (window.Screen.Width / 2) - (window.Allocation.Width / 2); int y = (window.Screen.Height / 2) - (window.Allocation.Height / 2); bool isWindows = System.IO.Path.DirectorySeparatorChar == '\\'; if (gravity.HasFlag(WindowGravity.Left)) { x = 0; } if (gravity.HasFlag(WindowGravity.Top)) { y = 0; } if (gravity.HasFlag(WindowGravity.Right)) { x = window.Screen.Width - window.Allocation.Width - (isWindows ? 10 : 0); } if (gravity.HasFlag(WindowGravity.Bottom)) { y = window.Screen.Height - window.Allocation.Height - (isWindows ? 74 : 0); } window.Move(x, y); }
public static void SetWorkaroundGeometry(this Wnck.Window window, WindowGravity gravity, WindowMoveResizeMask mask, int x, int y, int width, int height) { // This is very weird. Don't know when they will fix it. You must subtract the top and left // frame extents from a move operation to get the window to actually show in the right spot. // Save for maybe kwin, I think only compiz uses Viewports anyhow, so this is ok. int [] extents = window.FrameExtents(); x -= extents [(int)Position.Left]; y -= extents [(int)Position.Top]; window.SetGeometry(gravity, mask, x, y, width, height); }
public static void SetWorkaroundGeometry (this Window window, WindowGravity gravity, WindowMoveResizeMask mask, int x, int y, int width, int height) { // This is very weird. Don't know when they will fix it. You must subtract the top and left // frame extents from a move operation to get the window to actually show in the right spot. // Save for maybe kwin, I think only compiz uses Viewports anyhow, so this is ok. int [] extents = window.FrameExtents (); x -= extents [(int) Position.Left]; y -= extents [(int) Position.Top]; window.SetGeometry (gravity, mask, x, y, width, height); }