ktouchpadenabler: compiler warning fix

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-06-03 00:41:25 +03:00
parent 9b1959830c
commit e62863f60d

View file

@ -39,12 +39,12 @@ class TouchpadEnablerDaemonPrivate : public QWidget
TouchpadEnablerDaemonPrivate(); TouchpadEnablerDaemonPrivate();
~TouchpadEnablerDaemonPrivate(); ~TouchpadEnablerDaemonPrivate();
bool initSuccessful() const { return m_keyCode != 0; } bool initSuccessful() const;
bool x11Event(XEvent *event); bool x11Event(XEvent *event);
private: private:
enum TouchpadKey { ToggleKey = 0, OnKey, OffKey }; enum TouchpadKey { ToggleKey = 0, OnKey = 1, OffKey = 2 };
static const int nKeys = OffKey + 1; static const int nKeys = OffKey + 1;
bool getEnabled(bool *currentValue) const; bool getEnabled(bool *currentValue) const;
@ -144,6 +144,15 @@ TouchpadEnablerDaemonPrivate::~TouchpadEnablerDaemonPrivate()
} }
} }
bool TouchpadEnablerDaemonPrivate::initSuccessful() const {
for (int i = 0; i < nKeys; ++i) {
if (m_keyCode[i] == 0) {
return false;
}
}
return true;
}
bool TouchpadEnablerDaemonPrivate::x11Event(XEvent *event) bool TouchpadEnablerDaemonPrivate::x11Event(XEvent *event)
{ {
if (event->type == KeyPress) { if (event->type == KeyPress) {