On Thursday 27 December 2001 05:16, Sean 'Shaleh' Perry wrote: > So, blackbox just began. It loads the blackbox class. This class is > in charge of parsing the rc file, telling screen to parse the style and > menu file, and otherwise finalize the initialization process. screen > (Screen.cc) is a hodge podge of little functionality. It contains the > style parser and info, the menu parser, information about the slit and > toolbar, and quite a bit of other odds and ends. Most of the classes > in blackbox call screen functions often.
Actually, just to clarify about the BScreen class. BaseDisplay (like shaleh said) handles the X connection and events. The BScreen class handles every screen that shows up on the X connection. Normal X11 multihead (NOT Xinerama) has one root window per monitor, and for each of these screens, blackbox creates a BScreen class which holds some information about the screen, as well as things like the workspace lists, icon lists, pixmap cache, etc. Since blackbox doesn't use advanced things like hashes or maps, lots of things are stored in lists, which explains the design of some things. The design could be cleaned up considerably if such things were used. Just a little clarification, for those curious ;) > After the init, blackbox scans the window list for any windows open > before it loaded and parents them. This is when all of blackbox is > visible and ready to run. main then calls blackbox.eventLoop. This is > the brain of blackbox and is in charge of dispatching actions to the > approriate controller. > > eventLoop is actually defined in BaseDisplay.cc (remember blackbox is > derived from it). It is fairly obvious. There is a loop waiting for X > events which also catches Timer events. X events are handled via > process_event, timers handle themselves via timer->fireTimeout. > > Let's start with X events as these are what window managers are made > for. process_event is a switch statement which decides what event > occured and who should handle it. Events include mouse movement or > clicks, X requests such as mapping, unmapping, resizing, new windows, > etc, as well as client to client messages like bbpager and bbkeys use. > As you can see, quite a bit of time is spent here. > > That is pretty much how window management occurs. Let's look at the > supporting cast. > > Basemenu.cc (and the other menu.cc files) contain the code for the menu > system in blackbox. Basemenu defines how keys and mouse actions > trigger menu events. Each of the other menu class files defines a type > of menu -- window menu, rootmenu, etc. > > Image.cc contains all of the code for the look of blackbox. This is > where the gradients and colour handling come from. The code is quite > intense for those not versed in the graphic arts. > > Netizen.cc reprents the interface between applications and blackbox and > communicates via Atoms and client messages. > > Slit.cc defines how the slit looks and controls the programs which end > up there. > > Timer.cc defines what a timer is and how it acts. Many of the classes > in blackbox derive from this class (this was discussed in the last > mail). > > Toolbar.cc is the toolbar, another of the things that make blackbox > feel like blackbox. It handles the drawing of itself, the time update, > etc. > > Window.cc holds all of the information about client windows in > blackbox. Each window that is owned by the window manager has an > instance of BlackboxWindow attached to it. The frame around it as well > as the menu are controlled here. The window class knows how to move, > resize, shade, map, unmap and otherwise manipulate the client window it > owns. > > Workspace.cc is the handling of desktops for blackbox. It controls > which clients appear on which desktops as well as where they are placed > when first launched. workspace->placeWindow is the code which makes > the decision on where the term window you just launched goes. > > i18n.cc (i18n is the shorthand for internationalization -- i 18 letters > n) contains the support for nls in blackbox. i18n->getMessage() is the > equivalent to _() in gnu code. It looks like the string by number, > then calls into a mapping of number to local string. The code is > fairly simple as it just wraps the libc code for C++. > > That is about it. If there is more specifc help I can give, please > ask. Going into any more depth here would require many many more pages > and lots of talk about X handling.
