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); }
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); } }
private static void DoProgramRuleMatched(ProgramRule programRule, IntPtr hWnd, string className, string displayName, string processName, NativeMethods.WS style, NativeMethods.WS_EX exStyle) { if (ProgramRuleMatched != null) { ProgramRuleMatched(programRule, hWnd, className, displayName, processName, style, exStyle); } }
private void OnWindowCreatedOnCurrentWorkspace(IntPtr newWindow, ProgramRule programRule) { switch (programRule.onWindowCreatedOnCurrentWorkspaceAction) { case OnWindowCreatedOnWorkspaceAction.MoveToTop: ActivateWindow(new WindowBase(newWindow)); break; case OnWindowCreatedOnWorkspaceAction.PreserveTopmostWindow: if (DoForTopmostWindowForWorkspace(CurrentWorkspace, ActivateWindow) == NativeMethods.shellWindow) { ActivateWindow(new WindowBase(newWindow)); } break; } }