Skip to content

Commit 4a12c08

Browse files
committed
clang-format project
Destroying the git history in favour of humouring my OCD? Yes please.
1 parent dfc97ca commit 4a12c08

11 files changed

+514
-543
lines changed

Diff for: .clang-format

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
BasedOnStyle: Google
3+
AlignAfterOpenBracket: Align
4+
AlignConsecutiveAssignments: 'true'
5+
AlignConsecutiveDeclarations: 'true'
6+
AlignOperands: 'true'
7+
AllowAllParametersOfDeclarationOnNextLine: 'false'
8+
AllowShortCaseLabelsOnASingleLine: 'false'
9+
AllowShortFunctionsOnASingleLine: Empty
10+
AllowShortLoopsOnASingleLine: 'false'
11+
AlwaysBreakAfterDefinitionReturnType: None
12+
AlwaysBreakAfterReturnType: None
13+
AlwaysBreakBeforeMultilineStrings: 'false'
14+
BinPackArguments: 'true'
15+
BinPackParameters: 'true'
16+
ColumnLimit: '90'
17+
IndentCaseLabels: 'true'
18+
IndentPPDirectives: AfterHash
19+
IndentWidth: '2'
20+
MaxEmptyLinesToKeep: '1'
21+
PointerAlignment: Right
22+
SortIncludes: 'false'
23+
SpaceBeforeAssignmentOperators: 'true'
24+
SpaceBeforeParens: ControlStatements
25+
SpaceInEmptyParentheses: 'false'
26+
SpacesBeforeTrailingComments: 1
27+
TabWidth: '2'
28+
UseTab: Never
29+
30+
...

Diff for: headers/configuration.h

+15-18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef CONFIGURATION_H
22
#define CONFIGURATION_H
33

