]> Dogcows Code - chaz/openbox/blob - openbox/composite.c
oops
[chaz/openbox] / openbox / composite.c
1 #include "composite.h"
2 #include "openbox.h"
3 #include "extensions.h"
4
5 #ifndef USE_XCOMPOSITE
6 void composite_startup(gboolean reconfig) {}
7 void composite_shutdown(gboolean reconfig) {}
8 gboolean composite_window_has_alpha(Visual *vis) { return FALSE; }
9 XID composite_get_window_picture(Window win, Visual *vis) { return None; }
10 Pixmap composite_get_window_pixmap(Window win) { return None; }
11 void composite_setup_root_window() {}
12 void composite_enable_for_window(Window win) {}
13 #else
14
15 static Picture root_picture = None;
16
17 void composite_startup(gboolean reconfig)
18 {
19 if (reconfig) return;
20 if (!extensions_comp) return;
21 }
22
23 void composite_shutdown(gboolean reconfig)
24 {
25 if (reconfig) return;
26 if (!extensions_comp) return;
27 }
28
29 void composite_setup_root_window()
30 {
31 if (root_picture)
32 XRenderFreePicture(ob_display, root_picture);
33
34 root_picture =
35 composite_get_window_picture(RootWindow(ob_display, ob_screen),
36 RrVisual(ob_rr_inst));
37 }
38
39 gboolean composite_window_has_alpha(Visual *vis)
40 {
41 XRenderPictFormat *format;
42
43 if (!extensions_comp) return FALSE;
44
45 format = XRenderFindVisualFormat(ob_display, vis);
46 return format->type == PictTypeDirect && format->direct.alphaMask;
47 }
48
49 XID composite_get_window_picture(Window win, Visual *vis)
50 {
51 XRenderPictureAttributes pa;
52 XRenderPictFormat *format;
53
54 if (!extensions_comp) return None;
55
56 format = XRenderFindVisualFormat(ob_display, vis);
57
58 pa.subwindow_mode = IncludeInferiors;
59 return XRenderCreatePicture(ob_display, win, format, CPSubwindowMode, &pa);
60 }
61
62 Pixmap composite_get_window_pixmap(Window win)
63 {
64 if (!extensions_comp) return None;
65
66 return XCompositeNameWindowPixmap(ob_display, win);
67 }
68
69 void composite_enable_for_window(Window win)
70 {
71 /* Redirect window contents to offscreen pixmaps */
72 XCompositeRedirectWindow(ob_display, win, CompositeRedirectAutomatic);
73 }
74
75 #endif
This page took 0.035623 seconds and 4 git commands to generate.