news download themes documentation links










Fluxbox Class Reference

main class for the window manager. More...

#include <fluxbox.hh>

Inheritance diagram for Fluxbox:

FbTk::App FbTk::SignalEventHandler List of all members.

Public Types

typedef std::vector< Fluxbox::TitlebarTitlebarList
enum  Titlebar {
  SHADE = 0, MINIMIZE, MAXIMIZE, CLOSE,
  STICK, MENU, EMPTY
}
 obsolete


Public Member Functions

 Fluxbox (int argc, char **argv, const char *dpy_name=0, const char *rcfilename=0)
void eventLoop ()
 main event loop

bool validateWindow (Window win) const
void grab ()
void ungrab ()
Keys * keys ()
Atom getFluxboxPidAtom () const
WinClientsearchWindow (Window)
WinClientgetFocusedWindow ()
BScreensearchScreen (Window w)
unsigned int getDoubleClickInterval () const
unsigned int getUpdateDelayTime () const
Time getLastTime () const
void addAtomHandler (AtomHandler *atomh)
void removeAtomHandler (AtomHandler *atomh)
const Bool getIgnoreBorder () const
const std::vector< Fluxbox::Titlebar > & getTitlebarRight () const
const std::vector< Fluxbox::Titlebar > & getTitlebarLeft () const
const std::string & getStyleFilename () const
const std::string & getMenuFilename () const
const std::string & getSlitlistFilename () const
int colorsPerChannel () const
int getNumberOfLayers () const
int getMenuLayer () const
int getAboveDockLayer () const
int getDockLayer () const
int getTopLayer () const
int getNormalLayer () const
int getBottomLayer () const
int getDesktopLayer () const
time_t getAutoRaiseDelay () const
unsigned int getCacheLife () const
unsigned int getCacheMax () const
bool useMod1 () const
void maskWindowEvents (Window w, FluxboxWindow *bw)
void watchKeyRelease (BScreen &screen, unsigned int mods)
void setFocusedWindow (WinClient *w)
void revertFocus (BScreen &screen)
void shutdown ()
 prepares fluxbox for a shutdown

void load_rc (BScreen &scr)
void loadRootCommand (BScreen &scr)
void loadTitlebar ()
void saveStyleFilename (const char *val)
void saveMenuFilename (const char *)
void clearMenuFilenames ()
void saveTitlebarFilename (const char *)
void saveSlitlistFilename (const char *val)
void saveWindowSearch (Window win, WinClient *winclient)
void saveWindowSearchGroup (Window win, FluxboxWindow *fbwin)
void saveGroupSearch (Window win, WinClient *winclient)
void save_rc ()
 saves resources

void removeWindowSearch (Window win)
void removeWindowSearchGroup (Window win)
void removeGroupSearch (Window win)
void restart (const char *command=0)
 restarts fluxbox

void reconfigure ()
void rereadMenu ()
void checkMenu ()
 reloads the menus if the timestamps changed

void hideExtraMenus (BScreen &screen)
void handleSignal (int signum)
 handle any system signal sent to the application

void update (FbTk::Subject *changed)
void attachSignals (FluxboxWindow &win)
void attachSignals (WinClient &winclient)
void timed_reconfigure ()
bool isStartup () const
bool menuTimestampsChanged () const
 whether the timestamps on the menu changed

bool haveShape () const
int shapeEventbase () const
void getDefaultDataFilename (char *, std::string &)
 Provides default filename of data file.

BScreenmouseScreen ()
BScreenkeyScreen ()
BScreenwatchingScreen ()
const XEvent & lastEvent () const

Static Public Member Functions

Fluxboxinstance ()
 singleton instance of App


Detailed Description

main class for the window manager.

singleton type

Definition at line 75 of file fluxbox.hh.


Constructor & Destructor Documentation

Fluxbox::Fluxbox int  argc,
char **  argv,
const char *  dpy_name = 0,
const char *  rcfilename = 0
 

! TODO: NLS

! TODO: NLS

Definition at line 372 of file fluxbox.cc.

