diff --git a/src/comfortable_swipe/gesture/swipe_gesture.cpp b/src/comfortable_swipe/gesture/swipe_gesture.cpp
index f1f45c5..ca123db 100644
--- a/src/comfortable_swipe/gesture/swipe_gesture.cpp
+++ b/src/comfortable_swipe/gesture/swipe_gesture.cpp
@@ -1,8 +1,25 @@
#ifndef __COMFORTABLE_SWIPE__gesture_swipe_gesture__
#define __COMFORTABLE_SWIPE__gesture_swipe_gesture__
+/*
+Comfortable Swipe
+by Rico Tiongson
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
#include // std::cout, std::endl
-#include // std::abs
#include "../index.hpp"
extern "C"
@@ -72,7 +89,9 @@ namespace comfortable_swipe
if (this->fingers == 3) mask |= swipe_gesture::MSK_THREE_FINGERS;
else if (this->fingers == 4) mask |= swipe_gesture::MSK_FOUR_FINGERS;
- if (std::abs(x) > std::abs(y))
+ const float absx = x >= 0 ? x : -x;
+ const float absy = y >= 0 ? y : -y;
+ if (absx > absy)
{ // horizontal
mask |= swipe_gesture::MSK_HORIZONTAL;
if (x < 0)
diff --git a/src/comfortable_swipe/gesture/swipe_gesture.h b/src/comfortable_swipe/gesture/swipe_gesture.h
index 7ae66a4..394962d 100644
--- a/src/comfortable_swipe/gesture/swipe_gesture.h
+++ b/src/comfortable_swipe/gesture/swipe_gesture.h
@@ -1,8 +1,23 @@
#ifndef __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__
#define __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__
-#include
-#include
+/*
+Comfortable Swipe
+by Rico Tiongson
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
extern "C"
{
@@ -34,7 +49,7 @@ namespace comfortable_swipe
~swipe_gesture();
- // fields
+ // fields for xdo
int fingers;
float dx, dy, udx, udy;
xdo_t * xdo;
@@ -47,7 +62,7 @@ namespace comfortable_swipe
int previous_gesture;
const char ** commands;
- // methods
+ // hooks
void update();
void begin();
void end();
@@ -69,4 +84,4 @@ namespace comfortable_swipe
}
#endif
-#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ */
\ No newline at end of file
+#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ */
diff --git a/src/comfortable_swipe/index.cpp b/src/comfortable_swipe/index.cpp
index af16a54..b474877 100644
--- a/src/comfortable_swipe/index.cpp
+++ b/src/comfortable_swipe/index.cpp
@@ -1,3 +1,6 @@
+#ifndef __COMFORTABLE_SWIPE__
+#define __COMFORTABLE_SWIPE__
+
/*
Comfortable Swipe
by Rico Tiongson
@@ -16,9 +19,6 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef __COMFORTABLE_SWIPE__
-#define __COMFORTABLE_SWIPE__
-
// export all modules here
#include "gesture/swipe_gesture.cpp"
#include "service/autostart.cpp"
diff --git a/src/comfortable_swipe/index.hpp b/src/comfortable_swipe/index.hpp
index 2cf0602..e13262e 100644
--- a/src/comfortable_swipe/index.hpp
+++ b/src/comfortable_swipe/index.hpp
@@ -1,3 +1,6 @@
+#ifndef __COMFORTABLE_SWIPE__index_hpp__
+#define __COMFORTABLE_SWIPE__index_hpp__
+
/*
Comfortable Swipe
by Rico Tiongson
@@ -16,10 +19,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-#ifndef __COMFORTABLE_SWIPE__index_hpp__
-#define __COMFORTABLE_SWIPE__index_hpp__
-
-// global definitions
+// global defines
#ifndef __COMFORTABLE_SWIPE__PROGRAM__
#define __COMFORTABLE_SWIPE__PROGRAM__ "/usr/local/bin/comfortable-swipe"
#endif /* __COMFORTABLE_SWIPE__PROGRAM__ */
@@ -28,30 +28,24 @@ along with this program. If not, see .
#define __COMFORTABLE_SWIPE__CONFIG__ "/usr/local/share/comfortable-swipe/comfortable-swipe.conf"
#endif /* __COMFORTABLE_SWIPE__CONFIG__ */
+
#include