Attempt fix g++ error

This commit is contained in:
Rico Tiongson 2019-03-05 22:30:59 +08:00
parent 5457e012f2
commit 2ee59cf722
17 changed files with 562 additions and 533 deletions

View File

@ -15,6 +15,9 @@ addons:
packages: packages:
- libxdo-dev - libxdo-dev
- libinput-tools - libinput-tools
- g++-7
env:
CC: g++-7
install: install:
- pip install . - pip install .
script: script:

View File

@ -32,7 +32,9 @@ extern "C"
// CURRENT_WINDOW // CURRENT_WINDOW
} }
namespace comfortable_swipe::gesture namespace comfortable_swipe
{
namespace gesture
{ {
/** /**
* Constructs a new swipe gesture, given configurations for certain swipe events. * Constructs a new swipe gesture, given configurations for certain swipe events.
@ -209,5 +211,6 @@ namespace comfortable_swipe::gesture
"down4" "down4"
}; };
} }
}
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture__ */ #endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture__ */

View File

@ -21,11 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "xdo_gesture.h" #include "xdo_gesture.h"
#ifdef __cplusplus namespace comfortable_swipe
extern "C" { {
#endif namespace gesture
namespace comfortable_swipe::gesture
{ {
class swipe_gesture : protected xdo_gesture class swipe_gesture : protected xdo_gesture
{ {
@ -82,9 +80,6 @@ namespace comfortable_swipe::gesture
static const char* GESTURE_END_REGEX_PATTERN; static const char* GESTURE_END_REGEX_PATTERN;
}; };
} }
#ifdef __cplusplus
} }
#endif
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ */ #endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ */

View File

@ -21,7 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "swipe_gesture.h" #include "swipe_gesture.h"
namespace comfortable_swipe::gesture namespace comfortable_swipe
{
namespace gesture
{ {
/** /**
* Regex pattern for the libinput entry for start of swipe. * Regex pattern for the libinput entry for start of swipe.
@ -87,5 +89,6 @@ namespace comfortable_swipe::gesture
#undef CF_NUMBER_EXTRACT #undef CF_NUMBER_EXTRACT
#undef CF_NUMBER_REGEX #undef CF_NUMBER_REGEX
} }
}
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_regex__ */ #endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_regex__ */

View File

@ -26,7 +26,9 @@ extern "C"
#include "xdo_gesture.h" #include "xdo_gesture.h"
namespace comfortable_swipe::gesture namespace comfortable_swipe
{
namespace gesture
{ {
/** /**
* Constructs a new gesture handler with xdo. * Constructs a new gesture handler with xdo.
@ -43,5 +45,6 @@ namespace comfortable_swipe::gesture
xdo_free(this->xdo); xdo_free(this->xdo);
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__xdo_gesture__ */ #endif /* __COMFORTABLE_SWIPE__xdo_gesture__ */

View File

@ -4,8 +4,6 @@
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
extern "C"
{
namespace comfortable_swipe namespace comfortable_swipe
{ {
namespace service namespace service
@ -19,6 +17,5 @@ extern "C"
void status(); void status();
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__service_index_hpp__ */ #endif /* __COMFORTABLE_SWIPE__service_index_hpp__ */

View File

@ -2,10 +2,17 @@
#define __COMFORTABLE_SWIPE__service_python__ #define __COMFORTABLE_SWIPE__service_python__
#include "_index.hpp" #include "_index.hpp"
extern "C"
{
#include <Python.h> #include <Python.h>
}
// export as python module // export as python module
namespace comfortable_swipe::service::python namespace comfortable_swipe
{
namespace service
{
namespace python
{ {
#define __comfortable_swipe_void_method(method) \ #define __comfortable_swipe_void_method(method) \
static PyObject * \ static PyObject * \
@ -57,6 +64,8 @@ namespace comfortable_swipe::service::python
PyObject * module; PyObject * module;
} }
}
}
// initialize module // initialize module
#if PY_MAJOR_VERSION >= 3 #if PY_MAJOR_VERSION >= 3

View File

@ -21,7 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstdlib> // std::system #include <cstdlib> // std::system
namespace comfortable_swipe::service namespace comfortable_swipe
{
namespace service
{ {
/** /**
* Debugs output from `libinput debug-events`. * Debugs output from `libinput debug-events`.
@ -31,5 +33,6 @@ namespace comfortable_swipe::service
(void) std::system("bash -c \"stdbuf -oL -e0 libinput debug-events 2> >(grep -v 'double tracking')\""); (void) std::system("bash -c \"stdbuf -oL -e0 libinput debug-events 2> >(grep -v 'double tracking')\"");
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__service_debug__ */ #endif /* __COMFORTABLE_SWIPE__service_debug__ */

View File

@ -21,7 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstdio> // std::puts, std::printf #include <cstdio> // std::puts, std::printf
namespace comfortable_swipe::service namespace comfortable_swipe
{
namespace service
{ {
/** /**
* Shows the help window. * Shows the help window.
@ -41,5 +43,6 @@ namespace comfortable_swipe::service
std::puts("status - checks status of program and autostart"); std::puts("status - checks status of program and autostart");
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__service_help__ */ #endif /* __COMFORTABLE_SWIPE__service_help__ */

View File

@ -21,7 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../service/_index.hpp" #include "../service/_index.hpp"
namespace comfortable_swipe::service namespace comfortable_swipe
{
namespace service
{ {
/** /**
* Restarts the comfortable-swipe service. * Restarts the comfortable-swipe service.
@ -32,5 +34,6 @@ namespace comfortable_swipe::service
comfortable_swipe::service::start(); comfortable_swipe::service::start();
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__service_restart__ */ #endif /* __COMFORTABLE_SWIPE__service_restart__ */

View File

@ -24,7 +24,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstdlib> // std::system #include <cstdlib> // std::system
#include <unistd.h> // pipe, fork, perror, exit #include <unistd.h> // pipe, fork, perror, exit
namespace comfortable_swipe::service namespace comfortable_swipe
{
namespace service
{ {
/** /**
* Starts the comfortable-swipe service by buffering libinput debug-events. * Starts the comfortable-swipe service by buffering libinput debug-events.
@ -59,5 +61,6 @@ namespace comfortable_swipe::service
comfortable_swipe::service::stop(); comfortable_swipe::service::stop();
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__service_start__ */ #endif /* __COMFORTABLE_SWIPE__service_start__ */

View File

@ -30,7 +30,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstdio> // FILE, std::feof, std::fgets, std::printf #include <cstdio> // FILE, std::feof, std::fgets, std::printf
#include <regex> // std::cmatch, std::regex, std::regex_match #include <regex> // std::cmatch, std::regex, std::regex_match
namespace comfortable_swipe::service namespace comfortable_swipe
{
namespace service
{ {
/** /**
* Prints the status of comfortable-swipe. * Prints the status of comfortable-swipe.
@ -71,5 +73,6 @@ namespace comfortable_swipe::service
} }
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__service_restart__ */ #endif /* __COMFORTABLE_SWIPE__service_restart__ */

View File

@ -29,7 +29,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstdlib> // std::atoi #include <cstdlib> // std::atoi
#include <cstdio> // FILE, std::feof, std::fgets #include <cstdio> // FILE, std::feof, std::fgets
namespace comfortable_swipe::service namespace comfortable_swipe
{
namespace service
{ {
/** /**
* Stops all comfortable-swipe instances. * Stops all comfortable-swipe instances.
@ -66,5 +68,6 @@ namespace comfortable_swipe::service
(void) std::system(kill.data()); (void) std::system(kill.data());
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__service_stop__ */ #endif /* __COMFORTABLE_SWIPE__service_stop__ */

View File

@ -4,8 +4,6 @@
#include <map> // std::map #include <map> // std::map
#include <string> // std::string #include <string> // std::string
extern "C"
{
namespace comfortable_swipe namespace comfortable_swipe
{ {
namespace util namespace util
@ -13,6 +11,5 @@ extern "C"
std::map<std::string, std::string> read_config_file(const char*); std::map<std::string, std::string> read_config_file(const char*);
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__util_index_hpp__ */ #endif /* __COMFORTABLE_SWIPE__util_index_hpp__ */

View File

@ -22,13 +22,15 @@ 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
#include <sstream> // std::ostringstream
#include <iostream> // std::endl, std::getline #include <iostream> // std::endl, std::getline
#include <sstream> // std::ostringstream
#include <cstdlib> // exit #include <cstdlib> // exit
#include <cctype> // std::isspace #include <cctype> // std::isspace
#include <stdexcept> // std::runtime_error #include <stdexcept> // std::runtime_error
namespace comfortable_swipe::util namespace comfortable_swipe
{
namespace util
{ {
/** /**
* A utility method for reading the config file. * A utility method for reading the config file.
@ -39,7 +41,7 @@ namespace comfortable_swipe::util
{ {
std::map<std::string, std::string> conf; std::map<std::string, std::string> conf;
std::ifstream fin(filename); std::ifstream fin(filename, std::ios::in);
if (!fin.is_open()) if (!fin.is_open())
{ {
@ -100,4 +102,6 @@ namespace comfortable_swipe::util
return conf; return conf;
} }
} }
}
#endif /* __COMFORTABLE_SWIPE__util_read_config_file__ */ #endif /* __COMFORTABLE_SWIPE__util_read_config_file__ */

View File

@ -49,9 +49,6 @@ try:
COMFORTABLE_SWIPE_CONFIG='"{}"'.format(CONFIG) COMFORTABLE_SWIPE_CONFIG='"{}"'.format(CONFIG)
) )
# make sure to use gnu-gcc
os.putenv('CC', 'x86_64-linux-gnu-gcc')
# read C++ libraries for comfortable swipe # read C++ libraries for comfortable swipe
extensions = [Extension( extensions = [Extension(
name='{}.cpp.{}'.format(PYTHON_NAME, extension_name), name='{}.cpp.{}'.format(PYTHON_NAME, extension_name),