summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2014-08-19 19:02:57 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2014-08-22 10:01:03 -0400
commitd15a8f38a61478b41e0ac80ff3ee6f12e068534d (patch)
tree6eb3bb26c4daa19f570f624408c0001d1991fb47
parentd177714539924caf6f215ea6531aaa7e42256b12 (diff)
expose start
-rw-r--r--e-module-desksanity.edc291
-rw-r--r--src/Makefile.am1
-rw-r--r--src/e_mod_main.c2
-rw-r--r--src/e_mod_main.h3
-rw-r--r--src/zoom.c602
-rw-r--r--win_shadow.pngbin0 -> 501 bytes
6 files changed, 899 insertions, 0 deletions
diff --git a/e-module-desksanity.edc b/e-module-desksanity.edc
index f09dd1f..430e654 100644
--- a/e-module-desksanity.edc
+++ b/e-module-desksanity.edc
@@ -44,4 +44,295 @@ collections {
44 } 44 }
45 } 45 }
46 } 46 }
47 group { name: "e/modules/desksanity/zoom/base"; program_source: "e";
48 parts {
49 swallow { "e.swallow.background"; clip: "clip";
50 }
51 rect { "fader"; nomouse;
52 desc {
53 color: 0 0 0 0;
54 link.base: "e,state,inactive";
55 link.transition: LINEAR 0.3;
56 link.after: "fade_post";
57 }
58 desc { "fade";
59 color: 0 0 0 192;
60 link.base: "e,state,active";
61 link.transition: LINEAR 0.3;
62 }
63 program { "fade_post";
64 action: SIGNAL_EMIT "e,action,done" "e";
65 }
66 }
67 rect { "clip";
68 desc { color: 255 255 255 0;
69 link.base: "e,state,inactive";
70 link.transition: LINEAR 0.3;
71 }
72 desc { "active";
73 link.base: "e,state,active";
74 link.transition: LINEAR 0.3;
75 }
76 }
77 swallow { "e.swallow.layout"; clip: "clip"; }
78 program { signal: "e,state,inactive";
79 action: SIGNAL_EMIT "e,state,hiding" "e";
80 }
81 }
82 }
83 group { name: "e/modules/desksanity/zoom/scrollframe";
84 parts {
85 rect { "clipper"; nomouse;
86 desc {
87 rel1.to: "e.swallow.content";
88 rel2.to: "e.swallow.content";
89 }
90 }
91 swallow { "e.swallow.content";
92 clip: "clipper";
93 }
94 }
95 }
96 group { name: "e/modules/desksanity/zoom/client"; nomouse;
97 images.image: "win_shadow.png" COMP;
98 script {
99 public message(Msg_Type:type, id, ...) {
100 if (type == MSG_INT_SET) {
101 /* client diff geom[4] */
102 new x, y, w, h;
103
104 x = getarg(2);
105 y = getarg(3);
106 w = getarg(4);
107 h = getarg(5);
108
109 custom_state(PART:"spacer", "default", 0.0);
110 set_state_val(PART:"spacer", STATE_REL1_OFFSET, x, y);
111 set_state_val(PART:"spacer", STATE_REL2_OFFSET, w, h);
112 set_state(PART:"spacer", "custom", 0.0);
113 }
114 }
115 }
116 parts {
117 spacer { "spacer";
118 program { signal: "e,action,show"; source: "e";
119 action: STATE_SET "default" 0.0;
120 transition: LINEAR 0.3;
121 target: "spacer";
122 after: "idle";
123 }
124 program { signal: "e,action,hide"; source: "e";
125 action: STATE_SET "custom" 0.0;
126 transition: LINEAR 0.3;
127 target: "spacer";
128 }
129 }
130 part { "shadow"; clip: "clip";
131 desc {
132 image.normal: "win_shadow.png";
133 image.border: 14 14 14 14;
134 image.middle: 0;
135 rel1.to: "e.swallow.client";
136 rel1.offset: -7 -3;
137 rel2.to: "e.swallow.client";
138 rel2.offset: 6 11;
139 fill.smooth: 0;
140 }
141 }
142 rect { "outline";
143 desc {
144 color: 51 153 255 0;
145 rel1.to: "e.swallow.client";
146 rel1.offset: -2 -2;
147 rel2.to: "e.swallow.client";
148 rel2.offset: 2 2;
149 visible: 0;
150 link.base: "e,state,unfocused" "e";
151 link.transition: LINEAR 0.2;
152 }
153 desc { "active"; inherit: "default";
154 color: 51 153 255 170;
155 visible: 1;
156 link.base: "e,state,focused" "e";
157 link.transition: LINEAR 0.2;
158 }
159 }
160 rect { "bg";
161 desc {
162 color: 0 0 0 255;
163 rel1.to: "e.swallow.client";
164 rel2.to: "e.swallow.client";
165 }
166 }
167 swallow { "e.swallow.client"; clip: "clip";
168 desc {
169 rel1.to: "spacer";
170 rel2.to: "spacer";
171 rel1.offset: 10 10;
172 rel2.offset: -10 -10;
173 map.on: 1;
174 link.base: "mouse,out" "events";
175 link.transition: LINEAR 0.2;
176 link.after: "idle";
177 }
178 desc { "active";
179 rel1.to: "spacer";
180 rel2.to: "spacer";
181 rel2.relative: 1.3 1.3;
182 rel2.offset: -1 -1;
183 link.base: "mouse,in" "events";
184 link.transition: LINEAR 0.2;
185 }
186 desc { "idle1"; inherit: "default";
187 map.on: 1;
188 map.rotation.z: -5;
189 }
190 desc { "idle2"; inherit: "idle1";
191 map.rotation.z: 5;
192 }
193 desc { "idle3"; inherit: "idle1";
194 map.rotation.z: 5;
195 map.rotation.x: -70;
196 }
197 desc { "idle4"; inherit: "idle1";
198 map.rotation.z: 0;
199 map.rotation.x: -360;
200 map.rotation.y: 360;
201 }
202 program { "idle";
203 in: 2.0 10.0;
204 action: STATE_SET "idle1";
205 transition: SINUSOIDAL 6.0;
206 target: "e.swallow.client";
207 sequence {
208 action: STATE_SET "idle2";
209 name: "idle2";
210 transition: SINUSOIDAL 6.0;
211 target: "e.swallow.client";
212 in: 2.0 10.0;
213
214 action: STATE_SET "idle3";
215 name: "idle3";
216 transition: ACCEL 6.0;
217 target: "e.swallow.client";
218 in: 2.0 10.0;
219
220 action: STATE_SET "idle4";
221 name: "idle4";
222 transition: SINUSOIDAL 6.0;
223 target: "e.swallow.client";
224 in: 2.0 10.0;
225 after: "idle";
226 }
227 }
228 }
229 rect { "clip";
230 desc {
231 rel1.offset: -9999 -9999;
232 rel2.offset: 9999 9999;
233 color: 255 255 255 200;
234 link.base: "mouse,out" "events";
235 link.transition: LINEAR 0.2;
236 }
237 desc { "active"; inherit: "default";
238 color: 255 255 255 255;
239 link.base: "mouse,in" "events";
240 link.transition: LINEAR 0.2;
241 }
242 }
243 proxy { "clone";
244 desc {
245 source: "e.swallow.client";
246 rel1.to: "e.swallow.client";
247 rel2.to: "e.swallow.client";
248 hid;
249 color: 255 255 255 0;
250 }
251 desc { "urgent1"; inherit: "default";
252 vis;
253 color: 255 255 255 255;
254 }
255 desc { "urgent2"; inherit: "default";
256 vis;
257 rel1.relative: -0.5 -0.5;
258 rel2.relative: 1.5 1.5;
259 color: 255 255 255 0;
260 }
261 program { name: "urgent";
262 signal: "e,state,urgent"; source: "e";
263 action: ACTION_STOP;
264 target: "go_big";
265 target: "go_big2";
266 after: "go_big";
267 }
268 program { name: "go_big";
269 action: STATE_SET "urgent1" 0.0;
270 target: "clone";
271 after: "go_big2";
272 }
273 program { name: "go_big2";
274 action: STATE_SET "urgent2" 0.0;
275 transition: LINEAR 0.5;
276 target: "clone";
277 after: "go_big";
278 }
279 program { name: "not_urgent";
280 signal: "e,state,not_urgent"; source: "e";
281 action: ACTION_STOP;
282 target: "go_big";
283 target: "go_big2";
284 after: "go_hid";
285 }
286 program { name: "go_hid";
287 action: STATE_SET "default" 0.0;
288 transition: LINEAR 0.5;
289 target: "clone";
290 }
291 }
292 text { "e.text.title"; clip: "clip"; effect: OUTLINE;
293 desc {
294 fixed: 1 1;
295 align: 0.0 0.0;
296 rel1.to_x: "e.swallow.icon";
297 rel1.to_y: "e.swallow.client";
298 rel1.relative: 1.0 1.0;
299 rel1.offset: 0 10;
300 rel2.to: "e.swallow.client";
301 color: 255 255 255 255;
302 color2: 0 0 0 255;
303 text {
304 font: "Sans:style=Bold"; size: 12;
305 }
306 }
307 }
308 swallow { "e.swallow.icon"; clip: "clip";
309 desc {
310 fixed: 1 1;
311 min: 16 16;
312 align: 0.0 0.0;
313 rel1.to_x: "e.swallow.client";
314 rel1.to_y: "e.text.title";
315 rel1.offset: 0 -6;
316 rel2.to: "e.swallow.client";
317 rel2.relative: 0.0 1.0;
318 }
319 }
320 rect { "events"; mouse; repeat;
321 desc { color: 0 0 0 0; };
322 program { signal: "mouse,clicked,1"; source: "events";
323 action: SIGNAL_EMIT "e,action,activate" "e";
324 }
325 program { signal: "mouse,in"; source: "events";
326 action: SIGNAL_EMIT "e,state,active" "e";
327 sequence {
328 action: ACTION_STOP;
329 targets: "idle" "idle2" "idle3" "idle4";
330 }
331 }
332 program { signal: "mouse,out"; source: "events";
333 action: SIGNAL_EMIT "e,state,inactive" "e";
334 }
335 }
336 }
337 }
47} 338}
diff --git a/src/Makefile.am b/src/Makefile.am
index 96cdd5a..ae1affb 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,6 +15,7 @@ module_la_SOURCES = e_mod_main.h \
15 maximize.c \ 15 maximize.c \
16 moveresize.c \ 16 moveresize.c \
17 pip.c \ 17 pip.c \
18 zoom.c \
18 desksanity.c 19 desksanity.c
19 20
20module_la_LIBADD = @E_LIBS@ 21module_la_LIBADD = @E_LIBS@
diff --git a/src/e_mod_main.c b/src/e_mod_main.c
index 1a7776a..391005d 100644
--- a/src/e_mod_main.c
+++ b/src/e_mod_main.c
@@ -84,6 +84,7 @@ e_modapi_init(E_Module *m)
84 maximize_init(); 84 maximize_init();
85 85
86 pip_init(); 86 pip_init();
87 zoom_init();
87 88
88 return m; 89 return m;
89} 90}
@@ -91,6 +92,7 @@ e_modapi_init(E_Module *m)
91EAPI int 92EAPI int
92e_modapi_shutdown(E_Module *m EINA_UNUSED) 93e_modapi_shutdown(E_Module *m EINA_UNUSED)
93{ 94{
95 zoom_shutdown();
94 pip_shutdown(); 96 pip_shutdown();
95 if (!ds_config->disable_maximize) 97 if (!ds_config->disable_maximize)
96 maximize_shutdown(); 98 maximize_shutdown();
diff --git a/src/e_mod_main.h b/src/e_mod_main.h
index b908022..96247e4 100644
--- a/src/e_mod_main.h
+++ b/src/e_mod_main.h
@@ -100,4 +100,7 @@ EINTERN void pip_shutdown(void);
100 100
101EINTERN void ds_config_init(void); 101EINTERN void ds_config_init(void);
102EINTERN void ds_config_shutdown(void); 102EINTERN void ds_config_shutdown(void);
103
104EINTERN void zoom_init(void);
105EINTERN void zoom_shutdown(void);
103#endif 106#endif
diff --git a/src/zoom.c b/src/zoom.c
new file mode 100644
index 0000000..8129bee
--- /dev/null
+++ b/src/zoom.c
@@ -0,0 +1,602 @@
1#include "e_mod_main.h"
2
3#define MAX_COLS 4
4
5static Eina_List *zoom_objs = NULL;
6static Eina_List *current = NULL;
7static E_Action *act_zoom_desk = NULL;
8static E_Action *act_zoom_desk_all = NULL;
9static E_Action *act_zoom_zone = NULL;
10static E_Action *act_zoom_zone_all = NULL;
11
12static E_Action *cur_act = NULL;
13
14static Eina_List *handlers = NULL;
15
16static int zmw, zmh;
17
18static inline unsigned int
19_cols_calc(unsigned int count)
20{
21 if (count < 3) return 1;
22 if (count < 5) return 2;
23 if (count < 10) return 3;
24 return 4;
25}
26
27static void
28_hid(void *data EINA_UNUSED, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
29{
30 e_comp_shape_queue(e_comp_util_evas_object_comp_get(obj));
31 evas_object_hide(obj);
32 evas_object_del(obj);
33}
34
35static void
36_zoom_hide(void)
37{
38 Evas_Object *zoom_obj;
39
40 EINA_LIST_FREE(zoom_objs, zoom_obj)
41 edje_object_signal_emit(zoom_obj, "e,state,inactive", "e");
42 E_FREE_LIST(handlers, ecore_event_handler_del);
43 e_comp_ungrab_input(e_comp_get(NULL), 1, 1);
44 e_comp_shape_queue(e_comp_get(NULL));
45 current = NULL;
46 cur_act = NULL;
47}
48
49
50static void
51_dismiss()
52{
53 _zoom_hide();
54}
55
56static void
57_client_activate(void *data, Evas_Object *obj EINA_UNUSED, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
58{
59 e_client_activate(data, 1);
60 _zoom_hide();
61}
62
63static void
64_client_active(void *data EINA_UNUSED, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
65{
66 evas_object_raise(obj);
67}
68
69static void
70_zoomobj_pack_client(const E_Client *ec, const E_Zone *zone, Evas_Object *tb, Evas_Object *m, unsigned int id, unsigned int cols)
71{
72 int w, h;
73 unsigned int c, r;
74 Evas_Object *e;
75
76 e = evas_object_smart_parent_get(m);
77 if (ec->client.w > ec->client.h)
78 {
79 w = MIN((zone->w / cols) - zmw, ec->client.w);
80 h = (ec->client.h * w) / ec->client.w;
81 }
82 else
83 {
84 h = MIN((zone->w / cols) - zmh, ec->client.h);
85 w = (ec->client.w * h) / ec->client.h;
86 }
87
88 evas_object_size_hint_min_set(m, w, h);
89
90 r = (id - 1) / cols;
91 c = (id - 1) % cols;
92 e_table_pack(tb, e, c, r, 1, 1);
93 e_table_pack_options_set(e, 0, 0, 0, 0, 0.5, 0.5, zmw + w, zmh + h, 9999, 9999);
94}
95
96static void
97_zoomobj_add_client(Evas_Object *zoom_obj, Eina_List *l, Evas_Object *m)
98{
99 E_Client *ec;
100 Evas_Object *ic, *e;
101
102 ec = evas_object_data_get(m, "E_Client");
103 e = edje_object_add(ec->comp->evas);
104 evas_object_data_set(e, "__DSZOOMOBJ", zoom_obj);
105 e_comp_object_util_del_list_append(zoom_obj, e);
106 e_comp_object_util_del_list_append(zoom_obj, m);
107 e_theme_edje_object_set(e, NULL, "e/modules/desksanity/zoom/client");
108 if ((!zmw) && (!zmh))
109 edje_object_size_min_calc(e, &zmw, &zmh);
110 edje_object_signal_callback_add(e, "e,action,activate", "e", _client_activate, ec);
111 edje_object_signal_callback_add(e, "e,state,active", "e", _client_active, ec);
112 if (e_client_focused_get() == ec)
113 {
114 edje_object_signal_emit(e, "e,state,focused", "e");
115 current = l;
116 }
117 edje_object_part_swallow(e, "e.swallow.client", m);
118 edje_object_part_text_set(e, "e.text.title", e_client_util_name_get(ec));
119 if (ec->urgent)
120 edje_object_signal_emit(e, "e,state,urgent", "e");
121 ic = e_client_icon_add(ec, ec->comp->evas);
122 if (ic)
123 {
124 edje_object_part_swallow(e, "e.swallow.icon", ic);
125 e_comp_object_util_del_list_append(zoom_obj, ic);
126 }
127 evas_object_show(e);
128}
129
130static void
131_zoomobj_position_client(Evas_Object *m)
132{
133 int x, y, w, h;
134 E_Client *ec;
135 Evas_Object *e;
136 Edje_Message_Int_Set *msg;
137
138 e = evas_object_smart_parent_get(m);
139 ec = evas_object_data_get(m, "E_Client");
140 evas_object_geometry_get(e, &x, &y, &w, &h);
141 msg = alloca(sizeof(Edje_Message_Int_Set) + ((4 - 1) * sizeof(int)));
142 msg->count = 4;
143 msg->val[0] = ec->client.x - x;
144 msg->val[1] = ec->client.y - y;
145 msg->val[2] = (ec->client.x + ec->client.w) - (x + w);
146 msg->val[3] = (ec->client.y + ec->client.h) - (y + h);
147 edje_object_message_send(e, EDJE_MESSAGE_INT_SET, 0, msg);
148 edje_object_message_signal_process(e);
149 edje_object_signal_emit(e, "e,action,show", "e");
150}
151
152static Eina_Bool
153_zoom_key(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Event_Key *ev)
154{
155 Eina_List *n = NULL;
156
157 if (!e_util_strcmp(ev->key, "Escape"))
158 _zoom_hide();
159 else if (!e_util_strcmp(ev->key, "Left"))
160 n = eina_list_prev(current) ?: eina_list_last(current);
161 else if (!e_util_strcmp(ev->key, "Right"))
162 {
163 n = eina_list_next(current);
164 if (!n)
165 {
166 Eina_List *f;
167
168 for (f = n = current; f; n = f, f = eina_list_prev(f));
169 }
170 }
171 else if ((!strcmp(ev->key, "Return")) || (!strcmp(ev->key, "KP_Enter")))
172 {
173 e_client_activate(evas_object_data_get(eina_list_data_get(current), "E_Client"), 1);
174 _zoom_hide();
175 return ECORE_CALLBACK_DONE;
176 }
177 if (n)
178 {
179 Evas_Object *e, *scr;
180 int x, y, w ,h;
181 E_Zone *zone;
182
183 e = evas_object_smart_parent_get(eina_list_data_get(n));
184 edje_object_signal_emit(e, "e,state,focused", "e");
185 edje_object_signal_emit(evas_object_smart_parent_get(eina_list_data_get(current)), "e,state,unfocused", "e");
186 current = n;
187 evas_object_geometry_get(e, &x, &y, &w, &h);
188 scr = edje_object_part_swallow_get(evas_object_data_get(e, "__DSZOOMOBJ"), "e.swallow.layout");
189 zone = e_comp_object_util_zone_get(scr);
190 e_scrollframe_child_region_show(scr, x - zone->x, y - zone->y, w, h);
191 }
192 return ECORE_CALLBACK_DONE;
193}
194
195static void
196_relayout(Evas_Object *zoom_obj, Evas_Object *scr, Evas_Object *tb)
197{
198 Eina_List *l, *clients;
199 Evas_Object *m;
200 int tw, th;
201 unsigned int id = 1;
202
203 clients = evas_object_data_get(zoom_obj, "__DSCLIENTS");
204 e_comp_object_util_del_list_remove(zoom_obj, tb);
205 evas_object_del(tb);
206 tb = e_table_add(evas_object_evas_get(zoom_obj));
207 e_comp_object_util_del_list_append(zoom_obj, tb);
208 e_table_homogenous_set(tb, 1);
209 e_table_freeze(tb);
210 EINA_LIST_FOREACH(clients, l, m)
211 _zoomobj_pack_client(evas_object_data_get(m, "E_Client"),
212 e_comp_object_util_zone_get(zoom_obj), tb, m, id++,
213 _cols_calc(eina_list_count(clients)));
214 e_table_thaw(tb);
215 e_table_size_min_get(tb, &tw, &th);
216 evas_object_size_hint_min_set(tb, tw, th);
217 evas_object_resize(tb, tw, th);
218 e_scrollframe_child_set(scr, tb);
219 E_LIST_FOREACH(clients, _zoomobj_position_client);
220}
221
222static void
223_zoom_client_add_post(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
224{
225 Evas_Object *scr, *tb, *m;
226 Eina_List *clients;
227 unsigned int c, pc;
228 E_Client *ec;
229
230 ec = evas_object_data_get(obj, "E_Client");
231 evas_object_event_callback_del(ec->frame, EVAS_CALLBACK_SHOW, _zoom_client_add_post);
232 m = e_comp_object_util_mirror_add(ec->frame);
233 if (!m) return;
234 clients = evas_object_data_get(data, "__DSCLIENTS");
235 clients = eina_list_append(clients, m);
236 scr = edje_object_part_swallow_get(data, "e.swallow.layout");
237 tb = e_pan_child_get(edje_object_part_swallow_get(e_scrollframe_edje_object_get(scr), "e.swallow.content"));
238 c = _cols_calc(eina_list_count(clients));
239 pc = _cols_calc(eina_list_count(clients) - 1);
240 _zoomobj_add_client(data, eina_list_last(clients), m);
241 if (c == pc)
242 {
243 _zoomobj_pack_client(ec, ec->zone, tb, m, eina_list_count(clients), c);
244 _zoomobj_position_client(m);
245 }
246 else
247 _relayout(data, scr, tb);
248}
249
250static Eina_Bool
251_zoom_client_add(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client *ev)
252{
253 Evas_Object *zoom_obj;
254 Eina_List *l;
255
256 if (e_client_util_ignored_get(ev->ec)) return ECORE_CALLBACK_RENEW;
257 if (ev->ec->iconic && (!e_config->winlist_list_show_iconified)) return ECORE_CALLBACK_RENEW;
258 if (((cur_act == act_zoom_zone) || (cur_act == act_zoom_desk)) &&
259 (ev->ec->zone != e_zone_current_get(ev->ec->comp))) return ECORE_CALLBACK_RENEW;
260 if (((cur_act == act_zoom_desk) || (cur_act == act_zoom_desk_all)) &&
261 (!ev->ec->desk->visible)) return ECORE_CALLBACK_RENEW;
262
263 EINA_LIST_FOREACH(zoom_objs, l, zoom_obj)
264 {
265 if (e_comp_object_util_zone_get(zoom_obj) != ev->ec->zone) continue;
266
267 evas_object_event_callback_add(ev->ec->frame, EVAS_CALLBACK_SHOW, _zoom_client_add_post, zoom_obj);
268 break;
269 }
270 return ECORE_CALLBACK_RENEW;
271}
272
273static Eina_Bool
274_zoom_client_del(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client *ev)
275{
276 Evas_Object *zoom_obj;
277 Eina_List *l;
278
279 if (e_client_util_ignored_get(ev->ec)) return ECORE_CALLBACK_RENEW;
280 if (ev->ec->iconic && (!e_config->winlist_list_show_iconified)) return ECORE_CALLBACK_RENEW;
281
282 EINA_LIST_FOREACH(zoom_objs, l, zoom_obj)
283 {
284 Eina_List *ll, *clients = evas_object_data_get(zoom_obj, "__DSCLIENTS");
285 Evas_Object *m;
286
287 EINA_LIST_FOREACH(clients, ll, m)
288 {
289 Evas_Object *e, *scr, *tb, *ic;
290
291 if (evas_object_data_get(m, "E_Client") != ev->ec) continue;
292 e = evas_object_smart_parent_get(m);
293 e_comp_object_util_del_list_remove(zoom_obj, m);
294 e_comp_object_util_del_list_remove(zoom_obj, e);
295 ic = edje_object_part_swallow_get(e, "e.swallow.icon");
296 e_comp_object_util_del_list_remove(zoom_obj, ic);
297 evas_object_del(ic);
298 evas_object_data_set(zoom_obj, "__DSCLIENTS", eina_list_remove_list(clients, ll));
299 e_table_unpack(e);
300 evas_object_del(ic);
301 evas_object_del(e);
302 evas_object_del(m);
303 scr = edje_object_part_swallow_get(zoom_obj, "e.swallow.layout");
304 tb = e_pan_child_get(edje_object_part_swallow_get(e_scrollframe_edje_object_get(scr), "e.swallow.content"));
305 _relayout(zoom_obj, scr, tb);
306 return ECORE_CALLBACK_RENEW;
307 }
308 }
309 return ECORE_CALLBACK_RENEW;
310}
311
312static Eina_Bool
313_zoom_client_property(void *d EINA_UNUSED, int t EINA_UNUSED, E_Event_Client_Property *ev)
314{
315 Eina_List *l;
316 Evas_Object *zoom_obj;
317
318 if (!(ev->property & E_CLIENT_PROPERTY_URGENCY)) return ECORE_CALLBACK_RENEW;
319
320 EINA_LIST_FOREACH(zoom_objs, l, zoom_obj)
321 {
322 Evas_Object *m;
323 Eina_List *ll, *clients = evas_object_data_get(zoom_obj, "__DSCLIENTS");
324
325 EINA_LIST_FOREACH(clients, ll, m)
326 {
327 if (evas_object_data_get(m, "E_Client") != ev->ec) continue;
328
329 if (ev->ec->urgent)
330 edje_object_signal_emit(evas_object_smart_parent_get(m), "e,state,urgent", "e");
331 else
332 edje_object_signal_emit(evas_object_smart_parent_get(m), "e,state,not_urgent", "e");
333 return ECORE_CALLBACK_RENEW;
334 }
335 }
336
337 return ECORE_CALLBACK_RENEW;
338}
339
340static void
341_hiding(void *data EINA_UNUSED, Evas_Object *obj, const char *sig EINA_UNUSED, const char *src EINA_UNUSED)
342{
343 Eina_List *clients = evas_object_data_get(obj, "__DSCLIENTS");
344 Evas_Object *m, *e;
345
346 EINA_LIST_FREE(clients, m)
347 {
348 e = evas_object_smart_parent_get(m);
349 edje_object_signal_emit(e, "e,action,hide", "e");
350 }
351}
352
353static void
354zoom(Eina_List *clients, E_Zone *zone)
355{
356 E_Comp *comp = zone->comp;
357 Evas_Object *m, *bg_obj, *scr, *tb, *zoom_obj;
358 unsigned int cols, id = 1;
359 int tw, th;
360 Eina_Stringshare *bgf;
361 Eina_List *l;
362
363 if (!zoom_objs)
364 {
365 e_comp_shape_queue(comp);
366 e_comp_grab_input(comp, 1, 1);
367 E_LIST_HANDLER_APPEND(handlers, ECORE_EVENT_KEY_DOWN, _zoom_key, NULL);
368 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_PROPERTY, _zoom_client_property, NULL);
369 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_ADD, _zoom_client_add, NULL);
370 E_LIST_HANDLER_APPEND(handlers, E_EVENT_CLIENT_REMOVE, _zoom_client_del, NULL);
371 }
372
373 zoom_obj = edje_object_add(comp->evas);
374 edje_object_signal_callback_add(zoom_obj, "e,state,hiding", "e", _hiding, NULL);
375 edje_object_signal_callback_add(zoom_obj, "e,action,dismiss", "e", _dismiss, NULL);
376 edje_object_signal_callback_add(zoom_obj, "e,action,done", "e", _hid, NULL);
377 evas_object_resize(zoom_obj, zone->w, zone->h);
378 evas_object_layer_set(zoom_obj, E_LAYER_POPUP);
379 e_theme_edje_object_set(zoom_obj, NULL, "e/modules/desksanity/zoom/base");
380
381 bg_obj = e_icon_add(comp->evas);
382 bgf = e_bg_file_get(comp->man->num, zone->num, zone->desk_x_current, zone->desk_y_current);
383 if (eina_str_has_extension(bgf, ".edj"))
384 e_icon_file_edje_set(bg_obj, bgf, "e/desktop/background");
385 else
386 e_icon_file_set(bg_obj, bgf);
387 eina_stringshare_del(bgf);
388 e_comp_object_util_del_list_append(zoom_obj, bg_obj);
389 edje_object_part_swallow(zoom_obj, "e.swallow.background", bg_obj);
390
391 scr = e_scrollframe_add(comp->evas);
392 e_comp_object_util_del_list_append(zoom_obj, scr);
393 e_scrollframe_custom_theme_set(scr, NULL, "e/modules/desksanity/zoom/scrollframe");
394 edje_object_part_swallow(zoom_obj, "e.swallow.layout", scr);
395
396 tb = e_table_add(comp->evas);
397 e_comp_object_util_del_list_append(zoom_obj, tb);
398 e_table_homogenous_set(tb, 1);
399
400 evas_object_show(zoom_obj);
401
402 cols = _cols_calc(eina_list_count(clients));
403
404 e_table_freeze(tb);
405 EINA_LIST_FOREACH(clients, l, m)
406 {
407 _zoomobj_add_client(zoom_obj, l, m);
408 _zoomobj_pack_client(evas_object_data_get(m, "E_Client"), zone, tb, m, id++, cols);
409 }
410
411 e_table_thaw(tb);
412 e_table_size_min_get(tb, &tw, &th);
413 evas_object_size_hint_min_set(tb, tw, th);
414 evas_object_resize(tb, tw, th);
415 e_scrollframe_child_set(scr, tb);
416 edje_object_signal_emit(zoom_obj, "e,state,active", "e");
417
418 E_LIST_FOREACH(clients, _zoomobj_position_client);
419 evas_object_data_set(zoom_obj, "__DSCLIENTS", clients);
420
421 zoom_objs = eina_list_append(zoom_objs, zoom_obj);
422}
423
424static void
425_zoom_desk_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
426{
427 Eina_List *clients = NULL;
428 E_Comp *comp = e_comp_get(NULL);
429 E_Zone *zone;
430 Evas_Object *m;
431 E_Client *ec;
432
433
434 if (zoom_objs)
435 {
436 _zoom_hide();
437 return;
438 }
439
440 cur_act = act_zoom_desk;
441 zone = e_zone_current_get(comp);
442 E_CLIENT_FOREACH(comp, ec)
443 {
444 if (e_client_util_ignored_get(ec)) continue;
445 if (!e_client_util_desk_visible(ec, e_desk_current_get(zone))) continue;
446 if (ec->iconic && (!e_config->winlist_list_show_iconified)) continue;
447
448 m = e_comp_object_util_mirror_add(ec->frame);
449 if (!m) continue;
450 clients = eina_list_append(clients, m);
451 }
452 zoom(clients, zone);
453}
454
455static void
456_zoom_desk_all_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
457{
458 Eina_List *clients = NULL;
459 E_Comp *comp = e_comp_get(NULL);
460 E_Zone *zone;
461 Evas_Object *m;
462 E_Client *ec;
463 Eina_List *l;
464
465 if (zoom_objs)
466 {
467 _zoom_hide();
468 return;
469 }
470
471 cur_act = act_zoom_desk_all;
472 EINA_LIST_FOREACH(comp->zones, l, zone)
473 {
474 E_Desk *desk = e_desk_current_get(zone);
475 E_CLIENT_FOREACH(comp, ec)
476 {
477 if (e_client_util_ignored_get(ec)) continue;
478 if (ec->desk != desk) continue; //ignore sticky
479 if (ec->iconic && (!e_config->winlist_list_show_iconified)) continue;
480
481 m = e_comp_object_util_mirror_add(ec->frame);
482 if (!m) continue;
483 clients = eina_list_append(clients, m);
484 }
485 zoom(clients, zone);
486 }
487}
488
489static void
490_zoom_zone_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
491{
492 Eina_List *clients = NULL;
493 E_Comp *comp = e_comp_get(NULL);
494 E_Zone *zone;
495 Evas_Object *m;
496 E_Client *ec;
497
498
499 if (zoom_objs)
500 {
501 _zoom_hide();
502 return;
503 }
504
505 cur_act = act_zoom_zone;
506 zone = e_zone_current_get(comp);
507 E_CLIENT_FOREACH(comp, ec)
508 {
509 if (e_client_util_ignored_get(ec)) continue;
510 if (ec->zone != zone) continue;
511 if (ec->iconic && (!e_config->winlist_list_show_iconified)) continue;
512
513 m = e_comp_object_util_mirror_add(ec->frame);
514 if (!m) continue;
515 clients = eina_list_append(clients, m);
516 }
517 zoom(clients, zone);
518}
519
520static void
521_zoom_zone_all_cb(E_Object *obj EINA_UNUSED, const char *params EINA_UNUSED)
522{
523 Eina_List *clients = NULL;
524 E_Comp *comp = e_comp_get(NULL);
525 E_Zone *zone;
526 Evas_Object *m;
527 E_Client *ec;
528 Eina_List *l;
529
530
531 if (zoom_objs)
532 {
533 _zoom_hide();
534 return;
535 }
536
537 cur_act = act_zoom_zone_all;
538 EINA_LIST_FOREACH(comp->zones, l, zone)
539 {
540 E_CLIENT_FOREACH(comp, ec)
541 {
542 if (e_client_util_ignored_get(ec)) continue;
543 if (ec->zone != zone) continue;
544 if (ec->iconic && (!e_config->winlist_list_show_iconified)) continue;
545
546 m = e_comp_object_util_mirror_add(ec->frame);
547 if (!m) continue;
548 clients = eina_list_append(clients, m);
549 }
550 zoom(clients, zone);
551 }
552}
553
554EINTERN void
555zoom_init(void)
556{
557 act_zoom_desk = e_action_add("zoom_desk");
558 if (act_zoom_desk)
559 {
560 act_zoom_desk->func.go = _zoom_desk_cb;
561 e_action_predef_name_set(D_("Compositor"), D_("Toggle zoom current desk"),
562 "zoom_desk", NULL, NULL, 0);
563 }
564 act_zoom_desk_all = e_action_add("zoom_desk_all");
565 if (act_zoom_desk_all)
566 {
567 act_zoom_desk->func.go = _zoom_desk_all_cb;
568 e_action_predef_name_set(D_("Compositor"), D_("Toggle zoom current desks"),
569 "zoom_desk_all", NULL, NULL, 0);
570 }
571 act_zoom_zone = e_action_add("zoom_zone");
572 if (act_zoom_zone)
573 {
574 act_zoom_zone->func.go = _zoom_zone_cb;
575 e_action_predef_name_set(D_("Compositor"), D_("Toggle zoom current screen"),
576 "zoom_zone", NULL, NULL, 0);
577 }
578 act_zoom_zone_all = e_action_add("zoom_zone_all");
579 if (act_zoom_zone_all)
580 {
581 act_zoom_zone_all->func.go = _zoom_zone_all_cb;
582 e_action_predef_name_set(D_("Compositor"), D_("Toggle zoom all screens"),
583 "zoom_zone_all", NULL, NULL, 0);
584 }
585}
586
587EINTERN void
588zoom_shutdown(void)
589{
590 e_action_predef_name_del(D_("Compositor"), D_("Toggle zoom current desk"));
591 e_action_del("zoom_desk");
592 act_zoom_desk = NULL;
593 e_action_predef_name_del(D_("Compositor"), D_("Toggle zoom current desks"));
594 e_action_del("zoom_desk_all");
595 act_zoom_desk_all = NULL;
596 e_action_predef_name_del(D_("Compositor"), D_("Toggle zoom current screen"));
597 e_action_del("zoom_zone");
598 act_zoom_zone = NULL;
599 e_action_predef_name_del(D_("Compositor"), D_("Toggle zoom all screens"));
600 e_action_del("zoom_zone_all");
601 act_zoom_zone_all = NULL;
602}
diff --git a/win_shadow.png b/win_shadow.png
new file mode 100644
index 0000000..98f158e
--- /dev/null
+++ b/win_shadow.png
Binary files differ