refactor: ProtocolTypes EDirectionMask => enum class DirectionMask
This commit is contained in:
parent
d71d4eaf07
commit
dded2e3711
3 changed files with 16 additions and 14 deletions
|
|
@ -178,13 +178,13 @@ enum EDirection
|
||||||
*
|
*
|
||||||
* @since Protocol version 1.0
|
* @since Protocol version 1.0
|
||||||
*/
|
*/
|
||||||
enum EDirectionMask
|
enum class DirectionMask
|
||||||
{
|
{
|
||||||
kNoDirMask = 0, ///< No direction mask
|
NoDirMask = 0, ///< No direction mask
|
||||||
kLeftMask = 1 << kLeft, ///< Left edge mask
|
LeftMask = 1 << kLeft, ///< Left edge mask
|
||||||
kRightMask = 1 << kRight, ///< Right edge mask
|
RightMask = 1 << kRight, ///< Right edge mask
|
||||||
kTopMask = 1 << kTop, ///< Top edge mask
|
TopMask = 1 << kTop, ///< Top edge mask
|
||||||
kBottomMask = 1 << kBottom ///< Bottom edge mask
|
BottomMask = 1 << kBottom ///< Bottom edge mask
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -534,16 +534,17 @@ static bool mouseHookHandler(WPARAM wParam, int32_t x, int32_t y, int32_t data)
|
||||||
|
|
||||||
// check for mouse inside jump zone
|
// check for mouse inside jump zone
|
||||||
bool inside = false;
|
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);
|
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);
|
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);
|
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);
|
inside = (y >= g_yScreen + g_hScreen - g_zoneSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -305,19 +305,20 @@ std::string Server::getName(const BaseClientProxy *client) const
|
||||||
|
|
||||||
uint32_t Server::getActivePrimarySides() const
|
uint32_t Server::getActivePrimarySides() const
|
||||||
{
|
{
|
||||||
|
using enum DirectionMask;
|
||||||
uint32_t sides = 0;
|
uint32_t sides = 0;
|
||||||
if (!isLockedToScreenServer()) {
|
if (!isLockedToScreenServer()) {
|
||||||
if (hasAnyNeighbor(m_primaryClient, kLeft)) {
|
if (hasAnyNeighbor(m_primaryClient, kLeft)) {
|
||||||
sides |= kLeftMask;
|
sides |= static_cast<int>(LeftMask);
|
||||||
}
|
}
|
||||||
if (hasAnyNeighbor(m_primaryClient, kRight)) {
|
if (hasAnyNeighbor(m_primaryClient, kRight)) {
|
||||||
sides |= kRightMask;
|
sides |= static_cast<int>(RightMask);
|
||||||
}
|
}
|
||||||
if (hasAnyNeighbor(m_primaryClient, kTop)) {
|
if (hasAnyNeighbor(m_primaryClient, kTop)) {
|
||||||
sides |= kTopMask;
|
sides |= static_cast<int>(TopMask);
|
||||||
}
|
}
|
||||||
if (hasAnyNeighbor(m_primaryClient, kBottom)) {
|
if (hasAnyNeighbor(m_primaryClient, kBottom)) {
|
||||||
sides |= kBottomMask;
|
sides |= static_cast<int>(BottomMask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sides;
|
return sides;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue