1 #include <Elementary.h>
4 typedef struct _Elm_Win Elm_Win;
7 typedef struct _Object_Dump_Mod Object_Dump_Mod;
9 struct _Object_Dump_Mod
11 Eina_List *(*tree_create) (Evas_Object *root);
12 void (*tree_free) (Eina_List *tree);
13 char *(*tree_string_get) (Eina_List *tree);
14 char *(*tree_string_get_for_sdb) (Eina_List *tree);
15 char *(*command_for_sdb) (Eina_List *tree, char *data);
23 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
25 #ifdef HAVE_ELEMENTARY_X
27 Ecore_Event_Handler *client_message_handler;
30 Object_Dump_Mod *od_mod;
31 Ecore_Ipc_Server *sdb_server;
32 Ecore_Event_Handler *sdb_server_data_handler, *sdb_server_del_handler;
34 Ecore_Job *deferred_resize_job;
35 Ecore_Job *deferred_child_eval_job;
38 Elm_Win_Keyboard_Mode kbdmode;
39 Elm_Win_Indicator_Mode indmode;
40 Elm_Win_Indicator_Opacity_Mode ind_o_mode;
49 int *autodel_clear, rot;
59 Evas_Object *obj, *hot_obj;
69 Eina_Bool visible : 1;
70 Eina_Bool handled : 1;
74 Ecore_Job *reconf_job;
76 Eina_Bool enabled : 1;
77 Eina_Bool changed_theme : 1;
78 Eina_Bool top_animate : 1;
79 Eina_Bool geometry_changed : 1;
90 const char *icon_name;
96 Eina_Bool demand_attention : 1;
97 Eina_Bool autodel : 1;
98 Eina_Bool constrain : 1;
99 Eina_Bool resizing : 1;
100 Eina_Bool iconified : 1;
101 Eina_Bool withdrawn : 1;
102 Eina_Bool sticky : 1;
103 Eina_Bool fullscreen : 1;
104 Eina_Bool maximized : 1;
105 Eina_Bool skip_focus : 1;
106 Eina_Bool floating : 1;
109 static const char *widtype = NULL;
110 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
111 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
112 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
113 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
114 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
115 static void _elm_win_move(Ecore_Evas *ee);
116 static void _elm_win_resize(Ecore_Evas *ee);
117 static void _elm_win_delete_request(Ecore_Evas *ee);
118 static void _elm_win_resize_job(void *data);
119 #ifdef HAVE_ELEMENTARY_X
120 static void _elm_win_xwin_update(Elm_Win *win);
122 static void _elm_win_eval_subobjs(Evas_Object *obj);
123 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
124 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
125 static void _elm_win_focus_highlight_init(Elm_Win *win);
126 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
127 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
128 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
129 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
130 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
131 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
133 static void _elm_win_frame_add(Elm_Win *win, const char *style);
134 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
135 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
136 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
137 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
138 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
140 //static void _elm_win_pointer_add(Elm_Win *win, const char *style);
142 static const char SIG_DELETE_REQUEST[] = "delete,request";
143 static const char SIG_FOCUS_OUT[] = "focus,out";
144 static const char SIG_FOCUS_IN[] = "focus,in";
145 static const char SIG_MOVED[] = "moved";
146 static const char SIG_THEME_CHANGED[] = "theme,changed";
147 static const char SIG_WITHDRAWN[] = "withdrawn";
148 static const char SIG_ICONIFIED[] = "iconified";
149 static const char SIG_NORMAL[] = "normal";
150 static const char SIG_STICK[] = "stick";
151 static const char SIG_UNSTICK[] = "unstick";
152 static const char SIG_FULLSCREEN[] = "fullscreen";
153 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
154 static const char SIG_MAXIMIZED[] = "maximized";
155 static const char SIG_UNMAXIMIZED[] = "unmaximized";
156 static const char SIG_PROFILE_CHANGED[] = "profile,changed";
158 static const Evas_Smart_Cb_Description _signals[] = {
159 {SIG_DELETE_REQUEST, ""},
168 {SIG_FULLSCREEN, ""},
169 {SIG_UNFULLSCREEN, ""},
171 {SIG_UNMAXIMIZED, ""},
172 {SIG_PROFILE_CHANGED, ""},
178 Eina_List *_elm_win_list = NULL;
179 int _elm_win_deferred_free = 0;
181 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
182 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
185 _shot_delay_get(Elm_Win *win)
188 char *d = strdup(win->shot.info);
191 for (p = (char *)win->shot.info; *p; p++)
193 if (!strncmp(p, "delay=", 6))
197 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
212 _shot_file_get(Elm_Win *win)
215 char *tmp = strdup(win->shot.info);
216 char *repname = NULL;
218 if (!tmp) return NULL;
220 for (p = (char *)win->shot.info; *p; p++)
222 if (!strncmp(p, "file=", 5))
225 if (!win->shot.repeat_count) return tmp;
228 char *dotptr = strrchr(tmp, '.');
231 size_t size = sizeof(char)*(strlen(tmp) + 16);
232 repname = malloc(size);
233 strncpy(repname, tmp, dotptr - tmp);
234 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
235 win->shot.shot_counter + 1);
236 strcat(repname, dotptr);
244 if (!win->shot.repeat_count) return strdup("out.png");
246 repname = malloc(sizeof(char) * 24);
247 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
252 _shot_repeat_count_get(Elm_Win *win)
255 char *d = strdup(win->shot.info);
258 for (p = (char *)win->shot.info; *p; p++)
260 if (!strncmp(p, "repeat=", 7))
264 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
271 if (v > 1000) v = 999;
281 _shot_key_get(Elm_Win *win __UNUSED__)
287 _shot_flags_get(Elm_Win *win __UNUSED__)
293 _shot_do(Elm_Win *win)
297 unsigned int *pixels;
299 char *file, *key, *flags;
301 ecore_evas_manual_render(win->ee);
302 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
304 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
305 if ((w < 1) || (h < 1)) return;
306 file = _shot_file_get(win);
308 key = _shot_key_get(win);
309 flags = _shot_flags_get(win);
310 ee = ecore_evas_buffer_new(1, 1);
311 o = evas_object_image_add(ecore_evas_get(ee));
312 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
313 evas_object_image_size_set(o, w, h);
314 evas_object_image_data_set(o, pixels);
315 if (!evas_object_image_save(o, file, key, flags))
317 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
322 if (flags) free(flags);
324 if (win->shot.repeat_count) win->shot.shot_counter++;
328 _shot_delay(void *data)
332 if (win->shot.repeat_count)
334 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
335 if (remainshot > 0) return EINA_TRUE;
337 win->shot.timer = NULL;
343 _shot_init(Elm_Win *win)
345 if (!win->shot.info) return;
346 win->shot.repeat_count = _shot_repeat_count_get(win);
347 win->shot.shot_counter = 0;
351 _shot_handle(Elm_Win *win)
353 if (!win->shot.info) return;
354 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
358 _elm_win_move(Ecore_Evas *ee)
360 Evas_Object *obj = ecore_evas_object_associate_get(ee);
365 win = elm_widget_data_get(obj);
367 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
370 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
374 _elm_win_resize(Ecore_Evas *ee)
376 Evas_Object *obj = ecore_evas_object_associate_get(ee);
380 win = elm_widget_data_get(obj);
382 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
383 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
387 _elm_win_mouse_in(Ecore_Evas *ee)
392 if (!(obj = ecore_evas_object_associate_get(ee))) return;
393 if (!(win = elm_widget_data_get(obj))) return;
394 if (win->resizing) win->resizing = EINA_FALSE;
398 _elm_win_focus_in(Ecore_Evas *ee)
400 Evas_Object *obj = ecore_evas_object_associate_get(ee);
404 win = elm_widget_data_get(obj);
406 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
407 if (!elm_widget_focus_order_get(obj))
409 elm_widget_focus_steal(win->win_obj);
413 elm_widget_focus_restore(win->win_obj);
414 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
415 win->focus_highlight.cur.visible = EINA_TRUE;
416 _elm_win_focus_highlight_reconfigure_job_start(win);
419 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
421 else if (win->img_obj)
428 _elm_win_focus_out(Ecore_Evas *ee)
430 Evas_Object *obj = ecore_evas_object_associate_get(ee);
434 win = elm_widget_data_get(obj);
436 elm_object_focus_set(win->win_obj, EINA_FALSE);
437 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
438 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
439 win->focus_highlight.cur.visible = EINA_FALSE;
440 _elm_win_focus_highlight_reconfigure_job_start(win);
443 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
445 else if (win->img_obj)
452 if (win->od_mod) free(win->od_mod);
453 ecore_event_handler_del(win->sdb_server_data_handler);
454 ecore_event_handler_del(win->sdb_server_del_handler);
455 ecore_ipc_shutdown();
458 win->sdb_server = NULL;
459 win->sdb_server_data_handler = NULL;
460 win->sdb_server_del_handler = NULL;
466 _elm_win_profile_update(Ecore_Evas *ee)
468 Evas_Object *obj = ecore_evas_object_associate_get(ee);
472 win = elm_widget_data_get(obj);
475 if (win->profile.timer)
476 ecore_timer_del(win->profile.timer);
477 win->profile.timer = NULL;
479 /* TODO: We need the ability to bind a profile to a specific window.
480 * Elementary's configuration still has a single global profile for the app.
482 _elm_config_profile_set(win->profile.name);
484 evas_object_smart_callback_call(win->win_obj, SIG_PROFILE_CHANGED, NULL);
488 _elm_win_profile_change_delay(void *data)
492 Eina_Bool changed = EINA_FALSE;
494 profile = eina_list_nth(win->profile.names, 0);
497 if (win->profile.name)
499 if (strcmp(win->profile.name, profile))
501 eina_stringshare_replace(&(win->profile.name), profile);
507 win->profile.name = eina_stringshare_add(profile);
511 win->profile.timer = NULL;
512 if (changed) _elm_win_profile_update(win->ee);
517 _elm_win_state_change(Ecore_Evas *ee)
521 Eina_Bool ch_withdrawn = EINA_FALSE;
522 Eina_Bool ch_sticky = EINA_FALSE;
523 Eina_Bool ch_iconified = EINA_FALSE;
524 Eina_Bool ch_fullscreen = EINA_FALSE;
525 Eina_Bool ch_maximized = EINA_FALSE;
526 Eina_Bool ch_profile = EINA_FALSE;
529 if (!(obj = ecore_evas_object_associate_get(ee))) return;
531 if (!(win = elm_widget_data_get(obj))) return;
533 if (win->withdrawn != ecore_evas_withdrawn_get(win->ee))
535 win->withdrawn = ecore_evas_withdrawn_get(win->ee);
536 ch_withdrawn = EINA_TRUE;
538 if (win->sticky != ecore_evas_sticky_get(win->ee))
540 win->sticky = ecore_evas_sticky_get(win->ee);
541 ch_sticky = EINA_TRUE;
543 if (win->iconified != ecore_evas_iconified_get(win->ee))
545 win->iconified = ecore_evas_iconified_get(win->ee);
546 ch_iconified = EINA_TRUE;
548 if (win->fullscreen != ecore_evas_fullscreen_get(win->ee))
550 win->fullscreen = ecore_evas_fullscreen_get(win->ee);
551 ch_fullscreen = EINA_TRUE;
553 if (win->maximized != ecore_evas_maximized_get(win->ee))
555 win->maximized = ecore_evas_maximized_get(win->ee);
556 ch_maximized = EINA_TRUE;
558 profile = ecore_evas_profile_get(win->ee);
560 _elm_config_profile_exists(profile))
562 if (win->profile.name)
564 if (strcmp(win->profile.name, profile))
566 eina_stringshare_replace(&(win->profile.name), profile);
567 ch_profile = EINA_TRUE;
572 win->profile.name = eina_stringshare_add(profile);
573 ch_profile = EINA_TRUE;
576 if ((ch_withdrawn) || (ch_iconified))
579 evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL);
580 else if (win->iconified)
581 evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL);
583 evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL);
588 evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL);
590 evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL);
595 evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL);
597 evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL);
602 evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL);
604 evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL);
608 _elm_win_profile_update(win->ee);
613 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
615 Elm_Win *wd = elm_widget_data_get(obj);
616 const Eina_List *items;
617 const Eina_List *list;
618 void *(*list_data_get) (const Eina_List *list);
622 list = elm_widget_sub_object_list_get(obj);
627 if (!(items = elm_widget_focus_custom_chain_get(obj)))
630 list_data_get = eina_list_data_get;
632 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
637 *next = (Evas_Object *)obj;
642 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
644 Elm_Win *win = elm_widget_data_get(obj);
648 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
650 evas_object_focus_set(obj, elm_widget_focus_get(obj));
654 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
656 if (type == EVAS_CALLBACK_KEY_DOWN)
658 Evas_Event_Key_Down *ev = event_info;
659 if (!strcmp(ev->keyname, "Tab"))
661 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
662 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
664 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
665 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
668 else if ((!strcmp(ev->keyname, "Left")) ||
669 ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
671 //TODO : woohyun jung
673 else if ((!strcmp(ev->keyname, "Right")) ||
674 ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
676 //TODO : woohyun jung
678 else if ((!strcmp(ev->keyname, "Up")) ||
679 ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
681 //TODO : woohyun jung
683 else if ((!strcmp(ev->keyname, "Down")) ||
684 ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
686 //TODO : woohyun jung
694 _deferred_ecore_evas_free(void *data)
696 ecore_evas_free(data);
697 _elm_win_deferred_free--;
701 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
705 if (!win->show_count) win->show_count++;
706 if (win->shot.info) _shot_handle(win);
710 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
716 evas_object_hide(win->frame_obj);
718 else if (win->img_obj)
720 evas_object_hide(win->img_obj);
722 if (win->pointer.obj)
724 evas_object_hide(win->pointer.obj);
725 ecore_evas_hide(win->pointer.ee);
730 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
737 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
740 Evas_Object *child, *child2 = NULL;
745 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
746 _elm_win_obj_callback_parent_del, win);
749 if (win->autodel_clear) *(win->autodel_clear) = -1;
750 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
751 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
754 ecore_evas_callback_delete_request_set(win->ee, NULL);
755 ecore_evas_callback_resize_set(win->ee, NULL);
757 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
758 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
759 if (win->shot.info) eina_stringshare_del(win->shot.info);
760 if (win->shot.timer) ecore_timer_del(win->shot.timer);
761 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
762 _elm_win_obj_callback_del, win);
763 child = evas_object_bottom_get(win->evas);
766 /* if the object we see *IS* the window object (because we are
767 * faking a parent object inside the canvas), then skip it and
768 * go to the next one */
771 child = evas_object_above_get(child);
774 /* if we are using the next object above from the previous loop */
777 /* this object has refcounts from the previous loop */
778 child2 = evas_object_above_get(child);
779 if (child2) evas_object_ref(child2);
780 evas_object_del(child);
781 /* so unref from previous loop */
782 evas_object_unref(child);
787 /* just delete as normal (probably only first object */
788 child2 = evas_object_above_get(child);
789 if (child2) evas_object_ref(child2);
790 evas_object_del(child);
794 #ifdef HAVE_ELEMENTARY_X
795 if (win->client_message_handler)
796 ecore_event_handler_del(win->client_message_handler);
801 if (win->od_mod) free(win->od_mod);
802 ecore_event_handler_del(win->sdb_server_data_handler);
803 ecore_event_handler_del(win->sdb_server_del_handler);
804 ecore_ipc_shutdown();
807 win->sdb_server = NULL;
808 win->sdb_server_data_handler = NULL;
809 win->sdb_server_del_handler = NULL;
812 // FIXME: Why are we flushing edje on every window destroy ??
813 // edje_file_cache_flush();
814 // edje_collection_cache_flush();
815 // evas_image_cache_flush(win->evas);
816 // evas_font_cache_flush(win->evas);
817 // FIXME: we are in the del handler for the object and delete the canvas
818 // that lives under it from the handler... nasty. deferring doesn't help either
822 evas_object_event_callback_del_full
823 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
830 ecore_job_add(_deferred_ecore_evas_free, win->ee);
831 _elm_win_deferred_free++;
835 _elm_win_focus_highlight_shutdown(win);
836 eina_stringshare_del(win->focus_highlight.style);
838 if (win->title) eina_stringshare_del(win->title);
839 if (win->icon_name) eina_stringshare_del(win->icon_name);
840 if (win->role) eina_stringshare_del(win->role);
841 if (win->icon) evas_object_del(win->icon);
843 EINA_LIST_FREE(win->profile.names, str) eina_stringshare_del(str);
844 if (win->profile.name) eina_stringshare_del(win->profile.name);
845 if (win->profile.timer) ecore_timer_del(win->profile.timer);
849 if ((!_elm_win_list) &&
850 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
852 edje_file_cache_flush();
853 edje_collection_cache_flush();
854 evas_image_cache_flush(e);
855 evas_font_cache_flush(e);
862 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
865 if (obj == win->parent) win->parent = NULL;
869 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
875 if ((x != win->screen.x) || (y != win->screen.y))
879 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
884 evas_object_move(obj, x, y);
889 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
892 // this is called to make sure all smart containers have calculated their
893 // sizes BEFORE we show the window to make sure it initially appears at
894 // our desired size (ie min size is known first)
895 evas_smart_objects_calculate(evas_object_evas_get(obj));
898 evas_object_show(win->frame_obj);
900 else if (win->img_obj)
902 evas_object_show(win->img_obj);
904 if (win->pointer.obj)
906 ecore_evas_show(win->pointer.ee);
907 evas_object_show(win->pointer.obj);
908 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
910 evas_object_show(obj);
914 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
918 if (ecore_evas_override_get(win->ee))
922 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
925 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
931 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
935 /* FIXME: We should update ecore_wl_window_location here !! */
937 else if (win->img_obj)
941 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
944 // evas_object_move(win->img_obj, x, y);
949 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
956 else if (win->img_obj)
958 Evas_Coord w = 1, h = 1;
960 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
964 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
970 evas_object_image_size_set(win->img_obj, w, h);
975 _elm_win_delete_request(Ecore_Evas *ee)
977 Evas_Object *obj = ecore_evas_object_associate_get(ee);
979 if (strcmp(elm_widget_type_get(obj), "win")) return;
981 win = elm_widget_data_get(obj);
983 int autodel = win->autodel;
984 win->autodel_clear = &autodel;
985 evas_object_ref(win->win_obj);
986 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
987 // FIXME: if above callback deletes - then the below will be invalid
988 if (autodel) evas_object_del(win->win_obj);
989 else win->autodel_clear = NULL;
990 evas_object_unref(win->win_obj);
994 _elm_win_resize_job(void *data)
1001 win->deferred_resize_job = NULL;
1002 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
1006 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
1012 evas_object_resize(win->frame_obj, w, h);
1014 else if (win->img_obj)
1017 evas_object_resize(win->win_obj, w, h);
1018 EINA_LIST_FOREACH(win->subobjs, l, obj)
1020 evas_object_move(obj, 0, 0);
1021 evas_object_resize(obj, w, h);
1025 #ifdef HAVE_ELEMENTARY_X
1027 _elm_win_xwindow_get(Elm_Win *win)
1031 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
1032 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1034 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
1036 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
1037 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1038 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
1039 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
1040 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
1041 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
1042 ENGINE_COMPARE(ELM_OPENGL_COCOA))
1045 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1047 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
1049 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1051 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
1054 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1056 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
1059 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1061 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
1063 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1065 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
1067 #undef ENGINE_COMPARE
1071 #ifdef HAVE_ELEMENTARY_X
1073 _elm_win_xwin_update(Elm_Win *win)
1077 _elm_win_xwindow_get(win);
1082 win2 = elm_widget_data_get(win->parent);
1086 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
1090 if (!win->xwin) return; /* nothing more to do */
1093 if (!s) s = _elm_appname;
1095 if (win->icon_name) s = win->icon_name;
1096 ecore_x_icccm_icon_name_set(win->xwin, s);
1097 ecore_x_netwm_icon_name_set(win->xwin, s);
1100 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
1107 data = evas_object_image_data_get(win->icon, EINA_FALSE);
1111 int w = 0, h = 0, stride, x, y;
1115 evas_object_image_size_get(win->icon, &w, &h);
1116 stride = evas_object_image_stride_get(win->icon);
1117 if ((w > 0) && (h > 0) &&
1118 (stride >= (int)(w * sizeof(unsigned int))))
1122 ic.data = malloc(w * h * sizeof(unsigned int));
1126 p = (unsigned char *)data;
1127 p2 = (unsigned int *)ic.data;
1128 for (y = 0; y < h; y++)
1130 for (x = 0; x < w; x++)
1132 *p2 = *((unsigned int *)p);
1133 p += sizeof(unsigned int);
1136 p += (stride - (w * sizeof(unsigned int)));
1138 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
1142 evas_object_image_data_set(win->icon, data);
1149 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
1151 case ELM_WIN_DIALOG_BASIC:
1152 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
1154 case ELM_WIN_DESKTOP:
1155 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1158 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
1160 case ELM_WIN_TOOLBAR:
1161 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1164 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1166 case ELM_WIN_UTILITY:
1167 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1169 case ELM_WIN_SPLASH:
1170 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1172 case ELM_WIN_DROPDOWN_MENU:
1173 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1175 case ELM_WIN_POPUP_MENU:
1176 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1178 case ELM_WIN_TOOLTIP:
1179 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1181 case ELM_WIN_NOTIFICATION:
1182 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1185 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1188 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1193 ecore_x_e_virtual_keyboard_state_set
1194 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1195 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
1196 ecore_x_e_illume_indicator_state_set
1197 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1198 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
1199 ecore_x_e_illume_indicator_state_set
1200 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1205 _elm_win_eval_subobjs(Evas_Object *obj)
1208 const Evas_Object *child;
1210 Elm_Win *win = elm_widget_data_get(obj);
1211 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1215 EINA_LIST_FOREACH(win->subobjs, l, child)
1217 evas_object_size_hint_weight_get(child, &wx, &wy);
1218 if (wx == 0.0) xx = 0;
1219 if (wy == 0.0) xy = 0;
1221 evas_object_size_hint_min_get(child, &w, &h);
1224 if (w > minw) minw = w;
1225 if (h > minh) minh = h;
1227 evas_object_size_hint_max_get(child, &w, &h);
1230 if (maxw == -1) maxw = w;
1231 else if ((w > 0) && (w < maxw)) maxw = w;
1232 if (maxh == -1) maxh = h;
1233 else if ((h > 0) && (h < maxh)) maxh = h;
1235 if (!xx) maxw = minw;
1237 if (!xy) maxh = minh;
1239 evas_object_size_hint_min_set(obj, minw, minh);
1240 evas_object_size_hint_max_set(obj, maxw, maxh);
1241 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1242 if (w < minw) w = minw;
1243 if (h < minh) h = minh;
1244 if ((maxw >= 0) && (w > maxw)) w = maxw;
1245 if ((maxh >= 0) && (h > maxh)) h = maxh;
1246 evas_object_resize(obj, w, h);
1250 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1252 Elm_Win *win = elm_widget_data_get(data);
1253 win->subobjs = eina_list_remove(win->subobjs, obj);
1254 _elm_win_eval_subobjs(win->win_obj);
1258 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1260 _elm_win_eval_subobjs(data);
1264 _elm_win_shutdown(void)
1266 while (_elm_win_list)
1267 evas_object_del(_elm_win_list->data);
1271 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1278 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1279 elm_widget_theme(obj);
1283 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1284 elm_widget_theme_specific(obj, th, EINA_FALSE);
1289 _elm_win_translate(void)
1294 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1295 elm_widget_translate(obj);
1300 _elm_win_send_message_to_sdb(Elm_Win *win, char *msg)
1302 if (win->sdb_server && msg)
1303 return ecore_ipc_server_send(win->sdb_server, 0, 0, 0, 0, 0, msg, strlen(msg)+1);
1309 _elm_win_sdb_server_sent(void *data, int type __UNUSED__, void *event)
1311 Elm_Win *win = data;
1312 Ecore_Ipc_Event_Server_Data *e;
1313 e = (Ecore_Ipc_Event_Server_Data *) event;
1315 if (win->sdb_server != e->server) return EINA_FALSE;
1316 if (!win->od_mod) return EINA_FALSE;
1318 Object_Dump_Mod *mod = win->od_mod;
1319 char *msg = strdup((char *)e->data);
1320 const char *command = strtok(msg,"=");
1322 Eina_List *tree = NULL;
1324 if (mod->tree_create)
1325 tree = mod->tree_create(win->win_obj);
1329 if (!strcmp(command, "AT+DUMPWND"))
1331 if (mod->tree_string_get_for_sdb)
1332 text = mod->tree_string_get_for_sdb(tree);
1334 else if (!strcmp(command, "AT+GETPARAM") ||
1335 !strcmp(command, "AT+GETOTEXT") ||
1336 !strcmp(command, "AT+CLRENTRY") ||
1337 !strcmp(command, "AT+SETENTRY"))
1339 if (mod->command_for_sdb)
1340 text = mod->command_for_sdb(tree, e->data);
1343 text = strdup("Invaild Command!!");
1345 _elm_win_send_message_to_sdb(win, text);
1346 if (mod->tree_free) mod->tree_free(tree);
1347 if (text) free(text);
1356 _elm_win_sdb_server_del(void *data, int type __UNUSED__, void *event __UNUSED__)
1358 Elm_Win *win = data;
1360 if (win->od_mod) free(win->od_mod);
1361 ecore_event_handler_del(win->sdb_server_data_handler);
1362 ecore_event_handler_del(win->sdb_server_del_handler);
1363 ecore_ipc_shutdown();
1366 win->sdb_server = NULL;
1367 win->sdb_server_data_handler = NULL;
1368 win->sdb_server_del_handler = NULL;
1373 static Object_Dump_Mod *
1374 _object_dump_mod_init()
1376 Elm_Module *mod = NULL;
1377 mod = _elm_module_find_as("win/api");
1378 if (!mod) return NULL;
1380 mod->api = malloc(sizeof(Object_Dump_Mod));
1381 if (!mod->api) return NULL;
1383 ((Object_Dump_Mod *)(mod->api))->tree_create = _elm_module_symbol_get(mod, "tree_create");
1384 ((Object_Dump_Mod *)(mod->api))->tree_free = _elm_module_symbol_get(mod, "tree_free");
1385 ((Object_Dump_Mod *)(mod->api))->tree_string_get = _elm_module_symbol_get(mod, "tree_string_get");
1386 ((Object_Dump_Mod *)(mod->api))->tree_string_get_for_sdb = _elm_module_symbol_get(mod, "tree_string_get_for_sdb");
1387 ((Object_Dump_Mod *)(mod->api))->command_for_sdb = _elm_module_symbol_get(mod, "command_for_sdb");
1393 #ifdef HAVE_ELEMENTARY_X
1395 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1397 Elm_Win *win = data;
1398 Ecore_X_Event_Client_Message *e = event;
1400 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1401 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1403 if ((unsigned)e->data.l[0] == win->xwin)
1405 Evas *evas = evas_object_evas_get(win->win_obj);
1408 edje_file_cache_flush();
1409 edje_collection_cache_flush();
1410 evas_image_cache_flush(evas);
1411 evas_font_cache_flush(evas);
1415 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1417 if ((unsigned)e->data.l[0] == win->xwin)
1419 Evas *evas = evas_object_evas_get(win->win_obj);
1422 edje_file_cache_flush();
1423 edje_collection_cache_flush();
1424 evas_image_cache_flush(evas);
1425 evas_font_cache_flush(evas);
1426 evas_render_dump(evas);
1431 else if (e->message_type == ECORE_X_ATOM_SDB_SERVER_CONNECT)
1433 if ((unsigned)e->data.l[0] == win->xwin)
1436 win->od_mod = _object_dump_mod_init();
1438 win->sdb_server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_SYSTEM, "sdb", 0, NULL);
1439 win->sdb_server_data_handler = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, _elm_win_sdb_server_sent, win);
1440 win->sdb_server_del_handler = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, _elm_win_sdb_server_del, win);
1443 else if (e->message_type == ECORE_X_ATOM_SDB_SERVER_DISCONNECT)
1445 if ((unsigned)e->data.l[0] == win->xwin)
1447 if (win->od_mod) free(win->od_mod);
1448 ecore_event_handler_del(win->sdb_server_data_handler);
1449 ecore_event_handler_del(win->sdb_server_del_handler);
1450 ecore_ipc_shutdown();
1453 win->sdb_server = NULL;
1454 win->sdb_server_data_handler = NULL;
1455 win->sdb_server_del_handler = NULL;
1459 return ECORE_CALLBACK_PASS_ON;
1464 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1466 Elm_Win *win = data;
1468 win->focus_highlight.geometry_changed = EINA_TRUE;
1469 _elm_win_focus_highlight_reconfigure_job_start(win);
1473 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1475 Elm_Win *win = data;
1477 win->focus_highlight.geometry_changed = EINA_TRUE;
1478 _elm_win_focus_highlight_reconfigure_job_start(win);
1482 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1484 Elm_Win *win = data;
1486 win->focus_highlight.cur.target = NULL;
1488 _elm_win_focus_highlight_reconfigure_job_start(win);
1492 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1494 Evas_Object *obj = win->focus_highlight.cur.target;
1496 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1497 _elm_win_focus_target_move, win);
1498 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1499 _elm_win_focus_target_resize, win);
1500 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1501 _elm_win_focus_target_del, win);
1505 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1507 Evas_Object *obj = win->focus_highlight.cur.target;
1509 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1510 _elm_win_focus_target_move, win);
1511 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1512 _elm_win_focus_target_resize, win);
1513 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1514 _elm_win_focus_target_del, win);
1517 static Evas_Object *
1518 _elm_win_focus_target_get(Evas_Object *obj)
1520 Evas_Object *o = obj;
1524 if (elm_widget_is(o))
1526 if (!elm_widget_highlight_ignore_get(o))
1528 o = elm_widget_parent_get(o);
1530 o = evas_object_smart_parent_get(o);
1534 o = elm_widget_parent_widget_get(o);
1536 o = evas_object_smart_parent_get(o);
1545 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1547 Evas_Object *obj = event_info, *target;
1548 Elm_Win *win = data;
1550 if (win->focus_highlight.cur.target == obj)
1553 target = _elm_win_focus_target_get(obj);
1554 win->focus_highlight.cur.target = target;
1555 if (elm_widget_highlight_in_theme_get(target))
1556 win->focus_highlight.cur.handled = EINA_TRUE;
1558 _elm_win_focus_target_callbacks_add(win);
1560 _elm_win_focus_highlight_reconfigure_job_start(win);
1564 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1566 Elm_Win *win = data;
1568 if (!win->focus_highlight.cur.target)
1571 if (!win->focus_highlight.cur.handled)
1572 _elm_win_focus_target_callbacks_del(win);
1573 win->focus_highlight.cur.target = NULL;
1574 win->focus_highlight.cur.handled = EINA_FALSE;
1576 _elm_win_focus_highlight_reconfigure_job_start(win);
1580 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1582 evas_object_hide(obj);
1586 _elm_win_focus_highlight_init(Elm_Win *win)
1588 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1589 _elm_win_object_focus_in, win);
1590 evas_event_callback_add(win->evas,
1591 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1592 _elm_win_object_focus_out, win);
1594 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1596 win->focus_highlight.top = edje_object_add(win->evas);
1597 win->focus_highlight.changed_theme = EINA_TRUE;
1598 edje_object_signal_callback_add(win->focus_highlight.top,
1599 "elm,action,focus,hide,end", "",
1600 _elm_win_focus_highlight_hide, NULL);
1601 edje_object_signal_callback_add(win->focus_highlight.top,
1602 "elm,action,focus,anim,end", "",
1603 _elm_win_focus_highlight_anim_end, win);
1604 _elm_win_focus_highlight_reconfigure_job_start(win);
1608 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1610 _elm_win_focus_highlight_reconfigure_job_stop(win);
1611 if (win->focus_highlight.cur.target)
1613 _elm_win_focus_target_callbacks_del(win);
1614 win->focus_highlight.cur.target = NULL;
1616 if (win->focus_highlight.top)
1618 evas_object_del(win->focus_highlight.top);
1619 win->focus_highlight.top = NULL;
1622 evas_event_callback_del_full(win->evas,
1623 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1624 _elm_win_object_focus_in, win);
1625 evas_event_callback_del_full(win->evas,
1626 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1627 _elm_win_object_focus_out, win);
1631 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1635 top = win->focus_highlight.top;
1640 evas_object_show(top);
1641 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1647 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1652 _elm_win_focus_highlight_reconfigure_job(void *data)
1654 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1658 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1660 if (win->focus_highlight.reconf_job)
1661 ecore_job_del(win->focus_highlight.reconf_job);
1662 win->focus_highlight.reconf_job = ecore_job_add(
1663 _elm_win_focus_highlight_reconfigure_job, win);
1667 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1669 if (win->focus_highlight.reconf_job)
1670 ecore_job_del(win->focus_highlight.reconf_job);
1671 win->focus_highlight.reconf_job = NULL;
1675 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1677 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1678 Evas_Coord x, y, w, h;
1680 clip = evas_object_clip_get(target);
1681 evas_object_geometry_get(target, &x, &y, &w, &h);
1683 evas_object_move(obj, x, y);
1684 evas_object_resize(obj, w, h);
1685 evas_object_clip_set(obj, clip);
1689 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1691 Evas_Coord tx, ty, tw, th;
1692 Evas_Coord w, h, px, py, pw, ph;
1693 Edje_Message_Int_Set *m;
1694 Evas_Object *previous = win->focus_highlight.prev.target;
1695 Evas_Object *target = win->focus_highlight.cur.target;
1697 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1698 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1699 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1700 evas_object_move(obj, 0, 0);
1701 evas_object_resize(obj, tw, th);
1702 evas_object_clip_unset(obj);
1704 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1714 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1718 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1720 Elm_Win *win = data;
1721 _elm_win_focus_highlight_simple_setup(win, obj);
1725 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1727 Evas_Object *target = win->focus_highlight.cur.target;
1728 Evas_Object *previous = win->focus_highlight.prev.target;
1729 Evas_Object *top = win->focus_highlight.top;
1730 Eina_Bool visible_changed;
1731 Eina_Bool common_visible;
1732 const char *sig = NULL;
1734 _elm_win_focus_highlight_reconfigure_job_stop(win);
1736 visible_changed = (win->focus_highlight.cur.visible !=
1737 win->focus_highlight.prev.visible);
1739 if ((target == previous) && (!visible_changed) &&
1740 (!win->focus_highlight.geometry_changed))
1743 if ((previous) && (win->focus_highlight.prev.handled))
1744 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1747 common_visible = EINA_FALSE;
1748 else if (win->focus_highlight.cur.handled)
1750 common_visible = EINA_FALSE;
1751 if (win->focus_highlight.cur.visible)
1752 sig = "elm,action,focus_highlight,show";
1754 sig = "elm,action,focus_highlight,hide";
1757 common_visible = win->focus_highlight.cur.visible;
1759 _elm_win_focus_highlight_visible_set(win, common_visible);
1761 elm_widget_signal_emit(target, sig, "elm");
1763 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1766 if (win->focus_highlight.changed_theme)
1769 if (win->focus_highlight.style)
1770 str = win->focus_highlight.style;
1773 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1775 win->focus_highlight.changed_theme = EINA_FALSE;
1777 if (_elm_config->focus_highlight_animate)
1779 str = edje_object_data_get(win->focus_highlight.top, "animate");
1780 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1784 if ((win->focus_highlight.top_animate) && (previous) &&
1785 (!win->focus_highlight.prev.handled))
1786 _elm_win_focus_highlight_anim_setup(win, top);
1788 _elm_win_focus_highlight_simple_setup(win, top);
1789 evas_object_raise(top);
1792 win->focus_highlight.geometry_changed = EINA_FALSE;
1793 win->focus_highlight.prev = win->focus_highlight.cur;
1797 _elm_win_frame_add(Elm_Win *win, const char *style)
1799 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1801 win->frame_obj = edje_object_add(win->evas);
1802 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1803 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1804 evas_object_move(win->frame_obj, 0, 0);
1805 evas_object_resize(win->frame_obj, 1, 1);
1807 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1808 "elm", _elm_win_frame_cb_move_start, win);
1809 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1810 "*", _elm_win_frame_cb_resize_start, win);
1811 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1812 "elm", _elm_win_frame_cb_minimize, win);
1813 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1814 "elm", _elm_win_frame_cb_maximize, win);
1815 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1816 "elm", _elm_win_frame_cb_close, win);
1820 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1824 if (!(win = data)) return;
1825 /* FIXME: Change mouse pointer */
1827 /* NB: Wayland handles moving surfaces by itself so we cannot
1828 * specify a specific x/y we want. Instead, we will pass in the
1829 * existing x/y values so they can be recorded as 'previous' position.
1830 * The new position will get updated automatically when the move is
1833 ecore_evas_wayland_move(win->ee, win->screen.x, win->screen.y);
1837 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1841 if (!(win = data)) return;
1842 if (win->resizing) return;
1843 win->resizing = EINA_TRUE;
1845 /* FIXME: Change mouse pointer */
1847 if (!strcmp(source, "elm.event.resize.t"))
1848 win->resize_location = 1;
1849 else if (!strcmp(source, "elm.event.resize.b"))
1850 win->resize_location = 2;
1851 else if (!strcmp(source, "elm.event.resize.l"))
1852 win->resize_location = 4;
1853 else if (!strcmp(source, "elm.event.resize.r"))
1854 win->resize_location = 8;
1855 else if (!strcmp(source, "elm.event.resize.tl"))
1856 win->resize_location = 5;
1857 else if (!strcmp(source, "elm.event.resize.tr"))
1858 win->resize_location = 9;
1859 else if (!strcmp(source, "elm.event.resize.bl"))
1860 win->resize_location = 6;
1861 else if (!strcmp(source, "elm.event.resize.br"))
1862 win->resize_location = 10;
1864 win->resize_location = 0;
1866 if (win->resize_location > 0)
1867 ecore_evas_wayland_resize(win->ee, win->resize_location);
1871 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1875 if (!(win = data)) return;
1876 win->iconified = EINA_TRUE;
1877 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1881 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1885 if (!(win = data)) return;
1886 if (win->maximized) win->maximized = EINA_FALSE;
1887 else win->maximized = EINA_TRUE;
1888 ecore_evas_maximized_set(win->ee, win->maximized);
1892 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1896 if (!(win = data)) return;
1897 evas_object_del(win->win_obj);
1902 _elm_win_pointer_add(Elm_Win *win, const char *style)
1908 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1909 ecore_evas_resize(win->pointer.ee, 32, 32);
1911 win->pointer.evas = ecore_evas_get(win->ee);
1913 win->pointer.obj = edje_object_add(win->pointer.evas);
1914 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1915 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1916 evas_object_move(win->pointer.obj, 0, 0);
1917 evas_object_resize(win->pointer.obj, 32, 32);
1918 evas_object_show(win->pointer.obj);
1924 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1926 Evas_Event_Key_Down *ev = event_info;
1928 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1931 if ((strcmp(ev->keyname, "F12")) ||
1932 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1935 printf("Tree graph generated.\n");
1936 elm_object_tree_dot_dump(obj, "./dump.dot");
1941 _win_img_hide(void *data,
1943 Evas_Object *obj __UNUSED__,
1944 void *event_info __UNUSED__)
1946 Elm_Win *win = data;
1948 elm_widget_focus_hide_handle(win->win_obj);
1952 _win_img_mouse_up(void *data,
1954 Evas_Object *obj __UNUSED__,
1957 Elm_Win *win = data;
1958 Evas_Event_Mouse_Up *ev = event_info;
1959 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1960 elm_widget_focus_mouse_up_handle(win->win_obj);
1964 _win_img_focus_in(void *data,
1966 Evas_Object *obj __UNUSED__,
1967 void *event_info __UNUSED__)
1969 Elm_Win *win = data;
1970 elm_widget_focus_steal(win->win_obj);
1974 _win_img_focus_out(void *data,
1976 Evas_Object *obj __UNUSED__,
1977 void *event_info __UNUSED__)
1979 Elm_Win *win = data;
1980 elm_widget_focused_object_clear(win->win_obj);
1984 _win_inlined_image_set(Elm_Win *win)
1986 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1987 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1988 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1989 _elm_win_obj_callback_img_obj_del, win);
1991 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1992 _win_img_hide, win);
1993 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1994 _win_img_mouse_up, win);
1995 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1996 _win_img_focus_in, win);
1997 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1998 _win_img_focus_out, win);
2002 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
2004 evas_object_event_callback_del_full(subobj,
2005 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2006 _elm_win_subobj_callback_changed_size_hints,
2008 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2009 _elm_win_subobj_callback_del, obj);
2010 win->subobjs = eina_list_remove(win->subobjs, subobj);
2011 _elm_win_eval_subobjs(obj);
2015 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
2017 Elm_Win *win = data;
2018 if (win->icon == obj) win->icon = NULL;
2022 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
2026 const char *fontpath;
2028 win = ELM_NEW(Elm_Win);
2030 #define FALLBACK_TRY(engine) \
2033 CRITICAL(engine " engine creation failed. Trying default."); \
2034 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
2036 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
2038 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
2040 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
2041 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
2045 case ELM_WIN_INLINED_IMAGE:
2048 Evas *e = evas_object_evas_get(parent);
2051 ee = ecore_evas_ecore_evas_get(e);
2053 win->img_obj = ecore_evas_object_image_new(ee);
2054 if (!win->img_obj) break;
2055 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
2058 _win_inlined_image_set(win);
2061 evas_object_del(win->img_obj);
2062 win->img_obj = NULL;
2066 case ELM_WIN_SOCKET_IMAGE:
2067 win->ee = ecore_evas_extn_socket_new(1, 1);
2071 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
2073 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2074 #ifdef HAVE_ELEMENTARY_X
2075 win->client_message_handler = ecore_event_handler_add
2076 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2078 FALLBACK_TRY("Sofware X11");
2080 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2082 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2083 FALLBACK_TRY("Sofware FB");
2085 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
2087 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
2088 FALLBACK_TRY("Sofware DirectFB");
2090 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
2092 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
2093 FALLBACK_TRY("Sofware-16");
2094 #ifdef HAVE_ELEMENTARY_X
2095 win->client_message_handler = ecore_event_handler_add
2096 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2099 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
2101 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
2102 FALLBACK_TRY("Sofware-8");
2103 #ifdef HAVE_ELEMENTARY_X
2104 win->client_message_handler = ecore_event_handler_add
2105 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2109 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
2111 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
2112 FALLBACK_TRY("XRender");
2113 #ifdef HAVE_ELEMENTARY_X
2114 win->client_message_handler = ecore_event_handler_add
2115 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2119 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
2124 if (_elm_config->vsync)
2126 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
2132 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
2134 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
2135 FALLBACK_TRY("OpenGL");
2136 #ifdef HAVE_ELEMENTARY_X
2137 win->client_message_handler = ecore_event_handler_add
2138 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2141 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
2143 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
2144 FALLBACK_TRY("Sofware Win32");
2146 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2148 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
2149 FALLBACK_TRY("Sofware-16-WinCE");
2151 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
2153 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
2154 FALLBACK_TRY("PSL1GHT");
2156 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
2158 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
2159 FALLBACK_TRY("Sofware SDL");
2161 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
2163 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
2164 FALLBACK_TRY("Sofware-16-SDL");
2166 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
2168 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
2169 FALLBACK_TRY("OpenGL SDL");
2171 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
2173 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
2174 FALLBACK_TRY("OpenGL Cocoa");
2176 else if (ENGINE_COMPARE(ELM_BUFFER))
2178 win->ee = ecore_evas_buffer_new(1, 1);
2180 else if (ENGINE_COMPARE(ELM_EWS))
2182 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
2184 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
2186 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
2187 win->evas = ecore_evas_get(win->ee);
2189 _elm_win_frame_add(win, "default");
2190 // _elm_win_pointer_add(win, "default");
2192 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
2194 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
2195 win->evas = ecore_evas_get(win->ee);
2197 _elm_win_frame_add(win, "default");
2198 // _elm_win_pointer_add(win, "default");
2200 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
2202 win->ee = ecore_evas_buffer_new(1, 1);
2203 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
2204 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
2213 ERR("Cannot create window.");
2217 #ifdef HAVE_ELEMENTARY_X
2218 _elm_win_xwindow_get(win);
2220 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
2221 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
2222 // bg pixmap done by x - has other issues like can be redrawn by x before it
2223 // is filled/ready by app
2224 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
2227 win->parent = parent;
2229 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
2230 _elm_win_obj_callback_parent_del, win);
2232 win->evas = ecore_evas_get(win->ee);
2233 win->win_obj = elm_widget_add(win->evas);
2234 elm_widget_type_set(win->win_obj, "win");
2235 ELM_SET_WIDTYPE(widtype, "win");
2236 elm_widget_data_set(win->win_obj, win);
2237 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
2238 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
2239 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
2240 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
2241 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
2242 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
2243 evas_object_move(win->win_obj, 0, 0);
2244 evas_object_resize(win->win_obj, 1, 1);
2245 evas_object_layer_set(win->win_obj, 50);
2246 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
2250 evas_object_clip_set(win->win_obj, win->frame_obj);
2251 evas_object_stack_below(win->frame_obj, win->win_obj);
2254 if (type == ELM_WIN_INLINED_IMAGE)
2255 elm_widget_parent2_set(win->win_obj, parent);
2256 ecore_evas_object_associate(win->ee, win->win_obj,
2257 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
2258 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
2259 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
2260 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
2261 _elm_win_obj_callback_show, win);
2262 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
2263 _elm_win_obj_callback_hide, win);
2264 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
2265 _elm_win_obj_callback_del, win);
2266 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
2267 _elm_win_obj_callback_move, win);
2268 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
2269 _elm_win_obj_callback_resize, win);
2271 evas_object_intercept_move_callback_add(win->win_obj,
2272 _elm_win_obj_intercept_move, win);
2273 evas_object_intercept_show_callback_add(win->win_obj,
2274 _elm_win_obj_intercept_show, win);
2276 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
2277 ecore_evas_name_class_set(win->ee, name, _elm_appname);
2278 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
2279 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
2280 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
2281 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
2282 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
2283 ecore_evas_callback_move_set(win->ee, _elm_win_move);
2284 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
2285 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
2286 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
2287 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2288 evas_font_path_append(win->evas, fontpath);
2289 if (!_elm_config->font_hinting)
2290 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2291 else if (_elm_config->font_hinting == 1)
2292 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2293 else if (_elm_config->font_hinting == 2)
2294 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2296 #ifdef HAVE_ELEMENTARY_X
2297 _elm_win_xwin_update(win);
2300 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2302 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2304 ecore_evas_fullscreen_set(win->ee, 1);
2306 #undef ENGINE_COMPARE
2308 if (_elm_config->focus_highlight_enable)
2309 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2312 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2313 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2314 _debug_key_down, win);
2316 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2318 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2321 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2323 return win->win_obj;
2327 elm_win_util_standard_add(const char *name, const char *title)
2329 Evas_Object *win, *bg;
2331 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2332 if (!win) return NULL;
2333 elm_win_title_set(win, title);
2334 bg = elm_bg_add(win);
2337 evas_object_del(win);
2340 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2341 elm_win_resize_object_add(win, bg);
2342 evas_object_show(bg);
2347 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2351 ELM_CHECK_WIDTYPE(obj, widtype);
2352 win = elm_widget_data_get(obj);
2354 if (eina_list_data_find(win->subobjs, subobj)) return;
2355 win->subobjs = eina_list_append(win->subobjs, subobj);
2356 elm_widget_sub_object_add(obj, subobj);
2357 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2358 _elm_win_subobj_callback_del, obj);
2359 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2360 _elm_win_subobj_callback_changed_size_hints,
2362 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2363 evas_object_move(subobj, 0, 0);
2364 evas_object_resize(subobj, w, h);
2365 _elm_win_eval_subobjs(obj);
2369 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2372 ELM_CHECK_WIDTYPE(obj, widtype);
2373 win = elm_widget_data_get(obj);
2375 evas_object_event_callback_del_full(subobj,
2376 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2377 _elm_win_subobj_callback_changed_size_hints,
2379 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2380 _elm_win_subobj_callback_del, obj);
2381 win->subobjs = eina_list_remove(win->subobjs, subobj);
2382 elm_widget_sub_object_del(obj, subobj);
2383 _elm_win_eval_subobjs(obj);
2387 elm_win_title_set(Evas_Object *obj, const char *title)
2390 ELM_CHECK_WIDTYPE(obj, widtype);
2391 win = elm_widget_data_get(obj);
2392 if (!win || !title) return;
2393 eina_stringshare_replace(&(win->title), title);
2394 ecore_evas_title_set(win->ee, win->title);
2396 edje_object_part_text_escaped_set(win->frame_obj, "elm.text.title", win->title);
2400 elm_win_title_get(const Evas_Object *obj)
2403 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2404 win = elm_widget_data_get(obj);
2405 if (!win) return NULL;
2410 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2413 ELM_CHECK_WIDTYPE(obj, widtype);
2414 win = elm_widget_data_get(obj);
2415 if (!win || !icon_name) return;
2416 eina_stringshare_replace(&(win->icon_name), icon_name);
2417 #ifdef HAVE_ELEMENTARY_X
2418 _elm_win_xwin_update(win);
2423 elm_win_icon_name_get(const Evas_Object *obj)
2426 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2427 win = elm_widget_data_get(obj);
2428 if (!win) return NULL;
2429 return win->icon_name;
2433 elm_win_role_set(Evas_Object *obj, const char *role)
2436 ELM_CHECK_WIDTYPE(obj, widtype);
2437 win = elm_widget_data_get(obj);
2438 if (!win || !role) return;
2439 eina_stringshare_replace(&(win->role), role);
2440 #ifdef HAVE_ELEMENTARY_X
2441 _elm_win_xwin_update(win);
2446 elm_win_role_get(const Evas_Object *obj)
2449 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2450 win = elm_widget_data_get(obj);
2451 if (!win) return NULL;
2456 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2459 ELM_CHECK_WIDTYPE(obj, widtype);
2460 win = elm_widget_data_get(obj);
2463 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2464 _elm_win_obj_icon_callback_del, win);
2467 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2468 _elm_win_obj_icon_callback_del, win);
2469 #ifdef HAVE_ELEMENTARY_X
2470 _elm_win_xwin_update(win);
2474 EAPI const Evas_Object *
2475 elm_win_icon_object_get(const Evas_Object *obj)
2478 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2479 win = elm_widget_data_get(obj);
2480 if (!win) return NULL;
2485 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2488 ELM_CHECK_WIDTYPE(obj, widtype);
2489 win = elm_widget_data_get(obj);
2491 win->autodel = autodel;
2495 elm_win_autodel_get(const Evas_Object *obj)
2498 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2499 win = elm_widget_data_get(obj);
2500 if (!win) return EINA_FALSE;
2501 return win->autodel;
2505 elm_win_activate(Evas_Object *obj)
2508 ELM_CHECK_WIDTYPE(obj, widtype);
2509 win = elm_widget_data_get(obj);
2511 ecore_evas_activate(win->ee);
2515 elm_win_lower(Evas_Object *obj)
2518 ELM_CHECK_WIDTYPE(obj, widtype);
2519 win = elm_widget_data_get(obj);
2521 ecore_evas_lower(win->ee);
2525 elm_win_raise(Evas_Object *obj)
2528 ELM_CHECK_WIDTYPE(obj, widtype);
2529 win = elm_widget_data_get(obj);
2531 ecore_evas_raise(win->ee);
2535 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2538 int win_w, win_h, screen_w, screen_h, nx, ny;
2539 ELM_CHECK_WIDTYPE(obj, widtype);
2540 win = elm_widget_data_get(obj);
2542 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2543 if ((!screen_w) || (!screen_h)) return;
2544 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2545 if ((!win_w) || (!win_h)) return;
2546 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2547 else nx = win->screen.x;
2548 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2549 else ny = win->screen.y;
2552 evas_object_move(obj, nx, ny);
2556 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2559 ELM_CHECK_WIDTYPE(obj, widtype);
2560 win = elm_widget_data_get(obj);
2562 ecore_evas_borderless_set(win->ee, borderless);
2563 #ifdef HAVE_ELEMENTARY_X
2564 _elm_win_xwin_update(win);
2569 elm_win_borderless_get(const Evas_Object *obj)
2572 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2573 win = elm_widget_data_get(obj);
2574 if (!win) return EINA_FALSE;
2575 return ecore_evas_borderless_get(win->ee);
2579 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2582 ELM_CHECK_WIDTYPE(obj, widtype);
2583 win = elm_widget_data_get(obj);
2585 ecore_evas_shaped_set(win->ee, shaped);
2586 #ifdef HAVE_ELEMENTARY_X
2587 _elm_win_xwin_update(win);
2592 elm_win_shaped_get(const Evas_Object *obj)
2595 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2596 win = elm_widget_data_get(obj);
2597 if (!win) return EINA_FALSE;
2598 return ecore_evas_shaped_get(win->ee);
2602 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2605 ELM_CHECK_WIDTYPE(obj, widtype);
2606 win = elm_widget_data_get(obj);
2611 else if (win->img_obj)
2613 evas_object_image_alpha_set(win->img_obj, alpha);
2614 ecore_evas_alpha_set(win->ee, alpha);
2618 #ifdef HAVE_ELEMENTARY_X
2623 if (!_elm_config->compositing)
2624 elm_win_shaped_set(obj, alpha);
2626 ecore_evas_alpha_set(win->ee, alpha);
2629 ecore_evas_alpha_set(win->ee, alpha);
2630 _elm_win_xwin_update(win);
2634 ecore_evas_alpha_set(win->ee, alpha);
2639 elm_win_alpha_get(const Evas_Object *obj)
2642 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2643 win = elm_widget_data_get(obj);
2644 if (!win) return EINA_FALSE;
2648 else if (win->img_obj)
2650 return evas_object_image_alpha_get(win->img_obj);
2652 return ecore_evas_alpha_get(win->ee);
2656 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2659 ELM_CHECK_WIDTYPE(obj, widtype);
2660 win = elm_widget_data_get(obj);
2662 ecore_evas_override_set(win->ee, override);
2663 #ifdef HAVE_ELEMENTARY_X
2664 _elm_win_xwin_update(win);
2669 elm_win_override_get(const Evas_Object *obj)
2672 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2673 win = elm_widget_data_get(obj);
2674 if (!win) return EINA_FALSE;
2675 return ecore_evas_override_get(win->ee);
2679 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2682 ELM_CHECK_WIDTYPE(obj, widtype);
2683 win = elm_widget_data_get(obj);
2685 // YYY: handle if win->img_obj
2686 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2687 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2688 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2690 // these engines... can ONLY be fullscreen
2695 win->fullscreen = fullscreen;
2696 ecore_evas_fullscreen_set(win->ee, fullscreen);
2697 #ifdef HAVE_ELEMENTARY_X
2698 _elm_win_xwin_update(win);
2701 #undef ENGINE_COMPARE
2705 elm_win_fullscreen_get(const Evas_Object *obj)
2708 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2709 win = elm_widget_data_get(obj);
2710 if (!win) return EINA_FALSE;
2711 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2712 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2713 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2715 // these engines... can ONLY be fullscreen
2720 return win->fullscreen;
2722 #undef ENGINE_COMPARE
2726 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2729 ELM_CHECK_WIDTYPE(obj, widtype);
2730 win = elm_widget_data_get(obj);
2732 win->maximized = maximized;
2733 // YYY: handle if win->img_obj
2734 ecore_evas_maximized_set(win->ee, maximized);
2735 #ifdef HAVE_ELEMENTARY_X
2736 _elm_win_xwin_update(win);
2741 elm_win_maximized_get(const Evas_Object *obj)
2744 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2745 win = elm_widget_data_get(obj);
2746 if (!win) return EINA_FALSE;
2747 return win->maximized;
2751 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2754 ELM_CHECK_WIDTYPE(obj, widtype);
2755 win = elm_widget_data_get(obj);
2757 win->iconified = iconified;
2758 ecore_evas_iconified_set(win->ee, iconified);
2759 #ifdef HAVE_ELEMENTARY_X
2760 _elm_win_xwin_update(win);
2765 elm_win_iconified_get(const Evas_Object *obj)
2768 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2769 win = elm_widget_data_get(obj);
2770 if (!win) return EINA_FALSE;
2771 return win->iconified;
2775 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2778 ELM_CHECK_WIDTYPE(obj, widtype);
2779 win = elm_widget_data_get(obj);
2781 win->withdrawn = withdrawn;
2782 ecore_evas_withdrawn_set(win->ee, withdrawn);
2783 #ifdef HAVE_ELEMENTARY_X
2784 _elm_win_xwin_update(win);
2789 elm_win_withdrawn_get(const Evas_Object *obj)
2792 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2793 win = elm_widget_data_get(obj);
2794 if (!win) return EINA_FALSE;
2795 return win->withdrawn;
2799 elm_win_profiles_set(Evas_Object *obj, const char **profiles, unsigned int num_profiles)
2802 char **profiles_int;
2804 unsigned int i, num;
2807 ELM_CHECK_WIDTYPE(obj, widtype);
2808 win = elm_widget_data_get(obj);
2810 if (!profiles) return;
2812 if (win->profile.timer) ecore_timer_del(win->profile.timer);
2813 win->profile.timer = ecore_timer_add(0.1, _elm_win_profile_change_delay, win);
2814 EINA_LIST_FREE(win->profile.names, str) eina_stringshare_del(str);
2816 for (i = 0; i < num_profiles; i++)
2818 if ((profiles[i]) &&
2819 _elm_config_profile_exists(profiles[i]))
2821 str = eina_stringshare_add(profiles[i]);
2822 win->profile.names = eina_list_append(win->profile.names, str);
2826 num = eina_list_count(win->profile.names);
2827 profiles_int = alloca(num * sizeof(char *));
2832 EINA_LIST_FOREACH(win->profile.names, l, str)
2835 profiles_int[i] = strdup(str);
2837 profiles_int[i] = NULL;
2840 ecore_evas_profiles_set(win->ee, (const char **)profiles_int, i);
2841 for (i = 0; i < num; i++)
2843 if (profiles_int[i]) free(profiles_int[i]);
2847 ecore_evas_profiles_set(win->ee, profiles, num_profiles);
2851 elm_win_profile_get(const Evas_Object *obj)
2854 ELM_CHECK_WIDTYPE(obj, widtype);
2855 win = elm_widget_data_get(obj);
2856 if (!win) return NULL;
2858 return win->profile.name;
2862 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2865 ELM_CHECK_WIDTYPE(obj, widtype);
2866 win = elm_widget_data_get(obj);
2868 win->urgent = urgent;
2869 ecore_evas_urgent_set(win->ee, urgent);
2870 #ifdef HAVE_ELEMENTARY_X
2871 _elm_win_xwin_update(win);
2876 elm_win_urgent_get(const Evas_Object *obj)
2879 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2880 win = elm_widget_data_get(obj);
2881 if (!win) return EINA_FALSE;
2886 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2889 ELM_CHECK_WIDTYPE(obj, widtype);
2890 win = elm_widget_data_get(obj);
2892 win->demand_attention = demand_attention;
2893 ecore_evas_demand_attention_set(win->ee, demand_attention);
2894 #ifdef HAVE_ELEMENTARY_X
2895 _elm_win_xwin_update(win);
2900 elm_win_demand_attention_get(const Evas_Object *obj)
2903 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2904 win = elm_widget_data_get(obj);
2905 if (!win) return EINA_FALSE;
2906 return win->demand_attention;
2910 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2913 ELM_CHECK_WIDTYPE(obj, widtype);
2914 win = elm_widget_data_get(obj);
2917 ecore_evas_modal_set(win->ee, modal);
2918 #ifdef HAVE_ELEMENTARY_X
2919 _elm_win_xwin_update(win);
2924 elm_win_modal_get(const Evas_Object *obj)
2927 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2928 win = elm_widget_data_get(obj);
2929 if (!win) return EINA_FALSE;
2934 elm_win_aspect_set(Evas_Object *obj, double aspect)
2937 ELM_CHECK_WIDTYPE(obj, widtype);
2938 win = elm_widget_data_get(obj);
2940 win->aspect = aspect;
2941 ecore_evas_aspect_set(win->ee, aspect);
2942 #ifdef HAVE_ELEMENTARY_X
2943 _elm_win_xwin_update(win);
2948 elm_win_aspect_get(const Evas_Object *obj)
2951 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2952 win = elm_widget_data_get(obj);
2953 if (!win) return EINA_FALSE;
2958 elm_win_layer_set(Evas_Object *obj, int layer)
2961 ELM_CHECK_WIDTYPE(obj, widtype);
2962 win = elm_widget_data_get(obj);
2964 ecore_evas_layer_set(win->ee, layer);
2965 #ifdef HAVE_ELEMENTARY_X
2966 _elm_win_xwin_update(win);
2971 elm_win_layer_get(const Evas_Object *obj)
2974 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2975 win = elm_widget_data_get(obj);
2976 if (!win) return -1;
2977 return ecore_evas_layer_get(win->ee);
2981 elm_win_rotation_set(Evas_Object *obj, int rotation)
2984 ELM_CHECK_WIDTYPE(obj, widtype);
2985 win = elm_widget_data_get(obj);
2987 if (win->rot == rotation) return;
2988 win->rot = rotation;
2989 ecore_evas_rotation_set(win->ee, rotation);
2990 evas_object_size_hint_min_set(obj, -1, -1);
2991 evas_object_size_hint_max_set(obj, -1, -1);
2992 _elm_win_eval_subobjs(obj);
2993 #ifdef HAVE_ELEMENTARY_X
2994 _elm_win_xwin_update(win);
2999 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
3002 ELM_CHECK_WIDTYPE(obj, widtype);
3003 win = elm_widget_data_get(obj);
3005 if (win->rot == rotation) return;
3006 win->rot = rotation;
3007 ecore_evas_rotation_with_resize_set(win->ee, rotation);
3008 evas_object_size_hint_min_set(obj, -1, -1);
3009 evas_object_size_hint_max_set(obj, -1, -1);
3010 _elm_win_eval_subobjs(obj);
3011 #ifdef HAVE_ELEMENTARY_X
3012 _elm_win_xwin_update(win);
3017 elm_win_rotation_get(const Evas_Object *obj)
3020 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3021 win = elm_widget_data_get(obj);
3022 if (!win) return -1;
3027 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
3030 ELM_CHECK_WIDTYPE(obj, widtype);
3031 win = elm_widget_data_get(obj);
3033 win->sticky = sticky;
3034 ecore_evas_sticky_set(win->ee, sticky);
3035 #ifdef HAVE_ELEMENTARY_X
3036 _elm_win_xwin_update(win);
3041 elm_win_sticky_get(const Evas_Object *obj)
3044 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3045 win = elm_widget_data_get(obj);
3046 if (!win) return EINA_FALSE;
3051 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
3054 ELM_CHECK_WIDTYPE(obj, widtype);
3055 win = elm_widget_data_get(obj);
3057 if (mode == win->kbdmode) return;
3058 #ifdef HAVE_ELEMENTARY_X
3059 _elm_win_xwindow_get(win);
3061 win->kbdmode = mode;
3062 #ifdef HAVE_ELEMENTARY_X
3064 ecore_x_e_virtual_keyboard_state_set
3065 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
3069 EAPI Elm_Win_Keyboard_Mode
3070 elm_win_keyboard_mode_get(const Evas_Object *obj)
3073 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
3074 win = elm_widget_data_get(obj);
3075 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
3076 return win->kbdmode;
3080 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
3083 ELM_CHECK_WIDTYPE(obj, widtype);
3084 win = elm_widget_data_get(obj);
3086 #ifdef HAVE_ELEMENTARY_X
3087 _elm_win_xwindow_get(win);
3089 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
3096 elm_win_keyboard_win_get(const Evas_Object *obj)
3099 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3100 win = elm_widget_data_get(obj);
3101 if (!win) return EINA_FALSE;
3102 #ifdef HAVE_ELEMENTARY_X
3103 _elm_win_xwindow_get(win);
3105 return ecore_x_e_virtual_keyboard_get(win->xwin);
3110 // WRAPPER: Temperary added.
3112 elm_win_indicator_state_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
3114 elm_win_indicator_mode_set(obj, mode);
3118 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
3121 ELM_CHECK_WIDTYPE(obj, widtype);
3122 win = elm_widget_data_get(obj);
3124 if (mode == win->indmode) return;
3125 #ifdef HAVE_ELEMENTARY_X
3126 _elm_win_xwindow_get(win);
3128 win->indmode = mode;
3129 #ifdef HAVE_ELEMENTARY_X
3132 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
3133 ecore_x_e_illume_indicator_state_set
3134 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
3135 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
3136 ecore_x_e_illume_indicator_state_set
3137 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
3142 // WRAPPER: Temperary added.
3143 EAPI Elm_Win_Indicator_Mode
3144 elm_win_indicator_state_get(const Evas_Object *obj)
3146 return elm_win_indicator_mode_get(obj);
3149 EAPI Elm_Win_Indicator_Mode
3150 elm_win_indicator_mode_get(const Evas_Object *obj)
3153 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
3154 win = elm_widget_data_get(obj);
3155 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
3156 return win->indmode;
3160 elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode)
3163 ELM_CHECK_WIDTYPE(obj, widtype);
3164 win = elm_widget_data_get(obj);
3166 if (mode == win->ind_o_mode) return;
3167 win->ind_o_mode = mode;
3168 #ifdef HAVE_ELEMENTARY_X
3169 _elm_win_xwindow_get(win);
3172 if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
3173 ecore_x_e_illume_indicator_opacity_set
3174 (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
3175 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
3176 ecore_x_e_illume_indicator_opacity_set
3177 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
3178 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
3179 ecore_x_e_illume_indicator_opacity_set
3180 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
3186 EAPI Elm_Win_Indicator_Opacity_Mode
3187 elm_win_indicator_opacity_get(const Evas_Object *obj)
3190 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
3191 win = elm_widget_data_get(obj);
3192 if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
3193 return win->ind_o_mode;
3197 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
3200 ELM_CHECK_WIDTYPE(obj, widtype);
3201 win = elm_widget_data_get(obj);
3203 if (x) *x = win->screen.x;
3204 if (y) *y = win->screen.y;
3208 elm_win_focus_get(const Evas_Object *obj)
3211 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3212 win = elm_widget_data_get(obj);
3213 if (!win) return EINA_FALSE;
3214 return ecore_evas_focus_get(win->ee);
3218 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
3221 ELM_CHECK_WIDTYPE(obj, widtype);
3222 win = elm_widget_data_get(obj);
3224 win->constrain = !!constrain;
3228 elm_win_screen_constrain_get(Evas_Object *obj)
3231 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3232 win = elm_widget_data_get(obj);
3233 if (!win) return EINA_FALSE;
3234 return win->constrain;
3238 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
3241 ELM_CHECK_WIDTYPE(obj, widtype);
3242 win = elm_widget_data_get(obj);
3244 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
3248 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
3251 ELM_CHECK_WIDTYPE(obj, widtype);
3252 win = elm_widget_data_get(obj);
3254 #ifdef HAVE_ELEMENTARY_X
3255 _elm_win_xwindow_get(win);
3257 ecore_x_e_illume_conformant_set(win->xwin, conformant);
3264 elm_win_conformant_get(const Evas_Object *obj)
3267 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3268 win = elm_widget_data_get(obj);
3269 if (!win) return EINA_FALSE;
3270 #ifdef HAVE_ELEMENTARY_X
3271 _elm_win_xwindow_get(win);
3273 return ecore_x_e_illume_conformant_get(win->xwin);
3279 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
3282 ELM_CHECK_WIDTYPE(obj, widtype);
3283 win = elm_widget_data_get(obj);
3285 #ifdef HAVE_ELEMENTARY_X
3286 _elm_win_xwindow_get(win);
3289 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
3292 Ecore_X_Window_State states[2];
3294 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
3295 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
3296 ecore_x_netwm_window_state_set(win->xwin, states, 2);
3297 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
3306 elm_win_quickpanel_get(const Evas_Object *obj)
3309 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3310 win = elm_widget_data_get(obj);
3311 if (!win) return EINA_FALSE;
3312 #ifdef HAVE_ELEMENTARY_X
3313 _elm_win_xwindow_get(win);
3315 return ecore_x_e_illume_quickpanel_get(win->xwin);
3321 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
3324 ELM_CHECK_WIDTYPE(obj, widtype);
3325 win = elm_widget_data_get(obj);
3327 #ifdef HAVE_ELEMENTARY_X
3328 _elm_win_xwindow_get(win);
3330 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
3337 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
3340 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3341 win = elm_widget_data_get(obj);
3342 if (!win) return -1;
3343 #ifdef HAVE_ELEMENTARY_X
3344 _elm_win_xwindow_get(win);
3346 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
3352 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
3355 ELM_CHECK_WIDTYPE(obj, widtype);
3356 win = elm_widget_data_get(obj);
3358 #ifdef HAVE_ELEMENTARY_X
3359 _elm_win_xwindow_get(win);
3361 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3368 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3371 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3372 win = elm_widget_data_get(obj);
3373 if (!win) return -1;
3374 #ifdef HAVE_ELEMENTARY_X
3375 _elm_win_xwindow_get(win);
3377 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3383 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3386 ELM_CHECK_WIDTYPE(obj, widtype);
3387 win = elm_widget_data_get(obj);
3389 #ifdef HAVE_ELEMENTARY_X
3390 _elm_win_xwindow_get(win);
3392 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3399 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3402 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3403 win = elm_widget_data_get(obj);
3405 #ifdef HAVE_ELEMENTARY_X
3406 _elm_win_xwindow_get(win);
3408 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3414 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3417 ELM_CHECK_WIDTYPE(obj, widtype);
3418 win = elm_widget_data_get(obj);
3420 win->skip_focus = skip;
3421 ecore_evas_focus_skip_set(win->ee, skip);
3425 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3428 ELM_CHECK_WIDTYPE(obj, widtype);
3429 win = elm_widget_data_get(obj);
3431 #ifdef HAVE_ELEMENTARY_X
3432 _elm_win_xwindow_get(win);
3437 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3438 ecore_x_e_illume_focus_back_send(win->xwin);
3440 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3441 ecore_x_e_illume_focus_forward_send(win->xwin);
3443 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3444 ecore_x_e_illume_focus_home_send(win->xwin);
3446 case ELM_ILLUME_COMMAND_CLOSE:
3447 ecore_x_e_illume_close_send(win->xwin);
3459 elm_win_inlined_image_object_get(Evas_Object *obj)
3462 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3463 win = elm_widget_data_get(obj);
3464 if (!win) return NULL;
3465 return win->img_obj;
3469 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3473 ELM_CHECK_WIDTYPE(obj, widtype);
3475 win = elm_widget_data_get(obj);
3476 enabled = !!enabled;
3477 if (win->focus_highlight.enabled == enabled)
3480 win->focus_highlight.enabled = enabled;
3482 if (win->focus_highlight.enabled)
3483 _elm_win_focus_highlight_init(win);
3485 _elm_win_focus_highlight_shutdown(win);
3489 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3493 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3495 win = elm_widget_data_get(obj);
3496 return win->focus_highlight.enabled;
3500 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3504 ELM_CHECK_WIDTYPE(obj, widtype);
3506 win = elm_widget_data_get(obj);
3507 eina_stringshare_replace(&win->focus_highlight.style, style);
3508 win->focus_highlight.changed_theme = EINA_TRUE;
3509 _elm_win_focus_highlight_reconfigure_job_start(win);
3513 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3517 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3519 win = elm_widget_data_get(obj);
3520 return win->focus_highlight.style;
3523 typedef struct _Widget_Data Widget_Data;
3528 Evas_Object *content;
3531 static void _del_hook(Evas_Object *obj);
3532 static void _theme_hook(Evas_Object *obj);
3533 static void _sizing_eval(Evas_Object *obj);
3534 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3535 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3537 static const char *widtype2 = NULL;
3540 _del_hook(Evas_Object *obj)
3542 Widget_Data *wd = elm_widget_data_get(obj);
3548 _theme_hook(Evas_Object *obj)
3550 Widget_Data *wd = elm_widget_data_get(obj);
3551 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3553 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3556 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3560 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3562 Widget_Data *wd = elm_widget_data_get(obj);
3567 /* Try Focus cycle in subitem */
3570 elm_widget_focus_next_get(wd->content, dir, next);
3575 *next = (Evas_Object *)obj;
3580 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3582 Widget_Data *wd = elm_widget_data_get(obj);
3584 if (!wd || !item) return;
3585 edje_object_part_text_escaped_set(wd->frm, item, text);
3590 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3592 Widget_Data *wd = elm_widget_data_get(obj);
3594 if (!item || !wd || !wd->frm) return NULL;
3595 return edje_object_part_text_get(wd->frm, item);
3599 _sizing_eval(Evas_Object *obj)
3601 Widget_Data *wd = elm_widget_data_get(obj);
3602 Evas_Coord minw = -1, minh = -1;
3604 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3605 edje_object_size_min_calc(wd->frm, &minw, &minh);
3606 evas_object_size_hint_min_set(obj, minw, minh);
3607 evas_object_size_hint_max_set(obj, -1, -1);
3611 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3617 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3619 Widget_Data *wd = elm_widget_data_get(obj);
3620 Evas_Object *sub = event_info;
3621 if (sub == wd->content)
3623 evas_object_event_callback_del_full
3624 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3631 elm_win_inwin_add(Evas_Object *obj)
3637 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3638 win = elm_widget_data_get(obj);
3639 if (!win) return NULL;
3640 wd = ELM_NEW(Widget_Data);
3641 obj2 = elm_widget_add(win->evas);
3642 elm_widget_type_set(obj2, "inwin");
3643 ELM_SET_WIDTYPE(widtype2, "inwin");
3644 elm_widget_sub_object_add(obj, obj2);
3645 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3646 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3647 elm_win_resize_object_add(obj, obj2);
3649 elm_widget_data_set(obj2, wd);
3650 elm_widget_del_hook_set(obj2, _del_hook);
3651 elm_widget_theme_hook_set(obj2, _theme_hook);
3652 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3653 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3654 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3655 elm_widget_can_focus_set(obj2, EINA_TRUE);
3656 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3658 wd->frm = edje_object_add(win->evas);
3659 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3660 elm_widget_resize_object_set(obj2, wd->frm);
3662 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3669 elm_win_inwin_activate(Evas_Object *obj)
3671 ELM_CHECK_WIDTYPE(obj, widtype2);
3672 Widget_Data *wd = elm_widget_data_get(obj);
3674 evas_object_raise(obj);
3675 evas_object_show(obj);
3676 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3677 elm_object_focus_set(obj, EINA_TRUE);
3681 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3683 ELM_CHECK_WIDTYPE(obj, widtype2);
3684 Widget_Data *wd = elm_widget_data_get(obj);
3686 if (wd->content == content) return;
3687 if (wd->content) evas_object_del(wd->content);
3688 wd->content = content;
3691 elm_widget_sub_object_add(obj, content);
3692 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3693 _changed_size_hints, obj);
3694 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3700 elm_win_inwin_content_get(const Evas_Object *obj)
3702 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3703 Widget_Data *wd = elm_widget_data_get(obj);
3704 if (!wd) return NULL;
3709 elm_win_inwin_content_unset(Evas_Object *obj)
3711 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3712 Widget_Data *wd = elm_widget_data_get(obj);
3713 if (!wd) return NULL;
3714 if (!wd->content) return NULL;
3715 Evas_Object *content = wd->content;
3716 elm_widget_sub_object_del(obj, wd->content);
3717 evas_object_event_callback_del_full(wd->content,
3718 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3719 _changed_size_hints, obj);
3720 edje_object_part_unswallow(wd->frm, wd->content);
3726 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3731 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3732 win = elm_widget_data_get(obj);
3733 if (!win) return EINA_FALSE;
3734 if (!win->ee) return EINA_FALSE;
3736 if (!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3742 /* windowing specific calls - shall we do this differently? */
3744 static Ecore_X_Window
3745 _elm_ee_win_get(const Evas_Object *obj)
3748 #ifdef HAVE_ELEMENTARY_X
3749 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3750 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3756 elm_win_xwindow_get(const Evas_Object *obj)
3762 type = elm_widget_type_get(obj);
3763 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3764 win = elm_widget_data_get(obj);
3766 #ifdef HAVE_ELEMENTARY_X
3767 if (win->xwin) return win->xwin;
3768 if (win->parent) return elm_win_xwindow_get(win->parent);
3774 elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool floating)
3777 ELM_CHECK_WIDTYPE(obj, widtype);
3778 win = elm_widget_data_get(obj);
3780 if (floating == win->floating) return;
3781 #ifdef HAVE_ELEMENTARY_X
3782 _elm_win_xwindow_get(win);
3784 win->floating = floating;
3785 #ifdef HAVE_ELEMENTARY_X
3789 ecore_x_e_illume_window_state_set
3790 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_FLOATING);
3792 ecore_x_e_illume_window_state_set
3793 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_NORMAL);
3799 elm_win_floating_mode_get(const Evas_Object *obj)
3802 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3803 win = elm_widget_data_get(obj);
3804 if (!win) return EINA_FALSE;
3806 return win->floating;