aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c
blob: 3e3d951c714bd07b768d371c046091142e5795ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* ifdef HAVE_CONFIG_H */

#include "ecore_x_private.h"
#include "Ecore_X.h"

static Eina_Bool _composite_available = EINA_FALSE;

void
_ecore_x_composite_init(void)
{
   _composite_available = EINA_FALSE;

#ifdef ECORE_XCOMPOSITE
   int major, minor;

   if (XCompositeQueryVersion(_ecore_x_disp, &major, &minor))
     {
# ifdef ECORE_XRENDER
        if (XRenderQueryExtension(_ecore_x_disp, &major, &minor))
          {
#  ifdef ECORE_XFIXES
             if (XFixesQueryVersion(_ecore_x_disp, &major, &minor))
               {
                  _composite_available = EINA_TRUE;
               }
#  endif
          }
# endif
     }
#endif
} /* _ecore_x_composite_init */

EAPI Eina_Bool
ecore_x_composite_query(void)
{
   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   return _composite_available;
} /* ecore_x_composite_query */

EAPI void
ecore_x_composite_redirect_window(Ecore_X_Window                win,
                                  Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
   int update = CompositeRedirectAutomatic;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   switch(type)
     {
      case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
         update = CompositeRedirectAutomatic;
         break;

      case ECORE_X_COMPOSITE_UPDATE_MANUAL:
         update = CompositeRedirectManual;
         break;
     } /* switch */
   XCompositeRedirectWindow(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
} /* ecore_x_composite_redirect_window */

EAPI void
ecore_x_composite_redirect_subwindows(Ecore_X_Window                win,
                                      Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
   int update = CompositeRedirectAutomatic;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   switch(type)
     {
      case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
         update = CompositeRedirectAutomatic;
         break;

      case ECORE_X_COMPOSITE_UPDATE_MANUAL:
         update = CompositeRedirectManual;
         break;
     } /* switch */
   XCompositeRedirectSubwindows(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
} /* ecore_x_composite_redirect_subwindows */

EAPI void
ecore_x_composite_unredirect_window(Ecore_X_Window                win,
                                    Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
   int update = CompositeRedirectAutomatic;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   switch(type)
     {
      case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
         update = CompositeRedirectAutomatic;
         break;

      case ECORE_X_COMPOSITE_UPDATE_MANUAL:
         update = CompositeRedirectManual;
         break;
     } /* switch */
   XCompositeUnredirectWindow(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
} /* ecore_x_composite_unredirect_window */

EAPI void
ecore_x_composite_unredirect_subwindows(Ecore_X_Window                win,
                                        Ecore_X_Composite_Update_Type type)
{
#ifdef ECORE_XCOMPOSITE
   int update = CompositeRedirectAutomatic;

   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   switch(type)
     {
      case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC:
         update = CompositeRedirectAutomatic;
         break;

      case ECORE_X_COMPOSITE_UPDATE_MANUAL:
         update = CompositeRedirectManual;
         break;
     } /* switch */
   XCompositeUnredirectSubwindows(_ecore_x_disp, win, update);
#endif /* ifdef ECORE_XCOMPOSITE */
} /* ecore_x_composite_unredirect_subwindows */

EAPI Ecore_X_Pixmap
ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win)
{
   Ecore_X_Pixmap pixmap = None;
#ifdef ECORE_XCOMPOSITE
   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   pixmap = XCompositeNameWindowPixmap(_ecore_x_disp, win);
#endif /* ifdef ECORE_XCOMPOSITE */
   return pixmap;
} /* ecore_x_composite_name_window_pixmap_get */

EAPI void
ecore_x_composite_window_events_disable(Ecore_X_Window win)
{
#ifdef ECORE_XCOMPOSITE
   ecore_x_window_shape_input_rectangle_set(win, -1, -1, 1, 1);
#endif /* ifdef ECORE_XCOMPOSITE */
}

EAPI void
ecore_x_composite_window_events_enable(Ecore_X_Window win)
{
#ifdef ECORE_XCOMPOSITE
   ecore_x_window_shape_input_rectangle_set(win, 0, 0, 65535, 65535);
#endif /* ifdef ECORE_XCOMPOSITE */
}

EAPI Ecore_X_Window
ecore_x_composite_render_window_enable(Ecore_X_Window root)
{
   Ecore_X_Window win = 0;
#ifdef ECORE_XCOMPOSITE
   win = XCompositeGetOverlayWindow(_ecore_x_disp, root);
   ecore_x_composite_window_events_disable(win);
#endif /* ifdef ECORE_XCOMPOSITE */
   return win;
} /* ecore_x_composite_render_window_enable */

EAPI void
ecore_x_composite_render_window_disable(Ecore_X_Window root)
{
#ifdef ECORE_XCOMPOSITE
   LOGFN(__FILE__, __LINE__, __FUNCTION__);
   XCompositeReleaseOverlayWindow(_ecore_x_disp, root);
#endif /* ifdef ECORE_XCOMPOSITE */
} /* ecore_x_composite_render_window_disable */