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,in";
78 static const char SIG_FOCUS_IN[] = "focus,out";
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 ecore_evas_object_associate(win->ee, win->win_obj,
1495 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1496 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1497 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1498 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1499 _elm_win_obj_callback_show, win);
1500 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1501 _elm_win_obj_callback_hide, win);
1502 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1503 _elm_win_obj_callback_del, win);
1504 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1505 _elm_win_obj_callback_move, win);
1506 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1507 _elm_win_obj_callback_resize, win);
1509 evas_object_intercept_move_callback_add(win->win_obj,
1510 _elm_win_obj_intercept_move, win);
1511 evas_object_intercept_show_callback_add(win->win_obj,
1512 _elm_win_obj_intercept_show, win);
1514 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1515 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1516 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1517 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1518 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1519 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1520 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1521 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1522 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1523 evas_font_path_append(win->evas, fontpath);
1524 if (!_elm_config->font_hinting)
1525 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1526 else if (_elm_config->font_hinting == 1)
1527 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1528 else if (_elm_config->font_hinting == 2)
1529 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1531 #ifdef HAVE_ELEMENTARY_X
1532 _elm_win_xwin_update(win);
1535 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1537 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1539 ecore_evas_fullscreen_set(win->ee, 1);
1541 #undef ENGINE_COMPARE
1543 if (_elm_config->focus_highlight_enable)
1544 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1547 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1548 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1549 _debug_key_down, win);
1551 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1553 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1556 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1558 return win->win_obj;
1562 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1566 ELM_CHECK_WIDTYPE(obj, widtype);
1567 win = elm_widget_data_get(obj);
1569 if (eina_list_data_find(win->subobjs, subobj)) return;
1570 win->subobjs = eina_list_append(win->subobjs, subobj);
1571 elm_widget_sub_object_add(obj, subobj);
1572 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1573 _elm_win_subobj_callback_del, obj);
1574 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1575 _elm_win_subobj_callback_changed_size_hints,
1577 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1578 evas_object_move(subobj, 0, 0);
1579 evas_object_resize(subobj, w, h);
1580 _elm_win_eval_subobjs(obj);
1584 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1587 ELM_CHECK_WIDTYPE(obj, widtype);
1588 win = elm_widget_data_get(obj);
1590 evas_object_event_callback_del_full(subobj,
1591 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1592 _elm_win_subobj_callback_changed_size_hints,
1594 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1595 _elm_win_subobj_callback_del, obj);
1596 win->subobjs = eina_list_remove(win->subobjs, subobj);
1597 elm_widget_sub_object_del(obj, subobj);
1598 _elm_win_eval_subobjs(obj);
1602 elm_win_title_set(Evas_Object *obj, const char *title)
1605 ELM_CHECK_WIDTYPE(obj, widtype);
1606 win = elm_widget_data_get(obj);
1608 ecore_evas_title_set(win->ee, title);
1612 elm_win_title_get(const Evas_Object *obj)
1615 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1616 win = elm_widget_data_get(obj);
1617 if (!win) return NULL;
1618 return ecore_evas_title_get(win->ee);
1622 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1625 ELM_CHECK_WIDTYPE(obj, widtype);
1626 win = elm_widget_data_get(obj);
1628 win->autodel = autodel;
1632 elm_win_autodel_get(const Evas_Object *obj)
1635 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1636 win = elm_widget_data_get(obj);
1637 if (!win) return EINA_FALSE;
1638 return win->autodel;
1642 elm_win_activate(Evas_Object *obj)
1645 ELM_CHECK_WIDTYPE(obj, widtype);
1646 win = elm_widget_data_get(obj);
1648 ecore_evas_activate(win->ee);
1652 elm_win_lower(Evas_Object *obj)
1655 ELM_CHECK_WIDTYPE(obj, widtype);
1656 win = elm_widget_data_get(obj);
1658 ecore_evas_lower(win->ee);
1662 elm_win_raise(Evas_Object *obj)
1665 ELM_CHECK_WIDTYPE(obj, widtype);
1666 win = elm_widget_data_get(obj);
1668 ecore_evas_raise(win->ee);
1672 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1675 ELM_CHECK_WIDTYPE(obj, widtype);
1676 win = elm_widget_data_get(obj);
1678 ecore_evas_borderless_set(win->ee, borderless);
1679 #ifdef HAVE_ELEMENTARY_X
1680 _elm_win_xwin_update(win);
1685 elm_win_borderless_get(const Evas_Object *obj)
1688 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1689 win = elm_widget_data_get(obj);
1690 if (!win) return EINA_FALSE;
1691 return ecore_evas_borderless_get(win->ee);
1695 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1698 ELM_CHECK_WIDTYPE(obj, widtype);
1699 win = elm_widget_data_get(obj);
1701 ecore_evas_shaped_set(win->ee, shaped);
1702 #ifdef HAVE_ELEMENTARY_X
1703 _elm_win_xwin_update(win);
1708 elm_win_shaped_get(const Evas_Object *obj)
1711 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1712 win = elm_widget_data_get(obj);
1713 if (!win) return EINA_FALSE;
1714 return ecore_evas_shaped_get(win->ee);
1718 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1721 ELM_CHECK_WIDTYPE(obj, widtype);
1722 win = elm_widget_data_get(obj);
1727 else if (win->img_obj)
1729 evas_object_image_alpha_set(win->img_obj, alpha);
1733 #ifdef HAVE_ELEMENTARY_X
1738 if (!_elm_config->compositing)
1739 elm_win_shaped_set(obj, alpha);
1741 ecore_evas_alpha_set(win->ee, alpha);
1744 ecore_evas_alpha_set(win->ee, alpha);
1745 _elm_win_xwin_update(win);
1749 ecore_evas_alpha_set(win->ee, alpha);
1754 elm_win_alpha_get(const Evas_Object *obj)
1757 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1758 win = elm_widget_data_get(obj);
1759 if (!win) return EINA_FALSE;
1760 return ecore_evas_alpha_get(win->ee);
1764 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1767 ELM_CHECK_WIDTYPE(obj, widtype);
1768 win = elm_widget_data_get(obj);
1774 else if (win->img_obj)
1776 evas_object_image_alpha_set(win->img_obj, transparent);
1780 #ifdef HAVE_ELEMENTARY_X
1783 ecore_evas_transparent_set(win->ee, transparent);
1784 _elm_win_xwin_update(win);
1788 ecore_evas_transparent_set(win->ee, transparent);
1793 elm_win_transparent_get(const Evas_Object *obj)
1796 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1797 win = elm_widget_data_get(obj);
1798 if (!win) return EINA_FALSE;
1800 return ecore_evas_transparent_get(win->ee);
1804 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1807 ELM_CHECK_WIDTYPE(obj, widtype);
1808 win = elm_widget_data_get(obj);
1810 ecore_evas_override_set(win->ee, override);
1811 #ifdef HAVE_ELEMENTARY_X
1812 _elm_win_xwin_update(win);
1817 elm_win_override_get(const Evas_Object *obj)
1820 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1821 win = elm_widget_data_get(obj);
1822 if (!win) return EINA_FALSE;
1823 return ecore_evas_override_get(win->ee);
1827 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1830 ELM_CHECK_WIDTYPE(obj, widtype);
1831 win = elm_widget_data_get(obj);
1834 // YYY: handle if win->img_obj
1835 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1836 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1837 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1839 // these engines... can ONLY be fullscreen
1844 ecore_evas_fullscreen_set(win->ee, fullscreen);
1845 #ifdef HAVE_ELEMENTARY_X
1846 _elm_win_xwin_update(win);
1849 #undef ENGINE_COMPARE
1853 elm_win_fullscreen_get(const Evas_Object *obj)
1856 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1857 win = elm_widget_data_get(obj);
1858 if (!win) return EINA_FALSE;
1860 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1861 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1862 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1864 // these engines... can ONLY be fullscreen
1869 return ecore_evas_fullscreen_get(win->ee);
1871 #undef ENGINE_COMPARE
1875 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1878 ELM_CHECK_WIDTYPE(obj, widtype);
1879 win = elm_widget_data_get(obj);
1881 // YYY: handle if win->img_obj
1882 ecore_evas_maximized_set(win->ee, maximized);
1883 #ifdef HAVE_ELEMENTARY_X
1884 _elm_win_xwin_update(win);
1889 elm_win_maximized_get(const Evas_Object *obj)
1892 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1893 win = elm_widget_data_get(obj);
1894 if (!win) return EINA_FALSE;
1895 return ecore_evas_maximized_get(win->ee);
1899 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1902 ELM_CHECK_WIDTYPE(obj, widtype);
1903 win = elm_widget_data_get(obj);
1905 ecore_evas_iconified_set(win->ee, iconified);
1906 #ifdef HAVE_ELEMENTARY_X
1907 _elm_win_xwin_update(win);
1912 elm_win_iconified_get(const Evas_Object *obj)
1915 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1916 win = elm_widget_data_get(obj);
1917 if (!win) return EINA_FALSE;
1918 return ecore_evas_iconified_get(win->ee);
1922 elm_win_layer_set(Evas_Object *obj, int layer)
1925 ELM_CHECK_WIDTYPE(obj, widtype);
1926 win = elm_widget_data_get(obj);
1928 ecore_evas_layer_set(win->ee, layer);
1929 #ifdef HAVE_ELEMENTARY_X
1930 _elm_win_xwin_update(win);
1935 elm_win_layer_get(const Evas_Object *obj)
1938 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1939 win = elm_widget_data_get(obj);
1940 if (!win) return -1;
1941 return ecore_evas_layer_get(win->ee);
1945 elm_win_rotation_set(Evas_Object *obj, int rotation)
1948 ELM_CHECK_WIDTYPE(obj, widtype);
1949 win = elm_widget_data_get(obj);
1951 if (win->rot == rotation) return;
1952 win->rot = rotation;
1953 ecore_evas_rotation_set(win->ee, rotation);
1954 evas_object_size_hint_min_set(obj, -1, -1);
1955 evas_object_size_hint_max_set(obj, -1, -1);
1956 _elm_win_eval_subobjs(obj);
1957 #ifdef HAVE_ELEMENTARY_X
1958 _elm_win_xwin_update(win);
1963 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1966 ELM_CHECK_WIDTYPE(obj, widtype);
1967 win = elm_widget_data_get(obj);
1969 if (win->rot == rotation) return;
1970 win->rot = rotation;
1971 ecore_evas_rotation_with_resize_set(win->ee, rotation);
1972 evas_object_size_hint_min_set(obj, -1, -1);
1973 evas_object_size_hint_max_set(obj, -1, -1);
1974 _elm_win_eval_subobjs(obj);
1975 #ifdef HAVE_ELEMENTARY_X
1976 _elm_win_xwin_update(win);
1981 elm_win_rotation_get(const Evas_Object *obj)
1984 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1985 win = elm_widget_data_get(obj);
1986 if (!win) return -1;
1991 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
1994 ELM_CHECK_WIDTYPE(obj, widtype);
1995 win = elm_widget_data_get(obj);
1997 ecore_evas_sticky_set(win->ee, sticky);
1998 #ifdef HAVE_ELEMENTARY_X
1999 _elm_win_xwin_update(win);
2004 elm_win_sticky_get(const Evas_Object *obj)
2007 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2008 win = elm_widget_data_get(obj);
2009 if (!win) return EINA_FALSE;
2010 return ecore_evas_sticky_get(win->ee);
2014 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2017 ELM_CHECK_WIDTYPE(obj, widtype);
2018 win = elm_widget_data_get(obj);
2020 if (mode == win->kbdmode) return;
2021 #ifdef HAVE_ELEMENTARY_X
2022 _elm_win_xwindow_get(win);
2024 win->kbdmode = mode;
2025 #ifdef HAVE_ELEMENTARY_X
2027 ecore_x_e_virtual_keyboard_state_set
2028 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2032 EAPI Elm_Win_Keyboard_Mode
2033 elm_win_keyboard_mode_get(const Evas_Object *obj)
2036 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2037 win = elm_widget_data_get(obj);
2038 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2039 return win->kbdmode;
2043 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2046 ELM_CHECK_WIDTYPE(obj, widtype);
2047 win = elm_widget_data_get(obj);
2049 #ifdef HAVE_ELEMENTARY_X
2050 _elm_win_xwindow_get(win);
2052 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2057 elm_win_keyboard_win_get(const Evas_Object *obj)
2060 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2061 win = elm_widget_data_get(obj);
2062 if (!win) return EINA_FALSE;
2063 #ifdef HAVE_ELEMENTARY_X
2064 _elm_win_xwindow_get(win);
2066 return ecore_x_e_virtual_keyboard_get(win->xwin);
2072 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2075 ELM_CHECK_WIDTYPE(obj, widtype);
2076 win = elm_widget_data_get(obj);
2078 if (x) *x = win->screen.x;
2079 if (y) *y = win->screen.y;
2083 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2086 ELM_CHECK_WIDTYPE(obj, widtype);
2087 win = elm_widget_data_get(obj);
2089 #ifdef HAVE_ELEMENTARY_X
2090 _elm_win_xwindow_get(win);
2092 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2097 elm_win_conformant_get(const Evas_Object *obj)
2100 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2101 win = elm_widget_data_get(obj);
2102 if (!win) return EINA_FALSE;
2103 #ifdef HAVE_ELEMENTARY_X
2104 _elm_win_xwindow_get(win);
2106 return ecore_x_e_illume_conformant_get(win->xwin);
2112 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2115 ELM_CHECK_WIDTYPE(obj, widtype);
2116 win = elm_widget_data_get(obj);
2118 #ifdef HAVE_ELEMENTARY_X
2119 _elm_win_xwindow_get(win);
2122 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2125 Ecore_X_Window_State states[2];
2127 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2128 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2129 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2130 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2137 elm_win_quickpanel_get(const Evas_Object *obj)
2140 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2141 win = elm_widget_data_get(obj);
2142 if (!win) return EINA_FALSE;
2143 #ifdef HAVE_ELEMENTARY_X
2144 _elm_win_xwindow_get(win);
2146 return ecore_x_e_illume_quickpanel_get(win->xwin);
2152 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2155 ELM_CHECK_WIDTYPE(obj, widtype);
2156 win = elm_widget_data_get(obj);
2158 #ifdef HAVE_ELEMENTARY_X
2159 _elm_win_xwindow_get(win);
2161 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2166 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2169 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2170 win = elm_widget_data_get(obj);
2171 if (!win) return -1;
2172 #ifdef HAVE_ELEMENTARY_X
2173 _elm_win_xwindow_get(win);
2175 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2181 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2184 ELM_CHECK_WIDTYPE(obj, widtype);
2185 win = elm_widget_data_get(obj);
2187 #ifdef HAVE_ELEMENTARY_X
2188 _elm_win_xwindow_get(win);
2190 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2195 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2198 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2199 win = elm_widget_data_get(obj);
2200 if (!win) return -1;
2201 #ifdef HAVE_ELEMENTARY_X
2202 _elm_win_xwindow_get(win);
2204 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2210 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2213 ELM_CHECK_WIDTYPE(obj, widtype);
2214 win = elm_widget_data_get(obj);
2216 #ifdef HAVE_ELEMENTARY_X
2217 _elm_win_xwindow_get(win);
2219 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2224 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2227 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2228 win = elm_widget_data_get(obj);
2230 #ifdef HAVE_ELEMENTARY_X
2231 _elm_win_xwindow_get(win);
2233 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2239 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2242 ELM_CHECK_WIDTYPE(obj, widtype);
2243 win = elm_widget_data_get(obj);
2245 #ifdef HAVE_ELEMENTARY_X
2246 _elm_win_xwindow_get(win);
2251 Ecore_X_Window_State states[2];
2253 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2254 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2255 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2256 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2263 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2266 ELM_CHECK_WIDTYPE(obj, widtype);
2267 win = elm_widget_data_get(obj);
2269 #ifdef HAVE_ELEMENTARY_X
2270 _elm_win_xwindow_get(win);
2275 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2276 ecore_x_e_illume_focus_back_send(win->xwin);
2278 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2279 ecore_x_e_illume_focus_forward_send(win->xwin);
2281 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2282 ecore_x_e_illume_focus_home_send(win->xwin);
2284 case ELM_ILLUME_COMMAND_CLOSE:
2285 ecore_x_e_illume_close_send(win->xwin);
2295 elm_win_inlined_image_object_get(Evas_Object *obj)
2298 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2299 win = elm_widget_data_get(obj);
2300 if (!win) return NULL;
2301 return win->img_obj;
2305 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2309 ELM_CHECK_WIDTYPE(obj, widtype);
2311 win = elm_widget_data_get(obj);
2312 enabled = !!enabled;
2313 if (win->focus_highlight.enabled == enabled)
2316 win->focus_highlight.enabled = enabled;
2318 if (win->focus_highlight.enabled)
2319 _elm_win_focus_highlight_init(win);
2321 _elm_win_focus_highlight_shutdown(win);
2325 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2329 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2331 win = elm_widget_data_get(obj);
2332 return win->focus_highlight.enabled;
2336 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2340 ELM_CHECK_WIDTYPE(obj, widtype);
2342 win = elm_widget_data_get(obj);
2343 eina_stringshare_replace(&win->focus_highlight.style, style);
2344 win->focus_highlight.changed_theme = EINA_TRUE;
2345 _elm_win_focus_highlight_reconfigure_job_start(win);
2349 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2353 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2355 win = elm_widget_data_get(obj);
2356 return win->focus_highlight.style;
2359 typedef struct _Widget_Data Widget_Data;
2364 Evas_Object *content;
2367 static void _del_hook(Evas_Object *obj);
2368 static void _theme_hook(Evas_Object *obj);
2369 static void _sizing_eval(Evas_Object *obj);
2370 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2371 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2373 static const char *widtype2 = NULL;
2376 _del_hook(Evas_Object *obj)
2378 Widget_Data *wd = elm_widget_data_get(obj);
2384 _theme_hook(Evas_Object *obj)
2386 Widget_Data *wd = elm_widget_data_get(obj);
2387 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2389 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2394 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2396 Widget_Data *wd = elm_widget_data_get(obj);
2401 /* Try Focus cycle in subitem */
2404 elm_widget_focus_next_get(wd->content, dir, next);
2409 *next = (Evas_Object *)obj;
2414 _sizing_eval(Evas_Object *obj)
2416 Widget_Data *wd = elm_widget_data_get(obj);
2417 Evas_Coord minw = -1, minh = -1;
2419 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2420 edje_object_size_min_calc(wd->frm, &minw, &minh);
2421 evas_object_size_hint_min_set(obj, minw, minh);
2422 evas_object_size_hint_max_set(obj, -1, -1);
2426 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2432 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2434 Widget_Data *wd = elm_widget_data_get(obj);
2435 Evas_Object *sub = event_info;
2436 if (sub == wd->content)
2438 evas_object_event_callback_del_full
2439 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2446 elm_win_inwin_add(Evas_Object *obj)
2452 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2453 win = elm_widget_data_get(obj);
2454 if (!win) return NULL;
2455 wd = ELM_NEW(Widget_Data);
2456 obj2 = elm_widget_add(win->evas);
2457 elm_widget_type_set(obj2, "inwin");
2458 ELM_SET_WIDTYPE(widtype2, "inwin");
2459 elm_widget_sub_object_add(obj, obj2);
2460 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2461 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2462 elm_win_resize_object_add(obj, obj2);
2464 elm_widget_data_set(obj2, wd);
2465 elm_widget_del_hook_set(obj2, _del_hook);
2466 elm_widget_theme_hook_set(obj2, _theme_hook);
2467 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2468 elm_widget_can_focus_set(obj2, EINA_TRUE);
2469 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2471 wd->frm = edje_object_add(win->evas);
2472 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2473 elm_widget_resize_object_set(obj2, wd->frm);
2475 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2482 elm_win_inwin_activate(Evas_Object *obj)
2484 ELM_CHECK_WIDTYPE(obj, widtype2);
2485 Widget_Data *wd = elm_widget_data_get(obj);
2487 evas_object_raise(obj);
2488 evas_object_show(obj);
2489 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2490 elm_object_focus(obj);
2494 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2496 ELM_CHECK_WIDTYPE(obj, widtype2);
2497 Widget_Data *wd = elm_widget_data_get(obj);
2499 if (wd->content == content) return;
2500 if (wd->content) evas_object_del(wd->content);
2501 wd->content = content;
2504 elm_widget_sub_object_add(obj, content);
2505 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2506 _changed_size_hints, obj);
2507 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2513 elm_win_inwin_content_get(const Evas_Object *obj)
2515 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2516 Widget_Data *wd = elm_widget_data_get(obj);
2517 if (!wd) return NULL;
2522 elm_win_inwin_content_unset(Evas_Object *obj)
2524 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2525 Widget_Data *wd = elm_widget_data_get(obj);
2526 if (!wd) return NULL;
2527 if (!wd->content) return NULL;
2528 Evas_Object *content = wd->content;
2529 elm_widget_sub_object_del(obj, wd->content);
2530 edje_object_part_unswallow(wd->frm, wd->content);
2535 /* windowing spcific calls - shall we do this differently? */
2537 static Ecore_X_Window
2538 _elm_ee_win_get(const Evas_Object *obj)
2541 #ifdef HAVE_ELEMENTARY_X
2542 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2543 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2549 * Get the Ecore_X_Window of an Evas_Object
2551 * @param obj The object
2553 * @return The Ecore_X_Window of @p obj
2558 elm_win_xwindow_get(const Evas_Object *obj)
2560 Ecore_X_Window xwin = 0;
2565 type = elm_widget_type_get(obj);
2566 if (!type) return 0;
2567 if (type != widtype) return _elm_ee_win_get(obj);
2568 #ifdef HAVE_ELEMENTARY_X
2569 win = elm_widget_data_get(obj);
2570 if (!win) return xwin;
2571 if (win->xwin) return win->xwin;
2572 if (win->parent) return elm_win_xwindow_get(win->parent);