all repos — openbox @ cee305244662d352a7ad5ab7ae22f6221c064d3d

openbox fork - make it a bit more like ryudo

not using any old blackbox classes anymore!
Dana Jansens danakj@orodu.net
commit

cee305244662d352a7ad5ab7ae22f6221c064d3d

parent

fb0dd6cf9a839f9990ac877bf1b3d469d883b463

M src/Makefile.amsrc/Makefile.am

@@ -15,8 +15,7 @@ bin_PROGRAMS= openbox3

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
M src/bbscreen.ccsrc/bbscreen.cc

@@ -141,7 +141,6 @@ load_rc();

// XXX: ugh resource.wstyle.setImageControl(image_control); - resource.wstyle.setScreenNumber(scrn); LoadStyle(); XGCValues gcv;
M src/main.ccsrc/main.cc

@@ -24,11 +24,11 @@ setlocale(LC_ALL, "");

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); }
M src/openbox.ccsrc/openbox.cc

@@ -6,8 +6,11 @@ #endif

#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>

@@ -41,6 +44,8 @@ #include "gettext.h"

#define _(str) gettext(str) } +#include <algorithm> + namespace ob { Openbox *Openbox::instance = (Openbox *) 0;

@@ -79,9 +84,24 @@

_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);

@@ -106,6 +126,10 @@ _cursors.ll_angle = XCreateFontCursor(otk::OBDisplay::display, XC_ll_angle);

_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 }

@@ -118,6 +142,8 @@

// 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();
M src/openbox.hhsrc/openbox.hh

@@ -17,10 +17,13 @@

#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. /*!

@@ -61,6 +64,9 @@ };

//! 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

@@ -82,6 +88,9 @@

//! 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

@@ -109,6 +118,9 @@

//! 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

@@ -139,7 +151,14 @@ otk::OBTimerQueueManager.

*/ 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; }
M src/screen.ccsrc/screen.cc

@@ -9,6 +9,11 @@ #ifdef HAVE_STDIO_H

# 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) }

@@ -49,12 +54,10 @@

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(),

@@ -64,6 +67,8 @@ _image_control = new otk::BImageControl(Openbox::instance->timerManager(),

_info, true); _image_control->installRootColormap(); _root_cmap_installed = True; + + _style.setImageControl(_image_control); // Set the netwm atoms for geomtery and viewport

@@ -301,6 +306,16 @@ } else

xatom->set(getRootWindow(), otk::OBProperty::net_workarea, otk::OBProperty::Atom_Cardinal, 0, 0); */ +} + + +void OBScreen::loadStyle(const otk::Configuration &config) +{ + _style.load(config); + if (Openbox::instance->state() == Openbox::State_Starting) + return; + + // XXX: make stuff redraw! }
M src/screen.hhsrc/screen.hh

@@ -14,6 +14,8 @@ #include "otk/image.hh"

#include "otk/strut.hh" #include "otk/rect.hh" #include "otk/point.hh" +#include "otk/style.hh" +#include "otk/configuration.hh" // TEMPORARY #include <string>

@@ -52,6 +54,9 @@ const otk::ScreenInfo *_info;

//! 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;

@@ -107,7 +112,11 @@ //! Adds a window's strut to the screen's list of reserved spaces

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; } }; }
M src/xeventhandler.ccsrc/xeventhandler.cc

@@ -8,12 +8,9 @@ #include "xeventhandler.hh"

#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>

@@ -168,12 +165,9 @@ if (!client->positionRequested()) {

// 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);