Exemple #1
0
        internal Window(Window window)
            : base(window)
        {
            this.IsFloating = window.IsFloating;
            this.Titlebar = window.Titlebar;
            this.InAltTabAndTaskbar = window.InAltTabAndTaskbar;
            this.WindowBorders = window.WindowBorders;
            this.WorkspacesCount = window.WorkspacesCount;
            this.DisplayName = window.DisplayName;
            className = window.className;
            processName = window.processName;
            is64BitProcess = window.is64BitProcess;
            redrawOnShow = window.redrawOnShow;
            ShowMenu = window.ShowMenu;
            updateIcon = window.updateIcon;
            onHiddenWindowShownAction = window.onHiddenWindowShownAction;
            menu = window.menu;
            this.hideFromAltTabAndTaskbarWhenOnInactiveWorkspace = window.hideFromAltTabAndTaskbarWhenOnInactiveWorkspace;

            this.originalStyle = window.originalStyle;
            this.originalExStyle = window.originalExStyle;

            windowPlacement = window.windowPlacement;
            originalWindowPlacement = window.originalWindowPlacement;

            this.customOwnedWindowMatchingFunction = window.customOwnedWindowMatchingFunction;
            ownedWindows = window.ownedWindows;
        }
Exemple #2
0
        internal Window(IntPtr hWnd, string className, string displayName, string processName, int workspacesCount, bool is64BitProcess,
            NativeMethods.WS originalStyle, NativeMethods.WS_EX originalExStyle, ProgramRule.Rule rule, ProgramRule programRule, IntPtr menu)
            : base(hWnd)
        {
            IsFloating = rule.isFloating;
            Titlebar = rule.titlebar;
            InAltTabAndTaskbar = rule.inAltTabAndTaskbar;
            WindowBorders = rule.windowBorders;
            this.WorkspacesCount = workspacesCount;
            this.DisplayName = displayName;
            this.className = className;
            this.processName = processName;
            this.is64BitProcess = is64BitProcess;
            redrawOnShow = rule.redrawOnShow;
            ShowMenu = programRule.showMenu;
            updateIcon = programRule.updateIcon;
            onHiddenWindowShownAction = programRule.onHiddenWindowShownAction;
            this.menu = menu;
            this.hideFromAltTabAndTaskbarWhenOnInactiveWorkspace = rule.hideFromAltTabAndTaskbarWhenOnInactiveWorkspace;

            this.originalStyle = originalStyle;
            this.originalExStyle = originalExStyle;

            windowPlacement = NativeMethods.WINDOWPLACEMENT.Default;
            SavePosition();
            originalWindowPlacement = windowPlacement;

            this.customOwnedWindowMatchingFunction = programRule.customOwnedWindowMatchingFunction;

            this.ownedWindows = new LinkedList<IntPtr>();
            this.ownedWindows.AddFirst(hWnd);
        }
Exemple #3
0
        internal Window(Window window) : base(window)
        {
            this.IsFloating         = window.IsFloating;
            this.Titlebar           = window.Titlebar;
            this.InAltTabAndTaskbar = window.InAltTabAndTaskbar;
            this.WindowBorders      = window.WindowBorders;
            this.WorkspacesCount    = window.WorkspacesCount;
            this.DisplayName        = window.DisplayName;
            className                 = window.className;
            processName               = window.processName;
            is64BitProcess            = window.is64BitProcess;
            redrawOnShow              = window.redrawOnShow;
            ShowMenu                  = window.ShowMenu;
            updateIcon                = window.updateIcon;
            onHiddenWindowShownAction = window.onHiddenWindowShownAction;
            menu = window.menu;
            this.hideFromAltTabAndTaskbarWhenOnInactiveWorkspace = window.hideFromAltTabAndTaskbarWhenOnInactiveWorkspace;

            this.originalStyle   = window.originalStyle;
            this.originalExStyle = window.originalExStyle;

            windowPlacement         = window.windowPlacement;
            originalWindowPlacement = window.originalWindowPlacement;

            this.customOwnedWindowMatchingFunction = window.customOwnedWindowMatchingFunction;
            ownedWindows = window.ownedWindows;
        }
