summaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authordavc0n <dconti.dev@gmail.com>2025-05-02 17:07:20 +0200
committerGitHub <noreply@github.com>2025-05-02 17:07:20 +0200
commitce821294e21978cadf4c3facbeec421b245ea2c9 (patch)
treeaa90efb5251160cd1ed37fc9443f596f80f6dd96 /src/managers
parent6f174a9e0892aab5c4c17a7da9be7f92bcdcebec (diff)
managers: refactor class member vars (#10242)
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/AnimationManager.cpp16
-rw-r--r--src/managers/AnimationManager.hpp6
-rw-r--r--src/managers/CursorManager.cpp161
-rw-r--r--src/managers/CursorManager.hpp22
-rw-r--r--src/managers/DonationNagManager.cpp8
-rw-r--r--src/managers/DonationNagManager.hpp2
-rw-r--r--src/managers/EventManager.cpp38
-rw-r--r--src/managers/EventManager.hpp6
-rw-r--r--src/managers/HookSystemManager.cpp14
-rw-r--r--src/managers/HookSystemManager.hpp6
-rw-r--r--src/managers/KeybindManager.cpp450
-rw-r--r--src/managers/KeybindManager.hpp38
-rw-r--r--src/managers/LayoutManager.cpp32
-rw-r--r--src/managers/LayoutManager.hpp8
-rw-r--r--src/managers/PointerManager.cpp210
-rw-r--r--src/managers/PointerManager.hpp22
-rw-r--r--src/managers/ProtocolManager.cpp4
-rw-r--r--src/managers/ProtocolManager.hpp2
-rw-r--r--src/managers/SeatManager.cpp274
-rw-r--r--src/managers/SeatManager.hpp35
-rw-r--r--src/managers/SessionLockManager.cpp68
-rw-r--r--src/managers/SessionLockManager.hpp8
-rw-r--r--src/managers/TokenManager.cpp12
-rw-r--r--src/managers/TokenManager.hpp2
-rw-r--r--src/managers/VersionKeeperManager.cpp4
-rw-r--r--src/managers/VersionKeeperManager.hpp2
-rw-r--r--src/managers/XCursorManager.cpp72
-rw-r--r--src/managers/XCursorManager.hpp12
-rw-r--r--src/managers/input/InputManager.cpp42
-rw-r--r--src/managers/input/Tablets.cpp4
30 files changed, 789 insertions, 791 deletions
diff --git a/src/managers/AnimationManager.cpp b/src/managers/AnimationManager.cpp
index 0d3aa9c7..d49b4790 100644
--- a/src/managers/AnimationManager.cpp
+++ b/src/managers/AnimationManager.cpp
@@ -33,9 +33,9 @@ static int wlTick(SP<CEventLoopTimer> self, void* data) {
}
CHyprAnimationManager::CHyprAnimationManager() {
- m_pAnimationTimer = SP<CEventLoopTimer>(new CEventLoopTimer(std::chrono::microseconds(500), wlTick, nullptr));
+ m_animationTimer = SP<CEventLoopTimer>(new CEventLoopTimer(std::chrono::microseconds(500), wlTick, nullptr));
if (g_pEventLoopManager) // null in --verify-config mode
- g_pEventLoopManager->addTimer(m_pAnimationTimer);
+ g_pEventLoopManager->addTimer(m_animationTimer);
addBezierWithName("linear", Vector2D(0.0, 0.0), Vector2D(1.0, 1.0));
}
@@ -213,7 +213,7 @@ static void handleUpdate(CAnimatedVariable<VarType>& av, bool warp) {
void CHyprAnimationManager::tick() {
static std::chrono::time_point lastTick = std::chrono::high_resolution_clock::now();
- m_fLastTickTime = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - lastTick).count() / 1000.0;
+ m_lastTickTimeMs = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - lastTick).count() / 1000.0;
lastTick = std::chrono::high_resolution_clock::now();
static auto PANIMENABLED = CConfigValue<Hyprlang::INT>("animations:enabled");
@@ -250,15 +250,15 @@ void CHyprAnimationManager::tick() {
}
void CHyprAnimationManager::scheduleTick() {
- if (m_bTickScheduled)
+ if (m_tickScheduled)
return;
- m_bTickScheduled = true;
+ m_tickScheduled = true;
const auto PMOSTHZ = g_pHyprRenderer->m_pMostHzMonitor;
if (!PMOSTHZ) {
- m_pAnimationTimer->updateTimeout(std::chrono::milliseconds(16));
+ m_animationTimer->updateTimeout(std::chrono::milliseconds(16));
return;
}
@@ -268,11 +268,11 @@ void CHyprAnimationManager::scheduleTick() {
const auto TOPRES = std::clamp(refreshDelayMs - SINCEPRES, 1.1f, 1000.f); // we can't send 0, that will disarm it
- m_pAnimationTimer->updateTimeout(std::chrono::milliseconds((int)std::floor(TOPRES)));
+ m_animationTimer->updateTimeout(std::chrono::milliseconds((int)std::floor(TOPRES)));
}
void CHyprAnimationManager::onTicked() {
- m_bTickScheduled = false;
+ m_tickScheduled = false;
}
//
diff --git a/src/managers/AnimationManager.hpp b/src/managers/AnimationManager.hpp
index 833087d7..07e30c90 100644
--- a/src/managers/AnimationManager.hpp
+++ b/src/managers/AnimationManager.hpp
@@ -49,12 +49,12 @@ class CHyprAnimationManager : public Hyprutils::Animation::CAnimationManager {
std::string styleValidInConfigVar(const std::string&, const std::string&);
- SP<CEventLoopTimer> m_pAnimationTimer;
+ SP<CEventLoopTimer> m_animationTimer;
- float m_fLastTickTime; // in ms
+ float m_lastTickTimeMs;
private:
- bool m_bTickScheduled = false;
+ bool m_tickScheduled = false;
// Anim stuff
void animationPopin(PHLWINDOW, bool close = false, float minPerc = 0.f);
diff --git a/src/managers/CursorManager.cpp b/src/managers/CursorManager.cpp
index b7c2e4e2..77ea5a28 100644
--- a/src/managers/CursorManager.cpp
+++ b/src/managers/CursorManager.cpp
@@ -69,45 +69,45 @@ void CCursorBuffer::endDataPtr() {
}
CCursorManager::CCursorManager() {
- m_pHyprcursor = makeUnique<Hyprcursor::CHyprcursorManager>(m_szTheme.empty() ? nullptr : m_szTheme.c_str(), hcLogger);
- m_pXcursor = makeUnique<CXCursorManager>();
+ m_hyprcursor = makeUnique<Hyprcursor::CHyprcursorManager>(m_theme.empty() ? nullptr : m_theme.c_str(), hcLogger);
+ m_xcursor = makeUnique<CXCursorManager>();
static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor");
- if (m_pHyprcursor->valid() && *PUSEHYPRCURSOR) {
+ if (m_hyprcursor->valid() && *PUSEHYPRCURSOR) {
// find default size. First, HYPRCURSOR_SIZE then default to 24
auto const* SIZE = getenv("HYPRCURSOR_SIZE");
if (SIZE) {
try {
- m_iSize = std::stoi(SIZE);
+ m_size = std::stoi(SIZE);
} catch (...) { ; }
}
- if (m_iSize <= 0) {
+ if (m_size <= 0) {
Debug::log(WARN, "HYPRCURSOR_SIZE size not set, defaulting to size 24");
- m_iSize = 24;
+ m_size = 24;
}
} else {
- Debug::log(ERR, "Hyprcursor failed loading theme \"{}\", falling back to Xcursor.", m_szTheme);
+ Debug::log(ERR, "Hyprcursor failed loading theme \"{}\", falling back to Xcursor.", m_theme);
auto const* SIZE = getenv("XCURSOR_SIZE");
if (SIZE) {
try {
- m_iSize = std::stoi(SIZE);
+ m_size = std::stoi(SIZE);
} catch (...) { ; }
}
- if (m_iSize <= 0) {
+ if (m_size <= 0) {
Debug::log(WARN, "XCURSOR_SIZE size not set, defaulting to size 24");
- m_iSize = 24;
+ m_size = 24;
}
}
// since we fallback to xcursor always load it on startup. otherwise we end up with a empty theme if hyprcursor is enabled in the config
// and then later is disabled.
- m_pXcursor->loadTheme(getenv("XCURSOR_THEME") ? getenv("XCURSOR_THEME") : "default", m_iSize, m_fCursorScale);
+ m_xcursor->loadTheme(getenv("XCURSOR_THEME") ? getenv("XCURSOR_THEME") : "default", m_size, m_cursorScale);
- m_pAnimationTimer = makeShared<CEventLoopTimer>(std::nullopt, cursorAnimTimer, this);
- g_pEventLoopManager->addTimer(m_pAnimationTimer);
+ m_animationTimer = makeShared<CEventLoopTimer>(std::nullopt, cursorAnimTimer, this);
+ g_pEventLoopManager->addTimer(m_animationTimer);
updateTheme();
@@ -115,17 +115,17 @@ CCursorManager::CCursorManager() {
}
CCursorManager::~CCursorManager() {
- if (m_pAnimationTimer && g_pEventLoopManager) {
- g_pEventLoopManager->removeTimer(m_pAnimationTimer);
- m_pAnimationTimer.reset();
+ if (m_animationTimer && g_pEventLoopManager) {
+ g_pEventLoopManager->removeTimer(m_animationTimer);
+ m_animationTimer.reset();
}
- if (m_pHyprcursor->valid() && m_sCurrentStyleInfo.size > 0)
- m_pHyprcursor->cursorSurfaceStyleDone(m_sCurrentStyleInfo);
+ if (m_hyprcursor->valid() && m_currentStyleInfo.size > 0)
+ m_hyprcursor->cursorSurfaceStyleDone(m_currentStyleInfo);
}
SP<Aquamarine::IBuffer> CCursorManager::getCursorBuffer() {
- return !m_vCursorBuffers.empty() ? m_vCursorBuffers.back() : nullptr;
+ return !m_cursorBuffers.empty() ? m_cursorBuffers.back() : nullptr;
}
void CCursorManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot) {
@@ -134,28 +134,28 @@ void CCursorManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotsp
else
g_pPointerManager->setCursorSurface(surf, hotspot);
- m_bOurBufferConnected = false;
+ m_ourBufferConnected = false;
}
void CCursorManager::setCursorBuffer(SP<CCursorBuffer> buf, const Vector2D& hotspot, const float& scale) {
- m_vCursorBuffers.emplace_back(buf);
+ m_cursorBuffers.emplace_back(buf);
g_pPointerManager->setCursorBuffer(getCursorBuffer(), hotspot, scale);
- if (m_vCursorBuffers.size() > 1)
- std::erase_if(m_vCursorBuffers, [this](const auto& buf) { return buf.get() == m_vCursorBuffers.front().get(); });
+ if (m_cursorBuffers.size() > 1)
+ std::erase_if(m_cursorBuffers, [this](const auto& buf) { return buf.get() == m_cursorBuffers.front().get(); });
- m_bOurBufferConnected = true;
+ m_ourBufferConnected = true;
}
void CCursorManager::setAnimationTimer(const int& frame, const int& delay) {
if (delay > 0) {
// arm
- m_pAnimationTimer->updateTimeout(std::chrono::milliseconds(delay));
+ m_animationTimer->updateTimeout(std::chrono::milliseconds(delay));
} else {
// disarm
- m_pAnimationTimer->updateTimeout(std::nullopt);
+ m_animationTimer->updateTimeout(std::nullopt);
}
- m_iCurrentAnimationFrame = frame;
+ m_currentAnimationFrame = frame;
}
void CCursorManager::setCursorFromName(const std::string& name) {
@@ -163,9 +163,9 @@ void CCursorManager::setCursorFromName(const std::string& name) {
static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor");
auto setXCursor = [this](auto const& name) {
- float scale = std::ceil(m_fCursorScale);
+ float scale = std::ceil(m_cursorScale);
- auto xcursor = m_pXcursor->getShape(name, m_iSize, m_fCursorScale);
+ auto xcursor = m_xcursor->getShape(name, m_size, m_cursorScale);
auto& icon = xcursor->images.front();
auto buf = makeShared<CCursorBuffer>((uint8_t*)icon.pixels.data(), icon.size, icon.hotspot);
setCursorBuffer(buf, icon.hotspot / scale, scale);
@@ -181,90 +181,89 @@ void CCursorManager::setCursorFromName(const std::string& name) {
};
auto setHyprCursor = [this](auto const& name) {
- m_sCurrentCursorShapeData = m_pHyprcursor->getShape(name.c_str(), m_sCurrentStyleInfo);
+ m_currentCursorShapeData = m_hyprcursor->getShape(name.c_str(), m_currentStyleInfo);
- if (m_sCurrentCursorShapeData.images.size() < 1) {
+ if (m_currentCursorShapeData.images.size() < 1) {
// try with '_' first (old hc, etc)
std::string newName = name;
std::replace(newName.begin(), newName.end(), '-', '_');
- m_sCurrentCursorShapeData = m_pHyprcursor->getShape(newName.c_str(), m_sCurrentStyleInfo);
+ m_currentCursorShapeData = m_hyprcursor->getShape(newName.c_str(), m_currentStyleInfo);
}
- if (m_sCurrentCursorShapeData.images.size() < 1) {
+ if (m_currentCursorShapeData.images.size() < 1) {
// fallback to a default if available
constexpr const std::array<const char*, 3> fallbackShapes = {"default", "left_ptr", "left-ptr"};
for (auto const& s : fallbackShapes) {
- m_sCurrentCursorShapeData = m_pHyprcursor->getShape(s, m_sCurrentStyleInfo);
+ m_currentCursorShapeData = m_hyprcursor->getShape(s, m_currentStyleInfo);
- if (m_sCurrentCursorShapeData.images.size() > 0)
+ if (m_currentCursorShapeData.images.size() > 0)
break;
}
- if (m_sCurrentCursorShapeData.images.size() < 1) {
+ if (m_currentCursorShapeData.images.size() < 1) {
Debug::log(ERR, "BUG THIS: No fallback found for a cursor in setCursorFromName");
return false;
}
}
- auto buf =
- makeShared<CCursorBuffer>(m_sCurrentCursorShapeData.images[0].surface, Vector2D{m_sCurrentCursorShapeData.images[0].size, m_sCurrentCursorShapeData.images[0].size},
- Vector2D{m_sCurrentCursorShapeData.images[0].hotspotX, m_sCurrentCursorShapeData.images[0].hotspotY});
- auto hotspot = Vector2D{m_sCurrentCursorShapeData.images[0].hotspotX, m_sCurrentCursorShapeData.images[0].hotspotY} / m_fCursorScale;
- setCursorBuffer(buf, hotspot, m_fCursorScale);
+ auto buf = makeShared<CCursorBuffer>(m_currentCursorShapeData.images[0].surface, Vector2D{m_currentCursorShapeData.images[0].size, m_currentCursorShapeData.images[0].size},
+ Vector2D{m_currentCursorShapeData.images[0].hotspotX, m_currentCursorShapeData.images[0].hotspotY});
+ auto hotspot = Vector2D{m_currentCursorShapeData.images[0].hotspotX, m_currentCursorShapeData.images[0].hotspotY} / m_cursorScale;
+ setCursorBuffer(buf, hotspot, m_cursorScale);
int delay = 0;
int frame = 0;
- if (m_sCurrentCursorShapeData.images.size() > 1)
- delay = m_sCurrentCursorShapeData.images[frame].delay;
+ if (m_currentCursorShapeData.images.size() > 1)
+ delay = m_currentCursorShapeData.images[frame].delay;
setAnimationTimer(frame, delay);
return true;
};
- if (!m_pHyprcursor->valid() || !*PUSEHYPRCURSOR || !setHyprCursor(name))
+ if (!m_hyprcursor->valid() || !*PUSEHYPRCURSOR || !setHyprCursor(name))
setXCursor(name);
}
void CCursorManager::tickAnimatedCursor() {
- if (!m_bOurBufferConnected)
+ if (!m_ourBufferConnected)
return;
- if (!m_pHyprcursor->valid() && m_currentXcursor->images.size() > 1) {
- m_iCurrentAnimationFrame++;
+ if (!m_hyprcursor->valid() && m_currentXcursor->images.size() > 1) {
+ m_currentAnimationFrame++;
- if ((size_t)m_iCurrentAnimationFrame >= m_currentXcursor->images.size())
- m_iCurrentAnimationFrame = 0;
+ if ((size_t)m_currentAnimationFrame >= m_currentXcursor->images.size())
+ m_currentAnimationFrame = 0;
- float scale = std::ceil(m_fCursorScale);
- auto& icon = m_currentXcursor->images.at(m_iCurrentAnimationFrame);
+ float scale = std::ceil(m_cursorScale);
+ auto& icon = m_currentXcursor->images.at(m_currentAnimationFrame);
auto buf = makeShared<CCursorBuffer>((uint8_t*)icon.pixels.data(), icon.size, icon.hotspot);
setCursorBuffer(buf, icon.hotspot / scale, scale);
- setAnimationTimer(m_iCurrentAnimationFrame, m_currentXcursor->images[m_iCurrentAnimationFrame].delay);
- } else if (m_sCurrentCursorShapeData.images.size() > 1) {
- m_iCurrentAnimationFrame++;
+ setAnimationTimer(m_currentAnimationFrame, m_currentXcursor->images[m_currentAnimationFrame].delay);
+ } else if (m_currentCursorShapeData.images.size() > 1) {
+ m_currentAnimationFrame++;
- if ((size_t)m_iCurrentAnimationFrame >= m_sCurrentCursorShapeData.images.size())
- m_iCurrentAnimationFrame = 0;
+ if ((size_t)m_currentAnimationFrame >= m_currentCursorShapeData.images.size())
+ m_currentAnimationFrame = 0;
auto hotspot =
- Vector2D{m_sCurrentCursorShapeData.images[m_iCurrentAnimationFrame].hotspotX, m_sCurrentCursorShapeData.images[m_iCurrentAnimationFrame].hotspotY} / m_fCursorScale;
+ Vector2D{m_currentCursorShapeData.images[m_currentAnimationFrame].hotspotX, m_currentCursorShapeData.images[m_currentAnimationFrame].hotspotY} / m_cursorScale;
auto buf = makeShared<CCursorBuffer>(
- m_sCurrentCursorShapeData.images[m_iCurrentAnimationFrame].surface,
- Vector2D{m_sCurrentCursorShapeData.images[m_iCurrentAnimationFrame].size, m_sCurrentCursorShapeData.images[m_iCurrentAnimationFrame].size},
- Vector2D{m_sCurrentCursorShapeData.images[m_iCurrentAnimationFrame].hotspotX, m_sCurrentCursorShapeData.images[m_iCurrentAnimationFrame].hotspotY});
- setCursorBuffer(buf, hotspot, m_fCursorScale);
- setAnimationTimer(m_iCurrentAnimationFrame, m_sCurrentCursorShapeData.images[m_iCurrentAnimationFrame].delay);
+ m_currentCursorShapeData.images[m_currentAnimationFrame].surface,
+ Vector2D{m_currentCursorShapeData.images[m_currentAnimationFrame].size, m_currentCursorShapeData.images[m_currentAnimationFrame].size},
+ Vector2D{m_currentCursorShapeData.images[m_currentAnimationFrame].hotspotX, m_currentCursorShapeData.images[m_currentAnimationFrame].hotspotY});
+ setCursorBuffer(buf, hotspot, m_cursorScale);
+ setAnimationTimer(m_currentAnimationFrame, m_currentCursorShapeData.images[m_currentAnimationFrame].delay);
}
}
SCursorImageData CCursorManager::dataFor(const std::string& name) {
- if (!m_pHyprcursor->valid())
+ if (!m_hyprcursor->valid())
return {};
- const auto IMAGES = m_pHyprcursor->getShape(name.c_str(), m_sCurrentStyleInfo);
+ const auto IMAGES = m_hyprcursor->getShape(name.c_str(), m_currentStyleInfo);
if (IMAGES.images.empty())
return {};
@@ -279,7 +278,7 @@ void CCursorManager::setXWaylandCursor() {
g_pXWayland->setCursor(cairo_image_surface_get_data(CURSOR.surface), cairo_image_surface_get_stride(CURSOR.surface), {CURSOR.size, CURSOR.size},
{CURSOR.hotspotX, CURSOR.hotspotY});
else {
- auto xcursor = m_pXcursor->getShape("left_ptr", m_iSize, 1);
+ auto xcursor = m_xcursor->getShape("left_ptr", m_size, 1);
auto& icon = xcursor->images.front();
g_pXWayland->setCursor((uint8_t*)icon.pixels.data(), icon.size.x * 4, icon.size, icon.hotspot);
@@ -295,16 +294,16 @@ void CCursorManager::updateTheme() {
highestScale = m->m_scale;
}
- m_fCursorScale = highestScale;
+ m_cursorScale = highestScale;
if (*PUSEHYPRCURSOR) {
- if (m_sCurrentStyleInfo.size > 0 && m_pHyprcursor->valid())
- m_pHyprcursor->cursorSurfaceStyleDone(m_sCurrentStyleInfo);
+ if (m_currentStyleInfo.size > 0 && m_hyprcursor->valid())
+ m_hyprcursor->cursorSurfaceStyleDone(m_currentStyleInfo);
- m_sCurrentStyleInfo.size = std::round(m_iSize * highestScale);
+ m_currentStyleInfo.size = std::round(m_size * highestScale);
- if (m_pHyprcursor->valid())
- m_pHyprcursor->loadThemeStyle(m_sCurrentStyleInfo);
+ if (m_hyprcursor->valid())
+ m_hyprcursor->loadThemeStyle(m_currentStyleInfo);
}
for (auto const& m : g_pCompositor->m_monitors) {
@@ -315,24 +314,24 @@ void CCursorManager::updateTheme() {
bool CCursorManager::changeTheme(const std::string& name, const int size) {
static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor");
- m_szTheme = name.empty() ? "" : name;
- m_iSize = size <= 0 ? 24 : size;
+ m_theme = name.empty() ? "" : name;
+ m_size = size <= 0 ? 24 : size;
auto xcursor_theme = getenv("XCURSOR_THEME") ? getenv("XCURSOR_THEME") : "default";
if (*PUSEHYPRCURSOR) {
auto options = Hyprcursor::SManagerOptions();
options.logFn = hcLogger;
options.allowDefaultFallback = false;
- m_szTheme = name.empty() ? "" : name;
- m_iSize = size;
+ m_theme = name.empty() ? "" : name;
+ m_size = size;
- m_pHyprcursor = makeUnique<Hyprcursor::CHyprcursorManager>(m_szTheme.empty() ? nullptr : m_szTheme.c_str(), options);
- if (!m_pHyprcursor->valid()) {
- Debug::log(ERR, "Hyprcursor failed loading theme \"{}\", falling back to XCursor.", m_szTheme);
- m_pXcursor->loadTheme(m_szTheme.empty() ? xcursor_theme : m_szTheme, m_iSize, m_fCursorScale);
+ m_hyprcursor = makeUnique<Hyprcursor::CHyprcursorManager>(m_theme.empty() ? nullptr : m_theme.c_str(), options);
+ if (!m_hyprcursor->valid()) {
+ Debug::log(ERR, "Hyprcursor failed loading theme \"{}\", falling back to XCursor.", m_theme);
+ m_xcursor->loadTheme(m_theme.empty() ? xcursor_theme : m_theme, m_size, m_cursorScale);
}
} else
- m_pXcursor->loadTheme(m_szTheme.empty() ? xcursor_theme : m_szTheme, m_iSize, m_fCursorScale);
+ m_xcursor->loadTheme(m_theme.empty() ? xcursor_theme : m_theme, m_size, m_cursorScale);
updateTheme();
@@ -340,5 +339,5 @@ bool CCursorManager::changeTheme(const std::string& name, const int size) {
}
void CCursorManager::syncGsettings() {
- m_pXcursor->syncGsettings();
+ m_xcursor->syncGsettings();
}
diff --git a/src/managers/CursorManager.hpp b/src/managers/CursorManager.hpp
index 30741a62..03420dab 100644
--- a/src/managers/CursorManager.hpp
+++ b/src/managers/CursorManager.hpp
@@ -56,22 +56,22 @@ class CCursorManager {
void tickAnimatedCursor();
private:
- bool m_bOurBufferConnected = false;
- std::vector<SP<CCursorBuffer>> m_vCursorBuffers;
+ bool m_ourBufferConnected = false;
+ std::vector<SP<CCursorBuffer>> m_cursorBuffers;
- UP<Hyprcursor::CHyprcursorManager> m_pHyprcursor;
- UP<CXCursorManager> m_pXcursor;
+ UP<Hyprcursor::CHyprcursorManager> m_hyprcursor;
+ UP<CXCursorManager> m_xcursor;
SP<SXCursors> m_currentXcursor;
- std::string m_szTheme = "";
- int m_iSize = 0;
- float m_fCursorScale = 1.0;
+ std::string m_theme = "";
+ int m_size = 0;
+ float m_cursorScale = 1.0;
- Hyprcursor::SCursorStyleInfo m_sCurrentStyleInfo;
+ Hyprcursor::SCursorStyleInfo m_currentStyleInfo;
- SP<CEventLoopTimer> m_pAnimationTimer;
- int m_iCurrentAnimationFrame = 0;
- Hyprcursor::SCursorShapeData m_sCurrentCursorShapeData;
+ SP<CEventLoopTimer> m_animationTimer;
+ int m_currentAnimationFrame = 0;
+ Hyprcursor::SCursorShapeData m_currentCursorShapeData;
};
inline UP<CCursorManager> g_pCursorManager;
diff --git a/src/managers/DonationNagManager.cpp b/src/managers/DonationNagManager.cpp
index 454a02a0..249fbdcf 100644
--- a/src/managers/DonationNagManager.cpp
+++ b/src/managers/DonationNagManager.cpp
@@ -102,7 +102,7 @@ CDonationNagManager::CDonationNagManager() {
break;
}
- if (!m_bFired)
+ if (!m_fired)
Debug::log(LOG, "DonationNag: didn't hit any nagging periods, checking update");
if (state.major < currentMajor) {
@@ -115,18 +115,18 @@ CDonationNagManager::CDonationNagManager() {
writeState(state);
}
- if (!m_bFired)
+ if (!m_fired)
Debug::log(LOG, "DonationNag: didn't hit nagging conditions");
}
bool CDonationNagManager::fired() {
- return m_bFired;
+ return m_fired;
}
void CDonationNagManager::fire() {
static const auto DATAROOT = NFsUtils::getDataHome();
- m_bFired = true;
+ m_fired = true;
g_pEventLoopManager->doLater([] {
CProcess proc("hyprland-donate-screen", {});
diff --git a/src/managers/DonationNagManager.hpp b/src/managers/DonationNagManager.hpp
index ce6015de..c33ae07a 100644
--- a/src/managers/DonationNagManager.hpp
+++ b/src/managers/DonationNagManager.hpp
@@ -19,7 +19,7 @@ class CDonationNagManager {
void writeState(const SStateData& s);
void fire();
- bool m_bFired = false;
+ bool m_fired = false;
};
inline UP<CDonationNagManager> g_pDonationNagManager; \ No newline at end of file
diff --git a/src/managers/EventManager.cpp b/src/managers/EventManager.cpp
index d7535dc7..651bf436 100644
--- a/src/managers/EventManager.cpp
+++ b/src/managers/EventManager.cpp
@@ -11,8 +11,8 @@
#include <cstring>
using namespace Hyprutils::OS;
-CEventManager::CEventManager() : m_iSocketFD(socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) {
- if (!m_iSocketFD.isValid()) {
+CEventManager::CEventManager() : m_socketFD(socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)) {
+ if (!m_socketFD.isValid()) {
Debug::log(ERR, "Couldn't start the Hyprland Socket 2. (1) IPC will not work.");
return;
}
@@ -26,27 +26,27 @@ CEventManager::CEventManager() : m_iSocketFD(socket(AF_UNIX, SOCK_STREAM | SOCK_
strncpy(SERVERADDRESS.sun_path, PATH.c_str(), sizeof(SERVERADDRESS.sun_path) - 1);
- if (bind(m_iSocketFD.get(), (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) {
+ if (bind(m_socketFD.get(), (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS)) < 0) {
Debug::log(ERR, "Couldn't bind the Hyprland Socket 2. (3) IPC will not work.");
return;
}
// 10 max queued.
- if (listen(m_iSocketFD.get(), 10) < 0) {
+ if (listen(m_socketFD.get(), 10) < 0) {
Debug::log(ERR, "Couldn't listen on the Hyprland Socket 2. (4) IPC will not work.");
return;
}
- m_pEventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, m_iSocketFD.get(), WL_EVENT_READABLE, onClientEvent, nullptr);
+ m_eventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, m_socketFD.get(), WL_EVENT_READABLE, onClientEvent, nullptr);
}
CEventManager::~CEventManager() {
- for (const auto& client : m_vClients) {
+ for (const auto& client : m_clients) {
wl_event_source_remove(client.eventSource);
}
- if (m_pEventSource != nullptr)
- wl_event_source_remove(m_pEventSource);
+ if (m_eventSource != nullptr)
+ wl_event_source_remove(m_eventSource);
}
int CEventManager::onServerEvent(int fd, uint32_t mask, void* data) {
@@ -61,22 +61,22 @@ int CEventManager::onServerEvent(int fd, uint32_t mask) {
if (mask & WL_EVENT_ERROR || mask & WL_EVENT_HANGUP) {
Debug::log(ERR, "Socket2 hangup?? IPC broke");
- wl_event_source_remove(m_pEventSource);
- m_pEventSource = nullptr;
- m_iSocketFD.reset();
+ wl_event_source_remove(m_eventSource);
+ m_eventSource = nullptr;
+ m_socketFD.reset();
return 0;
}
sockaddr_in clientAddress;
socklen_t clientSize = sizeof(clientAddress);
- CFileDescriptor ACCEPTEDCONNECTION{accept4(m_iSocketFD.get(), (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC | SOCK_NONBLOCK)};
+ CFileDescriptor ACCEPTEDCONNECTION{accept4(m_socketFD.get(), (sockaddr*)&clientAddress, &clientSize, SOCK_CLOEXEC | SOCK_NONBLOCK)};
if (!ACCEPTEDCONNECTION.isValid()) {
if (errno != EAGAIN) {
Debug::log(ERR, "Socket2 failed receiving connection, errno: {}", errno);
- wl_event_source_remove(m_pEventSource);
- m_pEventSource = nullptr;
- m_iSocketFD.reset();
+ wl_event_source_remove(m_eventSource);
+ m_eventSource = nullptr;
+ m_socketFD.reset();
}
return 0;
@@ -86,7 +86,7 @@ int CEventManager::onServerEvent(int fd, uint32_t mask) {
// add to event loop so we can close it when we need to
auto* eventSource = wl_event_loop_add_fd(g_pCompositor->m_wlEventLoop, ACCEPTEDCONNECTION.get(), 0, onServerEvent, nullptr);
- m_vClients.emplace_back(SClient{
+ m_clients.emplace_back(SClient{
std::move(ACCEPTEDCONNECTION),
{},
eventSource,
@@ -123,14 +123,14 @@ int CEventManager::onClientEvent(int fd, uint32_t mask) {
}
std::vector<CEventManager::SClient>::iterator CEventManager::findClientByFD(int fd) {
- return std::find_if(m_vClients.begin(), m_vClients.end(), [fd](const auto& client) { return client.fd.get() == fd; });
+ return std::find_if(m_clients.begin(), m_clients.end(), [fd](const auto& client) { return client.fd.get() == fd; });
}
std::vector<CEventManager::SClient>::iterator CEventManager::removeClientByFD(int fd) {
const auto CLIENTIT = findClientByFD(fd);
wl_event_source_remove(CLIENTIT->eventSource);
- return m_vClients.erase(CLIENTIT);
+ return m_clients.erase(CLIENTIT);
}
std::string CEventManager::formatEvent(const SHyprIPCEvent& event) const {
@@ -148,7 +148,7 @@ void CEventManager::postEvent(const SHyprIPCEvent& event) {
const size_t MAX_QUEUED_EVENTS = 64;
auto sharedEvent = makeShared<std::string>(formatEvent(event));
- for (auto it = m_vClients.begin(); it != m_vClients.end();) {
+ for (auto it = m_clients.begin(); it != m_clients.end();) {
// try to send the event immediately if the queue is empty
const auto QUEUESIZE = it->events.size();
if (QUEUESIZE > 0 || write(it->fd.get(), sharedEvent->c_str(), sharedEvent->length()) < 0) {
diff --git a/src/managers/EventManager.hpp b/src/managers/EventManager.hpp
index c8335d20..bfed9790 100644
--- a/src/managers/EventManager.hpp
+++ b/src/managers/EventManager.hpp
@@ -35,10 +35,10 @@ class CEventManager {
std::vector<SClient>::iterator removeClientByFD(int fd);
private:
- Hyprutils::OS::CFileDescriptor m_iSocketFD;
- wl_event_source* m_pEventSource = nullptr;
+ Hyprutils::OS::CFileDescriptor m_socketFD;
+ wl_event_source* m_eventSource = nullptr;
- std::vector<SClient> m_vClients;
+ std::vector<SClient> m_clients;
};
inline UP<CEventManager> g_pEventManager;
diff --git a/src/managers/HookSystemManager.cpp b/src/managers/HookSystemManager.cpp
index 624d2fe1..67e6e732 100644
--- a/src/managers/HookSystemManager.cpp
+++ b/src/managers/HookSystemManager.cpp
@@ -9,12 +9,12 @@ CHookSystemManager::CHookSystemManager() {
// returns the pointer to the function
SP<HOOK_CALLBACK_FN> CHookSystemManager::hookDynamic(const std::string& event, HOOK_CALLBACK_FN fn, HANDLE handle) {
SP<HOOK_CALLBACK_FN> hookFN = makeShared<HOOK_CALLBACK_FN>(fn);
- m_mRegisteredHooks[event].emplace_back(SCallbackFNPtr{.fn = hookFN, .handle = handle});
+ m_registeredHooks[event].emplace_back(SCallbackFNPtr{.fn = hookFN, .handle = handle});
return hookFN;
}
void CHookSystemManager::unhook(SP<HOOK_CALLBACK_FN> fn) {
- for (auto& [k, v] : m_mRegisteredHooks) {
+ for (auto& [k, v] : m_registeredHooks) {
std::erase_if(v, [&](const auto& other) {
SP<HOOK_CALLBACK_FN> fn_ = other.fn.lock();
@@ -32,7 +32,7 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
for (auto const& cb : *callbacks) {
- m_bCurrentEventPlugin = false;
+ m_currentEventPlugin = false;
if (!cb.handle) {
// we don't guard hl hooks
@@ -44,13 +44,13 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
continue;
}
- m_bCurrentEventPlugin = true;
+ m_currentEventPlugin = true;
if (std::find(faultyHandles.begin(), faultyHandles.end(), cb.handle) != faultyHandles.end())
continue;
try {
- if (!setjmp(m_jbHookFaultJumpBuf)) {
+ if (!setjmp(m_hookFaultJumpBuf)) {
if (SP<HOOK_CALLBACK_FN> fn = cb.fn.lock())
(*fn)(fn.get(), info, data);
else
@@ -76,8 +76,8 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
}
std::vector<SCallbackFNPtr>* CHookSystemManager::getVecForEvent(const std::string& event) {
- if (!m_mRegisteredHooks.contains(event))
+ if (!m_registeredHooks.contains(event))
Debug::log(LOG, "[hookSystem] New hook event registered: {}", event);
- return &m_mRegisteredHooks[event];
+ return &m_registeredHooks[event];
}
diff --git a/src/managers/HookSystemManager.hpp b/src/managers/HookSystemManager.hpp
index c679c380..69d54a60 100644
--- a/src/managers/HookSystemManager.hpp
+++ b/src/managers/HookSystemManager.hpp
@@ -50,11 +50,11 @@ class CHookSystemManager {
void emit(std::vector<SCallbackFNPtr>* const callbacks, SCallbackInfo& info, std::any data = 0);
std::vector<SCallbackFNPtr>* getVecForEvent(const std::string& event);
- bool m_bCurrentEventPlugin = false;
- jmp_buf m_jbHookFaultJumpBuf;
+ bool m_currentEventPlugin = false;
+ jmp_buf m_hookFaultJumpBuf;
private:
- std::unordered_map<std::string, std::vector<SCallbackFNPtr>> m_mRegisteredHooks;
+ std::unordered_map<std::string, std::vector<SCallbackFNPtr>> m_registeredHooks;
};
inline UP<CHookSystemManager> g_pHookSystem;
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 98c0360b..aea49061 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -70,109 +70,109 @@ static std::vector<std::pair<std::string, std::string>> getHyprlandLaunchEnv(PHL
CKeybindManager::CKeybindManager() {
// initialize all dispatchers
- m_mDispatchers["exec"] = spawn;
- m_mDispatchers["execr"] = spawnRaw;
- m_mDispatchers["killactive"] = closeActive;
- m_mDispatchers["forcekillactive"] = killActive;
- m_mDispatchers["closewindow"] = closeWindow;
- m_mDispatchers["killwindow"] = killWindow;
- m_mDispatchers["signal"] = signalActive;
- m_mDispatchers["signalwindow"] = signalWindow;
- m_mDispatchers["togglefloating"] = toggleActiveFloating;
- m_mDispatchers["setfloating"] = setActiveFloating;
- m_mDispatchers["settiled"] = setActiveTiled;
- m_mDispatchers["workspace"] = changeworkspace;
- m_mDispatchers["renameworkspace"] = renameWorkspace;
- m_mDispatchers["fullscreen"] = fullscreenActive;
- m_mDispatchers["fullscreenstate"] = fullscreenStateActive;
- m_mDispatchers["movetoworkspace"] = moveActiveToWorkspace;
- m_mDispatchers["movetoworkspacesilent"] = moveActiveToWorkspaceSilent;
- m_mDispatchers["pseudo"] = toggleActivePseudo;
- m_mDispatchers["movefocus"] = moveFocusTo;
- m_mDispatchers["movewindow"] = moveActiveTo;
- m_mDispatchers["swapwindow"] = swapActive;
- m_mDispatchers["centerwindow"] = centerWindow;
- m_mDispatchers["togglegroup"] = toggleGroup;
- m_mDispatchers["changegroupactive"] = changeGroupActive;
- m_mDispatchers["movegroupwindow"] = moveGroupWindow;
- m_mDispatchers["togglesplit"] = toggleSplit;
- m_mDispatchers["swapsplit"] = swapSplit;
- m_mDispatchers["splitratio"] = alterSplitRatio;
- m_mDispatchers["focusmonitor"] = focusMonitor;
- m_mDispatchers["movecursortocorner"] = moveCursorToCorner;
- m_mDispatchers["movecursor"] = moveCursor;
- m_mDispatchers["workspaceopt"] = workspaceOpt;
- m_mDispatchers["exit"] = exitHyprland;
- m_mDispatchers["movecurrentworkspacetomonitor"] = moveCurrentWorkspaceToMonitor;
- m_mDispatchers["focusworkspaceoncurrentmonitor"] = focusWorkspaceOnCurrentMonitor;
- m_mDispatchers["moveworkspacetomonitor"] = moveWorkspaceToMonitor;
- m_mDispatchers["togglespecialworkspace"] = toggleSpecialWorkspace;
- m_mDispatchers["forcerendererreload"] = forceRendererReload;
- m_mDispatchers["resizeactive"] = resizeActive;
- m_mDispatchers["moveactive"] = moveActive;
- m_mDispatchers["cyclenext"] = circleNext;
- m_mDispatchers["focuswindowbyclass"] = focusWindow;
- m_mDispatchers["focuswindow"] = focusWindow;
- m_mDispatchers["tagwindow"] = tagWindow;
- m_mDispatchers["toggleswallow"] = toggleSwallow;
- m_mDispatchers["submap"] = setSubmap;
- m_mDispatchers["pass"] = pass;
- m_mDispatchers["sendshortcut"] = sendshortcut;
- m_mDispatchers["sendkeystate"] = sendkeystate;
- m_mDispatchers["layoutmsg"] = layoutmsg;
- m_mDispatchers["dpms"] = dpms;
- m_mDispatchers["movewindowpixel"] = moveWindow;
- m_mDispatchers["resizewindowpixel"] = resizeWindow;
- m_mDispatchers["swapnext"] = swapnext;
- m_mDispatchers["swapactiveworkspaces"] = swapActiveWorkspaces;
- m_mDispatchers["pin"] = pinActive;
- m_mDispatchers["mouse"] = mouse;
- m_mDispatchers["bringactivetotop"] = bringActiveToTop;
- m_mDispatchers["alterzorder"] = alterZOrder;
- m_mDispatchers["focusurgentorlast"] = focusUrgentOrLast;
- m_mDispatchers["focuscurrentorlast"] = focusCurrentOrLast;
- m_mDispatchers["lockgroups"] = lockGroups;
- m_mDispatchers["lockactivegroup"] = lockActiveGroup;
- m_mDispatchers["moveintogroup"] = moveIntoGroup;
- m_mDispatchers["moveoutofgroup"] = moveOutOfGroup;
- m_mDispatchers["movewindoworgroup"] = moveWindowOrGroup;
- m_mDispatchers["setignoregrouplock"] = setIgnoreGroupLock;
- m_mDispatchers["denywindowfromgroup"] = denyWindowFromGroup;
- m_mDispatchers["event"] = event;
- m_mDispatchers["global"] = global;
- m_mDispatchers["setprop"] = setProp;
-
- m_tScrollTimer.reset();
-
- m_pLongPressTimer = makeShared<CEventLoopTimer>(
+ m_dispatchers["exec"] = spawn;
+ m_dispatchers["execr"] = spawnRaw;
+ m_dispatchers["killactive"] = closeActive;
+ m_dispatchers["forcekillactive"] = killActive;
+ m_dispatchers["closewindow"] = closeWindow;
+ m_dispatchers["killwindow"] = killWindow;
+ m_dispatchers["signal"] = signalActive;
+ m_dispatchers["signalwindow"] = signalWindow;
+ m_dispatchers["togglefloating"] = toggleActiveFloating;
+ m_dispatchers["setfloating"] = setActiveFloating;
+ m_dispatchers["settiled"] = setActiveTiled;
+ m_dispatchers["workspace"] = changeworkspace;
+ m_dispatchers["renameworkspace"] = renameWorkspace;
+ m_dispatchers["fullscreen"] = fullscreenActive;
+ m_dispatchers["fullscreenstate"] = fullscreenStateActive;
+ m_dispatchers["movetoworkspace"] = moveActiveToWorkspace;
+ m_dispatchers["movetoworkspacesilent"] = moveActiveToWorkspaceSilent;
+ m_dispatchers["pseudo"] = toggleActivePseudo;
+ m_dispatchers["movefocus"] = moveFocusTo;
+ m_dispatchers["movewindow"] = moveActiveTo;
+ m_dispatchers["swapwindow"] = swapActive;
+ m_dispatchers["centerwindow"] = centerWindow;
+ m_dispatchers["togglegroup"] = toggleGroup;
+ m_dispatchers["changegroupactive"] = changeGroupActive;
+ m_dispatchers["movegroupwindow"] = moveGroupWindow;
+ m_dispatchers["togglesplit"] = toggleSplit;
+ m_dispatchers["swapsplit"] = swapSplit;
+ m_dispatchers["splitratio"] = alterSplitRatio;
+ m_dispatchers["focusmonitor"] = focusMonitor;
+ m_dispatchers["movecursortocorner"] = moveCursorToCorner;
+ m_dispatchers["movecursor"] = moveCursor;
+ m_dispatchers["workspaceopt"] = workspaceOpt;
+ m_dispatchers["exit"] = exitHyprland;
+ m_dispatchers["movecurrentworkspacetomonitor"] = moveCurrentWorkspaceToMonitor;
+ m_dispatchers["focusworkspaceoncurrentmonitor"] = focusWorkspaceOnCurrentMonitor;
+ m_dispatchers["moveworkspacetomonitor"] = moveWorkspaceToMonitor;
+ m_dispatchers["togglespecialworkspace"] = toggleSpecialWorkspace;
+ m_dispatchers["forcerendererreload"] = forceRendererReload;
+ m_dispatchers["resizeactive"] = resizeActive;
+ m_dispatchers["moveactive"] = moveActive;
+ m_dispatchers["cyclenext"] = circleNext;
+ m_dispatchers["focuswindowbyclass"] = focusWindow;
+ m_dispatchers["focuswindow"] = focusWindow;
+ m_dispatchers["tagwindow"] = tagWindow;
+ m_dispatchers["toggleswallow"] = toggleSwallow;
+ m_dispatchers["submap"] = setSubmap;
+ m_dispatchers["pass"] = pass;
+ m_dispatchers["sendshortcut"] = sendshortcut;
+ m_dispatchers["sendkeystate"] = sendkeystate;
+ m_dispatchers["layoutmsg"] = layoutmsg;
+ m_dispatchers["dpms"] = dpms;
+ m_dispatchers["movewindowpixel"] = moveWindow;
+ m_dispatchers["resizewindowpixel"] = resizeWindow;
+ m_dispatchers["swapnext"] = swapnext;
+ m_dispatchers["swapactiveworkspaces"] = swapActiveWorkspaces;
+ m_dispatchers["pin"] = pinActive;
+ m_dispatchers["mouse"] = mouse;
+ m_dispatchers["bringactivetotop"] = bringActiveToTop;
+ m_dispatchers["alterzorder"] = alterZOrder;
+ m_dispatchers["focusurgentorlast"] = focusUrgentOrLast;
+ m_dispatchers["focuscurrentorlast"] = focusCurrentOrLast;
+ m_dispatchers["lockgroups"] = lockGroups;
+ m_dispatchers["lockactivegroup"] = lockActiveGroup;
+ m_dispatchers["moveintogroup"] = moveIntoGroup;
+ m_dispatchers["moveoutofgroup"] = moveOutOfGroup;
+ m_dispatchers["movewindoworgroup"] = moveWindowOrGroup;
+ m_dispatchers["setignoregrouplock"] = setIgnoreGroupLock;
+ m_dispatchers["denywindowfromgroup"] = denyWindowFromGroup;
+ m_dispatchers["event"] = event;
+ m_dispatchers["global"] = global;
+ m_dispatchers["setprop"] = setProp;
+
+ m_scrollTimer.reset();
+
+ m_longPressTimer = makeShared<CEventLoopTimer>(
std::nullopt,
[this](SP<CEventLoopTimer> self, void* data) {
- if (!m_pLastLongPressKeybind || g_pSeatManager->keyboard.expired())
+ if (!m_lastLongPressKeybind || g_pSeatManager->m_keyboard.expired())
return;
- const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
+ const auto PACTIVEKEEB = g_pSeatManager->m_keyboard.lock();
if (!PACTIVEKEEB->m_allowBinds)
return;
- const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(m_pLastLongPressKeybind->handler);
+ const auto DISPATCHER = g_pKeybindManager->m_dispatchers.find(m_lastLongPressKeybind->handler);
Debug::log(LOG, "Long press timeout passed, calling dispatcher.");
- DISPATCHER->second(m_pLastLongPressKeybind->arg);
+ DISPATCHER->second(m_lastLongPressKeybind->arg);
},
nullptr);
- m_pRepeatKeyTimer = makeShared<CEventLoopTimer>(
+ m_repeatKeyTimer = makeShared<CEventLoopTimer>(
std::nullopt,
[this](SP<CEventLoopTimer> self, void* data) {
- if (m_vActiveKeybinds.size() == 0 || g_pSeatManager->keyboard.expired())
+ if (m_activeKeybinds.size() == 0 || g_pSeatManager->m_keyboard.expired())
return;
- const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
+ const auto PACTIVEKEEB = g_pSeatManager->m_keyboard.lock();
if (!PACTIVEKEEB->m_allowBinds)
return;
- for (const auto& k : m_vActiveKeybinds) {
- const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(k->handler);
+ for (const auto& k : m_activeKeybinds) {
+ const auto DISPATCHER = g_pKeybindManager->m_dispatchers.find(k->handler);
Debug::log(LOG, "Keybind repeat triggered, calling dispatcher.");
DISPATCHER->second(k->arg);
@@ -184,43 +184,43 @@ CKeybindManager::CKeybindManager() {
// null in --verify-config mode
if (g_pEventLoopManager) {
- g_pEventLoopManager->addTimer(m_pLongPressTimer);
- g_pEventLoopManager->addTimer(m_pRepeatKeyTimer);
+ g_pEventLoopManager->addTimer(m_longPressTimer);
+ g_pEventLoopManager->addTimer(m_repeatKeyTimer);
}
static auto P = g_pHookSystem->hookDynamic("configReloaded", [this](void* hk, SCallbackInfo& info, std::any param) {
// clear cuz realloc'd
- m_vActiveKeybinds.clear();
- m_pLastLongPressKeybind.reset();
- m_vPressedSpecialBinds.clear();
+ m_activeKeybinds.clear();
+ m_lastLongPressKeybind.reset();
+ m_pressedSpecialBinds.clear();
});
}
CKeybindManager::~CKeybindManager() {
- if (m_pXKBTranslationState)
- xkb_state_unref(m_pXKBTranslationState);
- if (m_pLongPressTimer && g_pEventLoopManager) {
- g_pEventLoopManager->removeTimer(m_pLongPressTimer);
- m_pLongPressTimer.reset();
+ if (m_xkbTranslationState)
+ xkb_state_unref(m_xkbTranslationState);
+ if (m_longPressTimer && g_pEventLoopManager) {
+ g_pEventLoopManager->removeTimer(m_longPressTimer);
+ m_longPressTimer.reset();
}
- if (m_pRepeatKeyTimer && g_pEventLoopManager) {
- g_pEventLoopManager->removeTimer(m_pRepeatKeyTimer);
- m_pRepeatKeyTimer.reset();
+ if (m_repeatKeyTimer && g_pEventLoopManager) {
+ g_pEventLoopManager->removeTimer(m_repeatKeyTimer);
+ m_repeatKeyTimer.reset();
}
}
void CKeybindManager::addKeybind(SKeybind kb) {
- m_vKeybinds.emplace_back(makeShared<SKeybind>(kb));
+ m_keybinds.emplace_back(makeShared<SKeybind>(kb));
- m_vActiveKeybinds.clear();
- m_pLastLongPressKeybind.reset();
+ m_activeKeybinds.clear();
+ m_lastLongPressKeybind.reset();
}
void CKeybindManager::removeKeybind(uint32_t mod, const SParsedKey& key) {
- std::erase_if(m_vKeybinds, [&mod, &key](const auto& el) { return el->modmask == mod && el->key == key.key && el->keycode == key.keycode && el->catchAll == key.catchAll; });
+ std::erase_if(m_keybinds, [&mod, &key](const auto& el) { return el->modmask == mod && el->key == key.key && el->keycode == key.keycode && el->catchAll == key.catchAll; });
- m_vActiveKeybinds.clear();
- m_pLastLongPressKeybind.reset();
+ m_activeKeybinds.clear();
+ m_lastLongPressKeybind.reset();
}
uint32_t CKeybindManager::stringToModMask(std::string mods) {
@@ -266,10 +266,10 @@ uint32_t CKeybindManager::keycodeToModifier(xkb_keycode_t keycode) {
}
void CKeybindManager::updateXKBTranslationState() {
- if (m_pXKBTranslationState) {
- xkb_state_unref(m_pXKBTranslationState);
+ if (m_xkbTranslationState) {
+ xkb_state_unref(m_xkbTranslationState);
- m_pXKBTranslationState = nullptr;
+ m_xkbTranslationState = nullptr;
}
static auto PFILEPATH = CConfigValue<std::string>("input:kb_file");
@@ -308,7 +308,7 @@ void CKeybindManager::updateXKBTranslationState() {
}
xkb_context_unref(PCONTEXT);
- m_pXKBTranslationState = xkb_state_new(PKEYMAP);
+ m_xkbTranslationState = xkb_state_new(PKEYMAP);
xkb_keymap_unref(PKEYMAP);
}
@@ -427,18 +427,18 @@ void CKeybindManager::switchToWindow(PHLWINDOW PWINDOWTOCHANGETO, bool preserveF
bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
if (!g_pCompositor->m_sessionActive || g_pCompositor->m_unsafeState) {
- m_dPressedKeys.clear();
+ m_pressedKeys.clear();
return true;
}
if (!pKeyboard->m_allowBinds)
return true;
- if (!m_pXKBTranslationState) {
+ if (!m_xkbTranslationState) {
Debug::log(ERR, "BUG THIS: m_pXKBTranslationState nullptr!");
updateXKBTranslationState();
- if (!m_pXKBTranslationState)
+ if (!m_xkbTranslationState)
return true;
}
@@ -446,7 +446,7 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
const auto KEYCODE = e.keycode + 8; // Because to xkbcommon it's +8 from libinput
- const xkb_keysym_t keysym = xkb_state_key_get_one_sym(pKeyboard->m_resolveBindsBySym ? pKeyboard->m_xkbSymState : m_pXKBTranslationState, KEYCODE);
+ const xkb_keysym_t keysym = xkb_state_key_get_one_sym(pKeyboard->m_resolveBindsBySym ? pKeyboard->m_xkbSymState : m_xkbTranslationState, KEYCODE);
const xkb_keysym_t internalKeysym = xkb_state_key_get_one_sym(pKeyboard->m_xkbState, KEYCODE);
if (keysym == XKB_KEY_Escape || internalKeysym == XKB_KEY_Escape)
@@ -459,9 +459,9 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
const auto MODS = g_pInputManager->accumulateModsFromAllKBs();
- m_uTimeLastMs = e.timeMs;
- m_uLastCode = KEYCODE;
- m_uLastMouseCode = 0;
+ m_timeLastMs = e.timeMs;
+ m_lastCode = KEYCODE;
+ m_lastMouseCode = 0;
bool mouseBindWasActive = ensureMouseBindState();
@@ -470,34 +470,34 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
.keycode = KEYCODE,
.modmaskAtPressTime = MODS,
.sent = true,
- .submapAtPress = m_szCurrentSelectedSubmap,
+ .submapAtPress = m_currentSelectedSubmap,
.mousePosAtPress = g_pInputManager->getMouseCoordsInternal(),
};
- m_vActiveKeybinds.clear();
+ m_activeKeybinds.clear();
- m_pLastLongPressKeybind.reset();
+ m_lastLongPressKeybind.reset();
bool suppressEvent = false;
if (e.state == WL_KEYBOARD_KEY_STATE_PRESSED) {
- m_dPressedKeys.push_back(KEY);
+ m_pressedKeys.push_back(KEY);
suppressEvent = !handleKeybinds(MODS, KEY, true).passEvent;
if (suppressEvent)
shadowKeybinds(keysym, KEYCODE);
- m_dPressedKeys.back().sent = !suppressEvent;
+ m_pressedKeys.back().sent = !suppressEvent;
} else { // key release
bool foundInPressedKeys = false;
- for (auto it = m_dPressedKeys.begin(); it != m_dPressedKeys.end();) {
+ for (auto it = m_pressedKeys.begin(); it != m_pressedKeys.end();) {
if (it->keycode == KEYCODE) {
handleKeybinds(MODS, *it, false);
foundInPressedKeys = true;
suppressEvent = !it->sent;
- it = m_dPressedKeys.erase(it);
+ it = m_pressedKeys.erase(it);
} else {
++it;
}
@@ -519,14 +519,14 @@ bool CKeybindManager::onAxisEvent(const IPointer::SAxisEvent& e) {
static auto PDELAY = CConfigValue<Hyprlang::INT>("binds:scroll_event_delay");
- if (m_tScrollTimer.getMillis() < *PDELAY) {
- m_tScrollTimer.reset();
+ if (m_scrollTimer.getMillis() < *PDELAY) {
+ m_scrollTimer.reset();
return true; // timer hasn't passed yet!
}
- m_tScrollTimer.reset();
+ m_scrollTimer.reset();
- m_vActiveKeybinds.clear();
+ m_activeKeybinds.clear();
bool found = false;
if (e.source == WL_POINTER_AXIS_SOURCE_WHEEL && e.axis == WL_POINTER_AXIS_VERTICAL_SCROLL) {
@@ -552,9 +552,9 @@ bool CKeybindManager::onMouseEvent(const IPointer::SButtonEvent& e) {
bool suppressEvent = false;
- m_uLastMouseCode = e.button;
- m_uLastCode = 0;
- m_uTimeLastMs = e.timeMs;
+ m_lastMouseCode = e.button;
+ m_lastCode = 0;
+ m_timeLastMs = e.timeMs;
bool mouseBindWasActive = ensureMouseBindState();
@@ -566,25 +566,25 @@ bool CKeybindManager::onMouseEvent(const IPointer::SButtonEvent& e) {
.mousePosAtPress = g_pInputManager->getMouseCoordsInternal(),
};
- m_vActiveKeybinds.clear();
+ m_activeKeybinds.clear();
if (e.state == WL_POINTER_BUTTON_STATE_PRESSED) {
- m_dPressedKeys.push_back(KEY);
+ m_pressedKeys.push_back(KEY);
suppressEvent = !handleKeybinds(MODS, KEY, true).passEvent;
if (suppressEvent)
shadowKeybinds();
- m_dPressedKeys.back().sent = !suppressEvent;
+ m_pressedKeys.back().sent = !suppressEvent;
} else {
bool foundInPressedKeys = false;
- for (auto it = m_dPressedKeys.begin(); it != m_dPressedKeys.end();) {
+ for (auto it = m_pressedKeys.begin(); it != m_pressedKeys.end();) {
if (it->keyName == KEY_NAME) {
suppressEvent = !handleKeybinds(MODS, *it, false).passEvent;
foundInPressedKeys = true;
suppressEvent = !it->sent;
- it = m_dPressedKeys.erase(it);
+ it = m_pressedKeys.erase(it);
} else {
++it;
}
@@ -639,14 +639,14 @@ eMultiKeyCase CKeybindManager::mkKeysymSetMatches(const std::set<xkb_keysym_t> k
}
eMultiKeyCase CKeybindManager::mkBindMatches(const SP<SKeybind> keybind) {
- if (mkKeysymSetMatches(keybind->sMkMods, m_sMkMods) != MK_FULL_MATCH)
+ if (mkKeysymSetMatches(keybind->sMkMods, m_mkMods) != MK_FULL_MATCH)
return MK_NO_MATCH;
- return mkKeysymSetMatches(keybind->sMkKeys, m_sMkKeys);
+ return mkKeysymSetMatches(keybind->sMkKeys, m_mkKeys);
}
std::string CKeybindManager::getCurrentSubmap() {
- return m_szCurrentSelectedSubmap;
+ return m_currentSelectedSubmap;
}
SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SPressedKeyWithMods& key, bool pressed) {
@@ -658,20 +658,20 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
if (pressed) {
if (keycodeToModifier(key.keycode))
- m_sMkMods.insert(key.keysym);
+ m_mkMods.insert(key.keysym);
else
- m_sMkKeys.insert(key.keysym);
+ m_mkKeys.insert(key.keysym);
} else {
if (keycodeToModifier(key.keycode))
- m_sMkMods.erase(key.keysym);
+ m_mkMods.erase(key.keysym);
else
- m_sMkKeys.erase(key.keysym);
+ m_mkKeys.erase(key.keysym);
}
- for (auto& k : m_vKeybinds) {
+ for (auto& k : m_keybinds) {
const bool SPECIALDISPATCHER = k->handler == "global" || k->handler == "pass" || k->handler == "sendshortcut" || k->handler == "mouse";
const bool SPECIALTRIGGERED =
- std::find_if(m_vPressedSpecialBinds.begin(), m_vPressedSpecialBinds.end(), [&](const auto& other) { return other == k; }) != m_vPressedSpecialBinds.end();
+ std::find_if(m_pressedSpecialBinds.begin(), m_pressedSpecialBinds.end(), [&](const auto& other) { return other == k; }) != m_pressedSpecialBinds.end();
const bool IGNORECONDITIONS =
SPECIALDISPATCHER && !pressed && SPECIALTRIGGERED; // ignore mods. Pass, global dispatchers should be released immediately once the key is released.
@@ -681,7 +681,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
if (!k->locked && g_pSessionLockManager->isSessionLocked())
continue;
- if (!IGNORECONDITIONS && ((modmask != k->modmask && !k->ignoreMods) || k->submap != m_szCurrentSelectedSubmap || k->shadowed))
+ if (!IGNORECONDITIONS && ((modmask != k->modmask && !k->ignoreMods) || k->submap != m_currentSelectedSubmap || k->shadowed))
continue;
if (k->multiKey) {
@@ -697,7 +697,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
if (key.keycode != k->keycode)
continue;
} else if (k->catchAll) {
- if (found || key.submapAtPress != m_szCurrentSelectedSubmap)
+ if (found || key.submapAtPress != m_currentSelectedSubmap)
continue;
} else {
// in this case, we only have the keysym to go off of for this keybind, and it's invalid
@@ -762,29 +762,29 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
}
if (k->longPress) {
- const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
+ const auto PACTIVEKEEB = g_pSeatManager->m_keyboard.lock();
- m_pLongPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->m_repeatDelay));
- m_pLastLongPressKeybind = k;
+ m_longPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->m_repeatDelay));
+ m_lastLongPressKeybind = k;
continue;
}
- const auto DISPATCHER = m_mDispatchers.find(k->mouse ? "mouse" : k->handler);
+ const auto DISPATCHER = m_dispatchers.find(k->mouse ? "mouse" : k->handler);
if (SPECIALTRIGGERED && !pressed)
- std::erase_if(m_vPressedSpecialBinds, [&](const auto& other) { return other == k; });
+ std::erase_if(m_pressedSpecialBinds, [&](const auto& other) { return other == k; });
else if (SPECIALDISPATCHER && pressed)
- m_vPressedSpecialBinds.emplace_back(k);
+ m_pressedSpecialBinds.emplace_back(k);
// Should never happen, as we check in the ConfigManager, but oh well
- if (DISPATCHER == m_mDispatchers.end()) {
+ if (DISPATCHER == m_dispatchers.end()) {
Debug::log(ERR, "Invalid handler in a keybind! (handler {} does not exist)", k->handler);
} else {
// call the dispatcher
Debug::log(LOG, "Keybind triggered, calling dispatcher ({}, {}, {}, {})", modmask, key.keyName, key.keysym, DISPATCHER->first);
- m_iPassPressed = (int)pressed;
+ m_passPressed = (int)pressed;
// if the dispatchers says to pass event then we will
if (k->handler == "mouse")
@@ -792,7 +792,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
else
res = DISPATCHER->second(k->arg);
- m_iPassPressed = -1;
+ m_passPressed = -1;
if (k->handler == "submap") {
found = true; // don't process keybinds on submap change.
@@ -801,10 +801,10 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
}
if (k->repeat) {
- const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock();
+ const auto PACTIVEKEEB = g_pSeatManager->m_keyboard.lock();
- m_vActiveKeybinds.emplace_back(k);
- m_pRepeatKeyTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->m_repeatDelay));
+ m_activeKeybinds.emplace_back(k);
+ m_repeatKeyTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->m_repeatDelay));
}
if (!k->nonConsuming)
@@ -830,7 +830,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP
void CKeybindManager::shadowKeybinds(const xkb_keysym_t& doesntHave, const uint32_t doesntHaveCode) {
// shadow disables keybinds after one has been triggered
- for (auto& k : m_vKeybinds) {
+ for (auto& k : m_keybinds) {
bool shadow = false;
@@ -843,7 +843,7 @@ void CKeybindManager::shadowKeybinds(const xkb_keysym_t& doesntHave, const uint3
const auto KBKEY = xkb_keysym_from_name(k->key.c_str(), XKB_KEYSYM_CASE_INSENSITIVE);
const auto KBKEYUPPER = xkb_keysym_to_upper(KBKEY);
- for (auto const& pk : m_dPressedKeys) {
+ for (auto const& pk : m_pressedKeys) {
if ((pk.keysym != 0 && (pk.keysym == KBKEY || pk.keysym == KBKEYUPPER))) {
shadow = true;
@@ -1125,7 +1125,7 @@ SDispatchResult CKeybindManager::signalWindow(std::string args) {
}
void CKeybindManager::clearKeybinds() {
- m_vKeybinds.clear();
+ m_keybinds.clear();
}
static SDispatchResult toggleActiveFloatingCore(std::string args, std::optional<bool> floatState) {
@@ -1336,7 +1336,7 @@ SDispatchResult CKeybindManager::changeworkspace(std::string args) {
if (*PWARPONWORKSPACECHANGE > 0) {
auto PLAST = pWorkspaceToChangeTo->getLastFocusedWindow();
- auto HLSurface = CWLSurface::fromResource(g_pSeatManager->state.pointerFocus.lock());
+ auto HLSurface = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
if (PLAST && (!HLSurface || HLSurface->getWindow()))
PLAST->warpCursor(*PWARPONWORKSPACECHANGE == 2);
@@ -2154,7 +2154,7 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
if (*PWARPONTOGGLESPECIAL > 0) {
auto PLAST = focusedWorkspace->getLastFocusedWindow();
- auto HLSurface = CWLSurface::fromResource(g_pSeatManager->state.pointerFocus.lock());
+ auto HLSurface = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
if (PLAST && (!HLSurface || HLSurface->getWindow()))
PLAST->warpCursor(*PWARPONTOGGLESPECIAL == 2);
@@ -2400,19 +2400,19 @@ SDispatchResult CKeybindManager::toggleSwallow(std::string args) {
SDispatchResult CKeybindManager::setSubmap(std::string submap) {
if (submap == "reset" || submap == "") {
- m_szCurrentSelectedSubmap = "";
+ m_currentSelectedSubmap = "";
Debug::log(LOG, "Reset active submap to the default one.");
g_pEventManager->postEvent(SHyprIPCEvent{"submap", ""});
- EMIT_HOOK_EVENT("submap", m_szCurrentSelectedSubmap);
+ EMIT_HOOK_EVENT("submap", m_currentSelectedSubmap);
return {};
}
- for (const auto& k : g_pKeybindManager->m_vKeybinds) {
+ for (const auto& k : g_pKeybindManager->m_keybinds) {
if (k->submap == submap) {
- m_szCurrentSelectedSubmap = submap;
+ m_currentSelectedSubmap = submap;
Debug::log(LOG, "Changed keybind submap to {}", submap);
g_pEventManager->postEvent(SHyprIPCEvent{"submap", submap});
- EMIT_HOOK_EVENT("submap", m_szCurrentSelectedSubmap);
+ EMIT_HOOK_EVENT("submap", m_currentSelectedSubmap);
return {};
}
}
@@ -2431,18 +2431,18 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
return {.success = false, .error = "pass: window not found"};
}
- if (!g_pSeatManager->keyboard) {
+ if (!g_pSeatManager->m_keyboard) {
Debug::log(ERR, "No kb in pass?");
return {.success = false, .error = "No kb in pass?"};
}
const auto XWTOXW = PWINDOW->m_isX11 && g_pCompositor->m_lastWindow.lock() && g_pCompositor->m_lastWindow->m_isX11;
- const auto LASTMOUSESURF = g_pSeatManager->state.pointerFocus.lock();
- const auto LASTKBSURF = g_pSeatManager->state.keyboardFocus.lock();
+ const auto LASTMOUSESURF = g_pSeatManager->m_state.pointerFocus.lock();
+ const auto LASTKBSURF = g_pSeatManager->m_state.keyboardFocus.lock();
// pass all mf shit
if (!XWTOXW) {
- if (g_pKeybindManager->m_uLastCode != 0)
+ if (g_pKeybindManager->m_lastCode != 0)
g_pSeatManager->setKeyboardFocus(PWINDOW->m_wlSurface->resource());
else
g_pSeatManager->setPointerFocus(PWINDOW->m_wlSurface->resource(), {1, 1});
@@ -2450,24 +2450,24 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
g_pSeatManager->sendKeyboardMods(g_pInputManager->accumulateModsFromAllKBs(), 0, 0, 0);
- if (g_pKeybindManager->m_iPassPressed == 1) {
- if (g_pKeybindManager->m_uLastCode != 0)
- g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastCode - 8, WL_KEYBOARD_KEY_STATE_PRESSED);
+ if (g_pKeybindManager->m_passPressed == 1) {
+ if (g_pKeybindManager->m_lastCode != 0)
+ g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_timeLastMs, g_pKeybindManager->m_lastCode - 8, WL_KEYBOARD_KEY_STATE_PRESSED);
else
- g_pSeatManager->sendPointerButton(g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastMouseCode, WL_POINTER_BUTTON_STATE_PRESSED);
- } else if (g_pKeybindManager->m_iPassPressed == 0)
- if (g_pKeybindManager->m_uLastCode != 0)
- g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastCode - 8, WL_KEYBOARD_KEY_STATE_RELEASED);
+ g_pSeatManager->sendPointerButton(g_pKeybindManager->m_timeLastMs, g_pKeybindManager->m_lastMouseCode, WL_POINTER_BUTTON_STATE_PRESSED);
+ } else if (g_pKeybindManager->m_passPressed == 0)
+ if (g_pKeybindManager->m_lastCode != 0)
+ g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_timeLastMs, g_pKeybindManager->m_lastCode - 8, WL_KEYBOARD_KEY_STATE_RELEASED);
else
- g_pSeatManager->sendPointerButton(g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastMouseCode, WL_POINTER_BUTTON_STATE_RELEASED);
+ g_pSeatManager->sendPointerButton(g_pKeybindManager->m_timeLastMs, g_pKeybindManager->m_lastMouseCode, WL_POINTER_BUTTON_STATE_RELEASED);
else {
// dynamic call of the dispatcher
- if (g_pKeybindManager->m_uLastCode != 0) {
- g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastCode - 8, WL_KEYBOARD_KEY_STATE_PRESSED);
- g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastCode - 8, WL_KEYBOARD_KEY_STATE_RELEASED);
+ if (g_pKeybindManager->m_lastCode != 0) {
+ g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_timeLastMs, g_pKeybindManager->m_lastCode - 8, WL_KEYBOARD_KEY_STATE_PRESSED);
+ g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_timeLastMs, g_pKeybindManager->m_lastCode - 8, WL_KEYBOARD_KEY_STATE_RELEASED);
} else {
- g_pSeatManager->sendPointerButton(g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastMouseCode, WL_POINTER_BUTTON_STATE_PRESSED);
- g_pSeatManager->sendPointerButton(g_pKeybindManager->m_uTimeLastMs, g_pKeybindManager->m_uLastMouseCode, WL_POINTER_BUTTON_STATE_RELEASED);
+ g_pSeatManager->sendPointerButton(g_pKeybindManager->m_timeLastMs, g_pKeybindManager->m_lastMouseCode, WL_POINTER_BUTTON_STATE_PRESSED);
+ g_pSeatManager->sendPointerButton(g_pKeybindManager->m_timeLastMs, g_pKeybindManager->m_lastMouseCode, WL_POINTER_BUTTON_STATE_RELEASED);
}
}
@@ -2478,18 +2478,18 @@ SDispatchResult CKeybindManager::pass(std::string regexp) {
// this will make g_pSeatManager NOT send the leave event to XWayland apps, provided we are not on an XWayland window already.
// please kill me
if (PWINDOW->m_isX11) {
- if (g_pKeybindManager->m_uLastCode != 0) {
- g_pSeatManager->state.keyboardFocus.reset();
- g_pSeatManager->state.keyboardFocusResource.reset();
+ if (g_pKeybindManager->m_lastCode != 0) {
+ g_pSeatManager->m_state.keyboardFocus.reset();
+ g_pSeatManager->m_state.keyboardFocusResource.reset();
} else {
- g_pSeatManager->state.pointerFocus.reset();
- g_pSeatManager->state.pointerFocusResource.reset();
+ g_pSeatManager->m_state.pointerFocus.reset();
+ g_pSeatManager->m_state.pointerFocusResource.reset();
}
}
const auto SL = PWINDOW->m_realPosition->goal() - g_pInputManager->getMouseCoordsInternal();
- if (g_pKeybindManager->m_uLastCode != 0)
+ if (g_pKeybindManager->m_lastCode != 0)
g_pSeatManager->setKeyboardFocus(LASTKBSURF);
else
g_pSeatManager->setPointerFocus(LASTMOUSESURF, SL);
@@ -2531,7 +2531,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
const auto KEYSYM = xkb_keysym_from_name(KEY.c_str(), XKB_KEYSYM_CASE_INSENSITIVE);
keycode = 0;
- const auto KB = g_pSeatManager->keyboard;
+ const auto KB = g_pSeatManager->m_keyboard;
if (!KB) {
Debug::log(ERR, "sendshortcut: no kb");
@@ -2540,7 +2540,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
const auto KEYPAIRSTRING = std::format("{}{}", (uintptr_t)KB.get(), KEY);
- if (!g_pKeybindManager->m_mKeyToCodeCache.contains(KEYPAIRSTRING)) {
+ if (!g_pKeybindManager->m_keyToCodeCache.contains(KEYPAIRSTRING)) {
xkb_keymap* km = KB->m_xkbKeymap;
xkb_state* ks = KB->m_xkbState;
@@ -2552,8 +2552,8 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
xkb_keysym_t sym = xkb_state_key_get_one_sym(ks, kc);
if (sym == KEYSYM) {
- keycode = kc;
- g_pKeybindManager->m_mKeyToCodeCache[KEYPAIRSTRING] = keycode;
+ keycode = kc;
+ g_pKeybindManager->m_keyToCodeCache[KEYPAIRSTRING] = keycode;
}
}
@@ -2563,7 +2563,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
}
} else
- keycode = g_pKeybindManager->m_mKeyToCodeCache[KEYPAIRSTRING];
+ keycode = g_pKeybindManager->m_keyToCodeCache[KEYPAIRSTRING];
}
if (!keycode) {
@@ -2585,7 +2585,7 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
return {.success = false, .error = "sendshortcut: window not found"};
}
- if (!g_pSeatManager->keyboard) {
+ if (!g_pSeatManager->m_keyboard) {
Debug::log(ERR, "No kb in sendshortcut?");
return {.success = false, .error = "No kb in sendshortcut?"};
}
@@ -2606,24 +2606,24 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
g_pSeatManager->sendKeyboardMods(MOD, 0, 0, 0);
- if (g_pKeybindManager->m_iPassPressed == 1) {
+ if (g_pKeybindManager->m_passPressed == 1) {
if (!isMouse)
- g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_uTimeLastMs, keycode - 8, WL_KEYBOARD_KEY_STATE_PRESSED);
+ g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_timeLastMs, keycode - 8, WL_KEYBOARD_KEY_STATE_PRESSED);
else
- g_pSeatManager->sendPointerButton(g_pKeybindManager->m_uTimeLastMs, keycode, WL_POINTER_BUTTON_STATE_PRESSED);
- } else if (g_pKeybindManager->m_iPassPressed == 0) {
+ g_pSeatManager->sendPointerButton(g_pKeybindManager->m_timeLastMs, keycode, WL_POINTER_BUTTON_STATE_PRESSED);
+ } else if (g_pKeybindManager->m_passPressed == 0) {
if (!isMouse)
- g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_uTimeLastMs, keycode - 8, WL_KEYBOARD_KEY_STATE_RELEASED);
+ g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_timeLastMs, keycode - 8, WL_KEYBOARD_KEY_STATE_RELEASED);
else
- g_pSeatManager->sendPointerButton(g_pKeybindManager->m_uTimeLastMs, keycode, WL_POINTER_BUTTON_STATE_RELEASED);
+ g_pSeatManager->sendPointerButton(g_pKeybindManager->m_timeLastMs, keycode, WL_POINTER_BUTTON_STATE_RELEASED);
} else {
// dynamic call of the dispatcher
if (!isMouse) {
- g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_uTimeLastMs, keycode - 8, WL_KEYBOARD_KEY_STATE_PRESSED);
- g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_uTimeLastMs, keycode - 8, WL_KEYBOARD_KEY_STATE_RELEASED);
+ g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_timeLastMs, keycode - 8, WL_KEYBOARD_KEY_STATE_PRESSED);
+ g_pSeatManager->sendKeyboardKey(g_pKeybindManager->m_timeLastMs, keycode - 8, WL_KEYBOARD_KEY_STATE_RELEASED);
} else {
- g_pSeatManager->sendPointerButton(g_pKeybindManager->m_uTimeLastMs, keycode, WL_POINTER_BUTTON_STATE_PRESSED);
- g_pSeatManager->sendPointerButton(g_pKeybindManager->m_uTimeLastMs, keycode, WL_POINTER_BUTTON_STATE_RELEASED);
+ g_pSeatManager->sendPointerButton(g_pKeybindManager->m_timeLastMs, keycode, WL_POINTER_BUTTON_STATE_PRESSED);
+ g_pSeatManager->sendPointerButton(g_pKeybindManager->m_timeLastMs, keycode, WL_POINTER_BUTTON_STATE_RELEASED);
}
}
@@ -2634,11 +2634,11 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
if (PWINDOW->m_isX11) { //xwayland hack, see pass
if (!isMouse) {
- g_pSeatManager->state.keyboardFocus.reset();
- g_pSeatManager->state.keyboardFocusResource.reset();
+ g_pSeatManager->m_state.keyboardFocus.reset();
+ g_pSeatManager->m_state.keyboardFocusResource.reset();
} else {
- g_pSeatManager->state.pointerFocus.reset();
- g_pSeatManager->state.pointerFocusResource.reset();
+ g_pSeatManager->m_state.pointerFocus.reset();
+ g_pSeatManager->m_state.pointerFocusResource.reset();
}
}
@@ -2877,13 +2877,13 @@ SDispatchResult CKeybindManager::alterZOrder(std::string args) {
SDispatchResult CKeybindManager::lockGroups(std::string args) {
if (args == "lock" || args.empty() || args == "lockgroups")
- g_pKeybindManager->m_bGroupsLocked = true;
+ g_pKeybindManager->m_groupsLocked = true;
else if (args == "toggle")
- g_pKeybindManager->m_bGroupsLocked = !g_pKeybindManager->m_bGroupsLocked;
+ g_pKeybindManager->m_groupsLocked = !g_pKeybindManager->m_groupsLocked;
else
- g_pKeybindManager->m_bGroupsLocked = false;
+ g_pKeybindManager->m_groupsLocked = false;
- g_pEventManager->postEvent(SHyprIPCEvent{"lockgroups", g_pKeybindManager->m_bGroupsLocked ? "1" : "0"});
+ g_pEventManager->postEvent(SHyprIPCEvent{"lockgroups", g_pKeybindManager->m_groupsLocked ? "1" : "0"});
g_pCompositor->updateAllWindowsAnimatedDecorationValues();
return {};
@@ -2962,12 +2962,12 @@ void CKeybindManager::moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string&
} else {
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(pWindow);
- const auto GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked;
- g_pKeybindManager->m_bGroupsLocked = true;
+ const auto GROUPSLOCKEDPREV = g_pKeybindManager->m_groupsLocked;
+ g_pKeybindManager->m_groupsLocked = true;
g_pLayoutManager->getCurrentLayout()->onWindowCreated(pWindow, direction);
- g_pKeybindManager->m_bGroupsLocked = GROUPSLOCKEDPREV;
+ g_pKeybindManager->m_groupsLocked = GROUPSLOCKEDPREV;
}
if (*BFOCUSREMOVEDWINDOW) {
@@ -2986,7 +2986,7 @@ SDispatchResult CKeybindManager::moveIntoGroup(std::string args) {
static auto PIGNOREGROUPLOCK = CConfigValue<Hyprlang::INT>("binds:ignore_group_lock");
- if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked)
+ if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_groupsLocked)
return {};
if (!isDirection(args)) {
@@ -3016,7 +3016,7 @@ SDispatchResult CKeybindManager::moveIntoGroup(std::string args) {
SDispatchResult CKeybindManager::moveOutOfGroup(std::string args) {
static auto PIGNOREGROUPLOCK = CConfigValue<Hyprlang::INT>("binds:ignore_group_lock");
- if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked)
+ if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_groupsLocked)
return {.success = false, .error = "Groups locked"};
PHLWINDOW PWINDOW = nullptr;
@@ -3054,7 +3054,7 @@ SDispatchResult CKeybindManager::moveWindowOrGroup(std::string args) {
if (PWINDOW->isFullscreen())
return {};
- if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_bGroupsLocked) {
+ if (!*PIGNOREGROUPLOCK && g_pKeybindManager->m_groupsLocked) {
g_pLayoutManager->getCurrentLayout()->moveWindowTo(PWINDOW, args);
return {};
}
@@ -3130,7 +3130,7 @@ SDispatchResult CKeybindManager::global(std::string args) {
if (!PROTO::globalShortcuts->isTaken(APPID, NAME))
return {};
- PROTO::globalShortcuts->sendGlobalShortcutEvent(APPID, NAME, g_pKeybindManager->m_iPassPressed);
+ PROTO::globalShortcuts->sendGlobalShortcutEvent(APPID, NAME, g_pKeybindManager->m_passPressed);
return {};
}
@@ -3296,21 +3296,21 @@ SDispatchResult CKeybindManager::sendkeystate(std::string args) {
std::string modifiedArgs = ARGS[0] + "," + ARGS[1] + "," + ARGS[3];
- const int oldPassPressed = g_pKeybindManager->m_iPassPressed;
+ const int oldPassPressed = g_pKeybindManager->m_passPressed;
if (STATE == "down")
- g_pKeybindManager->m_iPassPressed = 1;
+ g_pKeybindManager->m_passPressed = 1;
else if (STATE == "up")
- g_pKeybindManager->m_iPassPressed = 0;
+ g_pKeybindManager->m_passPressed = 0;
else if (STATE == "repeat")
- g_pKeybindManager->m_iPassPressed = 1;
+ g_pKeybindManager->m_passPressed = 1;
auto result = sendshortcut(modifiedArgs);
if (STATE == "repeat" && result.success)
result = sendshortcut(modifiedArgs);
- g_pKeybindManager->m_iPassPressed = oldPassPressed;
+ g_pKeybindManager->m_passPressed = oldPassPressed;
if (!result.success && !result.error.empty()) {
size_t pos = result.error.find("sendshortcut:");
diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp
index ede16402..be2d114b 100644
--- a/src/managers/KeybindManager.hpp
+++ b/src/managers/KeybindManager.hpp
@@ -100,50 +100,52 @@ class CKeybindManager {
void shadowKeybinds(const xkb_keysym_t& doesntHave = 0, const uint32_t doesntHaveCode = 0);
std::string getCurrentSubmap();
- std::unordered_map<std::string, std::function<SDispatchResult(std::string)>> m_mDispatchers;
+ std::unordered_map<std::string, std::function<SDispatchResult(std::string)>> m_dispatchers;
- bool m_bGroupsLocked = false;
+ bool m_groupsLocked = false;
- std::vector<SP<SKeybind>> m_vKeybinds;
+ std::vector<SP<SKeybind>> m_keybinds;
//since we cant find keycode through keyname in xkb:
//on sendshortcut call, we once search for keyname (e.g. "g") the correct keycode (e.g. 42)
//and cache it in this map to make sendshortcut calls faster
//we also store the keyboard pointer (in the string) to differentiate between different keyboard (layouts)
- std::unordered_map<std::string, xkb_keycode_t> m_mKeyToCodeCache;
+ std::unordered_map<std::string, xkb_keycode_t> m_keyToCodeCache;
static SDispatchResult changeMouseBindMode(const eMouseBindMode mode);
private:
- std::vector<SPressedKeyWithMods> m_dPressedKeys;
+ std::vector<SPressedKeyWithMods> m_pressedKeys;
- inline static std::string m_szCurrentSelectedSubmap = "";
+ inline static std::string m_currentSelectedSubmap = "";
- std::vector<WP<SKeybind>> m_vActiveKeybinds;
- WP<SKeybind> m_pLastLongPressKeybind;
- SP<CEventLoopTimer> m_pLongPressTimer, m_pRepeatKeyTimer;
+ std::vector<WP<SKeybind>> m_activeKeybinds;
+ WP<SKeybind> m_lastLongPressKeybind;
- uint32_t m_uTimeLastMs = 0;
- uint32_t m_uLastCode = 0;
- uint32_t m_uLastMouseCode = 0;
+ SP<CEventLoopTimer> m_longPressTimer;
+ SP<CEventLoopTimer> m_repeatKeyTimer;
- std::vector<WP<SKeybind>> m_vPressedSpecialBinds;
+ uint32_t m_timeLastMs = 0;
+ uint32_t m_lastCode = 0;
+ uint32_t m_lastMouseCode = 0;
- int m_iPassPressed = -1; // used for pass
+ std::vector<WP<SKeybind>> m_pressedSpecialBinds;
- CTimer m_tScrollTimer;
+ int m_passPressed = -1; // used for pass
+
+ CTimer m_scrollTimer;
SDispatchResult handleKeybinds(const uint32_t, const SPressedKeyWithMods&, bool);
- std::set<xkb_keysym_t> m_sMkKeys = {};
- std::set<xkb_keysym_t> m_sMkMods = {};
+ std::set<xkb_keysym_t> m_mkKeys = {};
+ std::set<xkb_keysym_t> m_mkMods = {};
eMultiKeyCase mkBindMatches(const SP<SKeybind>);
eMultiKeyCase mkKeysymSetMatches(const std::set<xkb_keysym_t>, const std::set<xkb_keysym_t>);
bool handleInternalKeybinds(xkb_keysym_t);
bool handleVT(xkb_keysym_t);
- xkb_state* m_pXKBTranslationState = nullptr;
+ xkb_state* m_xkbTranslationState = nullptr;
void updateXKBTranslationState();
bool ensureMouseBindState();
diff --git a/src/managers/LayoutManager.cpp b/src/managers/LayoutManager.cpp
index 70c2d2a3..a929b42e 100644
--- a/src/managers/LayoutManager.cpp
+++ b/src/managers/LayoutManager.cpp
@@ -1,22 +1,22 @@
#include "LayoutManager.hpp"
CLayoutManager::CLayoutManager() {
- m_vLayouts.emplace_back(std::make_pair<>("dwindle", &m_cDwindleLayout));
- m_vLayouts.emplace_back(std::make_pair<>("master", &m_cMasterLayout));
+ m_layouts.emplace_back(std::make_pair<>("dwindle", &m_dwindleLayout));
+ m_layouts.emplace_back(std::make_pair<>("master", &m_masterLayout));
}
IHyprLayout* CLayoutManager::getCurrentLayout() {
- return m_vLayouts[m_iCurrentLayoutID].second;
+ return m_layouts[m_currentLayoutID].second;
}
void CLayoutManager::switchToLayout(std::string layout) {
- for (size_t i = 0; i < m_vLayouts.size(); ++i) {
- if (m_vLayouts[i].first == layout) {
- if (i == (size_t)m_iCurrentLayoutID)
+ for (size_t i = 0; i < m_layouts.size(); ++i) {
+ if (m_layouts[i].first == layout) {
+ if (i == (size_t)m_currentLayoutID)
return;
getCurrentLayout()->onDisable();
- m_iCurrentLayoutID = i;
+ m_currentLayoutID = i;
getCurrentLayout()->onEnable();
return;
}
@@ -26,10 +26,10 @@ void CLayoutManager::switchToLayout(std::string layout) {
}
bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) {
- if (std::find_if(m_vLayouts.begin(), m_vLayouts.end(), [&](const auto& other) { return other.first == name || other.second == layout; }) != m_vLayouts.end())
+ if (std::find_if(m_layouts.begin(), m_layouts.end(), [&](const auto& other) { return other.first == name || other.second == layout; }) != m_layouts.end())
return false;
- m_vLayouts.emplace_back(std::make_pair<>(name, layout));
+ m_layouts.emplace_back(std::make_pair<>(name, layout));
Debug::log(LOG, "Added new layout {} at {:x}", name, (uintptr_t)layout);
@@ -37,24 +37,24 @@ bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) {
}
bool CLayoutManager::removeLayout(IHyprLayout* layout) {
- const auto IT = std::find_if(m_vLayouts.begin(), m_vLayouts.end(), [&](const auto& other) { return other.second == layout; });
+ const auto IT = std::find_if(m_layouts.begin(), m_layouts.end(), [&](const auto& other) { return other.second == layout; });
- if (IT == m_vLayouts.end() || IT->first == "dwindle" || IT->first == "master")
+ if (IT == m_layouts.end() || IT->first == "dwindle" || IT->first == "master")
return false;
- if (m_iCurrentLayoutID == IT - m_vLayouts.begin())
+ if (m_currentLayoutID == IT - m_layouts.begin())
switchToLayout("dwindle");
Debug::log(LOG, "Removed a layout {} at {:x}", IT->first, (uintptr_t)layout);
- std::erase(m_vLayouts, *IT);
+ std::erase(m_layouts, *IT);
return true;
}
std::vector<std::string> CLayoutManager::getAllLayoutNames() {
- std::vector<std::string> results(m_vLayouts.size());
- for (size_t i = 0; i < m_vLayouts.size(); ++i)
- results[i] = m_vLayouts[i].first;
+ std::vector<std::string> results(m_layouts.size());
+ for (size_t i = 0; i < m_layouts.size(); ++i)
+ results[i] = m_layouts[i].first;
return results;
}
diff --git a/src/managers/LayoutManager.hpp b/src/managers/LayoutManager.hpp
index 63e54baa..80c522fb 100644
--- a/src/managers/LayoutManager.hpp
+++ b/src/managers/LayoutManager.hpp
@@ -21,11 +21,11 @@ class CLayoutManager {
LAYOUT_MASTER
};
- int m_iCurrentLayoutID = LAYOUT_DWINDLE;
+ int m_currentLayoutID = LAYOUT_DWINDLE;
- CHyprDwindleLayout m_cDwindleLayout;
- CHyprMasterLayout m_cMasterLayout;
- std::vector<std::pair<std::string, IHyprLayout*>> m_vLayouts;
+ CHyprDwindleLayout m_dwindleLayout;
+ CHyprMasterLayout m_masterLayout;
+ std::vector<std::pair<std::string, IHyprLayout*>> m_layouts;
};
inline UP<CLayoutManager> g_pLayoutManager;
diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp
index 1dcc0107..48044a69 100644
--- a/src/managers/PointerManager.cpp
+++ b/src/managers/PointerManager.cpp
@@ -24,7 +24,7 @@
using namespace Hyprutils::Utils;
CPointerManager::CPointerManager() {
- hooks.monitorAdded = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any data) {
+ m_hooks.monitorAdded = g_pHookSystem->hookDynamic("monitorAdded", [this](void* self, SCallbackInfo& info, std::any data) {
auto PMONITOR = std::any_cast<PHLMONITOR>(data);
onMonitorLayoutChange();
@@ -34,12 +34,12 @@ CPointerManager::CPointerManager() {
PMONITOR->m_events.destroy.registerStaticListener(
[this](void* owner, std::any data) {
if (g_pCompositor && !g_pCompositor->m_isShuttingDown)
- std::erase_if(monitorStates, [](const auto& other) { return other->monitor.expired(); });
+ std::erase_if(m_monitorStates, [](const auto& other) { return other->monitor.expired(); });
},
nullptr);
});
- hooks.monitorPreRender = g_pHookSystem->hookDynamic("preMonitorCommit", [this](void* self, SCallbackInfo& info, std::any data) {
+ m_hooks.monitorPreRender = g_pHookSystem->hookDynamic("preMonitorCommit", [this](void* self, SCallbackInfo& info, std::any data) {
auto state = stateFor(std::any_cast<PHLMONITOR>(data));
if (!state)
return;
@@ -49,14 +49,14 @@ CPointerManager::CPointerManager() {
}
void CPointerManager::lockSoftwareAll() {
- for (auto const& state : monitorStates)
+ for (auto const& state : m_monitorStates)
state->softwareLocks++;
updateCursorBackend();
}
void CPointerManager::unlockSoftwareAll() {
- for (auto const& state : monitorStates)
+ for (auto const& state : m_monitorStates)
state->softwareLocks--;
updateCursorBackend();
@@ -86,26 +86,26 @@ bool CPointerManager::softwareLockedFor(PHLMONITOR mon) {
}
Vector2D CPointerManager::position() {
- return pointerPos;
+ return m_pointerPos;
}
bool CPointerManager::hasCursor() {
- return currentCursorImage.pBuffer || currentCursorImage.surface;
+ return m_currentCursorImage.pBuffer || m_currentCursorImage.surface;
}
SP<CPointerManager::SMonitorPointerState> CPointerManager::stateFor(PHLMONITOR mon) {
- auto it = std::find_if(monitorStates.begin(), monitorStates.end(), [mon](const auto& other) { return other->monitor == mon; });
- if (it == monitorStates.end())
- return monitorStates.emplace_back(makeShared<CPointerManager::SMonitorPointerState>(mon));
+ auto it = std::find_if(m_monitorStates.begin(), m_monitorStates.end(), [mon](const auto& other) { return other->monitor == mon; });
+ if (it == m_monitorStates.end())
+ return m_monitorStates.emplace_back(makeShared<CPointerManager::SMonitorPointerState>(mon));
return *it;
}
void CPointerManager::setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2D& hotspot, const float& scale) {
damageIfSoftware();
- if (buf == currentCursorImage.pBuffer) {
- if (hotspot != currentCursorImage.hotspot || scale != currentCursorImage.scale) {
- currentCursorImage.hotspot = hotspot;
- currentCursorImage.scale = scale;
+ if (buf == m_currentCursorImage.pBuffer) {
+ if (hotspot != m_currentCursorImage.hotspot || scale != m_currentCursorImage.scale) {
+ m_currentCursorImage.hotspot = hotspot;
+ m_currentCursorImage.scale = scale;
updateCursorBackend();
damageIfSoftware();
}
@@ -116,12 +116,12 @@ void CPointerManager::setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2
resetCursorImage(false);
if (buf) {
- currentCursorImage.size = buf->size;
- currentCursorImage.pBuffer = buf;
+ m_currentCursorImage.size = buf->size;
+ m_currentCursorImage.pBuffer = buf;
}
- currentCursorImage.hotspot = hotspot;
- currentCursorImage.scale = scale;
+ m_currentCursorImage.hotspot = hotspot;
+ m_currentCursorImage.scale = scale;
updateCursorBackend();
damageIfSoftware();
@@ -130,10 +130,10 @@ void CPointerManager::setCursorBuffer(SP<Aquamarine::IBuffer> buf, const Vector2
void CPointerManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hotspot) {
damageIfSoftware();
- if (surf == currentCursorImage.surface) {
- if (hotspot != currentCursorImage.hotspot || (surf && surf->resource() ? surf->resource()->current.scale : 1.F) != currentCursorImage.scale) {
- currentCursorImage.hotspot = hotspot;
- currentCursorImage.scale = surf && surf->resource() ? surf->resource()->current.scale : 1.F;
+ if (surf == m_currentCursorImage.surface) {
+ if (hotspot != m_currentCursorImage.hotspot || (surf && surf->resource() ? surf->resource()->current.scale : 1.F) != m_currentCursorImage.scale) {
+ m_currentCursorImage.hotspot = hotspot;
+ m_currentCursorImage.scale = surf && surf->resource() ? surf->resource()->current.scale : 1.F;
updateCursorBackend();
damageIfSoftware();
}
@@ -144,28 +144,28 @@ void CPointerManager::setCursorSurface(SP<CWLSurface> surf, const Vector2D& hots
resetCursorImage(false);
if (surf) {
- currentCursorImage.surface = surf;
- currentCursorImage.scale = surf->resource()->current.scale;
+ m_currentCursorImage.surface = surf;
+ m_currentCursorImage.scale = surf->resource()->current.scale;
surf->resource()->map();
- currentCursorImage.destroySurface = surf->m_events.destroy.registerListener([this](std::any data) { resetCursorImage(); });
- currentCursorImage.commitSurface = surf->resource()->events.commit.registerListener([this](std::any data) {
+ m_currentCursorImage.destroySurface = surf->m_events.destroy.registerListener([this](std::any data) { resetCursorImage(); });
+ m_currentCursorImage.commitSurface = surf->resource()->events.commit.registerListener([this](std::any data) {
damageIfSoftware();
- currentCursorImage.size = currentCursorImage.surface->resource()->current.texture ? currentCursorImage.surface->resource()->current.bufferSize : Vector2D{};
- currentCursorImage.scale = currentCursorImage.surface ? currentCursorImage.surface->resource()->current.scale : 1.F;
+ m_currentCursorImage.size = m_currentCursorImage.surface->resource()->current.texture ? m_currentCursorImage.surface->resource()->current.bufferSize : Vector2D{};
+ m_currentCursorImage.scale = m_currentCursorImage.surface ? m_currentCursorImage.surface->resource()->current.scale : 1.F;
recheckEnteredOutputs();
updateCursorBackend();
damageIfSoftware();
});
if (surf->resource()->current.texture) {
- currentCursorImage.size = surf->resource()->current.bufferSize;
+ m_currentCursorImage.size = surf->resource()->current.bufferSize;
surf->resource()->frame(Time::steadyNow());
}
}
- currentCursorImage.hotspot = hotspot;
+ m_currentCursorImage.hotspot = hotspot;
recheckEnteredOutputs();
updateCursorBackend();
@@ -178,7 +178,7 @@ void CPointerManager::recheckEnteredOutputs() {
auto box = getCursorBoxGlobal();
- for (auto const& s : monitorStates) {
+ for (auto const& s : m_monitorStates) {
if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_enabled)
continue;
@@ -187,12 +187,12 @@ void CPointerManager::recheckEnteredOutputs() {
if (!s->entered && overlaps) {
s->entered = true;
- if (!currentCursorImage.surface)
+ if (!m_currentCursorImage.surface)
continue;
- currentCursorImage.surface->resource()->enter(s->monitor.lock());
- PROTO::fractional->sendScale(currentCursorImage.surface->resource(), s->monitor->m_scale);
- g_pCompositor->setPreferredScaleForSurface(currentCursorImage.surface->resource(), s->monitor->m_scale);
+ m_currentCursorImage.surface->resource()->enter(s->monitor.lock());
+ PROTO::fractional->sendScale(m_currentCursorImage.surface->resource(), s->monitor->m_scale);
+ g_pCompositor->setPreferredScaleForSurface(m_currentCursorImage.surface->resource(), s->monitor->m_scale);
} else if (s->entered && !overlaps) {
s->entered = false;
@@ -202,10 +202,10 @@ void CPointerManager::recheckEnteredOutputs() {
(s->monitor->m_output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER))
setHWCursorBuffer(s, nullptr);
- if (!currentCursorImage.surface)
+ if (!m_currentCursorImage.surface)
continue;
- currentCursorImage.surface->resource()->leave(s->monitor.lock());
+ m_currentCursorImage.surface->resource()->leave(s->monitor.lock());
}
}
}
@@ -213,26 +213,26 @@ void CPointerManager::recheckEnteredOutputs() {
void CPointerManager::resetCursorImage(bool apply) {
damageIfSoftware();
- if (currentCursorImage.surface) {
+ if (m_currentCursorImage.surface) {
for (auto const& m : g_pCompositor->m_monitors) {
- currentCursorImage.surface->resource()->leave(m);
+ m_currentCursorImage.surface->resource()->leave(m);
}
- currentCursorImage.surface->resource()->unmap();
+ m_currentCursorImage.surface->resource()->unmap();
- currentCursorImage.destroySurface.reset();
- currentCursorImage.commitSurface.reset();
- currentCursorImage.surface.reset();
- } else if (currentCursorImage.pBuffer)
- currentCursorImage.pBuffer = nullptr;
+ m_currentCursorImage.destroySurface.reset();
+ m_currentCursorImage.commitSurface.reset();
+ m_currentCursorImage.surface.reset();
+ } else if (m_currentCursorImage.pBuffer)
+ m_currentCursorImage.pBuffer = nullptr;
- if (currentCursorImage.bufferTex)
- currentCursorImage.bufferTex = nullptr;
+ if (m_currentCursorImage.bufferTex)
+ m_currentCursorImage.bufferTex = nullptr;
- currentCursorImage.scale = 1.F;
- currentCursorImage.hotspot = {0, 0};
+ m_currentCursorImage.scale = 1.F;
+ m_currentCursorImage.hotspot = {0, 0};
- for (auto const& s : monitorStates) {
+ for (auto const& s : m_monitorStates) {
if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_enabled)
continue;
@@ -242,7 +242,7 @@ void CPointerManager::resetCursorImage(bool apply) {
if (!apply)
return;
- for (auto const& ms : monitorStates) {
+ for (auto const& ms : m_monitorStates) {
if (!ms->monitor || !ms->monitor->m_enabled || !ms->monitor->m_dpmsStatus) {
Debug::log(TRACE, "Not updating hw cursors: disabled / dpms off display");
continue;
@@ -392,7 +392,7 @@ bool CPointerManager::setHWCursorBuffer(SP<SMonitorPointerState> state, SP<Aquam
SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager::SMonitorPointerState> state, SP<CTexture> texture) {
auto maxSize = state->monitor->m_output->cursorPlaneSize();
- auto const& cursorSize = currentCursorImage.size;
+ auto const& cursorSize = m_currentCursorImage.size;
static auto PCPUBUFFER = CConfigValue<Hyprlang::INT>("cursor:use_cpu_buffer");
@@ -403,7 +403,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
if (maxSize != Vector2D{-1, -1}) {
if (cursorSize.x > maxSize.x || cursorSize.y > maxSize.y) {
- Debug::log(TRACE, "hardware cursor too big! {} > {}", currentCursorImage.size, maxSize);
+ Debug::log(TRACE, "hardware cursor too big! {} > {}", m_currentCursorImage.size, maxSize);
return nullptr;
}
} else
@@ -464,8 +464,8 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
// get the texture data if available.
auto texData = texture->dataCopy();
if (texData.empty()) {
- if (currentCursorImage.surface && currentCursorImage.surface->resource()->role->role() == SURFACE_ROLE_CURSOR) {
- const auto SURFACE = currentCursorImage.surface->resource();
+ if (m_currentCursorImage.surface && m_currentCursorImage.surface->resource()->role->role() == SURFACE_ROLE_CURSOR) {
+ const auto SURFACE = m_currentCursorImage.surface->resource();
auto& shmBuffer = CCursorSurfaceRole::cursorPixelData(SURFACE);
bool flipRB = false;
@@ -523,7 +523,7 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
const auto TR = state->monitor->m_transform;
// we need to scale the cursor to the right size, because it might not be (esp with XCursor)
- const auto SCALE = texture->m_vSize / (currentCursorImage.size / currentCursorImage.scale * state->monitor->m_scale);
+ const auto SCALE = texture->m_vSize / (m_currentCursorImage.size / m_currentCursorImage.scale * state->monitor->m_scale);
cairo_matrix_scale(&matrixPre, SCALE.x, SCALE.y);
if (TR) {
@@ -577,9 +577,9 @@ SP<Aquamarine::IBuffer> CPointerManager::renderHWCursorBuffer(SP<CPointerManager
g_pHyprOpenGL->beginSimple(state->monitor.lock(), {0, 0, INT16_MAX, INT16_MAX}, RBO);
g_pHyprOpenGL->clear(CHyprColor{0.F, 0.F, 0.F, 0.F});
- CBox xbox = {{}, Vector2D{currentCursorImage.size / currentCursorImage.scale * state->monitor->m_scale}.round()};
- Debug::log(TRACE, "[pointer] monitor: {}, size: {}, hw buf: {}, scale: {:.2f}, monscale: {:.2f}, xbox: {}", state->monitor->m_name, currentCursorImage.size, cursorSize,
- currentCursorImage.scale, state->monitor->m_scale, xbox.size());
+ CBox xbox = {{}, Vector2D{m_currentCursorImage.size / m_currentCursorImage.scale * state->monitor->m_scale}.round()};
+ Debug::log(TRACE, "[pointer] monitor: {}, size: {}, hw buf: {}, scale: {:.2f}, monscale: {:.2f}, xbox: {}", state->monitor->m_name, m_currentCursorImage.size, cursorSize,
+ m_currentCursorImage.scale, state->monitor->m_scale, xbox.size());
g_pHyprOpenGL->renderTexture(texture, xbox, 1.F);
@@ -599,8 +599,8 @@ void CPointerManager::renderSoftwareCursorsFor(PHLMONITOR pMonitor, const Time::
auto state = stateFor(pMonitor);
if (!state->hardwareFailed && state->softwareLocks == 0 && !forceRender) {
- if (currentCursorImage.surface)
- currentCursorImage.surface->resource()->frame(now);
+ if (m_currentCursorImage.surface)
+ m_currentCursorImage.surface->resource()->frame(now);
return;
}
@@ -627,12 +627,12 @@ void CPointerManager::renderSoftwareCursorsFor(PHLMONITOR pMonitor, const Time::
g_pHyprRenderer->m_sRenderPass.add(makeShared<CTexPassElement>(data));
- if (currentCursorImage.surface)
- currentCursorImage.surface->resource()->frame(now);
+ if (m_currentCursorImage.surface)
+ m_currentCursorImage.surface->resource()->frame(now);
}
Vector2D CPointerManager::getCursorPosForMonitor(PHLMONITOR pMonitor) {
- return CBox{pointerPos - pMonitor->m_position, {0, 0}}
+ return CBox{m_pointerPos - pMonitor->m_position, {0, 0}}
.transform(wlTransformToHyprutils(invertTransform(pMonitor->m_transform)), pMonitor->m_transformedSize.x / pMonitor->m_scale,
pMonitor->m_transformedSize.y / pMonitor->m_scale)
.pos() *
@@ -643,7 +643,7 @@ Vector2D CPointerManager::transformedHotspot(PHLMONITOR pMonitor) {
if (!pMonitor->m_cursorSwapchain)
return {}; // doesn't matter, we have no hw cursor, and this is only for hw cursors
- return CBox{currentCursorImage.hotspot * pMonitor->m_scale, {0, 0}}
+ return CBox{m_currentCursorImage.hotspot * pMonitor->m_scale, {0, 0}}
.transform(wlTransformToHyprutils(invertTransform(pMonitor->m_transform)), pMonitor->m_cursorSwapchain->currentOptions().size.x,
pMonitor->m_cursorSwapchain->currentOptions().size.y)
.pos();
@@ -654,7 +654,7 @@ CBox CPointerManager::getCursorBoxLogicalForMonitor(PHLMONITOR pMonitor) {
}
CBox CPointerManager::getCursorBoxGlobal() {
- return CBox{pointerPos, currentCursorImage.size / currentCursorImage.scale}.translate(-currentCursorImage.hotspot);
+ return CBox{m_pointerPos, m_currentCursorImage.size / m_currentCursorImage.scale}.translate(-m_currentCursorImage.hotspot);
}
Vector2D CPointerManager::closestValid(const Vector2D& pos) {
@@ -665,7 +665,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
//
static auto INSIDE_LAYOUT = [this](const CBox& box) -> bool {
- for (auto const& b : currentMonitorLayout.monitorBoxes) {
+ for (auto const& b : m_currentMonitorLayout.monitorBoxes) {
if (box.inside(b))
return true;
}
@@ -673,7 +673,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
};
static auto INSIDE_LAYOUT_COORD = [this](const Vector2D& vec) -> bool {
- for (auto const& b : currentMonitorLayout.monitorBoxes) {
+ for (auto const& b : m_currentMonitorLayout.monitorBoxes) {
if (b.containsPoint(vec))
return true;
}
@@ -684,7 +684,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
Vector2D leader;
float distanceSq = __FLT_MAX__;
- for (auto const& b : currentMonitorLayout.monitorBoxes) {
+ for (auto const& b : m_currentMonitorLayout.monitorBoxes) {
auto p = b.closestPoint(vec);
auto distSq = p.distanceSq(vec);
@@ -736,7 +736,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
void CPointerManager::damageIfSoftware() {
auto b = getCursorBoxGlobal().expand(4);
- for (auto const& mw : monitorStates) {
+ for (auto const& mw : m_monitorStates) {
if (mw->monitor.expired() || !mw->monitor->m_output)
continue;
@@ -751,7 +751,7 @@ void CPointerManager::damageIfSoftware() {
void CPointerManager::warpTo(const Vector2D& logical) {
damageIfSoftware();
- pointerPos = closestValid(logical);
+ m_pointerPos = closestValid(logical);
if (!g_pInputManager->isLocked()) {
recheckEnteredOutputs();
@@ -762,7 +762,7 @@ void CPointerManager::warpTo(const Vector2D& logical) {
}
void CPointerManager::move(const Vector2D& deltaLogical) {
- const auto oldPos = pointerPos;
+ const auto oldPos = m_pointerPos;
auto newPos = oldPos + Vector2D{std::isnan(deltaLogical.x) ? 0.0 : deltaLogical.x, std::isnan(deltaLogical.y) ? 0.0 : deltaLogical.y};
warpTo(newPos);
@@ -839,10 +839,10 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
damageIfSoftware();
if (std::isnan(abs.x) || std::isnan(abs.y)) {
- pointerPos.x = std::isnan(abs.x) ? pointerPos.x : mappedArea.x + mappedArea.w * abs.x;
- pointerPos.y = std::isnan(abs.y) ? pointerPos.y : mappedArea.y + mappedArea.h * abs.y;
+ m_pointerPos.x = std::isnan(abs.x) ? m_pointerPos.x : mappedArea.x + mappedArea.w * abs.x;
+ m_pointerPos.y = std::isnan(abs.y) ? m_pointerPos.y : mappedArea.y + mappedArea.h * abs.y;
} else
- pointerPos = mappedArea.pos() + mappedArea.size() * abs;
+ m_pointerPos = mappedArea.pos() + mappedArea.size() * abs;
onCursorMoved();
recheckEnteredOutputs();
@@ -851,17 +851,17 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
}
void CPointerManager::onMonitorLayoutChange() {
- currentMonitorLayout.monitorBoxes.clear();
+ m_currentMonitorLayout.monitorBoxes.clear();
for (auto const& m : g_pCompositor->m_monitors) {
if (m->isMirror() || !m->m_enabled || !m->m_output)
continue;
- currentMonitorLayout.monitorBoxes.emplace_back(m->m_position, m->m_size);
+ m_currentMonitorLayout.monitorBoxes.emplace_back(m->m_position, m->m_size);
}
damageIfSoftware();
- pointerPos = closestValid(pointerPos);
+ m_pointerPos = closestValid(m_pointerPos);
updateCursorBackend();
recheckEnteredOutputs();
@@ -869,16 +869,16 @@ void CPointerManager::onMonitorLayoutChange() {
}
SP<CTexture> CPointerManager::getCurrentCursorTexture() {
- if (!currentCursorImage.pBuffer && (!currentCursorImage.surface || !currentCursorImage.surface->resource()->current.texture))
+ if (!m_currentCursorImage.pBuffer && (!m_currentCursorImage.surface || !m_currentCursorImage.surface->resource()->current.texture))
return nullptr;
- if (currentCursorImage.pBuffer) {
- if (!currentCursorImage.bufferTex)
- currentCursorImage.bufferTex = makeShared<CTexture>(currentCursorImage.pBuffer, true);
- return currentCursorImage.bufferTex;
+ if (m_currentCursorImage.pBuffer) {
+ if (!m_currentCursorImage.bufferTex)
+ m_currentCursorImage.bufferTex = makeShared<CTexture>(m_currentCursorImage.pBuffer, true);
+ return m_currentCursorImage.bufferTex;
}
- return currentCursorImage.surface->resource()->current.texture;
+ return m_currentCursorImage.surface->resource()->current.texture;
}
void CPointerManager::attachPointer(SP<IPointer> pointer) {
@@ -888,7 +888,7 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
static auto PMOUSEDPMS = CConfigValue<Hyprlang::INT>("misc:mouse_move_enables_dpms");
//
- auto listener = pointerListeners.emplace_back(makeShared<SPointerListener>());
+ auto listener = m_pointerListeners.emplace_back(makeShared<SPointerListener>());
listener->pointer = pointer;
@@ -937,12 +937,12 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
listener->frame = pointer->m_pointerEvents.frame.registerListener([] (std::any e) {
bool shouldSkip = false;
- if (!g_pSeatManager->mouse.expired() && g_pInputManager->isLocked()) {
+ if (!g_pSeatManager->m_mouse.expired() && g_pInputManager->isLocked()) {
auto PMONITOR = g_pCompositor->m_lastMonitor.get();
shouldSkip = PMONITOR && PMONITOR->shouldSkipScheduleFrameOnMouseEvent();
}
- g_pSeatManager->isPointerFrameSkipped = shouldSkip;
- if (!g_pSeatManager->isPointerFrameSkipped)
+ g_pSeatManager->m_isPointerFrameSkipped = shouldSkip;
+ if (!g_pSeatManager->m_isPointerFrameSkipped)
g_pSeatManager->sendPointerFrame();
});
@@ -1027,7 +1027,7 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
static auto PMOUSEDPMS = CConfigValue<Hyprlang::INT>("misc:mouse_move_enables_dpms");
//
- auto listener = touchListeners.emplace_back(makeShared<STouchListener>());
+ auto listener = m_touchListeners.emplace_back(makeShared<STouchListener>());
listener->touch = touch;
@@ -1082,7 +1082,7 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
static auto PMOUSEDPMS = CConfigValue<Hyprlang::INT>("misc:mouse_move_enables_dpms");
//
- auto listener = tabletListeners.emplace_back(makeShared<STabletListener>());
+ auto listener = m_tabletListeners.emplace_back(makeShared<STabletListener>());
listener->tablet = tablet;
@@ -1134,19 +1134,19 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
}
void CPointerManager::detachPointer(SP<IPointer> pointer) {
- std::erase_if(pointerListeners, [pointer](const auto& e) { return e->pointer.expired() || e->pointer == pointer; });
+ std::erase_if(m_pointerListeners, [pointer](const auto& e) { return e->pointer.expired() || e->pointer == pointer; });
}
void CPointerManager::detachTouch(SP<ITouch> touch) {
- std::erase_if(touchListeners, [touch](const auto& e) { return e->touch.expired() || e->touch == touch; });
+ std::erase_if(m_touchListeners, [touch](const auto& e) { return e->touch.expired() || e->touch == touch; });
}
void CPointerManager::detachTablet(SP<CTablet> tablet) {
- std::erase_if(tabletListeners, [tablet](const auto& e) { return e->tablet.expired() || e->tablet == tablet; });
+ std::erase_if(m_tabletListeners, [tablet](const auto& e) { return e->tablet.expired() || e->tablet == tablet; });
}
void CPointerManager::damageCursor(PHLMONITOR pMonitor) {
- for (auto const& mw : monitorStates) {
+ for (auto const& mw : m_monitorStates) {
if (mw->monitor != pMonitor)
continue;
@@ -1162,24 +1162,24 @@ void CPointerManager::damageCursor(PHLMONITOR pMonitor) {
}
Vector2D CPointerManager::cursorSizeLogical() {
- return currentCursorImage.size / currentCursorImage.scale;
+ return m_currentCursorImage.size / m_currentCursorImage.scale;
}
void CPointerManager::storeMovement(uint64_t time, const Vector2D& delta, const Vector2D& deltaUnaccel) {
- storedTime = time;
- storedDelta += delta;
- storedUnaccel += deltaUnaccel;
+ m_storedTime = time;
+ m_storedDelta += delta;
+ m_storedUnaccel += deltaUnaccel;
}
void CPointerManager::setStoredMovement(uint64_t time, const Vector2D& delta, const Vector2D& deltaUnaccel) {
- storedTime = time;
- storedDelta = delta;
- storedUnaccel = deltaUnaccel;
+ m_storedTime = time;
+ m_storedDelta = delta;
+ m_storedUnaccel = deltaUnaccel;
}
void CPointerManager::sendStoredMovement() {
- PROTO::relativePointer->sendRelativeMotion((uint64_t)storedTime * 1000, storedDelta, storedUnaccel);
- storedTime = 0;
- storedDelta = Vector2D{};
- storedUnaccel = Vector2D{};
+ PROTO::relativePointer->sendRelativeMotion((uint64_t)m_storedTime * 1000, m_storedDelta, m_storedUnaccel);
+ m_storedTime = 0;
+ m_storedDelta = Vector2D{};
+ m_storedUnaccel = Vector2D{};
}
diff --git a/src/managers/PointerManager.hpp b/src/managers/PointerManager.hpp
index 3569b218..62a5d18f 100644
--- a/src/managers/PointerManager.hpp
+++ b/src/managers/PointerManager.hpp
@@ -110,7 +110,7 @@ class CPointerManager {
WP<IPointer> pointer;
};
- std::vector<SP<SPointerListener>> pointerListeners;
+ std::vector<SP<SPointerListener>> m_pointerListeners;
struct STouchListener {
CHyprSignalListener destroy;
@@ -122,7 +122,7 @@ class CPointerManager {
WP<ITouch> touch;
};
- std::vector<SP<STouchListener>> touchListeners;
+ std::vector<SP<STouchListener>> m_touchListeners;
struct STabletListener {
CHyprSignalListener destroy;
@@ -133,11 +133,11 @@ class CPointerManager {
WP<CTablet> tablet;
};
- std::vector<SP<STabletListener>> tabletListeners;
+ std::vector<SP<STabletListener>> m_tabletListeners;
struct {
std::vector<CBox> monitorBoxes;
- } currentMonitorLayout;
+ } m_currentMonitorLayout;
struct {
SP<Aquamarine::IBuffer> pBuffer;
@@ -150,13 +150,13 @@ class CPointerManager {
CHyprSignalListener destroySurface;
CHyprSignalListener commitSurface;
- } currentCursorImage; // TODO: support various sizes per-output so we can have pixel-perfect cursors
+ } m_currentCursorImage; // TODO: support various sizes per-output so we can have pixel-perfect cursors
- Vector2D pointerPos = {0, 0};
+ Vector2D m_pointerPos = {0, 0};
- uint64_t storedTime = 0;
- Vector2D storedDelta = {0, 0};
- Vector2D storedUnaccel = {0, 0};
+ uint64_t m_storedTime = 0;
+ Vector2D m_storedDelta = {0, 0};
+ Vector2D m_storedUnaccel = {0, 0};
struct SMonitorPointerState {
SMonitorPointerState(const PHLMONITOR& m) : monitor(m) {}
@@ -174,7 +174,7 @@ class CPointerManager {
SP<Aquamarine::IBuffer> cursorFrontBuffer;
};
- std::vector<SP<SMonitorPointerState>> monitorStates;
+ std::vector<SP<SMonitorPointerState>> m_monitorStates;
SP<SMonitorPointerState> stateFor(PHLMONITOR mon);
bool attemptHardwareCursor(SP<SMonitorPointerState> state);
SP<Aquamarine::IBuffer> renderHWCursorBuffer(SP<SMonitorPointerState> state, SP<CTexture> texture);
@@ -183,7 +183,7 @@ class CPointerManager {
struct {
SP<HOOK_CALLBACK_FN> monitorAdded;
SP<HOOK_CALLBACK_FN> monitorPreRender;
- } hooks;
+ } m_hooks;
};
inline UP<CPointerManager> g_pPointerManager;
diff --git a/src/managers/ProtocolManager.cpp b/src/managers/ProtocolManager.cpp
index 2de13da0..f2a9b0ea 100644
--- a/src/managers/ProtocolManager.cpp
+++ b/src/managers/ProtocolManager.cpp
@@ -122,7 +122,7 @@ CProtocolManager::CProtocolManager() {
PROTO::outputs.emplace(M->m_name, ref);
ref->self = ref;
- m_mModeChangeListeners[M->m_name] = M->m_events.modeChanged.registerListener([M, this](std::any d) { onMonitorModeChange(M); });
+ m_modeChangeListeners[M->m_name] = M->m_events.modeChanged.registerListener([M, this](std::any d) { onMonitorModeChange(M); });
});
static auto P2 = g_pHookSystem->hookDynamic("monitorRemoved", [this](void* self, SCallbackInfo& info, std::any param) {
@@ -130,7 +130,7 @@ CProtocolManager::CProtocolManager() {
if (!PROTO::outputs.contains(M->m_name))
return;
PROTO::outputs.at(M->m_name)->remove();
- m_mModeChangeListeners.erase(M->m_name);
+ m_modeChangeListeners.erase(M->m_name);
});
// Core
diff --git a/src/managers/ProtocolManager.hpp b/src/managers/ProtocolManager.hpp
index 1ec8db4a..86c6c0df 100644
--- a/src/managers/ProtocolManager.hpp
+++ b/src/managers/ProtocolManager.hpp
@@ -13,7 +13,7 @@ class CProtocolManager {
bool isGlobalPrivileged(const wl_global* global);
private:
- std::unordered_map<std::string, CHyprSignalListener> m_mModeChangeListeners;
+ std::unordered_map<std::string, CHyprSignalListener> m_modeChangeListeners;
void onMonitorModeChange(PHLMONITOR pMonitor);
};
diff --git a/src/managers/SeatManager.cpp b/src/managers/SeatManager.cpp
index 3fe407b3..809c0ad5 100644
--- a/src/managers/SeatManager.cpp
+++ b/src/managers/SeatManager.cpp
@@ -14,20 +14,20 @@
#include <ranges>
CSeatManager::CSeatManager() {
- listeners.newSeatResource = PROTO::seat->events.newSeatResource.registerListener([this](std::any res) { onNewSeatResource(std::any_cast<SP<CWLSeatResource>>(res)); });
+ m_listeners.newSeatResource = PROTO::seat->events.newSeatResource.registerListener([this](std::any res) { onNewSeatResource(std::any_cast<SP<CWLSeatResource>>(res)); });
}
CSeatManager::SSeatResourceContainer::SSeatResourceContainer(SP<CWLSeatResource> res) : resource(res) {
listeners.destroy = res->events.destroy.registerListener(
- [this](std::any data) { std::erase_if(g_pSeatManager->seatResources, [this](const auto& e) { return e->resource.expired() || e->resource == resource; }); });
+ [this](std::any data) { std::erase_if(g_pSeatManager->m_seatResources, [this](const auto& e) { return e->resource.expired() || e->resource == resource; }); });
}
void CSeatManager::onNewSeatResource(SP<CWLSeatResource> resource) {
- seatResources.emplace_back(makeShared<SSeatResourceContainer>(resource));
+ m_seatResources.emplace_back(makeShared<SSeatResourceContainer>(resource));
}
SP<CSeatManager::SSeatResourceContainer> CSeatManager::containerForResource(SP<CWLSeatResource> seatResource) {
- for (auto const& c : seatResources) {
+ for (auto const& c : m_seatResources) {
if (c->resource == seatResource)
return c;
}
@@ -76,19 +76,19 @@ void CSeatManager::updateCapabilities(uint32_t capabilities) {
}
void CSeatManager::setMouse(SP<IPointer> MAUZ) {
- if (mouse == MAUZ)
+ if (m_mouse == MAUZ)
return;
- mouse = MAUZ;
+ m_mouse = MAUZ;
}
void CSeatManager::setKeyboard(SP<IKeyboard> KEEB) {
- if (keyboard == KEEB)
+ if (m_keyboard == KEEB)
return;
- if (keyboard)
- keyboard->m_active = false;
- keyboard = KEEB;
+ if (m_keyboard)
+ m_keyboard->m_active = false;
+ m_keyboard = KEEB;
if (KEEB)
KEEB->m_active = true;
@@ -97,25 +97,25 @@ void CSeatManager::setKeyboard(SP<IKeyboard> KEEB) {
}
void CSeatManager::updateActiveKeyboardData() {
- if (keyboard)
- PROTO::seat->updateRepeatInfo(keyboard->m_repeatRate, keyboard->m_repeatDelay);
+ if (m_keyboard)
+ PROTO::seat->updateRepeatInfo(m_keyboard->m_repeatRate, m_keyboard->m_repeatDelay);
PROTO::seat->updateKeymap();
}
void CSeatManager::setKeyboardFocus(SP<CWLSurfaceResource> surf) {
- if (state.keyboardFocus == surf)
+ if (m_state.keyboardFocus == surf)
return;
- if (!keyboard) {
+ if (!m_keyboard) {
Debug::log(ERR, "BUG THIS: setKeyboardFocus without a valid keyboard set");
return;
}
- listeners.keyboardSurfaceDestroy.reset();
+ m_listeners.keyboardSurfaceDestroy.reset();
- if (state.keyboardFocusResource) {
- auto client = state.keyboardFocusResource->client();
- for (auto const& s : seatResources) {
+ if (m_state.keyboardFocusResource) {
+ auto client = m_state.keyboardFocusResource->client();
+ for (auto const& s : m_seatResources) {
if (s->resource->client() != client)
continue;
@@ -128,40 +128,40 @@ void CSeatManager::setKeyboardFocus(SP<CWLSurfaceResource> surf) {
}
}
- state.keyboardFocusResource.reset();
- state.keyboardFocus = surf;
+ m_state.keyboardFocusResource.reset();
+ m_state.keyboardFocus = surf;
if (!surf) {
- events.keyboardFocusChange.emit();
+ m_events.keyboardFocusChange.emit();
return;
}
auto client = surf->client();
- for (auto const& r : seatResources | std::views::reverse) {
+ for (auto const& r : m_seatResources | std::views::reverse) {
if (r->resource->client() != client)
continue;
- state.keyboardFocusResource = r->resource;
+ m_state.keyboardFocusResource = r->resource;
for (auto const& k : r->resource->keyboards) {
if (!k)
continue;
k->sendEnter(surf);
- k->sendMods(keyboard->m_modifiersState.depressed, keyboard->m_modifiersState.latched, keyboard->m_modifiersState.locked, keyboard->m_modifiersState.group);
+ k->sendMods(m_keyboard->m_modifiersState.depressed, m_keyboard->m_modifiersState.latched, m_keyboard->m_modifiersState.locked, m_keyboard->m_modifiersState.group);
}
}
- listeners.keyboardSurfaceDestroy = surf->events.destroy.registerListener([this](std::any d) { setKeyboardFocus(nullptr); });
+ m_listeners.keyboardSurfaceDestroy = surf->events.destroy.registerListener([this](std::any d) { setKeyboardFocus(nullptr); });
- events.keyboardFocusChange.emit();
+ m_events.keyboardFocusChange.emit();
}
void CSeatManager::sendKeyboardKey(uint32_t timeMs, uint32_t key, wl_keyboard_key_state state_) {
- if (!state.keyboardFocusResource)
+ if (!m_state.keyboardFocusResource)
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.keyboardFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.keyboardFocusResource->client())
continue;
for (auto const& k : s->resource->keyboards) {
@@ -174,11 +174,11 @@ void CSeatManager::sendKeyboardKey(uint32_t timeMs, uint32_t key, wl_keyboard_ke
}
void CSeatManager::sendKeyboardMods(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group) {
- if (!state.keyboardFocusResource)
+ if (!m_state.keyboardFocusResource)
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.keyboardFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.keyboardFocusResource->client())
continue;
for (auto const& k : s->resource->keyboards) {
@@ -191,28 +191,28 @@ void CSeatManager::sendKeyboardMods(uint32_t depressed, uint32_t latched, uint32
}
void CSeatManager::setPointerFocus(SP<CWLSurfaceResource> surf, const Vector2D& local) {
- if (state.pointerFocus == surf)
+ if (m_state.pointerFocus == surf)
return;
if (PROTO::data->dndActive() && surf) {
- if (state.dndPointerFocus == surf)
+ if (m_state.dndPointerFocus == surf)
return;
Debug::log(LOG, "[seatmgr] Refusing pointer focus during an active dnd, but setting dndPointerFocus");
- state.dndPointerFocus = surf;
- events.dndPointerFocusChange.emit();
+ m_state.dndPointerFocus = surf;
+ m_events.dndPointerFocusChange.emit();
return;
}
- if (!mouse) {
+ if (!m_mouse) {
Debug::log(ERR, "BUG THIS: setPointerFocus without a valid mouse set");
return;
}
- listeners.pointerSurfaceDestroy.reset();
+ m_listeners.pointerSurfaceDestroy.reset();
- if (state.pointerFocusResource) {
- auto client = state.pointerFocusResource->client();
- for (auto const& s : seatResources) {
+ if (m_state.pointerFocusResource) {
+ auto client = m_state.pointerFocusResource->client();
+ for (auto const& s : m_seatResources) {
if (s->resource->client() != client)
continue;
@@ -225,26 +225,26 @@ void CSeatManager::setPointerFocus(SP<CWLSurfaceResource> surf, const Vector2D&
}
}
- auto lastPointerFocusResource = state.pointerFocusResource;
+ auto lastPointerFocusResource = m_state.pointerFocusResource;
- state.dndPointerFocus.reset();
- state.pointerFocusResource.reset();
- state.pointerFocus = surf;
+ m_state.dndPointerFocus.reset();
+ m_state.pointerFocusResource.reset();
+ m_state.pointerFocus = surf;
if (!surf) {
sendPointerFrame(lastPointerFocusResource);
- events.pointerFocusChange.emit();
+ m_events.pointerFocusChange.emit();
return;
}
- state.dndPointerFocus = surf;
+ m_state.dndPointerFocus = surf;
auto client = surf->client();
- for (auto const& r : seatResources | std::views::reverse) {
+ for (auto const& r : m_seatResources | std::views::reverse) {
if (r->resource->client() != client)
continue;
- state.pointerFocusResource = r->resource;
+ m_state.pointerFocusResource = r->resource;
for (auto const& p : r->resource->pointers) {
if (!p)
continue;
@@ -253,23 +253,23 @@ void CSeatManager::setPointerFocus(SP<CWLSurfaceResource> surf, const Vector2D&
}
}
- if (state.pointerFocusResource != lastPointerFocusResource)
+ if (m_state.pointerFocusResource != lastPointerFocusResource)
sendPointerFrame(lastPointerFocusResource);
sendPointerFrame();
- listeners.pointerSurfaceDestroy = surf->events.destroy.registerListener([this](std::any d) { setPointerFocus(nullptr, {}); });
+ m_listeners.pointerSurfaceDestroy = surf->events.destroy.registerListener([this](std::any d) { setPointerFocus(nullptr, {}); });
- events.pointerFocusChange.emit();
- events.dndPointerFocusChange.emit();
+ m_events.pointerFocusChange.emit();
+ m_events.dndPointerFocusChange.emit();
}
void CSeatManager::sendPointerMotion(uint32_t timeMs, const Vector2D& local) {
- if (!state.pointerFocusResource)
+ if (!m_state.pointerFocusResource)
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.pointerFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.pointerFocusResource->client())
continue;
for (auto const& p : s->resource->pointers) {
@@ -280,15 +280,15 @@ void CSeatManager::sendPointerMotion(uint32_t timeMs, const Vector2D& local) {
}
}
- lastLocalCoords = local;
+ m_lastLocalCoords = local;
}
void CSeatManager::sendPointerButton(uint32_t timeMs, uint32_t key, wl_pointer_button_state state_) {
- if (!state.pointerFocusResource || PROTO::data->dndActive())
+ if (!m_state.pointerFocusResource || PROTO::data->dndActive())
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.pointerFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.pointerFocusResource->client())
continue;
for (auto const& p : s->resource->pointers) {
@@ -301,17 +301,17 @@ void CSeatManager::sendPointerButton(uint32_t timeMs, uint32_t key, wl_pointer_b
}
void CSeatManager::sendPointerFrame() {
- if (!state.pointerFocusResource)
+ if (!m_state.pointerFocusResource)
return;
- sendPointerFrame(state.pointerFocusResource);
+ sendPointerFrame(m_state.pointerFocusResource);
}
void CSeatManager::sendPointerFrame(WP<CWLSeatResource> pResource) {
if (!pResource)
return;
- for (auto const& s : seatResources) {
+ for (auto const& s : m_seatResources) {
if (s->resource->client() != pResource->client())
continue;
@@ -326,11 +326,11 @@ void CSeatManager::sendPointerFrame(WP<CWLSeatResource> pResource) {
void CSeatManager::sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double value, int32_t discrete, int32_t value120, wl_pointer_axis_source source,
wl_pointer_axis_relative_direction relative) {
- if (!state.pointerFocusResource)
+ if (!m_state.pointerFocusResource)
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.pointerFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.pointerFocusResource->client())
continue;
for (auto const& p : s->resource->pointers) {
@@ -353,17 +353,17 @@ void CSeatManager::sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double
}
void CSeatManager::sendTouchDown(SP<CWLSurfaceResource> surf, uint32_t timeMs, int32_t id, const Vector2D& local) {
- listeners.touchSurfaceDestroy.reset();
+ m_listeners.touchSurfaceDestroy.reset();
- state.touchFocusResource.reset();
- state.touchFocus = surf;
+ m_state.touchFocusResource.reset();
+ m_state.touchFocus = surf;
auto client = surf->client();
- for (auto const& r : seatResources | std::views::reverse) {
+ for (auto const& r : m_seatResources | std::views::reverse) {
if (r->resource->client() != client)
continue;
- state.touchFocusResource = r->resource;
+ m_state.touchFocusResource = r->resource;
for (auto const& t : r->resource->touches) {
if (!t)
continue;
@@ -372,24 +372,24 @@ void CSeatManager::sendTouchDown(SP<CWLSurfaceResource> surf, uint32_t timeMs, i
}
}
- listeners.touchSurfaceDestroy = surf->events.destroy.registerListener([this, timeMs, id](std::any d) { sendTouchUp(timeMs + 10, id); });
+ m_listeners.touchSurfaceDestroy = surf->events.destroy.registerListener([this, timeMs, id](std::any d) { sendTouchUp(timeMs + 10, id); });
- touchLocks++;
+ m_touchLocks++;
- if (touchLocks <= 1)
- events.touchFocusChange.emit();
+ if (m_touchLocks <= 1)
+ m_events.touchFocusChange.emit();
}
void CSeatManager::sendTouchUp(uint32_t timeMs, int32_t id) {
- if (!state.touchFocusResource || touchLocks <= 0)
+ if (!m_state.touchFocusResource || m_touchLocks <= 0)
return;
- auto client = state.touchFocusResource->client();
- for (auto const& r : seatResources | std::views::reverse) {
+ auto client = m_state.touchFocusResource->client();
+ for (auto const& r : m_seatResources | std::views::reverse) {
if (r->resource->client() != client)
continue;
- state.touchFocusResource = r->resource;
+ m_state.touchFocusResource = r->resource;
for (auto const& t : r->resource->touches) {
if (!t)
continue;
@@ -398,18 +398,18 @@ void CSeatManager::sendTouchUp(uint32_t timeMs, int32_t id) {
}
}
- touchLocks--;
+ m_touchLocks--;
- if (touchLocks <= 0)
- events.touchFocusChange.emit();
+ if (m_touchLocks <= 0)
+ m_events.touchFocusChange.emit();
}
void CSeatManager::sendTouchMotion(uint32_t timeMs, int32_t id, const Vector2D& local) {
- if (!state.touchFocusResource)
+ if (!m_state.touchFocusResource)
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.touchFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.touchFocusResource->client())
continue;
for (auto const& t : s->resource->touches) {
@@ -422,11 +422,11 @@ void CSeatManager::sendTouchMotion(uint32_t timeMs, int32_t id, const Vector2D&
}
void CSeatManager::sendTouchFrame() {
- if (!state.touchFocusResource)
+ if (!m_state.touchFocusResource)
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.touchFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.touchFocusResource->client())
continue;
for (auto const& t : s->resource->touches) {
@@ -439,11 +439,11 @@ void CSeatManager::sendTouchFrame() {
}
void CSeatManager::sendTouchCancel() {
- if (!state.touchFocusResource)
+ if (!m_state.touchFocusResource)
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.touchFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.touchFocusResource->client())
continue;
for (auto const& t : s->resource->touches) {
@@ -456,11 +456,11 @@ void CSeatManager::sendTouchCancel() {
}
void CSeatManager::sendTouchShape(int32_t id, const Vector2D& shape) {
- if (!state.touchFocusResource)
+ if (!m_state.touchFocusResource)
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.touchFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.touchFocusResource->client())
continue;
for (auto const& t : s->resource->touches) {
@@ -473,11 +473,11 @@ void CSeatManager::sendTouchShape(int32_t id, const Vector2D& shape) {
}
void CSeatManager::sendTouchOrientation(int32_t id, double angle) {
- if (!state.touchFocusResource)
+ if (!m_state.touchFocusResource)
return;
- for (auto const& s : seatResources) {
- if (s->resource->client() != state.touchFocusResource->client())
+ for (auto const& s : m_seatResources) {
+ if (s->resource->client() != m_state.touchFocusResource->client())
continue;
for (auto const& t : s->resource->touches) {
@@ -490,13 +490,13 @@ void CSeatManager::sendTouchOrientation(int32_t id, double angle) {
}
void CSeatManager::refocusGrab() {
- if (!seatGrab)
+ if (!m_seatGrab)
return;
- if (seatGrab->surfs.size() > 0) {
+ if (m_seatGrab->m_surfs.size() > 0) {
// try to find a surf in focus first
const auto MOUSE = g_pInputManager->getMouseCoordsInternal();
- for (auto const& s : seatGrab->surfs) {
+ for (auto const& s : m_seatGrab->m_surfs) {
auto hlSurf = CWLSurface::fromResource(s.lock());
if (!hlSurf)
continue;
@@ -508,23 +508,23 @@ void CSeatManager::refocusGrab() {
if (!b->containsPoint(MOUSE))
continue;
- if (seatGrab->keyboard)
+ if (m_seatGrab->m_keyboard)
setKeyboardFocus(s.lock());
- if (seatGrab->pointer)
+ if (m_seatGrab->m_pointer)
setPointerFocus(s.lock(), MOUSE - b->pos());
return;
}
- SP<CWLSurfaceResource> surf = seatGrab->surfs.at(0).lock();
- if (seatGrab->keyboard)
+ SP<CWLSurfaceResource> surf = m_seatGrab->m_surfs.at(0).lock();
+ if (m_seatGrab->m_keyboard)
setKeyboardFocus(surf);
- if (seatGrab->pointer)
+ if (m_seatGrab->m_pointer)
setPointerFocus(surf, {});
}
}
void CSeatManager::onSetCursor(SP<CWLSeatResource> seatResource, uint32_t serial, SP<CWLSurfaceResource> surf, const Vector2D& hotspot) {
- if (!state.pointerFocusResource || !seatResource || seatResource->client() != state.pointerFocusResource->client()) {
+ if (!m_state.pointerFocusResource || !seatResource || seatResource->client() != m_state.pointerFocusResource->client()) {
Debug::log(LOG, "[seatmgr] Rejecting a setCursor because the client ain't in focus");
return;
}
@@ -535,7 +535,7 @@ void CSeatManager::onSetCursor(SP<CWLSeatResource> seatResource, uint32_t serial
// return;
// }
- events.setCursor.emit(SSetCursorEvent{surf, hotspot});
+ m_events.setCursor.emit(SSetCursorEvent{surf, hotspot});
}
SP<CWLSeatResource> CSeatManager::seatResourceForClient(wl_client* client) {
@@ -543,62 +543,62 @@ SP<CWLSeatResource> CSeatManager::seatResourceForClient(wl_client* client) {
}
void CSeatManager::setCurrentSelection(SP<IDataSource> source) {
- if (source == selection.currentSelection) {
+ if (source == m_selection.currentSelection) {
Debug::log(WARN, "[seat] duplicated setCurrentSelection?");
return;
}
- selection.destroySelection.reset();
+ m_selection.destroySelection.reset();
- if (selection.currentSelection)
- selection.currentSelection->cancelled();
+ if (m_selection.currentSelection)
+ m_selection.currentSelection->cancelled();
if (!source)
PROTO::data->setSelection(nullptr);
- selection.currentSelection = source;
+ m_selection.currentSelection = source;
if (source) {
- selection.destroySelection = source->events.destroy.registerListener([this](std::any d) { setCurrentSelection(nullptr); });
+ m_selection.destroySelection = source->events.destroy.registerListener([this](std::any d) { setCurrentSelection(nullptr); });
PROTO::data->setSelection(source);
PROTO::dataWlr->setSelection(source, false);
}
- events.setSelection.emit();
+ m_events.setSelection.emit();
}
void CSeatManager::setCurrentPrimarySelection(SP<IDataSource> source) {
- if (source == selection.currentPrimarySelection) {
+ if (source == m_selection.currentPrimarySelection) {
Debug::log(WARN, "[seat] duplicated setCurrentPrimarySelection?");
return;
}
- selection.destroyPrimarySelection.reset();
+ m_selection.destroyPrimarySelection.reset();
- if (selection.currentPrimarySelection)
- selection.currentPrimarySelection->cancelled();
+ if (m_selection.currentPrimarySelection)
+ m_selection.currentPrimarySelection->cancelled();
if (!source)
PROTO::primarySelection->setSelection(nullptr);
- selection.currentPrimarySelection = source;
+ m_selection.currentPrimarySelection = source;
if (source) {
- selection.destroyPrimarySelection = source->events.destroy.registerListener([this](std::any d) { setCurrentPrimarySelection(nullptr); });
+ m_selection.destroyPrimarySelection = source->events.destroy.registerListener([this](std::any d) { setCurrentPrimarySelection(nullptr); });
PROTO::primarySelection->setSelection(source);
PROTO::dataWlr->setSelection(source, true);
}
- events.setPrimarySelection.emit();
+ m_events.setPrimarySelection.emit();
}
void CSeatManager::setGrab(SP<CSeatGrab> grab) {
- if (seatGrab) {
- auto oldGrab = seatGrab;
- seatGrab.reset();
+ if (m_seatGrab) {
+ auto oldGrab = m_seatGrab;
+ m_seatGrab.reset();
g_pInputManager->refocus();
- auto currentFocus = state.keyboardFocus.lock();
+ auto currentFocus = m_state.keyboardFocus.lock();
auto refocus = !currentFocus;
SP<CWLSurface> surf;
@@ -627,23 +627,23 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
g_pCompositor->focusWindow(candidate);
}
- if (oldGrab->onEnd)
- oldGrab->onEnd();
+ if (oldGrab->m_onEnd)
+ oldGrab->m_onEnd();
}
if (!grab)
return;
- seatGrab = grab;
+ m_seatGrab = grab;
refocusGrab();
}
void CSeatManager::resendEnterEvents() {
- SP<CWLSurfaceResource> kb = state.keyboardFocus.lock();
- SP<CWLSurfaceResource> pt = state.pointerFocus.lock();
+ SP<CWLSurfaceResource> kb = m_state.keyboardFocus.lock();
+ SP<CWLSurfaceResource> pt = m_state.pointerFocus.lock();
- auto last = lastLocalCoords;
+ auto last = m_lastLocalCoords;
setKeyboardFocus(nullptr);
setPointerFocus(nullptr, {});
@@ -653,23 +653,23 @@ void CSeatManager::resendEnterEvents() {
}
bool CSeatGrab::accepts(SP<CWLSurfaceResource> surf) {
- return std::find(surfs.begin(), surfs.end(), surf) != surfs.end();
+ return std::find(m_surfs.begin(), m_surfs.end(), surf) != m_surfs.end();
}
void CSeatGrab::add(SP<CWLSurfaceResource> surf) {
- surfs.emplace_back(surf);
+ m_surfs.emplace_back(surf);
}
void CSeatGrab::remove(SP<CWLSurfaceResource> surf) {
- std::erase(surfs, surf);
- if ((keyboard && g_pSeatManager->state.keyboardFocus == surf) || (pointer && g_pSeatManager->state.pointerFocus == surf))
+ std::erase(m_surfs, surf);
+ if ((m_keyboard && g_pSeatManager->m_state.keyboardFocus == surf) || (m_pointer && g_pSeatManager->m_state.pointerFocus == surf))
g_pSeatManager->refocusGrab();
}
void CSeatGrab::setCallback(std::function<void()> onEnd_) {
- onEnd = onEnd_;
+ m_onEnd = onEnd_;
}
void CSeatGrab::clear() {
- surfs.clear();
+ m_surfs.clear();
}
diff --git a/src/managers/SeatManager.hpp b/src/managers/SeatManager.hpp
index 32472aa3..6310f0d2 100644
--- a/src/managers/SeatManager.hpp
+++ b/src/managers/SeatManager.hpp
@@ -33,15 +33,12 @@ class CSeatGrab {
void setCallback(std::function<void()> onEnd_);
void clear();
- bool keyboard = false;
- bool pointer = false;
- bool touch = false;
-
- bool removeOnInput = true; // on hard input e.g. click outside, remove
+ bool m_keyboard = false;
+ bool m_pointer = false;
private:
- std::vector<WP<CWLSurfaceResource>> surfs;
- std::function<void()> onEnd;
+ std::vector<WP<CWLSurfaceResource>> m_surfs;
+ std::function<void()> m_onEnd;
friend class CSeatManager;
};
@@ -96,7 +93,7 @@ class CSeatManager {
WP<CWLSeatResource> touchFocusResource;
WP<CWLSurfaceResource> dndPointerFocus;
- } state;
+ } m_state;
struct SSetCursorEvent {
SP<CWLSurfaceResource> surf = nullptr;
@@ -111,27 +108,27 @@ class CSeatManager {
CSignal setCursor; // SSetCursorEvent
CSignal setSelection;
CSignal setPrimarySelection;
- } events;
+ } m_events;
struct {
WP<IDataSource> currentSelection;
CHyprSignalListener destroySelection;
WP<IDataSource> currentPrimarySelection;
CHyprSignalListener destroyPrimarySelection;
- } selection;
+ } m_selection;
void setCurrentSelection(SP<IDataSource> source);
void setCurrentPrimarySelection(SP<IDataSource> source);
// do not write to directly, use set...
- WP<IPointer> mouse;
- WP<IKeyboard> keyboard;
+ WP<IPointer> m_mouse;
+ WP<IKeyboard> m_keyboard;
void setGrab(SP<CSeatGrab> grab); // nullptr removes
- SP<CSeatGrab> seatGrab;
+ SP<CSeatGrab> m_seatGrab;
- bool isPointerFrameSkipped = false;
- bool isPointerFrameCommit = false;
+ bool m_isPointerFrameSkipped = false;
+ bool m_isPointerFrameCommit = false;
private:
struct SSeatResourceContainer {
@@ -145,7 +142,7 @@ class CSeatManager {
} listeners;
};
- std::vector<SP<SSeatResourceContainer>> seatResources;
+ std::vector<SP<SSeatResourceContainer>> m_seatResources;
void onNewSeatResource(SP<CWLSeatResource> resource);
SP<SSeatResourceContainer> containerForResource(SP<CWLSeatResource> seatResource);
@@ -156,10 +153,10 @@ class CSeatManager {
CHyprSignalListener keyboardSurfaceDestroy;
CHyprSignalListener pointerSurfaceDestroy;
CHyprSignalListener touchSurfaceDestroy;
- } listeners;
+ } m_listeners;
- Vector2D lastLocalCoords;
- int touchLocks = 0; // we assume there aint like 20 touch devices at once...
+ Vector2D m_lastLocalCoords;
+ int m_touchLocks = 0; // we assume there aint like 20 touch devices at once...
friend struct SSeatResourceContainer;
friend class CSeatGrab;
diff --git a/src/managers/SessionLockManager.cpp b/src/managers/SessionLockManager.cpp
index 83a238a6..bb01c944 100644
--- a/src/managers/SessionLockManager.cpp
+++ b/src/managers/SessionLockManager.cpp
@@ -42,7 +42,7 @@ SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : sur
}
CSessionLockManager::CSessionLockManager() {
- listeners.newLock = PROTO::sessionLock->events.newLock.registerListener([this](std::any data) { this->onNewSessionLock(std::any_cast<SP<CSessionLock>>(data)); });
+ m_listeners.newLock = PROTO::sessionLock->events.newLock.registerListener([this](std::any data) { this->onNewSessionLock(std::any_cast<SP<CSessionLock>>(data)); });
}
void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
@@ -57,30 +57,30 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
Debug::log(LOG, "Session got locked by {:x}", (uintptr_t)pLock.get());
- m_pSessionLock = makeUnique<SSessionLock>();
- m_pSessionLock->lock = pLock;
- m_pSessionLock->mLockTimer.reset();
+ m_sessionLock = makeUnique<SSessionLock>();
+ m_sessionLock->lock = pLock;
+ m_sessionLock->mLockTimer.reset();
- m_pSessionLock->listeners.newSurface = pLock->events.newLockSurface.registerListener([this](std::any data) {
+ m_sessionLock->listeners.newSurface = pLock->events.newLockSurface.registerListener([this](std::any data) {
auto SURFACE = std::any_cast<SP<CSessionLockSurface>>(data);
const auto PMONITOR = SURFACE->monitor();
- const auto NEWSURFACE = m_pSessionLock->vSessionLockSurfaces.emplace_back(makeUnique<SSessionLockSurface>(SURFACE)).get();
+ const auto NEWSURFACE = m_sessionLock->vSessionLockSurfaces.emplace_back(makeUnique<SSessionLockSurface>(SURFACE)).get();
NEWSURFACE->iMonitorID = PMONITOR->m_id;
PROTO::fractional->sendScale(SURFACE->surface(), PMONITOR->m_scale);
});
- m_pSessionLock->listeners.unlock = pLock->events.unlockAndDestroy.registerListener([this](std::any data) {
- m_pSessionLock.reset();
+ m_sessionLock->listeners.unlock = pLock->events.unlockAndDestroy.registerListener([this](std::any data) {
+ m_sessionLock.reset();
g_pInputManager->refocus();
for (auto const& m : g_pCompositor->m_monitors)
g_pHyprRenderer->damageMonitor(m);
});
- m_pSessionLock->listeners.destroy = pLock->events.destroyed.registerListener([this](std::any data) {
- m_pSessionLock.reset();
+ m_sessionLock->listeners.destroy = pLock->events.destroyed.registerListener([this](std::any data) {
+ m_sessionLock.reset();
g_pCompositor->focusSurface(nullptr);
for (auto const& m : g_pCompositor->m_monitors)
@@ -93,8 +93,8 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
// Normally the locked event is sent after each output rendered a lock screen frame.
// When there are no outputs, send it right away.
if (g_pCompositor->m_unsafeState) {
- m_pSessionLock->lock->sendLocked();
- m_pSessionLock->m_hasSentLocked = true;
+ m_sessionLock->lock->sendLocked();
+ m_sessionLock->hasSentLocked = true;
}
}
@@ -103,10 +103,10 @@ bool CSessionLockManager::isSessionLocked() {
}
WP<SSessionLockSurface> CSessionLockManager::getSessionLockSurfaceForMonitor(uint64_t id) {
- if (!m_pSessionLock)
+ if (!m_sessionLock)
return {};
- for (auto const& sls : m_pSessionLock->vSessionLockSurfaces) {
+ for (auto const& sls : m_sessionLock->vSessionLockSurfaces) {
if (sls->iMonitorID == id) {
if (sls->mapped)
return sls;
@@ -120,14 +120,14 @@ WP<SSessionLockSurface> CSessionLockManager::getSessionLockSurfaceForMonitor(uin
// We don't want the red screen to flash.
float CSessionLockManager::getRedScreenAlphaForMonitor(uint64_t id) {
- if (!m_pSessionLock)
+ if (!m_sessionLock)
return 1.F;
- const auto& NOMAPPEDSURFACETIMER = m_pSessionLock->mMonitorsWithoutMappedSurfaceTimers.find(id);
+ const auto& NOMAPPEDSURFACETIMER = m_sessionLock->mMonitorsWithoutMappedSurfaceTimers.find(id);
- if (NOMAPPEDSURFACETIMER == m_pSessionLock->mMonitorsWithoutMappedSurfaceTimers.end()) {
- m_pSessionLock->mMonitorsWithoutMappedSurfaceTimers.emplace(id, CTimer());
- m_pSessionLock->mMonitorsWithoutMappedSurfaceTimers[id].reset();
+ if (NOMAPPEDSURFACETIMER == m_sessionLock->mMonitorsWithoutMappedSurfaceTimers.end()) {
+ m_sessionLock->mMonitorsWithoutMappedSurfaceTimers.emplace(id, CTimer());
+ m_sessionLock->mMonitorsWithoutMappedSurfaceTimers[id].reset();
return 0.f;
}
@@ -135,13 +135,13 @@ float CSessionLockManager::getRedScreenAlphaForMonitor(uint64_t id) {
}
void CSessionLockManager::onLockscreenRenderedOnMonitor(uint64_t id) {
- if (!m_pSessionLock || m_pSessionLock->m_hasSentLocked)
+ if (!m_sessionLock || m_sessionLock->hasSentLocked)
return;
- m_pSessionLock->m_lockedMonitors.emplace(id);
- const bool LOCKED = std::ranges::all_of(g_pCompositor->m_monitors, [this](auto m) { return m_pSessionLock->m_lockedMonitors.contains(m->m_id); });
- if (LOCKED && m_pSessionLock->lock->good()) {
- m_pSessionLock->lock->sendLocked();
- m_pSessionLock->m_hasSentLocked = true;
+ m_sessionLock->lockedMonitors.emplace(id);
+ const bool LOCKED = std::ranges::all_of(g_pCompositor->m_monitors, [this](auto m) { return m_sessionLock->lockedMonitors.contains(m->m_id); });
+ if (LOCKED && m_sessionLock->lock->good()) {
+ m_sessionLock->lock->sendLocked();
+ m_sessionLock->hasSentLocked = true;
}
}
@@ -149,10 +149,10 @@ bool CSessionLockManager::isSurfaceSessionLock(SP<CWLSurfaceResource> pSurface)
// TODO: this has some edge cases when it's wrong (e.g. destroyed lock but not yet surfaces)
// but can be easily fixed when I rewrite wlr_surface
- if (!m_pSessionLock)
+ if (!m_sessionLock)
return false;
- for (auto const& sls : m_pSessionLock->vSessionLockSurfaces) {
+ for (auto const& sls : m_sessionLock->vSessionLockSurfaces) {
if (sls->surface->surface() == pSurface)
return true;
}
@@ -161,15 +161,15 @@ bool CSessionLockManager::isSurfaceSessionLock(SP<CWLSurfaceResource> pSurface)
}
void CSessionLockManager::removeSessionLockSurface(SSessionLockSurface* pSLS) {
- if (!m_pSessionLock)
+ if (!m_sessionLock)
return;
- std::erase_if(m_pSessionLock->vSessionLockSurfaces, [&](const auto& other) { return pSLS == other.get(); });
+ std::erase_if(m_sessionLock->vSessionLockSurfaces, [&](const auto& other) { return pSLS == other.get(); });
if (g_pCompositor->m_lastFocus)
return;
- for (auto const& sls : m_pSessionLock->vSessionLockSurfaces) {
+ for (auto const& sls : m_sessionLock->vSessionLockSurfaces) {
if (!sls->mapped)
continue;
@@ -179,18 +179,18 @@ void CSessionLockManager::removeSessionLockSurface(SSessionLockSurface* pSLS) {
}
bool CSessionLockManager::isSessionLockPresent() {
- return m_pSessionLock && !m_pSessionLock->vSessionLockSurfaces.empty();
+ return m_sessionLock && !m_sessionLock->vSessionLockSurfaces.empty();
}
bool CSessionLockManager::anySessionLockSurfacesPresent() {
- return m_pSessionLock && std::ranges::any_of(m_pSessionLock->vSessionLockSurfaces, [](const auto& surf) { return surf->mapped; });
+ return m_sessionLock && std::ranges::any_of(m_sessionLock->vSessionLockSurfaces, [](const auto& surf) { return surf->mapped; });
}
bool CSessionLockManager::shallConsiderLockMissing() {
- if (!m_pSessionLock)
+ if (!m_sessionLock)
return false;
static auto LOCKDEAD_SCREEN_DELAY = CConfigValue<Hyprlang::INT>("misc:lockdead_screen_delay");
- return m_pSessionLock->mLockTimer.getMillis() > *LOCKDEAD_SCREEN_DELAY;
+ return m_sessionLock->mLockTimer.getMillis() > *LOCKDEAD_SCREEN_DELAY;
}
diff --git a/src/managers/SessionLockManager.hpp b/src/managers/SessionLockManager.hpp
index b80da2fd..da15496e 100644
--- a/src/managers/SessionLockManager.hpp
+++ b/src/managers/SessionLockManager.hpp
@@ -40,8 +40,8 @@ struct SSessionLock {
CHyprSignalListener destroy;
} listeners;
- bool m_hasSentLocked = false;
- std::unordered_set<uint64_t> m_lockedMonitors;
+ bool hasSentLocked = false;
+ std::unordered_set<uint64_t> lockedMonitors;
};
class CSessionLockManager {
@@ -65,11 +65,11 @@ class CSessionLockManager {
bool shallConsiderLockMissing();
private:
- UP<SSessionLock> m_pSessionLock;
+ UP<SSessionLock> m_sessionLock;
struct {
CHyprSignalListener newLock;
- } listeners;
+ } m_listeners;
void onNewSessionLock(SP<CSessionLock> pWlrLock);
};
diff --git a/src/managers/TokenManager.cpp b/src/managers/TokenManager.cpp
index 446b87ce..141ea65e 100644
--- a/src/managers/TokenManager.cpp
+++ b/src/managers/TokenManager.cpp
@@ -18,7 +18,7 @@ std::string CTokenManager::getRandomUUID() {
uuid = std::format("{:02x}{:02x}{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}-{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}", (uint16_t)uuid_[0], (uint16_t)uuid_[1],
(uint16_t)uuid_[2], (uint16_t)uuid_[3], (uint16_t)uuid_[4], (uint16_t)uuid_[5], (uint16_t)uuid_[6], (uint16_t)uuid_[7], (uint16_t)uuid_[8],
(uint16_t)uuid_[9], (uint16_t)uuid_[10], (uint16_t)uuid_[11], (uint16_t)uuid_[12], (uint16_t)uuid_[13], (uint16_t)uuid_[14], (uint16_t)uuid_[15]);
- } while (m_mTokens.contains(uuid));
+ } while (m_tokens.contains(uuid));
return uuid;
}
@@ -26,7 +26,7 @@ std::string CTokenManager::getRandomUUID() {
std::string CTokenManager::registerNewToken(std::any data, Time::steady_dur expires) {
std::string uuid = getRandomUUID();
- m_mTokens[uuid] = makeShared<CUUIDToken>(uuid, data, expires);
+ m_tokens[uuid] = makeShared<CUUIDToken>(uuid, data, expires);
return uuid;
}
@@ -34,16 +34,16 @@ SP<CUUIDToken> CTokenManager::getToken(const std::string& uuid) {
// cleanup expired tokens
const auto NOW = Time::steadyNow();
- std::erase_if(m_mTokens, [&NOW](const auto& el) { return el.second->m_expiresAt < NOW; });
+ std::erase_if(m_tokens, [&NOW](const auto& el) { return el.second->m_expiresAt < NOW; });
- if (!m_mTokens.contains(uuid))
+ if (!m_tokens.contains(uuid))
return {};
- return m_mTokens.at(uuid);
+ return m_tokens.at(uuid);
}
void CTokenManager::removeToken(SP<CUUIDToken> token) {
if (!token)
return;
- m_mTokens.erase(token->m_uuid);
+ m_tokens.erase(token->m_uuid);
}
diff --git a/src/managers/TokenManager.hpp b/src/managers/TokenManager.hpp
index cccb9bd9..10faee7b 100644
--- a/src/managers/TokenManager.hpp
+++ b/src/managers/TokenManager.hpp
@@ -31,7 +31,7 @@ class CTokenManager {
void removeToken(SP<CUUIDToken> token);
private:
- std::unordered_map<std::string, SP<CUUIDToken>> m_mTokens;
+ std::unordered_map<std::string, SP<CUUIDToken>> m_tokens;
};
inline UP<CTokenManager> g_pTokenManager; \ No newline at end of file
diff --git a/src/managers/VersionKeeperManager.cpp b/src/managers/VersionKeeperManager.cpp
index 95c11b4b..ef9c274d 100644
--- a/src/managers/VersionKeeperManager.cpp
+++ b/src/managers/VersionKeeperManager.cpp
@@ -50,7 +50,7 @@ CVersionKeeperManager::CVersionKeeperManager() {
return;
}
- m_bFired = true;
+ m_fired = true;
g_pEventLoopManager->doLater([]() {
CProcess proc("hyprland-update-screen", {"--new-version", HYPRLAND_VERSION});
@@ -81,5 +81,5 @@ bool CVersionKeeperManager::isVersionOlderThanRunning(const std::string& ver) {
}
bool CVersionKeeperManager::fired() {
- return m_bFired;
+ return m_fired;
}
diff --git a/src/managers/VersionKeeperManager.hpp b/src/managers/VersionKeeperManager.hpp
index 250a36b8..15821879 100644
--- a/src/managers/VersionKeeperManager.hpp
+++ b/src/managers/VersionKeeperManager.hpp
@@ -12,7 +12,7 @@ class CVersionKeeperManager {
private:
bool isVersionOlderThanRunning(const std::string& ver);
- bool m_bFired = false;
+ bool m_fired = false;
};
inline UP<CVersionKeeperManager> g_pVersionKeeperMgr; \ No newline at end of file
diff --git a/src/managers/XCursorManager.cpp b/src/managers/XCursorManager.cpp
index 7d629785..79bb7a5d 100644
--- a/src/managers/XCursorManager.cpp
+++ b/src/managers/XCursorManager.cpp
@@ -97,45 +97,45 @@ static std::vector<uint32_t> HYPR_XCURSOR_PIXELS = {
// clang-format on
CXCursorManager::CXCursorManager() {
- hyprCursor = makeShared<SXCursors>();
+ m_hyprCursor = makeShared<SXCursors>();
SXCursorImage image;
image.size = {32, 32};
image.hotspot = {3, 2};
image.pixels = HYPR_XCURSOR_PIXELS;
image.delay = 0;
- hyprCursor->images.push_back(image);
- hyprCursor->shape = "left_ptr";
- defaultCursor = hyprCursor;
+ m_hyprCursor->images.push_back(image);
+ m_hyprCursor->shape = "left_ptr";
+ m_defaultCursor = m_hyprCursor;
}
void CXCursorManager::loadTheme(std::string const& name, int size, float scale) {
- if (lastLoadSize == (size * std::ceil(scale)) && themeName == name && lastLoadScale == scale)
+ if (m_lastLoadSize == (size * std::ceil(scale)) && m_themeName == name && m_lastLoadScale == scale)
return;
- lastLoadSize = size * std::ceil(scale);
- lastLoadScale = scale;
- themeName = name.empty() ? "default" : name;
- defaultCursor.reset();
- cursors.clear();
+ m_lastLoadSize = size * std::ceil(scale);
+ m_lastLoadScale = scale;
+ m_themeName = name.empty() ? "default" : name;
+ m_defaultCursor.reset();
+ m_cursors.clear();
- auto paths = themePaths(themeName);
+ auto paths = themePaths(m_themeName);
if (paths.empty()) {
Debug::log(ERR, "XCursor librarypath is empty loading standard XCursors");
- cursors = loadStandardCursors(themeName, lastLoadSize);
+ m_cursors = loadStandardCursors(m_themeName, m_lastLoadSize);
} else {
for (auto const& p : paths) {
try {
- auto dirCursors = loadAllFromDir(p, lastLoadSize);
- std::copy_if(dirCursors.begin(), dirCursors.end(), std::back_inserter(cursors),
- [this](auto const& p) { return std::none_of(cursors.begin(), cursors.end(), [&p](auto const& dp) { return dp->shape == p->shape; }); });
+ auto dirCursors = loadAllFromDir(p, m_lastLoadSize);
+ std::copy_if(dirCursors.begin(), dirCursors.end(), std::back_inserter(m_cursors),
+ [this](auto const& p) { return std::none_of(m_cursors.begin(), m_cursors.end(), [&p](auto const& dp) { return dp->shape == p->shape; }); });
} catch (std::exception& e) { Debug::log(ERR, "XCursor path {} can't be loaded: threw error {}", p, e.what()); }
}
}
- if (cursors.empty()) {
- Debug::log(ERR, "XCursor failed finding any shapes in theme \"{}\".", themeName);
- defaultCursor = hyprCursor;
+ if (m_cursors.empty()) {
+ Debug::log(ERR, "XCursor failed finding any shapes in theme \"{}\".", m_themeName);
+ m_defaultCursor = m_hyprCursor;
return;
}
@@ -144,14 +144,14 @@ void CXCursorManager::loadTheme(std::string const& name, int size, float scale)
if (legacyName.empty())
continue;
- auto it = std::find_if(cursors.begin(), cursors.end(), [&legacyName](auto const& c) { return c->shape == legacyName; });
+ auto it = std::find_if(m_cursors.begin(), m_cursors.end(), [&legacyName](auto const& c) { return c->shape == legacyName; });
- if (it == cursors.end()) {
+ if (it == m_cursors.end()) {
Debug::log(LOG, "XCursor failed to find a legacy shape with name {}, skipping", legacyName);
continue;
}
- if (std::any_of(cursors.begin(), cursors.end(), [&shape](auto const& dp) { return dp->shape == shape; })) {
+ if (std::any_of(m_cursors.begin(), m_cursors.end(), [&shape](auto const& dp) { return dp->shape == shape; })) {
Debug::log(LOG, "XCursor already has a shape {} loaded, skipping", shape);
continue;
}
@@ -160,7 +160,7 @@ void CXCursorManager::loadTheme(std::string const& name, int size, float scale)
cursor->images = it->get()->images;
cursor->shape = shape;
- cursors.emplace_back(cursor);
+ m_cursors.emplace_back(cursor);
}
syncGsettings();
@@ -168,11 +168,11 @@ void CXCursorManager::loadTheme(std::string const& name, int size, float scale)
SP<SXCursors> CXCursorManager::getShape(std::string const& shape, int size, float scale) {
// monitor scaling changed etc, so reload theme with new size.
- if ((size * std::ceil(scale)) != lastLoadSize || scale != lastLoadScale)
- loadTheme(themeName, size, scale);
+ if ((size * std::ceil(scale)) != m_lastLoadSize || scale != m_lastLoadScale)
+ loadTheme(m_themeName, size, scale);
// try to get an icon we know if we have one
- for (auto const& c : cursors) {
+ for (auto const& c : m_cursors) {
if (c->shape != shape)
continue;
@@ -180,7 +180,7 @@ SP<SXCursors> CXCursorManager::getShape(std::string const& shape, int size, floa
}
Debug::log(WARN, "XCursor couldn't find shape {} , using default cursor instead", shape);
- return defaultCursor;
+ return m_defaultCursor;
}
SP<SXCursors> CXCursorManager::createCursor(std::string const& shape, void* ximages) {
@@ -504,15 +504,15 @@ std::vector<SP<SXCursors>> CXCursorManager::loadStandardCursors(std::string cons
auto cursor = createCursor(shape, xImages);
newCursors.emplace_back(cursor);
- if (!defaultCursor && (shape == "left_ptr" || shape == "arrow"))
- defaultCursor = cursor;
+ if (!m_defaultCursor && (shape == "left_ptr" || shape == "arrow"))
+ m_defaultCursor = cursor;
XcursorImagesDestroy(xImages);
}
// broken theme.. just set it.
- if (!newCursors.empty() && !defaultCursor)
- defaultCursor = newCursors.front();
+ if (!newCursors.empty() && !m_defaultCursor)
+ m_defaultCursor = newCursors.front();
return newCursors;
}
@@ -551,16 +551,16 @@ std::vector<SP<SXCursors>> CXCursorManager::loadAllFromDir(std::string const& pa
auto cursor = createCursor(shape, xImages);
newCursors.emplace_back(cursor);
- if (!defaultCursor && (shape == "left_ptr" || shape == "arrow"))
- defaultCursor = cursor;
+ if (!m_defaultCursor && (shape == "left_ptr" || shape == "arrow"))
+ m_defaultCursor = cursor;
XcursorImagesDestroy(xImages);
}
}
// broken theme.. just set it.
- if (!newCursors.empty() && !defaultCursor)
- defaultCursor = newCursors.front();
+ if (!newCursors.empty() && !m_defaultCursor)
+ m_defaultCursor = newCursors.front();
return newCursors;
}
@@ -617,7 +617,7 @@ void CXCursorManager::syncGsettings() {
g_object_unref(gsettings);
};
- int unscaledSize = lastLoadSize / std::ceil(lastLoadScale);
- setValue("cursor-theme", themeName, "org.gnome.desktop.interface");
+ int unscaledSize = m_lastLoadSize / std::ceil(m_lastLoadScale);
+ setValue("cursor-theme", m_themeName, "org.gnome.desktop.interface");
setValue("cursor-size", unscaledSize, "org.gnome.desktop.interface");
}
diff --git a/src/managers/XCursorManager.hpp b/src/managers/XCursorManager.hpp
index 8e804a0c..2535d8a0 100644
--- a/src/managers/XCursorManager.hpp
+++ b/src/managers/XCursorManager.hpp
@@ -36,10 +36,10 @@ class CXCursorManager {
std::vector<SP<SXCursors>> loadStandardCursors(std::string const& name, int size);
std::vector<SP<SXCursors>> loadAllFromDir(std::string const& path, int size);
- int lastLoadSize = 0;
- float lastLoadScale = 0;
- std::string themeName = "";
- SP<SXCursors> defaultCursor;
- SP<SXCursors> hyprCursor;
- std::vector<SP<SXCursors>> cursors;
+ int m_lastLoadSize = 0;
+ float m_lastLoadScale = 0;
+ std::string m_themeName = "";
+ SP<SXCursors> m_defaultCursor;
+ SP<SXCursors> m_hyprCursor;
+ std::vector<SP<SXCursors>> m_cursors;
};
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 804eb173..1e62af64 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -48,10 +48,10 @@ CInputManager::CInputManager() {
auto event = std::any_cast<CCursorShapeProtocol::SSetShapeEvent>(data);
- if (!g_pSeatManager->state.pointerFocusResource)
+ if (!g_pSeatManager->m_state.pointerFocusResource)
return;
- if (wl_resource_get_client(event.pMgr->resource()) != g_pSeatManager->state.pointerFocusResource->client())
+ if (wl_resource_get_client(event.pMgr->resource()) != g_pSeatManager->m_state.pointerFocusResource->client())
return;
Debug::log(LOG, "cursorImage request: shape {} -> {}", (uint32_t)event.shape, event.shapeName);
@@ -74,7 +74,7 @@ CInputManager::CInputManager() {
this->newVirtualMouse(std::any_cast<SP<CVirtualPointerV1Resource>>(data));
updateCapabilities();
});
- m_listeners.setCursor = g_pSeatManager->events.setCursor.registerListener([this](std::any d) { this->processMouseRequest(d); });
+ m_listeners.setCursor = g_pSeatManager->m_events.setCursor.registerListener([this](std::any d) { this->processMouseRequest(d); });
m_cursorSurfaceInfo.wlSurface = CWLSurface::create();
}
@@ -112,7 +112,7 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) {
const auto DELTA = *PNOACCEL == 1 ? unaccel : delta;
- if (g_pSeatManager->isPointerFrameSkipped)
+ if (g_pSeatManager->m_isPointerFrameSkipped)
g_pPointerManager->storeMovement((uint64_t)e.timeMs, DELTA, unaccel);
else
g_pPointerManager->setStoredMovement((uint64_t)e.timeMs, DELTA, unaccel);
@@ -221,7 +221,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
// constraints
- if (!g_pSeatManager->mouse.expired() && isConstrained()) {
+ if (!g_pSeatManager->m_mouse.expired() && isConstrained()) {
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_lastFocus.lock());
const auto CONSTRAINT = SURF ? SURF->constraint() : nullptr;
@@ -289,9 +289,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
// if we are holding a pointer button,
// and we're not dnd-ing, don't refocus. Keep focus on last surface.
- if (!PROTO::data->dndActive() && !m_currentlyHeldButtons.empty() && g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->mapped && g_pSeatManager->state.pointerFocus &&
+ if (!PROTO::data->dndActive() && !m_currentlyHeldButtons.empty() && g_pCompositor->m_lastFocus && g_pCompositor->m_lastFocus->mapped && g_pSeatManager->m_state.pointerFocus &&
!m_hardInput) {
- foundSurface = g_pSeatManager->state.pointerFocus.lock();
+ foundSurface = g_pSeatManager->m_state.pointerFocus.lock();
// IME popups aren't desktop-like elements
// TODO: make them.
@@ -436,13 +436,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
// FIXME: This will be disabled during DnD operations because we do not exactly follow the spec
// xdg-popup grabs should be keyboard-only, while they are absolute in our case...
- if (g_pSeatManager->seatGrab && !g_pSeatManager->seatGrab->accepts(foundSurface) && !PROTO::data->dndActive()) {
+ if (g_pSeatManager->m_seatGrab && !g_pSeatManager->m_seatGrab->accepts(foundSurface) && !PROTO::data->dndActive()) {
if (m_hardInput || refocus) {
g_pSeatManager->setGrab(nullptr);
return; // setGrab will refocus
} else {
// we need to grab the last surface.
- foundSurface = g_pSeatManager->state.pointerFocus.lock();
+ foundSurface = g_pSeatManager->m_state.pointerFocus.lock();
auto HLSurface = CWLSurface::fromResource(foundSurface);
@@ -548,7 +548,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
if (FOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_lastWindow)
g_pSeatManager->setPointerFocus(foundSurface, surfaceLocal);
- if (g_pSeatManager->state.pointerFocus == foundSurface)
+ if (g_pSeatManager->m_state.pointerFocus == foundSurface)
g_pSeatManager->sendPointerMotion(time, surfaceLocal);
m_lastFocusOnLS = false;
@@ -573,7 +573,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
}
}
- if (g_pSeatManager->state.keyboardFocus == nullptr)
+ if (g_pSeatManager->m_state.keyboardFocus == nullptr)
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
m_lastFocusOnLS = false;
@@ -761,7 +761,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
if (*PFOLLOWMOUSE == 3) // don't refocus on full loose
break;
- if ((g_pSeatManager->mouse.expired() || !isConstrained()) /* No constraints */
+ if ((g_pSeatManager->m_mouse.expired() || !isConstrained()) /* No constraints */
&& (w && g_pCompositor->m_lastWindow.lock() != w) /* window should change */) {
// a bit hacky
// if we only pressed one button, allow us to refocus. m_lCurrentlyHeldButtons.size() > 0 will stick the focus
@@ -775,10 +775,10 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
}
// if clicked on a floating window make it top
- if (!g_pSeatManager->state.pointerFocus)
+ if (!g_pSeatManager->m_state.pointerFocus)
break;
- auto HLSurf = CWLSurface::fromResource(g_pSeatManager->state.pointerFocus.lock());
+ auto HLSurf = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
if (HLSurf && HLSurf->getWindow())
g_pCompositor->changeWindowZOrder(HLSurf->getWindow(), true);
@@ -794,7 +794,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
if (const auto PMON = g_pCompositor->getMonitorFromVector(mouseCoords); PMON != g_pCompositor->m_lastMonitor && PMON)
g_pCompositor->setActiveMonitor(PMON);
- if (g_pSeatManager->seatGrab && e.state == WL_POINTER_BUTTON_STATE_PRESSED) {
+ if (g_pSeatManager->m_seatGrab && e.state == WL_POINTER_BUTTON_STATE_PRESSED) {
m_hardInput = true;
simulateMouseMovement();
m_hardInput = false;
@@ -870,8 +870,8 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) {
}
}
- if (g_pSeatManager->state.pointerFocus) {
- const auto PCURRWINDOW = g_pCompositor->getWindowFromSurface(g_pSeatManager->state.pointerFocus.lock());
+ if (g_pSeatManager->m_state.pointerFocus) {
+ const auto PCURRWINDOW = g_pCompositor->getWindowFromSurface(g_pSeatManager->m_state.pointerFocus.lock());
if (*PFOLLOWMOUSE == 1 && PCURRWINDOW && PWINDOW != PCURRWINDOW)
simulateMouseMovement();
@@ -995,9 +995,9 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
auto PKEEB = ((IKeyboard*)owner)->m_self.lock();
const auto LAYOUT = PKEEB->getActiveLayout();
- if (PKEEB == g_pSeatManager->keyboard) {
+ if (PKEEB == g_pSeatManager->m_keyboard) {
g_pSeatManager->updateActiveKeyboardData();
- g_pKeybindManager->m_mKeyToCodeCache.clear();
+ g_pKeybindManager->m_keyToCodeCache.clear();
}
g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->m_hlName + "," + LAYOUT});
@@ -1323,7 +1323,7 @@ void CInputManager::destroyPointer(SP<IPointer> mouse) {
g_pSeatManager->setMouse(m_pointers.size() > 0 ? m_pointers.front() : nullptr);
- if (!g_pSeatManager->mouse.expired())
+ if (!g_pSeatManager->m_mouse.expired())
unconstrainMouse();
removeFromHIDs(mouse);
@@ -1502,7 +1502,7 @@ bool CInputManager::refocusLastWindow(PHLMONITOR pMonitor) {
}
void CInputManager::unconstrainMouse() {
- if (g_pSeatManager->mouse.expired())
+ if (g_pSeatManager->m_mouse.expired())
return;
for (auto const& c : m_constraints) {
diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp
index 5d80f1d4..5b9ca378 100644
--- a/src/managers/input/Tablets.cpp
+++ b/src/managers/input/Tablets.cpp
@@ -36,7 +36,7 @@ static void focusTool(SP<CTabletTool> tool, SP<CTablet> tablet, SP<CWLSurfaceRes
}
static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = false) {
- const auto LASTHLSURFACE = CWLSurface::fromResource(g_pSeatManager->state.pointerFocus.lock());
+ const auto LASTHLSURFACE = CWLSurface::fromResource(g_pSeatManager->m_state.pointerFocus.lock());
if (!LASTHLSURFACE || !tool->m_active) {
if (tool->getSurface())
@@ -56,7 +56,7 @@ static void refocusTablet(SP<CTablet> tab, SP<CTabletTool> tool, bool motion = f
const auto CURSORPOS = g_pInputManager->getMouseCoordsInternal();
- focusTool(tool, tab, g_pSeatManager->state.pointerFocus.lock());
+ focusTool(tool, tab, g_pSeatManager->m_state.pointerFocus.lock());
if (!motion)
return;