diff --git a/comfortable-swipe.cpp b/comfortable-swipe.cpp
index 1a79db1..b95eee2 100644
--- a/comfortable-swipe.cpp
+++ b/comfortable-swipe.cpp
@@ -16,10 +16,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
+#include "src/comfortable_swipe.cpp"
#include // std::ios
#include // std::cin, std::cout, std::cerr
#include // std::string
-#include "src/comfortable_swipe.cpp"
/* Command-line function. */
diff --git a/src/comfortable_swipe.cpp b/src/comfortable_swipe.cpp
index c93db77..cb62a58 100644
--- a/src/comfortable_swipe.cpp
+++ b/src/comfortable_swipe.cpp
@@ -39,9 +39,9 @@ along with this program. If not, see .
#include "service/start.cpp"
#include "service/status.cpp"
#include "service/stop.cpp"
+#include "start.cpp"
#include "util/autostart_filename.cpp"
#include "util/conf_filename.cpp"
#include "util/read_config_file.cpp"
-#include "start.cpp"
#endif /* __COMFORTABLE_SWIPE__ */
diff --git a/src/comfortable_swipe.h b/src/comfortable_swipe.h
index a5300ab..5314cb9 100644
--- a/src/comfortable_swipe.h
+++ b/src/comfortable_swipe.h
@@ -32,7 +32,7 @@ along with this program. If not, see .
#endif /* COMFORTABLE_SWIPE_PROGRAM */
#ifndef COMFORTABLE_SWIPE_CONFIG
-#define COMFORTABLE_SWIPE_CONFIG \
+#define COMFORTABLE_SWIPE_CONFIG \
"/usr/local/share/comfortable-swipe/comfortable-swipe.conf"
#endif /* COMFORTABLE_SWIPE_CONFIG */
diff --git a/src/gesture/keyboard_swipe_gesture.h b/src/gesture/keyboard_swipe_gesture.h
index 957077a..1048fe8 100644
--- a/src/gesture/keyboard_swipe_gesture.h
+++ b/src/gesture/keyboard_swipe_gesture.h
@@ -25,57 +25,52 @@ along with this program. If not, see .
extern "C" {
#endif
-namespace comfortable_swipe::gesture
-{
- class keyboard_swipe_gesture : public swipe_gesture
- {
- public:
- // constructor
- keyboard_swipe_gesture(
- const float threshold,
- const char* left3 /* 000 */,
- const char* left4 /* 001 */,
- const char* right3 /* 010 */,
- const char* right4 /* 011 */,
- const char* up3 /* 100 */,
- const char* up4 /* 101 */,
- const char* down3 /* 110 */,
- const char* down4 /* 111 */
- );
+namespace comfortable_swipe::gesture {
+class keyboard_swipe_gesture : public swipe_gesture {
+public:
+ // constructor
+ keyboard_swipe_gesture(const float threshold, const char *left3 /* 000 */,
+ const char *left4 /* 001 */,
+ const char *right3 /* 010 */,
+ const char *right4 /* 011 */,
+ const char *up3 /* 100 */, const char *up4 /* 101 */,
+ const char *down3 /* 110 */,
+ const char *down4 /* 111 */
+ );
- // destructor
- virtual ~keyboard_swipe_gesture();
+ // destructor
+ virtual ~keyboard_swipe_gesture();
- // hooks that we override
- virtual void begin() override;
- virtual void update() override;
- virtual void end() override;
+ // hooks that we override
+ virtual void begin() override;
+ virtual void update() override;
+ virtual void end() override;
- // override this when keyboard gesture is to be performed
- virtual void do_keyboard_gesture(int mask);
+ // override this when keyboard gesture is to be performed
+ virtual void do_keyboard_gesture(int mask);
- protected:
- // stores square of threshold so we can compute faster
- float threshold_squared;
+protected:
+ // stores square of threshold so we can compute faster
+ float threshold_squared;
- // stores previous gesture so we don't repeat action
- int previous_gesture;
+ // stores previous gesture so we don't repeat action
+ int previous_gesture;
- // stores all command strings for xdo to execute
- const char ** commands;
+ // stores all command strings for xdo to execute
+ const char **commands;
- public:
- // static enums we will use for gesture matching
- static const int FRESH;
- static const int MSK_THREE_FINGERS;
- static const int MSK_FOUR_FINGERS;
- static const int MSK_NEGATIVE;
- static const int MSK_POSITIVE;
- static const int MSK_HORIZONTAL;
- static const int MSK_VERTICAL;
- static const char * const command_map[8];
- };
-}
+public:
+ // static enums we will use for gesture matching
+ static const int FRESH;
+ static const int MSK_THREE_FINGERS;
+ static const int MSK_FOUR_FINGERS;
+ static const int MSK_NEGATIVE;
+ static const int MSK_POSITIVE;
+ static const int MSK_HORIZONTAL;
+ static const int MSK_VERTICAL;
+ static const char *const command_map[8];
+};
+} // namespace comfortable_swipe::gesture
#ifdef __cplusplus
}
diff --git a/src/gesture/mouse_hold_gesture.h b/src/gesture/mouse_hold_gesture.h
index a1d59c1..c92571a 100644
--- a/src/gesture/mouse_hold_gesture.h
+++ b/src/gesture/mouse_hold_gesture.h
@@ -25,44 +25,41 @@ along with this program. If not, see .
extern "C" {
#endif
-namespace comfortable_swipe::gesture
-{
- class mouse_hold_gesture : public swipe_gesture
- {
- public:
- // constructor
- mouse_hold_gesture(
- const char* hold3, // 3 finger mouse down
- const char* hold4 // 4 finger mouse down
- );
+namespace comfortable_swipe::gesture {
+class mouse_hold_gesture : public swipe_gesture {
+public:
+ // constructor
+ mouse_hold_gesture(const char *hold3, // 3 finger mouse down
+ const char *hold4 // 4 finger mouse down
+ );
- // the button being clicked
- int button;
+ // the button being clicked
+ int button;
- virtual ~mouse_hold_gesture();
+ virtual ~mouse_hold_gesture();
- // override begin and end for mousedown
- virtual void begin() override;
- virtual void update() override;
- virtual void end() override;
+ // override begin and end for mousedown
+ virtual void begin() override;
+ virtual void update() override;
+ virtual void end() override;
- // provide our own mouse functions
- virtual void do_mousedown(const char*);
- virtual void do_mouseup(const char*);
- virtual bool is_mousedown() const;
+ // provide our own mouse functions
+ virtual void do_mousedown(const char *);
+ virtual void do_mouseup(const char *);
+ virtual bool is_mousedown() const;
- // utility method to parse mouse input given config characters
- static int parse_mouse_button(const char*);
+ // utility method to parse mouse input given config characters
+ static int parse_mouse_button(const char *);
- protected:
- // command holders
- const char * hold3;
- const char * hold4;
+protected:
+ // command holders
+ const char *hold3;
+ const char *hold4;
- // flag we can use to check if mouse is down
- bool flag_mousedown;
- };
-}
+ // flag we can use to check if mouse is down
+ bool flag_mousedown;
+};
+} // namespace comfortable_swipe::gesture
#ifdef __cplusplus
}
diff --git a/src/gesture/swipe_gesture.h b/src/gesture/swipe_gesture.h
index 36a0744..5e90f08 100644
--- a/src/gesture/swipe_gesture.h
+++ b/src/gesture/swipe_gesture.h
@@ -25,46 +25,44 @@ along with this program. If not, see .
extern "C" {
#endif
-namespace comfortable_swipe::gesture
-{
- class swipe_gesture : public xdo_gesture
- {
- public:
- // constructor
- swipe_gesture();
+namespace comfortable_swipe::gesture {
+class swipe_gesture : public xdo_gesture {
+public:
+ // constructor
+ swipe_gesture();
- // destructor
- virtual ~swipe_gesture();
+ // destructor
+ virtual ~swipe_gesture();
- // fields for xdo
- int fingers;
+ // fields for xdo
+ int fingers;
- // normal values (for touchpad mapping)
- float x, y, dx, dy;
+ // normal values (for touchpad mapping)
+ float x, y, dx, dy;
- // unaccelerated values (for screen mapping)
- float ux, uy, udx, udy;
+ // unaccelerated values (for screen mapping)
+ float ux, uy, udx, udy;
- // hooks that we can override (mark as virtual)
- virtual void begin();
- virtual void update();
- virtual void end();
- virtual bool parse_line(const char *);
+ // hooks that we can override (mark as virtual)
+ virtual void begin();
+ virtual void update();
+ virtual void end();
+ virtual bool parse_line(const char *);
- protected:
- // location of mouse
- int screen_num, ix, iy;
+protected:
+ // location of mouse
+ int screen_num, ix, iy;
- // optimization flag for checking if GESTURE_SWIPE_BEGIN was dispatched
- bool flag_swiping;
+ // optimization flag for checking if GESTURE_SWIPE_BEGIN was dispatched
+ bool flag_swiping;
- public:
- // regex patterns
- static const char* GESTURE_BEGIN_REGEX_PATTERN;
- static const char* GESTURE_UPDATE_REGEX_PATTERN;
- static const char* GESTURE_END_REGEX_PATTERN;
- };
-}
+public:
+ // regex patterns
+ static const char *GESTURE_BEGIN_REGEX_PATTERN;
+ static const char *GESTURE_UPDATE_REGEX_PATTERN;
+ static const char *GESTURE_END_REGEX_PATTERN;
+};
+} // namespace comfortable_swipe::gesture
#ifdef __cplusplus
}
diff --git a/src/gesture/xdo_gesture.h b/src/gesture/xdo_gesture.h
index a6d5625..c8ff6d3 100644
--- a/src/gesture/xdo_gesture.h
+++ b/src/gesture/xdo_gesture.h
@@ -19,30 +19,26 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-extern "C"
-{
- #include // xdo_t
+extern "C" {
+#include // xdo_t
}
#ifdef __cplusplus
extern "C" {
#endif
-namespace comfortable_swipe
-{
- namespace gesture
- {
- class xdo_gesture
- {
- protected:
- xdo_t * xdo;
+namespace comfortable_swipe {
+namespace gesture {
+class xdo_gesture {
+protected:
+ xdo_t *xdo;
- public:
- xdo_gesture();
- virtual ~xdo_gesture();
- };
- }
-}
+public:
+ xdo_gesture();
+ virtual ~xdo_gesture();
+};
+} // namespace gesture
+} // namespace comfortable_swipe
#ifdef __cplusplus
}
diff --git a/src/start.cpp b/src/start.cpp
index 0eb9290..44756d3 100644
--- a/src/start.cpp
+++ b/src/start.cpp
@@ -45,31 +45,23 @@ void start() {
// hold3=button1 hold button 1 on 3 fingers
// hold4=button3 hold button 3 (right click) on 3 fingers
// hold3=ignore
- const char * const hold3 = config["hold3"].c_str();
- const char * const hold4 = config["hold4"].c_str();
+ const char *const hold3 = config["hold3"].c_str();
+ const char *const hold4 = config["hold4"].c_str();
comfortable_swipe::gesture::mouse_hold_gesture mouse_hold(hold3, hold4);
// initialize keyboard swipe gesture handler
- const float threshold = config.count("threshold") ? std::stof(config["threshold"]) : 0.0;
- const char * const left3 = config["left3"].c_str();
- const char * const left4 = config["left4"].c_str();
- const char * const right3 = config["right3"].c_str();
- const char * const right4 = config["right4"].c_str();
- const char * const up3 = config["up3"].c_str();
- const char * const up4 = config["up4"].c_str();
- const char * const down3 = config["down3"].c_str();
- const char * const down4 = config["down4"].c_str();
+ const float threshold =
+ config.count("threshold") ? std::stof(config["threshold"]) : 0.0;
+ const char *const left3 = config["left3"].c_str();
+ const char *const left4 = config["left4"].c_str();
+ const char *const right3 = config["right3"].c_str();
+ const char *const right4 = config["right4"].c_str();
+ const char *const up3 = config["up3"].c_str();
+ const char *const up4 = config["up4"].c_str();
+ const char *const down3 = config["down3"].c_str();
+ const char *const down4 = config["down4"].c_str();
comfortable_swipe::gesture::keyboard_swipe_gesture keyboard_swipe(
- threshold,
- left3,
- left4,
- right3,
- right4,
- up3,
- up4,
- down3,
- down4
- );
+ threshold, left3, left4, right3, right4, up3, up4, down3, down4);
// prepare data containers
std::array line;
diff --git a/src/start.h b/src/start.h
index f9c324e..eb18e65 100644
--- a/src/start.h
+++ b/src/start.h
@@ -2,7 +2,7 @@
#define __COMFORTABLE_SWIPE__start_h__
namespace comfortable_swipe {
- void start();
+void start();
}
#endif /* __COMFORTABLE_SWIPE__start_h__ */