Exemple #4
0
        internal Window(IntPtr hWnd, string className, string displayName, string processName, int workspacesCount, bool is64BitProcess,
                        NativeMethods.WS originalStyle, NativeMethods.WS_EX originalExStyle, ProgramRule.Rule rule, ProgramRule programRule, IntPtr menu) :
            base(hWnd)
        {
            IsFloating                = rule.isFloating;
            Titlebar                  = rule.titlebar;
            InAltTabAndTaskbar        = rule.inAltTabAndTaskbar;
            WindowBorders             = rule.windowBorders;
            this.WorkspacesCount      = workspacesCount;
            this.DisplayName          = displayName;
            this.className            = className;
            this.processName          = processName;
            this.is64BitProcess       = is64BitProcess;
            redrawOnShow              = rule.redrawOnShow;
            ShowMenu                  = programRule.showMenu;
            updateIcon                = programRule.updateIcon;
            onHiddenWindowShownAction = programRule.onHiddenWindowShownAction;
            this.menu                 = menu;
            this.hideFromAltTabAndTaskbarWhenOnInactiveWorkspace = rule.hideFromAltTabAndTaskbarWhenOnInactiveWorkspace;

            this.originalStyle   = originalStyle;
            this.originalExStyle = originalExStyle;

            windowPlacement = NativeMethods.WINDOWPLACEMENT.Default;
            SavePosition();
            originalWindowPlacement = windowPlacement;

            this.customOwnedWindowMatchingFunction = programRule.customOwnedWindowMatchingFunction;

            this.ownedWindows = new LinkedList <IntPtr>();
            this.ownedWindows.AddFirst(hWnd);
        }
Exemple #5
0
        public ProgramRule(string className = ".*", string displayName = ".*", string processName = ".*",
                           NativeMethods.WS styleContains                = (NativeMethods.WS) 0, NativeMethods.WS styleNotContains = (NativeMethods.WS) 0,
                           NativeMethods.WS_EX exStyleContains           = (NativeMethods.WS_EX) 0, NativeMethods.WS_EX exStyleNotContains = (NativeMethods.WS_EX) 0,
                           CustomMatchingFunction customMatchingFunction = null, CustomMatchingFunction customOwnedWindowMatchingFunction  = null,

                           bool isManaged = true, int tryAgainAfter = -1, int windowCreatedDelay = -1, bool redrawDesktopOnWindowCreated = false,
                           bool showMenu  = true, bool updateIcon   = false,
                           OnWindowCreatedOrShownAction onWindowCreatedAction     = OnWindowCreatedOrShownAction.SwitchToWindowsWorkspace,
                           OnWindowCreatedOrShownAction onHiddenWindowShownAction = OnWindowCreatedOrShownAction.SwitchToWindowsWorkspace,
                           OnWindowCreatedOnWorkspaceAction onWindowCreatedOnCurrentWorkspaceAction  = OnWindowCreatedOnWorkspaceAction.MoveToTop,
                           OnWindowCreatedOnWorkspaceAction onWindowCreatedOnInactiveWorkspaceAction = OnWindowCreatedOnWorkspaceAction.MoveToTop,
                           int showOnWorkspacesCount = 0, IEnumerable <Rule> rules = null)
        {
            this.className                         = new Regex(className, RegexOptions.Compiled);
            this.displayName                       = new Regex(displayName, RegexOptions.Compiled);
            this.processName                       = new Regex(processName, RegexOptions.Compiled);
            this.styleContains                     = styleContains;
            this.styleNotContains                  = styleNotContains;
            this.exStyleContains                   = exStyleContains;
            this.exStyleNotContains                = exStyleNotContains;
            this.customMatchingFunction            = customMatchingFunction ?? Utilities.IsAltTabWindow;
            this.customOwnedWindowMatchingFunction = customOwnedWindowMatchingFunction ?? DefaultOwnedWindowMatchingFunction;

            this.isManaged = isManaged;
            if (isManaged)
            {
                this.tryAgainAfter                = tryAgainAfter;
                this.windowCreatedDelay           = windowCreatedDelay;
                this.redrawDesktopOnWindowCreated = redrawDesktopOnWindowCreated;
                this.showMenu                  = showMenu;
                this.updateIcon                = updateIcon;
                this.onWindowCreatedAction     = onWindowCreatedAction;
                this.onHiddenWindowShownAction = onHiddenWindowShownAction;
                this.onWindowCreatedOnCurrentWorkspaceAction  = onWindowCreatedOnCurrentWorkspaceAction;
                this.onWindowCreatedOnInactiveWorkspaceAction = onWindowCreatedOnInactiveWorkspaceAction;

                if (showOnWorkspacesCount > 0)
                {
                    if (rules == null)
                    {
                        rules = new Rule[] { };
                    }

                    // This is slow (n ^ 2), but it doesn't matter in this case
                    this.rules = rules.Concat(
                        Enumerable.Range(1, showOnWorkspacesCount).Where(i => rules.All(r => r.workspace != i)).Select(i => new Rule(i))).
                                 ToArray();
                }
                else
                {
                    this.rules = rules == null ? new[] { new Rule() } : rules.ToArray();
                }
            }
        }
