Ejemplo n.º 1
0
 public VirtualScreen AddScreen(IDisplay display, Win32.Hooks.Dpi dpi, string client)
 {
     return(OnScreenChanged(Direction.None, AddScreen(display.X, display.Y, 0, 0, display.Width, display.Height, dpi, client)));
 }
Ejemplo n.º 2
0
 public VirtualScreen AddScreenBelow(VirtualScreen orig, IDisplay display, Win32.Hooks.Dpi dpi, string client)
 {
     return(OnScreenChanged(Direction.Bottom, AddScreen(display.X, display.Y, orig.X, orig.Y + orig.Height, display.Width, display.Height, dpi, client)));
 }
Ejemplo n.º 3
0
        public VirtualScreen AddScreen(int localX, int localY, int virtualX, int virtualY, int width, int height, Win32.Hooks.Dpi dpi, string client)
        {
            double newXBottomCorner = virtualX + width - 1;
            double newYBottomCorner = virtualY + height - 1;

            //check and make sure we can add this

            foreach (VirtualScreen s in screens.Values.SelectMany(x => x))
            {
                double existingX             = s.X;
                double existingY             = s.Y;
                double existingXBottomCorner = s.X + s.Width - 1;
                double existingYBottomCorner = s.Y + s.Height - 1;

                //no overlap of x coords
                if (virtualX > existingXBottomCorner || newXBottomCorner < existingX)
                {
                    continue;
                }

                // If one rectangle is above other
                //screen coordinates have the Y flipped, so we have to adjust this part by flipping the comparisons from what you would normally see
                if (virtualY > existingYBottomCorner || newYBottomCorner < existingY)
                {
                    continue;
                }

                return(null); //this is a coordinate overlap
            }

            //all good, add the new screen
            VirtualScreen newScreen = new VirtualScreen(client, dpi)
            {
                LocalX = localX,
                LocalY = localY,
                X      = virtualX,
                Y      = virtualY,
                Width  = width,
                Height = height
            };

            if (!screens.ContainsKey(client))
            {
                screens.TryAdd(client, new List <VirtualScreen>());
            }
            screens[client].Add(newScreen);
            return(newScreen);
        }