I'm trying to make a simple window manager for X to learn about the internal workings of Linux. I've read the whole XLib manual so far, but I'm having a little bit of trouble with window reparenting. Here's the relevant part of my code:
Code:
Window parent;
while(1)
{
// There is a part here that says to get the next event and store it in "event"
switch(event.type)
{
case 'CreateNotify':
parent = XCreateSimpleWindow(display, RootWindow(display, screen_num), event.xcreatewindow.x, event.xcreatewindow.y, event.xcreatewindow.width + 30, event.xcreatewindow.height + 30, 1, BlackPixel(display, screen_num), WhitePixel(display, screen_num));
XReparentWindow(display, event.xcreatewindow.window, parent, 15, 15);
XMoveWindow(display, parent, 100, 100);
break;
default:
break;
}
}
Some of this code may be off a bit, because I'm not near my Linux computer right now. Sorry!
Please tell me what's wrong! Nothing but a simple xterm window appears when I run "startx"! Thanks!
PS: I have changed my .xinitrc script, so it runs an xterm window and my window manager. I am 100% sure my window manager is running!