X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fclient.cc;h=57bf5161cf75614765292d8400f17e7d18ef5eae;hb=7df3b620e21777dbefa24f381c1a95fafed1c16e;hp=6b67f3c290aa9f1a3909169b84bb2fa2238f2de1;hpb=f7f3cd4085b8210bcefc1fd1f40df6eafea3035e;p=chaz%2Fopenbox diff --git a/src/client.cc b/src/client.cc index 6b67f3c2..57bf5161 100644 --- a/src/client.cc +++ b/src/client.cc @@ -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,11 +22,13 @@ extern "C" { namespace ob { -OBClient::OBClient(Window window) - : _window(window) +OBClient::OBClient(int screen, Window window) + : _screen(screen), _window(window) { assert(window); + ignore_unmaps = 0; + // update EVERYTHING the first time!! // the state is kinda assumed to be normal. is this right? XXX @@ -75,8 +81,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 +130,7 @@ OBClient::OBClient(Window window) _floating ? "yes" : "no", _positioned ? "yes" : "no"); #endif +*/ } @@ -265,7 +274,10 @@ void OBClient::getMwmHints() void OBClient::getArea() { XWindowAttributes wattrib; - assert(XGetWindowAttributes(otk::OBDisplay::display, _window, &wattrib)); + Status ret; + + ret = XGetWindowAttributes(otk::OBDisplay::display, _window, &wattrib); + assert(ret != BadWindow); _area.setRect(wattrib.x, wattrib.y, wattrib.width, wattrib.height); _border_width = wattrib.border_width; @@ -312,9 +324,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 +344,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 +456,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 +503,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 +658,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;