openbox3_LDADD=../otk/libotk.a @LIBINTL@
-openbox3_SOURCES= client.cc frame.cc bbscreen.cc openbox.cc screen.cc \
- bbwindow.cc workspace.cc blackbox.cc \
+openbox3_SOURCES= client.cc frame.cc openbox.cc screen.cc \
main.cc xeventhandler.cc
MAINTAINERCLEANFILES= Makefile.in
// XXX: ugh
resource.wstyle.setImageControl(image_control);
- resource.wstyle.setScreenNumber(scrn);
LoadStyle();
XGCValues gcv;
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- //ob::Openbox openbox(argc, argv);
- ob::Blackbox blackbox(argc, argv, 0);
+ ob::Openbox openbox(argc, argv);
+ //ob::Blackbox blackbox(argc, argv, 0);
//Blackbox blackbox(argv, session_display, rc_file);
- blackbox.eventLoop();
+ openbox.eventLoop();
return(0);
}
#include "../version.h"
#include "openbox.hh"
+#include "screen.hh"
#include "otk/property.hh"
#include "otk/display.hh"
+#include "otk/assassin.hh"
+#include "otk/util.hh" // TEMPORARY
extern "C" {
#include <X11/cursorfont.h>
#define _(str) gettext(str)
}
+#include <algorithm>
+
namespace ob {
Openbox *Openbox::instance = (Openbox *) 0;
_displayreq = (char*) 0;
_argv0 = argv[0];
_doshutdown = false;
+ _rcfilepath = otk::expandTilde("~/.openbox/rc3");
parseCommandLine(argc, argv);
+ // TEMPORARY: using the xrdb rc3
+ _config.setFile(_rcfilepath);
+ if (!_config.load()) {
+ printf("failed to load rc file %s\n", _config.file().c_str());
+ ::exit(2);
+ }
+ std::string s;
+ _config.getValue("session.styleFile", s);
+ _config.setFile(s);
+ if (!_config.load()) {
+ printf("failed to load style %s\n", _config.file().c_str());
+ ::exit(2);
+ }
+
// open the X display (and gets some info about it, and its screens)
otk::OBDisplay::initialize(_displayreq);
assert(otk::OBDisplay::display);
_cursors.lr_angle = XCreateFontCursor(otk::OBDisplay::display, XC_lr_angle);
_cursors.ul_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ul_angle);
_cursors.ur_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ur_angle);
+
+ // initialize all the screens
+ _screens.push_back(new OBScreen(0));
+ _screens[0]->loadStyle(_config);
_state = State_Normal; // done starting
}
// unmanage all windows
while (!_clients.empty())
_xeventhandler.unmanageWindow(_clients.begin()->second);
+
+ std::for_each(_screens.begin(), _screens.end(), otk::PointerAssassin());
// close the X display
otk::OBDisplay::destroy();
#include "otk/screeninfo.hh"
#include "otk/timerqueuemanager.hh"
#include "otk/property.hh"
+#include "otk/configuration.hh"
#include "xeventhandler.hh"
#include "client.hh"
namespace ob {
+class OBScreen;
+
//! The main class for the Openbox window manager.
/*!
Only a single instance of the Openbox class may be used in the application. A
//! A map for looking up a specific client class from the window id
typedef std::map<Window, OBClient *> ClientMap;
+
+ //! A list of OBScreen classes
+ typedef std::vector<OBScreen *> ScreenList;
private:
// stuff that can be passed on the command line
//! A list of all managed clients
ClientMap _clients;
+ //! A list of all the managed screens
+ ScreenList _screens;
+
//! Manages all timers for the application
/*!
Use of the otk::OBTimerQueueManager::fire funtion in this object ensures
//! When set to true, the Openbox::eventLoop function will stop and return
bool _doshutdown;
+ //! The configuration of the application. TEMPORARY
+ otk::Configuration _config;
+
//! Parses the command line used when executing this application
void parseCommandLine(int argv, char **argv);
//! Displays the version string to stdout
*/
inline otk::OBTimerQueueManager *timerManager() { return &_timermanager; }
+ //! Returns the otk::OBProperty instance for the window manager
inline const otk::OBProperty *property() const { return _property; }
+ //! Returns a managed screen
+ inline const OBScreen *screen(int num) const {
+ assert(num >= 0); assert(num < (signed)_screens.size());
+ return _screens[num];
+ }
+
//! Returns the mouse cursors used throughout Openbox
inline const Cursors &cursors() const { return _cursors; }
# include <stdio.h>
#endif // HAVE_STDIO_H
+#ifdef HAVE_UNISTD_H
+# include <sys/types.h>
+# include <unistd.h>
+#endif // HAVE_UNISTD_H
+
#include "gettext.h"
#define _(str) gettext(str)
}
printf(_("Managing screen %d: visual 0x%lx, depth %d\n"),
_number, XVisualIDFromVisual(_info->getVisual()), _info->getDepth());
-#ifdef HAVE_GETPID
Openbox::instance->property()->set(_info->getRootWindow(),
otk::OBProperty::openbox_pid,
otk::OBProperty::Atom_Cardinal,
(unsigned long) getpid());
-#endif // HAVE_GETPID
// set the mouse cursor for the root window (the default cursor)
XDefineCursor(otk::OBDisplay::display, _info->getRootWindow(),
_image_control->installRootColormap();
_root_cmap_installed = True;
+ _style.setImageControl(_image_control);
+
// Set the netwm atoms for geomtery and viewport
unsigned long geometry[] = { _size.x(),
}
+void OBScreen::loadStyle(const otk::Configuration &config)
+{
+ _style.load(config);
+ if (Openbox::instance->state() == Openbox::State_Starting)
+ return;
+
+ // XXX: make stuff redraw!
+}
+
+
}
#include "otk/strut.hh"
#include "otk/rect.hh"
#include "otk/point.hh"
+#include "otk/style.hh"
+#include "otk/configuration.hh" // TEMPORARY
#include <string>
//! The Image Control used for rendering on the screen
otk::BImageControl *_image_control;
+ //! The style with which to render on the screen
+ otk::Style _style;
+
//! Is the root colormap currently installed?
bool _root_cmap_installed;
void addStrut(otk::Strut *strut);
//! Removes a window's strut from the screen's list of reserved spaces
void removeStrut(otk::Strut *strut);
-
+
+ //! Loads a new style on the screen
+ void loadStyle(const otk::Configuration &config);
+
+ inline const otk::Style *style() const { return &_style; }
};
}
#include "client.hh"
#include "frame.hh"
#include "openbox.hh"
+#include "screen.hh"
#include "otk/display.hh"
#include "otk/rect.hh"
-// XXX: REMOVE THIS SOON!!#!
-#include "blackbox.hh"
-#include "bbscreen.hh"
-
extern "C" {
#include <X11/Xlib.h>
#include <X11/Xutil.h>
// XXX: position the window intelligenty
}
- // XXX: store a style somewheres cooler!!
- otk::Style *style = ((Blackbox*)Openbox::instance)->
- searchScreen(RootWindow(otk::OBDisplay::display, screen))->
- getWindowStyle();
// create the decoration frame for the client window
- client->frame = new OBFrame(client, style);
+ client->frame = new OBFrame(client,
+ Openbox::instance->screen(screen)->style());
// add all the client's decoration windows as event handlers for the client
Openbox::instance->addClient(client->frame->window(), client);