From 9eabbb690ce811677c0a9f2b94ee703b02fc7c05 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Fri, 23 May 2025 20:12:30 -0400 Subject: [PATCH] chore: MSWindows only items initilize members in header --- src/lib/platform/MSWindowsDesks.cpp | 12 ------- src/lib/platform/MSWindowsDesks.h | 17 +++++---- src/lib/platform/MSWindowsScreen.cpp | 24 ------------- src/lib/platform/MSWindowsScreen.h | 44 ++++++++++++----------- src/lib/platform/MSWindowsScreenSaver.cpp | 9 ----- src/lib/platform/MSWindowsScreenSaver.h | 18 +++++----- 6 files changed, 43 insertions(+), 81 deletions(-) diff --git a/src/lib/platform/MSWindowsDesks.cpp b/src/lib/platform/MSWindowsDesks.cpp index 7b5788b69..e2ba4da14 100644 --- a/src/lib/platform/MSWindowsDesks.cpp +++ b/src/lib/platform/MSWindowsDesks.cpp @@ -112,19 +112,7 @@ MSWindowsDesks::MSWindowsDesks( : m_isPrimary(isPrimary), m_noHooks(noHooks), m_isOnScreen(m_isPrimary), - m_x(0), - m_y(0), - m_w(0), - m_h(0), - m_xCenter(0), - m_yCenter(0), - m_multimon(false), - m_timer(nullptr), m_screensaver(screensaver), - m_screensaverNotify(false), - m_activeDesk(nullptr), - m_activeDeskName(), - m_mutex(), m_deskReady(&m_mutex, false), m_updateKeys(updateKeys), m_events(events) diff --git a/src/lib/platform/MSWindowsDesks.h b/src/lib/platform/MSWindowsDesks.h index 7b626c9c4..d4e366012 100644 --- a/src/lib/platform/MSWindowsDesks.h +++ b/src/lib/platform/MSWindowsDesks.h @@ -243,23 +243,26 @@ private: HCURSOR m_cursor; // screen shape stuff - int32_t m_x, m_y; - int32_t m_w, m_h; - int32_t m_xCenter, m_yCenter; + int32_t m_x = 0; + int32_t m_y = 9; + int32_t m_w = 0; + int32_t m_h = 0; + int32_t m_xCenter = 0; + int32_t m_yCenter = 0; // true if system appears to have multiple monitors - bool m_multimon; + bool m_multimon = false; // the timer used to check for desktop switching - EventQueueTimer *m_timer; + EventQueueTimer *m_timer = nullptr; // screen saver stuff DWORD m_threadID; const IScreenSaver *m_screensaver; - bool m_screensaverNotify; + bool m_screensaverNotify = false; // the current desk and it's name - Desk *m_activeDesk; + Desk *m_activeDesk = nullptr; std::string m_activeDeskName; // one desk per desktop and a cond var to communicate with it diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp index 689e3ca4e..c4f40f27f 100644 --- a/src/lib/platform/MSWindowsScreen.cpp +++ b/src/lib/platform/MSWindowsScreen.cpp @@ -88,31 +88,7 @@ MSWindowsScreen::MSWindowsScreen( m_isPrimary(isPrimary), m_noHooks(noHooks), m_isOnScreen(m_isPrimary), - m_class(0), - m_x(0), - m_y(0), - m_w(0), - m_h(0), - m_xCenter(0), - m_yCenter(0), - m_multimon(false), - m_xCursor(0), - m_yCursor(0), - m_sequenceNumber(0), - m_mark(0), - m_markReceived(0), - m_fixTimer(nullptr), - m_keyLayout(nullptr), - m_screensaver(nullptr), - m_screensaverNotify(false), - m_screensaverActive(false), - m_window(nullptr), - m_clipboardSequenceNumber(0), - m_ownClipboard(false), - m_desks(nullptr), - m_keyState(nullptr), m_hasMouse(GetSystemMetrics(SM_MOUSEPRESENT) != 0), - m_showingMouse(false), m_events(events) { assert(s_windowInstance != nullptr); diff --git a/src/lib/platform/MSWindowsScreen.h b/src/lib/platform/MSWindowsScreen.h index 7d153c0a7..130cd026a 100644 --- a/src/lib/platform/MSWindowsScreen.h +++ b/src/lib/platform/MSWindowsScreen.h @@ -259,51 +259,55 @@ private: bool m_isOnScreen; // our resources - ATOM m_class; + ATOM m_class = 0; // screen shape stuff - int32_t m_x, m_y; - int32_t m_w, m_h; - int32_t m_xCenter, m_yCenter; + int32_t m_x = 0; + int32_t m_y = 0; + int32_t m_w = 0; + int32_t m_h = 0; + int32_t m_xCenter = 0; + int32_t m_yCenter = 0; // true if system appears to have multiple monitors - bool m_multimon; + bool m_multimon = false; // last mouse position - int32_t m_xCursor, m_yCursor; + int32_t m_xCursor = 0; + int32_t m_yCursor = 0; // last clipboard - uint32_t m_sequenceNumber; + uint32_t m_sequenceNumber = 0; // used to discard queued messages that are no longer needed - uint32_t m_mark; - uint32_t m_markReceived; + uint32_t m_mark = 0; + uint32_t m_markReceived = 0; // the main loop's thread id DWORD m_threadID; // timer for periodically checking stuff that requires polling - EventQueueTimer *m_fixTimer; + EventQueueTimer *m_fixTimer = nullptr; // the keyboard layout to use when off primary screen - HKL m_keyLayout; + HKL m_keyLayout = nullptr; // screen saver stuff - MSWindowsScreenSaver *m_screensaver; - bool m_screensaverNotify; - bool m_screensaverActive; + MSWindowsScreenSaver *m_screensaver = nullptr; + bool m_screensaverNotify = false; + bool m_screensaverActive = false; // clipboard stuff. our window is used mainly as a clipboard // owner and as a link in the clipboard viewer chain. - HWND m_window; - DWORD m_clipboardSequenceNumber; - bool m_ownClipboard; + HWND m_window = nullptr; + DWORD m_clipboardSequenceNumber = 0; + bool m_ownClipboard = false; // one desk per desktop and a cond var to communicate with it - MSWindowsDesks *m_desks; + MSWindowsDesks *m_desks = nullptr; // keyboard stuff - MSWindowsKeyState *m_keyState; + MSWindowsKeyState *m_keyState = nullptr; // hot key stuff HotKeyMap m_hotKeys; @@ -325,7 +329,7 @@ private: // cursor to be displayed when the user has entered this screen. // m_showingMouse is true when we're doing that. bool m_hasMouse; - bool m_showingMouse; + bool m_showingMouse = false; bool m_gotOldMouseKeys; MOUSEKEYS m_mouseKeys; MOUSEKEYS m_oldMouseKeys; diff --git a/src/lib/platform/MSWindowsScreenSaver.cpp b/src/lib/platform/MSWindowsScreenSaver.cpp index f2b9cf7b0..050e102b3 100644 --- a/src/lib/platform/MSWindowsScreenSaver.cpp +++ b/src/lib/platform/MSWindowsScreenSaver.cpp @@ -30,15 +30,6 @@ static const TCHAR *const g_pathScreenSaverIsSecure[] = {"Control Panel", "Deskt // MSWindowsScreenSaver::MSWindowsScreenSaver() - : m_wasSecure(false), - m_wasSecureAnInt(false), - m_process(nullptr), - m_watch(nullptr), - m_threadID(0), - m_msg(0), - m_wParam(0), - m_lParam(0), - m_active(false) { // check if screen saver is enabled SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, &m_wasEnabled, 0); diff --git a/src/lib/platform/MSWindowsScreenSaver.h b/src/lib/platform/MSWindowsScreenSaver.h index ccbd24387..688fddc99 100644 --- a/src/lib/platform/MSWindowsScreenSaver.h +++ b/src/lib/platform/MSWindowsScreenSaver.h @@ -63,17 +63,17 @@ private: private: BOOL m_wasEnabled; - bool m_wasSecure; - bool m_wasSecureAnInt; + bool m_wasSecure = false; + bool m_wasSecureAnInt = false; - HANDLE m_process; - Thread *m_watch; - DWORD m_threadID; - UINT m_msg; - WPARAM m_wParam; - LPARAM m_lParam; + HANDLE m_process = nullptr; + Thread *m_watch = nullptr; + DWORD m_threadID = 0; + UINT m_msg = 0; + WPARAM m_wParam = 0; + LPARAM m_lParam = 0; // checkActive state. true if the screen saver is being watched // for deactivation (and is therefore active). - bool m_active; + bool m_active = false; };