References FbTk::App::display(), FbTk::Timer::fireOnce(), instance(), FbTk::App::instance(), BScreen::isScreenManaged(), BScreen::layerManager(), FbTk::ThemeManager::load(), FbTk::SignalHandler::registerHandler(), revertFocus(), BScreen::rootWindow(), FbTk::Timer::setCommand(), and FbTk::Timer::setTimeout().

00373     : FbTk::App(dpy_name),
00374       m_fbatoms(new FbAtoms()),
00375       m_resourcemanager(rcfilename, true), 
00376       // TODO: shouldn't need a separate one for screen
00377       m_screen_rm(m_resourcemanager),
00378       m_rc_tabs(m_resourcemanager, true, "session.tabs", "Session.Tabs"),
00379       m_rc_ignoreborder(m_resourcemanager, false, "session.ignoreBorder", "Session.IgnoreBorder"),
00380       m_rc_colors_per_channel(m_resourcemanager, 4, 
00381                               "session.colorsPerChannel", "Session.ColorsPerChannel"),
00382       m_rc_numlayers(m_resourcemanager, 13, "session.numLayers", "Session.NumLayers"),
00383       m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"),
00384       m_rc_update_delay_time(m_resourcemanager, 0, "session.updateDelayTime", "Session.UpdateDelayTime"),
00385       m_rc_stylefile(m_resourcemanager, "", "session.styleFile", "Session.StyleFile"),
00386       m_rc_menufile(m_resourcemanager, DEFAULTMENU, "session.menuFile", "Session.MenuFile"),
00387       m_rc_keyfile(m_resourcemanager, DEFAULTKEYSFILE, "session.keyFile", "Session.KeyFile"),
00388       m_rc_slitlistfile(m_resourcemanager, "", "session.slitlistFile", "Session.SlitlistFile"),
00389       m_rc_groupfile(m_resourcemanager, "", "session.groupFile", "Session.GroupFile"),
00390       m_rc_titlebar_left(m_resourcemanager, 
00391                          TitlebarList(&s_titlebar_left[0], &s_titlebar_left[1]), 
00392                          "session.titlebar.left", "Session.Titlebar.Left"),
00393       m_rc_titlebar_right(m_resourcemanager, 
00394                           TitlebarList(&s_titlebar_right[0], &s_titlebar_right[3]), 
00395                           "session.titlebar.right", "Session.Titlebar.Right"),
00396       m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"),
00397       m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"),
00398       m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"),
00399       m_rc_use_mod1(m_resourcemanager, true, "session.useMod1", "Session.UseMod1"),
00400       m_focused_window(0), m_masked_window(0),
00401       m_mousescreen(0),
00402       m_keyscreen(0),
00403       m_watching_screen(0), m_watch_keyrelease(0),
00404       m_last_time(0),
00405       m_masked(0),
00406       m_rc_file(rcfilename ? rcfilename : ""),
00407       m_argv(argv), m_argc(argc),
00408       m_starting(true),
00409       m_shutdown(false),
00410       m_server_grabs(0),
00411       m_randr_event_type(0),
00412       m_RC_PATH("fluxbox"),
00413       m_RC_INIT_FILE("init") {
00414       
00415     
00416     if (s_singleton != 0)
00417         throw string("Fatal! There can only one instance of fluxbox class.");
00418 
00419     if (display() == 0) {
00421         throw string("Can not connect to X server.\n"
00422                      "Make sure you started X before you start Fluxbox.");
00423     }
00424     // For KDE dock applets
00425     // KDE v1.x
00426     m_kwm1_dockwindow = XInternAtom(FbTk::App::instance()->display(), 
00427                                     "KWM_DOCKWINDOW", False);
00428     // KDE v2.x
00429     m_kwm2_dockwindow = XInternAtom(FbTk::App::instance()->display(), 
00430                                     "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False);
00431     // setup X error handler
00432     XSetErrorHandler((XErrorHandler) handleXErrors);
00433 
00434     //catch system signals
00435     SignalHandler &sigh = SignalHandler::instance();    
00436     sigh.registerHandler(SIGSEGV, this);
00437     sigh.registerHandler(SIGFPE, this);
00438     sigh.registerHandler(SIGTERM, this);
00439     sigh.registerHandler(SIGINT, this);
00440     sigh.registerHandler(SIGCHLD, this);
00441     sigh.registerHandler(SIGHUP, this);
00442     sigh.registerHandler(SIGUSR1, this);    
00443     sigh.registerHandler(SIGUSR2, this);
00444     //
00445     // setup timer
00446     // This timer is used to we can issue a safe reconfig command.
00447     // Because when the command is executed we shouldn't do reconfig directly
00448     // because it could affect ongoing menu stuff so we need to reconfig in
00449     // the next event "round".
00450     FbTk::RefCount<FbTk::Command> reconfig_cmd(new FbTk::SimpleCommand<Fluxbox>(*this, &Fluxbox::timed_reconfigure));
00451     timeval to;
00452     to.tv_sec = 0;
00453     to.tv_usec = 1;
00454     m_reconfig_timer.setTimeout(to);
00455     m_reconfig_timer.setCommand(reconfig_cmd);
00456     m_reconfig_timer.fireOnce(true);
00457 
00458     Display *disp = FbTk::App::instance()->display();
00459 
00460     s_singleton = this;
00461     m_have_shape = false;
00462     m_shape_eventbase = 0;
00463 #ifdef SHAPE
00464     int shape_err; 
00465     m_have_shape = XShapeQueryExtension(disp, &m_shape_eventbase, &shape_err);
00466 #endif // SHAPE
00467 
00468 #ifdef HAVE_RANDR
00469     // get randr event type
00470     int randr_error_base;
00471     XRRQueryExtension(disp, &m_randr_event_type, &randr_error_base);
00472 #endif // HAVE_RANDR
00473 
00474     load_rc();
00475     // setup theme manager to have our style file ready to be scanned
00476     FbTk::ThemeManager::instance().load(getStyleFilename());
00477 
00478     // setup atom handlers before we create any windows
00479 #ifdef USE_GNOME
00480     addAtomHandler(new Gnome()); // for gnome 1 atom support
00481 #endif //USE_GNOME
00482 
00483 #ifdef USE_NEWWMSPEC
00484     addAtomHandler(new Ewmh()); // for Extended window manager atom support
00485 #endif // USE_NEWWMSPEC
00486 
00487 #ifdef REMEMBER
00488     addAtomHandler(new Remember()); // for remembering window attribs
00489 #endif // REMEMBER
00490 
00491     grab();
00492     
00493     setupConfigFiles();
00494     
00495     if (! XSupportsLocale())
00496         cerr<<"Warning: X server does not support locale"<<endl;
00497 
00498     if (XSetLocaleModifiers("") == 0)
00499         cerr<<"Warning: cannot set locale modifiers"<<endl;
00500 
00501 
00502 #ifdef HAVE_GETPID
00503     m_fluxbox_pid = XInternAtom(disp, "_BLACKBOX_PID", False);
00504 #endif // HAVE_GETPID
00505 
00506     // Allocate screens
00507     for (int i = 0; i < ScreenCount(display()); i++) {
00508         char scrname[128], altscrname[128];
00509         sprintf(scrname, "session.screen%d", i);
00510         sprintf(altscrname, "session.Screen%d", i);
00511         BScreen *screen = new BScreen(m_screen_rm.lock(), 
00512 
00513                                       scrname, altscrname,
00514                                       i, getNumberOfLayers());
00515         if (! screen->isScreenManaged()) {
00516             delete screen;          
00517             continue;
00518         }
00519 
00520 #ifdef HAVE_GETPID
00521         pid_t bpid = getpid();
00522 
00523         screen->rootWindow().changeProperty(getFluxboxPidAtom(), XA_CARDINAL,
00524                                             sizeof(pid_t) * 8, PropModeReplace,
00525                                             (unsigned char *) &bpid, 1);
00526 #endif // HAVE_GETPID
00527 
00528 #ifdef HAVE_RANDR
00529         // setup RANDR for this screens root window
00530         // we need to determine if we should use old randr select input function or not
00531 #ifdef X_RRScreenChangeSelectInput
00532         // use old set randr event
00533         XRRScreenChangeSelectInput(disp, screen->rootWindow().window(), True);
00534 #else
00535         XRRSelectInput(disp, screen->rootWindow().window(),
00536                        RRScreenChangeNotifyMask);
00537 #endif // X_RRScreenChangeSelectInput        
00538 
00539 #endif // HAVE_RANDR
00540 
00541         m_screen_list.push_back(screen);
00542 #ifdef USE_TOOLBAR
00543         m_toolbars.push_back(new Toolbar(*screen, 
00544                                          *screen->layerManager().getLayer(Fluxbox::instance()->getNormalLayer())));
00545 #endif // USE_TOOLBAR
00546 
00547         // attach screen signals to this
00548         screen->currentWorkspaceSig().attach(this);
00549         screen->workspaceCountSig().attach(this);
00550         screen->workspaceNamesSig().attach(this);
00551         screen->clientListSig().attach(this);
00552 
00553         // initiate atomhandler for screen specific stuff
00554         for (size_t atomh=0; atomh<m_atomhandler.size(); ++atomh) {
00555             m_atomhandler[atomh]->initForScreen(*screen);
00556         }
00557 
00558         revertFocus(*screen); // make sure focus style is correct
00559 
00560     } // end init screens
00561 
00562 
00563     m_keyscreen = m_mousescreen = m_screen_list.front();
00564 
00565     if (m_screen_list.size() == 0) {
00567         throw string("Couldn't find screens to manage.\n"
00568                      "Make sure you don't have another window manager running.");
00569     }
00570 
00571     // setup theme manager to have our style file ready to be scanned
00572     FbTk::ThemeManager::instance().load(getStyleFilename());
00573 
00574     XSynchronize(disp, False);
00575     sync(false);
00576 
00577     m_reconfigure_wait = m_reread_menu_wait = false;
00578     
00579     // Create keybindings handler and load keys file    
00580     m_key.reset(new Keys(StringUtil::expandFilename(*m_rc_keyfile).c_str()));
00581 
00582     m_resourcemanager.unlock();
00583     ungrab();
00584 
00585 #ifdef DEBUG
00586     if (m_resourcemanager.lockDepth() != 0) 
00587         cerr<<"--- resource manager lockdepth = "<<m_resourcemanager.lockDepth()<<endl;
00588 #endif //DEBUG
00589     m_starting = false;
00590     // 
00591     // For dumping theme items
00592     // FbTk::ThemeManager::instance().listItems();
00593     //
00594     //    m_resourcemanager.dump();
00595 }


Member Function Documentation

void Fluxbox::revertFocus BScreen screen  ) 
 

