]> Dogcows Code - chaz/openbox/blobdiff - src/screen.cc
adjust how the config is loaded. it is not loaded at all during the screen's construc...
[chaz/openbox] / src / screen.cc
index 3461178d6c3d80ac616af0778c63e3b6ff870da9..e2e701d3c5f4b404cf2cc418c05ab2188efcc951 100644 (file)
@@ -2,6 +2,16 @@
 
 #include "config.h"
 
+#include "screen.hh"
+#include "client.hh"
+#include "openbox.hh"
+#include "frame.hh"
+#include "bindings.hh"
+#include "python.hh"
+#include "otk/display.hh"
+#include "otk/property.hh"
+#include "otk/util.hh"
+
 extern "C" {
 #ifdef    HAVE_UNISTD_H
 #  include <sys/types.h>
@@ -12,15 +22,6 @@ extern "C" {
 #define _(str) gettext(str)
 }
 
-#include "screen.hh"
-#include "client.hh"
-#include "openbox.hh"
-#include "frame.hh"
-#include "bindings.hh"
-#include "python.hh"
-#include "otk/display.hh"
-#include "otk/property.hh"
-
 #include <vector>
 #include <algorithm>
 #include <cstdio>
@@ -39,13 +40,12 @@ namespace ob {
 
 
 Screen::Screen(int screen)
-  : _number(screen)
+  : _number(screen),
+    _config(screen)
 {
   assert(screen >= 0); assert(screen < ScreenCount(**otk::display));
   _info = otk::display->screenInfo(screen);
 
-  _showing_desktop = false;
-
   ::running = false;
   XErrorHandler old = XSetErrorHandler(::anotherWMRunning);
   XSelectInput(**otk::display, _info->rootWindow(),
@@ -68,24 +68,6 @@ Screen::Screen(int screen)
   XDefineCursor(**otk::display, _info->rootWindow(),
                 openbox->cursors().session);
 
-  // XXX: initialize the screen's style
-  /*
-  otk::ustring stylepath;
-  python_get_string("THEME", &stylepath);
-  otk::Configuration sconfig(false);
-  sconfig.setFile(otk::expandTilde(stylepath.c_str()));
-  if (!sconfig.load()) {
-    sconfig.setFile(otk::expandTilde(DEFAULTSTYLE));
-    if (!sconfig.load()) {
-      printf(_("Unable to load default style: %s. Aborting.\n"), DEFAULTSTYLE);
-      ::exit(1);
-    }
-  }
-  _style.load(sconfig);
-  */
-  otk::display->renderControl(_number)->
-    drawRoot(*otk::RenderStyle::style(_number)->rootColor());
-
   // set up notification of netwm support
   changeSupportedAtoms();
 
@@ -96,23 +78,17 @@ Screen::Screen(int screen)
                      otk::Property::atoms.net_desktop_geometry,
                      otk::Property::atoms.cardinal, geometry, 2);
 
-  // Set the net_desktop_names property
-  std::vector<otk::ustring> names;
-  python_get_stringlist("DESKTOP_NAMES", &names);
-  otk::Property::set(_info->rootWindow(),
-                     otk::Property::atoms.net_desktop_names,
-                     otk::Property::utf8, names);
-  // the above set() will cause the updateDesktopNames to fire right away so
-  // we have a list of desktop names
-
   _desktop = 0;
-  
-  if (!python_get_long("NUMBER_OF_DESKTOPS", (long*)&_num_desktops))
-    _num_desktops = 1;
-  changeNumDesktops(_num_desktops); // set the hint
 
+  changeNumDesktops(1); // set the hint
   changeDesktop(0); // set the hint
 
+  // don't start in showing-desktop mode
+  _showing_desktop = false;
+  otk::Property::set(_info->rootWindow(),
+                     otk::Property::atoms.net_showing_desktop,
+                     otk::Property::atoms.cardinal, 0);
+
   // create the window which gets focus when no clients get it
   XSetWindowAttributes attr;
   attr.override_redirect = true;
@@ -682,7 +658,7 @@ void Screen::unmanageWindow(Client *client)
   client->_modal = false;
   
   // unfocus the client (calls the focus callbacks)
-  client->unfocus();
+  if (client->focused()) client->unfocus();
 
 #ifdef DEBUG
   printf("Unmanaged window 0x%lx frame 0x%lx\n", client->window(), framewin);
@@ -863,6 +839,11 @@ void Screen::setDesktopName(unsigned int i, const otk::ustring &name)
                      otk::Property::utf8, newnames);
 }
 
+otk::ustring Screen::desktopName(unsigned int i) const
+{
+  if (i >= _num_desktops) return "";
+  return _desktop_names[i];
+}
 
 const otk::Rect& Screen::area(unsigned int desktop) const {
   assert(desktop < _num_desktops || desktop == 0xffffffff);
This page took 0.023507 seconds and 4 git commands to generate.