Added a policy to support such as quickpanel to rotate based Window manager.
[platform/core/uifw/e17-extra-modules.git] / illume2-tizen / src / e_illume.h
1 #ifndef E_ILLUME_H
2 # define E_ILLUME_H
3
4 #ifdef HAVE_GETTEXT
5 #define _(str) gettext(str)
6 #define d_(str, dom) dgettext(PACKAGE dom, str)
7 #else
8 #define _(str) (str)
9 #define d_(str, dom) (str)
10 #endif
11
12 /**
13  * @file e_illume.h
14  *
15  * This header provides the various defines, structures and functions that
16  * make writing Illume policies easier.
17  *
18  * For details on the available functions, see @ref E_Illume_Main_Group.
19  *
20  * For details on the configuration structure, see @ref E_Illume_Config_Group.
21  *
22  * For details on the Policy API, see @ref E_Illume_Policy_Group.
23  *
24  * For details on quickpanels, see @ref E_Illume_Quickpanel_Group.
25  */
26
27 /* include standard E header */
28 # include "e.h"
29
30 /* define all of our typedefs */
31 typedef struct _E_Illume_Policy_Api E_Illume_Policy_Api;
32 typedef struct _E_Illume_Policy E_Illume_Policy;
33 typedef struct _E_Illume_Config E_Illume_Config;
34 typedef struct _E_Illume_Config_Zone E_Illume_Config_Zone;
35 typedef struct _E_Illume_Quickpanel E_Illume_Quickpanel;
36 typedef struct _E_Illume_Quickpanel_Info E_Illume_Quickpanel_Info;
37
38 typedef enum _E_Illume_Quickpanel_Ani_Type
39 {
40    E_ILLUME_QUICKPANEL_ANI_NONE,
41    E_ILLUME_QUICKPANEL_ANI_SHOW,
42    E_ILLUME_QUICKPANEL_ANI_HIDE
43 } E_Illume_Quickpanel_Ani_Type;
44
45 /**
46  * @def E_ILLUME_POLICY_API_VERSION
47  * @brief Current version of the Policy API that is supported by the Illume
48  * module.
49  *
50  * @warning Policies not written to match this version will fail to load.
51  *
52  * @ingroup E_Illume_Policy_Group
53  */
54 # define E_ILLUME_POLICY_API_VERSION 2
55
56 /**
57  * @brief structure for policy API.
58  *
59  * @details When Illume tries to load a policy, it will check for the
60  * existince of this structure. If it is not found, the policy will fail
61  * to load.
62  *
63  * @warning This structure is required for Illume to load a policy.
64  *
65  * @ingroup E_Illume_Policy_Group
66  */
67 struct _E_Illume_Policy_Api
68 {
69    int version;
70    /**< The version of this policy. */
71
72    const char *name;
73    /**< The name of this policy. */
74    const char *label;
75    /**< The label of this policy that will be displayed in the Policy Selection dialog. */
76 };
77
78 /**
79  * @brief structure for policy
80  *
81  * This structure actually holds the policy functions that Illume will call
82  * at the appropriate times.
83  *
84  * @ingroup E_Illume_Policy_Group
85  */
86 struct _E_Illume_Policy
87 {
88    E_Object e_obj_inherit;
89
90    E_Illume_Policy_Api *api;
91    /**< pointer to the @ref E_Illume_Policy_Api structure.
92     * @warning Policies are required to implement this or they will fail to
93     * load. */
94
95    void *handle;
96
97    struct
98      {
99         void *(*init) (E_Illume_Policy *p);
100         /**< pointer to the function that Illume will call to initialize this
101          * policy. Typically, a policy would set the pointers to the functions
102          * that it supports in here.
103          * @warning Policies are required to implement this function. */
104
105         int (*shutdown) (E_Illume_Policy *p);
106         /**< pointer to the function that Illume will call to shutdown this
107          * policy. Typically, a policy would do any cleanup that it needs to
108          * do in here.
109          * @warning Policies are required to implement this function. */
110
111         void (*border_add) (E_Border *bd);
112         /**< pointer to the function that Illume will call when a new border
113          * gets added. @note This function is optional. */
114
115         void (*border_del) (E_Border *bd);
116         /**< pointer to the function that Illume will call when a border gets
117          * deleted. @note This function is optional. */
118
119         void (*border_focus_in) (E_Border *bd);
120         /**< pointer to the function that Illume will call when a border gets
121          * focus. @note This function is optional. */
122
123         void (*border_focus_out) (E_Border *bd);
124         /**< pointer to the function that Illume will call when a border loses
125          * focus. @note This function is optional. */
126
127         void (*border_activate) (E_Border *bd);
128         /**< pointer to the function that Illume will call when a border gets
129          * an activate message. @note This function is optional. */
130
131         void (*border_post_fetch) (E_Border *bd);
132         /**< pointer to the function that Illume will call when E signals a
133          * border post fetch. @note This function is optional. */
134
135         void (*border_post_assign) (E_Border *bd);
136         /**< pointer to the function that Illume will call when E signals a
137          * border post assign. @note This function is optional. */
138
139         void (*border_show) (E_Border *bd);
140         /**< pointer to the function that Illume will call when a border gets
141          * shown. @note This function is optional. */
142
143         void (*border_move) (E_Border *bd);
144
145         void (*zone_layout) (E_Zone *zone);
146         /**< pointer to the function that Illume will call when a Zone needs
147          * to update it's layout. @note This function is optional. */
148
149         void (*zone_move_resize) (E_Zone *zone);
150         /**< pointer to the function that Illume will call when a Zone gets
151          * moved or resized. @note This function is optional. */
152
153         void (*zone_mode_change) (E_Zone *zone, Ecore_X_Atom mode);
154         /**< pointer to the function that Illume will call when the layout
155          * mode of a Zone changes. @note This function is optional. */
156
157         void (*zone_close) (E_Zone *zone);
158         /**< pointer to the function that Illume will call when the user has
159          * requested a border get closed. This is usually signaled from the
160          * Softkey window. @note This function is optional. */
161
162         void (*drag_start) (E_Border *bd);
163         /**< pointer to the function that Illume will call when the user has
164          * started to drag the Indicator/Softkey windows.
165          * @note This function is optional. */
166
167         void (*drag_end) (E_Border *bd);
168         /**< pointer to the function that Illume will call when the user has
169          * stopped draging the Indicator/Softkey windows.
170          * @note This function is optional. */
171
172         void (*focus_back) (E_Zone *zone);
173         /**< pointer to the function that Illume will call when the user has
174          * requested to cycle the focused border backwards. This is typically
175          * signalled from the Softkey window.
176          * @note This function is optional. */
177
178         void (*focus_forward) (E_Zone *zone);
179         /**< pointer to the function that Illume will call when the user has
180          * requested to cycle the focused border forward. This is typically
181          * signalled from the Softkey window.
182          * @note This function is optional. */
183
184         void (*property_change) (Ecore_X_Event_Window_Property *event);
185         /**< pointer to the function that Illume will call when properties
186          * change on a window. @note This function is optional. */
187
188         void (*window_focus_in) (Ecore_X_Event_Window_Focus_In *event);
189
190         void (*border_restack_request) (E_Border* bd, E_Border* sibling, int mode);
191         void (*border_stack) (E_Event_Border_Stack* ev);
192         void (*border_zone_set) (E_Event_Border_Zone_Set *event);
193
194         void (*border_post_new_border) (E_Border *bd);
195
196         void (*border_pre_fetch) (E_Border *bd);
197         void (*border_new_border) (E_Border *bd);
198 #ifdef _F_BORDER_HOOK_PATCH_
199         void (*border_del_border) (E_Border *bd);
200 #endif
201         void (*window_configure_request) (Ecore_X_Event_Window_Configure_Request *event);
202
203         void (*border_iconify_cb) (E_Border *bd);
204         void (*border_uniconify_cb) (E_Border *bd);
205
206         /* for visibility */
207         void (*window_create) (Ecore_X_Event_Window_Create *event);
208         void (*window_destroy) (Ecore_X_Event_Window_Destroy *event);
209         void (*window_reparent) (Ecore_X_Event_Window_Reparent *event);
210         void (*window_show) (Ecore_X_Event_Window_Show *event);
211         void (*window_hide) (Ecore_X_Event_Window_Hide *event);
212         void (*window_configure) (Ecore_X_Event_Window_Configure *event);
213
214         void (*window_sync_draw_done) (Ecore_X_Event_Client_Message *event);
215         void (*quickpanel_state_change) (Ecore_X_Event_Client_Message *event);
216
217         /* for popsync feature */
218         void (*window_desk_set) (Ecore_X_Event_Client_Message *event);
219
220         void (*window_move_resize_request) (Ecore_X_Event_Window_Move_Resize_Request *event);
221         void (*window_state_request) (Ecore_X_Event_Window_State_Request *event);
222
223         void (*module_update) (E_Event_Module_Update *event);
224
225         void (*idle_enterer) (void);
226
227         void (*illume_win_state_change_request) (Ecore_X_Event_Client_Message *event);
228
229         void (*rotation_list_add) (E_Border *bd);
230      } funcs;
231 };
232
233
234 /**
235  * @brief structure for Illume configuration.
236  *
237  * @ingroup E_Illume_Config_Group
238  */
239 struct _E_Illume_Config
240 {
241    int version;
242
243    struct
244      {
245         struct
246           {
247              int duration;
248              /**< integer specifying the amount of time it takes for an
249               * animation to complete. */
250           } vkbd, quickpanel;
251      } animation;
252
253    struct
254      {
255         const char *name;
256         /**< the name of the currently active/selected policy. */
257         struct
258           {
259              const char *class;
260              /**< The window class to match on */
261              const char *name;
262              /**< The window name to match on */
263              const char *title;
264              /**< The window title to match on */
265              int type;
266              /**< The window type to match on */
267              struct
268                {
269                   int class;
270                   /**< flag to indicate if we should match on class */
271                   int name;
272                   /**< flag to indicate if we should match on name */
273                   int title;
274                   /**< flag to indicate if we should match on title */
275                   int type;
276                   /**< flag to indicate if we should match on type */
277                } match;
278           } vkbd, indicator, softkey, home;
279         Eina_List *zones;
280      } policy;
281
282    struct
283      {
284         const char *mobile;
285         /**< the name of the type of window to be located mobile. */
286         const char *desktop;
287         /**< the name of the type of window to be located desktop. */
288         const char *popsync;
289         /**< the name of the type of window to be located popsync. */
290      } display_name;
291
292    Eina_Bool use_mem_trim;
293    Eina_Bool use_indicator_widget;
294    Eina_Bool use_force_iconify;
295    int floating_control_threshold;
296 };
297
298 /**
299  * @brief structure for Illume zone configuration.
300  *
301  * @ingroup E_Illume_Config_Group
302  */
303 struct _E_Illume_Config_Zone
304 {
305    int id;
306    struct
307      {
308         int dual;
309         /**< integer specifying whice mode we are in (0 == single application mode, 1 == dual application mode) */
310         int side;
311         /**< interger specifying if we layout windows in top/bottom or left/right when in dual mode */
312      } mode;
313
314    /* NB: These are not configurable by user...just placeholders */
315    struct
316      {
317         int size;
318      } vkbd, indicator, softkey;
319 };
320
321 struct _E_Illume_Quickpanel_Info
322 {
323    E_Border *bd;
324    int angle;
325
326    /* for mini controller */
327    Eina_Bool mini_controller;
328 };
329
330 /**
331  * @brief structure for Illume Quickpanels.
332  *
333  * @ingroup E_Illume_Quickpanel_Group
334  */
335 struct _E_Illume_Quickpanel
336 {
337    E_Object e_obj_inherit;
338
339    E_Zone *zone;
340    /**< the current zone on which this quickpanel belongs */
341    E_Border *bd;
342    /**< the border of this quickpanel */
343    Eina_List *borders;
344    /**< a list of borders that this quickpanel contains */
345    Ecore_Timer *timer;
346    Ecore_Animator *animator;
347    Ecore_Event_Handler *key_hdl;
348    double start, len;
349    struct
350      {
351         int size, isize, adjust, adjust_start, adjust_end, dir;
352      } vert, horiz;
353
354    int angle;
355    int ani_type;
356
357    unsigned char visible;
358    /**< flag to indicate if the quickpanel is currently visible */
359
360    E_Win *popup;
361    Ecore_Evas *ee;
362    Evas *evas;
363
364    Evas_Coord down_x, down_y;
365    int down_adjust;
366    Eina_Bool dragging : 1;
367    Eina_Bool down : 1;
368    Eina_Bool horiz_style : 1;
369
370    Evas_Object *ly_base;
371    Eina_Bool hide_trigger;
372
373    int popup_len;
374    int item_pos_y;
375    int threshold_y, move_x_min;
376    double scale;
377    E_Border *ind;
378
379    Eina_Bool is_lock;
380    Eina_List *hidden_mini_controllers;
381
382    struct
383      {
384         unsigned char layer :1;
385      } changes;
386    unsigned char changed :1;
387
388    unsigned int layer;
389
390    E_Border *below_bd;
391 };
392
393
394 /* define function prototypes that policies can use */
395 EAPI E_Illume_Config_Zone *e_illume_zone_config_get(int id);
396
397 /* general functions */
398 EAPI Eina_Bool e_illume_border_is_indicator(E_Border *bd);
399 EAPI Eina_Bool e_illume_border_is_keyboard(E_Border *bd);
400 EAPI Eina_Bool e_illume_border_is_keyboard_sub(E_Border *bd);
401 EAPI Eina_Bool e_illume_border_is_dialog(E_Border *bd);
402 EAPI Eina_Bool e_illume_border_is_splash(E_Border *bd);
403 EAPI Eina_Bool e_illume_border_is_qt_frame(E_Border *bd);
404 EAPI Eina_Bool e_illume_border_is_fullscreen(E_Border *bd);
405 EAPI Eina_Bool e_illume_border_is_conformant(E_Border *bd);
406 EAPI Eina_Bool e_illume_border_is_quickpanel(E_Border *bd);
407 EAPI Eina_Bool e_illume_border_is_lock_screen(E_Border *bd);
408 EAPI Eina_Bool e_illume_border_is_notification(E_Border *bd);
409 EAPI Eina_Bool e_illume_border_is_utility(E_Border *bd);
410 EAPI Eina_Bool e_illume_border_is_clipboard(E_Border *bd);
411
412 EAPI void e_illume_border_min_get(E_Border *bd, int *w, int *h);
413 EAPI void e_illume_border_max_get(E_Border *bd, int *w, int *h);
414 EAPI E_Border *e_illume_border_at_xy_get(E_Zone *zone, int x, int y);
415 EAPI E_Border *e_illume_border_parent_get(E_Border *bd);
416 EAPI void e_illume_border_show(E_Border *bd);
417 EAPI void e_illume_border_hide(E_Border *bd);
418 EAPI Eina_Bool e_illume_border_is_fixed(E_Border *bd);
419
420 /* indicator functions */
421 EAPI E_Border *e_illume_border_indicator_get(E_Zone *zone);
422 EAPI void e_illume_border_indicator_pos_get(E_Zone *zone, int *x, int *y);
423
424 /* quickpanel functions */
425 EAPI E_Illume_Quickpanel *e_illume_quickpanel_by_zone_get(E_Zone *zone);
426 EAPI Eina_List* e_illume_quickpanel_get (void);
427 EAPI void e_illume_quickpanel_show(E_Zone *zone, int isAni);
428 EAPI void e_illume_quickpanel_hide(E_Zone *zone, int isAni);
429 EAPI Eina_Bool e_illume_border_is_quickpanel_popup(E_Border *bd);
430
431 /* app tray functions */
432 EAPI Eina_Bool e_illume_border_is_app_tray(E_Border *bd);
433 EAPI Eina_Bool e_illume_border_is_miniapp_tray(E_Border *bd);
434 #endif