From 50e1bec85f8febdd78f50d94f140d07f9b34148d Mon Sep 17 00:00:00 2001 From: davc0n Date: Wed, 30 Apr 2025 23:45:20 +0200 Subject: helpers: refactor class member vars (#10218) --- src/helpers/Monitor.hpp | 154 ++++++++++++++++++++++++------------------------ 1 file changed, 76 insertions(+), 78 deletions(-) (limited to 'src/helpers/Monitor.hpp') diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index 88252ab4..31777b0c 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -71,7 +71,7 @@ class CMonitorState { private: void ensureBufferPresent(); - CMonitor* m_pOwner = nullptr; + CMonitor* m_owner = nullptr; }; class CMonitor { @@ -79,84 +79,82 @@ class CMonitor { CMonitor(SP output); ~CMonitor(); - Vector2D vecPosition = Vector2D(-1, -1); // means unset - Vector2D vecXWaylandPosition = Vector2D(-1, -1); // means unset - Vector2D vecSize = Vector2D(0, 0); - Vector2D vecPixelSize = Vector2D(0, 0); - Vector2D vecTransformedSize = Vector2D(0, 0); - - bool primary = false; - - MONITORID ID = MONITOR_INVALID; - PHLWORKSPACE activeWorkspace = nullptr; - PHLWORKSPACE activeSpecialWorkspace = nullptr; - float setScale = 1; // scale set by cfg - float scale = 1; // real scale - - std::string szName = ""; - std::string szDescription = ""; - std::string szShortDescription = ""; - - Vector2D vecReservedTopLeft = Vector2D(0, 0); - Vector2D vecReservedBottomRight = Vector2D(0, 0); - - drmModeModeInfo customDrmMode = {}; - - CMonitorState state; - CDamageRing damage; - - SP output; - float refreshRate = 60; // Hz - int forceFullFrames = 0; - bool scheduledRecalc = false; - wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL; - float xwaylandScale = 1.f; - Mat3x3 projMatrix; - std::optional forceSize; - SP currentMode; - SP cursorSwapchain; - uint32_t drmFormat = DRM_FORMAT_INVALID; - uint32_t prevDrmFormat = DRM_FORMAT_INVALID; - - bool dpmsStatus = true; - bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it. - bool enabled10bit = false; // as above, this can be TRUE even if 10 bit failed. - eCMType cmType = CM_SRGB; - float sdrSaturation = 1.0f; - float sdrBrightness = 1.0f; - bool createdByUser = false; - bool isUnsafeFallback = false; - - bool pendingFrame = false; // if we schedule a frame during rendering, reschedule it after - bool renderingActive = false; - - wl_event_source* renderTimer = nullptr; // for RAT - bool RATScheduled = false; - CTimer lastPresentationTimer; - - bool isBeingLeased = false; - - SMonitorRule activeMonitorRule; + Vector2D m_position = Vector2D(-1, -1); // means unset + Vector2D m_xwaylandPosition = Vector2D(-1, -1); // means unset + Vector2D m_size = Vector2D(0, 0); + Vector2D m_pixelSize = Vector2D(0, 0); + Vector2D m_transformedSize = Vector2D(0, 0); + + MONITORID m_id = MONITOR_INVALID; + PHLWORKSPACE m_activeWorkspace = nullptr; + PHLWORKSPACE m_activeSpecialWorkspace = nullptr; + float m_setScale = 1; // scale set by cfg + float m_scale = 1; // real scale + + std::string m_name = ""; + std::string m_description = ""; + std::string m_shortDescription = ""; + + Vector2D m_reservedTopLeft = Vector2D(0, 0); + Vector2D m_reservedBottomRight = Vector2D(0, 0); + + drmModeModeInfo m_customDrmMode = {}; + + CMonitorState m_state; + CDamageRing m_damage; + + SP m_output; + float m_refreshRate = 60; // Hz + int m_forceFullFrames = 0; + bool m_scheduledRecalc = false; + wl_output_transform m_transform = WL_OUTPUT_TRANSFORM_NORMAL; + float m_xwaylandScale = 1.f; + Mat3x3 m_projMatrix; + std::optional m_forceSize; + SP m_currentMode; + SP m_cursorSwapchain; + uint32_t m_drmFormat = DRM_FORMAT_INVALID; + uint32_t m_prevDrmFormat = DRM_FORMAT_INVALID; + + bool m_dpmsStatus = true; + bool m_vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it. + bool m_enabled10bit = false; // as above, this can be TRUE even if 10 bit failed. + eCMType m_cmType = CM_SRGB; + float m_sdrSaturation = 1.0f; + float m_sdrBrightness = 1.0f; + bool m_createdByUser = false; + bool m_isUnsafeFallback = false; + + bool m_pendingFrame = false; // if we schedule a frame during rendering, reschedule it after + bool m_renderingActive = false; + + wl_event_source* m_renderTimer = nullptr; // for RAT + bool m_ratsScheduled = false; + CTimer m_lastPresentationTimer; + + bool m_isBeingLeased = false; + + SMonitorRule m_activeMonitorRule; // explicit sync - Hyprutils::OS::CFileDescriptor inFence; // TODO: remove when aq uses CFileDescriptor + Hyprutils::OS::CFileDescriptor m_inFence; // TODO: remove when aq uses CFileDescriptor - PHLMONITORREF self; + PHLMONITORREF m_self; // mirroring - PHLMONITORREF pMirrorOf; - std::vector mirrors; + PHLMONITORREF m_mirrorOf; + std::vector m_mirrors; // ctm - Mat3x3 ctm = Mat3x3::identity(); - bool ctmUpdated = false; + Mat3x3 m_ctm = Mat3x3::identity(); + bool m_ctmUpdated = false; // for tearing - PHLWINDOWREF solitaryClient; + PHLWINDOWREF m_solitaryClient; // for direct scanout - PHLWINDOWREF lastScanout; - bool scanoutNeedsCursorUpdate = false; + PHLWINDOWREF m_lastScanout; + bool m_scanoutNeedsCursorUpdate = false; struct { bool canTear = false; @@ -165,7 +163,7 @@ class CMonitor { bool busy = false; bool frameScheduledWhileBusy = false; - } tearingState; + } m_tearingState; struct { CSignal destroy; @@ -173,9 +171,9 @@ class CMonitor { CSignal disconnect; CSignal dpmsChanged; CSignal modeChanged; - } events; + } m_events; - std::array, 4> m_aLayerSurfaceLayers; + std::array, 4> m_layerSurfaceLayers; // methods void onConnect(bool noRule); @@ -207,15 +205,15 @@ class CMonitor { void debugLastPresentation(const std::string& message); void onMonitorFrame(); - bool m_bEnabled = false; - bool m_bRenderingInitPassed = false; + bool m_enabled = false; + bool m_renderingInitPassed = false; WP m_previousFSWindow; - NColorManagement::SImageDescription imageDescription; + NColorManagement::SImageDescription m_imageDescription; // For the list lookup bool operator==(const CMonitor& rhs) { - return vecPosition == rhs.vecPosition && vecSize == rhs.vecSize && szName == rhs.szName; + return m_position == rhs.m_position && m_size == rhs.m_size && m_name == rhs.m_name; } // workspace previous per monitor functionality @@ -226,8 +224,8 @@ class CMonitor { void setupDefaultWS(const SMonitorRule&); WORKSPACEID findAvailableDefaultWS(); - bool doneScheduled = false; - std::stack prevWorkSpaces; + bool m_doneScheduled = false; + std::stack m_prevWorkSpaces; struct { CHyprSignalListener frame; @@ -236,5 +234,5 @@ class CMonitor { CHyprSignalListener needsFrame; CHyprSignalListener presented; CHyprSignalListener commit; - } listeners; + } m_listeners; }; -- cgit v1.2.3