]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
move screen.cc/hh to bbscreen.cc/hh
[chaz/openbox] / src / client.cc
index 6b67f3c290aa9f1a3909169b84bb2fa2238f2de1..f770fecd9f842c6625ed89ced3a03ddaef487f46 100644 (file)
@@ -1,7 +1,11 @@
 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
 
+#ifdef HAVE_CONFIG_H
+# include "../config.h"
+#endif
+
 #include "client.hh"
-#include "screen.hh"
+#include "bbscreen.hh"
 #include "openbox.hh"
 #include "otk/display.hh"
 #include "otk/property.hh"
@@ -18,8 +22,8 @@ extern "C" {
 
 namespace ob {
 
-OBClient::OBClient(Window window)
-  : _window(window)
+OBClient::OBClient(int screen, Window window)
+  : _screen(screen), _window(window)
 {
   assert(window);
 
@@ -75,8 +79,10 @@ OBClient::OBClient(Window window)
   updateWMHints();
   // XXX: updateTransientFor();
   updateTitle();
+  updateIconTitle();
   updateClass();
 
+/*
 #ifdef DEBUG
   printf("Mapped window: 0x%lx\n"
          "  title:         \t%s\t  icon title:    \t%s\n"
@@ -122,6 +128,7 @@ OBClient::OBClient(Window window)
          _floating ? "yes" : "no",
          _positioned ? "yes" : "no");
 #endif
+*/
 }
 
 
@@ -312,9 +319,13 @@ void OBClient::getShaped()
   if (otk::OBDisplay::shape()) {
     int foo;
     unsigned int ufoo;
+    int s;
+
+    XShapeSelectInput(otk::OBDisplay::display, _window, ShapeNotifyMask);
 
-    XShapeQueryExtents(otk::OBDisplay::display, client.window, &_shaped, &foo,
+    XShapeQueryExtents(otk::OBDisplay::display, _window, &s, &foo,
                        &foo, &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo);
+    _shaped = (s != 0);
   }
 #endif // SHAPE
 }
@@ -328,6 +339,8 @@ void OBClient::updateProtocols()
   int num_return = 0;
 
   _focus_notify = false;
+  _decorations &= ~Decor_Close;
+  _functions &= ~Func_Close;
 
   if (XGetWMProtocols(otk::OBDisplay::display, _window, &proto, &num_return)) {
     for (int i = 0; i < num_return; ++i) {
@@ -438,6 +451,25 @@ void OBClient::updateTitle()
 }
 
 
+void OBClient::updateIconTitle()
+{
+  const otk::OBProperty *property = Openbox::instance->property();
+
+  _icon_title = "";
+  
+  // try netwm
+  if (! property->get(_window, otk::OBProperty::net_wm_icon_name,
+                      otk::OBProperty::utf8, &_icon_title)) {
+    // try old x stuff
+    property->get(_window, otk::OBProperty::wm_icon_name,
+                  otk::OBProperty::ascii, &_icon_title);
+  }
+
+  if (_title.empty())
+    _icon_title = _("Unnamed Window");
+}
+
+
 void OBClient::updateClass()
 {
   const otk::OBProperty *property = Openbox::instance->property();
@@ -466,10 +498,11 @@ void OBClient::update(const XPropertyEvent &e)
   else if (e.atom == XA_WM_HINTS)
     updateWMHints();
   else if (e.atom == property->atom(otk::OBProperty::net_wm_name) ||
-           e.atom == property->atom(otk::OBProperty::wm_name) ||
-           e.atom == property->atom(otk::OBProperty::net_wm_icon_name) ||
-           e.atom == property->atom(otk::OBProperty::wm_icon_name))
+           e.atom == property->atom(otk::OBProperty::wm_name))
     updateTitle();
+  else if (e.atom == property->atom(otk::OBProperty::net_wm_icon_name) ||
+           e.atom == property->atom(otk::OBProperty::wm_icon_name))
+    updateIconTitle();
   else if (e.atom == property->atom(otk::OBProperty::wm_class))
     updateClass();
   else if (e.atom == property->atom(otk::OBProperty::wm_protocols))
@@ -620,6 +653,14 @@ void OBClient::update(const XClientMessageEvent &e)
 }
 
 
+#if defined(SHAPE) || defined(DOXYGEN_IGNORE)
+void OBClient::update(const XShapeEvent &e)
+{
+  _shaped = e.shaped;
+}
+#endif
+
+
 void OBClient::setArea(const otk::Rect &area)
 {
   _area = area;
This page took 0.027981 seconds and 4 git commands to generate.