Skip to content

Commit 2e3ebd6

Browse files
committed
lint errors
1 parent a02513e commit 2e3ebd6

File tree

9 files changed

+121
-125
lines changed

9 files changed

+121
-125
lines changed

src/wayland/input_method/c_helpers.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <qdebug.h>
88
#include <qlogging.h>
99
#include <sys/mman.h>
10-
#include <sys/shm.h>
1110
#include <unistd.h>
1211

1312
namespace qs::wayland::input_method::impl {
@@ -19,8 +18,7 @@ void FreeDeleter::operator()(const char* p) const {
1918
SharedMemory::SharedMemory(const char* shmName, int oFlag, size_t size)
2019
: mShmName(shmName)
2120
, mSize(size)
22-
, fd(shm_open(this->mShmName, oFlag, 0))
23-
, map(nullptr) {
21+
, fd(shm_open(this->mShmName, oFlag, 0)) {
2422
if (this->fd == -1) {
2523
perror("");
2624
qDebug() << "Virtual keyboard failed to open shared memory";

src/wayland/input_method/input_method.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "input_method.hpp"
2-
#include <cstddef>
2+
#include <cstdint>
33

44
#include <qdebug.h>
55
#include <qlogging.h>
@@ -12,6 +12,7 @@
1212

1313
#include "keyboard_grab.hpp"
1414
#include "manager.hpp"
15+
#include "types.hpp"
1516

1617
namespace qs::wayland::input_method::impl {
1718

@@ -64,12 +65,8 @@ uint32_t InputMethodHandle::surroundingTextAnchor() const {
6465
return this->mState.surroundingText.anchor;
6566
}
6667

67-
ContentHint InputMethodHandle::contentHint() const {
68-
return this->mState.contentHint;
69-
}
70-
ContentPurpose InputMethodHandle::contentPurpose() const {
71-
return this->mState.contentPurpose;
72-
}
68+
ContentHint InputMethodHandle::contentHint() const { return this->mState.contentHint; }
69+
ContentPurpose InputMethodHandle::contentPurpose() const { return this->mState.contentPurpose; }
7370

7471
void InputMethodHandle::zwp_input_method_v2_activate() { this->mNewState.activated = true; }
7572

@@ -95,19 +92,16 @@ void InputMethodHandle::zwp_input_method_v2_content_type(uint32_t hint, uint32_t
9592
};
9693

9794
void InputMethodHandle::zwp_input_method_v2_done() {
98-
auto oldState= mState;
95+
auto oldState = mState;
9996
this->mState = this->mNewState;
10097

101-
10298
if (this->mState.activated != oldState.activated) {
10399
if (this->mNewState.activated) emit activated();
104100
else emit deactivated();
105101
}
106102

107103
if (this->mState.surroundingText != oldState.surroundingText) {
108-
emit surroundingTextChanged(
109-
this->mNewState.surroundingText.textChangeCause
110-
);
104+
emit surroundingTextChanged(this->mNewState.surroundingText.textChangeCause);
111105
}
112106

113107
if (this->mState.contentHint != oldState.contentHint) {

src/wayland/input_method/input_method.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#pragma once
22

3+
#include <cstdint>
34
#include <qobject.h>
45
#include <qpointer.h>
56
#include <qtclasshelpermacros.h>
@@ -70,12 +71,12 @@ class InputMethodHandle
7071
QString text = "";
7172
uint32_t cursor = 0;
7273
uint32_t anchor = 0;
73-
TextChangeCause textChangeCause = TextChangeCause::INPUT_METHOD;
74+
TextChangeCause textChangeCause = TextChangeCause::InputMethod;
7475
bool operator==(const SurroundingText& other) const = default;
7576
} surroundingText;
7677

77-
ContentHint contentHint = ContentHint::NONE;
78-
ContentPurpose contentPurpose = ContentPurpose::NORMAL;
78+
ContentHint contentHint = ContentHint::None;
79+
ContentPurpose contentPurpose = ContentPurpose::Normal;
7980
};
8081

8182
State mState;

src/wayland/input_method/keyboard_grab.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#include "keyboard_grab.hpp"
22
#include <cassert>
3-
#include <cstddef>
3+
#include <cstdint>
44
#include <vector>
55

6+
#if INPUT_METHOD_PRINT
67
#include <qdebug.h>
8+
#endif
79
#include <qobject.h>
810
#include <qtmetamacros.h>
911
#include <qwayland-input-method-unstable-v2.h>
@@ -114,7 +116,7 @@ void InputMethodKeyboardGrab::zwp_input_method_keyboard_grab_v2_key(
114116
}
115117

116118
if (state == WL_KEYBOARD_KEY_STATE_PRESSED) {
117-
bool keyHandled = handleKey(key);
119+
const bool keyHandled = handleKey(key);
118120
if (keyHandled){
119121
if (this->mKeyMapState.keyRepeats(key) && this->mRepeatRate > 0) {
120122
this->mRepeatKey = key;
@@ -135,19 +137,19 @@ void InputMethodKeyboardGrab::zwp_input_method_keyboard_grab_v2_key(
135137
bool InputMethodKeyboardGrab::handleKey(xkb_keycode_t key){
136138
const xkb_keysym_t sym = this->mKeyMapState.getOneSym(key);
137139
if (sym == XKB_KEY_Up) {
138-
emit directionPress(DirectionKey::UP);
140+
emit directionPress(DirectionKey::Up);
139141
return true;
140142
}
141143
if (sym == XKB_KEY_Down) {
142-
emit directionPress(DirectionKey::DOWN);
144+
emit directionPress(DirectionKey::Down);
143145
return true;
144146
}
145147
if (sym == XKB_KEY_Left) {
146-
emit directionPress(DirectionKey::LEFT);
148+
emit directionPress(DirectionKey::Left);
147149
return true;
148150
}
149151
if (sym == XKB_KEY_Right) {
150-
emit directionPress(DirectionKey::RIGHT);
152+
emit directionPress(DirectionKey::Right);
151153
return true;
152154
}
153155
if (sym == XKB_KEY_BackSpace) {

src/wayland/input_method/qml.cpp

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#include "qml.hpp"
22
#include <cassert>
3-
#include <cstddef>
43
#include <utility>
54

65
#include <qlogging.h>
@@ -9,6 +8,7 @@
98
#include <qqmlengine.h>
109
#include <qqmlinfo.h>
1110
#include <qstring.h>
11+
#include <qtmetamacros.h>
1212

1313
#include "input_method.hpp"
1414
#include "keyboard_grab.hpp"
@@ -78,22 +78,22 @@ void InputMethod::getInput() {
7878
&InputMethod::onHandleActiveChanged
7979
);
8080
QObject::connect(
81-
this->handle.get(),
82-
&InputMethodHandle::contentHintChanged,
83-
this,
84-
&InputMethod::contentHintChanged
81+
this->handle.get(),
82+
&InputMethodHandle::contentHintChanged,
83+
this,
84+
&InputMethod::contentHintChanged
8585
);
8686
QObject::connect(
87-
this->handle.get(),
88-
&InputMethodHandle::contentPurposeChanged,
89-
this,
90-
&InputMethod::contentPurposeChanged
87+
this->handle.get(),
88+
&InputMethodHandle::contentPurposeChanged,
89+
this,
90+
&InputMethod::contentPurposeChanged
9191
);
9292
QObject::connect(
93-
this->handle.get(),
94-
&InputMethodHandle::surroundingTextChanged,
95-
this,
96-
&InputMethod::surroundingTextChanged
93+
this->handle.get(),
94+
&InputMethodHandle::surroundingTextChanged,
95+
this,
96+
&InputMethod::surroundingTextChanged
9797
);
9898

9999
emit hasInputChanged();
@@ -154,19 +154,11 @@ void InputMethod::handleKeyboardActive() {
154154
}
155155
}
156156

157-
const QString& InputMethod::surroundingText() const {
158-
return handle->surroundingText();
159-
}
160-
uint32_t InputMethod::surroundingTextCursor() const {
161-
return handle->surroundingTextCursor();
162-
}
163-
uint32_t InputMethod::surroundingTextAnchor() const {
164-
return handle->surroundingTextAnchor();
165-
}
157+
const QString& InputMethod::surroundingText() const { return handle->surroundingText(); }
158+
uint32_t InputMethod::surroundingTextCursor() const { return handle->surroundingTextCursor(); }
159+
uint32_t InputMethod::surroundingTextAnchor() const { return handle->surroundingTextAnchor(); }
166160

167-
QMLContentHint::Enum InputMethod::contentHint() const {
168-
return this->handle->contentHint();
169-
}
161+
QMLContentHint::Enum InputMethod::contentHint() const { return this->handle->contentHint(); }
170162
QMLContentPurpose::Enum InputMethod::contentPurpose() const {
171163
return this->handle->contentPurpose();
172164
}

src/wayland/input_method/qml_helpers.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
#include "qml_helpers.hpp"
2+
#include <algorithm>
23

34
#include <qjsvalue.h>
45
#include <qobject.h>
56
#include <qqmlinfo.h>
7+
#include <qtmetamacros.h>
68

79
#include "qml.hpp"
10+
#include "types.hpp"
811

912
namespace qs::wayland::input_method {
1013

@@ -17,7 +20,12 @@ KeyboardTextEdit::KeyboardTextEdit(QObject* parent): Keyboard(parent) {
1720

1821
auto* inputMethod = dynamic_cast<InputMethod*>(parent);
1922
if (inputMethod)
20-
QObject::connect(inputMethod, &InputMethod::surroundingTextChanged, this, &KeyboardTextEdit::onSurroundingTextChanged);
23+
QObject::connect(
24+
inputMethod,
25+
&InputMethod::surroundingTextChanged,
26+
this,
27+
&KeyboardTextEdit::onSurroundingTextChanged
28+
);
2129
}
2230

2331
QJSValue KeyboardTextEdit::transform() const { return this->mTransform; }
@@ -78,11 +86,11 @@ void KeyboardTextEdit::onDeletePress() {
7886

7987
void KeyboardTextEdit::onDirectionPress(QMLDirectionKey::Enum direction) {
8088
switch (direction) {
81-
case QMLDirectionKey::LEFT: {
89+
case QMLDirectionKey::Left: {
8290
this->setCursor(this->mCursor - 1);
8391
return;
8492
}
85-
case QMLDirectionKey::RIGHT: {
93+
case QMLDirectionKey::Right: {
8694
this->setCursor(this->mCursor + 1);
8795
return;
8896
}
@@ -102,7 +110,7 @@ void KeyboardTextEdit::onReturnPress() {
102110
}
103111

104112
void KeyboardTextEdit::onSurroundingTextChanged(QMLTextChangeCause::Enum textChangeCause) {
105-
if (textChangeCause == QMLTextChangeCause::OTHER) {
113+
if (textChangeCause == QMLTextChangeCause::Other) {
106114
this->setEditText("");
107115
}
108116
}

0 commit comments

Comments
 (0)