This function is called whenever we aren't quite sure what focus is meant to be, it'll make things right ;-) last_focused is set to something if we want to make use of the previously focused window (it must NOT be set focused now, it is probably dying).

ignore_event means that it ignores the given event until it gets a focusIn

Definition at line 1915 of file fluxbox.cc.

References BScreen::currentWorkspaceID(), FbTk::App::display(), WinClient::fbwindow(), BScreen::getFocusModel(), BScreen::getLastFocusedWindow(), FbTk::App::instance(), BScreen::rootWindow(), and FluxboxWindow::setCurrentClient().

Referenced by Fluxbox(), FluxboxWindow::iconify(), and BScreen::notifyReleasedKeys().

01915                                          {
01916     // Relevant resources:
01917     // resource.focus_last = whether we focus last focused when changing workspace
01918     // BScreen::FocusModel = sloppy, click, whatever
01919     WinClient *next_focus = screen.getLastFocusedWindow(screen.currentWorkspaceID());
01920 
01921     // if setting focus fails, or isn't possible, fallback correctly
01922     if (!(next_focus && next_focus->fbwindow() &&
01923           next_focus->fbwindow()->setCurrentClient(*next_focus, true))) {
01924         setFocusedWindow(0); // so we don't get dangling m_focused_window pointer
01925         switch (screen.getFocusModel()) {
01926         case BScreen::SLOPPYFOCUS:
01927         case BScreen::SEMISLOPPYFOCUS:
01928             XSetInputFocus(FbTk::App::instance()->display(), 
01929                            PointerRoot, None, CurrentTime);
01930             break;
01931         case BScreen::CLICKTOFOCUS:
01932             screen.rootWindow().setInputFocus(RevertToPointerRoot, CurrentTime);
01933             break;
01934         }
01935     }
01936 }


The documentation for this class was generated from the following files:

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA