Question

I'm trying to implement a basic window manager using xcb library.

I managed to connect with X server, and grab some events, but i cannot figure how to launch an application and show it inside the current X session.

I'm trying to follow the xcb tutorial: http://xcb.freedesktop.org/tutorial/

Basically i thought (and probaly i'm wrong) that once the session is started, with my "windowmanager", if i want to launch an application i just have to fork it, and launch the application, so for example:

int child = fork();
if(child==0) {
    printf("Child");
    execve("/usr/bin/xterm", NULL, NULL);
}

But it seems that didn't work.

I have no much code to show, since i'm trying just to modify che code in the tutorial pasted above (i added an infinite loop, and few other thing).

So how to launch an x application like xterm, pcmanfm and show it on the current x session?

And how i can draw an application inside a new window?

And a last question: i tried to copy and paste the hello world window example of X tutorial, but it doesn't seem to load any window. The code is here: http://www.x.org/releases/X11R7.7/doc/libxcb/tutorial/index.html#helloworld

Was it helpful?

Solution

You don't "draw an application inside a new window" - you just launch a process and it creates a window for itself. Check that DISPLAY variable is set correctly for your process.

To manage windows, you set SubstructureRedirect mask on a root window and respond to substructure/map request notifications from (new) application windows.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top