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_PSL1GHT))
1479 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1480 FALLBACK_TRY("PSL1GHT");
1482 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1484 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1485 FALLBACK_TRY("Sofware SDL");
1487 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1489 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1490 FALLBACK_TRY("Sofware-16-SDL");
1492 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1494 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1495 FALLBACK_TRY("OpenGL SDL");
1497 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1499 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1500 FALLBACK_TRY("OpenGL Cocoa");
1502 else if (ENGINE_COMPARE(ELM_BUFFER))
1504 win->ee = ecore_evas_buffer_new(1, 1);
1506 else if (ENGINE_COMPARE(ELM_EWS))
1508 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1510 else if (!strncmp(_elm_config->engine, "shot:", 5))
1512 win->ee = ecore_evas_buffer_new(1, 1);
1513 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1514 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1523 ERR("Cannot create window.");
1527 #ifdef HAVE_ELEMENTARY_X
1528 _elm_win_xwindow_get(win);
1530 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1531 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1532 // bg pixmap done by x - has other issues like can be redrawn by x before it
1533 // is filled/ready by app
1534 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1537 win->parent = parent;
1539 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1540 _elm_win_obj_callback_parent_del, win);
1542 win->evas = ecore_evas_get(win->ee);
1543 win->win_obj = elm_widget_add(win->evas);
1544 elm_widget_type_set(win->win_obj, "win");
1545 ELM_SET_WIDTYPE(widtype, "win");
1546 elm_widget_data_set(win->win_obj, win);
1547 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1548 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1549 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1550 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1551 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1552 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1553 evas_object_move(win->win_obj, 0, 0);
1554 evas_object_resize(win->win_obj, 1, 1);
1555 evas_object_layer_set(win->win_obj, 50);
1556 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1558 if (type == ELM_WIN_INLINED_IMAGE)
1559 elm_widget_parent2_set(win->win_obj, parent);
1560 ecore_evas_object_associate(win->ee, win->win_obj,
1561 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1562 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1563 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1564 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1565 _elm_win_obj_callback_show, win);
1566 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1567 _elm_win_obj_callback_hide, win);
1568 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1569 _elm_win_obj_callback_del, win);
1570 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1571 _elm_win_obj_callback_move, win);
1572 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1573 _elm_win_obj_callback_resize, win);
1575 evas_object_intercept_move_callback_add(win->win_obj,
1576 _elm_win_obj_intercept_move, win);
1577 evas_object_intercept_show_callback_add(win->win_obj,
1578 _elm_win_obj_intercept_show, win);
1580 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1581 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1582 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1583 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1584 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1585 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1586 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1587 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1588 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1589 evas_font_path_append(win->evas, fontpath);
1590 if (!_elm_config->font_hinting)
1591 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1592 else if (_elm_config->font_hinting == 1)
1593 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1594 else if (_elm_config->font_hinting == 2)
1595 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1597 #ifdef HAVE_ELEMENTARY_X
1598 _elm_win_xwin_update(win);
1601 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1603 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1605 ecore_evas_fullscreen_set(win->ee, 1);
1607 #undef ENGINE_COMPARE
1609 if (_elm_config->focus_highlight_enable)
1610 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1613 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1614 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1615 _debug_key_down, win);
1617 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1619 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1622 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1624 return win->win_obj;
1628 elm_win_util_standard_add(const char *name, const char *title)
1630 Evas_Object *win, *bg;
1632 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1633 if (!win) return NULL;
1634 elm_win_title_set(win, title);
1635 bg = elm_bg_add(win);
1638 evas_object_del(win);
1641 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1642 elm_win_resize_object_add(win, bg);
1643 evas_object_show(bg);
1648 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1652 ELM_CHECK_WIDTYPE(obj, widtype);
1653 win = elm_widget_data_get(obj);
1655 if (eina_list_data_find(win->subobjs, subobj)) return;
1656 win->subobjs = eina_list_append(win->subobjs, subobj);
1657 elm_widget_sub_object_add(obj, subobj);
1658 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1659 _elm_win_subobj_callback_del, obj);
1660 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1661 _elm_win_subobj_callback_changed_size_hints,
1663 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1664 evas_object_move(subobj, 0, 0);
1665 evas_object_resize(subobj, w, h);
1666 _elm_win_eval_subobjs(obj);
1670 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1673 ELM_CHECK_WIDTYPE(obj, widtype);
1674 win = elm_widget_data_get(obj);
1676 evas_object_event_callback_del_full(subobj,
1677 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1678 _elm_win_subobj_callback_changed_size_hints,
1680 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1681 _elm_win_subobj_callback_del, obj);
1682 win->subobjs = eina_list_remove(win->subobjs, subobj);
1683 elm_widget_sub_object_del(obj, subobj);
1684 _elm_win_eval_subobjs(obj);
1688 elm_win_title_set(Evas_Object *obj, const char *title)
1691 ELM_CHECK_WIDTYPE(obj, widtype);
1692 win = elm_widget_data_get(obj);
1694 ecore_evas_title_set(win->ee, title);
1698 elm_win_title_get(const Evas_Object *obj)
1701 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1702 win = elm_widget_data_get(obj);
1703 if (!win) return NULL;
1704 return ecore_evas_title_get(win->ee);
1708 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1711 ELM_CHECK_WIDTYPE(obj, widtype);
1712 win = elm_widget_data_get(obj);
1714 win->autodel = autodel;
1718 elm_win_autodel_get(const Evas_Object *obj)
1721 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1722 win = elm_widget_data_get(obj);
1723 if (!win) return EINA_FALSE;
1724 return win->autodel;
1728 elm_win_activate(Evas_Object *obj)
1731 ELM_CHECK_WIDTYPE(obj, widtype);
1732 win = elm_widget_data_get(obj);
1734 ecore_evas_activate(win->ee);
1738 elm_win_lower(Evas_Object *obj)
1741 ELM_CHECK_WIDTYPE(obj, widtype);
1742 win = elm_widget_data_get(obj);
1744 ecore_evas_lower(win->ee);
1748 elm_win_raise(Evas_Object *obj)
1751 ELM_CHECK_WIDTYPE(obj, widtype);
1752 win = elm_widget_data_get(obj);
1754 ecore_evas_raise(win->ee);
1758 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1761 ELM_CHECK_WIDTYPE(obj, widtype);
1762 win = elm_widget_data_get(obj);
1764 ecore_evas_borderless_set(win->ee, borderless);
1765 #ifdef HAVE_ELEMENTARY_X
1766 _elm_win_xwin_update(win);
1771 elm_win_borderless_get(const Evas_Object *obj)
1774 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1775 win = elm_widget_data_get(obj);
1776 if (!win) return EINA_FALSE;
1777 return ecore_evas_borderless_get(win->ee);
1781 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1784 ELM_CHECK_WIDTYPE(obj, widtype);
1785 win = elm_widget_data_get(obj);
1787 ecore_evas_shaped_set(win->ee, shaped);
1788 #ifdef HAVE_ELEMENTARY_X
1789 _elm_win_xwin_update(win);
1794 elm_win_shaped_get(const Evas_Object *obj)
1797 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1798 win = elm_widget_data_get(obj);
1799 if (!win) return EINA_FALSE;
1800 return ecore_evas_shaped_get(win->ee);
1804 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1807 ELM_CHECK_WIDTYPE(obj, widtype);
1808 win = elm_widget_data_get(obj);
1813 else if (win->img_obj)
1815 evas_object_image_alpha_set(win->img_obj, alpha);
1816 ecore_evas_alpha_set(win->ee, alpha);
1820 #ifdef HAVE_ELEMENTARY_X
1825 if (!_elm_config->compositing)
1826 elm_win_shaped_set(obj, alpha);
1828 ecore_evas_alpha_set(win->ee, alpha);
1831 ecore_evas_alpha_set(win->ee, alpha);
1832 _elm_win_xwin_update(win);
1836 ecore_evas_alpha_set(win->ee, alpha);
1841 elm_win_alpha_get(const Evas_Object *obj)
1844 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1845 win = elm_widget_data_get(obj);
1846 if (!win) return EINA_FALSE;
1850 else if (win->img_obj)
1852 return evas_object_image_alpha_get(win->img_obj);
1854 return ecore_evas_alpha_get(win->ee);
1858 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1861 ELM_CHECK_WIDTYPE(obj, widtype);
1862 win = elm_widget_data_get(obj);
1868 else if (win->img_obj)
1870 evas_object_image_alpha_set(win->img_obj, transparent);
1874 #ifdef HAVE_ELEMENTARY_X
1877 ecore_evas_transparent_set(win->ee, transparent);
1878 _elm_win_xwin_update(win);
1882 ecore_evas_transparent_set(win->ee, transparent);
1887 elm_win_transparent_get(const Evas_Object *obj)
1890 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1891 win = elm_widget_data_get(obj);
1892 if (!win) return EINA_FALSE;
1894 return ecore_evas_transparent_get(win->ee);
1898 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1901 ELM_CHECK_WIDTYPE(obj, widtype);
1902 win = elm_widget_data_get(obj);
1904 ecore_evas_override_set(win->ee, override);
1905 #ifdef HAVE_ELEMENTARY_X
1906 _elm_win_xwin_update(win);
1911 elm_win_override_get(const Evas_Object *obj)
1914 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1915 win = elm_widget_data_get(obj);
1916 if (!win) return EINA_FALSE;
1917 return ecore_evas_override_get(win->ee);
1921 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1924 ELM_CHECK_WIDTYPE(obj, widtype);
1925 win = elm_widget_data_get(obj);
1928 // YYY: handle if win->img_obj
1929 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1930 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1931 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1933 // these engines... can ONLY be fullscreen
1938 ecore_evas_fullscreen_set(win->ee, fullscreen);
1939 #ifdef HAVE_ELEMENTARY_X
1940 _elm_win_xwin_update(win);
1943 #undef ENGINE_COMPARE
1947 elm_win_fullscreen_get(const Evas_Object *obj)
1950 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1951 win = elm_widget_data_get(obj);
1952 if (!win) return EINA_FALSE;
1954 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1955 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1956 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1958 // these engines... can ONLY be fullscreen
1963 return ecore_evas_fullscreen_get(win->ee);
1965 #undef ENGINE_COMPARE
1969 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1972 ELM_CHECK_WIDTYPE(obj, widtype);
1973 win = elm_widget_data_get(obj);
1975 // YYY: handle if win->img_obj
1976 ecore_evas_maximized_set(win->ee, maximized);
1977 #ifdef HAVE_ELEMENTARY_X
1978 _elm_win_xwin_update(win);
1983 elm_win_maximized_get(const Evas_Object *obj)
1986 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1987 win = elm_widget_data_get(obj);
1988 if (!win) return EINA_FALSE;
1989 return ecore_evas_maximized_get(win->ee);
1993 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1996 ELM_CHECK_WIDTYPE(obj, widtype);
1997 win = elm_widget_data_get(obj);
1999 ecore_evas_iconified_set(win->ee, iconified);
2000 #ifdef HAVE_ELEMENTARY_X
2001 _elm_win_xwin_update(win);
2006 elm_win_iconified_get(const Evas_Object *obj)
2009 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2010 win = elm_widget_data_get(obj);
2011 if (!win) return EINA_FALSE;
2012 return ecore_evas_iconified_get(win->ee);
2016 elm_win_layer_set(Evas_Object *obj, int layer)
2019 ELM_CHECK_WIDTYPE(obj, widtype);
2020 win = elm_widget_data_get(obj);
2022 ecore_evas_layer_set(win->ee, layer);
2023 #ifdef HAVE_ELEMENTARY_X
2024 _elm_win_xwin_update(win);
2029 elm_win_layer_get(const Evas_Object *obj)
2032 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2033 win = elm_widget_data_get(obj);
2034 if (!win) return -1;
2035 return ecore_evas_layer_get(win->ee);
2039 elm_win_rotation_set(Evas_Object *obj, int rotation)
2042 ELM_CHECK_WIDTYPE(obj, widtype);
2043 win = elm_widget_data_get(obj);
2045 if (win->rot == rotation) return;
2046 win->rot = rotation;
2047 ecore_evas_rotation_set(win->ee, rotation);
2048 evas_object_size_hint_min_set(obj, -1, -1);
2049 evas_object_size_hint_max_set(obj, -1, -1);
2050 _elm_win_eval_subobjs(obj);
2051 #ifdef HAVE_ELEMENTARY_X
2052 _elm_win_xwin_update(win);
2057 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2060 ELM_CHECK_WIDTYPE(obj, widtype);
2061 win = elm_widget_data_get(obj);
2063 if (win->rot == rotation) return;
2064 win->rot = rotation;
2065 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2066 evas_object_size_hint_min_set(obj, -1, -1);
2067 evas_object_size_hint_max_set(obj, -1, -1);
2068 _elm_win_eval_subobjs(obj);
2069 #ifdef HAVE_ELEMENTARY_X
2070 _elm_win_xwin_update(win);
2075 elm_win_rotation_get(const Evas_Object *obj)
2078 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2079 win = elm_widget_data_get(obj);
2080 if (!win) return -1;
2085 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2088 ELM_CHECK_WIDTYPE(obj, widtype);
2089 win = elm_widget_data_get(obj);
2091 ecore_evas_sticky_set(win->ee, sticky);
2092 #ifdef HAVE_ELEMENTARY_X
2093 _elm_win_xwin_update(win);
2098 elm_win_sticky_get(const Evas_Object *obj)
2101 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2102 win = elm_widget_data_get(obj);
2103 if (!win) return EINA_FALSE;
2104 return ecore_evas_sticky_get(win->ee);
2108 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2111 ELM_CHECK_WIDTYPE(obj, widtype);
2112 win = elm_widget_data_get(obj);
2114 if (mode == win->kbdmode) return;
2115 #ifdef HAVE_ELEMENTARY_X
2116 _elm_win_xwindow_get(win);
2118 win->kbdmode = mode;
2119 #ifdef HAVE_ELEMENTARY_X
2121 ecore_x_e_virtual_keyboard_state_set
2122 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2126 EAPI Elm_Win_Keyboard_Mode
2127 elm_win_keyboard_mode_get(const Evas_Object *obj)
2130 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2131 win = elm_widget_data_get(obj);
2132 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2133 return win->kbdmode;
2137 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2140 ELM_CHECK_WIDTYPE(obj, widtype);
2141 win = elm_widget_data_get(obj);
2143 #ifdef HAVE_ELEMENTARY_X
2144 _elm_win_xwindow_get(win);
2146 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2151 elm_win_keyboard_win_get(const Evas_Object *obj)
2154 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2155 win = elm_widget_data_get(obj);
2156 if (!win) return EINA_FALSE;
2157 #ifdef HAVE_ELEMENTARY_X
2158 _elm_win_xwindow_get(win);
2160 return ecore_x_e_virtual_keyboard_get(win->xwin);
2166 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2169 ELM_CHECK_WIDTYPE(obj, widtype);
2170 win = elm_widget_data_get(obj);
2172 if (x) *x = win->screen.x;
2173 if (y) *y = win->screen.y;
2177 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2180 ELM_CHECK_WIDTYPE(obj, widtype);
2181 win = elm_widget_data_get(obj);
2183 #ifdef HAVE_ELEMENTARY_X
2184 _elm_win_xwindow_get(win);
2186 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2191 elm_win_conformant_get(const Evas_Object *obj)
2194 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2195 win = elm_widget_data_get(obj);
2196 if (!win) return EINA_FALSE;
2197 #ifdef HAVE_ELEMENTARY_X
2198 _elm_win_xwindow_get(win);
2200 return ecore_x_e_illume_conformant_get(win->xwin);
2206 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2209 ELM_CHECK_WIDTYPE(obj, widtype);
2210 win = elm_widget_data_get(obj);
2212 #ifdef HAVE_ELEMENTARY_X
2213 _elm_win_xwindow_get(win);
2216 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2219 Ecore_X_Window_State states[2];
2221 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2222 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2223 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2224 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2231 elm_win_quickpanel_get(const Evas_Object *obj)
2234 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2235 win = elm_widget_data_get(obj);
2236 if (!win) return EINA_FALSE;
2237 #ifdef HAVE_ELEMENTARY_X
2238 _elm_win_xwindow_get(win);
2240 return ecore_x_e_illume_quickpanel_get(win->xwin);
2246 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2249 ELM_CHECK_WIDTYPE(obj, widtype);
2250 win = elm_widget_data_get(obj);
2252 #ifdef HAVE_ELEMENTARY_X
2253 _elm_win_xwindow_get(win);
2255 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2260 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2263 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2264 win = elm_widget_data_get(obj);
2265 if (!win) return -1;
2266 #ifdef HAVE_ELEMENTARY_X
2267 _elm_win_xwindow_get(win);
2269 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2275 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2278 ELM_CHECK_WIDTYPE(obj, widtype);
2279 win = elm_widget_data_get(obj);
2281 #ifdef HAVE_ELEMENTARY_X
2282 _elm_win_xwindow_get(win);
2284 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2289 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2292 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2293 win = elm_widget_data_get(obj);
2294 if (!win) return -1;
2295 #ifdef HAVE_ELEMENTARY_X
2296 _elm_win_xwindow_get(win);
2298 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2304 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2307 ELM_CHECK_WIDTYPE(obj, widtype);
2308 win = elm_widget_data_get(obj);
2310 #ifdef HAVE_ELEMENTARY_X
2311 _elm_win_xwindow_get(win);
2313 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2318 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2321 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2322 win = elm_widget_data_get(obj);
2324 #ifdef HAVE_ELEMENTARY_X
2325 _elm_win_xwindow_get(win);
2327 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2333 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2336 ELM_CHECK_WIDTYPE(obj, widtype);
2337 win = elm_widget_data_get(obj);
2339 #ifdef HAVE_ELEMENTARY_X
2340 _elm_win_xwindow_get(win);
2345 Ecore_X_Window_State states[2];
2347 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2348 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2349 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2350 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2357 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2360 ELM_CHECK_WIDTYPE(obj, widtype);
2361 win = elm_widget_data_get(obj);
2363 #ifdef HAVE_ELEMENTARY_X
2364 _elm_win_xwindow_get(win);
2369 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2370 ecore_x_e_illume_focus_back_send(win->xwin);
2372 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2373 ecore_x_e_illume_focus_forward_send(win->xwin);
2375 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2376 ecore_x_e_illume_focus_home_send(win->xwin);
2378 case ELM_ILLUME_COMMAND_CLOSE:
2379 ecore_x_e_illume_close_send(win->xwin);
2389 elm_win_inlined_image_object_get(Evas_Object *obj)
2392 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2393 win = elm_widget_data_get(obj);
2394 if (!win) return NULL;
2395 return win->img_obj;
2399 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2403 ELM_CHECK_WIDTYPE(obj, widtype);
2405 win = elm_widget_data_get(obj);
2406 enabled = !!enabled;
2407 if (win->focus_highlight.enabled == enabled)
2410 win->focus_highlight.enabled = enabled;
2412 if (win->focus_highlight.enabled)
2413 _elm_win_focus_highlight_init(win);
2415 _elm_win_focus_highlight_shutdown(win);
2419 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2423 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2425 win = elm_widget_data_get(obj);
2426 return win->focus_highlight.enabled;
2430 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2434 ELM_CHECK_WIDTYPE(obj, widtype);
2436 win = elm_widget_data_get(obj);
2437 eina_stringshare_replace(&win->focus_highlight.style, style);
2438 win->focus_highlight.changed_theme = EINA_TRUE;
2439 _elm_win_focus_highlight_reconfigure_job_start(win);
2443 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2447 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2449 win = elm_widget_data_get(obj);
2450 return win->focus_highlight.style;
2453 typedef struct _Widget_Data Widget_Data;
2458 Evas_Object *content;
2461 static void _del_hook(Evas_Object *obj);
2462 static void _theme_hook(Evas_Object *obj);
2463 static void _sizing_eval(Evas_Object *obj);
2464 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2465 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2467 static const char *widtype2 = NULL;
2470 _del_hook(Evas_Object *obj)
2472 Widget_Data *wd = elm_widget_data_get(obj);
2478 _theme_hook(Evas_Object *obj)
2480 Widget_Data *wd = elm_widget_data_get(obj);
2481 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2483 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2486 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2490 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2492 Widget_Data *wd = elm_widget_data_get(obj);
2497 /* Try Focus cycle in subitem */
2500 elm_widget_focus_next_get(wd->content, dir, next);
2505 *next = (Evas_Object *)obj;
2510 _sizing_eval(Evas_Object *obj)
2512 Widget_Data *wd = elm_widget_data_get(obj);
2513 Evas_Coord minw = -1, minh = -1;
2515 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2516 edje_object_size_min_calc(wd->frm, &minw, &minh);
2517 evas_object_size_hint_min_set(obj, minw, minh);
2518 evas_object_size_hint_max_set(obj, -1, -1);
2522 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2528 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2530 Widget_Data *wd = elm_widget_data_get(obj);
2531 Evas_Object *sub = event_info;
2532 if (sub == wd->content)
2534 evas_object_event_callback_del_full
2535 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2542 elm_win_inwin_add(Evas_Object *obj)
2548 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2549 win = elm_widget_data_get(obj);
2550 if (!win) return NULL;
2551 wd = ELM_NEW(Widget_Data);
2552 obj2 = elm_widget_add(win->evas);
2553 elm_widget_type_set(obj2, "inwin");
2554 ELM_SET_WIDTYPE(widtype2, "inwin");
2555 elm_widget_sub_object_add(obj, obj2);
2556 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2557 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2558 elm_win_resize_object_add(obj, obj2);
2560 elm_widget_data_set(obj2, wd);
2561 elm_widget_del_hook_set(obj2, _del_hook);
2562 elm_widget_theme_hook_set(obj2, _theme_hook);
2563 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2564 elm_widget_can_focus_set(obj2, EINA_TRUE);
2565 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2567 wd->frm = edje_object_add(win->evas);
2568 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2569 elm_widget_resize_object_set(obj2, wd->frm);
2571 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2578 elm_win_inwin_activate(Evas_Object *obj)
2580 ELM_CHECK_WIDTYPE(obj, widtype2);
2581 Widget_Data *wd = elm_widget_data_get(obj);
2583 evas_object_raise(obj);
2584 evas_object_show(obj);
2585 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2586 elm_object_focus_set(obj, EINA_TRUE);
2590 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2592 ELM_CHECK_WIDTYPE(obj, widtype2);
2593 Widget_Data *wd = elm_widget_data_get(obj);
2595 if (wd->content == content) return;
2596 if (wd->content) evas_object_del(wd->content);
2597 wd->content = content;
2600 elm_widget_sub_object_add(obj, content);
2601 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2602 _changed_size_hints, obj);
2603 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2609 elm_win_inwin_content_get(const Evas_Object *obj)
2611 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2612 Widget_Data *wd = elm_widget_data_get(obj);
2613 if (!wd) return NULL;
2618 elm_win_inwin_content_unset(Evas_Object *obj)
2620 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2621 Widget_Data *wd = elm_widget_data_get(obj);
2622 if (!wd) return NULL;
2623 if (!wd->content) return NULL;
2624 Evas_Object *content = wd->content;
2625 elm_widget_sub_object_del(obj, wd->content);
2626 evas_object_event_callback_del_full(wd->content,
2627 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2628 _changed_size_hints, obj);
2629 edje_object_part_unswallow(wd->frm, wd->content);
2634 /* windowing spcific calls - shall we do this differently? */
2636 static Ecore_X_Window
2637 _elm_ee_win_get(const Evas_Object *obj)
2640 #ifdef HAVE_ELEMENTARY_X
2641 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2642 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2648 elm_win_xwindow_get(const Evas_Object *obj)
2654 type = elm_widget_type_get(obj);
2655 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
2656 #ifdef HAVE_ELEMENTARY_X
2657 win = elm_widget_data_get(obj);
2659 if (win->xwin) return win->xwin;
2660 if (win->parent) return elm_win_xwindow_get(win->parent);