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.

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.

Reply via email to