Пример #1
0
        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);
            });
        }
Пример #2
0
 void SetupActiveWindow()
 {
     Wnck.Window active = screen.ActiveWindow;
     if (active != null)
     {
         active.GeometryChanged += HandleGeometryChanged;
         last_known_geo          = active.EasyGeometry();
     }
 }
Пример #3
0
        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)));
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
            }
        }
Пример #7
0
 public static int Area(this Wnck.Window self)
 {
     Gdk.Rectangle geo = self.EasyGeometry();
     return(geo.Width * geo.Height);
 }