Skip to content

Commit

Permalink
Standalone compositor config
Browse files Browse the repository at this point in the history
  • Loading branch information
jaelpark committed Jul 16, 2020
1 parent 710eecb commit 7d0cd7d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down
3 changes: 2 additions & 1 deletion src/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ friend class Compositor::TexturePixmap;

class Default : public X11Backend{
public:
Default();
Default(bool);
virtual ~Default();
void Start();
void Stop();
Expand Down Expand Up @@ -249,6 +249,7 @@ class Default : public X11Backend{
std::vector<xcb_window_t> netClientList; //used only to update the property - not maintained
X11Client *pdragClient;
sint dragRootX, dragRootY;
bool standaloneComp;
};

class DebugClient : public WManager::Client{
Expand Down
5 changes: 4 additions & 1 deletion src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ WorkspaceProxy::~WorkspaceProxy(){
//
}*/

BackendInterface::BackendInterface() : pbackend(0){
BackendInterface::BackendInterface() : standaloneComp(Loader::standaloneComp), pbackend(0){
//
}

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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'});
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit 7d0cd7d

Please sign in to comment.