Ejemplo n.º 1
0
        private void ProcessRemovedScreens(List <string> removedScreens)
        {
            foreach (string name in removedScreens)
            {
                CairoLogger.Instance.DebugIf(Settings.Instance.EnableMenuBarMultiMon || Settings.Instance.EnableTaskbarMultiMon, "WindowManager: Removing windows associated with screen " + name);

                if (Settings.Instance.EnableTaskbarMultiMon && Settings.Instance.EnableTaskbar)
                {
                    // close TaskBars
                    Taskbar taskbarToClose = null;
                    foreach (Taskbar bar in TaskbarWindows)
                    {
                        if (bar.Screen != null && bar.Screen.DeviceName == name)
                        {
                            CairoLogger.Instance.DebugIf(bar.Screen.Primary, "WindowManager: Closing TaskBar on primary display");

                            taskbarToClose = bar;
                            break;
                        }
                    }

                    if (taskbarToClose != null)
                    {
                        if (!taskbarToClose.IsClosing)
                        {
                            taskbarToClose.Close();
                        }

                        TaskbarWindows.Remove(taskbarToClose);
                    }
                }

                if (Settings.Instance.EnableMenuBarMultiMon)
                {
                    // close menu bars
                    MenuBar barToClose = null;
                    foreach (MenuBar bar in MenuBarWindows)
                    {
                        if (bar.Screen != null && bar.Screen.DeviceName == name)
                        {
                            CairoLogger.Instance.DebugIf(bar.Screen.Primary, "WindowManager: Closing menu bar on primary display");

                            barToClose = bar;
                            break;
                        }
                    }

                    if (barToClose != null)
                    {
                        if (!barToClose.IsClosing)
                        {
                            barToClose.Close();
                        }

                        MenuBarWindows.Remove(barToClose);
                    }
                }
            }
        }