+void OBClient::toggleClientBorder(bool addborder)
+{
+ // adjust our idea of where the client is, based on its border. When the
+ // border is removed, the client should now be considered to be in a
+ // different position.
+ // when re-adding the border to the client, the same operation needs to be
+ // reversed.
+ int x = _area.x(), y = _area.y();
+ switch(_gravity) {
+ case NorthWestGravity:
+ case WestGravity:
+ case SouthWestGravity:
+ break;
+ case NorthEastGravity:
+ case EastGravity:
+ case SouthEastGravity:
+ if (addborder) x -= _border_width * 2;
+ else x += _border_width * 2;
+ break;
+ }
+ switch(_gravity) {
+ case NorthWestGravity:
+ case NorthGravity:
+ case NorthEastGravity:
+ break;
+ case SouthWestGravity:
+ case SouthGravity:
+ case SouthEastGravity:
+ if (addborder) y -= _border_width * 2;
+ else y += _border_width * 2;
+ break;
+ default:
+ // no change for StaticGravity etc.
+ break;
+ }
+ _area.setPos(x, y);
+
+ if (addborder) {
+ XSetWindowBorderWidth(otk::OBDisplay::display, _window, _border_width);
+
+ // move the client so it is back it the right spot _with_ its border!
+ XMoveWindow(otk::OBDisplay::display, _window, x, y);
+ } else
+ XSetWindowBorderWidth(otk::OBDisplay::display, _window, 0);
+}
+
+