diff --git a/src/backend.cpp b/src/backend.cpp index eb365b7..bf53e70 100644 --- a/src/backend.cpp +++ b/src/backend.cpp @@ -575,12 +575,14 @@ const char *X11Backend::pcursorStrs[CURSOR_COUNT] = { "left_ptr" }; -Default::Default() : X11Backend(), pdragClient(0){ +Default::Default(bool _standaloneComp) : X11Backend(), pdragClient(0), standaloneComp(_standaloneComp){ // clock_gettime(CLOCK_MONOTONIC,&eventTimer); pollTimer.tv_sec = 0; pollTimer.tv_nsec = 0; //polling = false; + + printf("------standalone comp: %u\n",standaloneComp); } Default::~Default(){ diff --git a/src/backend.h b/src/backend.h index 11b6966..1b0b96a 100644 --- a/src/backend.h +++ b/src/backend.h @@ -220,7 +220,7 @@ friend class Compositor::TexturePixmap; class Default : public X11Backend{ public: - Default(); + Default(bool); virtual ~Default(); void Start(); void Stop(); @@ -249,6 +249,7 @@ class Default : public X11Backend{ std::vector netClientList; //used only to update the property - not maintained X11Client *pdragClient; sint dragRootX, dragRootY; + bool standaloneComp; }; class DebugClient : public WManager::Client{ diff --git a/src/config.cpp b/src/config.cpp index 47c8169..a90adeb 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -446,7 +446,7 @@ WorkspaceProxy::~WorkspaceProxy(){ // }*/ -BackendInterface::BackendInterface() : pbackend(0){ +BackendInterface::BackendInterface() : standaloneComp(Loader::standaloneComp), pbackend(0){ // } @@ -1067,6 +1067,7 @@ BOOST_PYTHON_MODULE(chamfer){ .def("BindKey",&BackendInterface::BindKey) .def("MapKey",&BackendInterface::MapKey) .def("GrabKeyboard",&BackendInterface::GrabKeyboard) + .def_readwrite("standaloneCompositor",&BackendInterface::standaloneComp) ; boost::python::def("BindBackend",BackendInterface::Bind); @@ -1169,6 +1170,8 @@ void Loader::Run(const char *pfilePath, const char *pfileLabel){ fclose(pf); } +bool Loader::standaloneComp; + sint Loader::deviceIndex; bool Loader::debugLayers; bool Loader::scissoring; diff --git a/src/config.h b/src/config.h index 816cb8c..e1a198a 100644 --- a/src/config.h +++ b/src/config.h @@ -143,6 +143,8 @@ class BackendInterface{ void MapKey(uint, uint, uint); void GrabKeyboard(bool); + bool standaloneComp; + class BackendConfig *pbackend; static void Bind(boost::python::object); @@ -215,6 +217,10 @@ class Loader{ ~Loader(); void Run(const char *, const char *); + //backend + static bool standaloneComp; + + //compositor static sint deviceIndex; static bool debugLayers; static bool scissoring; diff --git a/src/main.cpp b/src/main.cpp index 8a07b81..4d09326 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -327,7 +327,7 @@ class RunBackend : public Config::BackendConfig{ class DefaultBackend : public Backend::Default, public RunBackend{ public: - DefaultBackend(Config::BackendInterface *_pbackendInt) : Default(), RunBackend(new Config::X11ContainerConfig(this),_pbackendInt){ + DefaultBackend(Config::BackendInterface *_pbackendInt) : Default(_pbackendInt->standaloneComp), RunBackend(new Config::X11ContainerConfig(this),_pbackendInt){ Start(); DebugPrintf(stdout,"Backend initialized.\n"); } @@ -823,6 +823,7 @@ int main(sint argc, const char **pargv){ args::Group group_backend(parser,"Backend",args::Group::Validators::DontCare); args::Flag debugBackend(group_backend,"debugBackend","Create a test environment for the compositor engine without redirection. The application will not act as a window manager.",{'d',"debug-backend"}); + args::Flag staComp(group_backend,"standaloneCompositor","Standalone compositor for external window managers.",{'C',"standalone-compositor"}); args::Group group_comp(parser,"Compositor",args::Group::Validators::DontCare); args::Flag noComp(group_comp,"noComp","Disable compositor.",{"no-compositor",'n'}); @@ -855,6 +856,9 @@ int main(sint argc, const char **pargv){ Config::Loader *pconfigLoader = new Config::Loader(pargv[0]); pconfigLoader->Run(configPath?configPath.Get().c_str():0,"config.py"); + if(staComp.Get()) + Config::BackendInterface::pbackendInt->standaloneComp = true; + if(deviceIndexOpt) Config::CompositorInterface::pcompositorInt->deviceIndex = deviceIndexOpt.Get(); if(debugLayersOpt.Get())