g++ -L/usr/X11R6/lib -lX11 -lXft -lm -lXpm -lpng -lcups `imlib2-config --libs` -llaxkit laxhello.cc -o laxhelloYou will be subclassing Laxkit::anXWindow. The constructor of that class sets up win_xatts and win_xattsmask to the minimum that it needs for the basics of windowing. If you need access to exotic events like CirculateNotify or VisibilityNotify, you must intercept them in anXWindow::event(), and also select for those events by or'ing them to anXWindow::win_xatts.event_mask.
anXWindow will deal with the basics, like clicking the window manager's delete button decoration, and delivering input events to functions like anXWindow::CharInput() and anXWindow::LBDown().
Tip: it is not a good idea to have a window's constructor depend on x,y,w,h, as those might change, for instance by the frame windows. Any size dependent initialization can be done in preinit() which is called before the window is XCreateWindow'd, or init(), which is called after it is XCreated but before it is mapped. Note that if you try to resize a window after it is XCreated but before it is mapped, the resize is ignored. This is due to mysterious goings on in Xlib.
Windows typically add any initial children in window->init(), ie after app gives window a real Xlib Window. Dialogs will typically create and add buttons and edit boxes it init(), and call anXWin::addwindow() to get them going.
If you want to have windows that really stick around (that is to say, not get deleted), for instance a file dialog that you want to have the same settings for each time it is used, then you can define a reference to it, rather than pointertoit=new WhateverWindow(...). Then, you call app->addwindow(&referencetowindow,0). That final 0 tells anXApp/anXWindow that it should not try to call delete on that pointer.
Something will call app->destroywindow(win) to tag win for deletion. app will immediately XDestroyWindow(win->window), and also its subwindows. The anXWindow structures are not deleted until after event queue is depleted, and it is called direct from app to prevent deletion of a window while control is in the window. Actual deletion is done by app->deletequeued(), where app will delete whatever window is in the stack app->todelete, by calling windowparent->deletekid(theKidToBeDeleted). The window's kid stack is flushed when win's destructor is called. If islocal==0 for any window in app's stack or in a window's kid stack, that window is not deleted. In that case, it is assumed that the programmer has set up some alternate system to control window deletion.
anXApp app; app->init(argc,argv); app->addwindow(new SomeWindow(...), mapit=1, islocal=1): in here, some window properties are set up, somewindow->preinit() is called somewindow->window gets a value from XCreateWindow() somewindow->init() is called. the window gets mapped now, if mapit==1
app->run(); app event loop: deal with all pending messages draw all needtodraw deal all idles destroy windows in todelete stack
app->close(); this destroys any left over windows
It is worth remembering that there are no copy constructors or equal operators defined for any of the Laxkit classes, except NumStack, LineStyle and FillStyle.