tizen 2.4 release
[framework/uifw/e17-mod-tizen-comp.git] / src / e_mod_comp_shared_types.h
1 #ifdef E_TYPEDEFS
2 #else
3 #ifndef E_MOD_COMP_SHARED_TYPES_H
4 #define E_MOD_COMP_SHARED_TYPES_H
5
6 typedef struct _E_Comp                      E_Comp;
7 typedef struct _E_Comp_Win                  E_Comp_Win;
8 typedef struct _E_Comp_Effect_Object        E_Comp_Effect_Object;
9 typedef struct _E_Comp_Effect_Zone_Rotation E_Comp_Effect_Zone_Rotation;
10 typedef struct _E_Comp_HWComp               E_Comp_HWComp;
11
12 #include "e.h"
13 #include "e_mod_main.h"
14 #include "e_mod_comp_update.h"
15 #include "e_mod_comp_hw_ov_win.h"
16 #include "e_mod_comp_canvas.h"
17 #include "e_mod_comp_object.h"
18 #include "e_mod_comp_policy.h"
19 #include "e_mod_comp_effect_win_rotation.h"
20 #include "e_mod_comp_effect.h"
21 #include "e_mod_comp_win_type.h"
22 #include "e_mod_comp_screen.h"
23 #include "e_mod_comp_win_shape_input.h"
24 #include "e_mod_comp_bg_win.h"
25 #include "e_mod_comp_util.h"
26 #include "e_mod_comp_effect_image_launch.h"
27 #include "e_mod_comp_hwcomp.h"
28 #include "e_mod_comp_aux_hint.h"
29
30 #ifdef ENABLE_TTRACE
31 #include <ttrace.h>
32 #endif //ENABLE_TTRACE
33
34 #ifdef _F_USE_EXTN_DIALOG_
35 # define e_util_dialog_internal e_util_extn_dialog_show
36 #endif
37
38 //structure for passing values to XRR output property
39 typedef struct _Data_Rrprop
40 {
41    Ecore_X_Window win;
42    unsigned int value;
43 }Data_Rrprop;
44
45 struct _E_Comp
46 {
47    Ecore_X_Window                win; // COW
48    E_Manager                    *man;
49    Eina_Inlist                  *wins;
50    Eina_List                    *wins_list;
51    Eina_List                    *updates;
52    Ecore_Animator               *render_animator;
53    Ecore_Job                    *update_job;
54    Ecore_Timer                  *new_up_timer;
55    int                           animating;
56    int                           render_overflow;
57    E_Manager_Comp                comp;
58    Ecore_X_Window                cm_selection;
59    Eina_List                    *canvases; // list of E_Comp_Canvas
60    Eina_Bool                     gl : 1;
61    Eina_Bool                     grabbed : 1;
62    Eina_Bool                     nocomp : 1;
63    Eina_Bool                     wins_invalid : 1;
64
65    // added for tizen
66    Eina_Bool                     animatable : 1; // if this value is true then window can show animaton. otherwise, window can not show animation effect.
67    Eina_Bool                     effect_stage : 1;
68    E_Comp_Screen_Lock            lock;
69    E_Comp_Screen_Rotation        rotation;
70    Eina_Bool                     need_shape_merge;
71    Eina_Bool                     use_hw_ov; // use H/W overlay window for primary screen
72    Eina_Bool                     keyboard_effect : 1; // True: Compositor Show Keyborad Window Effect / False: Compositor do not show keyboard window effect
73    Eina_Bool                     defer_raise_effect : 1; // True : Compositor defer evas object restack on window effect
74    Eina_Bool                     fake_image_launch : 1; // True : Enable Fake Image Launch feature
75    E_Comp_Win                   *lower_win; // For saving window on backkey(lower) event
76
77    // fake image launch
78    E_Comp_Effect_Image_Launch   *eff_img;
79    Evas                         *evas;
80
81    Eina_List                    *shape_inputs;
82    Eina_List                    *shape_inputs_mo;
83
84    //effect module
85    void *effect_handle;
86    //hwcomp module
87    void *hwcomp_handle;
88
89    struct
90      {
91         Eina_Bool           (*init)(E_Comp *c);
92         void                (*shutdown)(E_Comp *c);
93
94         E_Comp_Effect_Type *(*type_new)(void);
95         void                (*type_free)(E_Comp_Effect_Type *type);
96         Eina_Bool           (*type_setup)(E_Comp_Effect_Type *type, Ecore_X_Window win);
97         Eina_Bool           (*state_setup)(E_Comp_Effect_Type *type, Ecore_X_Window win);
98         Eina_Bool           (*state_get)(E_Comp_Effect_Type *type);
99         void                (*state_set)(E_Comp_Effect_Type *type, Eina_Bool state);
100         Eina_Bool           (*style_setup)(E_Comp_Effect_Type *type, Ecore_X_Window win);
101         E_Comp_Effect_Style (*style_get)(E_Comp_Effect_Type *type, E_Comp_Effect_Kind kind);
102
103         /* window effect functions */
104         void                (*win_show)(E_Comp_Win *cw);
105         void                (*win_hide)(E_Comp_Win *cw);
106         void                (*win_restack)(E_Comp_Win *cw, Eina_Bool v1, Eina_Bool v2);
107
108         Eina_Bool           (*signal_add)(E_Comp_Win *cw, Evas_Object *o, const char *emission, const char *src);
109         Eina_Bool           (*signal_del)(E_Comp_Win *cw, Evas_Object *obj, const char *name);
110         Eina_Bool           (*jobs_clean)(E_Comp_Win *cw, Evas_Object *obj, const char *name);
111         Eina_Bool           (*signal_flush)(void);
112         Eina_Bool           (*animating_set)(E_Comp *c, E_Comp_Win *cw, Eina_Bool set);
113
114         /* effect object functions */
115         E_Comp_Effect_Object *(*object_new)(E_Comp_Layer *ly, E_Comp_Win *cw, Eina_Bool recreate);
116         void                  (*object_free)(E_Comp_Effect_Object *o);
117
118         void                  (*object_win_set)(E_Comp_Win *cw, const char *emission);
119         void                  (*above_wins_set)(E_Comp_Win *cw, Eina_Bool show);
120
121         /* fake image functions */
122         E_Comp_Effect_Image_Launch *(*image_launch_new)(Evas *e, int w, int h);
123         void                        (*image_launch_free)(E_Comp_Effect_Image_Launch *eff);
124         Eina_Bool                   (*image_launch_handler_message)(Ecore_X_Event_Client_Message *ev);
125         Eina_Bool                   (*image_launch_show)(E_Comp_Effect_Image_Launch *eff, const char *file);
126         Eina_Bool                   (*image_launch_hide)(E_Comp_Effect_Image_Launch *eff);
127         Eina_Bool                   (*image_launch_window_check)(E_Comp_Effect_Image_Launch *eff, E_Comp_Win *cw);
128         Eina_Bool                   (*image_launch_running_check)(E_Comp_Effect_Image_Launch *eff);
129         Eina_Bool                   (*image_launch_fake_show_done_check)(E_Comp_Effect_Image_Launch *eff);
130         Eina_Bool                   (*image_launch_window_set)(E_Comp_Effect_Image_Launch *eff, Ecore_X_Window w);
131         void                        (*image_launch_disable)(E_Comp_Effect_Image_Launch *eff);
132
133         /* rotation functions */
134         Eina_Bool                    (*win_angle_get)(E_Comp_Win *cw);
135         E_Comp_Effect_Zone_Rotation *(*zone_rotation_new)(E_Comp_Canvas *canvas);
136         void                         (*zone_rotation_free)(E_Comp_Effect_Zone_Rotation *zr);
137         Eina_Bool                    (*zone_rotation_begin)(E_Comp_Effect_Zone_Rotation *zr);
138         Eina_Bool                    (*zone_rotation_end)(E_Comp_Effect_Zone_Rotation *zr);
139         Eina_Bool                    (*zone_rotation_cancel)(E_Comp_Effect_Zone_Rotation *zr);
140         Eina_Bool                    (*zone_rotation_do)(E_Comp_Effect_Zone_Rotation *zr);
141         Eina_Bool                    (*zone_rotation_clear)(E_Comp_Effect_Zone_Rotation *zr);
142      }effect_funcs;
143
144    struct
145      {
146         Eina_Bool           (*init)(E_Comp *c);
147         void                (*shutdown)(E_Comp *c);
148
149         E_Comp_HWComp*      (*hwcomp_new)(E_Comp_Canvas *canvas);
150         void                (*hwcomp_free)(E_Comp_HWComp *hwcomp);
151         void                (*update_composite)(E_Comp_HWComp *hwcomp);
152         void                (*set_full_composite)(E_Comp_HWComp *hwcomp);
153         void                (*force_composite_set)(E_Comp_HWComp *hwcomp, Eina_Bool set);
154         Eina_Bool           (*force_composite_get)(E_Comp_HWComp *hwcomp);
155         Eina_Bool           (*cb_update)(E_Comp_HWComp *hwcomp);
156         void                (*process_event)(E_Comp *c, Ecore_X_Event_Generic *e);
157         void                (*check_win_update)(E_Comp_Win *cw, int w, int h);
158         void                (*win_update)(E_Comp_Win *cw);
159         void                (*set_resize)(E_Comp_Win *cw);
160         void                (*reset_idle_timer)(E_Comp_Canvas *canvas);
161         void                (*win_del)(E_Comp_Win *cw);
162         E_HWComp_Mode       (*mode_get)(E_Comp_HWComp *hwcomp);
163         void                (*update_null_set_drawables)(E_Comp_HWComp *hwcomp);
164         void                (*fullcomp_pending_release)(E_Comp_HWComp *hwcomp);
165         void                (*cb_rotation_begin)(E_Comp_HWComp *hwcomp);
166         void                (*cb_rotation_end)(E_Comp_HWComp *hwcomp);
167         void                (*set_drawables)(E_Comp_HWComp_Update *hwc_update, Ecore_X_Window win);
168         Eina_Bool           (*verify_update_mode)(E_Comp_HWComp *hwcomp, E_Comp_HWComp_Update *hwc_update);
169      }hwcomp_funcs;
170
171     Eina_Bool stand_by_canvas_render;   // stand by canvas flip while composite init
172 };
173
174 struct _E_Comp_Win
175 {
176    EINA_INLIST;
177
178    E_Comp                     *c; // parent compositor
179    Ecore_X_Window              win; // raw window - for menus etc.
180    E_Border                   *bd; // if its a border - later
181    E_Popup                    *pop; // if its a popup - later
182    E_Menu                     *menu; // if it is a menu - later
183    int                         x, y, w, h; // geometry
184    struct
185    {
186       int                      x, y; // temporary geometry (for save geometry from window was resized to rendering was finished)
187    } resizing;
188    struct
189    {
190       int                      x, y, w, h; // hidden geometry (used when its unmapped and re-instated on map)
191    } hidden;
192    int                         pw, ph; // pixmap w/h
193    int                         border; // border width
194    Ecore_X_Pixmap              pixmap; // the compositing pixmap
195    Ecore_X_Damage              damage; // damage region
196    Ecore_X_Visual              vis; // window visual
197    int                         depth; // window depth
198    Eina_List                  *objs; // list of E_Comp_Object
199    E_Update                   *up; // update handler
200    E_Object_Delfn             *dfn; // delete function handle for objects being tracked
201    Ecore_X_Sync_Counter        counter; // sync counter for syncronised drawing
202    Ecore_Timer                *update_timeout; // max time between damage and "done" event
203    Ecore_Timer                *ready_timeout;  // max time on show (new window draw) to wait for window contents to be ready if sync protocol not handled. this is fallback.
204    int                         dmg_updates; // num of damage event updates since a redirect
205    Ecore_X_Rectangle          *rects; // shape rects... if shaped :(
206    int                         rects_num; // num rects above
207    Ecore_X_Pixmap              cache_pixmap; // the cached pixmap (1/nth the dimensions)
208    int                         cache_w, cache_h; // cached pixmap size
209    int                         update_count; // how many updates have happend to this win
210    double                      last_visible_time; // last time window was visible
211    double                      last_draw_time; // last time window was damaged
212    int                         pending_count; // pending event count
213    unsigned int                opacity;  // opacity set with _NET_WM_WINDOW_OPACITY
214    char                       *title, *name, *clas, *role; // fetched for override-redirect windowa
215    Ecore_X_Window_Type         primary_type; // fetched for override-redirect windowa
216    unsigned char               misses; // number of sync misses
217    struct {
218       int                      version; // version of efl sync
219       int                      val; // sync value
220       int                      done_count; // draw done event count
221    } sync_info;
222    Eina_Bool                   delete_pending : 1; // delete pendig
223    Eina_Bool                   hidden_override : 1; // hidden override
224    Eina_Bool                   animating : 1; // it's busy animating - defer hides/dels
225    Eina_Bool                   force : 1; // force del/hide even if animating
226    Eina_Bool                   defer_hide : 1; // flag to get hide to work on deferred hide
227    Eina_Bool                   delete_me : 1; // delete me!
228    Eina_Bool                   visible : 1; // is visible
229    Eina_Bool                   input_only : 1; // is input_only
230    Eina_Bool                   override : 1; // is override-redirect
231    Eina_Bool                   argb : 1; // is argb
232    Eina_Bool                   shaped : 1; // is shaped
233    Eina_Bool                   update : 1; // has updates to fetch
234    Eina_Bool                   redirected : 1; // has updates to fetch
235    Eina_Bool                   shape_changed : 1; // shape changed
236    Eina_Bool                   drawme : 1; // drawme flag fo syncing rendering
237    Eina_Bool                   invalid : 1; // invalid depth used - just use as marker
238    Eina_Bool                   nocomp : 1; // nocomp applied
239    Eina_Bool                   needpix : 1; // need new pixmap
240    Eina_Bool                   real_hid : 1; // last hide was a real window unmap
241    Eina_Bool                   inhash : 1; // is in the windows hash
242    Eina_Bool                   show_ready : 1;  // is this window ready for its first show
243    Eina_Bool                   show_anim : 1; // ran show animation
244    Eina_Bool                   use_dri2 : 1;
245
246    Eina_Bool                   animate_hide : 1 ; // if window animation effect is occured, do hide unrelated window. -> use evas_object_hide()
247    Eina_Bool                   resize_hide : 1; // if window do resize event received, set this valuse true; and check win_update()
248    Eina_Bool                   show_done : 1 ; // check for show is done
249    Eina_Bool                   effect_stage: 1; // check for if background window is hided or not.
250    Eina_Bool                   defer_raise; // flag to defer to raise
251    Eina_Bool                   activate; // flag to check activate
252    E_Comp_Effect_Type         *eff_type;
253    E_Comp_Win_Type             win_type;
254    E_Comp_Win_Shape_Input     *shape_input;
255    E_Comp_BG_Win              *bgwin;
256    int                         angle; // window's current angle property
257    Eina_Bool                   launched : 1; //flag for checking whether launch or not
258
259    // ov object
260    Ecore_X_Image              *ov_xim;
261    Evas_Object                *ov_obj;
262    struct
263    {
264       int                      x, y, w, h;
265    } ov;
266
267    /* transparent rectangle for showing under the H/W ui layer. i.e., video layer */
268    struct
269    {
270       Eina_Bool                use;
271       int                      x, y, w, h;
272    } transp_rect;
273
274    struct
275    {
276       Eina_Bool                set_drawable;
277       int                      geo_changed;
278       int                      resize_pending;
279    } hwc;
280
281    Eina_Bool                   sync_draw_support: 1; // 1: update with damage immediately 2: ignore damage before receiving sync_draw_done
282    // interfacing for 3d stereoscopic mode
283    Eina_Bool                   win3d; // flag to set 3D window
284    Eina_Bool                   always_selective_mode: 1; // always selective mode (this window can't no-comp mode)
285
286    // ignore rendering when hide
287    Eina_Bool                   ignore_dmg; // dmg ignore
288 };
289
290 #endif
291 #endif