XLib Window Reparenting

This is a discussion on XLib Window Reparenting within the Linux Programming forums, part of the Platform Specific Boards category; I'm trying to make a simple window manager for X to learn about the internal workings of Linux. I've read ...

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    9

    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:

    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!

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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.

    --
    Mats
    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, 09: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, 11:17 AM
  4. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 11:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21