+
+#ifdef OWN_WINDOW
+/* reserve window manager space */
+void set_struts(int sidenum)
+{
+ Atom strut;
+ if ((strut = ATOM(_NET_WM_STRUT)) != None) {
+ /* reserve space at left, right, top, bottom */
+ signed long sizes[12] = {0};
+ int i;
+
+ /* define strut depth */
+ switch (sidenum) {
+ case 0:
+ /* left side */
+ sizes[0] = window.x + window.width;
+ break;
+ case 1:
+ /* right side */
+ sizes[1] = display_width - window.x;
+ break;
+ case 2:
+ /* top side */
+ sizes[2] = window.y + window.height;
+ break;
+ case 3:
+ /* bottom side */
+ sizes[3] = display_height - window.y;
+ break;
+ }
+
+ /* define partial strut length */
+ if (sidenum <= 1) {
+ sizes[4 + (sidenum*2)] = window.y;
+ sizes[5 + (sidenum*2)] = window.y + window.height;
+ } else if (sidenum <= 3) {
+ sizes[4 + (sidenum*2)] = window.x;
+ sizes[5 + (sidenum*2)] = window.x + window.width;
+ }
+
+ /* check constraints */
+ for (i = 0; i < 12; i++) {
+ if (sizes[i] < 0) {
+ sizes[i] = 0;
+ } else {
+ if (i <= 1 || i >= 8) {
+ if (sizes[i] > display_width) {
+ sizes[i] = display_width;
+ }
+ } else {
+ if (sizes[i] > display_height) {
+ sizes[i] = display_height;
+ }
+ }
+ }
+ }
+
+ XChangeProperty(display, window.window, strut, XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *) &sizes, 4);
+
+ if ((strut = ATOM(_NET_WM_STRUT_PARTIAL)) != None) {
+ XChangeProperty(display, window.window, strut, XA_CARDINAL, 32,
+ PropModeReplace, (unsigned char *) &sizes, 12);
+ }
+ }
+}
+#endif /* OWN_WINDOW */
+
+#ifdef HAVE_XDBE
+void xdbe_swap_buffers(void)
+{
+ if (use_xdbe) {
+ //XWindowAttributes dest;//leaks
+ //XGetWindowAttributes(display, window.window, &dest);
+ //unsigned int src_height, src_width, src_depth = 0;
+ //XGetGeometry(display, window.back_buffer, NULL, NULL, NULL,src_width,src_height, NULL, src_depth);
+// fprintf(stderr, PACKAGE_NAME": copy from %d x %d x %d to %d x %d x %d\n",src_width, src_height, src_depth, dest.width, dest.height, dest.depth);
+ XCopyArea(display, window.drawable, window.window,
+ window.gc_back, 0, 0, window.width, window.height, 0, 0);
+ /* FIXME should fill w/ window background */
+// XFillRectangle(display, window.back_buffer, window.gc,
+// 0, 0, window.width, window.height);
+ }
+}
+#endif /* HAVE_XDBE */
+