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;
38 Eina_Bool visible : 1;
39 Eina_Bool handled : 1;
43 Ecore_Job *reconf_job;
45 Eina_Bool enabled : 1;
46 Eina_Bool changed_theme : 1;
47 Eina_Bool top_animate : 1;
48 Eina_Bool geometry_changed : 1;
52 static const char *widtype = NULL;
53 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
54 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
55 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
56 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
57 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
58 static void _elm_win_move(Ecore_Evas *ee);
59 static void _elm_win_resize(Ecore_Evas *ee);
60 static void _elm_win_delete_request(Ecore_Evas *ee);
61 static void _elm_win_resize_job(void *data);
62 #ifdef HAVE_ELEMENTARY_X
63 static void _elm_win_xwin_update(Elm_Win *win);
65 static void _elm_win_eval_subobjs(Evas_Object *obj);
66 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
67 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
68 static void _elm_win_focus_highlight_init(Elm_Win *win);
69 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
70 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
71 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
72 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
73 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
74 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
76 static const char SIG_DELETE_REQUEST[] = "delete,request";
77 static const char SIG_FOCUS_OUT[] = "focus,out";
78 static const char SIG_FOCUS_IN[] = "focus,in";
79 static const char SIG_MOVED[] = "moved";
81 static const Evas_Smart_Cb_Description _signals[] = {
82 {SIG_DELETE_REQUEST, ""},
91 Eina_List *_elm_win_list = NULL;
92 int _elm_win_deferred_free = 0;
94 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
95 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
98 _shot_delay_get(Elm_Win *win)
101 char *d = strdup(win->shot.info);
104 for (p = (char *)win->shot.info; *p; p++)
106 if (!strncmp(p, "delay=", 6))
110 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
125 _shot_file_get(Elm_Win *win)
128 char *tmp = strdup(win->shot.info);
129 char *repname = NULL;
131 if (!tmp) return NULL;
133 for (p = (char *)win->shot.info; *p; p++)
135 if (!strncmp(p, "file=", 5))
138 if (!win->shot.repeat_count) return tmp;
141 char *dotptr = strrchr(tmp, '.');
144 repname = malloc(sizeof(char)*(strlen(tmp) + 16));
145 strncpy(repname, tmp, dotptr - tmp);
146 sprintf(repname + (dotptr - tmp), "%03i",
147 win->shot.shot_counter + 1);
148 strcat(repname, dotptr);
155 if (!win->shot.repeat_count) return strdup("out.png");
158 repname = malloc(sizeof(char) * 24);
159 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
165 _shot_repeat_count_get(Elm_Win *win)
169 char *d = strdup(win->shot.info);
172 for (p = (char *)win->shot.info; *p; p++)
174 if (!strncmp(p, "repeat=", 7))
178 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
185 if (v > 1000) v = 999;
195 _shot_key_get(Elm_Win *win __UNUSED__)
201 _shot_flags_get(Elm_Win *win __UNUSED__)
207 _shot_do(Elm_Win *win)
211 unsigned int *pixels;
213 char *file, *key, *flags;
215 ecore_evas_manual_render(win->ee);
216 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
218 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
219 if ((w < 1) || (h < 1)) return;
220 file = _shot_file_get(win);
222 key = _shot_key_get(win);
223 flags = _shot_flags_get(win);
224 ee = ecore_evas_buffer_new(1, 1);
225 o = evas_object_image_add(ecore_evas_get(ee));
226 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
227 evas_object_image_size_set(o, w, h);
228 evas_object_image_data_set(o, pixels);
229 if (!evas_object_image_save(o, file, key, flags))
231 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
236 if (flags) free(flags);
238 if (win->shot.repeat_count) win->shot.shot_counter++;
242 _shot_delay(void *data)
246 if (win->shot.repeat_count)
248 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
249 if (remainshot > 0) return EINA_TRUE;
251 win->shot.timer = NULL;
257 _shot_init(Elm_Win *win)
259 if (!win->shot.info) return;
260 win->shot.repeat_count = _shot_repeat_count_get(win);
261 win->shot.shot_counter = 0;
265 _shot_handle(Elm_Win *win)
267 if (!win->shot.info) return;
268 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
272 _elm_win_move(Ecore_Evas *ee)
274 Evas_Object *obj = ecore_evas_object_associate_get(ee);
279 win = elm_widget_data_get(obj);
281 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
284 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
288 _elm_win_resize(Ecore_Evas *ee)
290 Evas_Object *obj = ecore_evas_object_associate_get(ee);
294 win = elm_widget_data_get(obj);
296 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
297 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
301 _elm_win_focus_in(Ecore_Evas *ee)
303 Evas_Object *obj = ecore_evas_object_associate_get(ee);
307 win = elm_widget_data_get(obj);
309 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
310 win->focus_highlight.cur.visible = EINA_TRUE;
311 _elm_win_focus_highlight_reconfigure_job_start(win);
315 else if (win->img_obj)
322 _elm_win_focus_out(Ecore_Evas *ee)
324 Evas_Object *obj = ecore_evas_object_associate_get(ee);
328 win = elm_widget_data_get(obj);
330 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
331 win->focus_highlight.cur.visible = EINA_FALSE;
332 _elm_win_focus_highlight_reconfigure_job_start(win);
336 else if (win->img_obj)
343 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
345 Elm_Win *wd = elm_widget_data_get(obj);
346 const Eina_List *items;
347 void *(*list_data_get) (const Eina_List *list);
355 if (!(items = elm_widget_focus_custom_chain_get(obj)))
361 list_data_get = eina_list_data_get;
363 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
369 *next = (Evas_Object *)obj;
374 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
376 Elm_Win *win = elm_widget_data_get(obj);
380 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
382 evas_object_focus_set(obj, elm_widget_focus_get(obj));
386 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
388 if (type == EVAS_CALLBACK_KEY_DOWN)
390 Evas_Event_Key_Down *ev = event_info;
391 if (!strcmp(ev->keyname, "Tab"))
393 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
394 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
396 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
397 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
406 _deferred_ecore_evas_free(void *data)
408 ecore_evas_free(data);
409 _elm_win_deferred_free--;
413 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
417 elm_object_focus(obj);
418 if (win->shot.info) _shot_handle(win);
422 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
429 else if (win->img_obj)
431 evas_object_hide(win->img_obj);
436 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
443 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
444 _elm_win_obj_callback_parent_del, win);
447 if (win->autodel_clear) *(win->autodel_clear) = -1;
448 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
449 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
452 ecore_evas_callback_delete_request_set(win->ee, NULL);
453 ecore_evas_callback_resize_set(win->ee, NULL);
455 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
456 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
457 if (win->shot.info) eina_stringshare_del(win->shot.info);
458 if (win->shot.timer) ecore_timer_del(win->shot.timer);
459 while (((child = evas_object_bottom_get(win->evas))) &&
462 evas_object_del(child);
464 while (((child = evas_object_top_get(win->evas))) &&
467 evas_object_del(child);
469 #ifdef HAVE_ELEMENTARY_X
470 if (win->client_message_handler)
471 ecore_event_handler_del(win->client_message_handler);
473 // FIXME: Why are we flushing edje on every window destroy ??
474 // edje_file_cache_flush();
475 // edje_collection_cache_flush();
476 // evas_image_cache_flush(win->evas);
477 // evas_font_cache_flush(win->evas);
478 // FIXME: we are in the del handler for the object and delete the canvas
479 // that lives under it from the handler... nasty. deferring doesn't help either
489 ecore_job_add(_deferred_ecore_evas_free, win->ee);
490 _elm_win_deferred_free++;
494 _elm_win_focus_highlight_shutdown(win);
495 eina_stringshare_del(win->focus_highlight.style);
499 if ((!_elm_win_list) &&
500 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
502 edje_file_cache_flush();
503 edje_collection_cache_flush();
504 evas_image_cache_flush(e);
505 evas_font_cache_flush(e);
511 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
514 if (!win->img_obj) return;
515 evas_object_event_callback_del_full
516 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
517 evas_object_del(win->img_obj);
521 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
524 if (obj == win->parent) win->parent = NULL;
528 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
534 if ((x != win->screen.x) || (y != win->screen.y))
538 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
543 evas_object_move(obj, x, y);
548 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
551 // this is called to make sure all smart containers have calculated their
552 // sizes BEFORE we show the window to make sure it initially appears at
553 // our desired size (ie min size is known first)
554 evas_smart_objects_calculate(evas_object_evas_get(obj));
555 evas_object_show(obj);
559 else if (win->img_obj)
561 evas_object_show(win->img_obj);
566 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
570 if (ecore_evas_override_get(win->ee))
574 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
577 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
582 else if (win->img_obj)
586 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
589 // evas_object_move(win->img_obj, x, y);
594 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
601 else if (win->img_obj)
603 Evas_Coord w = 1, h = 1;
605 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
608 evas_object_image_size_set(win->img_obj, w, h);
613 _elm_win_delete_request(Ecore_Evas *ee)
615 Evas_Object *obj = ecore_evas_object_associate_get(ee);
617 if (strcmp(elm_widget_type_get(obj), "win")) return;
619 win = elm_widget_data_get(obj);
621 int autodel = win->autodel;
622 win->autodel_clear = &autodel;
623 evas_object_ref(win->win_obj);
624 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
625 // FIXME: if above callback deletes - then the below will be invalid
626 if (autodel) evas_object_del(win->win_obj);
627 else win->autodel_clear = NULL;
628 evas_object_unref(win->win_obj);
632 _elm_win_resize_job(void *data)
639 win->deferred_resize_job = NULL;
640 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
641 evas_object_resize(win->win_obj, w, h);
645 else if (win->img_obj)
648 EINA_LIST_FOREACH(win->subobjs, l, obj)
650 evas_object_move(obj, 0, 0);
651 evas_object_resize(obj, w, h);
655 #ifdef HAVE_ELEMENTARY_X
657 _elm_win_xwindow_get(Elm_Win *win)
661 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
662 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
664 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
666 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
667 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
668 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
669 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
670 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
671 ENGINE_COMPARE(ELM_OPENGL_SDL))
674 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
676 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
678 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
680 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
683 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
685 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
688 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
690 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
692 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
694 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
696 #undef ENGINE_COMPARE
700 #ifdef HAVE_ELEMENTARY_X
702 _elm_win_xwin_update(Elm_Win *win)
704 _elm_win_xwindow_get(win);
709 win2 = elm_widget_data_get(win->parent);
713 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
717 if (!win->xwin) return; /* nothing more to do */
722 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
724 case ELM_WIN_DIALOG_BASIC:
725 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
727 case ELM_WIN_DESKTOP:
728 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
731 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
733 case ELM_WIN_TOOLBAR:
734 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
737 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
739 case ELM_WIN_UTILITY:
740 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
743 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
745 case ELM_WIN_DROPDOWN_MENU:
746 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
748 case ELM_WIN_POPUP_MENU:
749 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
751 case ELM_WIN_TOOLTIP:
752 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
754 case ELM_WIN_NOTIFICATION:
755 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
758 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
761 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
766 ecore_x_e_virtual_keyboard_state_set
767 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
772 _elm_win_eval_subobjs(Evas_Object *obj)
775 const Evas_Object *child;
777 Elm_Win *win = elm_widget_data_get(obj);
778 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
782 EINA_LIST_FOREACH(win->subobjs, l, child)
784 evas_object_size_hint_weight_get(child, &wx, &wy);
785 if (wx == 0.0) xx = 0;
786 if (wy == 0.0) xy = 0;
788 evas_object_size_hint_min_get(child, &w, &h);
791 if (w > minw) minw = w;
792 if (h > minh) minh = h;
794 evas_object_size_hint_max_get(child, &w, &h);
797 if (maxw == -1) maxw = w;
798 else if ((w > 0) && (w < maxw)) maxw = w;
799 if (maxh == -1) maxh = h;
800 else if ((h > 0) && (h < maxh)) maxh = h;
802 if (!xx) maxw = minw;
804 if (!xy) maxh = minh;
806 evas_object_size_hint_min_set(obj, minw, minh);
807 evas_object_size_hint_max_set(obj, maxw, maxh);
808 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
809 if (w < minw) w = minw;
810 if (h < minh) h = minh;
811 if ((maxw >= 0) && (w > maxw)) w = maxw;
812 if ((maxh >= 0) && (h > maxh)) h = maxh;
813 evas_object_resize(obj, w, h);
817 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
819 Elm_Win *win = elm_widget_data_get(data);
820 win->subobjs = eina_list_remove(win->subobjs, obj);
821 _elm_win_eval_subobjs(win->win_obj);
825 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
827 _elm_win_eval_subobjs(data);
831 _elm_win_shutdown(void)
833 while (_elm_win_list)
834 evas_object_del(_elm_win_list->data);
838 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
845 EINA_LIST_FOREACH(_elm_win_list, l, obj)
846 elm_widget_theme(obj);
850 EINA_LIST_FOREACH(_elm_win_list, l, obj)
851 elm_widget_theme_specific(obj, th, EINA_FALSE);
855 #ifdef HAVE_ELEMENTARY_X
857 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
860 Ecore_X_Event_Client_Message *e = event;
862 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
863 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
865 if ((unsigned)e->data.l[0] == win->xwin)
867 Evas *evas = evas_object_evas_get(win->win_obj);
870 edje_file_cache_flush();
871 edje_collection_cache_flush();
872 evas_image_cache_flush(evas);
873 evas_font_cache_flush(evas);
877 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
879 if ((unsigned)e->data.l[0] == win->xwin)
881 Evas *evas = evas_object_evas_get(win->win_obj);
884 edje_file_cache_flush();
885 edje_collection_cache_flush();
886 evas_image_cache_flush(evas);
887 evas_font_cache_flush(evas);
888 evas_render_dump(evas);
892 return ECORE_CALLBACK_PASS_ON;
897 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
901 win->focus_highlight.geometry_changed = EINA_TRUE;
902 _elm_win_focus_highlight_reconfigure_job_start(win);
906 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
910 win->focus_highlight.geometry_changed = EINA_TRUE;
911 _elm_win_focus_highlight_reconfigure_job_start(win);
915 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
919 win->focus_highlight.cur.target = NULL;
921 _elm_win_focus_highlight_reconfigure_job_start(win);
925 _elm_win_focus_target_callbacks_add(Elm_Win *win)
927 Evas_Object *obj = win->focus_highlight.cur.target;
929 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
930 _elm_win_focus_target_move, win);
931 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
932 _elm_win_focus_target_resize, win);
933 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
934 _elm_win_focus_target_del, win);
938 _elm_win_focus_target_callbacks_del(Elm_Win *win)
940 Evas_Object *obj = win->focus_highlight.cur.target;
942 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
943 _elm_win_focus_target_move, win);
944 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
945 _elm_win_focus_target_resize, win);
946 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
947 _elm_win_focus_target_del, win);
951 _elm_win_focus_target_get(Evas_Object *obj)
953 Evas_Object *o = obj;
957 if (elm_widget_is(o))
959 if (!elm_widget_highlight_ignore_get(o))
961 o = elm_widget_parent_get(o);
963 o = evas_object_smart_parent_get(o);
967 o = elm_widget_parent_widget_get(o);
969 o = evas_object_smart_parent_get(o);
978 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
980 Evas_Object *obj = event_info, *target;
983 if (win->focus_highlight.cur.target == obj)
986 target = _elm_win_focus_target_get(obj);
987 win->focus_highlight.cur.target = target;
988 if (elm_widget_highlight_in_theme_get(target))
989 win->focus_highlight.cur.handled = EINA_TRUE;
991 _elm_win_focus_target_callbacks_add(win);
993 _elm_win_focus_highlight_reconfigure_job_start(win);
997 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1001 if (!win->focus_highlight.cur.target)
1004 if (!win->focus_highlight.cur.handled)
1005 _elm_win_focus_target_callbacks_del(win);
1006 win->focus_highlight.cur.target = NULL;
1007 win->focus_highlight.cur.handled = EINA_FALSE;
1009 _elm_win_focus_highlight_reconfigure_job_start(win);
1013 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1015 evas_object_hide(obj);
1019 _elm_win_focus_highlight_init(Elm_Win *win)
1021 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1022 _elm_win_object_focus_in, win);
1023 evas_event_callback_add(win->evas,
1024 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1025 _elm_win_object_focus_out, win);
1027 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1029 win->focus_highlight.top = edje_object_add(win->evas);
1030 win->focus_highlight.changed_theme = EINA_TRUE;
1031 edje_object_signal_callback_add(win->focus_highlight.top,
1032 "elm,action,focus,hide,end", "",
1033 _elm_win_focus_highlight_hide, NULL);
1034 edje_object_signal_callback_add(win->focus_highlight.top,
1035 "elm,action,focus,anim,end", "",
1036 _elm_win_focus_highlight_anim_end, win);
1037 _elm_win_focus_highlight_reconfigure_job_start(win);
1041 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1043 _elm_win_focus_highlight_reconfigure_job_stop(win);
1044 if (win->focus_highlight.cur.target)
1046 _elm_win_focus_target_callbacks_del(win);
1047 win->focus_highlight.cur.target = NULL;
1049 if (win->focus_highlight.top)
1051 evas_object_del(win->focus_highlight.top);
1052 win->focus_highlight.top = NULL;
1055 evas_event_callback_del_full(win->evas,
1056 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1057 _elm_win_object_focus_in, win);
1058 evas_event_callback_del_full(win->evas,
1059 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1060 _elm_win_object_focus_out, win);
1064 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1068 top = win->focus_highlight.top;
1073 evas_object_show(top);
1074 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1080 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1085 _elm_win_focus_highlight_reconfigure_job(void *data)
1087 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1091 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1093 if (win->focus_highlight.reconf_job)
1094 ecore_job_del(win->focus_highlight.reconf_job);
1095 win->focus_highlight.reconf_job = ecore_job_add(
1096 _elm_win_focus_highlight_reconfigure_job, win);
1100 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1102 if (win->focus_highlight.reconf_job)
1103 ecore_job_del(win->focus_highlight.reconf_job);
1104 win->focus_highlight.reconf_job = NULL;
1108 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1110 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1111 Evas_Coord x, y, w, h;
1113 clip = evas_object_clip_get(target);
1114 evas_object_geometry_get(target, &x, &y, &w, &h);
1116 evas_object_move(obj, x, y);
1117 evas_object_resize(obj, w, h);
1118 evas_object_clip_set(obj, clip);
1122 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1124 Evas_Coord tx, ty, tw, th;
1125 Evas_Coord w, h, px, py, pw, ph;
1126 Edje_Message_Int_Set *m;
1127 Evas_Object *previous = win->focus_highlight.prev.target;
1128 Evas_Object *target = win->focus_highlight.cur.target;
1130 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1131 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1132 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1133 evas_object_move(obj, 0, 0);
1134 evas_object_resize(obj, tw, th);
1135 evas_object_clip_unset(obj);
1137 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1147 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1151 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1153 Elm_Win *win = data;
1154 _elm_win_focus_highlight_simple_setup(win, obj);
1158 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1160 Evas_Object *target = win->focus_highlight.cur.target;
1161 Evas_Object *previous = win->focus_highlight.prev.target;
1162 Evas_Object *top = win->focus_highlight.top;
1163 Eina_Bool visible_changed;
1164 Eina_Bool common_visible;
1165 const char *sig = NULL;
1167 _elm_win_focus_highlight_reconfigure_job_stop(win);
1169 visible_changed = (win->focus_highlight.cur.visible !=
1170 win->focus_highlight.prev.visible);
1172 if ((target == previous) && (!visible_changed) &&
1173 (!win->focus_highlight.geometry_changed))
1176 if ((previous) && (win->focus_highlight.prev.handled))
1177 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1180 common_visible = EINA_FALSE;
1181 else if (win->focus_highlight.cur.handled)
1183 common_visible = EINA_FALSE;
1184 if (win->focus_highlight.cur.visible)
1185 sig = "elm,action,focus_highlight,show";
1187 sig = "elm,action,focus_highlight,hide";
1190 common_visible = win->focus_highlight.cur.visible;
1192 _elm_win_focus_highlight_visible_set(win, common_visible);
1194 elm_widget_signal_emit(target, sig, "elm");
1196 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1199 if (win->focus_highlight.changed_theme)
1202 if (win->focus_highlight.style)
1203 str = win->focus_highlight.style;
1206 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1208 win->focus_highlight.changed_theme = EINA_FALSE;
1210 if (_elm_config->focus_highlight_animate)
1212 str = edje_object_data_get(win->focus_highlight.top, "animate");
1213 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1217 if ((win->focus_highlight.top_animate) && (previous) &&
1218 (!win->focus_highlight.prev.handled))
1219 _elm_win_focus_highlight_anim_setup(win, top);
1221 _elm_win_focus_highlight_simple_setup(win, top);
1222 evas_object_raise(top);
1225 win->focus_highlight.geometry_changed = EINA_FALSE;
1226 win->focus_highlight.prev = win->focus_highlight.cur;
1231 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1233 Evas_Event_Key_Down *ev = event_info;
1235 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1239 if ((strcmp(ev->keyname, "F12")) ||
1240 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1243 printf("Tree graph generated.\n");
1244 elm_object_tree_dot_dump(obj, "./dump.dot");
1249 _win_img_hide(void *data,
1251 Evas_Object *obj __UNUSED__,
1252 void *event_info __UNUSED__)
1254 Elm_Win *win = data;
1256 elm_widget_focus_hide_handle(win->win_obj);
1260 _win_img_mouse_down(void *data,
1262 Evas_Object *obj __UNUSED__,
1263 void *event_info __UNUSED__)
1265 Elm_Win *win = data;
1266 elm_widget_focus_mouse_down_handle(win->win_obj);
1270 _win_img_focus_in(void *data,
1272 Evas_Object *obj __UNUSED__,
1273 void *event_info __UNUSED__)
1275 Elm_Win *win = data;
1276 elm_widget_focus_steal(win->win_obj);
1280 _win_img_focus_out(void *data,
1282 Evas_Object *obj __UNUSED__,
1283 void *event_info __UNUSED__)
1285 Elm_Win *win = data;
1286 elm_widget_focused_object_clear(win->win_obj);
1290 _win_inlined_image_set(Elm_Win *win)
1292 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1293 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1294 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1295 _elm_win_obj_callback_img_obj_del, win);
1297 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1298 _win_img_hide, win);
1299 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1300 _win_img_mouse_down, win);
1301 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1302 _win_img_focus_in, win);
1303 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1304 _win_img_focus_out, win);
1308 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1312 const char *fontpath;
1314 win = ELM_NEW(Elm_Win);
1316 #define FALLBACK_TRY(engine) \
1319 CRITICAL(engine " engine creation failed. Trying software X11."); \
1320 elm_engine_set(ELM_SOFTWARE_X11); \
1321 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1323 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1327 case ELM_WIN_INLINED_IMAGE:
1330 Evas *e = evas_object_evas_get(parent);
1333 ee = ecore_evas_ecore_evas_get(e);
1335 win->img_obj = ecore_evas_object_image_new(ee);
1336 if (!win->img_obj) break;
1337 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1340 _win_inlined_image_set(win);
1343 evas_object_del(win->img_obj);
1344 win->img_obj = NULL;
1348 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1350 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1351 #ifdef HAVE_ELEMENTARY_X
1352 win->client_message_handler = ecore_event_handler_add
1353 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1356 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1358 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1359 FALLBACK_TRY("Sofware FB");
1361 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1363 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1364 FALLBACK_TRY("Sofware DirectFB");
1366 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1368 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1369 FALLBACK_TRY("Sofware-16");
1370 #ifdef HAVE_ELEMENTARY_X
1371 win->client_message_handler = ecore_event_handler_add
1372 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1375 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1377 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1378 FALLBACK_TRY("Sofware-8");
1379 #ifdef HAVE_ELEMENTARY_X
1380 win->client_message_handler = ecore_event_handler_add
1381 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1385 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1387 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1388 FALLBACK_TRY("XRender");
1389 #ifdef HAVE_ELEMENTARY_X
1390 win->client_message_handler = ecore_event_handler_add
1391 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1395 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1400 if (_elm_config->vsync)
1402 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1408 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1410 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1411 FALLBACK_TRY("OpenGL");
1412 #ifdef HAVE_ELEMENTARY_X
1413 win->client_message_handler = ecore_event_handler_add
1414 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1417 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1419 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1420 FALLBACK_TRY("Sofware Win32");
1422 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1424 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1425 FALLBACK_TRY("Sofware-16-WinCE");
1427 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1429 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1430 FALLBACK_TRY("Sofware SDL");
1432 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1434 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1435 FALLBACK_TRY("Sofware-16-SDL");
1437 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1439 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1440 FALLBACK_TRY("OpenGL SDL");
1442 else if (ENGINE_COMPARE(ELM_BUFFER))
1444 win->ee = ecore_evas_buffer_new(1, 1);
1446 else if (!strncmp(_elm_config->engine, "shot:", 5))
1448 win->ee = ecore_evas_buffer_new(1, 1);
1449 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1450 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1459 ERR("Cannot create window.");
1463 #ifdef HAVE_ELEMENTARY_X
1464 _elm_win_xwindow_get(win);
1466 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1467 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1468 // bg pixmap done by x - has other issues like can be redrawn by x before it
1469 // is filled/ready by app
1470 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1473 win->parent = parent;
1475 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1476 _elm_win_obj_callback_parent_del, win);
1478 win->evas = ecore_evas_get(win->ee);
1479 win->win_obj = elm_widget_add(win->evas);
1480 elm_widget_type_set(win->win_obj, "win");
1481 ELM_SET_WIDTYPE(widtype, "win");
1482 elm_widget_data_set(win->win_obj, win);
1483 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1484 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1485 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1486 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1487 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1488 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1489 evas_object_move(win->win_obj, 0, 0);
1490 evas_object_resize(win->win_obj, 1, 1);
1491 evas_object_layer_set(win->win_obj, 50);
1492 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1494 if (type == ELM_WIN_INLINED_IMAGE)
1495 elm_widget_parent2_set(win->win_obj, parent);
1496 ecore_evas_object_associate(win->ee, win->win_obj,
1497 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1498 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1499 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1500 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1501 _elm_win_obj_callback_show, win);
1502 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1503 _elm_win_obj_callback_hide, win);
1504 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1505 _elm_win_obj_callback_del, win);
1506 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1507 _elm_win_obj_callback_move, win);
1508 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1509 _elm_win_obj_callback_resize, win);
1511 evas_object_intercept_move_callback_add(win->win_obj,
1512 _elm_win_obj_intercept_move, win);
1513 evas_object_intercept_show_callback_add(win->win_obj,
1514 _elm_win_obj_intercept_show, win);
1516 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1517 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1518 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1519 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1520 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1521 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1522 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1523 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1524 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1525 evas_font_path_append(win->evas, fontpath);
1526 if (!_elm_config->font_hinting)
1527 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1528 else if (_elm_config->font_hinting == 1)
1529 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1530 else if (_elm_config->font_hinting == 2)
1531 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1533 #ifdef HAVE_ELEMENTARY_X
1534 _elm_win_xwin_update(win);
1537 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1539 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1541 ecore_evas_fullscreen_set(win->ee, 1);
1543 #undef ENGINE_COMPARE
1545 if (_elm_config->focus_highlight_enable)
1546 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1549 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1550 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1551 _debug_key_down, win);
1553 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1555 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1558 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1560 return win->win_obj;
1564 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1568 ELM_CHECK_WIDTYPE(obj, widtype);
1569 win = elm_widget_data_get(obj);
1571 if (eina_list_data_find(win->subobjs, subobj)) return;
1572 win->subobjs = eina_list_append(win->subobjs, subobj);
1573 elm_widget_sub_object_add(obj, subobj);
1574 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1575 _elm_win_subobj_callback_del, obj);
1576 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1577 _elm_win_subobj_callback_changed_size_hints,
1579 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1580 evas_object_move(subobj, 0, 0);
1581 evas_object_resize(subobj, w, h);
1582 _elm_win_eval_subobjs(obj);
1586 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1589 ELM_CHECK_WIDTYPE(obj, widtype);
1590 win = elm_widget_data_get(obj);
1592 evas_object_event_callback_del_full(subobj,
1593 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1594 _elm_win_subobj_callback_changed_size_hints,
1596 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1597 _elm_win_subobj_callback_del, obj);
1598 win->subobjs = eina_list_remove(win->subobjs, subobj);
1599 elm_widget_sub_object_del(obj, subobj);
1600 _elm_win_eval_subobjs(obj);
1604 elm_win_title_set(Evas_Object *obj, const char *title)
1607 ELM_CHECK_WIDTYPE(obj, widtype);
1608 win = elm_widget_data_get(obj);
1610 ecore_evas_title_set(win->ee, title);
1614 elm_win_title_get(const Evas_Object *obj)
1617 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1618 win = elm_widget_data_get(obj);
1619 if (!win) return NULL;
1620 return ecore_evas_title_get(win->ee);
1624 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1627 ELM_CHECK_WIDTYPE(obj, widtype);
1628 win = elm_widget_data_get(obj);
1630 win->autodel = autodel;
1634 elm_win_autodel_get(const Evas_Object *obj)
1637 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1638 win = elm_widget_data_get(obj);
1639 if (!win) return EINA_FALSE;
1640 return win->autodel;
1644 elm_win_activate(Evas_Object *obj)
1647 ELM_CHECK_WIDTYPE(obj, widtype);
1648 win = elm_widget_data_get(obj);
1650 ecore_evas_activate(win->ee);
1654 elm_win_lower(Evas_Object *obj)
1657 ELM_CHECK_WIDTYPE(obj, widtype);
1658 win = elm_widget_data_get(obj);
1660 ecore_evas_lower(win->ee);
1664 elm_win_raise(Evas_Object *obj)
1667 ELM_CHECK_WIDTYPE(obj, widtype);
1668 win = elm_widget_data_get(obj);
1670 ecore_evas_raise(win->ee);
1674 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1677 ELM_CHECK_WIDTYPE(obj, widtype);
1678 win = elm_widget_data_get(obj);
1680 ecore_evas_borderless_set(win->ee, borderless);
1681 #ifdef HAVE_ELEMENTARY_X
1682 _elm_win_xwin_update(win);
1687 elm_win_borderless_get(const Evas_Object *obj)
1690 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1691 win = elm_widget_data_get(obj);
1692 if (!win) return EINA_FALSE;
1693 return ecore_evas_borderless_get(win->ee);
1697 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1700 ELM_CHECK_WIDTYPE(obj, widtype);
1701 win = elm_widget_data_get(obj);
1703 ecore_evas_shaped_set(win->ee, shaped);
1704 #ifdef HAVE_ELEMENTARY_X
1705 _elm_win_xwin_update(win);
1710 elm_win_shaped_get(const Evas_Object *obj)
1713 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1714 win = elm_widget_data_get(obj);
1715 if (!win) return EINA_FALSE;
1716 return ecore_evas_shaped_get(win->ee);
1720 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1723 ELM_CHECK_WIDTYPE(obj, widtype);
1724 win = elm_widget_data_get(obj);
1729 else if (win->img_obj)
1731 evas_object_image_alpha_set(win->img_obj, alpha);
1735 #ifdef HAVE_ELEMENTARY_X
1740 if (!_elm_config->compositing)
1741 elm_win_shaped_set(obj, alpha);
1743 ecore_evas_alpha_set(win->ee, alpha);
1746 ecore_evas_alpha_set(win->ee, alpha);
1747 _elm_win_xwin_update(win);
1751 ecore_evas_alpha_set(win->ee, alpha);
1756 elm_win_alpha_get(const Evas_Object *obj)
1759 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1760 win = elm_widget_data_get(obj);
1761 if (!win) return EINA_FALSE;
1762 return ecore_evas_alpha_get(win->ee);
1766 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1769 ELM_CHECK_WIDTYPE(obj, widtype);
1770 win = elm_widget_data_get(obj);
1776 else if (win->img_obj)
1778 evas_object_image_alpha_set(win->img_obj, transparent);
1782 #ifdef HAVE_ELEMENTARY_X
1785 ecore_evas_transparent_set(win->ee, transparent);
1786 _elm_win_xwin_update(win);
1790 ecore_evas_transparent_set(win->ee, transparent);
1795 elm_win_transparent_get(const Evas_Object *obj)
1798 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1799 win = elm_widget_data_get(obj);
1800 if (!win) return EINA_FALSE;
1802 return ecore_evas_transparent_get(win->ee);
1806 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1809 ELM_CHECK_WIDTYPE(obj, widtype);
1810 win = elm_widget_data_get(obj);
1812 ecore_evas_override_set(win->ee, override);
1813 #ifdef HAVE_ELEMENTARY_X
1814 _elm_win_xwin_update(win);
1819 elm_win_override_get(const Evas_Object *obj)
1822 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1823 win = elm_widget_data_get(obj);
1824 if (!win) return EINA_FALSE;
1825 return ecore_evas_override_get(win->ee);
1829 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1832 ELM_CHECK_WIDTYPE(obj, widtype);
1833 win = elm_widget_data_get(obj);
1836 // YYY: handle if win->img_obj
1837 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1838 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1839 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1841 // these engines... can ONLY be fullscreen
1846 ecore_evas_fullscreen_set(win->ee, fullscreen);
1847 #ifdef HAVE_ELEMENTARY_X
1848 _elm_win_xwin_update(win);
1851 #undef ENGINE_COMPARE
1855 elm_win_fullscreen_get(const Evas_Object *obj)
1858 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1859 win = elm_widget_data_get(obj);
1860 if (!win) return EINA_FALSE;
1862 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1863 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1864 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1866 // these engines... can ONLY be fullscreen
1871 return ecore_evas_fullscreen_get(win->ee);
1873 #undef ENGINE_COMPARE
1877 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1880 ELM_CHECK_WIDTYPE(obj, widtype);
1881 win = elm_widget_data_get(obj);
1883 // YYY: handle if win->img_obj
1884 ecore_evas_maximized_set(win->ee, maximized);
1885 #ifdef HAVE_ELEMENTARY_X
1886 _elm_win_xwin_update(win);
1891 elm_win_maximized_get(const Evas_Object *obj)
1894 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1895 win = elm_widget_data_get(obj);
1896 if (!win) return EINA_FALSE;
1897 return ecore_evas_maximized_get(win->ee);
1901 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1904 ELM_CHECK_WIDTYPE(obj, widtype);
1905 win = elm_widget_data_get(obj);
1907 ecore_evas_iconified_set(win->ee, iconified);
1908 #ifdef HAVE_ELEMENTARY_X
1909 _elm_win_xwin_update(win);
1914 elm_win_iconified_get(const Evas_Object *obj)
1917 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1918 win = elm_widget_data_get(obj);
1919 if (!win) return EINA_FALSE;
1920 return ecore_evas_iconified_get(win->ee);
1924 elm_win_layer_set(Evas_Object *obj, int layer)
1927 ELM_CHECK_WIDTYPE(obj, widtype);
1928 win = elm_widget_data_get(obj);
1930 ecore_evas_layer_set(win->ee, layer);
1931 #ifdef HAVE_ELEMENTARY_X
1932 _elm_win_xwin_update(win);
1937 elm_win_layer_get(const Evas_Object *obj)
1940 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1941 win = elm_widget_data_get(obj);
1942 if (!win) return -1;
1943 return ecore_evas_layer_get(win->ee);
1947 elm_win_rotation_set(Evas_Object *obj, int rotation)
1950 ELM_CHECK_WIDTYPE(obj, widtype);
1951 win = elm_widget_data_get(obj);
1953 if (win->rot == rotation) return;
1954 win->rot = rotation;
1955 ecore_evas_rotation_set(win->ee, rotation);
1956 evas_object_size_hint_min_set(obj, -1, -1);
1957 evas_object_size_hint_max_set(obj, -1, -1);
1958 _elm_win_eval_subobjs(obj);
1959 #ifdef HAVE_ELEMENTARY_X
1960 _elm_win_xwin_update(win);
1965 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1968 ELM_CHECK_WIDTYPE(obj, widtype);
1969 win = elm_widget_data_get(obj);
1971 if (win->rot == rotation) return;
1972 win->rot = rotation;
1973 ecore_evas_rotation_with_resize_set(win->ee, rotation);
1974 evas_object_size_hint_min_set(obj, -1, -1);
1975 evas_object_size_hint_max_set(obj, -1, -1);
1976 _elm_win_eval_subobjs(obj);
1977 #ifdef HAVE_ELEMENTARY_X
1978 _elm_win_xwin_update(win);
1983 elm_win_rotation_get(const Evas_Object *obj)
1986 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1987 win = elm_widget_data_get(obj);
1988 if (!win) return -1;
1993 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
1996 ELM_CHECK_WIDTYPE(obj, widtype);
1997 win = elm_widget_data_get(obj);
1999 ecore_evas_sticky_set(win->ee, sticky);
2000 #ifdef HAVE_ELEMENTARY_X
2001 _elm_win_xwin_update(win);
2006 elm_win_sticky_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_sticky_get(win->ee);
2016 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2019 ELM_CHECK_WIDTYPE(obj, widtype);
2020 win = elm_widget_data_get(obj);
2022 if (mode == win->kbdmode) return;
2023 #ifdef HAVE_ELEMENTARY_X
2024 _elm_win_xwindow_get(win);
2026 win->kbdmode = mode;
2027 #ifdef HAVE_ELEMENTARY_X
2029 ecore_x_e_virtual_keyboard_state_set
2030 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2034 EAPI Elm_Win_Keyboard_Mode
2035 elm_win_keyboard_mode_get(const Evas_Object *obj)
2038 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2039 win = elm_widget_data_get(obj);
2040 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2041 return win->kbdmode;
2045 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2048 ELM_CHECK_WIDTYPE(obj, widtype);
2049 win = elm_widget_data_get(obj);
2051 #ifdef HAVE_ELEMENTARY_X
2052 _elm_win_xwindow_get(win);
2054 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2059 elm_win_keyboard_win_get(const Evas_Object *obj)
2062 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2063 win = elm_widget_data_get(obj);
2064 if (!win) return EINA_FALSE;
2065 #ifdef HAVE_ELEMENTARY_X
2066 _elm_win_xwindow_get(win);
2068 return ecore_x_e_virtual_keyboard_get(win->xwin);
2074 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2077 ELM_CHECK_WIDTYPE(obj, widtype);
2078 win = elm_widget_data_get(obj);
2080 if (x) *x = win->screen.x;
2081 if (y) *y = win->screen.y;
2085 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2088 ELM_CHECK_WIDTYPE(obj, widtype);
2089 win = elm_widget_data_get(obj);
2091 #ifdef HAVE_ELEMENTARY_X
2092 _elm_win_xwindow_get(win);
2094 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2099 elm_win_conformant_get(const Evas_Object *obj)
2102 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2103 win = elm_widget_data_get(obj);
2104 if (!win) return EINA_FALSE;
2105 #ifdef HAVE_ELEMENTARY_X
2106 _elm_win_xwindow_get(win);
2108 return ecore_x_e_illume_conformant_get(win->xwin);
2114 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2117 ELM_CHECK_WIDTYPE(obj, widtype);
2118 win = elm_widget_data_get(obj);
2120 #ifdef HAVE_ELEMENTARY_X
2121 _elm_win_xwindow_get(win);
2124 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2127 Ecore_X_Window_State states[2];
2129 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2130 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2131 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2132 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2139 elm_win_quickpanel_get(const Evas_Object *obj)
2142 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2143 win = elm_widget_data_get(obj);
2144 if (!win) return EINA_FALSE;
2145 #ifdef HAVE_ELEMENTARY_X
2146 _elm_win_xwindow_get(win);
2148 return ecore_x_e_illume_quickpanel_get(win->xwin);
2154 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2157 ELM_CHECK_WIDTYPE(obj, widtype);
2158 win = elm_widget_data_get(obj);
2160 #ifdef HAVE_ELEMENTARY_X
2161 _elm_win_xwindow_get(win);
2163 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2168 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2171 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2172 win = elm_widget_data_get(obj);
2173 if (!win) return -1;
2174 #ifdef HAVE_ELEMENTARY_X
2175 _elm_win_xwindow_get(win);
2177 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2183 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2186 ELM_CHECK_WIDTYPE(obj, widtype);
2187 win = elm_widget_data_get(obj);
2189 #ifdef HAVE_ELEMENTARY_X
2190 _elm_win_xwindow_get(win);
2192 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2197 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2200 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2201 win = elm_widget_data_get(obj);
2202 if (!win) return -1;
2203 #ifdef HAVE_ELEMENTARY_X
2204 _elm_win_xwindow_get(win);
2206 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2212 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2215 ELM_CHECK_WIDTYPE(obj, widtype);
2216 win = elm_widget_data_get(obj);
2218 #ifdef HAVE_ELEMENTARY_X
2219 _elm_win_xwindow_get(win);
2221 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2226 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2229 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2230 win = elm_widget_data_get(obj);
2232 #ifdef HAVE_ELEMENTARY_X
2233 _elm_win_xwindow_get(win);
2235 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2241 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2244 ELM_CHECK_WIDTYPE(obj, widtype);
2245 win = elm_widget_data_get(obj);
2247 #ifdef HAVE_ELEMENTARY_X
2248 _elm_win_xwindow_get(win);
2253 Ecore_X_Window_State states[2];
2255 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2256 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2257 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2258 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2265 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2268 ELM_CHECK_WIDTYPE(obj, widtype);
2269 win = elm_widget_data_get(obj);
2271 #ifdef HAVE_ELEMENTARY_X
2272 _elm_win_xwindow_get(win);
2277 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2278 ecore_x_e_illume_focus_back_send(win->xwin);
2280 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2281 ecore_x_e_illume_focus_forward_send(win->xwin);
2283 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2284 ecore_x_e_illume_focus_home_send(win->xwin);
2286 case ELM_ILLUME_COMMAND_CLOSE:
2287 ecore_x_e_illume_close_send(win->xwin);
2297 elm_win_inlined_image_object_get(Evas_Object *obj)
2300 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2301 win = elm_widget_data_get(obj);
2302 if (!win) return NULL;
2303 return win->img_obj;
2307 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2311 ELM_CHECK_WIDTYPE(obj, widtype);
2313 win = elm_widget_data_get(obj);
2314 enabled = !!enabled;
2315 if (win->focus_highlight.enabled == enabled)
2318 win->focus_highlight.enabled = enabled;
2320 if (win->focus_highlight.enabled)
2321 _elm_win_focus_highlight_init(win);
2323 _elm_win_focus_highlight_shutdown(win);
2327 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2331 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2333 win = elm_widget_data_get(obj);
2334 return win->focus_highlight.enabled;
2338 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2342 ELM_CHECK_WIDTYPE(obj, widtype);
2344 win = elm_widget_data_get(obj);
2345 eina_stringshare_replace(&win->focus_highlight.style, style);
2346 win->focus_highlight.changed_theme = EINA_TRUE;
2347 _elm_win_focus_highlight_reconfigure_job_start(win);
2351 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2355 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2357 win = elm_widget_data_get(obj);
2358 return win->focus_highlight.style;
2361 typedef struct _Widget_Data Widget_Data;
2366 Evas_Object *content;
2369 static void _del_hook(Evas_Object *obj);
2370 static void _theme_hook(Evas_Object *obj);
2371 static void _sizing_eval(Evas_Object *obj);
2372 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2373 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2375 static const char *widtype2 = NULL;
2378 _del_hook(Evas_Object *obj)
2380 Widget_Data *wd = elm_widget_data_get(obj);
2386 _theme_hook(Evas_Object *obj)
2388 Widget_Data *wd = elm_widget_data_get(obj);
2389 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2391 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2396 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2398 Widget_Data *wd = elm_widget_data_get(obj);
2403 /* Try Focus cycle in subitem */
2406 elm_widget_focus_next_get(wd->content, dir, next);
2411 *next = (Evas_Object *)obj;
2416 _sizing_eval(Evas_Object *obj)
2418 Widget_Data *wd = elm_widget_data_get(obj);
2419 Evas_Coord minw = -1, minh = -1;
2421 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2422 edje_object_size_min_calc(wd->frm, &minw, &minh);
2423 evas_object_size_hint_min_set(obj, minw, minh);
2424 evas_object_size_hint_max_set(obj, -1, -1);
2428 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2434 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2436 Widget_Data *wd = elm_widget_data_get(obj);
2437 Evas_Object *sub = event_info;
2438 if (sub == wd->content)
2440 evas_object_event_callback_del_full
2441 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2448 elm_win_inwin_add(Evas_Object *obj)
2454 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2455 win = elm_widget_data_get(obj);
2456 if (!win) return NULL;
2457 wd = ELM_NEW(Widget_Data);
2458 obj2 = elm_widget_add(win->evas);
2459 elm_widget_type_set(obj2, "inwin");
2460 ELM_SET_WIDTYPE(widtype2, "inwin");
2461 elm_widget_sub_object_add(obj, obj2);
2462 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2463 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2464 elm_win_resize_object_add(obj, obj2);
2466 elm_widget_data_set(obj2, wd);
2467 elm_widget_del_hook_set(obj2, _del_hook);
2468 elm_widget_theme_hook_set(obj2, _theme_hook);
2469 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2470 elm_widget_can_focus_set(obj2, EINA_TRUE);
2471 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2473 wd->frm = edje_object_add(win->evas);
2474 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2475 elm_widget_resize_object_set(obj2, wd->frm);
2477 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2484 elm_win_inwin_activate(Evas_Object *obj)
2486 ELM_CHECK_WIDTYPE(obj, widtype2);
2487 Widget_Data *wd = elm_widget_data_get(obj);
2489 evas_object_raise(obj);
2490 evas_object_show(obj);
2491 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2492 elm_object_focus(obj);
2496 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2498 ELM_CHECK_WIDTYPE(obj, widtype2);
2499 Widget_Data *wd = elm_widget_data_get(obj);
2501 if (wd->content == content) return;
2502 if (wd->content) evas_object_del(wd->content);
2503 wd->content = content;
2506 elm_widget_sub_object_add(obj, content);
2507 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2508 _changed_size_hints, obj);
2509 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2515 elm_win_inwin_content_get(const Evas_Object *obj)
2517 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2518 Widget_Data *wd = elm_widget_data_get(obj);
2519 if (!wd) return NULL;
2524 elm_win_inwin_content_unset(Evas_Object *obj)
2526 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2527 Widget_Data *wd = elm_widget_data_get(obj);
2528 if (!wd) return NULL;
2529 if (!wd->content) return NULL;
2530 Evas_Object *content = wd->content;
2531 elm_widget_sub_object_del(obj, wd->content);
2532 edje_object_part_unswallow(wd->frm, wd->content);
2537 /* windowing spcific calls - shall we do this differently? */
2539 static Ecore_X_Window
2540 _elm_ee_win_get(const Evas_Object *obj)
2543 #ifdef HAVE_ELEMENTARY_X
2544 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2545 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2551 * Get the Ecore_X_Window of an Evas_Object
2553 * @param obj The object
2555 * @return The Ecore_X_Window of @p obj
2560 elm_win_xwindow_get(const Evas_Object *obj)
2566 type = elm_widget_type_get(obj);
2567 if (!type) return 0;
2568 if (type != widtype) return _elm_ee_win_get(obj);
2569 #ifdef HAVE_ELEMENTARY_X
2570 win = elm_widget_data_get(obj);
2572 if (win->xwin) return win->xwin;
2573 if (win->parent) return elm_win_xwindow_get(win->parent);