diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c new file mode 100644 index 0000000..43153ff --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c | |||
@@ -0,0 +1,176 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif /* ifdef HAVE_CONFIG_H */ | ||
4 | |||
5 | #include "ecore_x_private.h" | ||
6 | #include "Ecore_X.h" | ||
7 | |||
8 | static Eina_Bool _composite_available = EINA_FALSE; | ||
9 | |||
10 | void | ||
11 | _ecore_x_composite_init(void) | ||
12 | { | ||
13 | _composite_available = EINA_FALSE; | ||
14 | |||
15 | #ifdef ECORE_XCOMPOSITE | ||
16 | int major, minor; | ||
17 | |||
18 | if (XCompositeQueryVersion(_ecore_x_disp, &major, &minor)) | ||
19 | { | ||
20 | # ifdef ECORE_XRENDER | ||
21 | if (XRenderQueryExtension(_ecore_x_disp, &major, &minor)) | ||
22 | { | ||
23 | # ifdef ECORE_XFIXES | ||
24 | if (XFixesQueryVersion(_ecore_x_disp, &major, &minor)) | ||
25 | { | ||
26 | _composite_available = EINA_TRUE; | ||
27 | } | ||
28 | # endif | ||
29 | } | ||
30 | # endif | ||
31 | } | ||
32 | #endif | ||
33 | } /* _ecore_x_composite_init */ | ||
34 | |||
35 | EAPI Eina_Bool | ||
36 | ecore_x_composite_query(void) | ||
37 | { | ||
38 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
39 | return _composite_available; | ||
40 | } /* ecore_x_composite_query */ | ||
41 | |||
42 | EAPI void | ||
43 | ecore_x_composite_redirect_window(Ecore_X_Window win, | ||
44 | Ecore_X_Composite_Update_Type type) | ||
45 | { | ||
46 | #ifdef ECORE_XCOMPOSITE | ||
47 | int update = CompositeRedirectAutomatic; | ||
48 | |||
49 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
50 | switch(type) | ||
51 | { | ||
52 | case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: | ||
53 | update = CompositeRedirectAutomatic; | ||
54 | break; | ||
55 | |||
56 | case ECORE_X_COMPOSITE_UPDATE_MANUAL: | ||
57 | update = CompositeRedirectManual; | ||
58 | break; | ||
59 | } /* switch */ | ||
60 | XCompositeRedirectWindow(_ecore_x_disp, win, update); | ||
61 | #endif /* ifdef ECORE_XCOMPOSITE */ | ||
62 | } /* ecore_x_composite_redirect_window */ | ||
63 | |||
64 | EAPI void | ||
65 | ecore_x_composite_redirect_subwindows(Ecore_X_Window win, | ||
66 | Ecore_X_Composite_Update_Type type) | ||
67 | { | ||
68 | #ifdef ECORE_XCOMPOSITE | ||
69 | int update = CompositeRedirectAutomatic; | ||
70 | |||
71 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
72 | switch(type) | ||
73 | { | ||
74 | case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: | ||
75 | update = CompositeRedirectAutomatic; | ||
76 | break; | ||
77 | |||
78 | case ECORE_X_COMPOSITE_UPDATE_MANUAL: | ||
79 | update = CompositeRedirectManual; | ||
80 | break; | ||
81 | } /* switch */ | ||
82 | XCompositeRedirectSubwindows(_ecore_x_disp, win, update); | ||
83 | #endif /* ifdef ECORE_XCOMPOSITE */ | ||
84 | } /* ecore_x_composite_redirect_subwindows */ | ||
85 | |||
86 | EAPI void | ||
87 | ecore_x_composite_unredirect_window(Ecore_X_Window win, | ||
88 | Ecore_X_Composite_Update_Type type) | ||
89 | { | ||
90 | #ifdef ECORE_XCOMPOSITE | ||
91 | int update = CompositeRedirectAutomatic; | ||
92 | |||
93 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
94 | switch(type) | ||
95 | { | ||
96 | case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: | ||
97 | update = CompositeRedirectAutomatic; | ||
98 | break; | ||
99 | |||
100 | case ECORE_X_COMPOSITE_UPDATE_MANUAL: | ||
101 | update = CompositeRedirectManual; | ||
102 | break; | ||
103 | } /* switch */ | ||
104 | XCompositeUnredirectWindow(_ecore_x_disp, win, update); | ||
105 | #endif /* ifdef ECORE_XCOMPOSITE */ | ||
106 | } /* ecore_x_composite_unredirect_window */ | ||
107 | |||
108 | EAPI void | ||
109 | ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, | ||
110 | Ecore_X_Composite_Update_Type type) | ||
111 | { | ||
112 | #ifdef ECORE_XCOMPOSITE | ||
113 | int update = CompositeRedirectAutomatic; | ||
114 | |||
115 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
116 | switch(type) | ||
117 | { | ||
118 | case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: | ||
119 | update = CompositeRedirectAutomatic; | ||
120 | break; | ||
121 | |||
122 | case ECORE_X_COMPOSITE_UPDATE_MANUAL: | ||
123 | update = CompositeRedirectManual; | ||
124 | break; | ||
125 | } /* switch */ | ||
126 | XCompositeUnredirectSubwindows(_ecore_x_disp, win, update); | ||
127 | #endif /* ifdef ECORE_XCOMPOSITE */ | ||
128 | } /* ecore_x_composite_unredirect_subwindows */ | ||
129 | |||
130 | EAPI Ecore_X_Pixmap | ||
131 | ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win) | ||
132 | { | ||
133 | Ecore_X_Pixmap pixmap = None; | ||
134 | #ifdef ECORE_XCOMPOSITE | ||
135 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
136 | pixmap = XCompositeNameWindowPixmap(_ecore_x_disp, win); | ||
137 | #endif /* ifdef ECORE_XCOMPOSITE */ | ||
138 | return pixmap; | ||
139 | } /* ecore_x_composite_name_window_pixmap_get */ | ||
140 | |||
141 | EAPI void | ||
142 | ecore_x_composite_window_events_disable(Ecore_X_Window win) | ||
143 | { | ||
144 | #ifdef ECORE_XCOMPOSITE | ||
145 | ecore_x_window_shape_input_rectangle_set(win, -1, -1, 1, 1); | ||
146 | #endif /* ifdef ECORE_XCOMPOSITE */ | ||
147 | } | ||
148 | |||
149 | EAPI void | ||
150 | ecore_x_composite_window_events_enable(Ecore_X_Window win) | ||
151 | { | ||
152 | #ifdef ECORE_XCOMPOSITE | ||
153 | ecore_x_window_shape_input_rectangle_set(win, 0, 0, 65535, 65535); | ||
154 | #endif /* ifdef ECORE_XCOMPOSITE */ | ||
155 | } | ||
156 | |||
157 | EAPI Ecore_X_Window | ||
158 | ecore_x_composite_render_window_enable(Ecore_X_Window root) | ||
159 | { | ||
160 | Ecore_X_Window win = 0; | ||
161 | #ifdef ECORE_XCOMPOSITE | ||
162 | win = XCompositeGetOverlayWindow(_ecore_x_disp, root); | ||
163 | ecore_x_composite_window_events_disable(win); | ||
164 | #endif /* ifdef ECORE_XCOMPOSITE */ | ||
165 | return win; | ||
166 | } /* ecore_x_composite_render_window_enable */ | ||
167 | |||
168 | EAPI void | ||
169 | ecore_x_composite_render_window_disable(Ecore_X_Window root) | ||
170 | { | ||
171 | #ifdef ECORE_XCOMPOSITE | ||
172 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
173 | XCompositeReleaseOverlayWindow(_ecore_x_disp, root); | ||
174 | #endif /* ifdef ECORE_XCOMPOSITE */ | ||
175 | } /* ecore_x_composite_render_window_disable */ | ||
176 | |||