indentation and EventManager usage

This commit is contained in:
fluxgen 2002-12-02 23:49:56 +00:00
parent 29c647645b
commit 0611f932ee

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
// $Id: fluxbox.cc,v 1.84 2002/12/01 13:42:06 rathnor Exp $
// $Id: fluxbox.cc,v 1.85 2002/12/02 23:49:56 fluxgen Exp $
#include "fluxbox.hh"
@ -41,6 +41,7 @@
#include "XrmDatabaseHelper.hh"
#include "AtomHandler.hh"
#include "ImageControl.hh"
#include "EventManager.hh"
//Use GNU extensions
#ifndef _GNU_SOURCE
@ -409,13 +410,11 @@ Fluxbox::Fluxbox(int m_argc, char **m_argv, const char *dpy_name, const char *rc
I18n *i18n = I18n::instance();
if (screenList.size() == 0) {
fprintf(stderr,
throw string(
i18n->
getMessage(
FBNLS::blackboxSet, FBNLS::blackboxNoManagableScreens,
"Fluxbox::Fluxbox: no managable screens found, aborting.\n"));
throw static_cast<int>(3);
"Fluxbox::Fluxbox: no managable screens found, aborting."));
}
XSynchronize(getXDisplay(), False);
@ -572,6 +571,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
case ButtonRelease:
case ButtonPress:
handleButtonEvent(e->xbutton);
FbTk::EventManager::instance()->handleEvent(*e);
break;
case ConfigureRequest:
{
@ -758,7 +758,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
BScreen *screen = (BScreen *) 0;
FluxboxWindow *win = (FluxboxWindow *) 0;
Basemenu *menu = (Basemenu *) 0;
Toolbar *tbar = (Toolbar *) 0;
Tab *tab = (Tab *) 0;
#ifdef SLIT
Slit *slit = (Slit *) 0;
@ -791,9 +791,9 @@ void Fluxbox::handleEvent(XEvent * const e) {
}
} else if ((menu = searchMenu(e->xcrossing.window)))
menu->enterNotifyEvent(&e->xcrossing);
else if ((tbar = searchToolbar(e->xcrossing.window)))
/* else if ((tbar = searchToolbar(e->xcrossing.window)))
tbar->enterNotifyEvent(&e->xcrossing);
else if ((tab = searchTab(e->xcrossing.window))) {
*/else if ((tab = searchTab(e->xcrossing.window))) {
win = tab->getWindow();
if (win->getScreen()->isSloppyFocus() && (! win->isFocused()) &&
(! no_focus)) {
@ -808,11 +808,13 @@ void Fluxbox::handleEvent(XEvent * const e) {
ungrab();
}
}
#ifdef SLIT
else if ((slit = searchSlit(e->xcrossing.window)))
slit->enterNotifyEvent(&e->xcrossing);
#endif // SLIT
else {
FbTk::EventManager::instance()->handleEvent(*e);
}
}
@ -823,7 +825,6 @@ void Fluxbox::handleEvent(XEvent * const e) {
FluxboxWindow *win = (FluxboxWindow *) 0;
Basemenu *menu = (Basemenu *) 0;
Toolbar *tbar = (Toolbar *) 0;
#ifdef SLIT
Slit *slit = (Slit *) 0;
@ -833,13 +834,16 @@ void Fluxbox::handleEvent(XEvent * const e) {
menu->leaveNotifyEvent(&e->xcrossing);
else if ((win = searchWindow(e->xcrossing.window)))
win->installColormap(False);
else if ((tbar = searchToolbar(e->xcrossing.window)))
/* else if ((tbar = searchToolbar(e->xcrossing.window)))
tbar->leaveNotifyEvent(&e->xcrossing);
*/
#ifdef SLIT
else if ((slit = searchSlit(e->xcrossing.window)))
slit->leaveNotifyEvent(&e->xcrossing);
#endif // SLIT
else {
FbTk::EventManager::instance()->handleEvent(*e);
}
}
break;
@ -847,22 +851,21 @@ void Fluxbox::handleEvent(XEvent * const e) {
{
FluxboxWindow *win = (FluxboxWindow *) 0;
Basemenu *menu = (Basemenu *) 0;
Toolbar *tbar = (Toolbar *) 0;
Tab *tab = 0;
if ((win = searchWindow(e->xexpose.window)))
win->exposeEvent(&e->xexpose);
else if ((menu = searchMenu(e->xexpose.window)))
menu->exposeEvent(&e->xexpose);
else if ((tbar = searchToolbar(e->xexpose.window)))
tbar->exposeEvent(&e->xexpose);
else if ((tab = searchTab(e->xexpose.window)))
tab->exposeEvent(&e->xexpose);
else
FbTk::EventManager::instance()->handleEvent(*e);
}
break;
case KeyPress:
handleKeyEvent(e->xkey);
FbTk::EventManager::instance()->handleEvent(*e);
break;
case ColormapNotify: {
BScreen *screen = searchScreen(e->xcolormap.window);
@ -900,7 +903,7 @@ void Fluxbox::handleEvent(XEvent * const e) {
win->shapeEvent(shape_event);
}
#endif // SHAPE
FbTk::EventManager::instance()->handleEvent(*e);
}
}
}
@ -911,16 +914,13 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
{
last_time = be.time;
FluxboxWindow *win = (FluxboxWindow *) 0;
Basemenu *menu = (Basemenu *) 0;
FluxboxWindow *win = 0;
Basemenu *menu = 0;
Tab *tab = 0;
#ifdef SLIT
Slit *slit = (Slit *) 0;
#endif // SLIT
Toolbar *tbar = (Toolbar *) 0;
Tab *tab = 0;
if ((win = searchWindow(be.window))) {
win->buttonPressEvent(&be);
@ -930,15 +930,13 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
} else if ((menu = searchMenu(be.window))) {
menu->buttonPressEvent(&be);
}
#ifdef SLIT
} else if ((slit = searchSlit(be.window))) {
else if ((slit = searchSlit(be.window))) {
slit->buttonPressEvent(&be);
}
#endif // SLIT
} else if ((tbar = searchToolbar(be.window))) {
tbar->buttonPressEvent(&be);
} else if ((tab = searchTab(be.window))) {
else if ((tab = searchTab(be.window))) {
tab->buttonPressEvent(&be);
} else {
ScreenList::iterator it = screenList.begin();
@ -1032,15 +1030,12 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
last_time = be.time;
FluxboxWindow *win = (FluxboxWindow *) 0;
Basemenu *menu = (Basemenu *) 0;
Toolbar *tbar = (Toolbar *) 0;
Tab *tab = 0;
if ((win = searchWindow(be.window)))
win->buttonReleaseEvent(&be);
else if ((menu = searchMenu(be.window)))
menu->buttonReleaseEvent(&be);
else if ((tbar = searchToolbar(be.window)))
tbar->buttonReleaseEvent(&be);
else if ((tab = searchTab(be.window)))
tab->buttonReleaseEvent(&be);
}
@ -1152,12 +1147,11 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) {
switch (ke.type) {
case KeyPress:
{
Toolbar *tbar = searchToolbar(ke.window);
BScreen *screen = searchScreen(ke.window);
if (tbar && tbar->isEditing())
tbar->keyPressEvent(&ke);
else if (screen) {
if (screen) {
#ifdef DEBUG
cerr<<"KeyEvent"<<endl;
#endif
@ -2359,19 +2353,18 @@ void Fluxbox::load_rc(BScreen *screen) {
}
void Fluxbox::loadRootCommand(BScreen *screen) {
XrmDatabase database = (XrmDatabase) 0;
string dbfile(getRcFilename());
database = XrmGetFileDatabase(dbfile.c_str());
if (!database)
XrmDatabaseHelper database(dbfile.c_str());
if (!*database)
database = XrmGetFileDatabase(DEFAULT_INITFILE);
XrmValue value;
char *value_type, name_lookup[1024], class_lookup[1024];
sprintf(name_lookup, "session.screen%d.rootCommand", screen->getScreenNumber());
sprintf(class_lookup, "Session.Screen%d.RootCommand", screen->getScreenNumber());
if (XrmGetResource(database, name_lookup, class_lookup, &value_type,
if (XrmGetResource(*database, name_lookup, class_lookup, &value_type,
&value)) {
screen->saveRootCommand(value.addr==0 ? "": value.addr);
} else