]> Dogcows Code - chaz/openbox/commitdiff
i forgot to add these
authorDana Jansens <danakj@orodu.net>
Wed, 20 Jun 2007 03:02:28 +0000 (03:02 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 20 Jun 2007 03:02:28 +0000 (03:02 +0000)
openbox/composite.c [new file with mode: 0644]
openbox/composite.h [new file with mode: 0644]

diff --git a/openbox/composite.c b/openbox/composite.c
new file mode 100644 (file)
index 0000000..1e2ce6a
--- /dev/null
@@ -0,0 +1,72 @@
+#include "composite.h"
+#include "openbox.h"
+#include "extensions.h"
+
+#ifndef USE_XCOMPOSITE
+void composite_startup(gboolean reconfig) {}
+void composite_shutdown(gboolean reconfig) {}
+gboolean composite_window_has_alpha(Visual *vis) { return FALSE; }
+XID composite_get_window_picture(Window win, Visual *vis) { return None; }
+Pixmap composite_get_window_pixmap(Window win) { return None; }
+#else
+
+static Picture root_picture = None;
+
+void composite_startup(gboolean reconfig)
+{
+    if (reconfig) return;
+    if (!extensions_comp) return;
+
+    /* Redirect window contents to offscreen pixmaps */
+    XCompositeRedirectSubwindows(ob_display,
+                                 RootWindow(ob_display, ob_screen),
+                                 CompositeRedirectAutomatic);
+}
+
+void composite_shutdown(gboolean reconfig)
+{
+    if (reconfig) return;
+    if (!extensions_comp) return;
+}
+
+void composite_setup_root_window()
+{
+    if (root_picture)
+        XRenderFreePicture(ob_display, root_picture);
+
+    root_picture =
+        composite_get_window_picture(RootWindow(ob_display, ob_screen),
+                                     RrVisual(ob_rr_inst));
+}
+
+gboolean composite_window_has_alpha(Visual *vis)
+{
+    XRenderPictFormat *format;
+
+    if (!extensions_comp) return FALSE;
+
+    format = XRenderFindVisualFormat(ob_display, vis);
+    return format->type == PictTypeDirect && format->direct.alphaMask;
+}
+
+XID composite_get_window_picture(Window win, Visual *vis)
+{
+    XRenderPictureAttributes pa;
+    XRenderPictFormat *format;
+
+    if (!extensions_comp) return None;
+
+    format = XRenderFindVisualFormat(ob_display, vis);
+
+    pa.subwindow_mode = IncludeInferiors;
+    return XRenderCreatePicture(ob_display, win, format, CPSubwindowMode, &pa);
+}
+
+Pixmap composite_get_window_pixmap(Window win)
+{
+    if (!extensions_comp) return None;
+
+    return XCompositeNameWindowPixmap(ob_display, win);
+}
+
+#endif
diff --git a/openbox/composite.h b/openbox/composite.h
new file mode 100644 (file)
index 0000000..94232ff
--- /dev/null
@@ -0,0 +1,14 @@
+#ifndef __composite_h
+#define __composite_h
+
+#include <glib.h>
+#include <X11/Xlib.h>
+
+void composite_startup(gboolean reconfig);
+void composite_shutdown(gboolean reconfig);
+
+gboolean composite_window_has_alpha(Visual *vis);
+XID composite_get_window_picture(Window win, Visual *vis);
+Pixmap composite_get_window_pixmap(Window win);
+
+#endif
This page took 0.024386 seconds and 4 git commands to generate.