Exemple #6
0
        public ProgramRule(string className = ".*", string displayName = ".*", string processName = ".*",
            NativeMethods.WS styleContains = (NativeMethods.WS) 0, NativeMethods.WS styleNotContains = (NativeMethods.WS) 0,
            NativeMethods.WS_EX exStyleContains = (NativeMethods.WS_EX) 0, NativeMethods.WS_EX exStyleNotContains = (NativeMethods.WS_EX) 0,
            CustomMatchingFunction customMatchingFunction = null, CustomMatchingFunction customOwnedWindowMatchingFunction = null,
            
            bool isManaged = true, int tryAgainAfter = -1, int windowCreatedDelay = -1, bool redrawDesktopOnWindowCreated = false,
            bool showMenu = true, bool updateIcon = false,
            OnWindowCreatedOrShownAction onWindowCreatedAction = OnWindowCreatedOrShownAction.SwitchToWindowsWorkspace,
            OnWindowCreatedOrShownAction onHiddenWindowShownAction = OnWindowCreatedOrShownAction.SwitchToWindowsWorkspace,
            OnWindowCreatedOnWorkspaceAction onWindowCreatedOnCurrentWorkspaceAction = OnWindowCreatedOnWorkspaceAction.MoveToTop,
            OnWindowCreatedOnWorkspaceAction onWindowCreatedOnInactiveWorkspaceAction = OnWindowCreatedOnWorkspaceAction.MoveToTop,
            int showOnWorkspacesCount = 0, IEnumerable<Rule> rules = null)
        {
            this.className = new Regex(className, RegexOptions.Compiled);
            this.displayName = new Regex(displayName, RegexOptions.Compiled);
            this.processName = new Regex(processName, RegexOptions.Compiled);
            this.styleContains = styleContains;
            this.styleNotContains = styleNotContains;
            this.exStyleContains = exStyleContains;
            this.exStyleNotContains = exStyleNotContains;
            this.customMatchingFunction = customMatchingFunction ?? Utilities.IsAltTabWindow;
            this.customOwnedWindowMatchingFunction = customOwnedWindowMatchingFunction ?? DefaultOwnedWindowMatchingFunction;

            this.isManaged = isManaged;
            if (isManaged)
            {
                this.tryAgainAfter = tryAgainAfter;
                this.windowCreatedDelay = windowCreatedDelay;
                this.redrawDesktopOnWindowCreated = redrawDesktopOnWindowCreated;
                this.showMenu = showMenu;
                this.updateIcon = updateIcon;
                this.onWindowCreatedAction = onWindowCreatedAction;
                this.onHiddenWindowShownAction = onHiddenWindowShownAction;
                this.onWindowCreatedOnCurrentWorkspaceAction = onWindowCreatedOnCurrentWorkspaceAction;
                this.onWindowCreatedOnInactiveWorkspaceAction = onWindowCreatedOnInactiveWorkspaceAction;

                if (showOnWorkspacesCount > 0)
                {
                    if (rules == null)
                    {
                        rules = new Rule[] { };
                    }

                    // This is slow (n ^ 2), but it doesn't matter in this case
                    this.rules = rules.Concat(
                        Enumerable.Range(1, showOnWorkspacesCount).Where(i => rules.All(r => r.workspace != i)).Select(i => new Rule(i))).
                        ToArray();
                }
                else
                {
                    this.rules = rules == null ? new[] { new Rule() } : rules.ToArray();
                }
            }
        }