]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
otk::Timer-ng!! thanks ManMower for this shizznit!
[chaz/openbox] / src / client.cc
index 0fc485c8eec30aa533801761d9dedb0fe8865e5a..df519050fdff001086104e0cdeb003039885f1fc 100644 (file)
@@ -72,7 +72,7 @@ Client::Client(int screen, Window window)
 
 Client::~Client()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   // clean up childrens' references
   while (!_transients.empty()) {
@@ -84,7 +84,7 @@ Client::~Client()
   if (_transient_for)
     _transient_for->_transients.remove(this); // remove from old parent
   
-  if (Openbox::instance->state() != Openbox::State_Exiting) {
+  if (openbox->state() != Openbox::State_Exiting) {
     // these values should not be persisted across a window unmapping/mapping
     property->erase(_window, otk::Property::net_wm_desktop);
     property->erase(_window, otk::Property::net_wm_state);
@@ -94,16 +94,16 @@ Client::~Client()
 
 void Client::getDesktop()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   // defaults to the current desktop
-  _desktop = Openbox::instance->screen(_screen)->desktop();
+  _desktop = openbox->screen(_screen)->desktop();
 
   if (!property->get(_window, otk::Property::net_wm_desktop,
                      otk::Property::Atom_Cardinal,
                      (long unsigned*)&_desktop)) {
     // make sure the hint exists
-    Openbox::instance->property()->set(_window,
+    openbox->property()->set(_window,
                                        otk::Property::net_wm_desktop,
                                        otk::Property::Atom_Cardinal,
                                        (unsigned)_desktop);
@@ -113,7 +113,7 @@ void Client::getDesktop()
 
 void Client::getType()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   _type = (WindowType) -1;
   
@@ -245,7 +245,7 @@ void Client::setupDecorAndFunctions()
 
 void Client::getMwmHints()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   unsigned long num = MwmHints::elements;
   unsigned long *hints;
@@ -273,7 +273,7 @@ void Client::getArea()
   XWindowAttributes wattrib;
   Status ret;
   
-  ret = XGetWindowAttributes(otk::Display::display, _window, &wattrib);
+  ret = XGetWindowAttributes(**otk::display, _window, &wattrib);
   assert(ret != BadWindow);
 
   _area.setRect(wattrib.x, wattrib.y, wattrib.width, wattrib.height);
@@ -283,7 +283,7 @@ void Client::getArea()
 
 void Client::getState()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   _modal = _shaded = _max_horz = _max_vert = _fullscreen = _above = _below =
     _skip_taskbar = _skip_pager = false;
@@ -332,14 +332,14 @@ void Client::getShaped()
 {
   _shaped = false;
 #ifdef   SHAPE
-  if (otk::Display::shape()) {
+  if (otk::display->shape()) {
     int foo;
     unsigned int ufoo;
     int s;
 
-    XShapeSelectInput(otk::Display::display, _window, ShapeNotifyMask);
+    XShapeSelectInput(**otk::display, _window, ShapeNotifyMask);
 
-    XShapeQueryExtents(otk::Display::display, _window, &s, &foo,
+    XShapeQueryExtents(**otk::display, _window, &s, &foo,
                        &foo, &ufoo, &ufoo, &foo, &foo, &foo, &ufoo, &ufoo);
     _shaped = (s != 0);
   }
@@ -368,7 +368,7 @@ void Client::calcLayer() {
         if we don't have a frame, then we aren't mapped yet (and this would
         SIGSEGV :)
       */
-      Openbox::instance->screen(_screen)->restack(true, this); // raise
+      openbox->screen(_screen)->restack(true, this); // raise
     }
   }
 }
@@ -376,7 +376,7 @@ void Client::calcLayer() {
 
 void Client::updateProtocols()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   Atom *proto;
   int num_return = 0;
@@ -385,7 +385,7 @@ void Client::updateProtocols()
   _decorations &= ~Decor_Close;
   _functions &= ~Func_Close;
 
-  if (XGetWMProtocols(otk::Display::display, _window, &proto, &num_return)) {
+  if (XGetWMProtocols(**otk::display, _window, &proto, &num_return)) {
     for (int i = 0; i < num_return; ++i) {
       if (proto[i] == property->atom(otk::Property::wm_delete_window)) {
         _decorations |= Decor_Close;
@@ -419,7 +419,7 @@ void Client::updateNormalHints()
   // point..
 
   // get the hints from the window
-  if (XGetWMNormalHints(otk::Display::display, _window, &size, &ret)) {
+  if (XGetWMNormalHints(**otk::display, _window, &size, &ret)) {
     _positioned = (size.flags & (PPosition|USPosition));
 
     if (size.flags & PWinGravity)
@@ -457,7 +457,7 @@ void Client::updateWMHints()
   _can_focus = true;
   _urgent = false;
   
-  if ((hints = XGetWMHints(otk::Display::display, _window)) != NULL) {
+  if ((hints = XGetWMHints(**otk::display, _window)) != NULL) {
     if (hints->flags & InputHint)
       _can_focus = hints->input;
 
@@ -480,7 +480,7 @@ void Client::updateWMHints()
 
 void Client::updateTitle()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   _title = "";
   
@@ -502,7 +502,7 @@ void Client::updateTitle()
 
 void Client::updateIconTitle()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   _icon_title = "";
   
@@ -521,7 +521,7 @@ void Client::updateIconTitle()
 
 void Client::updateClass()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   // set the defaults
   _app_name = _app_class = _role = "";
@@ -531,15 +531,15 @@ void Client::updateClass()
 
   if (property->get(_window, otk::Property::wm_class,
                     otk::Property::ascii, &num, &v)) {
-    if (num > 0) _app_name = v[0];
-    if (num > 1) _app_class = v[1];
+    if (num > 0) _app_name = v[0].c_str();
+    if (num > 1) _app_class = v[1].c_str();
   }
 
   v.clear();
   num = 1;
   if (property->get(_window, otk::Property::wm_window_role,
                     otk::Property::ascii, &num, &v)) {
-    if (num > 0) _role = v[0];
+    if (num > 0) _role = v[0].c_str();
   }
 }
 
@@ -548,7 +548,7 @@ void Client::updateStrut()
 {
   unsigned long num = 4;
   unsigned long *data;
-  if (!Openbox::instance->property()->get(_window,
+  if (!openbox->property()->get(_window,
                                           otk::Property::net_wm_strut,
                                           otk::Property::Atom_Cardinal,
                                           &num, &data))
@@ -560,7 +560,7 @@ void Client::updateStrut()
     _strut.top = data[2];
     _strut.bottom = data[3];
     
-    Openbox::instance->screen(_screen)->updateStrut();
+    openbox->screen(_screen)->updateStrut();
   }
 
   delete [] data;
@@ -572,16 +572,16 @@ void Client::updateTransientFor()
   Window t = 0;
   Client *c = 0;
 
-  if (XGetTransientForHint(otk::Display::display, _window, &t) &&
+  if (XGetTransientForHint(**otk::display, _window, &t) &&
       t != _window) { // cant be transient to itself!
-    c = Openbox::instance->findClient(t);
+    c = openbox->findClient(t);
     assert(c != this); // if this happens then we need to check for it
 
     if (!c /*XXX: && _group*/) {
       // not transient to a client, see if it is transient for a group
       if (//t == _group->leader() ||
         t == None ||
-        t == otk::Display::screenInfo(_screen)->rootWindow()) {
+        t == otk::display->screenInfo(_screen)->rootWindow()) {
         // window is a transient for its group!
         // XXX: for now this is treated as non-transient.
         //      this needs to be fixed!
@@ -606,15 +606,15 @@ void Client::propertyHandler(const XPropertyEvent &e)
 {
   otk::EventHandler::propertyHandler(e);
   
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   // compress changes to a single property into a single change
   XEvent ce;
-  while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) {
+  while (XCheckTypedEvent(**otk::display, e.type, &ce)) {
     // XXX: it would be nice to compress ALL changes to a property, not just
     //      changes in a row without other props between.
     if (ce.xproperty.atom != e.atom) {
-      XPutBackEvent(otk::Display::display, &ce);
+      XPutBackEvent(**otk::display, &ce);
       break;
     }
   }
@@ -671,13 +671,13 @@ void Client::setDesktop(long target)
   
   _desktop = target;
 
-  Openbox::instance->property()->set(_window,
+  openbox->property()->set(_window,
                                      otk::Property::net_wm_desktop,
                                      otk::Property::Atom_Cardinal,
                                      (unsigned)_desktop);
   
   // 'move' the window to the new desktop
-  if (_desktop == Openbox::instance->screen(_screen)->desktop() ||
+  if (_desktop == openbox->screen(_screen)->desktop() ||
       _desktop == (signed)0xffffffff)
     frame->show();
   else
@@ -687,7 +687,7 @@ void Client::setDesktop(long target)
 
 void Client::setState(StateAction action, long data1, long data2)
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
   bool shadestate = _shaded;
 
   if (!(action == State_Add || action == State_Remove ||
@@ -850,12 +850,12 @@ void Client::toggleClientBorder(bool addborder)
   _area.setPos(x, y);
 
   if (addborder) {
-    XSetWindowBorderWidth(otk::Display::display, _window, _border_width);
+    XSetWindowBorderWidth(**otk::display, _window, _border_width);
 
     // move the client so it is back it the right spot _with_ its border!
-    XMoveWindow(otk::Display::display, _window, x, y);
+    XMoveWindow(**otk::display, _window, x, y);
   } else
-    XSetWindowBorderWidth(otk::Display::display, _window, 0);
+    XSetWindowBorderWidth(**otk::display, _window, 0);
 }
 
 
@@ -865,17 +865,17 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
   
   if (e.format != 32) return;
 
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
   
   if (e.message_type == property->atom(otk::Property::wm_change_state)) {
     // compress changes into a single change
     bool compress = false;
     XEvent ce;
-    while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) {
+    while (XCheckTypedEvent(**otk::display, e.type, &ce)) {
       // XXX: it would be nice to compress ALL messages of a type, not just
       //      messages in a row without other message types between.
       if (ce.xclient.message_type != e.message_type) {
-        XPutBackEvent(otk::Display::display, &ce);
+        XPutBackEvent(**otk::display, &ce);
         break;
       }
       compress = true;
@@ -889,11 +889,11 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
     // compress changes into a single change 
     bool compress = false;
     XEvent ce;
-    while (XCheckTypedEvent(otk::Display::display, e.type, &ce)) {
+    while (XCheckTypedEvent(**otk::display, e.type, &ce)) {
       // XXX: it would be nice to compress ALL messages of a type, not just
       //      messages in a row without other message types between.
       if (ce.xclient.message_type != e.message_type) {
-        XPutBackEvent(otk::Display::display, &ce);
+        XPutBackEvent(**otk::display, &ce);
         break;
       }
       compress = true;
@@ -926,7 +926,7 @@ void Client::clientMessageHandler(const XClientMessageEvent &e)
       shade(false);
     // XXX: deiconify
     focus();
-    Openbox::instance->screen(_screen)->restack(true, this); // raise
+    openbox->screen(_screen)->restack(true, this); // raise
   }
 }
 
@@ -998,7 +998,7 @@ void Client::resize(Corner anchor, int w, int h, int x, int y)
 
   _area.setSize(w, h);
 
-  XResizeWindow(otk::Display::display, _window, w, h);
+  XResizeWindow(**otk::display, _window, w, h);
 
   // resize the frame to match the request
   frame->adjustSize();
@@ -1018,7 +1018,7 @@ void Client::move(int x, int y)
     // yet)
     XEvent event;
     event.type = ConfigureNotify;
-    event.xconfigure.display = otk::Display::display;
+    event.xconfigure.display = **otk::display;
     event.xconfigure.event = _window;
     event.xconfigure.window = _window;
     event.xconfigure.x = x;
@@ -1037,7 +1037,7 @@ void Client::move(int x, int y)
 void Client::close()
 {
   XEvent ce;
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   if (!(_functions & Func_Close)) return;
 
@@ -1049,7 +1049,7 @@ void Client::close()
 
   ce.xclient.type = ClientMessage;
   ce.xclient.message_type =  property->atom(otk::Property::wm_protocols);
-  ce.xclient.display = otk::Display::display;
+  ce.xclient.display = **otk::display;
   ce.xclient.window = _window;
   ce.xclient.format = 32;
   ce.xclient.data.l[0] = property->atom(otk::Property::wm_delete_window);
@@ -1057,13 +1057,13 @@ void Client::close()
   ce.xclient.data.l[2] = 0l;
   ce.xclient.data.l[3] = 0l;
   ce.xclient.data.l[4] = 0l;
-  XSendEvent(otk::Display::display, _window, false, NoEventMask, &ce);
+  XSendEvent(**otk::display, _window, false, NoEventMask, &ce);
 }
 
 
 void Client::changeState()
 {
-  const otk::Property *property = Openbox::instance->property();
+  const otk::Property *property = openbox->property();
 
   unsigned long state[2];
   state[0] = _wmstate;
@@ -1123,24 +1123,24 @@ bool Client::focus() const
   if (_focused) return true;
 
   if (_can_focus)
-    XSetInputFocus(otk::Display::display, _window,
+    XSetInputFocus(**otk::display, _window,
                    RevertToNone, CurrentTime);
 
   if (_focus_notify) {
     XEvent ce;
-    const otk::Property *property = Openbox::instance->property();
+    const otk::Property *property = openbox->property();
     
     ce.xclient.type = ClientMessage;
     ce.xclient.message_type =  property->atom(otk::Property::wm_protocols);
-    ce.xclient.display = otk::Display::display;
+    ce.xclient.display = **otk::display;
     ce.xclient.window = _window;
     ce.xclient.format = 32;
     ce.xclient.data.l[0] = property->atom(otk::Property::wm_take_focus);
-    ce.xclient.data.l[1] = Openbox::instance->lastTime();
+    ce.xclient.data.l[1] = openbox->lastTime();
     ce.xclient.data.l[2] = 0l;
     ce.xclient.data.l[3] = 0l;
     ce.xclient.data.l[4] = 0l;
-    XSendEvent(otk::Display::display, _window, False, NoEventMask, &ce);
+    XSendEvent(**otk::display, _window, False, NoEventMask, &ce);
   }
 
   return true;
@@ -1151,8 +1151,8 @@ void Client::unfocus() const
 {
   if (!_focused) return;
 
-  assert(Openbox::instance->focusedClient() == this);
-  Openbox::instance->setFocusedClient(0);
+  assert(openbox->focusedClient() == this);
+  openbox->setFocusedClient(0);
 }
 
 
@@ -1167,7 +1167,7 @@ void Client::focusHandler(const XFocusChangeEvent &e)
   frame->focus();
   _focused = true;
 
-  Openbox::instance->setFocusedClient(this);
+  openbox->setFocusedClient(this);
 }
 
 
@@ -1182,8 +1182,8 @@ void Client::unfocusHandler(const XFocusChangeEvent &e)
   frame->unfocus();
   _focused = false;
 
-  if (Openbox::instance->focusedClient() == this)
-    Openbox::instance->setFocusedClient(0);
+  if (openbox->focusedClient() == this)
+    openbox->setFocusedClient(0);
 }
 
 
@@ -1239,13 +1239,13 @@ void Client::configureRequestHandler(const XConfigureRequestEvent &e)
     switch (e.detail) {
     case Below:
     case BottomIf:
-      Openbox::instance->screen(_screen)->restack(false, this); // lower
+      openbox->screen(_screen)->restack(false, this); // lower
       break;
 
     case Above:
     case TopIf:
     default:
-      Openbox::instance->screen(_screen)->restack(true, this); // raise
+      openbox->screen(_screen)->restack(true, this); // raise
       break;
     }
   }
@@ -1269,7 +1269,7 @@ void Client::unmapHandler(const XUnmapEvent &e)
   otk::EventHandler::unmapHandler(e);
 
   // this deletes us etc
-  Openbox::instance->screen(_screen)->unmanageWindow(this);
+  openbox->screen(_screen)->unmanageWindow(this);
 }
 
 
@@ -1282,7 +1282,7 @@ void Client::destroyHandler(const XDestroyWindowEvent &e)
   otk::EventHandler::destroyHandler(e);
 
   // this deletes us etc
-  Openbox::instance->screen(_screen)->unmanageWindow(this);
+  openbox->screen(_screen)->unmanageWindow(this);
 }
 
 
@@ -1308,10 +1308,10 @@ void Client::reparentHandler(const XReparentEvent &e)
   // server to deal with after we unmanage the window
   XEvent ev;
   ev.xreparent = e;
-  XPutBackEvent(otk::Display::display, &ev);
+  XPutBackEvent(**otk::display, &ev);
   
   // this deletes us etc
-  Openbox::instance->screen(_screen)->unmanageWindow(this);
+  openbox->screen(_screen)->unmanageWindow(this);
 }
 
 }
This page took 0.0406 seconds and 4 git commands to generate.