Add -no-slit and -no-toolbar flags
Sometimes fluxbox is used as a component of a desktop environment ( e.g., the "Lumina Desktop"). It's easier and more stable for this kind of "users" to disable the toolbar or the slit alltogether. Why not configure these features out? Because then they would need 2 installations of fluxbox: One without the slit and the toolbar (and perhaps other components) and one with them. This implements feature request #314, at least partially. This commit also looks bigger than it actually is: I refactored and cleaned up classes Fluxbox and BScreen.
This commit is contained in:
parent
3cda1099e2
commit
ab2eef4937
6 changed files with 267 additions and 262 deletions
|
@ -24,14 +24,13 @@
|
|||
|
||||
#include "NotCopyable.hh"
|
||||
#include "Accessor.hh"
|
||||
#include "XrmDatabaseHelper.hh"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <iostream>
|
||||
|
||||
#include <exception>
|
||||
#include <typeinfo>
|
||||
#include "XrmDatabaseHelper.hh"
|
||||
|
||||
namespace FbTk {
|
||||
|
||||
|
|
111
src/Screen.cc
111
src/Screen.cc
|
@ -189,7 +189,8 @@ void initAtoms(Display* dpy) {
|
|||
BScreen::BScreen(FbTk::ResourceManager &rm,
|
||||
const string &screenname,
|
||||
const string &altscreenname,
|
||||
int scrn, int num_layers) :
|
||||
int scrn, int num_layers,
|
||||
unsigned int opts) :
|
||||
m_layermanager(num_layers),
|
||||
root_colormap_installed(false),
|
||||
m_image_control(0),
|
||||
|
@ -214,19 +215,20 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
|||
m_altname(altscreenname),
|
||||
m_focus_control(new FocusControl(*this)),
|
||||
m_placement_strategy(new ScreenPlacement(*this)),
|
||||
m_cycling(false), m_cycle_opts(0),
|
||||
m_restart(false),
|
||||
m_shutdown(false) {
|
||||
m_cycle_opts(0),
|
||||
m_opts(opts) {
|
||||
|
||||
|
||||
m_state.cycling = false;
|
||||
m_state.restart = false;
|
||||
m_state.shutdown = false;
|
||||
m_state.managed = false;
|
||||
|
||||
Fluxbox *fluxbox = Fluxbox::instance();
|
||||
Display *disp = fluxbox->display();
|
||||
|
||||
initAtoms(disp);
|
||||
|
||||
|
||||
// TODO fluxgen: check if this is the right place (it was not -lis)
|
||||
//
|
||||
// Create the first one, initXinerama will expand this if needed.
|
||||
m_head_areas.resize(1);
|
||||
m_head_areas[0] = new HeadArea();
|
||||
|
@ -244,8 +246,8 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
|||
|
||||
XSetErrorHandler((XErrorHandler) old);
|
||||
|
||||
managed = running;
|
||||
if (! managed) {
|
||||
m_state.managed = running;
|
||||
if (!m_state.managed) {
|
||||
delete m_placement_strategy; m_placement_strategy = 0;
|
||||
delete m_focus_control; m_focus_control = 0;
|
||||
return;
|
||||
|
@ -261,14 +263,12 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
|||
#endif // HAVE_GETPID
|
||||
|
||||
// check if we're the first EWMH compliant window manager on this screen
|
||||
Atom xa_ret_type;
|
||||
int ret_format;
|
||||
unsigned long ret_nitems, ret_bytes_after;
|
||||
union { Atom atom; unsigned long ul; int i; } ignore;
|
||||
unsigned char *ret_prop;
|
||||
if (rootWindow().property(atom_wm_check, 0l, 1l,
|
||||
False, XA_WINDOW, &xa_ret_type, &ret_format, &ret_nitems,
|
||||
&ret_bytes_after, &ret_prop) ) {
|
||||
m_restart = (ret_prop != NULL);
|
||||
False, XA_WINDOW, &ignore.atom, &ignore.i, &ignore.ul,
|
||||
&ignore.ul, &ret_prop) ) {
|
||||
m_state.restart = (ret_prop != NULL);
|
||||
XFree(ret_prop);
|
||||
}
|
||||
|
||||
|
@ -362,7 +362,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
|||
|
||||
// check which desktop we should start on
|
||||
int first_desktop = 0;
|
||||
if (m_restart) {
|
||||
if (m_state.restart) {
|
||||
bool exists;
|
||||
int ret = (rootWindow().cardinalProperty(atom_net_desktop, &exists));
|
||||
if (exists) {
|
||||
|
@ -373,8 +373,10 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
|||
changeWorkspaceID(first_desktop);
|
||||
|
||||
#ifdef USE_SLIT
|
||||
m_slit.reset(new Slit(*this, *layerManager().getLayer(ResourceLayer::DESKTOP),
|
||||
fluxbox->getSlitlistFilename().c_str()));
|
||||
if (opts & Fluxbox::OPT_SLIT) {
|
||||
Slit* slit = new Slit(*this, *layerManager().getLayer(ResourceLayer::DESKTOP), fluxbox->getSlitlistFilename().c_str());
|
||||
m_slit.reset(slit);
|
||||
}
|
||||
#endif // USE_SLIT
|
||||
|
||||
rm.unlock();
|
||||
|
@ -386,7 +388,7 @@ BScreen::BScreen(FbTk::ResourceManager &rm,
|
|||
|
||||
BScreen::~BScreen() {
|
||||
|
||||
if (! managed)
|
||||
if (!m_state.managed)
|
||||
return;
|
||||
|
||||
m_toolbar.reset(0);
|
||||
|
@ -445,19 +447,23 @@ BScreen::~BScreen() {
|
|||
}
|
||||
|
||||
bool BScreen::isRestart() {
|
||||
return Fluxbox::instance()->isStartup() && m_restart;
|
||||
return Fluxbox::instance()->isStartup() && m_state.restart;
|
||||
}
|
||||
|
||||
void BScreen::initWindows() {
|
||||
|
||||
#ifdef USE_TOOLBAR
|
||||
m_toolbar.reset(new Toolbar(*this,
|
||||
*layerManager().getLayer(::ResourceLayer::NORMAL)));
|
||||
if (m_opts & Fluxbox::OPT_TOOLBAR) {
|
||||
Toolbar* tb = new Toolbar(*this, *layerManager().getLayer(::ResourceLayer::NORMAL));
|
||||
m_toolbar.reset(tb);
|
||||
}
|
||||
#endif // USE_TOOLBAR
|
||||
|
||||
unsigned int nchild;
|
||||
Window r, p, *children;
|
||||
Display *disp = FbTk::App::instance()->display();
|
||||
Fluxbox* fluxbox = Fluxbox::instance();
|
||||
Display* disp = fluxbox->display();
|
||||
|
||||
XQueryTree(disp, rootWindow().window(), &r, &p, &children, &nchild);
|
||||
|
||||
// preen the window list of all icon windows... for better dockapp support
|
||||
|
@ -483,10 +489,8 @@ void BScreen::initWindows() {
|
|||
}
|
||||
XFree(wmhints);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Fluxbox *fluxbox = Fluxbox::instance();
|
||||
|
||||
// manage shown windows
|
||||
Window transient_for = 0;
|
||||
|
@ -611,8 +615,8 @@ void BScreen::focusedWinFrameThemeReconfigured() {
|
|||
Fluxbox *fluxbox = Fluxbox::instance();
|
||||
const std::list<Focusable *> winlist =
|
||||
focusControl().focusedOrderWinList().clientList();
|
||||
std::list<Focusable *>::const_iterator it = winlist.begin(),
|
||||
it_end = winlist.end();
|
||||
std::list<Focusable *>::const_iterator it = winlist.begin();
|
||||
std::list<Focusable *>::const_iterator it_end = winlist.end();
|
||||
for (; it != it_end; ++it)
|
||||
fluxbox->updateFrameExtents(*(*it)->fbwindow());
|
||||
|
||||
|
@ -661,14 +665,15 @@ void BScreen::keyPressEvent(XKeyEvent &ke) {
|
|||
}
|
||||
|
||||
void BScreen::keyReleaseEvent(XKeyEvent &ke) {
|
||||
if (m_cycling) {
|
||||
if (m_state.cycling) {
|
||||
|
||||
unsigned int state = FbTk::KeyUtil::instance().cleanMods(ke.state);
|
||||
state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode);
|
||||
|
||||
if (state) // still cycling
|
||||
return;
|
||||
|
||||
m_cycling = false;
|
||||
m_state.cycling = false;
|
||||
focusControl().stopCyclingFocus();
|
||||
}
|
||||
if (!Fluxbox::instance()->keys()->inKeychain())
|
||||
|
@ -693,8 +698,8 @@ void BScreen::cycleFocus(int options, const ClientPattern *pat, bool reverse) {
|
|||
else if (ev.type == ButtonPress)
|
||||
mods = FbTk::KeyUtil::instance().cleanMods(ev.xbutton.state);
|
||||
|
||||
if (!m_cycling && mods) {
|
||||
m_cycling = true;
|
||||
if (!m_state.cycling && mods) {
|
||||
m_state.cycling = true;
|
||||
FbTk::EventManager::instance()->grabKeyboard(rootWindow().window());
|
||||
}
|
||||
|
||||
|
@ -849,13 +854,12 @@ void BScreen::removeClient(WinClient &client) {
|
|||
int BScreen::addWorkspace() {
|
||||
|
||||
bool save_name = getNameOfWorkspace(m_workspaces_list.size()) == "";
|
||||
Workspace *wkspc = new Workspace(*this,
|
||||
getNameOfWorkspace(m_workspaces_list.size()),
|
||||
m_workspaces_list.size());
|
||||
m_workspaces_list.push_back(wkspc);
|
||||
std::string name = getNameOfWorkspace(m_workspaces_list.size());
|
||||
Workspace *ws = new Workspace(*this, name, m_workspaces_list.size());
|
||||
m_workspaces_list.push_back(ws);
|
||||
|
||||
if (save_name) {
|
||||
addWorkspaceName(wkspc->name().c_str());
|
||||
addWorkspaceName(ws->name().c_str());
|
||||
m_workspacenames_sig.emit(*this);
|
||||
}
|
||||
|
||||
|
@ -1065,7 +1069,9 @@ bool BScreen::addKdeDockapp(Window client) {
|
|||
}
|
||||
|
||||
FluxboxWindow *BScreen::createWindow(Window client) {
|
||||
FbTk::App::instance()->sync(false);
|
||||
|
||||
Fluxbox* fluxbox = Fluxbox::instance();
|
||||
fluxbox->sync(false);
|
||||
|
||||
if (isKdeDockapp(client) && addKdeDockapp(client)) {
|
||||
return 0; // dont create a FluxboxWindow for this one
|
||||
|
@ -1084,14 +1090,14 @@ FluxboxWindow *BScreen::createWindow(Window client) {
|
|||
}
|
||||
|
||||
// check if it should be grouped with something else
|
||||
FluxboxWindow *win;
|
||||
WinClient *other;
|
||||
if ((other = findGroupLeft(*winclient)) && (win = other->fbwindow())) {
|
||||
win->attachClient(*winclient);
|
||||
Fluxbox::instance()->attachSignals(*winclient);
|
||||
} else {
|
||||
WinClient* other = findGroupLeft(*winclient);
|
||||
FluxboxWindow* win = other ? other->fbwindow() : 0;
|
||||
|
||||
Fluxbox::instance()->attachSignals(*winclient);
|
||||
if (other && win) {
|
||||
win->attachClient(*winclient);
|
||||
fluxbox->attachSignals(*winclient);
|
||||
} else {
|
||||
fluxbox->attachSignals(*winclient);
|
||||
if (winclient->fbwindow()) { // may have been set in an atomhandler
|
||||
win = winclient->fbwindow();
|
||||
Workspace *workspace = getWorkspace(win->workspaceNumber());
|
||||
|
@ -1109,7 +1115,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
|
|||
|
||||
// add the window to the focus list
|
||||
// always add to front on startup to keep the focus order the same
|
||||
if (win->isFocused() || Fluxbox::instance()->isStartup())
|
||||
if (win->isFocused() || fluxbox->isStartup())
|
||||
focusControl().addFocusFront(*winclient);
|
||||
else
|
||||
focusControl().addFocusBack(*winclient);
|
||||
|
@ -1123,7 +1129,7 @@ FluxboxWindow *BScreen::createWindow(Window client) {
|
|||
|
||||
m_clientlist_sig.emit(*this);
|
||||
|
||||
FbTk::App::instance()->sync(false);
|
||||
fluxbox->sync(false);
|
||||
return win;
|
||||
}
|
||||
|
||||
|
@ -1386,7 +1392,7 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
|
|||
void BScreen::shutdown() {
|
||||
rootWindow().setEventMask(NoEventMask);
|
||||
FbTk::App::instance()->sync(false);
|
||||
m_shutdown = true;
|
||||
m_state.shutdown = true;
|
||||
m_focus_control->shutdown();
|
||||
for_each(m_workspaces_list.begin(),
|
||||
m_workspaces_list.end(),
|
||||
|
@ -1701,15 +1707,12 @@ int BScreen::getCurrHead() const {
|
|||
if (!hasXinerama()) return 0;
|
||||
int root_x = 0, root_y = 0;
|
||||
#ifdef XINERAMA
|
||||
int ignore_i;
|
||||
unsigned int ignore_ui;
|
||||
|
||||
Window ignore_w;
|
||||
union { int i; unsigned int ui; Window w; } ignore;
|
||||
|
||||
XQueryPointer(FbTk::App::instance()->display(),
|
||||
rootWindow().window(), &ignore_w,
|
||||
&ignore_w, &root_x, &root_y,
|
||||
&ignore_i, &ignore_i, &ignore_ui);
|
||||
rootWindow().window(), &ignore.w,
|
||||
&ignore.w, &root_x, &root_y,
|
||||
&ignore.i, &ignore.i, &ignore.ui);
|
||||
#endif // XINERAMA
|
||||
return getHead(root_x, root_y);
|
||||
}
|
||||
|
|
|
@ -79,20 +79,19 @@ class FbWindow;
|
|||
class BScreen: public FbTk::EventHandler, private FbTk::NotCopyable {
|
||||
public:
|
||||
typedef std::list<FluxboxWindow *> Icons;
|
||||
|
||||
typedef std::vector<Workspace *> Workspaces;
|
||||
typedef std::vector<std::string> WorkspaceNames;
|
||||
|
||||
BScreen(FbTk::ResourceManager &rm,
|
||||
const std::string &screenname, const std::string &altscreenname,
|
||||
int scrn, int number_of_layers);
|
||||
int scrn, int number_of_layers, unsigned int opts);
|
||||
~BScreen();
|
||||
|
||||
void initWindows();
|
||||
void initMenus();
|
||||
|
||||
bool isRootColormapInstalled() const { return root_colormap_installed; }
|
||||
bool isScreenManaged() const { return managed; }
|
||||
bool isScreenManaged() const { return m_state.managed; }
|
||||
bool isWorkspaceWarping() const { return (m_workspaces_list.size() > 1) && *resource.workspace_warping; }
|
||||
bool doAutoRaise() const { return *resource.auto_raise; }
|
||||
bool clickRaises() const { return *resource.click_raises; }
|
||||
|
@ -222,7 +221,7 @@ public:
|
|||
*/
|
||||
void cycleFocus(int opts = 0, const ClientPattern *pat = 0, bool reverse = false);
|
||||
|
||||
bool isCycling() const { return m_cycling; }
|
||||
bool isCycling() const { return m_state.cycling; }
|
||||
|
||||
/**
|
||||
* For extras to add menus.
|
||||
|
@ -267,7 +266,7 @@ public:
|
|||
const FbTk::ResourceManager &resourceManager() const { return m_resource_manager; }
|
||||
const std::string &name() const { return m_name; }
|
||||
const std::string &altName() const { return m_altname; }
|
||||
bool isShuttingdown() const { return m_shutdown; }
|
||||
bool isShuttingdown() const { return m_state.shutdown; }
|
||||
bool isRestart();
|
||||
|
||||
ScreenPlacement &placementStrategy() { return *m_placement_strategy; }
|
||||
|
@ -479,8 +478,8 @@ private:
|
|||
|
||||
Icons m_icon_list;
|
||||
|
||||
std::auto_ptr<Slit> m_slit;
|
||||
std::auto_ptr<Toolbar> m_toolbar;
|
||||
std::auto_ptr<Slit> m_slit;
|
||||
std::auto_ptr<Toolbar> m_toolbar;
|
||||
|
||||
Workspace *m_current_workspace;
|
||||
|
||||
|
@ -516,7 +515,6 @@ private:
|
|||
typedef std::map<Window, WinClient *> Groupables;
|
||||
Groupables m_expecting_groups;
|
||||
|
||||
bool m_cycling;
|
||||
const ClientPattern *m_cycle_opts;
|
||||
|
||||
// Xinerama related private data
|
||||
|
@ -536,10 +534,13 @@ private:
|
|||
|
||||
std::vector<HeadArea*> m_head_areas;
|
||||
|
||||
|
||||
bool m_restart;
|
||||
bool m_shutdown;
|
||||
bool managed;
|
||||
struct {
|
||||
bool cycling;
|
||||
bool restart;
|
||||
bool shutdown;
|
||||
bool managed;
|
||||
} m_state;
|
||||
unsigned int m_opts; // hold Fluxbox::OPT_SLIT etc
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -129,6 +129,8 @@ int FluxboxCli::Options::parse(int argc, char** argv) {
|
|||
"-display <string>\t\tuse display connection.\n"
|
||||
"-screen <all|int,int,int>\trun on specified screens only.\n"
|
||||
"-rc <string>\t\t\tuse alternate resource file.\n"
|
||||
"-no-slit\t\t\tdo not provide a slit.\n"
|
||||
"-no-toolbar\t\t\tdo not provide a toolbar.\n"
|
||||
"-version\t\t\tdisplay version and exit.\n"
|
||||
"-info\t\t\t\tdisplay some useful information.\n"
|
||||
"-list-commands\t\t\tlist all valid key commands.\n"
|
||||
|
@ -136,7 +138,7 @@ int FluxboxCli::Options::parse(int argc, char** argv) {
|
|||
"-log <filename>\t\t\tlog output to file.\n"
|
||||
"-help\t\t\t\tdisplay this help text and exit.\n\n",
|
||||
|
||||
"Main usage string. Please lay it out nicely. There is one %s that is given the version").c_str(),
|
||||
"Main usage string. Please lay it out nicely. One %%s gives the version, ther other gives the year").c_str(),
|
||||
__fluxbox_version, "2001-2015");
|
||||
return EXIT_SUCCESS;
|
||||
} else if (arg == "-info" || arg == "-i" || arg == "--info") {
|
||||
|
|
194
src/fluxbox.cc
194
src/fluxbox.cc
|
@ -81,10 +81,6 @@
|
|||
|
||||
// system headers
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
@ -111,6 +107,10 @@
|
|||
#include <memory>
|
||||
#include <algorithm>
|
||||
#include <typeinfo>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
|
@ -230,54 +230,54 @@ int s_randr_event_type = 0; ///< the type number of randr event
|
|||
int s_shape_eventbase = 0; ///< event base for shape events
|
||||
bool s_have_shape = false ; ///< if shape is supported by server
|
||||
|
||||
Atom s_kwm1_dockwindow;
|
||||
Atom s_kwm2_dockwindow;
|
||||
|
||||
Fluxbox* s_singleton = 0;
|
||||
|
||||
} // end anonymous
|
||||
|
||||
|
||||
bool Fluxbox::haveShape() const { return s_have_shape; }
|
||||
int Fluxbox::shapeEventbase() const { return s_shape_eventbase; }
|
||||
Fluxbox* Fluxbox::instance() { return s_singleton; }
|
||||
|
||||
Fluxbox::Config::Config(FbTk::ResourceManager& rm, const std::string& path) :
|
||||
ignore_border(rm, false, "session.ignoreBorder", "Session.IgnoreBorder"),
|
||||
pseudotrans(rm, false, "session.forcePseudoTransparency", "Session.forcePseudoTransparency"),
|
||||
colors_per_channel(rm, 4, "session.colorsPerChannel", "Session.ColorsPerChannel"),
|
||||
double_click_interval(rm, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"),
|
||||
tabs_padding(rm, 0, "session.tabPadding", "Session.TabPadding"),
|
||||
style_file(rm, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"),
|
||||
overlay_file(rm, path + "/overlay", "session.styleOverlay", "Session.StyleOverlay"),
|
||||
menu_file(rm, path + "/menu", "session.menuFile", "Session.MenuFile"),
|
||||
key_file(rm, path + "/keys", "session.keyFile", "Session.KeyFile"),
|
||||
slit_file(rm, path + "/slitlist", "session.slitlistFile", "Session.SlitlistFile"),
|
||||
apps_file(rm, path + "/apps", "session.appsFile", "Session.AppsFile"),
|
||||
tabs_attach_area(rm, ATTACH_AREA_WINDOW, "session.tabsAttachArea", "Session.TabsAttachArea"),
|
||||
cache_life(rm, 5, "session.cacheLife", "Session.CacheLife"),
|
||||
cache_max(rm, 200, "session.cacheMax", "Session.CacheMax"),
|
||||
auto_raise_delay(rm, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay") {
|
||||
}
|
||||
|
||||
Fluxbox::Fluxbox(int argc, char **argv,
|
||||
const std::string& dpy_name,
|
||||
const std::string& rc_path, const std::string& rc_filename, bool xsync)
|
||||
: FbTk::App(dpy_name.c_str()),
|
||||
m_fbatoms(FbAtoms::instance()),
|
||||
m_resourcemanager(rc_filename.c_str(), true),
|
||||
// TODO: shouldn't need a separate one for screen
|
||||
m_screen_rm(m_resourcemanager),
|
||||
|
||||
m_RC_PATH(rc_path),
|
||||
m_rc_ignoreborder(m_resourcemanager, false, "session.ignoreBorder", "Session.IgnoreBorder"),
|
||||
m_rc_pseudotrans(m_resourcemanager, false, "session.forcePseudoTransparency", "Session.forcePseudoTransparency"),
|
||||
m_rc_colors_per_channel(m_resourcemanager, 4,
|
||||
"session.colorsPerChannel", "Session.ColorsPerChannel"),
|
||||
m_rc_double_click_interval(m_resourcemanager, 250, "session.doubleClickInterval", "Session.DoubleClickInterval"),
|
||||
m_rc_tabs_padding(m_resourcemanager, 0, "session.tabPadding", "Session.TabPadding"),
|
||||
m_rc_stylefile(m_resourcemanager, DEFAULTSTYLE, "session.styleFile", "Session.StyleFile"),
|
||||
m_rc_styleoverlayfile(m_resourcemanager, m_RC_PATH + "/overlay", "session.styleOverlay", "Session.StyleOverlay"),
|
||||
m_rc_menufile(m_resourcemanager, m_RC_PATH + "/menu", "session.menuFile", "Session.MenuFile"),
|
||||
m_rc_keyfile(m_resourcemanager, m_RC_PATH + "/keys", "session.keyFile", "Session.KeyFile"),
|
||||
m_rc_slitlistfile(m_resourcemanager, m_RC_PATH + "/slitlist", "session.slitlistFile", "Session.SlitlistFile"),
|
||||
m_rc_appsfile(m_resourcemanager, m_RC_PATH + "/apps", "session.appsFile", "Session.AppsFile"),
|
||||
m_rc_tabs_attach_area(m_resourcemanager, ATTACH_AREA_WINDOW, "session.tabsAttachArea", "Session.TabsAttachArea"),
|
||||
m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"),
|
||||
m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"),
|
||||
m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"),
|
||||
m_masked_window(0),
|
||||
m_mousescreen(0),
|
||||
m_keyscreen(0),
|
||||
m_screen_rm(m_resourcemanager), // TODO: shouldn't need a separate one for screen
|
||||
m_config(m_resourcemanager, rc_path),
|
||||
m_last_time(0),
|
||||
m_masked(0),
|
||||
m_rc_file(rc_filename),
|
||||
m_masked_window(0),
|
||||
m_argv(argv), m_argc(argc),
|
||||
m_showing_dialog(false),
|
||||
m_starting(true),
|
||||
m_restarting(false),
|
||||
m_shutdown(false),
|
||||
m_server_grabs(0) {
|
||||
|
||||
_FB_USES_NLS;
|
||||
|
||||
m_state.restarting = false;
|
||||
m_state.shutdown = false;
|
||||
m_state.starting = true;
|
||||
|
||||
if (s_singleton != 0)
|
||||
throw _FB_CONSOLETEXT(Fluxbox, FatalSingleton, "Fatal! There can only one instance of fluxbox class.", "Error displayed on weird error where an instance of the Fluxbox class already exists!");
|
||||
|
||||
|
@ -287,14 +287,12 @@ Fluxbox::Fluxbox(int argc, char **argv,
|
|||
"Error message when no X display appears to exist");
|
||||
}
|
||||
|
||||
m_config.file = rc_filename;
|
||||
m_active_screen.mouse = 0;
|
||||
m_active_screen.key = 0;
|
||||
|
||||
Display *disp = FbTk::App::instance()->display();
|
||||
// For KDE dock applets
|
||||
// KDE v1.x
|
||||
s_kwm1_dockwindow = XInternAtom(disp,
|
||||
"KWM_DOCKWINDOW", False);
|
||||
// KDE v2.x
|
||||
s_kwm2_dockwindow = XInternAtom(disp,
|
||||
"_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False);
|
||||
|
||||
// setup X error handler
|
||||
XSetErrorHandler(handleXErrors);
|
||||
XSetIOErrorHandler(handleXIOErrors);
|
||||
|
@ -362,6 +360,8 @@ Fluxbox::Fluxbox(int argc, char **argv,
|
|||
m_key.reset(new Keys);
|
||||
m_key->reconfigure();
|
||||
|
||||
|
||||
unsigned int opts = OPT_SLIT|OPT_TOOLBAR;
|
||||
vector<int> screens;
|
||||
int i;
|
||||
|
||||
|
@ -396,16 +396,21 @@ Fluxbox::Fluxbox(int argc, char **argv,
|
|||
|
||||
if (!vals.empty())
|
||||
swap(scrtmp, screens);
|
||||
} else if (!strcmp(m_argv[i], "-no-slit")) {
|
||||
opts &= ~OPT_SLIT;
|
||||
} else if (!strcmp(m_argv[i], "-no-toolbar")) {
|
||||
opts &= ~OPT_TOOLBAR;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// create screens
|
||||
for (size_t s = 0; s < screens.size(); s++) {
|
||||
std::string sc_nr = FbTk::StringUtil::number2String(screens[s]);
|
||||
for (i = 0; i < static_cast<int>(screens.size()); i++) {
|
||||
std::string sc_nr = FbTk::StringUtil::number2String(screens[i]);
|
||||
BScreen *screen = new BScreen(m_screen_rm.lock(),
|
||||
std::string("session.screen") + sc_nr,
|
||||
std::string("session.Screen") + sc_nr,
|
||||
screens[s], ::ResourceLayer::NUM_LAYERS);
|
||||
screens[i], ::ResourceLayer::NUM_LAYERS, opts);
|
||||
|
||||
// already handled
|
||||
if (! screen->isScreenManaged()) {
|
||||
|
@ -414,16 +419,16 @@ Fluxbox::Fluxbox(int argc, char **argv,
|
|||
}
|
||||
|
||||
// add to our list
|
||||
m_screen_list.push_back(screen);
|
||||
m_screens.push_back(screen);
|
||||
}
|
||||
|
||||
if (m_screen_list.empty()) {
|
||||
if (m_screens.empty()) {
|
||||
throw _FB_CONSOLETEXT(Fluxbox, ErrorNoScreens,
|
||||
"Couldn't find screens to manage.\nMake sure you don't have another window manager running.",
|
||||
"Error message when no unmanaged screens found - usually means another window manager is running");
|
||||
}
|
||||
|
||||
m_keyscreen = m_mousescreen = m_screen_list.front();
|
||||
m_active_screen.key = m_active_screen.mouse = m_screens.front();
|
||||
|
||||
#ifdef USE_EWMH
|
||||
addAtomHandler(new Ewmh());
|
||||
|
@ -437,7 +442,7 @@ Fluxbox::Fluxbox(int argc, char **argv,
|
|||
#endif // REMEMBER
|
||||
|
||||
// init all "screens"
|
||||
STLUtil::forAll(m_screen_list, bind1st(mem_fun(&Fluxbox::initScreen), this));
|
||||
STLUtil::forAll(m_screens, bind1st(mem_fun(&Fluxbox::initScreen), this));
|
||||
|
||||
XAllowEvents(disp, ReplayPointer, CurrentTime);
|
||||
|
||||
|
@ -453,7 +458,7 @@ Fluxbox::Fluxbox(int argc, char **argv,
|
|||
fbdbg<<"--- resource manager lockdepth = "<<m_resourcemanager.lockDepth()<<endl;
|
||||
}
|
||||
|
||||
m_starting = false;
|
||||
m_state.starting = false;
|
||||
//
|
||||
// For dumping theme items
|
||||
// FbTk::ThemeManager::instance().listItems();
|
||||
|
@ -472,7 +477,7 @@ Fluxbox::~Fluxbox() {
|
|||
leaveAll(); // leave all connections
|
||||
|
||||
// destroy screens (after others, as they may do screen things)
|
||||
FbTk::STLUtil::destroyAndClear(m_screen_list);
|
||||
FbTk::STLUtil::destroyAndClear(m_screens);
|
||||
|
||||
FbTk::STLUtil::destroyAndClear(m_atomhandler);
|
||||
}
|
||||
|
@ -516,7 +521,7 @@ void Fluxbox::eventLoop() {
|
|||
|
||||
Display *disp = display();
|
||||
|
||||
while (!m_shutdown) {
|
||||
while (!m_state.shutdown) {
|
||||
|
||||
if (XPending(disp)) {
|
||||
XEvent e;
|
||||
|
@ -584,20 +589,19 @@ void Fluxbox::handleEvent(XEvent * const e) {
|
|||
// update key/mouse screen and last time before we enter other eventhandlers
|
||||
if (e->type == KeyPress ||
|
||||
e->type == KeyRelease) {
|
||||
m_keyscreen = searchScreen(e->xkey.root);
|
||||
m_active_screen.key = searchScreen(e->xkey.root);
|
||||
} else if (e->type == ButtonPress ||
|
||||
e->type == ButtonRelease ||
|
||||
e->type == MotionNotify ) {
|
||||
m_last_time = e->xbutton.time;
|
||||
if (e->type == MotionNotify)
|
||||
m_last_time = e->xmotion.time;
|
||||
else
|
||||
m_last_time = e->xbutton.time;
|
||||
|
||||
m_mousescreen = searchScreen(e->xbutton.root);
|
||||
m_active_screen.mouse = searchScreen(e->xbutton.root);
|
||||
} else if (e->type == EnterNotify ||
|
||||
e->type == LeaveNotify) {
|
||||
m_last_time = e->xcrossing.time;
|
||||
m_mousescreen = searchScreen(e->xcrossing.root);
|
||||
m_active_screen.mouse = searchScreen(e->xcrossing.root);
|
||||
} else if (e->type == PropertyNotify) {
|
||||
m_last_time = e->xproperty.time;
|
||||
// check transparency atoms if it's a root pm
|
||||
|
@ -632,7 +636,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
|
|||
xwc.sibling = e->xconfigurerequest.above;
|
||||
xwc.stack_mode = e->xconfigurerequest.detail;
|
||||
|
||||
XConfigureWindow(FbTk::App::instance()->display(),
|
||||
XConfigureWindow(display(),
|
||||
e->xconfigurerequest.window,
|
||||
e->xconfigurerequest.value_mask, &xwc);
|
||||
}
|
||||
|
@ -760,14 +764,14 @@ void Fluxbox::handleEvent(XEvent * const e) {
|
|||
|
||||
if (FbTk::Menu::focused() &&
|
||||
FbTk::Menu::focused()->window() == e->xfocus.window) {
|
||||
m_keyscreen = findScreen(FbTk::Menu::focused()->screenNumber());
|
||||
m_active_screen.key = findScreen(FbTk::Menu::focused()->screenNumber());
|
||||
FocusControl::setFocusedWindow(0);
|
||||
break;
|
||||
}
|
||||
|
||||
WinClient *winclient = searchWindow(e->xfocus.window);
|
||||
if (winclient)
|
||||
m_keyscreen = &winclient->screen();
|
||||
m_active_screen.key = &winclient->screen();
|
||||
FocusControl::setFocusedWindow(winclient);
|
||||
|
||||
} break;
|
||||
|
@ -981,8 +985,8 @@ BScreen *Fluxbox::searchScreen(Window window) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
ScreenList::iterator it = m_screen_list.begin();
|
||||
ScreenList::iterator it_end = m_screen_list.end();
|
||||
ScreenList::iterator it = m_screens.begin();
|
||||
ScreenList::iterator it_end = m_screens.end();
|
||||
for (; it != it_end; ++it) {
|
||||
if (*it && (*it)->rootWindow() == window_root)
|
||||
return *it;
|
||||
|
@ -1058,9 +1062,9 @@ void Fluxbox::removeGroupSearch(Window window) {
|
|||
|
||||
/// restarts fluxbox
|
||||
void Fluxbox::restart(const char *prog) {
|
||||
shutdown();
|
||||
|
||||
m_restarting = true;
|
||||
shutdown();
|
||||
m_state.restarting = true;
|
||||
|
||||
if (prog && *prog != '\0') {
|
||||
m_restart_argument = prog;
|
||||
|
@ -1072,11 +1076,11 @@ void Fluxbox::restart(const char *prog) {
|
|||
// already. trying to cleanup over a shaky xserver connection is pointless and
|
||||
// might lead to hangups.
|
||||
void Fluxbox::shutdown(int x_wants_down) {
|
||||
if (m_shutdown)
|
||||
if (m_state.shutdown)
|
||||
return;
|
||||
|
||||
Display *dpy = FbTk::App::instance()->display();
|
||||
m_shutdown = true;
|
||||
m_state.shutdown = true;
|
||||
|
||||
#ifdef HAVE_ALARM
|
||||
// give ourself 2 seconds (randomly picked randon number) to shutdown
|
||||
|
@ -1088,7 +1092,7 @@ void Fluxbox::shutdown(int x_wants_down) {
|
|||
XSetInputFocus(dpy, PointerRoot, None, CurrentTime);
|
||||
|
||||
if (x_wants_down == 0) {
|
||||
STLUtil::forAll(m_screen_list, mem_fun(&BScreen::shutdown));
|
||||
STLUtil::forAll(m_screens, mem_fun(&BScreen::shutdown));
|
||||
sync(false);
|
||||
}
|
||||
}
|
||||
|
@ -1107,8 +1111,8 @@ void Fluxbox::save_rc() {
|
|||
cerr<<_FB_CONSOLETEXT(Fluxbox, BadRCFile, "rc filename is invalid!", "Bad settings file")<<endl;
|
||||
|
||||
|
||||
ScreenList::iterator it = m_screen_list.begin();
|
||||
ScreenList::iterator it_end = m_screen_list.end();
|
||||
ScreenList::iterator it = m_screens.begin();
|
||||
ScreenList::iterator it_end = m_screens.end();
|
||||
for (; it != it_end; ++it) {
|
||||
BScreen *screen = *it;
|
||||
|
||||
|
@ -1143,14 +1147,14 @@ void Fluxbox::save_rc() {
|
|||
|
||||
/// @return filename of resource file
|
||||
string Fluxbox::getRcFilename() {
|
||||
if (m_rc_file.empty())
|
||||
if (m_config.file.empty())
|
||||
return getDefaultDataFilename(RC_INIT_FILE);
|
||||
return m_rc_file;
|
||||
return m_config.file;
|
||||
}
|
||||
|
||||
/// Provides default filename of data file
|
||||
string Fluxbox::getDefaultDataFilename(const char *name) const {
|
||||
return m_RC_PATH + string("/") + name;
|
||||
return m_config.path + string("/") + name;
|
||||
}
|
||||
|
||||
/// loads resources
|
||||
|
@ -1171,20 +1175,20 @@ void Fluxbox::load_rc() {
|
|||
cerr<<_FB_CONSOLETEXT(Fluxbox, CantLoadRCFile, "Failed to load database", "")<<": "<<DEFAULT_INITFILE<<endl;
|
||||
}
|
||||
|
||||
if (m_rc_menufile->empty())
|
||||
m_rc_menufile.setDefaultValue();
|
||||
if (m_config.menu_file->empty())
|
||||
m_config.menu_file.setDefaultValue();
|
||||
|
||||
FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans);
|
||||
FbTk::Transparent::usePseudoTransparent(*m_config.pseudotrans);
|
||||
|
||||
if (m_rc_slitlistfile->empty()) {
|
||||
if (m_config.slit_file->empty()) {
|
||||
string filename = getDefaultDataFilename("slitlist");
|
||||
m_rc_slitlistfile.setFromString(filename.c_str());
|
||||
m_config.slit_file.setFromString(filename.c_str());
|
||||
}
|
||||
|
||||
*m_rc_colors_per_channel = FbTk::Util::clamp(*m_rc_colors_per_channel, 2, 6);
|
||||
*m_config.colors_per_channel = FbTk::Util::clamp(*m_config.colors_per_channel, 2, 6);
|
||||
|
||||
if (m_rc_stylefile->empty())
|
||||
*m_rc_stylefile = DEFAULTSTYLE;
|
||||
if (m_config.style_file->empty())
|
||||
*m_config.style_file = DEFAULTSTYLE;
|
||||
}
|
||||
|
||||
void Fluxbox::load_rc(BScreen &screen) {
|
||||
|
@ -1198,7 +1202,6 @@ void Fluxbox::load_rc(BScreen &screen) {
|
|||
if (database==0)
|
||||
database = XrmGetFileDatabase(DEFAULT_INITFILE);
|
||||
|
||||
|
||||
screen.removeWorkspaceNames();
|
||||
|
||||
std::string screen_number = FbTk::StringUtil::number2String(screen.screenNumber());
|
||||
|
@ -1252,14 +1255,14 @@ void Fluxbox::reconfigure() {
|
|||
|
||||
void Fluxbox::real_reconfigure() {
|
||||
|
||||
FbTk::Transparent::usePseudoTransparent(*m_rc_pseudotrans);
|
||||
FbTk::Transparent::usePseudoTransparent(*m_config.pseudotrans);
|
||||
|
||||
ScreenList::iterator screen_it = m_screen_list.begin();
|
||||
ScreenList::iterator screen_it_end = m_screen_list.end();
|
||||
ScreenList::iterator screen_it = m_screens.begin();
|
||||
ScreenList::iterator screen_it_end = m_screens.end();
|
||||
for (; screen_it != screen_it_end; ++screen_it)
|
||||
load_rc(*(*screen_it));
|
||||
|
||||
STLUtil::forAll(m_screen_list, mem_fun(&BScreen::reconfigure));
|
||||
STLUtil::forAll(m_screens, mem_fun(&BScreen::reconfigure));
|
||||
m_key->reconfigure();
|
||||
STLUtil::forAll(m_atomhandler, mem_fun(&AtomHandler::reconfigure));
|
||||
}
|
||||
|
@ -1267,10 +1270,10 @@ void Fluxbox::real_reconfigure() {
|
|||
BScreen *Fluxbox::findScreen(int id) {
|
||||
|
||||
BScreen* result = 0;
|
||||
ScreenList::iterator it = find_if(m_screen_list.begin(), m_screen_list.end(),
|
||||
ScreenList::iterator it = find_if(m_screens.begin(), m_screens.end(),
|
||||
FbTk::CompareEqual<BScreen>(&BScreen::screenNumber, id));
|
||||
|
||||
if (it != m_screen_list.end())
|
||||
if (it != m_screens.end())
|
||||
result = *it;
|
||||
|
||||
return result;
|
||||
|
@ -1284,8 +1287,8 @@ void Fluxbox::timed_reconfigure() {
|
|||
}
|
||||
|
||||
void Fluxbox::revertFocus() {
|
||||
bool revert = m_keyscreen && !m_showing_dialog;
|
||||
|
||||
bool revert = m_active_screen.key && !m_showing_dialog;
|
||||
if (revert) {
|
||||
// see if there are any more focus events in the queue
|
||||
XEvent ev;
|
||||
|
@ -1301,12 +1304,12 @@ void Fluxbox::revertFocus() {
|
|||
// we only want to revert focus if it's left dangling, as some other
|
||||
// application may have set the focus to an unmanaged window
|
||||
if (win != None && win != PointerRoot && !searchWindow(win) &&
|
||||
win != m_keyscreen->rootWindow().window())
|
||||
win != m_active_screen.key->rootWindow().window())
|
||||
revert = false;
|
||||
}
|
||||
|
||||
if (revert)
|
||||
FocusControl::revertFocus(*m_keyscreen);
|
||||
FocusControl::revertFocus(*m_active_screen.key);
|
||||
else
|
||||
FocusControl::setFocusedWindow(0);
|
||||
}
|
||||
|
@ -1360,17 +1363,4 @@ void Fluxbox::workspaceAreaChanged(BScreen &screen) {
|
|||
CallMemFunWithRefArg<AtomHandler, BScreen&, void>(&AtomHandler::updateWorkarea, screen));
|
||||
}
|
||||
|
||||
bool Fluxbox::haveShape() const {
|
||||
return s_have_shape;
|
||||
}
|
||||
|
||||
int Fluxbox::shapeEventbase() const {
|
||||
return s_shape_eventbase;
|
||||
}
|
||||
|
||||
Fluxbox* Fluxbox::instance() {
|
||||
return s_singleton;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
192
src/fluxbox.hh
192
src/fluxbox.hh
|
@ -34,16 +34,6 @@
|
|||
|
||||
#include <X11/Xresource.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#ifdef HAVE_CSTDIO
|
||||
#include <cstdio>
|
||||
#else
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef TIME_WITH_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
@ -60,6 +50,7 @@
|
|||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdio>
|
||||
|
||||
class AtomHandler;
|
||||
class FluxboxWindow;
|
||||
|
@ -75,61 +66,71 @@ class FbAtoms;
|
|||
class Fluxbox : public FbTk::App,
|
||||
private FbTk::SignalTracker {
|
||||
public:
|
||||
|
||||
typedef std::list<BScreen *> ScreenList;
|
||||
|
||||
enum {
|
||||
OPT_TOOLBAR = 1 << 0,
|
||||
OPT_SLIT = 1 << 1
|
||||
};
|
||||
|
||||
/// obsolete
|
||||
enum TabsAttachArea{ATTACH_AREA_WINDOW= 0, ATTACH_AREA_TITLEBAR};
|
||||
|
||||
|
||||
static Fluxbox *instance();
|
||||
|
||||
|
||||
Fluxbox(int argc, char **argv,
|
||||
const std::string& dpy_name,
|
||||
const std::string& rc_path, const std::string& rc_filename,
|
||||
bool xsync = false);
|
||||
virtual ~Fluxbox();
|
||||
|
||||
static Fluxbox *instance();
|
||||
|
||||
/// main event loop
|
||||
void eventLoop();
|
||||
bool validateWindow(Window win) const;
|
||||
bool validateClient(const WinClient *client) const;
|
||||
|
||||
void grab();
|
||||
void ungrab();
|
||||
Keys *keys() { return m_key.get(); }
|
||||
Atom getFluxboxPidAtom() const { return m_fluxbox_pid; }
|
||||
|
||||
// Not currently implemented until we decide how it'll be used
|
||||
//WinClient *searchGroup(Window);
|
||||
WinClient *searchWindow(Window);
|
||||
|
||||
void initScreen(BScreen *screen);
|
||||
BScreen *searchScreen(Window w);
|
||||
|
||||
unsigned int getDoubleClickInterval() const { return *m_rc_double_click_interval; }
|
||||
WinClient *searchWindow(Window);
|
||||
BScreen *searchScreen(Window w);
|
||||
bool validateWindow(Window win) const;
|
||||
bool validateClient(const WinClient *client) const;
|
||||
|
||||
// Not currently implemented until we decide how it'll be used
|
||||
//WinClient *searchGroup(Window);
|
||||
|
||||
Time getLastTime() const { return m_last_time; }
|
||||
|
||||
AtomHandler *getAtomHandler(const std::string &name);
|
||||
void addAtomHandler(AtomHandler *atomh);
|
||||
void removeAtomHandler(AtomHandler *atomh);
|
||||
|
||||
/// obsolete
|
||||
enum TabsAttachArea{ATTACH_AREA_WINDOW= 0, ATTACH_AREA_TITLEBAR};
|
||||
|
||||
std::string getDefaultDataFilename(const char *name) const;
|
||||
|
||||
bool getIgnoreBorder() const { return *m_rc_ignoreborder; }
|
||||
bool &getPseudoTrans() { return *m_rc_pseudotrans; }
|
||||
|
||||
Fluxbox::TabsAttachArea getTabsAttachArea() const { return *m_rc_tabs_attach_area; }
|
||||
const std::string &getStyleFilename() const { return *m_rc_stylefile; }
|
||||
const std::string &getStyleOverlayFilename() const { return *m_rc_styleoverlayfile; }
|
||||
|
||||
const std::string &getMenuFilename() const { return *m_rc_menufile; }
|
||||
const std::string &getSlitlistFilename() const { return *m_rc_slitlistfile; }
|
||||
const std::string &getAppsFilename() const { return *m_rc_appsfile; }
|
||||
const std::string &getKeysFilename() const { return *m_rc_keyfile; }
|
||||
int colorsPerChannel() const { return *m_rc_colors_per_channel; }
|
||||
int getTabsPadding() const { return *m_rc_tabs_padding; }
|
||||
|
||||
|
||||
time_t getAutoRaiseDelay() const { return *m_rc_auto_raise_delay; }
|
||||
|
||||
unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; }
|
||||
unsigned int getCacheMax() const { return *m_rc_cache_max; }
|
||||
bool &getPseudoTrans() { return *m_config.pseudotrans; }
|
||||
bool getIgnoreBorder() const { return *m_config.ignore_border; }
|
||||
Fluxbox::TabsAttachArea getTabsAttachArea() const { return *m_config.tabs_attach_area; }
|
||||
const std::string &getStyleFilename() const { return *m_config.style_file; }
|
||||
const std::string &getStyleOverlayFilename() const { return *m_config.overlay_file; }
|
||||
const std::string &getMenuFilename() const { return *m_config.menu_file; }
|
||||
const std::string &getSlitlistFilename() const { return *m_config.slit_file; }
|
||||
const std::string &getAppsFilename() const { return *m_config.apps_file; }
|
||||
const std::string &getKeysFilename() const { return *m_config.key_file; }
|
||||
int colorsPerChannel() const { return *m_config.colors_per_channel; }
|
||||
int getTabsPadding() const { return *m_config.tabs_padding; }
|
||||
unsigned int getDoubleClickInterval() const { return *m_config.double_click_interval; }
|
||||
time_t getAutoRaiseDelay() const { return *m_config.auto_raise_delay; }
|
||||
unsigned int getCacheLife() const { return *m_config.cache_life * 60000; }
|
||||
unsigned int getCacheMax() const { return *m_config.cache_max; }
|
||||
|
||||
|
||||
void maskWindowEvents(Window w, FluxboxWindow *bw)
|
||||
|
@ -137,7 +138,7 @@ public:
|
|||
|
||||
void shutdown(int x_wants_down = 0);
|
||||
void load_rc(BScreen &scr);
|
||||
void saveStyleFilename(const char *val) { m_rc_stylefile = (val == 0 ? "" : val); }
|
||||
void saveStyleFilename(const char *val) { m_config.style_file = (val == 0 ? "" : val); }
|
||||
void saveWindowSearch(Window win, WinClient *winclient);
|
||||
// some windows relate to the group, not the client, so we record separately
|
||||
// searchWindow on these windows will give the active client in the group
|
||||
|
@ -162,25 +163,23 @@ public:
|
|||
m_showing_dialog = value; if (!value) revertFocus();
|
||||
}
|
||||
|
||||
bool isStartup() const { return m_starting; }
|
||||
bool isRestarting() const { return m_restarting; }
|
||||
bool isShuttingDown() const { return m_shutdown; }
|
||||
bool isStartup() const { return m_state.starting; }
|
||||
bool isRestarting() const { return m_state.restarting; }
|
||||
bool isShuttingDown() const { return m_state.shutdown; }
|
||||
|
||||
const std::string &getRestartArgument() const { return m_restart_argument; }
|
||||
|
||||
/// get screen from number
|
||||
BScreen *findScreen(int num);
|
||||
|
||||
typedef std::list<BScreen *> ScreenList;
|
||||
const ScreenList screenList() const { return m_screen_list; }
|
||||
const ScreenList screenList() const { return m_screens; }
|
||||
|
||||
bool haveShape() const;
|
||||
int shapeEventbase() const;
|
||||
std::string getDefaultDataFilename(const char *name) const;
|
||||
// screen mouse was in at last key event
|
||||
BScreen *mouseScreen() { return m_mousescreen; }
|
||||
// screen of window that last key event (i.e. focused window) went to
|
||||
BScreen *keyScreen() { return m_keyscreen; }
|
||||
|
||||
|
||||
BScreen *mouseScreen() { return m_active_screen.mouse; }
|
||||
BScreen *keyScreen() { return m_active_screen.key; }
|
||||
const XEvent &lastEvent() const { return m_last_event; }
|
||||
|
||||
AttentionNoticeHandler &attentionHandler() { return m_attention_handler; }
|
||||
|
@ -188,11 +187,8 @@ public:
|
|||
private:
|
||||
std::string getRcFilename();
|
||||
void load_rc();
|
||||
|
||||
void real_reconfigure();
|
||||
|
||||
void handleEvent(XEvent *xe);
|
||||
|
||||
void handleUnmapNotify(XUnmapEvent &ue);
|
||||
void handleClientMessage(XClientMessageEvent &ce);
|
||||
|
||||
|
@ -222,33 +218,53 @@ private:
|
|||
/// Called when a window layer changes
|
||||
void windowLayerChanged(FluxboxWindow &win);
|
||||
|
||||
std::auto_ptr<FbAtoms> m_fbatoms;
|
||||
|
||||
FbTk::ResourceManager m_resourcemanager, &m_screen_rm;
|
||||
typedef std::map<Window, WinClient *> WinClientMap;
|
||||
typedef std::map<Window, FluxboxWindow *> WindowMap;
|
||||
typedef std::set<AtomHandler *> AtomHandlerContainer;
|
||||
typedef AtomHandlerContainer::iterator AtomHandlerContainerIt;
|
||||
|
||||
std::string m_RC_PATH;
|
||||
|
||||
//--- Resources
|
||||
|
||||
FbTk::Resource<bool> m_rc_ignoreborder;
|
||||
FbTk::Resource<bool> m_rc_pseudotrans;
|
||||
FbTk::Resource<int> m_rc_colors_per_channel,
|
||||
m_rc_double_click_interval,
|
||||
m_rc_tabs_padding;
|
||||
FbTk::Resource<std::string> m_rc_stylefile,
|
||||
m_rc_styleoverlayfile,
|
||||
m_rc_menufile, m_rc_keyfile, m_rc_slitlistfile,
|
||||
m_rc_appsfile;
|
||||
std::auto_ptr<FbAtoms> m_fbatoms;
|
||||
FbTk::ResourceManager m_resourcemanager;
|
||||
FbTk::ResourceManager& m_screen_rm;
|
||||
|
||||
struct Config {
|
||||
Config(FbTk::ResourceManager& rm, const std::string& path);
|
||||
|
||||
std::string path;
|
||||
std::string file;
|
||||
|
||||
FbTk::Resource<bool> ignore_border;
|
||||
FbTk::Resource<bool> pseudotrans;
|
||||
FbTk::Resource<int> colors_per_channel;
|
||||
FbTk::Resource<int> double_click_interval;
|
||||
FbTk::Resource<int> tabs_padding;
|
||||
|
||||
FbTk::Resource<std::string> style_file;
|
||||
FbTk::Resource<std::string> overlay_file;
|
||||
FbTk::Resource<std::string> menu_file;
|
||||
FbTk::Resource<std::string> key_file;
|
||||
FbTk::Resource<std::string> slit_file;
|
||||
FbTk::Resource<std::string> apps_file;
|
||||
|
||||
FbTk::Resource<TabsAttachArea> tabs_attach_area;
|
||||
FbTk::Resource<unsigned int> cache_life;
|
||||
FbTk::Resource<unsigned int> cache_max;
|
||||
FbTk::Resource<time_t> auto_raise_delay;
|
||||
} m_config;
|
||||
|
||||
|
||||
FbTk::Resource<TabsAttachArea> m_rc_tabs_attach_area;
|
||||
FbTk::Resource<unsigned int> m_rc_cache_life, m_rc_cache_max;
|
||||
FbTk::Resource<time_t> m_rc_auto_raise_delay;
|
||||
std::auto_ptr<Keys> m_key;
|
||||
AtomHandlerContainer m_atomhandler;
|
||||
AttentionNoticeHandler m_attention_handler;
|
||||
|
||||
ScreenList m_screens;
|
||||
WinClientMap m_window_search;
|
||||
WindowMap m_window_search_group;
|
||||
|
||||
typedef std::map<Window, WinClient *> WinClientMap;
|
||||
WinClientMap m_window_search;
|
||||
typedef std::map<Window, FluxboxWindow *> WindowMap;
|
||||
WindowMap m_window_search_group;
|
||||
// A window is the group leader, which can map to several
|
||||
// WinClients in the group, it is *not* fluxbox's concept of groups
|
||||
// See ICCCM section 4.1.11
|
||||
|
@ -256,43 +272,37 @@ private:
|
|||
// will have it's window being the group index
|
||||
std::multimap<Window, WinClient *> m_group_search;
|
||||
|
||||
ScreenList m_screen_list;
|
||||
|
||||
Time m_last_time;
|
||||
XEvent m_last_event;
|
||||
|
||||
Window m_masked;
|
||||
FluxboxWindow *m_masked_window;
|
||||
|
||||
BScreen *m_mousescreen, *m_keyscreen;
|
||||
struct {
|
||||
BScreen* mouse;
|
||||
BScreen* key;
|
||||
} m_active_screen;
|
||||
|
||||
Atom m_fluxbox_pid;
|
||||
|
||||
bool m_reconfigure_wait;
|
||||
Time m_last_time;
|
||||
Window m_masked;
|
||||
std::string m_rc_file; ///< resource filename
|
||||
char **m_argv;
|
||||
int m_argc;
|
||||
|
||||
std::string m_restart_argument; ///< what to restart
|
||||
|
||||
XEvent m_last_event;
|
||||
|
||||
///< when we execute reconfig command we must wait until next event round
|
||||
FbTk::Timer m_reconfig_timer;
|
||||
FbTk::Timer m_key_reload_timer;
|
||||
bool m_showing_dialog;
|
||||
|
||||
std::auto_ptr<Keys> m_key;
|
||||
struct {
|
||||
bool starting;
|
||||
bool restarting;
|
||||
bool shutdown;
|
||||
} m_state;
|
||||
|
||||
typedef std::set<AtomHandler *> AtomHandlerContainer;
|
||||
typedef AtomHandlerContainer::iterator AtomHandlerContainerIt;
|
||||
|
||||
AtomHandlerContainer m_atomhandler;
|
||||
|
||||
bool m_starting;
|
||||
bool m_restarting;
|
||||
bool m_shutdown;
|
||||
int m_server_grabs;
|
||||
|
||||
AttentionNoticeHandler m_attention_handler;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue