]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
conflicts with python too :\
[chaz/openbox] / src / client.cc
index 07d754624ad29aacbb4b635d52d54e3548ec6572..a22a18a6481afd40d9a4b650805fe04dcfcf976b 100644 (file)
@@ -26,6 +26,7 @@ namespace ob {
 
 OBClient::OBClient(int screen, Window window)
   : otk::OtkEventHandler(),
+    OBWidget(OBWidget::Type_Client),
     frame(0), _screen(screen), _window(window)
 {
   assert(screen >= 0);
@@ -673,8 +674,6 @@ void OBClient::toggleClientBorder(bool addborder)
   case NorthWestGravity:
   case WestGravity:
   case SouthWestGravity:
-    if (addborder) x += _border_width;
-    else           x -= _border_width;
     break;
   case NorthEastGravity:
   case EastGravity:
@@ -687,8 +686,6 @@ void OBClient::toggleClientBorder(bool addborder)
   case NorthWestGravity:
   case NorthGravity:
   case NorthEastGravity:
-    if (addborder) y += _border_width;
-    else           y -= _border_width;
     break;
   case SouthWestGravity:
   case SouthGravity:
@@ -777,6 +774,11 @@ void OBClient::resize(Corner anchor, int w, int h)
   w -= _base_size.x(); 
   h -= _base_size.y();
 
+  // for interactive resizing. have to move half an increment in each
+  // direction.
+  w += _size_inc.x() / 2;
+  h += _size_inc.y() / 2;
+
   // is the window resizable? if it is not, then don't check its sizes, the
   // client can do what it wants and the user can't change it anyhow
   if (_min_size.x() <= _max_size.x() && _min_size.y() <= _max_size.y()) {
@@ -833,6 +835,30 @@ void OBClient::move(int x, int y)
 }
 
 
+void OBClient::close()
+{
+  XEvent ce;
+  const otk::OBProperty *property = Openbox::instance->property();
+
+  if (!(_functions & Func_Close)) return;
+
+  // XXX: itd be cool to do timeouts and shit here for killing the client's
+  //      process off
+
+  ce.xclient.type = ClientMessage;
+  ce.xclient.message_type =  property->atom(otk::OBProperty::wm_protocols);
+  ce.xclient.display = otk::OBDisplay::display;
+  ce.xclient.window = _window;
+  ce.xclient.format = 32;
+  ce.xclient.data.l[0] = property->atom(otk::OBProperty::wm_delete_window);
+  ce.xclient.data.l[1] = CurrentTime;
+  ce.xclient.data.l[2] = 0l;
+  ce.xclient.data.l[3] = 0l;
+  ce.xclient.data.l[4] = 0l;
+  XSendEvent(otk::OBDisplay::display, _window, False, NoEventMask, &ce);
+}
+
+
 void OBClient::configureRequestHandler(const XConfigureRequestEvent &e)
 {
   OtkEventHandler::configureRequestHandler(e);
This page took 0.020734 seconds and 4 git commands to generate.