summaryrefslogtreecommitdiff
path: root/src/bin/e_comp.h
blob: d360aeb1162d22ec344eb42404fcfda6f4251516 (plain)
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
#ifdef E_TYPEDEFS
typedef struct _E_Comp      E_Comp;
typedef struct _E_Comp_Data      E_Comp_Data;
typedef struct E_Comp_Client_Data E_Comp_Client_Data;

#define E_COMP_TYPE (int) 0xE0b01003

#define E_LAYER_COUNT 19
#define E_CLIENT_LAYER_COUNT 11

typedef enum _E_Layer
{
   E_LAYER_BOTTOM = -100,
   E_LAYER_BG = -1, // zone bg stuff
   E_LAYER_DESKTOP = 0, // desktop objects: fileman, gadgets, shelves
   E_LAYER_DESKTOP_TOP = 10, // raised desktop objects: gadgets
   E_LAYER_CLIENT_DESKTOP = 100, //shelves
   E_LAYER_CLIENT_BELOW = 150,
   E_LAYER_CLIENT_NORMAL = 200,
   E_LAYER_CLIENT_ABOVE = 250,
   E_LAYER_CLIENT_EDGE = 300,
   E_LAYER_CLIENT_FULLSCREEN = 350,
   E_LAYER_CLIENT_EDGE_FULLSCREEN = 400,
   E_LAYER_CLIENT_POPUP = 450,
   E_LAYER_CLIENT_TOP = 500,
   E_LAYER_CLIENT_DRAG = 550,
   E_LAYER_CLIENT_PRIO = 600,
   E_LAYER_POPUP = 999, // popups
   E_LAYER_MENU = 5000, // menus
   E_LAYER_DESKLOCK = 9999, // desklock
   E_LAYER_MAX = 32767 // EVAS_LAYER_MAX
} E_Layer;

#else
#ifndef E_MOD_COMP_H
#define E_MOD_COMP_H

# include "e_comp_cfdata.h"


struct _E_Comp
{
   E_Object e_obj_inherit;

   Ecore_Window  win; // input overlay
   Ecore_Evas     *ee;
   Ecore_Window  ee_win;
   Evas           *evas;
   Evas_Object    *bg_blank_object;
   Eina_List      *zones;
   E_Manager      *man;
   E_Pointer      *pointer;
   Eina_List *clients;
   unsigned int new_clients;

   E_Comp_Data *comp_data;

   unsigned int num;
   Eina_Stringshare *name;
   struct {
      Ecore_Window win;
      Evas_Object *obj;
      //Eina_Inlist *objs; /* E_Comp_Object; NOT to be exposed; seems pointless? */
      Eina_Inlist *clients; /* E_Client, bottom to top */
      unsigned int clients_count;
   } layers[E_LAYER_COUNT];

   struct
   {
      Evas_Object *rect;
      Evas_Object *obj;
      Ecore_Event_Handler *key_handler;
      E_Comp_Object_Autoclose_Cb del_cb;
      E_Comp_Object_Key_Cb key_cb;
      void *data;
   } autoclose;

   Eina_List *debug_rects;
   Eina_List *ignore_wins;

   Eina_List      *updates;
   Eina_List      *post_updates;
   Ecore_Animator *render_animator;
   Ecore_Job      *shape_job;
   Ecore_Job      *update_job;
   Evas_Object    *fps_bg;
   Evas_Object    *fps_fg;
   Ecore_Job      *screen_job;
   Ecore_Timer    *nocomp_delay_timer;
   Ecore_Timer    *nocomp_override_timer;
   int             animating;
   double          frametimes[122];
   int             frameskip;

   int             nocomp_override; //number of times nocomp override has been requested
   Ecore_Window block_win;
   int             block_count; //number of times block window has been requested

   Ecore_Window  cm_selection; //FIXME: move to comp_x ?

   int depth;

   Ecore_Cb        grab_cb;
   Ecore_Cb        bindings_grab_cb;
   Ecore_Cb        bindings_ungrab_cb;

   Eina_Bool       gl : 1;
   Eina_Bool       grabbed : 1;
   Eina_Bool       nocomp : 1;
   Eina_Bool       nocomp_want : 1;
   Eina_Bool       saver : 1;
};

typedef enum
{
   E_COMP_ENGINE_NONE = 0,
   E_COMP_ENGINE_SW = 1,
   E_COMP_ENGINE_GL = 2
} E_Comp_Engine;

EINTERN Eina_Bool e_comp_init(void);
EAPI E_Comp *e_comp_new(void);
EAPI int e_comp_internal_save(void);
EINTERN int e_comp_shutdown(void);
EAPI void e_comp_render_queue(E_Comp *c);
EAPI void e_comp_shape_queue(E_Comp *c);
EAPI E_Comp_Config *e_comp_config_get(void);
EAPI const Eina_List *e_comp_list(void);
EAPI void e_comp_shadows_reset(void);
EAPI E_Comp *e_comp_get(const void *o);
EAPI Ecore_Window e_comp_top_window_at_xy_get(E_Comp *c, Evas_Coord x, Evas_Coord y);
EAPI void e_comp_util_wins_print(const E_Comp *c);
EAPI void e_comp_ignore_win_add(E_Pixmap_Type type, Ecore_Window win);
EAPI void e_comp_ignore_win_del(E_Pixmap_Type type, Ecore_Window win);
EAPI Eina_Bool e_comp_ignore_win_find(Ecore_Window win);
EAPI void e_comp_override_del(E_Comp *c);
EAPI void e_comp_override_add(E_Comp *c);
EAPI void e_comp_block_window_add(void);
EAPI void e_comp_block_window_del(void);
EAPI E_Comp *e_comp_find_by_window(Ecore_Window win);
EAPI void e_comp_override_timed_pop(E_Comp *c);
EAPI unsigned int e_comp_e_object_layer_get(const E_Object *obj);
EAPI Eina_Bool e_comp_grab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd);
EAPI void e_comp_ungrab_input(E_Comp *c, Eina_Bool mouse, Eina_Bool kbd);
EAPI void e_comp_gl_set(Eina_Bool set);
EAPI Eina_Bool e_comp_gl_get(void);
EAPI E_Comp *e_comp_evas_find(const Evas *e);

EAPI void e_comp_button_bindings_grab_all(void);
EAPI void e_comp_button_bindings_ungrab_all(void);

static inline E_Comp *
e_comp_util_evas_object_comp_get(Evas_Object *obj)
{
   return ecore_evas_data_get(ecore_evas_ecore_evas_get(evas_object_evas_get(obj)), "comp");
}

static inline Eina_Bool
e_comp_util_client_is_fullscreen(const E_Client *ec)
{
   if ((!ec->visible) || (ec->input_only))
     return EINA_FALSE;
   return ((ec->client.x == 0) && (ec->client.y == 0) &&
       ((ec->client.w) >= ec->comp->man->w) &&
       ((ec->client.h) >= ec->comp->man->h) &&
       (!ec->argb) && (!ec->shaped)
       );
}

#endif
#endif