]> Dogcows Code - chaz/openbox/commitdiff
not using any old blackbox classes anymore!
authorDana Jansens <danakj@orodu.net>
Mon, 11 Nov 2002 10:05:06 +0000 (10:05 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 11 Nov 2002 10:05:06 +0000 (10:05 +0000)
src/Makefile.am
src/bbscreen.cc
src/main.cc
src/openbox.cc
src/openbox.hh
src/screen.cc
src/screen.hh
src/xeventhandler.cc

index 6fe76c90f55ddf2e472b1e3e156deb9cc1d4c4d7..8034df0e773f5245d12e786e42f21a4b0876d976 100644 (file)
@@ -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
index ebfceb98965d04bbc6a6d0ed110adb2b0cd551f4..fb9303175a2c24568d8dd3761b95761db9a8f423 100644 (file)
@@ -141,7 +141,6 @@ BScreen::BScreen(Blackbox *bb, unsigned int scrn) : ScreenInfo(scrn) {
 
   // XXX: ugh
   resource.wstyle.setImageControl(image_control);
-  resource.wstyle.setScreenNumber(scrn);
   LoadStyle();
 
   XGCValues gcv;
index 3bab740af93c3f78dd70dfe321755d6084eb2459..6b131b92078c681389cd6689eb07d0737928ab34 100644 (file)
@@ -24,11 +24,11 @@ int main(int argc, char **argv) {
   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);
 }
index 6f42bc206157f102c1df8b0654edea7452b75fc5..9d040e14e786b036f37d2bb9bd94fa73a56b4adf 100644 (file)
@@ -6,8 +6,11 @@
 
 #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 @@ extern "C" {
 #define _(str) gettext(str)
 }
 
+#include <algorithm>
+
 namespace ob {
 
 Openbox *Openbox::instance = (Openbox *) 0;
@@ -79,9 +84,24 @@ Openbox::Openbox(int argc, char **argv)
   _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 @@ Openbox::Openbox(int argc, char **argv)
   _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 @@ Openbox::~Openbox()
   // 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();
index ccf2b80aa18634c163048812622e3d824c52ff03..a257cb243cb49dd52e2e75a98f30dafe1a2f4fbb 100644 (file)
@@ -17,11 +17,14 @@ extern "C" {
 #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
@@ -61,6 +64,9 @@ public:
   
   //! 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 @@ private:
   //! 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 @@ private:
   //! 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,8 +151,15 @@ public:
   */
   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; }
 
index 845014a9968756b990316ed5a910bda54ed0056f..51e3aa169f34975862ece70d7b6ec7b6cf2f8dca 100644 (file)
@@ -9,6 +9,11 @@ extern "C" {
 #  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 @@ OBScreen::OBScreen(int screen)
   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(),
@@ -65,6 +68,8 @@ OBScreen::OBScreen(int screen)
   _image_control->installRootColormap();
   _root_cmap_installed = True;
 
+  _style.setImageControl(_image_control);
+
   
   // Set the netwm atoms for geomtery and viewport
   unsigned long geometry[] = { _size.x(),
@@ -304,4 +309,14 @@ void OBScreen::setWorkArea() {
 }
 
 
+void OBScreen::loadStyle(const otk::Configuration &config)
+{
+  _style.load(config);
+  if (Openbox::instance->state() == Openbox::State_Starting)
+    return;
+
+  // XXX: make stuff redraw!
+}
+
+
 }
index 6068e04be09ef79946b9cf5d1d873386d8247c47..d4d42a7c826d45c2bfa02a0ef7d7bb2d94c2967a 100644 (file)
@@ -14,6 +14,8 @@ extern "C" {
 #include "otk/strut.hh"
 #include "otk/rect.hh"
 #include "otk/point.hh"
+#include "otk/style.hh"
+#include "otk/configuration.hh" // TEMPORARY
 
 #include <string>
 
@@ -53,6 +55,9 @@ private:
   //! 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 @@ public:
   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; }
 };
 
 }
index afa5eceeb4095923a28718fd67adf61a3dfd7bd2..560aace26a242cee9845ad5cf5c59ab190180fce 100644 (file)
@@ -8,13 +8,10 @@
 #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>
@@ -168,12 +165,9 @@ void OBXEventHandler::manageWindow(int screen, Window window)
     // 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);
This page took 0.034541 seconds and 4 git commands to generate.