Skip to content

Commit 62c173c

Browse files
committed
fit the code style
1 parent 4a0d4eb commit 62c173c

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/anbox/platform/sdl/platform.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,22 +296,23 @@ void Platform::process_input_event(const SDL_Event &event) {
296296
}
297297

298298
int Platform::find_touch_slot(int id){
299-
for(int i = 0; i < MAX_FINGERS; i++){
300-
if(touch_slots[i] == id)return i;
299+
for (int i = 0; i < MAX_FINGERS; i++) {
300+
if (touch_slots[i] == id)
301+
return i;
301302
}
302303
return -1;
303304
}
304305

305306
void Platform::push_slot(std::vector<input::Event> &touch_events, int slot){
306-
if(last_slot != slot){
307+
if (last_slot != slot) {
307308
touch_events.push_back({EV_ABS, ABS_MT_SLOT, slot});
308309
last_slot = slot;
309310
}
310311
}
311312

312313
void Platform::push_finger_down(int x, int y, int finger_id, std::vector<input::Event> &touch_events){
313314
int slot = find_touch_slot(-1);
314-
if(slot == -1){
315+
if (slot == -1) {
315316
DEBUG("no free slot!");
316317
return;
317318
}
@@ -325,7 +326,8 @@ void Platform::push_finger_down(int x, int y, int finger_id, std::vector<input::
325326

326327
void Platform::push_finger_up(int finger_id, std::vector<input::Event> &touch_events){
327328
int slot = find_touch_slot(finger_id);
328-
if(slot == -1)return;
329+
if (slot == -1)
330+
return;
329331
push_slot(touch_events, slot);
330332
touch_events.push_back({EV_ABS, ABS_MT_TRACKING_ID, -1});
331333
touch_events.push_back({EV_SYN, SYN_REPORT, 0});
@@ -334,7 +336,8 @@ void Platform::push_finger_up(int finger_id, std::vector<input::Event> &touch_ev
334336

335337
void Platform::push_finger_motion(int x, int y, int finger_id, std::vector<input::Event> &touch_events){
336338
int slot = find_touch_slot(finger_id);
337-
if(slot == -1)return;
339+
if (slot == -1)
340+
return;
338341
push_slot(touch_events, slot);
339342
touch_events.push_back({EV_ABS, ABS_MT_POSITION_X, x});
340343
touch_events.push_back({EV_ABS, ABS_MT_POSITION_Y, y});

src/anbox/platform/sdl/platform.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,11 @@ class Platform : public std::enable_shared_from_this<Platform>,
9999
std::uint32_t focused_sdl_window_id_ = 0;
100100
Configuration config_;
101101

102-
enum{MAX_FINGERS = 10};
103-
enum{MAX_TRACKING_ID = 10};
102+
static const int MAX_FINGERS = 10;
103+
static const int MAX_TRACKING_ID = 10;
104104
int touch_slots[MAX_FINGERS];
105105
int last_slot = -1;
106+
106107
int find_touch_slot(int id);
107108
void push_slot(std::vector<input::Event> &touch_events, int slot);
108109
void push_finger_down(int x, int y, int finger_id, std::vector<input::Event> &touch_events);

0 commit comments

Comments
 (0)