1 #include <Elementary.h>
4 typedef struct _Elm_Win Elm_Win;
10 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
12 #ifdef HAVE_ELEMENTARY_X
14 Ecore_Event_Handler *client_message_handler;
16 Ecore_Job *deferred_resize_job;
17 Ecore_Job *deferred_child_eval_job;
20 Elm_Win_Keyboard_Mode kbdmode;
27 Eina_Bool autodel : 1;
28 int *autodel_clear, rot;
39 Eina_Bool visible : 1;
40 Eina_Bool handled : 1;
44 Ecore_Job *reconf_job;
46 Eina_Bool enabled : 1;
47 Eina_Bool changed_theme : 1;
48 Eina_Bool top_animate : 1;
49 Eina_Bool geometry_changed : 1;
53 static const char *widtype = NULL;
54 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
55 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
56 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
57 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
58 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
59 static void _elm_win_move(Ecore_Evas *ee);
60 static void _elm_win_resize(Ecore_Evas *ee);
61 static void _elm_win_delete_request(Ecore_Evas *ee);
62 static void _elm_win_resize_job(void *data);
63 #ifdef HAVE_ELEMENTARY_X
64 static void _elm_win_xwin_update(Elm_Win *win);
66 static void _elm_win_eval_subobjs(Evas_Object *obj);
67 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
68 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
69 static void _elm_win_focus_highlight_init(Elm_Win *win);
70 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
71 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
72 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
73 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
74 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
75 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
77 static const char SIG_DELETE_REQUEST[] = "delete,request";
78 static const char SIG_FOCUS_OUT[] = "focus,out";
79 static const char SIG_FOCUS_IN[] = "focus,in";
80 static const char SIG_MOVED[] = "moved";
81 static const char SIG_THEME_CHANGED[] = "theme,changed";
83 static const Evas_Smart_Cb_Description _signals[] = {
84 {SIG_DELETE_REQUEST, ""},
93 Eina_List *_elm_win_list = NULL;
94 int _elm_win_deferred_free = 0;
96 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
97 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
100 _shot_delay_get(Elm_Win *win)
103 char *d = strdup(win->shot.info);
106 for (p = (char *)win->shot.info; *p; p++)
108 if (!strncmp(p, "delay=", 6))
112 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
127 _shot_file_get(Elm_Win *win)
130 char *tmp = strdup(win->shot.info);
131 char *repname = NULL;
133 if (!tmp) return NULL;
135 for (p = (char *)win->shot.info; *p; p++)
137 if (!strncmp(p, "file=", 5))
140 if (!win->shot.repeat_count) return tmp;
143 char *dotptr = strrchr(tmp, '.');
146 repname = malloc(sizeof(char)*(strlen(tmp) + 16));
147 strncpy(repname, tmp, dotptr - tmp);
148 sprintf(repname + (dotptr - tmp), "%03i",
149 win->shot.shot_counter + 1);
150 strcat(repname, dotptr);
158 if (!win->shot.repeat_count) return strdup("out.png");
161 repname = malloc(sizeof(char) * 24);
162 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
168 _shot_repeat_count_get(Elm_Win *win)
172 char *d = strdup(win->shot.info);
175 for (p = (char *)win->shot.info; *p; p++)
177 if (!strncmp(p, "repeat=", 7))
181 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
188 if (v > 1000) v = 999;
198 _shot_key_get(Elm_Win *win __UNUSED__)
204 _shot_flags_get(Elm_Win *win __UNUSED__)
210 _shot_do(Elm_Win *win)
214 unsigned int *pixels;
216 char *file, *key, *flags;
218 ecore_evas_manual_render(win->ee);
219 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
221 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
222 if ((w < 1) || (h < 1)) return;
223 file = _shot_file_get(win);
225 key = _shot_key_get(win);
226 flags = _shot_flags_get(win);
227 ee = ecore_evas_buffer_new(1, 1);
228 o = evas_object_image_add(ecore_evas_get(ee));
229 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
230 evas_object_image_size_set(o, w, h);
231 evas_object_image_data_set(o, pixels);
232 if (!evas_object_image_save(o, file, key, flags))
234 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
239 if (flags) free(flags);
241 if (win->shot.repeat_count) win->shot.shot_counter++;
245 _shot_delay(void *data)
249 if (win->shot.repeat_count)
251 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
252 if (remainshot > 0) return EINA_TRUE;
254 win->shot.timer = NULL;
260 _shot_init(Elm_Win *win)
262 if (!win->shot.info) return;
263 win->shot.repeat_count = _shot_repeat_count_get(win);
264 win->shot.shot_counter = 0;
268 _shot_handle(Elm_Win *win)
270 if (!win->shot.info) return;
271 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
275 _elm_win_move(Ecore_Evas *ee)
277 Evas_Object *obj = ecore_evas_object_associate_get(ee);
282 win = elm_widget_data_get(obj);
284 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
287 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
291 _elm_win_resize(Ecore_Evas *ee)
293 Evas_Object *obj = ecore_evas_object_associate_get(ee);
297 win = elm_widget_data_get(obj);
299 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
300 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
304 _elm_win_focus_in(Ecore_Evas *ee)
306 Evas_Object *obj = ecore_evas_object_associate_get(ee);
310 win = elm_widget_data_get(obj);
312 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
313 if (win->show_count == 1)
315 elm_object_focus_set(win->win_obj, EINA_TRUE);
319 elm_widget_focus_restore(win->win_obj);
320 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
321 win->focus_highlight.cur.visible = EINA_TRUE;
322 _elm_win_focus_highlight_reconfigure_job_start(win);
326 else if (win->img_obj)
333 _elm_win_focus_out(Ecore_Evas *ee)
335 Evas_Object *obj = ecore_evas_object_associate_get(ee);
339 win = elm_widget_data_get(obj);
341 elm_object_focus_set(win->win_obj, EINA_FALSE);
342 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
343 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
344 win->focus_highlight.cur.visible = EINA_FALSE;
345 _elm_win_focus_highlight_reconfigure_job_start(win);
349 else if (win->img_obj)
356 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
358 Elm_Win *wd = elm_widget_data_get(obj);
359 const Eina_List *items;
360 void *(*list_data_get) (const Eina_List *list);
368 if (!(items = elm_widget_focus_custom_chain_get(obj)))
374 list_data_get = eina_list_data_get;
376 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
382 *next = (Evas_Object *)obj;
387 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
389 Elm_Win *win = elm_widget_data_get(obj);
393 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
395 evas_object_focus_set(obj, elm_widget_focus_get(obj));
399 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
401 if (type == EVAS_CALLBACK_KEY_DOWN)
403 Evas_Event_Key_Down *ev = event_info;
404 if (!strcmp(ev->keyname, "Tab"))
406 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
407 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
409 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
410 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
413 else if ((!strcmp(ev->keyname, "Left")) ||
414 (!strcmp(ev->keyname, "KP_Left")))
416 //TODO : woohyun jung
418 else if ((!strcmp(ev->keyname, "Right")) ||
419 (!strcmp(ev->keyname, "KP_Right")))
421 //TODO : woohyun jung
423 else if ((!strcmp(ev->keyname, "Up")) ||
424 (!strcmp(ev->keyname, "KP_Up")))
426 //TODO : woohyun jung
428 else if ((!strcmp(ev->keyname, "Down")) ||
429 (!strcmp(ev->keyname, "KP_Down")))
431 //TODO : woohyun jung
439 _deferred_ecore_evas_free(void *data)
441 ecore_evas_free(data);
442 _elm_win_deferred_free--;
446 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
450 if (!win->show_count) win->show_count++;
451 if (win->shot.info) _shot_handle(win);
455 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
462 else if (win->img_obj)
464 evas_object_hide(win->img_obj);
469 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
476 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
477 _elm_win_obj_callback_parent_del, win);
480 if (win->autodel_clear) *(win->autodel_clear) = -1;
481 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
482 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
485 ecore_evas_callback_delete_request_set(win->ee, NULL);
486 ecore_evas_callback_resize_set(win->ee, NULL);
488 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
489 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
490 if (win->shot.info) eina_stringshare_del(win->shot.info);
491 if (win->shot.timer) ecore_timer_del(win->shot.timer);
492 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
493 _elm_win_obj_callback_del, win);
494 while (((child = evas_object_bottom_get(win->evas))) &&
497 evas_object_del(child);
499 while (((child = evas_object_top_get(win->evas))) &&
502 evas_object_del(child);
504 #ifdef HAVE_ELEMENTARY_X
505 if (win->client_message_handler)
506 ecore_event_handler_del(win->client_message_handler);
508 // FIXME: Why are we flushing edje on every window destroy ??
509 // edje_file_cache_flush();
510 // edje_collection_cache_flush();
511 // evas_image_cache_flush(win->evas);
512 // evas_font_cache_flush(win->evas);
513 // FIXME: we are in the del handler for the object and delete the canvas
514 // that lives under it from the handler... nasty. deferring doesn't help either
524 ecore_job_add(_deferred_ecore_evas_free, win->ee);
525 _elm_win_deferred_free++;
529 _elm_win_focus_highlight_shutdown(win);
530 eina_stringshare_del(win->focus_highlight.style);
534 if ((!_elm_win_list) &&
535 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
537 edje_file_cache_flush();
538 edje_collection_cache_flush();
539 evas_image_cache_flush(e);
540 evas_font_cache_flush(e);
546 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
549 if (!win->img_obj) return;
550 evas_object_event_callback_del_full
551 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
552 evas_object_del(win->img_obj);
556 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
559 if (obj == win->parent) win->parent = NULL;
563 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
569 if ((x != win->screen.x) || (y != win->screen.y))
573 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
578 evas_object_move(obj, x, y);
583 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
586 // this is called to make sure all smart containers have calculated their
587 // sizes BEFORE we show the window to make sure it initially appears at
588 // our desired size (ie min size is known first)
589 evas_smart_objects_calculate(evas_object_evas_get(obj));
590 evas_object_show(obj);
594 else if (win->img_obj)
596 evas_object_show(win->img_obj);
601 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
605 if (ecore_evas_override_get(win->ee))
609 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
612 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
617 else if (win->img_obj)
621 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
624 // evas_object_move(win->img_obj, x, y);
629 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
636 else if (win->img_obj)
638 Evas_Coord w = 1, h = 1;
640 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
643 evas_object_image_size_set(win->img_obj, w, h);
648 _elm_win_delete_request(Ecore_Evas *ee)
650 Evas_Object *obj = ecore_evas_object_associate_get(ee);
652 if (strcmp(elm_widget_type_get(obj), "win")) return;
654 win = elm_widget_data_get(obj);
656 int autodel = win->autodel;
657 win->autodel_clear = &autodel;
658 evas_object_ref(win->win_obj);
659 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
660 // FIXME: if above callback deletes - then the below will be invalid
661 if (autodel) evas_object_del(win->win_obj);
662 else win->autodel_clear = NULL;
663 evas_object_unref(win->win_obj);
667 _elm_win_resize_job(void *data)
674 win->deferred_resize_job = NULL;
675 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
676 evas_object_resize(win->win_obj, w, h);
680 else if (win->img_obj)
683 EINA_LIST_FOREACH(win->subobjs, l, obj)
685 evas_object_move(obj, 0, 0);
686 evas_object_resize(obj, w, h);
690 #ifdef HAVE_ELEMENTARY_X
692 _elm_win_xwindow_get(Elm_Win *win)
696 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
697 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
699 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
701 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
702 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
703 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
704 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
705 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
706 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
707 ENGINE_COMPARE(ELM_OPENGL_COCOA))
710 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
712 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
714 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
716 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
719 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
721 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
724 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
726 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
728 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
730 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
732 #undef ENGINE_COMPARE
736 #ifdef HAVE_ELEMENTARY_X
738 _elm_win_xwin_update(Elm_Win *win)
740 _elm_win_xwindow_get(win);
745 win2 = elm_widget_data_get(win->parent);
749 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
753 if (!win->xwin) return; /* nothing more to do */
758 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
760 case ELM_WIN_DIALOG_BASIC:
761 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
763 case ELM_WIN_DESKTOP:
764 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
767 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
769 case ELM_WIN_TOOLBAR:
770 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
773 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
775 case ELM_WIN_UTILITY:
776 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
779 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
781 case ELM_WIN_DROPDOWN_MENU:
782 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
784 case ELM_WIN_POPUP_MENU:
785 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
787 case ELM_WIN_TOOLTIP:
788 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
790 case ELM_WIN_NOTIFICATION:
791 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
794 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
797 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
802 ecore_x_e_virtual_keyboard_state_set
803 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
808 _elm_win_eval_subobjs(Evas_Object *obj)
811 const Evas_Object *child;
813 Elm_Win *win = elm_widget_data_get(obj);
814 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
818 EINA_LIST_FOREACH(win->subobjs, l, child)
820 evas_object_size_hint_weight_get(child, &wx, &wy);
821 if (wx == 0.0) xx = 0;
822 if (wy == 0.0) xy = 0;
824 evas_object_size_hint_min_get(child, &w, &h);
827 if (w > minw) minw = w;
828 if (h > minh) minh = h;
830 evas_object_size_hint_max_get(child, &w, &h);
833 if (maxw == -1) maxw = w;
834 else if ((w > 0) && (w < maxw)) maxw = w;
835 if (maxh == -1) maxh = h;
836 else if ((h > 0) && (h < maxh)) maxh = h;
838 if (!xx) maxw = minw;
840 if (!xy) maxh = minh;
842 evas_object_size_hint_min_set(obj, minw, minh);
843 evas_object_size_hint_max_set(obj, maxw, maxh);
844 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
845 if (w < minw) w = minw;
846 if (h < minh) h = minh;
847 if ((maxw >= 0) && (w > maxw)) w = maxw;
848 if ((maxh >= 0) && (h > maxh)) h = maxh;
849 evas_object_resize(obj, w, h);
853 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
855 Elm_Win *win = elm_widget_data_get(data);
856 win->subobjs = eina_list_remove(win->subobjs, obj);
857 _elm_win_eval_subobjs(win->win_obj);
861 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
863 _elm_win_eval_subobjs(data);
867 _elm_win_shutdown(void)
869 while (_elm_win_list)
870 evas_object_del(_elm_win_list->data);
874 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
881 EINA_LIST_FOREACH(_elm_win_list, l, obj)
882 elm_widget_theme(obj);
886 EINA_LIST_FOREACH(_elm_win_list, l, obj)
887 elm_widget_theme_specific(obj, th, EINA_FALSE);
892 _elm_win_translate(void)
897 EINA_LIST_FOREACH(_elm_win_list, l, obj)
898 elm_widget_translate(obj);
901 #ifdef HAVE_ELEMENTARY_X
903 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
906 Ecore_X_Event_Client_Message *e = event;
908 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
909 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
911 if ((unsigned)e->data.l[0] == win->xwin)
913 Evas *evas = evas_object_evas_get(win->win_obj);
916 edje_file_cache_flush();
917 edje_collection_cache_flush();
918 evas_image_cache_flush(evas);
919 evas_font_cache_flush(evas);
923 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
925 if ((unsigned)e->data.l[0] == win->xwin)
927 Evas *evas = evas_object_evas_get(win->win_obj);
930 edje_file_cache_flush();
931 edje_collection_cache_flush();
932 evas_image_cache_flush(evas);
933 evas_font_cache_flush(evas);
934 evas_render_dump(evas);
938 return ECORE_CALLBACK_PASS_ON;
943 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
947 win->focus_highlight.geometry_changed = EINA_TRUE;
948 _elm_win_focus_highlight_reconfigure_job_start(win);
952 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
956 win->focus_highlight.geometry_changed = EINA_TRUE;
957 _elm_win_focus_highlight_reconfigure_job_start(win);
961 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
965 win->focus_highlight.cur.target = NULL;
967 _elm_win_focus_highlight_reconfigure_job_start(win);
971 _elm_win_focus_target_callbacks_add(Elm_Win *win)
973 Evas_Object *obj = win->focus_highlight.cur.target;
975 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
976 _elm_win_focus_target_move, win);
977 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
978 _elm_win_focus_target_resize, win);
979 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
980 _elm_win_focus_target_del, win);
984 _elm_win_focus_target_callbacks_del(Elm_Win *win)
986 Evas_Object *obj = win->focus_highlight.cur.target;
988 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
989 _elm_win_focus_target_move, win);
990 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
991 _elm_win_focus_target_resize, win);
992 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
993 _elm_win_focus_target_del, win);
997 _elm_win_focus_target_get(Evas_Object *obj)
999 Evas_Object *o = obj;
1003 if (elm_widget_is(o))
1005 if (!elm_widget_highlight_ignore_get(o))
1007 o = elm_widget_parent_get(o);
1009 o = evas_object_smart_parent_get(o);
1013 o = elm_widget_parent_widget_get(o);
1015 o = evas_object_smart_parent_get(o);
1024 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1026 Evas_Object *obj = event_info, *target;
1027 Elm_Win *win = data;
1029 if (win->focus_highlight.cur.target == obj)
1032 target = _elm_win_focus_target_get(obj);
1033 win->focus_highlight.cur.target = target;
1034 if (elm_widget_highlight_in_theme_get(target))
1035 win->focus_highlight.cur.handled = EINA_TRUE;
1037 _elm_win_focus_target_callbacks_add(win);
1039 _elm_win_focus_highlight_reconfigure_job_start(win);
1043 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1045 Elm_Win *win = data;
1047 if (!win->focus_highlight.cur.target)
1050 if (!win->focus_highlight.cur.handled)
1051 _elm_win_focus_target_callbacks_del(win);
1052 win->focus_highlight.cur.target = NULL;
1053 win->focus_highlight.cur.handled = EINA_FALSE;
1055 _elm_win_focus_highlight_reconfigure_job_start(win);
1059 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1061 evas_object_hide(obj);
1065 _elm_win_focus_highlight_init(Elm_Win *win)
1067 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1068 _elm_win_object_focus_in, win);
1069 evas_event_callback_add(win->evas,
1070 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1071 _elm_win_object_focus_out, win);
1073 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1075 win->focus_highlight.top = edje_object_add(win->evas);
1076 win->focus_highlight.changed_theme = EINA_TRUE;
1077 edje_object_signal_callback_add(win->focus_highlight.top,
1078 "elm,action,focus,hide,end", "",
1079 _elm_win_focus_highlight_hide, NULL);
1080 edje_object_signal_callback_add(win->focus_highlight.top,
1081 "elm,action,focus,anim,end", "",
1082 _elm_win_focus_highlight_anim_end, win);
1083 _elm_win_focus_highlight_reconfigure_job_start(win);
1087 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1089 _elm_win_focus_highlight_reconfigure_job_stop(win);
1090 if (win->focus_highlight.cur.target)
1092 _elm_win_focus_target_callbacks_del(win);
1093 win->focus_highlight.cur.target = NULL;
1095 if (win->focus_highlight.top)
1097 evas_object_del(win->focus_highlight.top);
1098 win->focus_highlight.top = NULL;
1101 evas_event_callback_del_full(win->evas,
1102 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1103 _elm_win_object_focus_in, win);
1104 evas_event_callback_del_full(win->evas,
1105 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1106 _elm_win_object_focus_out, win);
1110 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1114 top = win->focus_highlight.top;
1119 evas_object_show(top);
1120 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1126 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1131 _elm_win_focus_highlight_reconfigure_job(void *data)
1133 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1137 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1139 if (win->focus_highlight.reconf_job)
1140 ecore_job_del(win->focus_highlight.reconf_job);
1141 win->focus_highlight.reconf_job = ecore_job_add(
1142 _elm_win_focus_highlight_reconfigure_job, win);
1146 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1148 if (win->focus_highlight.reconf_job)
1149 ecore_job_del(win->focus_highlight.reconf_job);
1150 win->focus_highlight.reconf_job = NULL;
1154 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1156 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1157 Evas_Coord x, y, w, h;
1159 clip = evas_object_clip_get(target);
1160 evas_object_geometry_get(target, &x, &y, &w, &h);
1162 evas_object_move(obj, x, y);
1163 evas_object_resize(obj, w, h);
1164 evas_object_clip_set(obj, clip);
1168 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1170 Evas_Coord tx, ty, tw, th;
1171 Evas_Coord w, h, px, py, pw, ph;
1172 Edje_Message_Int_Set *m;
1173 Evas_Object *previous = win->focus_highlight.prev.target;
1174 Evas_Object *target = win->focus_highlight.cur.target;
1176 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1177 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1178 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1179 evas_object_move(obj, 0, 0);
1180 evas_object_resize(obj, tw, th);
1181 evas_object_clip_unset(obj);
1183 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1193 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1197 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1199 Elm_Win *win = data;
1200 _elm_win_focus_highlight_simple_setup(win, obj);
1204 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1206 Evas_Object *target = win->focus_highlight.cur.target;
1207 Evas_Object *previous = win->focus_highlight.prev.target;
1208 Evas_Object *top = win->focus_highlight.top;
1209 Eina_Bool visible_changed;
1210 Eina_Bool common_visible;
1211 const char *sig = NULL;
1213 _elm_win_focus_highlight_reconfigure_job_stop(win);
1215 visible_changed = (win->focus_highlight.cur.visible !=
1216 win->focus_highlight.prev.visible);
1218 if ((target == previous) && (!visible_changed) &&
1219 (!win->focus_highlight.geometry_changed))
1222 if ((previous) && (win->focus_highlight.prev.handled))
1223 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1226 common_visible = EINA_FALSE;
1227 else if (win->focus_highlight.cur.handled)
1229 common_visible = EINA_FALSE;
1230 if (win->focus_highlight.cur.visible)
1231 sig = "elm,action,focus_highlight,show";
1233 sig = "elm,action,focus_highlight,hide";
1236 common_visible = win->focus_highlight.cur.visible;
1238 _elm_win_focus_highlight_visible_set(win, common_visible);
1240 elm_widget_signal_emit(target, sig, "elm");
1242 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1245 if (win->focus_highlight.changed_theme)
1248 if (win->focus_highlight.style)
1249 str = win->focus_highlight.style;
1252 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1254 win->focus_highlight.changed_theme = EINA_FALSE;
1256 if (_elm_config->focus_highlight_animate)
1258 str = edje_object_data_get(win->focus_highlight.top, "animate");
1259 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1263 if ((win->focus_highlight.top_animate) && (previous) &&
1264 (!win->focus_highlight.prev.handled))
1265 _elm_win_focus_highlight_anim_setup(win, top);
1267 _elm_win_focus_highlight_simple_setup(win, top);
1268 evas_object_raise(top);
1271 win->focus_highlight.geometry_changed = EINA_FALSE;
1272 win->focus_highlight.prev = win->focus_highlight.cur;
1277 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1279 Evas_Event_Key_Down *ev = event_info;
1281 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1285 if ((strcmp(ev->keyname, "F12")) ||
1286 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1289 printf("Tree graph generated.\n");
1290 elm_object_tree_dot_dump(obj, "./dump.dot");
1295 _win_img_hide(void *data,
1297 Evas_Object *obj __UNUSED__,
1298 void *event_info __UNUSED__)
1300 Elm_Win *win = data;
1302 elm_widget_focus_hide_handle(win->win_obj);
1306 _win_img_mouse_up(void *data,
1308 Evas_Object *obj __UNUSED__,
1311 Elm_Win *win = data;
1312 Evas_Event_Mouse_Up *ev = event_info;
1313 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1314 elm_widget_focus_mouse_up_handle(win->win_obj);
1318 _win_img_focus_in(void *data,
1320 Evas_Object *obj __UNUSED__,
1321 void *event_info __UNUSED__)
1323 Elm_Win *win = data;
1324 elm_widget_focus_steal(win->win_obj);
1328 _win_img_focus_out(void *data,
1330 Evas_Object *obj __UNUSED__,
1331 void *event_info __UNUSED__)
1333 Elm_Win *win = data;
1334 elm_widget_focused_object_clear(win->win_obj);
1338 _win_inlined_image_set(Elm_Win *win)
1340 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1341 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1342 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1343 _elm_win_obj_callback_img_obj_del, win);
1345 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1346 _win_img_hide, win);
1347 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1348 _win_img_mouse_up, win);
1349 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1350 _win_img_focus_in, win);
1351 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1352 _win_img_focus_out, win);
1356 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1360 const char *fontpath;
1362 win = ELM_NEW(Elm_Win);
1364 #define FALLBACK_TRY(engine) \
1367 CRITICAL(engine " engine creation failed. Trying default."); \
1368 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1370 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1372 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1376 case ELM_WIN_INLINED_IMAGE:
1379 Evas *e = evas_object_evas_get(parent);
1382 ee = ecore_evas_ecore_evas_get(e);
1384 win->img_obj = ecore_evas_object_image_new(ee);
1385 if (!win->img_obj) break;
1386 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1389 _win_inlined_image_set(win);
1392 evas_object_del(win->img_obj);
1393 win->img_obj = NULL;
1397 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1399 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1400 #ifdef HAVE_ELEMENTARY_X
1401 win->client_message_handler = ecore_event_handler_add
1402 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1404 FALLBACK_TRY("Sofware X11");
1406 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1408 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1409 FALLBACK_TRY("Sofware FB");
1411 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1413 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1414 FALLBACK_TRY("Sofware DirectFB");
1416 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1418 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1419 FALLBACK_TRY("Sofware-16");
1420 #ifdef HAVE_ELEMENTARY_X
1421 win->client_message_handler = ecore_event_handler_add
1422 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1425 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1427 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1428 FALLBACK_TRY("Sofware-8");
1429 #ifdef HAVE_ELEMENTARY_X
1430 win->client_message_handler = ecore_event_handler_add
1431 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1435 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1437 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1438 FALLBACK_TRY("XRender");
1439 #ifdef HAVE_ELEMENTARY_X
1440 win->client_message_handler = ecore_event_handler_add
1441 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1445 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1450 if (_elm_config->vsync)
1452 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1458 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1460 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1461 FALLBACK_TRY("OpenGL");
1462 #ifdef HAVE_ELEMENTARY_X
1463 win->client_message_handler = ecore_event_handler_add
1464 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1467 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1469 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1470 FALLBACK_TRY("Sofware Win32");
1472 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1474 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1475 FALLBACK_TRY("Sofware-16-WinCE");
1477 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1479 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1480 FALLBACK_TRY("Sofware SDL");
1482 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1484 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1485 FALLBACK_TRY("Sofware-16-SDL");
1487 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1489 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1490 FALLBACK_TRY("OpenGL SDL");
1492 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1494 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1495 FALLBACK_TRY("OpenGL Cocoa");
1497 else if (ENGINE_COMPARE(ELM_BUFFER))
1499 win->ee = ecore_evas_buffer_new(1, 1);
1501 else if (ENGINE_COMPARE(ELM_EWS))
1503 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1505 else if (!strncmp(_elm_config->engine, "shot:", 5))
1507 win->ee = ecore_evas_buffer_new(1, 1);
1508 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1509 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1518 ERR("Cannot create window.");
1522 #ifdef HAVE_ELEMENTARY_X
1523 _elm_win_xwindow_get(win);
1525 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1526 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1527 // bg pixmap done by x - has other issues like can be redrawn by x before it
1528 // is filled/ready by app
1529 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1532 win->parent = parent;
1534 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1535 _elm_win_obj_callback_parent_del, win);
1537 win->evas = ecore_evas_get(win->ee);
1538 win->win_obj = elm_widget_add(win->evas);
1539 elm_widget_type_set(win->win_obj, "win");
1540 ELM_SET_WIDTYPE(widtype, "win");
1541 elm_widget_data_set(win->win_obj, win);
1542 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1543 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1544 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1545 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1546 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1547 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1548 evas_object_move(win->win_obj, 0, 0);
1549 evas_object_resize(win->win_obj, 1, 1);
1550 evas_object_layer_set(win->win_obj, 50);
1551 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1553 if (type == ELM_WIN_INLINED_IMAGE)
1554 elm_widget_parent2_set(win->win_obj, parent);
1555 ecore_evas_object_associate(win->ee, win->win_obj,
1556 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1557 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1558 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1559 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1560 _elm_win_obj_callback_show, win);
1561 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1562 _elm_win_obj_callback_hide, win);
1563 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1564 _elm_win_obj_callback_del, win);
1565 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1566 _elm_win_obj_callback_move, win);
1567 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1568 _elm_win_obj_callback_resize, win);
1570 evas_object_intercept_move_callback_add(win->win_obj,
1571 _elm_win_obj_intercept_move, win);
1572 evas_object_intercept_show_callback_add(win->win_obj,
1573 _elm_win_obj_intercept_show, win);
1575 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1576 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1577 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1578 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1579 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1580 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1581 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1582 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1583 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1584 evas_font_path_append(win->evas, fontpath);
1585 if (!_elm_config->font_hinting)
1586 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1587 else if (_elm_config->font_hinting == 1)
1588 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1589 else if (_elm_config->font_hinting == 2)
1590 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1592 #ifdef HAVE_ELEMENTARY_X
1593 _elm_win_xwin_update(win);
1596 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1598 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1600 ecore_evas_fullscreen_set(win->ee, 1);
1602 #undef ENGINE_COMPARE
1604 if (_elm_config->focus_highlight_enable)
1605 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1608 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1609 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1610 _debug_key_down, win);
1612 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1614 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1617 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1619 return win->win_obj;
1623 elm_win_util_standard_add(const char *name, const char *title)
1625 Evas_Object *win, *bg;
1627 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1628 if (!win) return NULL;
1629 elm_win_title_set(win, title);
1630 bg = elm_bg_add(win);
1633 evas_object_del(win);
1636 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1637 elm_win_resize_object_add(win, bg);
1638 evas_object_show(bg);
1643 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1647 ELM_CHECK_WIDTYPE(obj, widtype);
1648 win = elm_widget_data_get(obj);
1650 if (eina_list_data_find(win->subobjs, subobj)) return;
1651 win->subobjs = eina_list_append(win->subobjs, subobj);
1652 elm_widget_sub_object_add(obj, subobj);
1653 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1654 _elm_win_subobj_callback_del, obj);
1655 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1656 _elm_win_subobj_callback_changed_size_hints,
1658 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1659 evas_object_move(subobj, 0, 0);
1660 evas_object_resize(subobj, w, h);
1661 _elm_win_eval_subobjs(obj);
1665 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1668 ELM_CHECK_WIDTYPE(obj, widtype);
1669 win = elm_widget_data_get(obj);
1671 evas_object_event_callback_del_full(subobj,
1672 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1673 _elm_win_subobj_callback_changed_size_hints,
1675 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1676 _elm_win_subobj_callback_del, obj);
1677 win->subobjs = eina_list_remove(win->subobjs, subobj);
1678 elm_widget_sub_object_del(obj, subobj);
1679 _elm_win_eval_subobjs(obj);
1683 elm_win_title_set(Evas_Object *obj, const char *title)
1686 ELM_CHECK_WIDTYPE(obj, widtype);
1687 win = elm_widget_data_get(obj);
1689 ecore_evas_title_set(win->ee, title);
1693 elm_win_title_get(const Evas_Object *obj)
1696 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1697 win = elm_widget_data_get(obj);
1698 if (!win) return NULL;
1699 return ecore_evas_title_get(win->ee);
1703 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1706 ELM_CHECK_WIDTYPE(obj, widtype);
1707 win = elm_widget_data_get(obj);
1709 win->autodel = autodel;
1713 elm_win_autodel_get(const Evas_Object *obj)
1716 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1717 win = elm_widget_data_get(obj);
1718 if (!win) return EINA_FALSE;
1719 return win->autodel;
1723 elm_win_activate(Evas_Object *obj)
1726 ELM_CHECK_WIDTYPE(obj, widtype);
1727 win = elm_widget_data_get(obj);
1729 ecore_evas_activate(win->ee);
1733 elm_win_lower(Evas_Object *obj)
1736 ELM_CHECK_WIDTYPE(obj, widtype);
1737 win = elm_widget_data_get(obj);
1739 ecore_evas_lower(win->ee);
1743 elm_win_raise(Evas_Object *obj)
1746 ELM_CHECK_WIDTYPE(obj, widtype);
1747 win = elm_widget_data_get(obj);
1749 ecore_evas_raise(win->ee);
1753 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1756 ELM_CHECK_WIDTYPE(obj, widtype);
1757 win = elm_widget_data_get(obj);
1759 ecore_evas_borderless_set(win->ee, borderless);
1760 #ifdef HAVE_ELEMENTARY_X
1761 _elm_win_xwin_update(win);
1766 elm_win_borderless_get(const Evas_Object *obj)
1769 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1770 win = elm_widget_data_get(obj);
1771 if (!win) return EINA_FALSE;
1772 return ecore_evas_borderless_get(win->ee);
1776 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1779 ELM_CHECK_WIDTYPE(obj, widtype);
1780 win = elm_widget_data_get(obj);
1782 ecore_evas_shaped_set(win->ee, shaped);
1783 #ifdef HAVE_ELEMENTARY_X
1784 _elm_win_xwin_update(win);
1789 elm_win_shaped_get(const Evas_Object *obj)
1792 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1793 win = elm_widget_data_get(obj);
1794 if (!win) return EINA_FALSE;
1795 return ecore_evas_shaped_get(win->ee);
1799 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1802 ELM_CHECK_WIDTYPE(obj, widtype);
1803 win = elm_widget_data_get(obj);
1808 else if (win->img_obj)
1810 evas_object_image_alpha_set(win->img_obj, alpha);
1811 ecore_evas_alpha_set(win->ee, alpha);
1815 #ifdef HAVE_ELEMENTARY_X
1820 if (!_elm_config->compositing)
1821 elm_win_shaped_set(obj, alpha);
1823 ecore_evas_alpha_set(win->ee, alpha);
1826 ecore_evas_alpha_set(win->ee, alpha);
1827 _elm_win_xwin_update(win);
1831 ecore_evas_alpha_set(win->ee, alpha);
1836 elm_win_alpha_get(const Evas_Object *obj)
1839 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1840 win = elm_widget_data_get(obj);
1841 if (!win) return EINA_FALSE;
1845 else if (win->img_obj)
1847 return evas_object_image_alpha_get(win->img_obj);
1849 return ecore_evas_alpha_get(win->ee);
1853 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1856 ELM_CHECK_WIDTYPE(obj, widtype);
1857 win = elm_widget_data_get(obj);
1863 else if (win->img_obj)
1865 evas_object_image_alpha_set(win->img_obj, transparent);
1869 #ifdef HAVE_ELEMENTARY_X
1872 ecore_evas_transparent_set(win->ee, transparent);
1873 _elm_win_xwin_update(win);
1877 ecore_evas_transparent_set(win->ee, transparent);
1882 elm_win_transparent_get(const Evas_Object *obj)
1885 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1886 win = elm_widget_data_get(obj);
1887 if (!win) return EINA_FALSE;
1889 return ecore_evas_transparent_get(win->ee);
1893 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1896 ELM_CHECK_WIDTYPE(obj, widtype);
1897 win = elm_widget_data_get(obj);
1899 ecore_evas_override_set(win->ee, override);
1900 #ifdef HAVE_ELEMENTARY_X
1901 _elm_win_xwin_update(win);
1906 elm_win_override_get(const Evas_Object *obj)
1909 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1910 win = elm_widget_data_get(obj);
1911 if (!win) return EINA_FALSE;
1912 return ecore_evas_override_get(win->ee);
1916 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1919 ELM_CHECK_WIDTYPE(obj, widtype);
1920 win = elm_widget_data_get(obj);
1923 // YYY: handle if win->img_obj
1924 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1925 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1926 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1928 // these engines... can ONLY be fullscreen
1933 ecore_evas_fullscreen_set(win->ee, fullscreen);
1934 #ifdef HAVE_ELEMENTARY_X
1935 _elm_win_xwin_update(win);
1938 #undef ENGINE_COMPARE
1942 elm_win_fullscreen_get(const Evas_Object *obj)
1945 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1946 win = elm_widget_data_get(obj);
1947 if (!win) return EINA_FALSE;
1949 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1950 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1951 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1953 // these engines... can ONLY be fullscreen
1958 return ecore_evas_fullscreen_get(win->ee);
1960 #undef ENGINE_COMPARE
1964 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1967 ELM_CHECK_WIDTYPE(obj, widtype);
1968 win = elm_widget_data_get(obj);
1970 // YYY: handle if win->img_obj
1971 ecore_evas_maximized_set(win->ee, maximized);
1972 #ifdef HAVE_ELEMENTARY_X
1973 _elm_win_xwin_update(win);
1978 elm_win_maximized_get(const Evas_Object *obj)
1981 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1982 win = elm_widget_data_get(obj);
1983 if (!win) return EINA_FALSE;
1984 return ecore_evas_maximized_get(win->ee);
1988 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1991 ELM_CHECK_WIDTYPE(obj, widtype);
1992 win = elm_widget_data_get(obj);
1994 ecore_evas_iconified_set(win->ee, iconified);
1995 #ifdef HAVE_ELEMENTARY_X
1996 _elm_win_xwin_update(win);
2001 elm_win_iconified_get(const Evas_Object *obj)
2004 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2005 win = elm_widget_data_get(obj);
2006 if (!win) return EINA_FALSE;
2007 return ecore_evas_iconified_get(win->ee);
2011 elm_win_layer_set(Evas_Object *obj, int layer)
2014 ELM_CHECK_WIDTYPE(obj, widtype);
2015 win = elm_widget_data_get(obj);
2017 ecore_evas_layer_set(win->ee, layer);
2018 #ifdef HAVE_ELEMENTARY_X
2019 _elm_win_xwin_update(win);
2024 elm_win_layer_get(const Evas_Object *obj)
2027 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2028 win = elm_widget_data_get(obj);
2029 if (!win) return -1;
2030 return ecore_evas_layer_get(win->ee);
2034 elm_win_rotation_set(Evas_Object *obj, int rotation)
2037 ELM_CHECK_WIDTYPE(obj, widtype);
2038 win = elm_widget_data_get(obj);
2040 if (win->rot == rotation) return;
2041 win->rot = rotation;
2042 ecore_evas_rotation_set(win->ee, rotation);
2043 evas_object_size_hint_min_set(obj, -1, -1);
2044 evas_object_size_hint_max_set(obj, -1, -1);
2045 _elm_win_eval_subobjs(obj);
2046 #ifdef HAVE_ELEMENTARY_X
2047 _elm_win_xwin_update(win);
2052 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2055 ELM_CHECK_WIDTYPE(obj, widtype);
2056 win = elm_widget_data_get(obj);
2058 if (win->rot == rotation) return;
2059 win->rot = rotation;
2060 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2061 evas_object_size_hint_min_set(obj, -1, -1);
2062 evas_object_size_hint_max_set(obj, -1, -1);
2063 _elm_win_eval_subobjs(obj);
2064 #ifdef HAVE_ELEMENTARY_X
2065 _elm_win_xwin_update(win);
2070 elm_win_rotation_get(const Evas_Object *obj)
2073 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2074 win = elm_widget_data_get(obj);
2075 if (!win) return -1;
2080 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2083 ELM_CHECK_WIDTYPE(obj, widtype);
2084 win = elm_widget_data_get(obj);
2086 ecore_evas_sticky_set(win->ee, sticky);
2087 #ifdef HAVE_ELEMENTARY_X
2088 _elm_win_xwin_update(win);
2093 elm_win_sticky_get(const Evas_Object *obj)
2096 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2097 win = elm_widget_data_get(obj);
2098 if (!win) return EINA_FALSE;
2099 return ecore_evas_sticky_get(win->ee);
2103 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2106 ELM_CHECK_WIDTYPE(obj, widtype);
2107 win = elm_widget_data_get(obj);
2109 if (mode == win->kbdmode) return;
2110 #ifdef HAVE_ELEMENTARY_X
2111 _elm_win_xwindow_get(win);
2113 win->kbdmode = mode;
2114 #ifdef HAVE_ELEMENTARY_X
2116 ecore_x_e_virtual_keyboard_state_set
2117 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2121 EAPI Elm_Win_Keyboard_Mode
2122 elm_win_keyboard_mode_get(const Evas_Object *obj)
2125 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2126 win = elm_widget_data_get(obj);
2127 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2128 return win->kbdmode;
2132 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2135 ELM_CHECK_WIDTYPE(obj, widtype);
2136 win = elm_widget_data_get(obj);
2138 #ifdef HAVE_ELEMENTARY_X
2139 _elm_win_xwindow_get(win);
2141 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2146 elm_win_keyboard_win_get(const Evas_Object *obj)
2149 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2150 win = elm_widget_data_get(obj);
2151 if (!win) return EINA_FALSE;
2152 #ifdef HAVE_ELEMENTARY_X
2153 _elm_win_xwindow_get(win);
2155 return ecore_x_e_virtual_keyboard_get(win->xwin);
2161 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2164 ELM_CHECK_WIDTYPE(obj, widtype);
2165 win = elm_widget_data_get(obj);
2167 if (x) *x = win->screen.x;
2168 if (y) *y = win->screen.y;
2172 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2175 ELM_CHECK_WIDTYPE(obj, widtype);
2176 win = elm_widget_data_get(obj);
2178 #ifdef HAVE_ELEMENTARY_X
2179 _elm_win_xwindow_get(win);
2181 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2186 elm_win_conformant_get(const Evas_Object *obj)
2189 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2190 win = elm_widget_data_get(obj);
2191 if (!win) return EINA_FALSE;
2192 #ifdef HAVE_ELEMENTARY_X
2193 _elm_win_xwindow_get(win);
2195 return ecore_x_e_illume_conformant_get(win->xwin);
2201 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2204 ELM_CHECK_WIDTYPE(obj, widtype);
2205 win = elm_widget_data_get(obj);
2207 #ifdef HAVE_ELEMENTARY_X
2208 _elm_win_xwindow_get(win);
2211 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2214 Ecore_X_Window_State states[2];
2216 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2217 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2218 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2219 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2226 elm_win_quickpanel_get(const Evas_Object *obj)
2229 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2230 win = elm_widget_data_get(obj);
2231 if (!win) return EINA_FALSE;
2232 #ifdef HAVE_ELEMENTARY_X
2233 _elm_win_xwindow_get(win);
2235 return ecore_x_e_illume_quickpanel_get(win->xwin);
2241 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2244 ELM_CHECK_WIDTYPE(obj, widtype);
2245 win = elm_widget_data_get(obj);
2247 #ifdef HAVE_ELEMENTARY_X
2248 _elm_win_xwindow_get(win);
2250 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2255 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2258 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2259 win = elm_widget_data_get(obj);
2260 if (!win) return -1;
2261 #ifdef HAVE_ELEMENTARY_X
2262 _elm_win_xwindow_get(win);
2264 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2270 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2273 ELM_CHECK_WIDTYPE(obj, widtype);
2274 win = elm_widget_data_get(obj);
2276 #ifdef HAVE_ELEMENTARY_X
2277 _elm_win_xwindow_get(win);
2279 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2284 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2287 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2288 win = elm_widget_data_get(obj);
2289 if (!win) return -1;
2290 #ifdef HAVE_ELEMENTARY_X
2291 _elm_win_xwindow_get(win);
2293 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2299 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2302 ELM_CHECK_WIDTYPE(obj, widtype);
2303 win = elm_widget_data_get(obj);
2305 #ifdef HAVE_ELEMENTARY_X
2306 _elm_win_xwindow_get(win);
2308 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2313 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2316 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2317 win = elm_widget_data_get(obj);
2319 #ifdef HAVE_ELEMENTARY_X
2320 _elm_win_xwindow_get(win);
2322 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2328 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2331 ELM_CHECK_WIDTYPE(obj, widtype);
2332 win = elm_widget_data_get(obj);
2334 #ifdef HAVE_ELEMENTARY_X
2335 _elm_win_xwindow_get(win);
2340 Ecore_X_Window_State states[2];
2342 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2343 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2344 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2345 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2352 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2355 ELM_CHECK_WIDTYPE(obj, widtype);
2356 win = elm_widget_data_get(obj);
2358 #ifdef HAVE_ELEMENTARY_X
2359 _elm_win_xwindow_get(win);
2364 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2365 ecore_x_e_illume_focus_back_send(win->xwin);
2367 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2368 ecore_x_e_illume_focus_forward_send(win->xwin);
2370 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2371 ecore_x_e_illume_focus_home_send(win->xwin);
2373 case ELM_ILLUME_COMMAND_CLOSE:
2374 ecore_x_e_illume_close_send(win->xwin);
2384 elm_win_inlined_image_object_get(Evas_Object *obj)
2387 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2388 win = elm_widget_data_get(obj);
2389 if (!win) return NULL;
2390 return win->img_obj;
2394 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2398 ELM_CHECK_WIDTYPE(obj, widtype);
2400 win = elm_widget_data_get(obj);
2401 enabled = !!enabled;
2402 if (win->focus_highlight.enabled == enabled)
2405 win->focus_highlight.enabled = enabled;
2407 if (win->focus_highlight.enabled)
2408 _elm_win_focus_highlight_init(win);
2410 _elm_win_focus_highlight_shutdown(win);
2414 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2418 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2420 win = elm_widget_data_get(obj);
2421 return win->focus_highlight.enabled;
2425 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2429 ELM_CHECK_WIDTYPE(obj, widtype);
2431 win = elm_widget_data_get(obj);
2432 eina_stringshare_replace(&win->focus_highlight.style, style);
2433 win->focus_highlight.changed_theme = EINA_TRUE;
2434 _elm_win_focus_highlight_reconfigure_job_start(win);
2438 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2442 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2444 win = elm_widget_data_get(obj);
2445 return win->focus_highlight.style;
2448 typedef struct _Widget_Data Widget_Data;
2453 Evas_Object *content;
2456 static void _del_hook(Evas_Object *obj);
2457 static void _theme_hook(Evas_Object *obj);
2458 static void _sizing_eval(Evas_Object *obj);
2459 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2460 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2462 static const char *widtype2 = NULL;
2465 _del_hook(Evas_Object *obj)
2467 Widget_Data *wd = elm_widget_data_get(obj);
2473 _theme_hook(Evas_Object *obj)
2475 Widget_Data *wd = elm_widget_data_get(obj);
2476 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2478 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2481 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2485 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2487 Widget_Data *wd = elm_widget_data_get(obj);
2492 /* Try Focus cycle in subitem */
2495 elm_widget_focus_next_get(wd->content, dir, next);
2500 *next = (Evas_Object *)obj;
2505 _sizing_eval(Evas_Object *obj)
2507 Widget_Data *wd = elm_widget_data_get(obj);
2508 Evas_Coord minw = -1, minh = -1;
2510 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2511 edje_object_size_min_calc(wd->frm, &minw, &minh);
2512 evas_object_size_hint_min_set(obj, minw, minh);
2513 evas_object_size_hint_max_set(obj, -1, -1);
2517 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2523 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2525 Widget_Data *wd = elm_widget_data_get(obj);
2526 Evas_Object *sub = event_info;
2527 if (sub == wd->content)
2529 evas_object_event_callback_del_full
2530 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2537 elm_win_inwin_add(Evas_Object *obj)
2543 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2544 win = elm_widget_data_get(obj);
2545 if (!win) return NULL;
2546 wd = ELM_NEW(Widget_Data);
2547 obj2 = elm_widget_add(win->evas);
2548 elm_widget_type_set(obj2, "inwin");
2549 ELM_SET_WIDTYPE(widtype2, "inwin");
2550 elm_widget_sub_object_add(obj, obj2);
2551 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2552 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2553 elm_win_resize_object_add(obj, obj2);
2555 elm_widget_data_set(obj2, wd);
2556 elm_widget_del_hook_set(obj2, _del_hook);
2557 elm_widget_theme_hook_set(obj2, _theme_hook);
2558 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2559 elm_widget_can_focus_set(obj2, EINA_TRUE);
2560 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2562 wd->frm = edje_object_add(win->evas);
2563 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2564 elm_widget_resize_object_set(obj2, wd->frm);
2566 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2573 elm_win_inwin_activate(Evas_Object *obj)
2575 ELM_CHECK_WIDTYPE(obj, widtype2);
2576 Widget_Data *wd = elm_widget_data_get(obj);
2578 evas_object_raise(obj);
2579 evas_object_show(obj);
2580 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2581 elm_object_focus_set(obj, EINA_TRUE);
2585 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2587 ELM_CHECK_WIDTYPE(obj, widtype2);
2588 Widget_Data *wd = elm_widget_data_get(obj);
2590 if (wd->content == content) return;
2591 if (wd->content) evas_object_del(wd->content);
2592 wd->content = content;
2595 elm_widget_sub_object_add(obj, content);
2596 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2597 _changed_size_hints, obj);
2598 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2604 elm_win_inwin_content_get(const Evas_Object *obj)
2606 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2607 Widget_Data *wd = elm_widget_data_get(obj);
2608 if (!wd) return NULL;
2613 elm_win_inwin_content_unset(Evas_Object *obj)
2615 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2616 Widget_Data *wd = elm_widget_data_get(obj);
2617 if (!wd) return NULL;
2618 if (!wd->content) return NULL;
2619 Evas_Object *content = wd->content;
2620 elm_widget_sub_object_del(obj, wd->content);
2621 evas_object_event_callback_del_full(wd->content,
2622 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2623 _changed_size_hints, obj);
2624 edje_object_part_unswallow(wd->frm, wd->content);
2629 /* windowing spcific calls - shall we do this differently? */
2631 static Ecore_X_Window
2632 _elm_ee_win_get(const Evas_Object *obj)
2635 #ifdef HAVE_ELEMENTARY_X
2636 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2637 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2643 elm_win_xwindow_get(const Evas_Object *obj)
2649 type = elm_widget_type_get(obj);
2650 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
2651 #ifdef HAVE_ELEMENTARY_X
2652 win = elm_widget_data_get(obj);
2654 if (win->xwin) return win->xwin;
2655 if (win->parent) return elm_win_xwindow_get(win->parent);