refactor: replace anon Enum in XWindowsKeyState with static vars

This commit is contained in:
sithlord48 2025-07-08 14:19:40 -04:00 committed by Chris Rizzitello
parent 181d862838
commit e37cea2d6b
2 changed files with 7 additions and 10 deletions

View file

@ -71,17 +71,17 @@ void XWindowsKeyState::init(const Display *display, bool useXKB)
m_xkb = nullptr; m_xkb = nullptr;
} }
#endif #endif
setActiveGroup(kGroupPoll); setActiveGroup(s_groupPoll);
} }
void XWindowsKeyState::setActiveGroup(int32_t group) void XWindowsKeyState::setActiveGroup(int32_t group)
{ {
if (group == kGroupPollAndSet) { if (group == s_groupPollAndSet) {
// we need to set the group to -1 in order for pollActiveGroup() to // we need to set the group to -1 in order for pollActiveGroup() to
// actually poll for the group // actually poll for the group
m_group = -1; m_group = -1;
m_group = pollActiveGroup(); m_group = pollActiveGroup();
} else if (group == kGroupPoll) { } else if (group == s_groupPoll) {
m_group = -1; m_group = -1;
} else { } else {
assert(group >= 0); assert(group >= 0);

View file

@ -32,11 +32,8 @@ class XWindowsKeyState : public KeyState
{ {
public: public:
using KeycodeList = std::vector<int>; using KeycodeList = std::vector<int>;
enum inline static const auto s_groupPoll = -1;
{ inline static const auto s_groupPollAndSet = -2;
kGroupPoll = -1,
kGroupPollAndSet = -2
};
XWindowsKeyState(Display *, bool useXKB, IEventQueue *events); XWindowsKeyState(Display *, bool useXKB, IEventQueue *events);
XWindowsKeyState(Display *, bool useXKB, IEventQueue *events, deskflow::KeyMap &keyMap); XWindowsKeyState(Display *, bool useXKB, IEventQueue *events, deskflow::KeyMap &keyMap);
@ -48,9 +45,9 @@ public:
//! Set active group //! Set active group
/*! /*!
Sets the active group to \p group. This is the group returned by Sets the active group to \p group. This is the group returned by
\c pollActiveGroup(). If \p group is \c kGroupPoll then \c pollActiveGroup(). If \p group is \c s_groupPoll then
\c pollActiveGroup() will really poll, but that's a slow operation \c pollActiveGroup() will really poll, but that's a slow operation
on X11. If \p group is \c kGroupPollAndSet then this will poll the on X11. If \p group is \c s_groupPollAndSet then this will poll the
active group now and use it for future calls to \c pollActiveGroup(). active group now and use it for future calls to \c pollActiveGroup().
*/ */
void setActiveGroup(int32_t group); void setActiveGroup(int32_t group);