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:
- libxdo-dev
- libinput-tools
- g++-7
env:
CC: g++-7
install:
- pip install .
script:

View File

@ -32,8 +32,10 @@ extern "C"
// CURRENT_WINDOW
}
namespace comfortable_swipe::gesture
namespace comfortable_swipe
{
namespace gesture
{
/**
* Constructs a new swipe gesture, given configurations for certain swipe events.
*/
@ -208,6 +210,7 @@ namespace comfortable_swipe::gesture
"down3",
"down4"
};
}
}
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture__ */

View File

@ -21,12 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "xdo_gesture.h"
#ifdef __cplusplus
extern "C" {
#endif
namespace comfortable_swipe::gesture
namespace comfortable_swipe
{
namespace gesture
{
class swipe_gesture : protected xdo_gesture
{
public:
@ -81,10 +79,7 @@ namespace comfortable_swipe::gesture
static const char* GESTURE_UPDATE_REGEX_PATTERN;
static const char* GESTURE_END_REGEX_PATTERN;
};
}
}
#ifdef __cplusplus
}
#endif
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_h__ */

View File

@ -21,8 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "swipe_gesture.h"
namespace comfortable_swipe::gesture
namespace comfortable_swipe
{
namespace gesture
{
/**
* Regex pattern for the libinput entry for start of swipe.
* Extracts one match for the number of fingers used during the swipe.
@ -86,6 +88,7 @@ namespace comfortable_swipe::gesture
#undef CF_NUMBER_DIVISION
#undef CF_NUMBER_EXTRACT
#undef CF_NUMBER_REGEX
}
}
#endif /* __COMFORTABLE_SWIPE__gesture_swipe_gesture_regex__ */

View File

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

View File

@ -4,10 +4,8 @@
#include <map> // std::map
#include <string> // std::string
extern "C"
namespace comfortable_swipe
{
namespace comfortable_swipe
{
namespace service
{
void buffer();
@ -18,7 +16,6 @@ extern "C"
void stop();
void status();
}
}
}
#endif /* __COMFORTABLE_SWIPE__service_index_hpp__ */

View File

@ -2,11 +2,18 @@
#define __COMFORTABLE_SWIPE__service_python__
#include "_index.hpp"
#include <Python.h>
extern "C"
{
#include <Python.h>
}
// export as python module
namespace comfortable_swipe::service::python
namespace comfortable_swipe
{
namespace service
{
namespace python
{
#define __comfortable_swipe_void_method(method) \
static PyObject * \
method(PyObject * self, PyObject * args) \
@ -56,6 +63,8 @@ namespace comfortable_swipe::service::python
#endif
PyObject * module;
}
}
}
// initialize module

View File

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

View File

@ -21,8 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstdio> // std::puts, std::printf
namespace comfortable_swipe::service
namespace comfortable_swipe
{
namespace service
{
/**
* Shows the help window.
*/
@ -40,6 +42,7 @@ namespace comfortable_swipe::service
std::puts("debug - logs raw output from input events taken from libinput");
std::puts("status - checks status of program and autostart");
}
}
}
#endif /* __COMFORTABLE_SWIPE__service_help__ */

View File

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

View File

@ -24,8 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstdlib> // std::system
#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.
* This method is deferred. Please refer to comfortable_swipe::service::buffer()
@ -58,6 +60,7 @@ namespace comfortable_swipe::service
}
comfortable_swipe::service::stop();
}
}
}
#endif /* __COMFORTABLE_SWIPE__service_start__ */

View File

@ -30,8 +30,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cstdio> // FILE, std::feof, std::fgets, std::printf
#include <regex> // std::cmatch, std::regex, std::regex_match
namespace comfortable_swipe::service
namespace comfortable_swipe
{
namespace service
{
/**
* Prints the status of comfortable-swipe.
*/
@ -70,6 +72,7 @@ namespace comfortable_swipe::service
std::printf("config error: %s\n", e.what());
}
}
}
}
#endif /* __COMFORTABLE_SWIPE__service_restart__ */

View File

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

View File

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

View File

@ -22,14 +22,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <map> // std::map
#include <string> // std::string
#include <fstream> // std::ifstream
#include <sstream> // std::ostringstream
#include <iostream> // std::endl, std::getline
#include <sstream> // std::ostringstream
#include <cstdlib> // exit
#include <cctype> // std::isspace
#include <stdexcept> // std::runtime_error
namespace comfortable_swipe::util
namespace comfortable_swipe
{
namespace util
{
/**
* A utility method for reading the config file.
*
@ -39,7 +41,7 @@ namespace comfortable_swipe::util
{
std::map<std::string, std::string> conf;
std::ifstream fin(filename);
std::ifstream fin(filename, std::ios::in);
if (!fin.is_open())
{
@ -99,5 +101,7 @@ namespace comfortable_swipe::util
return conf;
}
}
}
#endif /* __COMFORTABLE_SWIPE__util_read_config_file__ */

View File

@ -49,9 +49,6 @@ try:
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
extensions = [Extension(
name='{}.cpp.{}'.format(PYTHON_NAME, extension_name),