huge wl fixup (wayland clients actually working again)
[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_Data      E_Comp_Data;
4 typedef struct _E_Comp_Client_Data E_Comp_Client_Data;
5 typedef struct _E_Comp_Demo_Style_Item E_Comp_Demo_Style_Item;
6
7 #define E_COMP_TYPE (int) 0xE0b01003
8
9 #define E_LAYER_COUNT 19
10 #define E_CLIENT_LAYER_COUNT 11
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_POPUP = 999, // popups
30    E_LAYER_MENU = 5000, // menus
31    E_LAYER_DESKLOCK = 9999, // desklock
32    E_LAYER_MAX = 32767 // EVAS_LAYER_MAX
33 } E_Layer;
34
35 #else
36 #ifndef E_MOD_COMP_H
37 #define E_MOD_COMP_H
38
39 # include "e_comp_cfdata.h"
40
41
42 struct _E_Comp
43 {
44    E_Object e_obj_inherit;
45
46    Ecore_Window  win; // input overlay
47    Ecore_Evas     *ee;
48    Ecore_Window  ee_win;
49    Evas           *evas;
50    Evas_Object    *bg_blank_object;
51    Eina_List      *zones;
52    E_Manager      *man;
53    E_Pointer      *pointer;
54    Eina_List *clients;
55    unsigned int new_clients;
56
57    E_Comp_Data *comp_data;
58    E_Pixmap_Type comp_type; //for determining X/Wayland/
59
60    unsigned int num;
61    Eina_Stringshare *name;
62    struct {
63       Ecore_Window win;
64       Evas_Object *obj;
65       //Eina_Inlist *objs; /* E_Comp_Object; NOT to be exposed; seems pointless? */
66       Eina_Inlist *clients; /* E_Client, bottom to top */
67       unsigned int clients_count;
68    } layers[E_LAYER_COUNT];
69
70    struct
71    {
72       Evas_Object *rect;
73       Evas_Object *obj;
74       Ecore_Event_Handler *key_handler;
75       E_Comp_Object_Autoclose_Cb del_cb;
76       E_Comp_Object_Key_Cb key_cb;
77       void *data;
78    } autoclose;
79
80    Eina_List *debug_rects;
81    Eina_List *ignore_wins;
82
83    Eina_List      *updates;
84    Eina_List      *post_updates;
85    Ecore_Animator *render_animator;
86    Ecore_Job      *shape_job;
87    Ecore_Job      *update_job;
88    Evas_Object    *fps_bg;
89    Evas_Object    *fps_fg;
90    Ecore_Job      *screen_job;
91    Ecore_Timer    *nocomp_delay_timer;
92    Ecore_Timer    *nocomp_override_timer;
93    int             animating;
94    double          frametimes[122];
95    int             frameskip;
96
97    int             nocomp_override; //number of times nocomp override has been requested
98    Ecore_Window block_win;
99    int             block_count; //number of times block window has been requested
100
101    Ecore_Window  cm_selection; //FIXME: move to comp_x ?
102
103    int depth;
104
105    Ecore_Cb        grab_cb;
106    Ecore_Cb        bindings_grab_cb;
107    Ecore_Cb        bindings_ungrab_cb;
108
109    Eina_Bool       gl : 1;
110    Eina_Bool       grabbed : 1;
111    Eina_Bool       nocomp : 1;
112    Eina_Bool       nocomp_want : 1;
113    Eina_Bool       saver : 1;
114 };
115
116
117 struct _E_Comp_Demo_Style_Item
118 {
119    Evas_Object *preview;
120    Evas_Object *frame;
121    Evas_Object *livethumb;
122    Evas_Object *layout;
123    Evas_Object *border;
124    Evas_Object *client;
125 };
126
127 typedef enum
128 {
129    E_COMP_ENGINE_NONE = 0,
130    E_COMP_ENGINE_SW = 1,
131    E_COMP_ENGINE_GL = 2
132 } E_Comp_Engine;
133
134 EINTERN Eina_Bool e_comp_init(void);
135 EAPI E_Comp *e_comp_new(void);
136 EAPI int e_comp_internal_save(void);
137 EINTERN int e_comp_shutdown(void);
138 EAPI void e_comp_render_queue(E_Comp *c);
139 EAPI void e_comp_shape_queue(E_Comp *c);
140 EAPI E_Comp_Config *e_comp_config_get(void);
141 EAPI const Eina_List *e_comp_list(void);
142 EAPI void e_comp_shadows_reset(void);
143 EAPI E_Comp *e_comp_get(const void *o);
144 EAPI Ecore_Window e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y);
145 EAPI void e_comp_util_wins_print(const E_Comp *c);
146 EAPI void e_comp_ignore_win_add(E_Pixmap_Type type, Ecore_Window win);
147 EAPI void e_comp_ignore_win_del(E_Pixmap_Type type, Ecore_Window win);
148 EAPI Eina_Bool e_comp_ignore_win_find(Ecore_Window win);
149 EAPI void e_comp_override_del(E_Comp *c);
150 EAPI void e_comp_override_add(E_Comp *c);
151 EAPI void e_comp_block_window_add(void);
152 EAPI void e_comp_block_window_del(void);
153 EAPI E_Comp *e_comp_find_by_window(Ecore_Window win);
154 EAPI void e_comp_override_timed_pop(E_Comp *c);
155 EAPI unsigned int e_comp_e_object_layer_get(const E_Object *obj);
156 EAPI Eina_Bool e_comp_grab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd);
157 EAPI void e_comp_ungrab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd);
158 EAPI void e_comp_gl_set(Eina_Bool set);
159 EAPI Eina_Bool e_comp_gl_get(void);
160 EAPI E_Comp *e_comp_evas_find(const Evas *e);
161
162 EAPI void e_comp_button_bindings_grab_all(void);
163 EAPI void e_comp_button_bindings_ungrab_all(void);
164
165 EINTERN Evas_Object *e_comp_style_selector_create(Evas *evas, const char **source);
166 EAPI E_Config_Dialog *e_int_config_comp(E_Comp *comp, const char *params);
167 EAPI E_Config_Dialog *e_int_config_comp_match(E_Comp *comp, const char *params);
168
169 static inline E_Comp *
170 e_comp_util_evas_object_comp_get(Evas_Object *obj)
171 {
172    return ecore_evas_data_get(ecore_evas_ecore_evas_get(evas_object_evas_get(obj)), "comp");
173 }
174
175 static inline Eina_Bool
176 e_comp_util_client_is_fullscreen(const E_Client *ec)
177 {
178    if ((!ec->visible) || (ec->input_only))
179      return EINA_FALSE;
180    return ((ec->client.x == 0) && (ec->client.y == 0) &&
181        ((ec->client.w) >= ec->comp->man->w) &&
182        ((ec->client.h) >= ec->comp->man->h) &&
183        (!ec->argb) && (!ec->shaped)
184        );
185 }
186
187 #endif
188 #endif