summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <m.blumenkran@samsung.com>2013-04-25 11:21:22 +0100
committerMike Blumenkrantz <m.blumenkran@samsung.com>2013-04-25 11:21:22 +0100
commit47283e55188a7470138b3a96eb640bea5571b5e2 (patch)
tree63731a12f23b89f240a0f7f4860ed9c51f92585e
parent7777b5d738dfe6010251bf16adeae8c5218400f9 (diff)
add deskmirror, a new widget which breaks evas in a number of terrifying ways
to experience the terror, uncomment the define in e_deskmirror.h
-rw-r--r--ChangeLog4
-rw-r--r--NEWS1
-rw-r--r--data/themes/Makefile.am1
-rw-r--r--data/themes/default.edc1
-rw-r--r--data/themes/edc/deskmirror.edc406
-rw-r--r--src/bin/Makefile.am2
-rw-r--r--src/bin/e_deskmirror.c627
-rw-r--r--src/bin/e_deskmirror.h8
-rw-r--r--src/bin/e_includes.h1
-rw-r--r--src/bin/e_int_border_menu.c24
-rw-r--r--src/bin/e_test.c23
11 files changed, 1092 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index a93d47af4..bc6af85b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
12013-04-25 Mike Blumenkrantz
2
3 * added deskmirror
4
12013-04-19 Mike Blumenkrantz 52013-04-19 Mike Blumenkrantz
2 6
3 * deskpreview renamed to bgpreview 7 * deskpreview renamed to bgpreview
diff --git a/NEWS b/NEWS
index 548fb0be8..fa5104040 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,7 @@ Additions:
34 * added e_object_ref_debug_set 34 * added e_object_ref_debug_set
35 * added e_gadcon_repopulate 35 * added e_gadcon_repopulate
36 * added e_comp_win_effect* api 36 * added e_comp_win_effect* api
37 * added deskmirror
37 Config: 38 Config:
38 * Added option for disabling icons in menus 39 * Added option for disabling icons in menus
39 * Added option for disabling pointer warping when performing directional focus changes using winlist 40 * Added option for disabling pointer warping when performing directional focus changes using winlist
diff --git a/data/themes/Makefile.am b/data/themes/Makefile.am
index 0be183e8d..8018c6762 100644
--- a/data/themes/Makefile.am
+++ b/data/themes/Makefile.am
@@ -37,6 +37,7 @@ edc/connman.edc \
37edc/cpufreq.edc \ 37edc/cpufreq.edc \
38edc/cslider.edc \ 38edc/cslider.edc \
39edc/desklock.edc \ 39edc/desklock.edc \
40edc/deskmirror.edc \
40edc/deskpreview.edc \ 41edc/deskpreview.edc \
41edc/dialog.edc \ 42edc/dialog.edc \
42edc/edgebindings.edc \ 43edc/edgebindings.edc \
diff --git a/data/themes/default.edc b/data/themes/default.edc
index c90f99b77..39c566ba5 100644
--- a/data/themes/default.edc
+++ b/data/themes/default.edc
@@ -4,6 +4,7 @@ collections {
4#include "colorclasses.edc" 4#include "colorclasses.edc"
5// desktop in general 5// desktop in general
6#include "edc/comp.edc" 6#include "edc/comp.edc"
7#include "edc/deskmirror.edc"
7#include "edc/background.edc" 8#include "edc/background.edc"
8#include "edc/shelf.edc" 9#include "edc/shelf.edc"
9#include "edc/border.edc" 10#include "edc/border.edc"
diff --git a/data/themes/edc/deskmirror.edc b/data/themes/edc/deskmirror.edc
new file mode 100644
index 000000000..e79de0373
--- /dev/null
+++ b/data/themes/edc/deskmirror.edc
@@ -0,0 +1,406 @@
1group { name: "e/deskmirror/frame/default";
2 alias: "e/deskmirror/frame/dialog";
3 script {
4 public message(Msg_Type:type, id, ...) {
5 /* set scale */
6 new sc;
7
8 sc = getarg(2);
9 custom_state(PART:"title2", "default", 0.0);
10 custom_state(PART:"top", "default", 0.0);
11 custom_state(PART:"e.text.title", "default", 0.0);
12 custom_state(PART:"bottom", "default", 0.0);
13 set_state_val(PART:"title2", STATE_REL1, 0, 0.0 - sc);
14 set_state_val(PART:"top", STATE_REL1, 0, 0.0 - sc);
15 set_state_val(PART:"e.text.title", STATE_REL1, 0, 0.0 - sc);
16 set_state_val(PART:"bottom", STATE_REL2, 1, sc);
17 set_state(PART:"title2", "custom", 0.0);
18 set_state(PART:"top", "custom", 0.0);
19 set_state(PART:"e.text.title", "custom", 0.0);
20 set_state(PART:"e.swallow.client", "custom", 0.0);
21 set_state(PART:"bottom", "custom", 0.0);
22 }
23 }
24 parts {
25 part { name: "client_clip"; type: RECT;
26 description { state: "default" 0.0;
27 rel1.to_y: "e.swallow.client";
28 rel2.to_y: "e.swallow.client";
29 }
30 }
31 part { name: "e.swallow.client"; type: SWALLOW;
32 clip_to: "client_clip";
33 description { state: "default" 0.0;
34 rel1.to_y: "top";
35 rel1.relative: 0 1;
36 }
37 }
38 part { name: "top";
39 description { state: "default" 0.0;
40 color_class: "border_top";
41 image.normal: "vgrad_med_lighter.png";
42 fill.smooth: 0;
43 TILED_HORIZ(120)
44 rel2.to_y: "title2";
45 rel2.offset: -1 -4;
46 min: 0 1;
47 }
48 }
49 part { name: "bevel"; mouse_events: 0;
50 description { state: "default" 0.0;
51 image.normal: "bevel_out.png";
52 image.border: 1 1 1 1;
53 image.middle: 0;
54 rel1.to: "top";
55 rel2.to: "top";
56 fill.smooth: 0;
57 }
58 }
59 part { name: "e.text.title"; type: TEXT; mouse_events: 0;
60 scale: 1;
61 effect: SHADOW BOTTOM;
62 description { state: "default" 0.0;
63 color_class: "border_title";
64 rel1.offset: 1 3;
65 rel2.relative: 1.0 0.0;
66 rel2.offset: -2 3;
67 align: 0.5 0.0;
68 color: 21 21 21 255;
69 color3: 255 255 255 25;
70 text { font: "Sans:style=Bold";
71 fit: 0 1;
72 text_class: "title_bar";
73 align: 0.5 0.0;
74 min: 0 1;
75 }
76 fixed: 0 1;
77 }
78 }
79 part { name: "title2"; type: TEXT; mouse_events: 0;
80 scale: 1;
81 effect: SOFT_SHADOW BOTTOM;
82 description { state: "default" 0.0;
83 color_class: "border_title_active";
84 rel1.offset: 1 2;
85 rel2.relative: 1.0 0.0;
86 rel2.offset: -1 2;
87 align: 0.5 0.0;
88 color: 255 255 255 255;
89 color3: 0 0 0 18;
90 text { font: "Sans:style=Bold";
91 fit: 0 1;
92 text_source: "e.text.title";
93 text_class: "title_bar";
94 align: 0.5 0.0;
95 min: 0 1;
96 }
97 visible: 0;
98 fixed: 0 1;
99 }
100 }
101 part { name: "bottom"; type: RECT; mouse_events: 0;
102 description { state: "default" 0.0;
103 color_class: "border_bottom";
104 rel1.to_y: "e.swallow.client";
105 rel1.relative: 0.0 1.0;
106 rel1.offset: 0 -3;
107 min: 0 1;
108 color: 64 64 64 255;
109 fixed: 0 1;
110 }
111 }
112 part { name: "bevel2"; mouse_events: 0;
113 description { state: "default" 0.0;
114 image.normal: "bevel_dark_out.png";
115 image.border: 1 1 1 1;
116 image.middle: 0;
117 rel1.to: "bottom";
118 rel2.to: "bottom";
119 fill.smooth: 0;
120 }
121 }
122 part { name: "shadow";
123 mouse_events: 0;
124 description { state: "default" 0.0;
125 image.normal: "win_shadow.png";
126 image.border: 14 14 14 14;
127 image.middle: 0;
128 rel1.to: "top";
129 rel1.offset: -7 -3;
130 rel2.to: "bottom";
131 rel2.offset: 6 11;
132 fill.smooth: 0;
133 }
134 }
135 }
136 programs {
137 program { name: "shon";
138 signal: "e,state,shadow,on"; source: "e";
139 script {
140 custom_state(PART:"shadow", "default", 0.0);
141 set_state_val(PART:"shadow", STATE_VISIBLE, 1);
142 set_state(PART:"shadow", "custom", 0.0);
143 }
144 }
145 program { name: "shoff";
146 signal: "e,state,shadow,off"; source: "e";
147 script {
148 custom_state(PART:"shadow", "default", 0.0);
149 set_state_val(PART:"shadow", STATE_VISIBLE, 0);
150 set_state(PART:"shadow", "custom", 0.0);
151 }
152 }
153 program {
154 name: "focus";
155 signal: "e,state,focused"; source: "e";
156 script {
157 custom_state(PART:"top", "default", 0.0);
158 set_state_val(PART:"top", STATE_IMAGE, get_image_id("vgrad_med_dark.png"));
159 set_state(PART:"top", "custom", 0.0);
160 custom_state(PART:"title2", "default", 0.0);
161 set_state_val(PART:"title2", STATE_VISIBLE, 1);
162 set_state(PART:"title2", "custom", 0.0);
163 custom_state(PART:"e.text.title", "default", 0.0);
164 set_state_val(PART:"e.text.title", STATE_VISIBLE, 0);
165 set_state(PART:"e.text.title", "custom", 0.0);
166 }
167 }
168 program {
169 name: "unfocus";
170 signal: "e,state,unfocused"; source: "e";
171 script {
172 custom_state(PART:"top", "default", 0.0);
173 set_state_val(PART:"top", STATE_IMAGE, get_image_id("vgrad_med_lighter.png"));
174 set_state(PART:"top", "custom", 0.0);
175 custom_state(PART:"title2", "default", 0.0);
176 set_state_val(PART:"title2", STATE_VISIBLE, 0);
177 set_state(PART:"title2", "custom", 0.0);
178 custom_state(PART:"e.text.title", "default", 0.0);
179 set_state_val(PART:"e.text.title", STATE_VISIBLE, 1);
180 set_state(PART:"e.text.title", "custom", 0.0);
181 }
182 }
183 program {
184 name: "shade";
185 signal: "e,state,shaded"; source: "e";
186 script {
187 custom_state(PART:"e.swallow.client", "default", 0.0);
188 set_state_val(PART:"e.swallow.client", STATE_MAX, 1, 1);
189 set_state_val(PART:"e.swallow.client", STATE_VISIBLE, 0);
190 set_state(PART:"e.swallow.client", "custom", 0.0);
191 custom_state(PART:"client_clip", "default", 0.0);
192 set_state_val(PART:"client_clip", STATE_REL1_TO, get_part_id("top"), get_part_id("top"));
193 set_state_val(PART:"client_clip", STATE_REL2_TO, get_part_id("top"), get_part_id("top"));
194 set_state(PART:"client_clip", "custom", 0.0);
195 custom_state(PART:"bottom", "default", 0.0);
196 set_state_val(PART:"bottom", STATE_VISIBLE, 0);
197 set_state_val(PART:"bottom", STATE_MIN, 0, 0);
198 set_state_val(PART:"bottom", STATE_REL1_OFFSET, 0, 0);
199 set_state(PART:"bottom", "custom", 0.0);
200 custom_state(PART:"bevel2", "default", 0.0);
201 set_state_val(PART:"bevel2", STATE_VISIBLE, 0);
202 set_state_val(PART:"bevel2", STATE_MIN, 0, 0);
203 set_state(PART:"bevel2", "custom", 0.0);
204 custom_state(PART:"shadow", "default", 0.0);
205 set_state_val(PART:"shadow", STATE_REL2_TO, get_part_id("top"), get_part_id("top"));
206 set_state(PART:"shadow", "custom", 0.0);
207 }
208 }
209 program {
210 signal: "e,state,maximize*"; source: "e";
211 script {
212 custom_state(PART:"bottom", "default", 0.0);
213 set_state_val(PART:"bottom", STATE_VISIBLE, 0);
214 set_state_val(PART:"bottom", STATE_MIN, 0, 0);
215 set_state_val(PART:"bottom", STATE_REL1_OFFSET, 0, 0);
216 set_state(PART:"bottom", "custom", 0.0);
217 custom_state(PART:"bevel2", "default", 0.0);
218 set_state_val(PART:"bevel2", STATE_VISIBLE, 0);
219 set_state_val(PART:"bevel2", STATE_MIN, 0, 0);
220 set_state(PART:"bevel2", "custom", 0.0);
221 }
222 }
223 program {
224 signal: "e,state,unmaximize*"; source: "e";
225 after: "unshade";
226 }
227 program {
228 signal: "e,state,unshaded"; source: "e";
229 after: "unshade";
230 }
231 program {
232 name: "unshade";
233 signal: "e,state,unshading"; source: "e";
234 script {
235 custom_state(PART:"e.swallow.client", "default", 0.0);
236 set_state_val(PART:"e.swallow.client", STATE_MAX, 99999, 99999);
237 set_state_val(PART:"e.swallow.client", STATE_VISIBLE, 1);
238 set_state(PART:"e.swallow.client", "custom", 0.0);
239 custom_state(PART:"client_clip", "default", 0.0);
240 set_state_val(PART:"client_clip", STATE_REL1_TO, get_part_id("e.swallow.client"), get_part_id("e.swallow.client"));
241 set_state_val(PART:"client_clip", STATE_REL2_TO, get_part_id("e.swallow.client"), get_part_id("e.swallow.client"));
242 set_state(PART:"client_clip", "custom", 0.0);
243 custom_state(PART:"bottom", "default", 0.0);
244 set_state_val(PART:"bottom", STATE_VISIBLE, 1);
245 set_state_val(PART:"bottom", STATE_MIN, 0, 1);
246 set_state_val(PART:"bottom", STATE_REL1_OFFSET, 0, -3);
247 set_state(PART:"bottom", "custom", 0.0);
248 custom_state(PART:"bevel2", "default", 0.0);
249 set_state_val(PART:"bevel2", STATE_VISIBLE, 1);
250 set_state_val(PART:"bevel2", STATE_MIN, 0, 1);
251 set_state(PART:"bevel2", "custom", 0.0);
252 custom_state(PART:"shadow", "default", 0.0);
253 set_state_val(PART:"shadow", STATE_REL2_TO, get_part_id("bottom"), get_part_id("bottom"));
254 set_state(PART:"shadow", "custom", 0.0);
255 }
256 }
257 program {
258 signal: "e,action,maximize*"; source: "e";
259 action: STATE_SET "max" 0.0;
260 target: "e.swallow.client";
261 target: "bottom";
262 target: "bevel2";
263 }
264 program {
265 signal: "e,action,unmaximize*"; source: "e";
266 action: STATE_SET "default" 0.0;
267 target: "e.swallow.client";
268 target: "bottom";
269 target: "bevel2";
270 }
271 }
272}
273
274group { name: "e/deskmirror/frame/noresize";
275 inherit: "e/deskmirror/frame/default";
276 parts {
277 part { name: "e.swallow.client"; type: SWALLOW;
278 description { state: "default" 0.0;
279 rel2.relative: 1.0 1.0;
280 }
281 }
282 part { name: "bottom"; type: RECT;
283 description { state: "default" 0.0;
284 color_class: "border_bottom";
285 rel1.relative: 0.0 1.0;
286 rel1.offset: 0 -1;
287 rel2.relative: 1.0 1.0;
288 min: 0 0;
289 fixed: 0 1;
290 visible: 0;
291 }
292 }
293 part { name: "bevel2";
294 description { state: "default" 0.0;
295 visible: 0;
296 }
297 }
298 }
299}
300
301group { name: "e/deskmirror/frame/noresize_dialog";
302 inherit: "e/deskmirror/frame/default";
303 parts {
304 part { name: "e.swallow.client"; type: SWALLOW;
305 description { state: "default" 0.0;
306 rel2.relative: 1.0 1.0;
307 }
308 }
309 part { name: "bottom"; type: RECT;
310 description { state: "default" 0.0;
311 color_class: "border_bottom";
312 rel1.relative: 0.0 1.0;
313 rel1.offset: 0 -1;
314 rel2.relative: 1.0 1.0;
315 min: 0 0;
316 fixed: 0 1;
317 visible: 0;
318 }
319 }
320 part { name: "bevel2";
321 description { state: "default" 0.0;
322 visible: 0;
323 }
324 }
325 }
326}
327
328group { name: "e/deskmirror/frame/pixel";
329 parts {
330 part { name: "client_clip"; type: RECT;
331 description { state: "default" 0.0;
332 rel1.to_y: "e.swallow.client";
333 rel2.to_y: "e.swallow.client";
334 }
335 }
336 part { name: "e.swallow.client"; type: SWALLOW;
337 clip_to: "client_clip";
338 description { state: "default" 0.0;
339 rel1.offset: 1 1;
340 rel2.offset: -2 -2;
341 }
342 }
343 part { name: "top"; type: RECT;
344 description { state: "default" 0.0;
345 color: 0 0 0 255;
346 align: 0.0 0.0;
347 max: 99999 1;
348 }
349 description { state: "focused" 0.0;
350 inherit: "default" 0.0;
351 color: 51 153 255 255;
352 }
353 }
354 part { name: "bottom"; type: RECT;
355 description { state: "default" 0.0;
356 color: 0 0 0 255;
357 align: 0.0 1.0;
358 max: 99999 1;
359 }
360 description { state: "focused" 0.0;
361 inherit: "default" 0.0;
362 color: 51 153 255 255;
363 }
364 }
365 part { name: "left"; type: RECT;
366 description { state: "default" 0.0;
367 color: 0 0 0 255;
368 align: 0.0 0.0;
369 max: 1 99999;
370 }
371 description { state: "focused" 0.0;
372 inherit: "default" 0.0;
373 color: 51 153 255 255;
374 }
375 }
376 part { name: "right"; type: RECT;
377 description { state: "default" 0.0;
378 color: 0 0 0 255;
379 align: 1.0 0.0;
380 max: 1 99999;
381 }
382 description { state: "focused" 0.0;
383 inherit: "default" 0.0;
384 color: 51 153 255 255;
385 }
386 }
387 }
388 programs {
389 program {
390 signal: "e,state,focused"; source: "e";
391 action: STATE_SET "focused" 0.0;
392 target: "top";
393 target: "bottom";
394 target: "left";
395 target: "right";
396 }
397 program {
398 signal: "e,state,unfocused"; source: "e";
399 action: STATE_SET "default" 0.0;
400 target: "top";
401 target: "bottom";
402 target: "left";
403 target: "right";
404 }
405 }
406}
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 0987d8963..098f4393f 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -71,6 +71,7 @@ e_dbusmenu.h \
71e_desk.h \ 71e_desk.h \
72e_deskenv.h \ 72e_deskenv.h \
73e_desklock.h \ 73e_desklock.h \
74e_deskmirror.h \
74e_dialog.h \ 75e_dialog.h \
75e_dnd.h \ 76e_dnd.h \
76e_dpms.h \ 77e_dpms.h \
@@ -241,6 +242,7 @@ e_dbusmenu.c \
241e_desk.c \ 242e_desk.c \
242e_deskenv.c \ 243e_deskenv.c \
243e_desklock.c \ 244e_desklock.c \
245e_deskmirror.c \
244e_dialog.c \ 246e_dialog.c \
245e_dnd.c \ 247e_dnd.c \
246e_dpms.c \ 248e_dpms.c \
diff --git a/src/bin/e_deskmirror.c b/src/bin/e_deskmirror.c
new file mode 100644
index 000000000..6306f9665
--- /dev/null
+++ b/src/bin/e_deskmirror.c
@@ -0,0 +1,627 @@
1#include "e.h"
2
3#define INTERNAL_ENTRY E_Smart_Data * sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
4
5typedef struct E_Smart_Data
6{
7 Evas *e;
8 Evas_Object *obj;
9 Evas_Object *clip;
10 Evas_Object *bgpreview;
11 Evas_Object *layout;
12 Eina_Inlist *mirrors;
13 Eina_Hash *mirror_hash;
14
15 Eina_List *handlers;
16
17 Evas_Coord x, y;
18 int w, h;
19
20 E_Desk *desk;
21 E_Object_Delfn *desk_delfn;
22
23 Eina_Bool pager : 1;
24 Eina_Bool taskbar : 1;
25
26 Eina_Bool resize : 1;
27} E_Smart_Data;
28
29typedef struct Mirror
30{
31 EINA_INLIST;
32 E_Smart_Data *sd;
33 E_Comp_Win *cw;
34 Evas_Object *mirror;
35 int x, y, w, h;
36 Eina_Bool frame : 1;
37} Mirror;
38
39typedef struct Mirror_Border
40{
41 Mirror *m;
42 Evas_Object *mirror;
43 Evas_Object *frame;
44 Evas_Object *obj;
45} Mirror_Border;
46
47/* local subsystem globals */
48static Evas_Smart *_e_deskmirror_smart = NULL;
49static Evas_Smart *_mirror_border_smart = NULL;
50
51/* local subsystem functions */
52static void
53_mirror_scale_set(Mirror *m, float sc)
54{
55 Edje_Message_Float_Set msg;
56 Mirror_Border *mb;
57
58 if (!m->frame) return;
59
60 mb = evas_object_smart_data_get(m->mirror);
61 msg.count = 1;
62 msg.val[0] = sc;
63 edje_object_message_send(mb->frame, EDJE_MESSAGE_FLOAT_SET, 0, &msg);
64}
65
66static void
67_e_deskmirror_smart_reconfigure(E_Smart_Data *sd)
68{
69 e_layout_freeze(sd->layout);
70 evas_object_move(sd->clip, sd->x, sd->y);
71 evas_object_move(sd->bgpreview, sd->x, sd->y);
72 evas_object_move(sd->layout, sd->x, sd->y);
73
74 if (sd->resize)
75 {
76 Mirror *m;
77
78 evas_object_resize(sd->clip, sd->w, sd->h);
79 evas_object_resize(sd->bgpreview, sd->w, sd->h);
80 evas_object_resize(sd->layout, sd->w, sd->h);
81 EINA_INLIST_FOREACH(sd->mirrors, m)
82 _mirror_scale_set(m, (float)sd->h / (float)sd->desk->zone->h);
83 }
84 e_layout_thaw(sd->layout);
85 sd->resize = 0;
86}
87
88///////////////////////////////////////////////
89
90static void
91_e_deskmirror_smart_add(Evas_Object *obj)
92{
93 E_Smart_Data *sd;
94
95 sd = E_NEW(E_Smart_Data, 1);
96 if (!sd) return;
97 sd->obj = obj;
98 sd->e = evas_object_evas_get(obj);
99 sd->x = sd->y = sd->w = sd->h = 0;
100 sd->clip = evas_object_rectangle_add(sd->e);
101 evas_object_smart_member_add(sd->clip, sd->obj);
102 evas_object_smart_data_set(obj, sd);
103}
104
105static void
106_e_deskmirror_smart_del(Evas_Object *obj)
107{
108 INTERNAL_ENTRY;
109 if (sd->desk_delfn)
110 {
111 e_object_delfn_del(E_OBJECT(sd->desk), sd->desk_delfn);
112 sd->desk_delfn = NULL;
113 sd->desk = NULL;
114 }
115 E_FREE_LIST(sd->handlers, ecore_event_handler_del);
116 eina_hash_free(sd->mirror_hash);
117 free(sd);
118}
119
120static void
121_e_deskmirror_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
122{
123 INTERNAL_ENTRY;
124 sd->x = x;
125 sd->y = y;
126 _e_deskmirror_smart_reconfigure(sd);
127}
128
129static void
130_e_deskmirror_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
131{
132 INTERNAL_ENTRY;
133 sd->w = w;
134 sd->h = h;
135 sd->resize = 1;
136 _e_deskmirror_smart_reconfigure(sd);
137}
138
139static void
140_e_deskmirror_smart_show(Evas_Object *obj)
141{
142 INTERNAL_ENTRY;
143 evas_object_show(sd->clip);
144}
145
146static void
147_e_deskmirror_smart_hide(Evas_Object *obj)
148{
149 INTERNAL_ENTRY;
150 evas_object_hide(sd->clip);
151}
152
153static void
154_e_deskmirror_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
155{
156 INTERNAL_ENTRY;
157 evas_object_color_set(sd->clip, r, g, b, a);
158}
159
160static void
161_e_deskmirror_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
162{
163 INTERNAL_ENTRY;
164 evas_object_clip_set(sd->clip, clip);
165}
166
167static void
168_e_deskmirror_smart_clip_unset(Evas_Object *obj)
169{
170 INTERNAL_ENTRY;
171 evas_object_clip_unset(sd->clip);
172}
173
174////////////////////////////////////////////////////////
175
176static void
177_e_deskmirror_mirror_frame_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
178{
179 Mirror_Border *mb = data;
180
181 if (mb->m->cw->bd && (!e_object_is_del(E_OBJECT(mb->m->cw->bd))))
182 {
183 evas_object_smart_member_del(mb->mirror);
184 mb->m->mirror = mb->mirror;
185 mb->m->frame = 0;
186 }
187 else
188 mb->m->cw = NULL;
189 evas_object_del(mb->obj);
190}
191
192static void
193_mirror_border_smart_add(Evas_Object *obj)
194{
195 Mirror_Border *mb;
196
197 mb = E_NEW(Mirror_Border, 1);
198 mb->obj = obj;
199 evas_object_smart_data_set(obj, mb);
200}
201
202static void
203_mirror_border_signal_cb(void *data, Evas_Object *obj EINA_UNUSED, const char *emission, const char *src)
204{
205 Mirror_Border *mb = data;
206 edje_object_signal_emit(mb->frame, emission, src);
207 edje_object_message_signal_process(mb->frame);
208 edje_object_calc_force(mb->frame);
209}
210
211static void
212_mirror_border_smart_del(Evas_Object *obj)
213{
214 Mirror_Border *mb = evas_object_smart_data_get(obj);
215 if (mb->m->cw && mb->m->cw->bd)
216 {
217 evas_object_event_callback_del_full(mb->m->cw->bd->bg_object, EVAS_CALLBACK_DEL, _e_deskmirror_mirror_frame_del_cb, mb);
218 edje_object_signal_callback_del_full(mb->m->cw->bd->bg_object, "*", "*", _mirror_border_signal_cb, mb);
219 }
220 free(mb);
221}
222
223static void
224_mirror_border_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
225{
226 Mirror_Border *mb = evas_object_smart_data_get(obj);
227
228 evas_object_move(mb->frame, x, y);
229}
230
231static void
232_mirror_border_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
233{
234 Mirror_Border *mb = evas_object_smart_data_get(obj);
235 evas_object_resize(mb->frame, w, h);
236}
237
238static void
239_mirror_border_smart_show(Evas_Object *obj)
240{
241 Mirror_Border *mb = evas_object_smart_data_get(obj);
242 evas_object_show(mb->frame);
243 evas_object_show(mb->mirror);
244}
245
246static void
247_mirror_border_smart_hide(Evas_Object *obj)
248{
249 Mirror_Border *mb = evas_object_smart_data_get(obj);
250 evas_object_hide(mb->frame);
251 evas_object_hide(mb->mirror);
252}
253
254static void
255_mirror_border_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
256{
257 Mirror_Border *mb = evas_object_smart_data_get(obj);
258 evas_object_color_set(mb->frame, r, g, b, a);
259 evas_object_color_set(mb->mirror, r, g, b, a);
260}
261
262static void
263_mirror_border_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
264{
265 Mirror_Border *mb = evas_object_smart_data_get(obj);
266 evas_object_clip_set(mb->frame, clip);
267 evas_object_clip_set(mb->mirror, clip);
268}
269
270static void
271_mirror_border_smart_clip_unset(Evas_Object *obj)
272{
273 Mirror_Border *mb = evas_object_smart_data_get(obj);
274 evas_object_clip_unset(mb->frame);
275 evas_object_clip_unset(mb->mirror);
276}
277
278static void
279_mirror_border_smart_init(void)
280{
281 static const Evas_Smart_Class sc =
282 {
283 "mirror_border", EVAS_SMART_CLASS_VERSION,
284 _mirror_border_smart_add, _mirror_border_smart_del, _mirror_border_smart_move, _mirror_border_smart_resize,
285 _mirror_border_smart_show, _mirror_border_smart_hide, _mirror_border_smart_color_set, _mirror_border_smart_clip_set,
286 _mirror_border_smart_clip_unset, NULL, NULL, NULL, NULL, NULL, NULL, NULL
287 };
288 if (_mirror_border_smart) return;
289 _mirror_border_smart = evas_smart_class_new(&sc);
290}
291
292static void
293_e_deskmirror_smart_init(void)
294{
295 static const Evas_Smart_Class sc =
296 {
297 "e_deskmirror", EVAS_SMART_CLASS_VERSION,
298 _e_deskmirror_smart_add, _e_deskmirror_smart_del, _e_deskmirror_smart_move, _e_deskmirror_smart_resize,
299 _e_deskmirror_smart_show, _e_deskmirror_smart_hide, _e_deskmirror_smart_color_set, _e_deskmirror_smart_clip_set,
300 _e_deskmirror_smart_clip_unset, NULL, NULL, NULL, NULL, NULL, NULL, NULL
301 };
302 if (_e_deskmirror_smart) return;
303 _e_deskmirror_smart = evas_smart_class_new(&sc);
304}
305
306static void
307_e_deskmirror_delfn(E_Smart_Data *sd, void *desk EINA_UNUSED)
308{
309 sd->desk_delfn = NULL;
310 sd->desk = NULL;
311 evas_object_del(sd->obj);
312}
313
314static Eina_Bool
315_e_deskmirror_win_visible_get(E_Smart_Data *sd, E_Comp_Win *cw)
316{
317 Eina_Bool visible = cw->visible;
318 if (cw->bd)
319 {
320 if (visible)
321 {
322 if (sd->pager)
323 visible = !cw->bd->client.netwm.state.skip_pager;
324 if (visible && sd->taskbar)
325 visible = !cw->bd->client.netwm.state.skip_taskbar;
326 }
327 }
328 return visible;
329}
330
331static void
332_e_deskmirror_mirror_del(Mirror *m)
333{
334 eina_hash_del_by_key(m->sd->mirror_hash, &m->cw);
335}
336
337static void
338_e_deskmirror_mirror_del_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
339{
340 _e_deskmirror_mirror_del(data);
341}
342
343static void
344_e_deskmirror_mirror_del_hash(Mirror *m)
345{
346 m->sd->mirrors = eina_inlist_remove(m->sd->mirrors, EINA_INLIST_GET(m));
347 evas_object_event_callback_del_full(m->mirror, EVAS_CALLBACK_DEL, _e_deskmirror_mirror_del_cb, m);
348 evas_object_del(m->mirror);
349 free(m);
350}
351
352static void
353_e_deskmirror_mirror_geometry_get(Mirror *m)
354{
355 if (m->cw->bd)
356 {
357 m->x = m->cw->bd->x;
358 m->y = m->cw->bd->y;
359 m->w = m->cw->bd->w;
360 if (m->cw->bd->shaded)
361 m->h = m->cw->bd->client_inset.t;
362 else
363 m->h = m->cw->bd->h;
364 }
365 else if (m->cw->not_in_layout)
366 evas_object_geometry_get(m->cw->effect_obj, &m->x, &m->y, &m->w, &m->h);
367 else
368 e_layout_child_geometry_get(m->cw->effect_obj, &m->x, &m->y, &m->w, &m->h);
369 /* double check here if we get zeroes */
370 if ((!m->w) || (!m->h))
371 {
372 m->w = m->cw->w, m->h = m->cw->h;
373 m->x = m->cw->x, m->y = m->cw->y;
374 }
375}
376
377static void
378_e_deskmirror_mirror_reconfigure(Mirror *m)
379{
380 _e_deskmirror_mirror_geometry_get(m);
381 e_layout_child_move(m->mirror, m->x, m->y);
382 e_layout_child_resize(m->mirror, m->w, m->h);
383 if (_e_deskmirror_win_visible_get(m->sd, m->cw) && m->w && m->h)
384 evas_object_show(m->mirror);
385 else
386 evas_object_hide(m->mirror);
387}
388
389static Evas_Object *
390_mirror_border_new(Mirror *m)
391{
392 Evas_Object *o;
393 Mirror_Border *mb;
394 char buf[4096];
395
396 _mirror_border_smart_init();
397 o = evas_object_smart_add(m->sd->e, _mirror_border_smart);
398 mb = evas_object_smart_data_get(o);
399 mb->m = m;
400 mb->frame = edje_object_add(m->sd->e);
401 evas_object_name_set(mb->frame, "mirror_border");
402 snprintf(buf, sizeof(buf), "e/deskmirror/frame/%s", m->cw->bd->client.border.name);
403 e_theme_edje_object_set(mb->frame, "base/theme/borders", buf);
404 if (e_util_border_shadow_state_get(m->cw->bd))
405 edje_object_signal_emit(mb->frame, "e,state,shadow,on", "e");
406 else
407 edje_object_signal_emit(mb->frame, "e,state,shadow,off", "e");
408 edje_object_signal_callback_add(mb->m->cw->bd->bg_object, "*", "*", _mirror_border_signal_cb, mb);
409 if (e_border_focused_get() == mb->m->cw->bd)
410 edje_object_signal_emit(mb->frame, "e,state,focused", "e");
411 if (mb->m->cw->bd->shaded)
412 edje_object_signal_emit(mb->frame, "e,state,shaded", "e");
413 if (mb->m->cw->bd->maximized)
414 edje_object_signal_emit(mb->frame, "e,action,maximize", "e");
415 if (mb->m->cw->bd->sticky)
416 edje_object_signal_emit(mb->frame, "e,state,sticky", "e");
417
418 mb->mirror = m->mirror;
419 evas_object_smart_member_add(mb->frame, o);
420 evas_object_name_set(mb->mirror, "mirror");
421 evas_object_smart_member_add(mb->mirror, o);
422 edje_object_part_swallow(mb->frame, "e.swallow.client", m->mirror);
423 edje_object_part_text_set(mb->frame, "e.text.title", m->cw->bd->client.netwm.name ?: m->cw->bd->client.icccm.name);
424 _mirror_scale_set(m, (double)m->sd->h / (double)m->sd->desk->zone->h);
425 evas_object_event_callback_add(m->cw->bd->bg_object, EVAS_CALLBACK_DEL, _e_deskmirror_mirror_frame_del_cb, mb);
426 return o;
427}
428
429static void
430_e_deskmirror_mirror_setup(Mirror *m)
431{
432 if (!m->mirror) return;
433 if (m->cw->bd && m->cw->bd->bg_object)
434 {
435 m->mirror = _mirror_border_new(m);
436 m->frame = 1;
437 }
438 else
439 evas_object_pass_events_set(m->mirror, 1);
440 e_layout_pack(m->sd->layout, m->mirror);
441 evas_object_event_callback_add(m->mirror, EVAS_CALLBACK_DEL, _e_deskmirror_mirror_del_cb, m);
442 _e_deskmirror_mirror_reconfigure(m);
443}
444
445static Mirror *
446_e_deskmirror_mirror_add(E_Smart_Data *sd, E_Comp_Win *cw)
447{
448 Mirror *m;
449 Evas_Object *o = NULL;
450
451 if (cw->bd)
452 {
453 if ((cw->bd->zone != sd->desk->zone) || ((cw->bd->desk != sd->desk) && (!cw->bd->sticky)))
454 return NULL;
455 }
456 else
457 {
458 int x, y;
459
460 if (!sd->desk->visible) return NULL;
461 if (cw->not_in_layout)
462 evas_object_geometry_get(cw->effect_obj, &x, &y, NULL, NULL);
463 else
464 e_layout_child_geometry_get(cw->effect_obj, &x, &y, NULL, NULL);
465 if (!E_INSIDE(x, y, sd->desk->zone->x, sd->desk->zone->y, sd->desk->zone->w, sd->desk->zone->h)) return NULL;
466 }
467 if ((cw->w > 1) && (cw->h > 1))
468 {
469 o = e_comp_win_image_mirror_add(cw);
470 if (!o) return NULL;
471 }
472 m = calloc(1, sizeof(Mirror));
473 m->cw = cw;
474 m->sd = sd;
475 m->mirror = o;
476 sd->mirrors = eina_inlist_append(sd->mirrors, EINA_INLIST_GET(m));
477 eina_hash_direct_add(sd->mirror_hash, &m->cw, m);
478 _e_deskmirror_mirror_setup(m);
479 return m;
480}
481
482static Eina_Bool
483_comp_source_add(E_Smart_Data *sd, int type EINA_UNUSED, E_Event_Comp *ev)
484{
485 if (eina_hash_find(sd->mirror_hash, &ev->cw)) return ECORE_CALLBACK_RENEW;
486 _e_deskmirror_mirror_add(sd, ev->cw);
487 return ECORE_CALLBACK_RENEW;
488}
489
490static Eina_Bool
491_comp_source_visible(E_Smart_Data *sd, int type EINA_UNUSED, E_Event_Comp *ev)
492{
493 Mirror *m;
494
495 m = eina_hash_find(sd->mirror_hash, &ev->cw);
496 if (!m) return ECORE_CALLBACK_RENEW;
497 if (!m->mirror)
498 {
499 if ((m->cw->w < 2) || (m->cw->h < 2)) return ECORE_CALLBACK_RENEW;
500 m->mirror = e_comp_win_image_mirror_add(m->cw);
501 _e_deskmirror_mirror_setup(m);
502 }
503 if (_e_deskmirror_win_visible_get(m->sd, m->cw))
504 evas_object_show(m->mirror);
505 else
506 evas_object_hide(m->mirror);
507 return ECORE_CALLBACK_RENEW;
508}
509
510static Eina_Bool
511_comp_source_stack(E_Smart_Data *sd, int type EINA_UNUSED, E_Event_Comp *ev)
512{
513 Mirror *m, *m2;
514 E_Comp_Win *cw;
515
516 m = eina_hash_find(sd->mirror_hash, &ev->cw);
517 if (!m) return ECORE_CALLBACK_RENEW;
518 if (!m->mirror)
519 {
520 if ((m->cw->w < 2) || (m->cw->h < 2)) return ECORE_CALLBACK_RENEW;
521 m->mirror = e_comp_win_image_mirror_add(m->cw);
522 _e_deskmirror_mirror_setup(m);
523 }
524 if (!EINA_INLIST_GET(ev->cw)->next)
525 e_layout_child_raise(m->mirror);
526 else if (!EINA_INLIST_GET(ev->cw)->prev)
527 e_layout_child_lower(m->mirror);
528 else
529 {
530 EINA_INLIST_FOREACH(EINA_INLIST_GET(ev->cw)->next, cw)
531 {
532 m2 = eina_hash_find(sd->mirror_hash, &cw);
533 if ((!m2) || (!m2->mirror)) continue;
534 e_layout_child_lower_below(m->mirror, m2->mirror);
535 return ECORE_CALLBACK_RENEW;
536 }
537 e_layout_child_raise(m->mirror);
538 }
539 return ECORE_CALLBACK_RENEW;
540}
541
542static Eina_Bool
543_comp_source_configure(E_Smart_Data *sd, int type EINA_UNUSED, E_Event_Comp *ev)
544{
545 Mirror *m;
546
547 m = eina_hash_find(sd->mirror_hash, &ev->cw);
548 if (m)
549 {
550 if (!m->mirror)
551 {
552 if ((m->cw->w < 2) || (m->cw->h < 2)) return ECORE_CALLBACK_RENEW;
553 m->mirror = e_comp_win_image_mirror_add(m->cw);
554 _e_deskmirror_mirror_setup(m);
555 }
556 _e_deskmirror_mirror_reconfigure(m);
557 }
558 return ECORE_CALLBACK_RENEW;
559}
560
561/* externally accessible functions */
562EAPI Evas_Object *
563e_deskmirror_add(E_Desk *desk)
564{
565 E_Smart_Data *sd;
566 Evas_Object *o;
567 Evas *e;
568 E_Comp_Win *cw;
569
570 e = e_comp_get(desk)->evas;
571 _e_deskmirror_smart_init();
572 o = evas_object_smart_add(e, _e_deskmirror_smart);
573 sd = evas_object_smart_data_get(o);
574 sd->desk = desk;
575 sd->mirror_hash = eina_hash_pointer_new((Eina_Free_Cb)_e_deskmirror_mirror_del_hash);
576 sd->desk_delfn = e_object_delfn_add(E_OBJECT(desk), (Ecore_End_Cb)_e_deskmirror_delfn, sd);
577 sd->bgpreview = e_widget_bgpreview_desk_add(e, desk->zone, desk->x, desk->y);
578 evas_object_clip_set(sd->bgpreview, sd->clip);
579 evas_object_smart_member_add(sd->bgpreview, o);
580 evas_object_show(sd->bgpreview);
581 sd->layout = e_layout_add(e);
582 evas_object_clip_set(sd->layout, sd->clip);
583 e_layout_virtual_size_set(sd->layout, desk->zone->w, desk->zone->h);
584 evas_object_smart_member_add(sd->layout, o);
585 evas_object_show(sd->layout);
586
587 e_layout_freeze(sd->layout);
588
589 EINA_INLIST_FOREACH(e_comp_get(desk)->wins, cw)
590 {
591 Mirror *m;
592
593 m = _e_deskmirror_mirror_add(sd, cw);
594 if (m) e_layout_child_raise(m->mirror);
595 }
596
597 e_layout_thaw(sd->layout);
598
599 E_LIST_HANDLER_APPEND(sd->handlers, E_EVENT_COMP_SOURCE_ADD, _comp_source_add, sd);
600 E_LIST_HANDLER_APPEND(sd->handlers, E_EVENT_COMP_SOURCE_CONFIGURE, _comp_source_configure, sd);
601 E_LIST_HANDLER_APPEND(sd->handlers, E_EVENT_COMP_SOURCE_STACK, _comp_source_stack, sd);
602 E_LIST_HANDLER_APPEND(sd->handlers, E_EVENT_COMP_SOURCE_VISIBILITY, _comp_source_visible, sd);
603 return o;
604}
605
606EAPI void
607e_deskmirror_util_wins_print(Evas_Object *obj)
608{
609 E_Smart_Data *sd;
610 Mirror *m;
611
612 EINA_SAFETY_ON_NULL_RETURN(obj);
613 sd = evas_object_smart_data_get(obj);
614 EINA_INLIST_FOREACH(sd->mirrors, m)
615 {
616 if (m->cw->bd)
617 fprintf(stderr, "MIRROR BD: %p - %u '%s:%s'\n", m->cw, m->cw->win, m->cw->bd->client.icccm.name, m->cw->bd->client.icccm.class);
618 else if (m->cw->pop)
619 fprintf(stderr, "MIRROR POP: %p - %s\n", m->cw, m->cw->pop->name);
620 else if (m->cw->menu)
621 fprintf(stderr, "MIRROR MENU: %p - %s\n", m->cw, m->cw->menu->header.title);
622 else if (m->cw->real_obj)
623 fprintf(stderr, "MIRROR OBJ: %p - %s\n", m->cw, evas_object_name_get(m->cw->obj));
624 else
625 fprintf(stderr, "MIRROR WIN: %p - %u%s\n", m->cw, m->cw->win, m->cw->input_only ? " INPUT" : "");
626 }
627}
diff --git a/src/bin/e_deskmirror.h b/src/bin/e_deskmirror.h
new file mode 100644
index 000000000..aabbc7720
--- /dev/null
+++ b/src/bin/e_deskmirror.h
@@ -0,0 +1,8 @@
1#ifndef E_WIDGET_DESKMIRROR_H
2#define E_WIDGET_DESKMIRROR_H
3
4EAPI Evas_Object *e_deskmirror_add(E_Desk *desk);
5EAPI void e_deskmirror_util_wins_print(Evas_Object *obj);
6//#define DESKMIRROR_TEST
7
8#endif
diff --git a/src/bin/e_includes.h b/src/bin/e_includes.h
index 809caa7c0..68b72783d 100644
--- a/src/bin/e_includes.h
+++ b/src/bin/e_includes.h
@@ -120,6 +120,7 @@
120#include "e_filereg.h" 120#include "e_filereg.h"
121#include "e_widget_aspect.h" 121#include "e_widget_aspect.h"
122#include "e_widget_bgpreview.h" 122#include "e_widget_bgpreview.h"
123#include "e_deskmirror.h"
123#include "e_fm_prop.h" 124#include "e_fm_prop.h"
124#include "e_mouse.h" 125#include "e_mouse.h"
125#include "e_order.h" 126#include "e_order.h"
diff --git a/src/bin/e_int_border_menu.c b/src/bin/e_int_border_menu.c
index a8faaa6e2..3586a1bbe 100644
--- a/src/bin/e_int_border_menu.c
+++ b/src/bin/e_int_border_menu.c
@@ -31,7 +31,6 @@ static void _e_border_menu_cb_fullscreen(void *data, E_Menu *m, E_Menu_Item *mi)
31static void _e_border_menu_cb_skip_winlist(void *data, E_Menu *m, E_Menu_Item *mi); 31static void _e_border_menu_cb_skip_winlist(void *data, E_Menu *m, E_Menu_Item *mi);
32static void _e_border_menu_cb_skip_pager(void *data, E_Menu *m, E_Menu_Item *mi); 32static void _e_border_menu_cb_skip_pager(void *data, E_Menu *m, E_Menu_Item *mi);
33static void _e_border_menu_cb_skip_taskbar(void *data, E_Menu *m, E_Menu_Item *mi); 33static void _e_border_menu_cb_skip_taskbar(void *data, E_Menu *m, E_Menu_Item *mi);
34static void _e_border_menu_cb_sendto_icon_pre(void *data, E_Menu *m, E_Menu_Item *mi);
35static void _e_border_menu_cb_sendto_pre(void *data, E_Menu *m, E_Menu_Item *mi); 34static void _e_border_menu_cb_sendto_pre(void *data, E_Menu *m, E_Menu_Item *mi);
36static void _e_border_menu_cb_sendto(void *data, E_Menu *m, E_Menu_Item *mi); 35static void _e_border_menu_cb_sendto(void *data, E_Menu *m, E_Menu_Item *mi);
37static void _e_border_menu_cb_pin(void *data, E_Menu *m, E_Menu_Item *mi); 36static void _e_border_menu_cb_pin(void *data, E_Menu *m, E_Menu_Item *mi);
@@ -881,7 +880,8 @@ _e_border_menu_cb_skip_taskbar(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi
881 e_remember_update(bd); 880 e_remember_update(bd);
882} 881}
883 882
884static void 883#ifndef DESKMIRROR_TEST
884 static void
885_e_border_menu_cb_sendto_icon_pre(void *data, E_Menu *m, E_Menu_Item *mi) 885_e_border_menu_cb_sendto_icon_pre(void *data, E_Menu *m, E_Menu_Item *mi)
886{ 886{
887 E_Desk *desk = NULL; 887 E_Desk *desk = NULL;
@@ -903,6 +903,7 @@ _e_border_menu_cb_sendto_icon_pre(void *data, E_Menu *m, E_Menu_Item *mi)
903 e_thumb_icon_begin(o); 903 e_thumb_icon_begin(o);
904 mi->icon_object = o; 904 mi->icon_object = o;
905} 905}
906#endif
906 907
907static void 908static void
908_e_border_menu_cb_sendto_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi) 909_e_border_menu_cb_sendto_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
@@ -935,24 +936,35 @@ _e_border_menu_cb_sendto_pre(void *data, E_Menu *m __UNUSED__, E_Menu_Item *mi)
935 e_menu_item_disabled_set(submi, EINA_TRUE); 936 e_menu_item_disabled_set(submi, EINA_TRUE);
936 } 937 }
937 938
938// FIXME: Remove labels and add bgpreview to menu.
939// Evas_Object *o = e_widget_bgpreview_add(m->evas, 4, 2);
940
941 for (i = 0; i < zone->desk_x_count * zone->desk_y_count; i++) 939 for (i = 0; i < zone->desk_x_count * zone->desk_y_count; i++)
942 { 940 {
943 E_Desk *desk; 941 E_Desk *desk;
944 942#ifdef DESKMIRROR_TEST
943 int tw = 50, th;
944#endif
945 desk = zone->desks[i]; 945 desk = zone->desks[i];
946#ifdef DESKMIRROR_TEST
947 th = (tw * desk->zone->h) / desk->zone->w;
948#endif
946 submi = e_menu_item_new(subm); 949 submi = e_menu_item_new(subm);
947 e_menu_item_label_set(submi, desk->name); 950 e_menu_item_label_set(submi, desk->name);
948 e_menu_item_radio_set(submi, 1); 951 e_menu_item_radio_set(submi, 1);
949 e_menu_item_radio_group_set(submi, 2); 952 e_menu_item_radio_group_set(submi, 2);
953#ifdef DESKMIRROR_TEST
954 e_menu_item_icon_file_set(submi, "sup");
955#endif
950 if ((bd->zone == zone) && (desk_cur == desk)) 956 if ((bd->zone == zone) && (desk_cur == desk))
951 e_menu_item_toggle_set(submi, 1); 957 e_menu_item_toggle_set(submi, 1);
952 else 958 else
953 e_menu_item_callback_set(submi, _e_border_menu_cb_sendto, desk); 959 e_menu_item_callback_set(submi, _e_border_menu_cb_sendto, desk);
960#ifdef DESKMIRROR_TEST
961 submi->icon_object = e_deskmirror_add(desk);
962 edje_extern_object_min_size_set(submi->icon_object, tw, th);
963 evas_object_show(submi->icon_object);
964#else
954 e_menu_item_realize_callback_set(submi, _e_border_menu_cb_sendto_icon_pre, 965 e_menu_item_realize_callback_set(submi, _e_border_menu_cb_sendto_icon_pre,
955 desk); 966 desk);
967#endif
956 } 968 }
957 } 969 }
958} 970}
diff --git a/src/bin/e_test.c b/src/bin/e_test.c
index 8a5fe3423..4d9a14c57 100644
--- a/src/bin/e_test.c
+++ b/src/bin/e_test.c
@@ -2,6 +2,25 @@
2 2
3static void _e_test_internal(E_Container *con); 3static void _e_test_internal(E_Container *con);
4 4
5#ifdef DESKMIRROR_TEST
6
7static Eina_Bool
8deskmirror_test(void *d EINA_UNUSED)
9{
10 E_Zone *zone;
11 Evas_Object *o;
12 E_Popup *pop;
13
14 zone = e_util_zone_current_get(e_manager_current_get());
15 pop = e_popup_new(zone, zone->x + zone->w / 4, zone->y + zone->h / 4, zone->w / 2, zone->h / 2);
16 o = e_deskmirror_add(e_desk_current_get(zone));
17 e_popup_content_set(pop, o);
18 e_popup_show(pop);
19 return EINA_FALSE;
20}
21
22#endif
23
5EAPI void 24EAPI void
6e_test(void) 25e_test(void)
7{ 26{
@@ -16,6 +35,10 @@ e_test(void)
16 _e_test_internal(con); 35 _e_test_internal(con);
17 } 36 }
18 } 37 }
38
39#ifdef DESKMIRROR_TEST
40 ecore_timer_add(2.0, deskmirror_test, NULL);
41#endif
19} 42}
20 43
21#if 0 44#if 0