refactor: ProtocolTypes EDirectionMask => enum class DirectionMask

This commit is contained in:
sithlord48
2025-07-03 14:53:42 -04:00
committed by Nick Bolton
parent d71d4eaf07
commit dded2e3711
3 changed files with 16 additions and 14 deletions

View File

@ -178,13 +178,13 @@ enum EDirection
*
* @since Protocol version 1.0
*/
enum EDirectionMask
enum class DirectionMask
{
kNoDirMask = 0, ///< No direction mask
kLeftMask = 1 << kLeft, ///< Left edge mask
kRightMask = 1 << kRight, ///< Right edge mask
kTopMask = 1 << kTop, ///< Top edge mask
kBottomMask = 1 << kBottom ///< Bottom edge mask
NoDirMask = 0, ///< No direction mask
LeftMask = 1 << kLeft, ///< Left edge mask
RightMask = 1 << kRight, ///< Right edge mask
TopMask = 1 << kTop, ///< Top edge mask
BottomMask = 1 << kBottom ///< Bottom edge mask
};
/**

View File

@ -534,16 +534,17 @@ static bool mouseHookHandler(WPARAM wParam, int32_t x, int32_t y, int32_t data)
// check for mouse inside jump zone
bool inside = false;
if (!inside && (g_zoneSides & kLeftMask) != 0) {
using enum DirectionMask;
if (!inside && (g_zoneSides & static_cast<int>(LeftMask)) != 0) {
inside = (x < g_xScreen + g_zoneSize);
}
if (!inside && (g_zoneSides & kRightMask) != 0) {
if (!inside && (g_zoneSides & static_cast<int>(RightMask)) != 0) {
inside = (x >= g_xScreen + g_wScreen - g_zoneSize);
}
if (!inside && (g_zoneSides & kTopMask) != 0) {
if (!inside && (g_zoneSides & static_cast<int>(TopMask)) != 0) {
inside = (y < g_yScreen + g_zoneSize);
}
if (!inside && (g_zoneSides & kBottomMask) != 0) {
if (!inside && (g_zoneSides & static_cast<int>(BottomMask)) != 0) {
inside = (y >= g_yScreen + g_hScreen - g_zoneSize);
}

View File

@ -305,19 +305,20 @@ std::string Server::getName(const BaseClientProxy *client) const
uint32_t Server::getActivePrimarySides() const
{
using enum DirectionMask;
uint32_t sides = 0;
if (!isLockedToScreenServer()) {
if (hasAnyNeighbor(m_primaryClient, kLeft)) {
sides |= kLeftMask;
sides |= static_cast<int>(LeftMask);
}
if (hasAnyNeighbor(m_primaryClient, kRight)) {
sides |= kRightMask;
sides |= static_cast<int>(RightMask);
}
if (hasAnyNeighbor(m_primaryClient, kTop)) {
sides |= kTopMask;
sides |= static_cast<int>(TopMask);
}
if (hasAnyNeighbor(m_primaryClient, kBottom)) {
sides |= kBottomMask;
sides |= static_cast<int>(BottomMask);
}
}
return sides;