enlightenment_info: add hwc info
[platform/upstream/enlightenment.git] / src / bin / e_comp.h
1 #ifdef E_TYPEDEFS
2 typedef struct _E_Comp                       E_Comp;
3 typedef struct _E_Comp_Wl_Client_Data        E_Comp_Client_Data;
4 typedef struct _E_Comp_Wl_Data               E_Comp_Wl_Data;
5 typedef struct _E_Comp_Connected_Client_Info E_Comp_Connected_Client_Info;
6
7 # define E_COMP_TYPE (int) 0xE0b01003
8
9 # define E_LAYER_COUNT 24
10 # define E_CLIENT_LAYER_COUNT 16
11
12 typedef enum _E_Layer
13 {
14    E_LAYER_BOTTOM = -100,
15    E_LAYER_BG = -1, // zone bg stuff
16    E_LAYER_DESKTOP = 0, // desktop objects: fileman, gadgets, shelves
17    E_LAYER_DESKTOP_TOP = 10, // raised desktop objects: gadgets
18    E_LAYER_CLIENT_DESKTOP = 100, //shelves
19    E_LAYER_CLIENT_BELOW = 150,
20    E_LAYER_CLIENT_NORMAL = 200,
21    E_LAYER_CLIENT_ABOVE = 250,
22    E_LAYER_CLIENT_EDGE = 300,
23    E_LAYER_CLIENT_FULLSCREEN = 350,
24    E_LAYER_CLIENT_EDGE_FULLSCREEN = 400,
25    E_LAYER_CLIENT_POPUP = 450,
26    E_LAYER_CLIENT_TOP = 500,
27    E_LAYER_CLIENT_DRAG = 550,
28    E_LAYER_CLIENT_PRIO = 600,
29    E_LAYER_CLIENT_NOTIFICATION_LOW = 650,
30    E_LAYER_CLIENT_NOTIFICATION_NORMAL = 700,
31    E_LAYER_CLIENT_NOTIFICATION_HIGH = 750,
32    E_LAYER_CLIENT_NOTIFICATION_TOP = 800,
33    E_LAYER_CLIENT_ALERT = 850,
34    E_LAYER_POPUP = 999, // popups
35    E_LAYER_EFFECT = 1999,
36    E_LAYER_MENU = 5000, // menus
37    E_LAYER_DESKLOCK = 9999, // desklock
38    E_LAYER_MAX = 32767 // EVAS_LAYER_MAX
39 } E_Layer;
40
41 #else
42 # ifndef E_COMP_H
43 #  define E_COMP_H
44
45 # include "e_comp_cfdata.h"
46
47 extern E_API int E_EVENT_COMPOSITOR_DISABLE;
48 extern E_API int E_EVENT_COMPOSITOR_ENABLE;
49 extern E_API int E_EVENT_COMPOSITOR_FPS_UPDATE;
50
51 typedef void (*E_Comp_Cb)(void);
52
53 typedef struct _E_Comp_Hook E_Comp_Hook;
54
55 typedef enum _E_Comp_Hook_Point
56 {
57    E_COMP_HOOK_PREPARE_PLANE,
58    E_COMP_HOOK_LAST
59 } E_Comp_Hook_Point;
60
61 typedef void (*E_Comp_Hook_Cb)(void *data, E_Comp *c);
62
63 struct _E_Comp_Hook
64 {
65    EINA_INLIST;
66    E_Comp_Hook_Point hookpoint;
67    E_Comp_Hook_Cb    func;
68    void               *data;
69    unsigned char       delete_me : 1;
70 };
71
72 struct _E_Comp
73 {
74    E_Object e_obj_inherit;
75    int w, h;
76
77    Ecore_Window  win; // input overlay
78    Ecore_Window  root;
79    Ecore_Evas     *ee;
80    Ecore_Window  ee_win;
81    //Evas_Object    *elm;
82    Evas           *evas;
83    Evas_Object    *bg_blank_object;
84    Eina_List      *zones;
85    E_Pointer      *pointer;
86    Eina_List *clients;
87    unsigned int new_clients;
88
89    Eina_List *pre_render_cbs; /* E_Comp_Cb */
90
91    E_Comp_Wl_Data *wl_comp_data;
92
93    E_Pixmap_Type comp_type; //for determining X/Wayland/
94
95    Eina_Stringshare *name;
96    struct {
97       Evas_Object *obj;
98       Eina_Inlist *clients; /* E_Client, bottom to top */
99       unsigned int clients_count;
100    } layers[E_LAYER_COUNT];
101
102    struct
103    {
104       Evas_Object *rect;
105       Evas_Object *obj;
106       Ecore_Event_Handler *key_handler;
107       E_Comp_Object_Autoclose_Cb del_cb;
108       E_Comp_Object_Key_Cb key_cb;
109       void *data;
110    } autoclose;
111
112    Eina_List *debug_rects;
113    Eina_List *ignore_wins;
114
115    Eina_List      *updates;
116    Eina_List      *post_updates;
117    Ecore_Animator *render_animator;
118    Ecore_Job      *shape_job;
119    Ecore_Job      *update_job;
120    Evas_Object    *fps_bg;
121    Evas_Object    *fps_fg;
122    Ecore_Job      *screen_job;
123    Ecore_Timer    *nocomp_delay_timer;
124    Ecore_Timer    *nocomp_override_timer;
125    Ecore_Timer    *selcomp_delay_timer;
126    Ecore_Timer    *selcomp_override_timer;
127    int             animating;
128    double          frametimes[122];
129    int             frameskip;
130    double          fps;
131
132    int             nocomp_override; //number of times nocomp override has been requested
133    Ecore_Window    block_win;
134    int             block_count; //number of times block window has been requested
135
136    Ecore_Window    cm_selection; //FIXME: move to comp_x ?
137    E_Client       *nocomp_ec;
138
139    int             hwc_override; //number of times hwc override has been requested
140    Eina_Bool       hwc_mode;
141
142    int depth;
143    unsigned int    input_key_grabs;
144    unsigned int    input_mouse_grabs;
145
146    E_Comp_Cb        grab_cb;
147    E_Comp_Cb        bindings_grab_cb;
148    E_Comp_Cb        bindings_ungrab_cb;
149
150    Eina_Bool       gl : 1;
151    Eina_Bool       grabbed : 1;
152    Eina_Bool       nocomp : 1;
153    Eina_Bool       nocomp_want : 1;
154    Eina_Bool       selcomp_want : 1;
155    Eina_Bool       saver : 1;
156    Eina_Bool       shape_queue_blocked : 1;
157    Eina_Bool       calc_fps : 1;
158    Eina_Bool       hwc : 1;
159    Eina_Bool       hwc_fs : 1; // active hwc policy
160
161    Eina_List      *connected_clients;
162    Eina_List      *launchscrns; // list of dummy clients for launchscreen image.
163 };
164
165 struct _E_Comp_Connected_Client_Info
166 {
167    const char *name;
168    int pid;
169    int uid;
170    int gid;
171 };
172
173 typedef enum
174 {
175    E_COMP_ENGINE_NONE = 0,
176    E_COMP_ENGINE_SW = 1,
177    E_COMP_ENGINE_GL = 2
178 } E_Comp_Engine;
179
180 extern E_API E_Comp *e_comp;
181 extern E_API E_Comp_Wl_Data *e_comp_wl;
182
183 EINTERN Eina_Bool e_comp_init(void);
184 E_API E_Comp *e_comp_new(void);
185 E_API int e_comp_internal_save(void);
186 EINTERN int e_comp_shutdown(void);
187 E_API void e_comp_deferred_job(void);
188 E_API void e_comp_render_queue(void);
189 E_API void e_comp_client_post_update_add(E_Client *ec);
190 E_API void e_comp_shape_queue(void);
191 E_API void e_comp_shape_queue_block(Eina_Bool block);
192 E_API E_Comp_Config *e_comp_config_get(void);
193 E_API const Eina_List *e_comp_list(void);
194 E_API void e_comp_shadows_reset(void);
195 E_API Ecore_Window e_comp_top_window_at_xy_get(Evas_Coord x, Evas_Coord y);
196 E_API void e_comp_util_wins_print(void);
197 E_API void e_comp_ignore_win_add(E_Pixmap_Type type, Ecore_Window win);
198 E_API void e_comp_ignore_win_del(E_Pixmap_Type type, Ecore_Window win);
199 E_API Eina_Bool e_comp_ignore_win_find(Ecore_Window win);
200 E_API void e_comp_override_del(void);
201 E_API void e_comp_override_add(void);
202 E_API E_Comp *e_comp_find_by_window(Ecore_Window win);
203 E_API void e_comp_override_timed_pop(void);
204 E_API unsigned int e_comp_e_object_layer_get(const E_Object *obj);
205 E_API void e_comp_layer_name_get(unsigned int layer, char *buff, int buff_size);
206 E_API Eina_Bool e_comp_grab_input(Eina_Bool mouse, Eina_Bool kbd);
207 E_API void e_comp_ungrab_input(Eina_Bool mouse, Eina_Bool kbd);
208 E_API void e_comp_gl_set(Eina_Bool set);
209 E_API Eina_Bool e_comp_gl_get(void);
210
211 E_API void e_comp_button_bindings_grab_all(void);
212 E_API void e_comp_button_bindings_ungrab_all(void);
213 E_API void e_comp_client_redirect_toggle(E_Client *ec);
214 E_API Eina_Bool e_comp_util_object_is_above_nocomp(Evas_Object *obj);
215
216 E_API Eina_Bool e_comp_util_kbd_grabbed(void);
217 E_API Eina_Bool e_comp_util_mouse_grabbed(void);
218
219 E_API void e_comp_nocomp_end(const char *location);
220
221 static inline Eina_Bool
222 e_comp_util_client_is_fullscreen(const E_Client *ec)
223 {
224    if ((!ec->visible) || (ec->input_only))
225      return EINA_FALSE;
226    return ((ec->client.x == 0) && (ec->client.y == 0) &&
227        ((ec->client.w) >= e_comp->w) &&
228        ((ec->client.h) >= e_comp->h) &&
229        (!ec->argb) && (!ec->shaped)
230        );
231 }
232
233 E_API void e_comp_post_update_add(E_Client *ec);
234 E_API void e_comp_post_update_purge(E_Client *ec);
235
236 E_API E_Comp_Hook *e_comp_hook_add(E_Comp_Hook_Point hookpoint, E_Comp_Hook_Cb func, const void *data);
237 E_API void e_comp_hook_del(E_Comp_Hook *ph);
238 EINTERN Eina_Bool e_comp_is_on_overlay(E_Client *ec);
239 E_API void e_comp_hwc_end(const char *location);
240
241 #endif
242 #endif