Thread: XLib Window Reparenting

  1. #1
    Registered User
    Join Date
    Oct 2007

    XLib Window Reparenting

    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:

    Window parent;
       // There is a part here that says to get the next event and store it in "event"
          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);
    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!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    I have no idea what's wrong with your code, but in my opinion, there's no such thing as a "simple window manager". They are all rather complicated, just that some are rather MUCH complicated and some are rather not so much complicated.

    And you won't learn much about Linux internals by looking at Window manager. You may learn something about X-windows, which in most Linux distros is XFree86.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM