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; }
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); }
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); }
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(); } } }
internal bool IsMatch(IntPtr hWnd, string cName, string dName, string pName, NativeMethods.WS style, NativeMethods.WS_EX exStyle) { return(className.IsMatch(cName) && displayName.IsMatch(dName) && processName.IsMatch(pName) && (style & styleContains) == styleContains && (style & styleNotContains) == 0 && (exStyle & exStyleContains) == exStyleContains && (exStyle & exStyleNotContains) == 0 && customMatchingFunction(hWnd)); }
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(); } } }
private void OnProgramRuleMatched(ProgramRule programRule, IntPtr hWnd, string className, string displayName, string processName, NativeMethods.WS style, NativeMethods.WS_EX exStyle) { if (programRule != null) { writer.WriteLine("MATCHED - class '{0}'; caption '{1}'; processName '{2}';", className, displayName, processName); writer.WriteLine("\tAGAINST RULE WITH class '{0}'; caption '{1}'; process name '{2}';", programRule.className, programRule.displayName, programRule.processName); writer.WriteLine("\tstyle contains: '{0}'; style not contains '{1}'; ex style contains '{2}'; ex style not contains '{3}'; is managed '{4}'", programRule.styleContains, programRule.styleNotContains, programRule.exStyleContains, programRule.exStyleNotContains, programRule.isManaged); } else { writer.WriteLine("COULD NOT MATCH - class '{0}'; caption '{1}'; processName '{2}' AGAINST ANY RULE", className, displayName, processName); } }