]> Dogcows Code - chaz/openbox/commitdiff
some small cleanups
authorDana Jansens <danakj@orodu.net>
Mon, 11 Nov 2002 10:03:11 +0000 (10:03 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 11 Nov 2002 10:03:11 +0000 (10:03 +0000)
make style not take a screen separate from the image control
make style::load() take a const ref

otk/property.cc
otk/property.hh
otk/style.cc
otk/style.hh

index 359bf8bd7ba4d66cf4d6e029849f49d92baacde8..9a0efe5bf6bd00f6e8a04e141713ede1cdf42bc3 100644 (file)
@@ -29,9 +29,7 @@ OBProperty::OBProperty()
   _atoms[Atom_String] = XA_STRING;
   _atoms[Atom_Utf8] = create("UTF8_STRING");
   
-#ifdef    HAVE_GETPID
   _atoms[openbox_pid] = create("_OPENBOX_PID");
-#endif // HAVE_GETPID
 
   _atoms[wm_colormap_windows] = create("WM_COLORMAP_WINDOWS");
   _atoms[wm_protocols] = create("WM_PROTOCOLS");
@@ -162,7 +160,9 @@ OBProperty::~OBProperty()
  */
 Atom OBProperty::create(const char *name) const
 {
-  return XInternAtom(OBDisplay::display, name, False);
+  Atom a = XInternAtom(OBDisplay::display, name, False);
+  assert(a);
+  return a;
 }
 
 
index 2bab9565b9c3ff962cd033c83d1cc12d9b42d145..9e2d7aca7c139e53757ed5d3b79a4de825166a4f 100644 (file)
@@ -33,9 +33,7 @@ public:
     Atom_String,   //!< The atom which represents ascii strings
     Atom_Utf8,     //!< The atom which represents utf8-encoded strings
     
-#ifdef    HAVE_GETPID
     openbox_pid,
-#endif // HAVE_GETPID
 
     // window hints
     wm_colormap_windows,
@@ -160,7 +158,7 @@ public:
 private:
   //! The value of all atoms on the X server that exist in the
   //! OBProperty::Atoms enum
-  Atom                  _atoms[NUM_ATOMS];
+  Atom _atoms[NUM_ATOMS];
 
   //! Gets the value of an Atom from the X server, creating it if nessesary
   Atom create(const char *name) const;
index aa8213007d93f390a627c089b2858ed562f7cc5f..6349a6bcf4a23694222f3663e0794b14b37765b6 100644 (file)
@@ -14,13 +14,9 @@ Style::Style() : font(NULL)
 {
 }
 
-Style::Style(unsigned int screen)
-  : font(0), screen_number(screen)
-{
-}
-
-Style::Style(unsigned int screen, BImageControl *ctrl)
-  : image_control(ctrl), font(0), screen_number(screen)
+Style::Style(BImageControl *ctrl)
+  : image_control(ctrl), font(0),
+    screen_number(ctrl->getScreenInfo()->getScreenNumber())
 {
 }
 
@@ -43,7 +39,7 @@ Style::~Style() {
   stick_button.mask = None;
 }
 
-void Style::load(Configuration &style) {
+void Style::load(const Configuration &style) {
   std::string s;
 
   // load fonts/fontsets
@@ -302,7 +298,11 @@ BFont *Style::readDatabaseFont(const std::string &rbasename,
       return b;
     delete b;
   }
-    
+
+  if (style.getValue(rbasename + "xft.font", s))
+    printf("Unable to load font \"%s\". Exiting\n", s.c_str());
+  else
+    printf("Font not defined by style. Exiting\n");
   exit(2);  // can't continue without a font
 }
 
index d13a1282c3e8dc59d50f51121ed8a9004c97516e..2eb214c577fb7e119187c25e4ba2ea624a1ef255 100644 (file)
@@ -62,8 +62,7 @@ public:
 public:
 
   Style();
-  Style(unsigned int);
-  Style(unsigned int, BImageControl *);
+  Style(BImageControl *);
   ~Style();
 
   void doJustify(const std::string &text, int &start_pos,
@@ -85,7 +84,7 @@ public:
   BFont *readDatabaseFont(const std::string &rbasename,
                           const Configuration &style);
 
-  void load(Configuration &);
+  void load(const Configuration &style);
 
   inline BColor *getBorderColor(void) { return &border_color; }
 
@@ -134,8 +133,10 @@ public:
   inline const BTexture &getFrameFocus() const { return f_focus; }
   inline const BTexture &getFrameUnfocus() const { return f_unfocus; }
 
-  inline void setImageControl(BImageControl *c) { image_control = c; }
-  inline void setScreenNumber(unsigned int scr) { screen_number = scr; }
+  inline void setImageControl(BImageControl *c) {
+    image_control = c;
+    screen_number = c->getScreenInfo()->getScreenNumber();
+  }
   inline unsigned int getScreen(void) { return screen_number; }
 
   // XXX add inline accessors for the rest of the bummy
This page took 0.026415 seconds and 4 git commands to generate.