summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2014-09-18 18:21:07 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2014-09-18 18:23:43 -0400
commit349a9f5262163cf5d6449873ceadc75a1ec49b24 (patch)
tree83852242d6c838dc09a5db4e2d2dec1685f98024
parent309ff82429a27efa84611657b0df80b89249a71e (diff)
add borderless theme for deskmirror clients to support various animations
-rw-r--r--src/bin/e_deskmirror.c101
1 files changed, 27 insertions, 74 deletions
diff --git a/src/bin/e_deskmirror.c b/src/bin/e_deskmirror.c
index c66a6fc4b..e6f5434aa 100644
--- a/src/bin/e_deskmirror.c
+++ b/src/bin/e_deskmirror.c
@@ -40,7 +40,6 @@ typedef struct Mirror
40 Evas_Object *comp_object; 40 Evas_Object *comp_object;
41 Evas_Object *mirror; 41 Evas_Object *mirror;
42 int x, y, w, h; 42 int x, y, w, h;
43 Eina_Bool frame : 1;
44 Eina_Bool added : 1; 43 Eina_Bool added : 1;
45} Mirror; 44} Mirror;
46 45
@@ -101,7 +100,7 @@ _mirror_scale_set(Mirror *m, float sc)
101 Edje_Message_Float msg; 100 Edje_Message_Float msg;
102 Mirror_Border *mb; 101 Mirror_Border *mb;
103 102
104 if (!m->frame) return; 103 if (!m->mirror) return;
105 mb = evas_object_smart_data_get(m->mirror); 104 mb = evas_object_smart_data_get(m->mirror);
106 msg.val = sc; 105 msg.val = sc;
107 edje_object_message_send(mb->frame, EDJE_MESSAGE_FLOAT, 0, &msg); 106 edje_object_message_send(mb->frame, EDJE_MESSAGE_FLOAT, 0, &msg);
@@ -222,65 +221,46 @@ _e_deskmirror_smart_clip_unset(Evas_Object *obj)
222//////////////////////////////////////////////////////// 221////////////////////////////////////////////////////////
223 222
224static void 223static void
225_mirror_client_theme_setup(Mirror_Border *mb) 224_mirror_client_theme_setup(Mirror_Border *mb, Evas_Object *o)
226{ 225{
227 char buf[4096]; 226 char buf[4096];
228 227
229 snprintf(buf, sizeof(buf), "e/deskmirror/frame/%s", mb->m->ec->border.name); 228 if (e_comp_object_frame_exists(mb->m->ec->frame))
230 e_theme_edje_object_set(mb->frame, "base/theme/borders", buf); 229 snprintf(buf, sizeof(buf), "e/deskmirror/frame/%s", mb->m->ec->border.name);
230 else
231 snprintf(buf, sizeof(buf), "e/deskmirror/frame/borderless");
232 e_theme_edje_object_set(o, "base/theme/borders", buf);
231 if (e_client_util_shadow_state_get(mb->m->ec)) 233 if (e_client_util_shadow_state_get(mb->m->ec))
232 edje_object_signal_emit(mb->frame, "e,state,shadow,on", "e"); 234 edje_object_signal_emit(o, "e,state,shadow,on", "e");
233 else 235 else
234 edje_object_signal_emit(mb->frame, "e,state,shadow,off", "e"); 236 edje_object_signal_emit(o, "e,state,shadow,off", "e");
235 if (mb->m->ec->focused) 237 if (mb->m->ec->focused)
236 edje_object_signal_emit(mb->frame, "e,state,focused", "e"); 238 edje_object_signal_emit(o, "e,state,focused", "e");
237 if (mb->m->ec->shaded) 239 if (mb->m->ec->shaded)
238 edje_object_signal_emit(mb->frame, "e,state,shaded", "e"); 240 edje_object_signal_emit(o, "e,state,shaded", "e");
239 if (mb->m->ec->maximized) 241 if (mb->m->ec->maximized)
240 edje_object_signal_emit(mb->frame, "e,action,maximize", "e"); 242 edje_object_signal_emit(o, "e,action,maximize", "e");
241 if (mb->m->ec->sticky) 243 if (mb->m->ec->sticky)
242 edje_object_signal_emit(mb->frame, "e,state,sticky", "e"); 244 edje_object_signal_emit(o, "e,state,sticky", "e");
243 if (mb->m->ec->iconic) 245 if (mb->m->ec->iconic)
244 edje_object_signal_emit(mb->frame, "e,action,iconify", "e"); 246 edje_object_signal_emit(o, "e,action,iconify", "e");
245} 247}
246 248
247static void 249static void
248_e_deskmirror_mirror_frame_recalc_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 250_e_deskmirror_mirror_frame_recalc_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
249{ 251{
250 Mirror *m = data; 252 Mirror *m = data;
251 Mirror_Border *mb; 253 Mirror_Border *mb;
252 254
253 255 if (!m->mirror) return;
254 if (m->frame) 256 mb = evas_object_smart_data_get(m->mirror);
257 if (mb->m->ec && (!e_object_is_del(E_OBJECT(mb->m->ec))))
255 { 258 {
256 mb = evas_object_smart_data_get(m->mirror); 259 _mirror_client_theme_setup(mb, mb->frame);
257 if (mb->m->ec && (!e_object_is_del(E_OBJECT(mb->m->ec)))) 260 _mirror_scale_set(mb->m, (float)mb->m->sd->h / (float)mb->m->sd->desk->zone->h);
258 {
259 if (e_comp_object_frame_exists(obj))
260 {
261 _mirror_client_theme_setup(mb);
262 _mirror_scale_set(mb->m, (float)mb->m->sd->h / (float)mb->m->sd->desk->zone->h);
263 return;
264 }
265 evas_object_smart_member_del(mb->mirror);
266 mb->m->mirror = mb->mirror;
267 mb->mirror = NULL;
268 mb->m->frame = 0;
269 }
270 else
271 mb->m->comp_object = NULL;
272 evas_object_del(mb->obj);
273 e_layout_pack(m->sd->layout, m->mirror);
274 } 261 }
275 else 262 else
276 { 263 mb->m->comp_object = NULL;
277 if (m->ec && (!e_object_is_del(E_OBJECT(m->ec))))
278 {
279 if (!e_comp_object_frame_exists(obj)) return;
280 e_layout_unpack(m->mirror);
281 _e_deskmirror_mirror_setup(m);
282 }
283 }
284} 264}
285 265
286static void 266static void
@@ -479,7 +459,7 @@ _mirror_client_new(Mirror *m)
479 mb->m = m; 459 mb->m = m;
480 mb->frame = edje_object_add(m->sd->e); 460 mb->frame = edje_object_add(m->sd->e);
481 evas_object_name_set(mb->frame, "mirror_border"); 461 evas_object_name_set(mb->frame, "mirror_border");
482 _mirror_client_theme_setup(mb); 462 _mirror_client_theme_setup(mb, mb->frame);
483 if (m->comp_object) 463 if (m->comp_object)
484 { 464 {
485 e_comp_object_signal_callback_add(mb->m->comp_object, "*", "*", _mirror_client_signal_cb, mb->frame); 465 e_comp_object_signal_callback_add(mb->m->comp_object, "*", "*", _mirror_client_signal_cb, mb->frame);
@@ -500,10 +480,9 @@ _e_deskmirror_mirror_setup(Mirror *m)
500{ 480{
501 if (!m->mirror) return; 481 if (!m->mirror) return;
502 evas_object_event_callback_del_full(m->comp_object, EVAS_CALLBACK_DEL, _e_deskmirror_mirror_del_cb, m); 482 evas_object_event_callback_del_full(m->comp_object, EVAS_CALLBACK_DEL, _e_deskmirror_mirror_del_cb, m);
503 if (m->ec && e_comp_object_frame_exists(m->comp_object)) 483 if (m->ec)
504 { 484 {
505 m->mirror = _mirror_client_new(m); 485 m->mirror = _mirror_client_new(m);
506 m->frame = 1;
507 _mirror_scale_set(m, (double)m->sd->h / (double)m->sd->desk->zone->h); 486 _mirror_scale_set(m, (double)m->sd->h / (double)m->sd->desk->zone->h);
508 } 487 }
509 else 488 else
@@ -791,55 +770,29 @@ e_deskmirror_mirror_copy(Evas_Object *obj)
791 { 770 {
792 Evas_Object *o, *oo; 771 Evas_Object *o, *oo;
793 Edje_Message_Float msg; 772 Edje_Message_Float msg;
794 char buf[1024];
795 Mirror_Border *mb; 773 Mirror_Border *mb;
796 774
797 mb = evas_object_smart_data_get(obj); 775 mb = evas_object_smart_data_get(obj);
798 o = edje_object_add(evas_object_evas_get(obj)); 776 o = edje_object_add(evas_object_evas_get(obj));
799 snprintf(buf, sizeof(buf), "e/deskmirror/frame/%s", mb->m->ec->border.name); 777 _mirror_client_theme_setup(mb, o);
800 e_theme_edje_object_set(o, "base/theme/borders", buf);
801 if (e_client_util_shadow_state_get(mb->m->ec))
802 edje_object_signal_emit(o, "e,state,shadow,on", "e");
803 else
804 edje_object_signal_emit(o, "e,state,shadow,off", "e");
805 if (mb->m->comp_object) 778 if (mb->m->comp_object)
806 { 779 {
807 e_comp_object_signal_callback_add(mb->m->comp_object, "*", "*", _mirror_client_signal_cb, o); 780 e_comp_object_signal_callback_add(mb->m->comp_object, "*", "*", _mirror_client_signal_cb, o);
808 evas_object_smart_callback_add(mb->m->comp_object, "shadow_change", _mirror_client_shadow_change, o); 781 evas_object_smart_callback_add(mb->m->comp_object, "shadow_change", _mirror_client_shadow_change, o);
809 evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _mirror_copy_del, mb->m->comp_object); 782 evas_object_event_callback_add(o, EVAS_CALLBACK_DEL, _mirror_copy_del, mb->m->comp_object);
810 } 783 }
811 if (mb->m->ec->focused)
812 edje_object_signal_emit(o, "e,state,focused", "e");
813 if (mb->m->ec->shaded)
814 edje_object_signal_emit(o, "e,state,shaded", "e");
815 if (mb->m->ec->maximized)
816 edje_object_signal_emit(o, "e,action,maximize", "e");
817 if (mb->m->ec->sticky)
818 edje_object_signal_emit(o, "e,state,sticky", "e");
819 if (mb->m->ec->iconic)
820 edje_object_signal_emit(o, "e,action,iconify", "e");
821 msg.val = mb->m->sd->h / mb->m->sd->desk->zone->h; 784 msg.val = mb->m->sd->h / mb->m->sd->desk->zone->h;
822 edje_object_message_send(o, EDJE_MESSAGE_FLOAT, 0, &msg); 785 edje_object_message_send(o, EDJE_MESSAGE_FLOAT, 0, &msg);
823 786
824 oo = e_comp_object_util_mirror_add(mb->m->comp_object); 787 oo = e_comp_object_util_mirror_add(mb->m->comp_object);
825 edje_object_part_swallow(o, "e.swallow.client", oo); 788 edje_object_part_swallow(o, "e.swallow.client", oo);
826 edje_object_part_text_set(o, "e.text.title", e_client_util_name_get(mb->m->ec)); 789 if (e_comp_object_frame_exists(mb->m->ec->frame))
790 edje_object_part_text_set(o, "e.text.title", e_client_util_name_get(mb->m->ec));
827 e_comp_object_util_del_list_append(o, oo); 791 e_comp_object_util_del_list_append(o, oo);
828 return o; 792 return o;
829 } 793 }
830 else if (!e_util_strcmp(evas_object_type_get(obj), "image")) 794 else if (!e_util_strcmp(evas_object_type_get(obj), "image"))
831 { 795 return e_comp_object_util_mirror_add(obj);
832 if (!e_util_strcmp(evas_object_name_get(obj), "m->mirror"))
833 {
834 E_Client *ec;
835
836 ec = evas_object_data_get(obj, "E_Client");
837 if (!ec) return NULL;
838 return e_comp_object_util_mirror_add(ec->frame);
839 }
840 else
841 return e_comp_object_util_mirror_add(obj);
842 }
843 CRI("NOT A DESKMIRROR CLIENT"); 796 CRI("NOT A DESKMIRROR CLIENT");
844 return NULL; 797 return NULL;
845} 798}