public static DoForSelfAndOwnersWhile ( |
||
hWnd | ||
action | Predicate |
|
return |
private void OnWindowActivated(IntPtr hWnd) { if (isShown && (!showSingleApplicationTab || bar.Monitor.CurrentVisibleWorkspace.IsCurrentWorkspace)) { Panel panel = null; var applications = applicationPanels[bar.Monitor.CurrentVisibleWorkspace.id - 1]; if (applications.Count > 0 && (hWnd = Utilities.DoForSelfAndOwnersWhile(hWnd, h => applications.All(t => t.Item1 != h))) != IntPtr.Zero) { panel = applications.First(t => t.Item1 == hWnd).Item2; if (panel == currentlyHighlightedPanel) { return; } } // removes the current highlight if (currentlyHighlightedPanel != null) { if (showSingleApplicationTab) { currentlyHighlightedPanel.Hide(); } else { currentlyHighlightedPanel.ForeColor = normalForegroundColor; currentlyHighlightedPanel.BackColor = normalBackgroundColor; } } // highlights the new app if (panel != null) { if (showSingleApplicationTab) { panel.Show(); } else if (applications.Count > 1) { panel.ForeColor = highlightedForegroundColor; panel.BackColor = highlightedBackgroundColor; } currentlyHighlightedPanel = panel; } else { currentlyHighlightedPanel = null; } } }
private static void OnWindowFlashing(IntPtr hWnd, LinkedList <Tuple <Workspace, Window> > list) { if (list != null) { if (NativeMethods.IsWindow(hWnd) && !flashingWindows.ContainsKey(hWnd)) { var foregroundWindow = NativeMethods.GetForegroundWindow(); if (Utilities.DoForSelfAndOwnersWhile(foregroundWindow, h => h != hWnd) == IntPtr.Zero) { var workspace = list.First.Value.Item1; flashingWindows[hWnd] = workspace; flashingWorkspaces.Add(workspace); if (flashingWorkspaces.Count == 1) { flashTimer.Start(); } } } } }