Add licenses in headers

This commit is contained in:
Rico Tiongson 2019-02-07 17:11:03 +08:00
parent 8e75bc4c1c
commit 5e0584de76
14 changed files with 238 additions and 30 deletions

View File

@ -1,8 +1,25 @@
#ifndef __COMFORTABLE_SWIPE__gesture_swipe_gesture__ #ifndef __COMFORTABLE_SWIPE__gesture_swipe_gesture__
#define __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 <http://www.gnu.org/licenses/>.
*/
#include <iostream> // std::cout, std::endl #include <iostream> // std::cout, std::endl
#include <cmath> // std::abs
#include "../index.hpp" #include "../index.hpp"
extern "C" extern "C"
@ -72,7 +89,9 @@ namespace comfortable_swipe
if (this->fingers == 3) mask |= swipe_gesture::MSK_THREE_FINGERS; if (this->fingers == 3) mask |= swipe_gesture::MSK_THREE_FINGERS;
else if (this->fingers == 4) mask |= swipe_gesture::MSK_FOUR_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 { // horizontal
mask |= swipe_gesture::MSK_HORIZONTAL; mask |= swipe_gesture::MSK_HORIZONTAL;
if (x < 0) if (x < 0)

View File

@ -1,8 +1,23 @@
#ifndef __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ #ifndef __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__
#define __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ #define __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__
#include <cstdio> /*
#include <regex> 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 <http://www.gnu.org/licenses/>.
*/
extern "C" extern "C"
{ {
@ -34,7 +49,7 @@ namespace comfortable_swipe
~swipe_gesture(); ~swipe_gesture();
// fields // fields for xdo
int fingers; int fingers;
float dx, dy, udx, udy; float dx, dy, udx, udy;
xdo_t * xdo; xdo_t * xdo;
@ -47,7 +62,7 @@ namespace comfortable_swipe
int previous_gesture; int previous_gesture;
const char ** commands; const char ** commands;
// methods // hooks
void update(); void update();
void begin(); void begin();
void end(); void end();
@ -69,4 +84,4 @@ namespace comfortable_swipe
} }
#endif #endif
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ */ #endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ */

View File

@ -1,3 +1,6 @@
#ifndef __COMFORTABLE_SWIPE__
#define __COMFORTABLE_SWIPE__
/* /*
Comfortable Swipe Comfortable Swipe
by Rico Tiongson 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 <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __COMFORTABLE_SWIPE__
#define __COMFORTABLE_SWIPE__
// export all modules here // export all modules here
#include "gesture/swipe_gesture.cpp" #include "gesture/swipe_gesture.cpp"
#include "service/autostart.cpp" #include "service/autostart.cpp"

View File

@ -1,3 +1,6 @@
#ifndef __COMFORTABLE_SWIPE__index_hpp__
#define __COMFORTABLE_SWIPE__index_hpp__
/* /*
Comfortable Swipe Comfortable Swipe
by Rico Tiongson 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 <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef __COMFORTABLE_SWIPE__index_hpp__ // global defines
#define __COMFORTABLE_SWIPE__index_hpp__
// global definitions
#ifndef __COMFORTABLE_SWIPE__PROGRAM__ #ifndef __COMFORTABLE_SWIPE__PROGRAM__
#define __COMFORTABLE_SWIPE__PROGRAM__ "/usr/local/bin/comfortable-swipe" #define __COMFORTABLE_SWIPE__PROGRAM__ "/usr/local/bin/comfortable-swipe"
#endif /* __COMFORTABLE_SWIPE__PROGRAM__ */ #endif /* __COMFORTABLE_SWIPE__PROGRAM__ */
@ -28,30 +28,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define __COMFORTABLE_SWIPE__CONFIG__ "/usr/local/share/comfortable-swipe/comfortable-swipe.conf" #define __COMFORTABLE_SWIPE__CONFIG__ "/usr/local/share/comfortable-swipe/comfortable-swipe.conf"
#endif /* __COMFORTABLE_SWIPE__CONFIG__ */ #endif /* __COMFORTABLE_SWIPE__CONFIG__ */
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include "gesture/swipe_gesture.h" #include "gesture/swipe_gesture.h"
// other program header files // other program header files
extern "C"
#ifdef __cplusplus
// allow function overloading
extern "C" {
#endif
namespace comfortable_swipe
{ {
namespace util namespace comfortable_swipe::util
{ {
extern const char* GESTURE_SWIPE_BEGIN_REGEX_PATTERN; extern const char* GESTURE_SWIPE_BEGIN_REGEX_PATTERN;
extern const char* GESTURE_SWIPE_UPDATE_REGEX_PATTERN; extern const char* GESTURE_SWIPE_UPDATE_REGEX_PATTERN;
extern const char* GESTURE_SWIPE_END_REGEX_PATTERN; extern const char* GESTURE_SWIPE_END_REGEX_PATTERN;
std::map<std::string, std::string> read_config_file(const char*);
const char* autostart_filename(); const char* autostart_filename();
constexpr const char* conf_filename(); constexpr const char* conf_filename();
std::map<std::string, std::string> read_config_file(const char*);
} }
namespace comfortable_swipe::service
namespace service
{ {
void autostart(); void autostart();
void buffer(); void buffer();
@ -62,8 +56,4 @@ namespace comfortable_swipe
} }
} }
#ifdef __cplusplus #endif /* __COMFORTABLE_SWIPE__index_hpp__ */
}
#endif
#endif /* __COMFORTABLE_SWIPE__index_hpp__ */

View File

@ -1,6 +1,24 @@
#ifndef __COMFORTABLE_SWIPE__service_autostart__ #ifndef __COMFORTABLE_SWIPE__service_autostart__
#define __COMFORTABLE_SWIPE__service_autostart__ #define __COMFORTABLE_SWIPE__service_autostart__
/*
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 <http://www.gnu.org/licenses/>.
*/
#include <iostream> // std::cerr, std::cout, std::endl #include <iostream> // std::cerr, std::cout, std::endl
#include <fstream> // std::ifstream, std::ofstream #include <fstream> // std::ifstream, std::ofstream
#include <string> // std::string #include <string> // std::string

View File

@ -1,6 +1,24 @@
#ifndef __COMFORTABLE_SWIPE__service_buffer__ #ifndef __COMFORTABLE_SWIPE__service_buffer__
#define __COMFORTABLE_SWIPE__service_buffer__ #define __COMFORTABLE_SWIPE__service_buffer__
/*
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 <http://www.gnu.org/licenses/>.
*/
#include <string> // std::stoi, std::stof #include <string> // std::stoi, std::stof
#include <cstdio> // std::fgets_unlocked, stdin #include <cstdio> // std::fgets_unlocked, stdin
#include <regex> // std::regex, std::regex_match, std::cmatch #include <regex> // std::regex, std::regex_match, std::cmatch

View File

@ -1,6 +1,24 @@
#ifndef __COMFORTABLE_SWIPE__service_help__ #ifndef __COMFORTABLE_SWIPE__service_help__
#define __COMFORTABLE_SWIPE__service_help__ #define __COMFORTABLE_SWIPE__service_help__
/*
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 <http://www.gnu.org/licenses/>.
*/
#include <cstdio> // std::puts, std::printf #include <cstdio> // std::puts, std::printf
#include "../index.hpp" #include "../index.hpp"

View File

@ -1,6 +1,24 @@
#ifndef __COMFORTABLE_SWIPE__service_restart__ #ifndef __COMFORTABLE_SWIPE__service_restart__
#define __COMFORTABLE_SWIPE__service_restart__ #define __COMFORTABLE_SWIPE__service_restart__
/*
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 <http://www.gnu.org/licenses/>.
*/
#include "../index.hpp" #include "../index.hpp"
namespace comfortable_swipe::service namespace comfortable_swipe::service

View File

@ -1,6 +1,24 @@
#ifndef __COMFORTABLE_SWIPE__service_start__ #ifndef __COMFORTABLE_SWIPE__service_start__
#define __COMFORTABLE_SWIPE__service_start__ #define __COMFORTABLE_SWIPE__service_start__
/*
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 <http://www.gnu.org/licenses/>.
*/
#include "../index.hpp" #include "../index.hpp"
#include <cstdlib> // std::system #include <cstdlib> // std::system

View File

@ -4,6 +4,24 @@
#include <cstdio> // std::FILE, std::feof, std::fgets #include <cstdio> // std::FILE, std::feof, std::fgets
#include <cstdlib> // std::atoi, std::system #include <cstdlib> // std::atoi, std::system
#include <string> // std::string, std::to_string #include <string> // std::string, std::to_string
/*
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 <http://www.gnu.org/licenses/>.
*/
#include <stdexcept> // std::runtime_error #include <stdexcept> // std::runtime_error
#include <unistd.h> // popen, pclose, getpid #include <unistd.h> // popen, pclose, getpid

View File

@ -1,6 +1,24 @@
#ifndef __COMFORTABLE_SWIPE__util_autostart_filename__ #ifndef __COMFORTABLE_SWIPE__util_autostart_filename__
#define __COMFORTABLE_SWIPE__util_autostart_filename__ #define __COMFORTABLE_SWIPE__util_autostart_filename__
/*
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 <http://www.gnu.org/licenses/>.
*/
#include <string> // std::string #include <string> // std::string
#include <unistd.h> // getenv #include <unistd.h> // getenv

View File

@ -1,6 +1,24 @@
#ifndef __COMFORTABLE_SWIPE__util_conf_filename__ #ifndef __COMFORTABLE_SWIPE__util_conf_filename__
#define __COMFORTABLE_SWIPE__util_conf_filename__ #define __COMFORTABLE_SWIPE__util_conf_filename__
/*
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 <http://www.gnu.org/licenses/>.
*/
#include "../index.hpp" #include "../index.hpp"
namespace comfortable_swipe::util namespace comfortable_swipe::util

View File

@ -1,3 +1,24 @@
#ifndef __COMFORTABLE_SWIPE__util_read_config_file__
#define __COMFORTABLE_SWIPE__util_read_config_file__
/*
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 <http://www.gnu.org/licenses/>.
*/
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
#include <fstream> // std::ifstream #include <fstream> // std::ifstream
@ -76,3 +97,4 @@ namespace comfortable_swipe::util
return conf; return conf;
} }
} }
#endif /* __COMFORTABLE_SWIPE__util_read_config_file__ */

View File

@ -1,6 +1,24 @@
#ifndef __COMFORTABLE_SWIPE__util_regex__ #ifndef __COMFORTABLE_SWIPE__util_regex__
#define __COMFORTABLE_SWIPE__util_regex__ #define __COMFORTABLE_SWIPE__util_regex__
/*
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 <http://www.gnu.org/licenses/>.
*/
namespace comfortable_swipe::util namespace comfortable_swipe::util
{ {
/** /**