4-
54
struct configuration {
65
int click1Effect;
76
int click2Effect;
@@ -15,8 +14,6 @@ struct configuration {
1514
int hold5Effect;
1615
} configuration;
1716

18-
19-
2017
#define NUM_TRIGGERS 11
2118
//triggers:
2219
#define TRIGGER_CLICK_1 1
@@ -30,23 +27,23 @@ struct configuration {
3027
#define TRIGGER_HOLD_4 9
3128
#define TRIGGER_HOLD_5 10
3229

33-
//recognized words in configuration file.
34-
static const char* triggers[NUM_TRIGGERS] = {
35-
"", //for alignment 0
36-
"click", //TRIGGER_CLICK_1 1
37-
"double-click", //TRIGGER_CLICK_2 2
38-
"triple-click", //TRIGGER_CLICK_3 3
39-
"quadruple-click", //TRIGGER_CLICK_4 4
40-
"quintuple-click", //TRIGGER_CLICK_5 5
41-
"press&hold", //TRIGGER_PRESS_1 6
42-
"double-press&hold", //TRIGGER_PRESS_2 7
43-
"triple-press&hold", //TRIGGER_PRESS_3 8
44-
"quadruple-press&hold", //TRIGGER_PRESS_4 9
45-
"quintuple-press&hold", //TRIGGER_PRESS_5 10
30+
// Recognized words in configuration file.
31+
static const char *triggers[NUM_TRIGGERS] = {
32+
"", // for alignment 0
33+
"click", // TRIGGER_CLICK_1 1
34+
"double-click", // TRIGGER_CLICK_2 2
35+
"triple-click", // TRIGGER_CLICK_3 3
36+
"quadruple-click", // TRIGGER_CLICK_4 4
37+
"quintuple-click", // TRIGGER_CLICK_5 5
38+
"press&hold", // TRIGGER_PRESS_1 6
39+
"double-press&hold", // TRIGGER_PRESS_2 7
40+
"triple-press&hold", // TRIGGER_PRESS_3 8
41+
"quadruple-press&hold", // TRIGGER_PRESS_4 9
42+
"quintuple-press&hold", // TRIGGER_PRESS_5 10
4643
};
4744

45+
int getTriggerConfig(const char *path, struct configuration *config);
4846

49-
int getTriggerConfig(const char *path, struct configuration* config);
50-
void printConfig(struct configuration* config);
47+
void printConfig(struct configuration *config);
5148

5249
#endif

Diff for: headers/effects.h

100755100644
+5-7
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,25 @@
77
#include "effects_data.h"
88
#include "orientation.h"
99

10-
1110
//static const struct input_event tool_touch_off = {.type = EV_KEY, .code = BTN_TOUCH, .value = 0}; //these might be used in the future to improve press and hold mode
1211
static const struct input_event tool_pen_on = {.type = EV_KEY, .code = BTN_TOOL_PEN, .value = 1}; //used when pen approaches the screen
1312
static const struct input_event tool_pen_off = {.type = EV_KEY, .code = BTN_TOOL_PEN, .value = 0};
1413
static const struct input_event tool_rubber_on = {.type = EV_KEY, .code = BTN_TOOL_RUBBER, .value = 1}; // used when rubber approaches the screen
1514
static const struct input_event tool_rubber_off = {.type = EV_KEY, .code = BTN_TOOL_RUBBER, .value = 0};
1615

17-
const char* effectStringFromInt(int effect);
16+
const char *effectStringFromInt(int effect);
1817

1918
void writeEvent(int fd_touch, struct input_event event);
20-
void handleCurrentTrackingID(struct input_event* event);
19+
void handleCurrentTrackingID(struct input_event *event);
2120
void writeTapWithTouch(int fd_touch, const int location[2]);
2221
void writeTapWithPen(int fd_touch, const int location[2]);
23-
int writeOrientedTapSequence(int device, int fd_touch, toolbarOrientation* orientation, int RMversion, int numLocations, ...);
24-
25-
22+
int writeOrientedTapSequence(int device, int fd_touch, toolbarOrientation *orientation,
23+
int RMversion, int numLocations, ...);
2624

2725
void activateToolEraserRM2(int fd_pen);
2826
void deactivateToolEraserRM2(int fd_pen);
2927
void toggleToolEraserRM2(int fd_pen);
30-
void actionToolEraserRM2(struct input_event* ev_pen, int fd_pen);
28+
void actionToolEraserRM2(struct input_event *ev_pen, int fd_pen);
3129

3230
void activateToolEraserSelect(int fd_touch);
3331
void deactivateToolEraserSelect(int fd_touch);

Diff for: headers/effects_data.h

100755100644
+1-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#define NOTEBOOK 0
99
#define PDF 1
1010

11-
1211
#define NUM_EFFECTS 11
1312
//[EFFECT]:
1413
#define NULL_EFFECT 0 //null effect
@@ -37,7 +36,7 @@
3736
#define SELECT_TOGGLE (SELECT + TOGGLE_OFFSET)
3837

3938
//recognized words in config file
40-
static const char* effects[NUM_EFFECTS] = {
39+
static const char* effects[NUM()_EFFECTS] = {
4140
"null-effect", //null effect 0
4241
"toolbar", //TOOLBAR 1
4342
"writing", //WRITING 2
@@ -104,5 +103,4 @@ static const int locationLookupWacom[NUM_EFFECTS][4][2] = {
104103
{ { 12220, W_RM2_RHY}, { W_RM2_RHX, 8880}, { 12300, W_RM2_LHY}, { W_RM2_LHX, 8780} }, //REDO 7
105104
};
106105

107-
108106
#endif //EFFECTS_DATA_H

Diff for: headers/orientation.h

100755100644
+12-9
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,27 @@
22
#define ORIENTATION_H
33

44
#define BUFSIZE 48
5-
#define RHP 0 // Right Hand, Portrait
6-
#define RHL 1 // Right Hand, Landscape
7-
#define LHP 2 // Left Hand, Portrait
8-
#define LHL 3 // Left Hand, Landscape
9-
5+
#define RHP 0 // Right Hand, Portrait
6+
#define RHL 1 // Right Hand, Landscape
7+
#define LHP 2 // Left Hand, Portrait
8+
#define LHL 3 // Left Hand, Landscape
109

1110
typedef struct {
1211
int openNotebook;
1312
int orientation;
1413
int docType;
1514
} toolbarOrientation;
1615

17-
int getOpenFileUUID(char* UUID);
16+
int getOpenFileUUID(char *UUID);
17+
1818
int checkConf(const char *path, const char *param, const char *paramTrue);
19-
int getConf(const char *path, const char *param, char* returnString, int bufferSize);
19+
20+
int getConf(const char *path, const char *param, char *returnString, int bufferSize);
21+
2022
toolbarOrientation getToolbarOrientation();
23+
2124
int getRmVersion();
22-
int getSoftwareVersion();
2325

26+
int getSoftwareVersion();
2427

25-
#endif //ORIENTATION_H
28+
#endif // ORIENTATION_H

Diff for: headers/triggers.h

+32-30
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,46 @@
11
#ifndef TRIGGERS_H
22
#define TRIGGERS_H
33

4-
#include <stdbool.h>
54
#include <linux/input.h>
5+
#include <stdbool.h>
66

7-
8-
//triggers:
9-
//Click || Press&Hold
10-
//Double Click || DoublePress&Hold
11-
//Triple Click || TripleClick&Hold
12-
//Bit 7 encodes trigger on or off
13-
//Bit 6 encodes Click or Press and hold
14-
//Bits 4-5 unused
15-
//Bits 0-3 encodes the number as an int ie. (click=1, double click=2, press and hold=1, double press and hold=2)
16-
#define NULL_TRIGGER 0x00
17-
18-
#define CLICK_1 0x81
19-
#define CLICK_2 0x82
20-
#define CLICK_3 0x83
21-
#define CLICK_4 0x84
22-
#define CLICK_5 0x85
23-
24-
#define HOLD_1_ON 0xc1
25-
#define HOLD_2_ON 0xc2
26-
#define HOLD_3_ON 0xc3
27-
#define HOLD_4_ON 0xc4
28-
#define HOLD_5_ON 0xc5
29-
30-
#define HOLD_1_OFF 0x41
31-
#define HOLD_2_OFF 0x42
32-
#define HOLD_3_OFF 0x43
33-
#define HOLD_4_OFF 0x44
34-
#define HOLD_5_OFF 0x45
7+
// Triggers:
8+
//
9+
// Click || Press&Hold
10+
// Double Click || DoublePress&Hold
11+
// Triple Click || TripleClick&Hold
12+
// Bit 7 encodes trigger on or off
13+
// Bit 6 encodes Click or Press and hold
14+
// Bits 4-5 unused
15+
// Bits 0-3 encodes the number as an int; i.e.,
16+
// (click=1, double click=2, press and hold=1, double press and hold=2)
17+
18+
#define NULL_TRIGGER 0x00
19+
20+
#define CLICK_1 0x81
21+
#define CLICK_2 0x82
22+
#define CLICK_3 0x83
23+
#define CLICK_4 0x84
24+
#define CLICK_5 0x85
25+
26+
#define HOLD_1_ON 0xc1
27+
#define HOLD_2_ON 0xc2
28+
#define HOLD_3_ON 0xc3
29+
#define HOLD_4_ON 0xc4
30+
#define HOLD_5_ON 0xc5
31+
32+
#define HOLD_1_OFF 0x41
33+
#define HOLD_2_OFF 0x42
34+
#define HOLD_3_OFF 0x43
35+
#define HOLD_4_OFF 0x44
36+
#define HOLD_5_OFF 0x45
3537

3638

3739
#define MAX_CLICK_TIME 0.2 //seconds
3840
#define MAX_DOUBLE_CLICK_TIME 0.4 //seconds
3941

42+
int getTrigger(struct input_event *ev_pen);
4043

41-
int getTrigger(struct input_event* ev_pen);
4244
void printTriggers(int trigger, bool includeNull);
4345

4446
#endif // TRIGGERS_H

0 commit comments

Comments
 (0)