From: Dana Jansens Date: Wed, 20 Jun 2007 03:02:28 +0000 (+0000) Subject: i forgot to add these X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=271761db53b38e9235ad492812552f625049dd90;p=chaz%2Fopenbox i forgot to add these --- diff --git a/openbox/composite.c b/openbox/composite.c new file mode 100644 index 00000000..1e2ce6a9 --- /dev/null +++ b/openbox/composite.c @@ -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 index 00000000..94232ffa --- /dev/null +++ b/openbox/composite.h @@ -0,0 +1,14 @@ +#ifndef __composite_h +#define __composite_h + +#include +#include + +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