void HandleGeometryChanged(object sender, EventArgs e) { Wnck.Window window = sender as Wnck.Window; if (sender == null) { return; } Gdk.Rectangle geo = window.EasyGeometry(); if (geo == last_known_geo) { return; } last_known_geo = geo; if (timer_geometry > 0) { return; } timer_geometry = GLib.Timeout.Add(updateDelay, delegate { UpdateWindowIntersect(); timer_geometry = 0; return(false); }); }
void SetupActiveWindow() { Wnck.Window active = screen.ActiveWindow; if (active != null) { active.GeometryChanged += HandleGeometryChanged; last_known_geo = active.EasyGeometry(); } }
bool WindowCenterInViewport(Wnck.Window window) { if (!window.IsOnWorkspace(parent)) { return(false); } Rectangle geo = window.EasyGeometry(); geo.X += parent.ViewportX; geo.Y += parent.ViewportY; return(area.Contains(new Point(geo.X + geo.Width / 2, geo.Y + geo.Height / 2))); }
void SetTemporaryWindowGeometry(Wnck.Window window, Gdk.Rectangle area, Dictionary <Wnck.Window, WindowState> state) { Gdk.Rectangle oldGeo = window.EasyGeometry(); oldGeo.X += parent.ViewportX; oldGeo.Y += parent.ViewportY; state [window] = new WindowState(oldGeo, window.State); if (window.IsMaximized) { window.Unmaximize(); } window.SetWorkaroundGeometry(WindowGravity.Current, MoveResizeMask, area.X, area.Y, area.Width, area.Height); }
void SetTemporaryWindowGeometry(Wnck.Window window, Gdk.Rectangle area) { Gdk.Rectangle oldGeo = window.EasyGeometry(); oldGeo.X += parent.ViewportX; oldGeo.Y += parent.ViewportY; if (!window_states.ContainsKey(window)) { window_states [window] = new WindowState(oldGeo, window.State); } if (window.IsMaximized) { window.Unmaximize(); } window.SetWorkaroundGeometry(WindowGravity.Current, MoveResizeMask, area.X, area.Y, area.Width, area.Height); }
public void MoveWindowInto(Wnck.Window window) { if (parent.IsVirtual) { Rectangle geo = window.EasyGeometry(); geo.X += window.Workspace.ViewportX; geo.Y += window.Workspace.ViewportY; int x = area.X + (geo.X % area.Width); int y = area.Y + (geo.Y % area.Height); x -= window.Workspace.ViewportX; y -= window.Workspace.ViewportY; window.SetWorkaroundGeometry(WindowGravity.Current, MoveMask, x, y, 0, 0); } else { window.MoveToWorkspace(parent); } }
public static int Area(this Wnck.Window self) { Gdk.Rectangle geo = self.EasyGeometry(); return(geo.Width * geo.Height); }