Exemplo n.º 1
0
        public StartupHandler(IScreens screensInfo, IVirtualDesktopCollection virtualDesktops, IContainerNodeCreater containerNodeCreator, IVirtualDesktopCreater virtualDesktopCreator, IScreenNodeCreater screenNodeCreator, ISignalHandler signal, IKeyHandler keyHandler, ICommandHelper commandHelper, IWindowTracker windowTracker, IPInvokeHandler pinvokeHandler)
        {
            this.screensInfo          = screensInfo;
            this.desktops             = virtualDesktops;
            this.containerNodeCreator = containerNodeCreator;
            this.signal          = signal;
            this.keyHandler      = keyHandler;
            this.commandHelper   = commandHelper;
            this.windowTracker   = windowTracker;
            this.pinvokeHandler  = pinvokeHandler;
            this.HandlesToIgnore = new List <IntPtr>();

            var result = screensInfo.AllScreens.GetOrderRect();

            _screens = result.rect.ToArray();

            for (var i = 0; i < desktops.Count; i++)
            {
                var screensToAdd = _screens.Select((rect, i) => screenNodeCreator.Create("Screen" + i, rect, dir: result.direction)).ToArray();
                desktops[i] = virtualDesktopCreator.Create(i, rect: _screens.TotalRect(), dir: result.direction, childs: screensToAdd);
                desktops[i].Hide();
            }

            desktops.Index = 0;
            desktops.ActiveDesktop.Show();
        }
Exemplo n.º 2
0
    public SignalHandler(IPInvokeHandler pinvokeHandler)
    {
        WMC_SHOW          = pinvokeHandler.RegisterWindowMessage("WMC_SHOW");
        WMC_CREATE        = pinvokeHandler.RegisterWindowMessage("WMC_CREATE");
        WMC_ENTERMOVE     = pinvokeHandler.RegisterWindowMessage("WMC_ENTERMOVE");
        WMC_MOVE          = pinvokeHandler.RegisterWindowMessage("WMC_MOVE");
        WMC_EXITMOVE      = pinvokeHandler.RegisterWindowMessage("WMC_EXITMOVE");
        WMC_KEYDOWN       = pinvokeHandler.RegisterWindowMessage("WMC_KEYDOWN");
        WMC_KEYUP         = pinvokeHandler.RegisterWindowMessage("WMC_KEYUP");
        WMC_SETFOCUS      = pinvokeHandler.RegisterWindowMessage("WMC_SETFOCUS");
        WMC_KILLFOCUS     = pinvokeHandler.RegisterWindowMessage("WMC_KILLFOCUS");
        WMC_SHOWWINDOW    = pinvokeHandler.RegisterWindowMessage("WMC_SHOWWINDOW");
        WMC_DESTROY       = pinvokeHandler.RegisterWindowMessage("WMC_DESTROY");
        WMC_STYLECHANGED  = pinvokeHandler.RegisterWindowMessage("WMC_STYLECHANGED");
        WMC_SCCLOSE       = pinvokeHandler.RegisterWindowMessage("WMC_SCCLOSE");
        WMC_SCMAXIMIZE    = pinvokeHandler.RegisterWindowMessage("WMC_SCMAXIMIZE");
        WMC_SCMINIMIZE    = pinvokeHandler.RegisterWindowMessage("WMC_SCMINIMIZE");
        WMC_SCRESTORE     = pinvokeHandler.RegisterWindowMessage("WMC_SCRESTORE");
        WMC_ACTIVATEAPP   = pinvokeHandler.RegisterWindowMessage("WMC_ACTIVATEAPP");
        WMC_DISPLAYCHANGE = pinvokeHandler.RegisterWindowMessage("WMC_DISPLAYCHANGE");
        WMC_SIZE          = pinvokeHandler.RegisterWindowMessage("WMC_SIZE");
        WMC_EXTRATRACK    = pinvokeHandler.RegisterWindowMessage("WMC_EXTRATRACK");

        // Custom message not from winhook
        WMC_SHOWNODE = pinvokeHandler.RegisterWindowMessage("WMC_SHOWNODE");
    }
Exemplo n.º 3
0
 public WindowEventHandler(ISignalHandler signalHandler, IPInvokeHandler pinvokeHandler)
 {
     this.signalHandler          = signalHandler;
     this.pinvokeHandler         = pinvokeHandler;
     this._closeListeners        = new Dictionary <Guid, Tuple <IntPtr, Action <IntPtr> > >();
     this._styleChangedListeners = new Dictionary <Guid, Tuple <IntPtr, Action <WindowStyleChangedArg> > >();
 }
Exemplo n.º 4
0
 public ContainerNodeCreater(IFocusHandler focusHandler, IWindowEventHandler windowHandler, IWindowTracker windowTracker, IPInvokeHandler pinvokeHandler)
 {
     this.focusHandler   = focusHandler;
     this.windowHandler  = windowHandler;
     this.windowTracker  = windowTracker;
     this.pinvokeHandler = pinvokeHandler;
 }
Exemplo n.º 5
0
 public WindowNodeCreater(IDragHandler dragHandler, IFocusHandler focusHandler, ISignalHandler signalHandler, IWindowEventHandler windowHandler, IWindowTracker windowTracker, IPInvokeHandler pinvokeHandler)
 {
     this.dragHandler    = dragHandler;
     this.focusHandler   = focusHandler;
     this.signalHandler  = signalHandler;
     this.windowHandler  = windowHandler;
     this.windowTracker  = windowTracker;
     this.pinvokeHandler = pinvokeHandler;
 }
