From 533bc5115e49a6d0d093b45f7db65854bc9a0494 Mon Sep 17 00:00:00 2001 From: Nathan Ollerenshaw Date: Mon, 14 Apr 2025 02:07:53 -0700 Subject: monitors: fix disconnected monitors are reconnected to an empty workspace (#9874) --------- Co-authored-by: nyx --- src/Compositor.hpp | 95 +++++++++++++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 47 deletions(-) (limited to 'src/Compositor.hpp') diff --git a/src/Compositor.hpp b/src/Compositor.hpp index 2393662b..33780cc9 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -25,53 +25,54 @@ class CCompositor { CCompositor(bool onlyConfig = false); ~CCompositor(); - wl_display* m_sWLDisplay = nullptr; - wl_event_loop* m_sWLEventLoop = nullptr; - int m_iDRMFD = -1; - bool m_bInitialized = false; - SP m_pAqBackend; - - std::string m_szHyprTempDataRoot = ""; - - std::string m_szWLDisplaySocket = ""; - std::string m_szInstanceSignature = ""; - std::string m_szInstancePath = ""; - std::string m_szCurrentSplash = "error"; - - std::vector m_vMonitors; - std::vector m_vRealMonitors; // for all monitors, even those turned off - std::vector m_vWindows; - std::vector m_vLayers; - std::vector m_vWorkspaces; - std::vector m_vWindowsFadingOut; - std::vector m_vSurfacesFadingOut; - - std::unordered_map m_mMonitorIDMap; - - void initServer(std::string socketName, int socketFd); - void startCompositor(); - void stopCompositor(); - void cleanup(); - void bumpNofile(); - void restoreNofile(); - - WP m_pLastFocus; - PHLWINDOWREF m_pLastWindow; - PHLMONITORREF m_pLastMonitor; - - std::vector m_vWindowFocusHistory; // first element is the most recently focused. - - bool m_bReadyToProcess = false; - bool m_bSessionActive = true; - bool m_bDPMSStateON = true; - bool m_bUnsafeState = false; // unsafe state is when there is no monitors. - bool m_bNextIsUnsafe = false; - PHLMONITORREF m_pUnsafeOutput; // fallback output for the unsafe state - bool m_bIsShuttingDown = false; - bool m_bFinalRequests = false; - bool m_bDesktopEnvSet = false; - bool m_bWantsXwayland = true; - bool m_bOnlyConfigVerification = false; + wl_display* m_sWLDisplay = nullptr; + wl_event_loop* m_sWLEventLoop = nullptr; + int m_iDRMFD = -1; + bool m_bInitialized = false; + SP m_pAqBackend; + + std::string m_szHyprTempDataRoot = ""; + + std::string m_szWLDisplaySocket = ""; + std::string m_szInstanceSignature = ""; + std::string m_szInstancePath = ""; + std::string m_szCurrentSplash = "error"; + + std::vector m_vMonitors; + std::vector m_vRealMonitors; // for all monitors, even those turned off + std::vector m_vWindows; + std::vector m_vLayers; + std::vector m_vWorkspaces; + std::vector m_vWindowsFadingOut; + std::vector m_vSurfacesFadingOut; + + std::unordered_map m_mMonitorIDMap; + std::unordered_map m_mSeenMonitorWorkspaceMap; // map of seen monitor names to workspace IDs + + void initServer(std::string socketName, int socketFd); + void startCompositor(); + void stopCompositor(); + void cleanup(); + void bumpNofile(); + void restoreNofile(); + + WP m_pLastFocus; + PHLWINDOWREF m_pLastWindow; + PHLMONITORREF m_pLastMonitor; + + std::vector m_vWindowFocusHistory; // first element is the most recently focused. + + bool m_bReadyToProcess = false; + bool m_bSessionActive = true; + bool m_bDPMSStateON = true; + bool m_bUnsafeState = false; // unsafe state is when there is no monitors. + bool m_bNextIsUnsafe = false; + PHLMONITORREF m_pUnsafeOutput; // fallback output for the unsafe state + bool m_bIsShuttingDown = false; + bool m_bFinalRequests = false; + bool m_bDesktopEnvSet = false; + bool m_bWantsXwayland = true; + bool m_bOnlyConfigVerification = false; // ------------------------------------------------- // -- cgit v1.2.3