Exemplo n.º 6
0
 public SessionChangeHandler(IPInvokeHandler pinvokeHandler)
 {
     this.pinvokeHandler = pinvokeHandler;
     _registered         = true;
     if (!pinvokeHandler.WTSRegisterSessionNotification(this.Handle, PInvoker.NOTIFY_FOR_THIS_SESSION))
     {
         _registered = false;
         Log.Warning($"Problem registering session notification. Problem might arise with lock screen. error: {pinvokeHandler.GetLastError()}");
     }
 }
Exemplo n.º 7
0
 public TWHandler(string exec, string pipeName, ref ConcurrentQueue <PipeMessageEx> queue, AppConfig appConfig, IPInvokeHandler pinvokeHandler, ISignalHandler signalHandler)
 {
     this.queue          = queue;
     this.exec           = exec;
     this.pipeName       = pipeName;
     this.disableWinKey  = appConfig?.DisableWinKey ?? false;
     this.showHooks      = appConfig?.DebugShowHooks ?? true;
     this.pinvokeHandler = pinvokeHandler;
     this.signalHandler  = signalHandler;
 }
Exemplo n.º 8
0
 public VirtualDesktopCreater(IServiceProvider service)// IFocusTracker focusTracker, IFocusHandler focusHandler, IWindowEventHandler windowHandler, IWindowTracker windowTracker, IPInvokeHandler pinvokeHandler, IContainerNodeCreater containerCreater)
 {
     this.service          = service;
     this.focusHandler     = service.GetRequiredService <IFocusHandler>();
     this.windowHandler    = service.GetRequiredService <IWindowEventHandler>();
     this.windowTracker    = service.GetRequiredService <IWindowTracker>();
     this.pinvokeHandler   = service.GetRequiredService <IPInvokeHandler>();
     this.containerCreater = service.GetRequiredService <IContainerNodeCreater>();
     this.screenCreater    = service.GetRequiredService <IScreenNodeCreater>();
     this.signalHandler    = service.GetRequiredService <ISignalHandler>();
 }
Exemplo n.º 9
0
        public WindowTracker(IPInvokeHandler pinvokeHandler, CreateWindowNode windowNodeCreater, IWindowEventHandler windowHandler)
        {
            this._ignoreHwnds       = new List <IgnoreHwndInfo>();
            this.pinvokeHandler     = pinvokeHandler;
            this.windowNodeCreater  = windowNodeCreater;
            this.windowHandler      = windowHandler;
            this.classNamesToIgnore = new List <Regex>
            {
                new Regex(@"^Shell_TrayWnd$", RegexOptions.Compiled),
                new Regex(@"^Progman$", RegexOptions.Compiled),                 // Program Manager === Desktop in win
                new Regex(@"^VirtualConsoleClassApp$", RegexOptions.Compiled),  // ConEmu
                new Regex(@"^LockScreenBackstopFrame$", RegexOptions.Compiled), // Windows 10 Lock screen
                new Regex(@"^MultitaskingViewFrame$", RegexOptions.Compiled),   // Windows 10 multitasking screen
                new Regex(@"^MSO_BORDEREFFECT_WINDOW_CLASS$", RegexOptions.Compiled),
                new Regex(@"GlowWindow", RegexOptions.Compiled),                // Full: VisualStudioGlowWindow
            };

            this.captionsToIgnore = new List <Regex>
            {
                new Regex(@"^TileWindow - AppBar$", RegexOptions.Compiled)
            };
        }
Exemplo n.º 10
0
        public FormAppBar(AppConfig appConfig, IPInvokeHandler pinvokeHandler, uint signalShowHide)
        {
            this.direction       = appConfig.Bar.Position;
            this.pinvokeHandler  = pinvokeHandler;
            this.signalShowHide  = signalShowHide;
            this.backColor       = ColorTranslator.FromHtml(appConfig.Bar.Colors?.Background);
            this.focusForeColor  = ColorTranslator.FromHtml(appConfig.Bar.Colors?.FocusedWorkspace.Text);
            this.focusBackColor  = ColorTranslator.FromHtml(appConfig.Bar.Colors?.FocusedWorkspace.Background);
            this.color           = ColorTranslator.FromHtml(appConfig.Bar.Colors?.Statusline);
            this.wantedSize      = 25;
            this.iconSize        = 23;
            this.contentStart    = 1;
            this.contentStartTop = direction == BarPosition.Top || direction == BarPosition.Bottom;
            this.BackColor       = backColor;
            this.ForeColor       = color;
            InitializeComponent();

            this.Height             = wantedSize;
            this.Width              = wantedSize;
            this.Size               = new Size(wantedSize, wantedSize);
            containerControl.Height = direction == BarPosition.Left || direction == BarPosition.Right ? 400 : wantedSize;
            containerControl.Width  = containerControl.Height == wantedSize ? 400 : wantedSize;
        }
Exemplo n.º 11
0
 public CommandHelper(IVirtualDesktopCollection desktops, IPInvokeHandler pinvokeHandler, ICommandExecutor commandExecutor)
 {
     this.desktops        = desktops;
     this.pinvokeHandler  = pinvokeHandler;
     this.commandExecutor = commandExecutor;
 }