1 #include <Elementary.h>
7 * The window class of Elementary. Contains functions to manipulate
11 typedef struct _Elm_Win Elm_Win;
17 Evas_Object *parent, *win_obj;
19 #ifdef HAVE_ELEMENTARY_X
21 Ecore_Event_Handler *client_message_handler;
23 Ecore_Job *deferred_resize_job;
24 Ecore_Job *deferred_child_eval_job;
27 Elm_Win_Keyboard_Mode kbdmode;
28 Eina_Bool autodel : 1;
29 int *autodel_clear, rot;
39 Eina_Bool visible : 1;
40 Eina_Bool handled : 1;
44 Ecore_Job *reconf_job;
46 Eina_Bool enabled : 1;
47 Eina_Bool changed_theme : 1;
48 Eina_Bool top_animate : 1;
49 Eina_Bool geometry_changed : 1;
53 static const char *widtype = NULL;
54 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
55 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
56 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
57 static void _elm_win_move(Ecore_Evas *ee);
58 static void _elm_win_resize(Ecore_Evas *ee);
59 static void _elm_win_delete_request(Ecore_Evas *ee);
60 static void _elm_win_resize_job(void *data);
61 #ifdef HAVE_ELEMENTARY_X
62 static void _elm_win_xwin_update(Elm_Win *win);
64 static void _elm_win_eval_subobjs(Evas_Object *obj);
65 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
66 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
67 static void _elm_win_focus_highlight_init(Elm_Win *win);
68 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
69 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
70 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
71 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
72 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
73 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
75 Eina_List *_elm_win_list = NULL;
76 int _elm_win_deferred_free = 0;
79 _elm_win_move(Ecore_Evas *ee)
81 Evas_Object *obj = ecore_evas_object_associate_get(ee);
86 win = elm_widget_data_get(obj);
88 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
91 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
95 _elm_win_resize(Ecore_Evas *ee)
97 Evas_Object *obj = ecore_evas_object_associate_get(ee);
101 win = elm_widget_data_get(obj);
103 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
104 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
108 _elm_win_focus_in(Ecore_Evas *ee)
110 Evas_Object *obj = ecore_evas_object_associate_get(ee);
114 win = elm_widget_data_get(obj);
116 /*NB: Why two different "focus signals" here ??? */
117 evas_object_smart_callback_call(win->win_obj, "focus-in", NULL); // FIXME: remove me
118 evas_object_smart_callback_call(win->win_obj, "focus,in", NULL);
119 win->focus_highlight.cur.visible = EINA_TRUE;
120 _elm_win_focus_highlight_reconfigure_job_start(win);
124 _elm_win_focus_out(Ecore_Evas *ee)
126 Evas_Object *obj = ecore_evas_object_associate_get(ee);
130 win = elm_widget_data_get(obj);
132 evas_object_smart_callback_call(win->win_obj, "focus-out", NULL); // FIXME: remove me
133 evas_object_smart_callback_call(win->win_obj, "focus,out", NULL);
134 win->focus_highlight.cur.visible = EINA_FALSE;
135 _elm_win_focus_highlight_reconfigure_job_start(win);
139 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
141 Elm_Win *wd = elm_widget_data_get(obj);
142 const Eina_List *items;
143 void *(*list_data_get) (const Eina_List *list);
151 if (!(items = elm_widget_focus_custom_chain_get(obj)))
157 list_data_get = eina_list_data_get;
159 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
165 *next = (Evas_Object *)obj;
170 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
172 if (elm_widget_focus_get(obj))
173 evas_object_focus_set(obj, EINA_TRUE);
175 evas_object_focus_set(obj, EINA_FALSE);
179 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
181 if (type == EVAS_CALLBACK_KEY_DOWN)
183 Evas_Event_Key_Down *ev = event_info;
184 if (!strcmp(ev->keyname, "Tab"))
186 if(evas_key_modifier_is_set(ev->modifiers, "Shift"))
187 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
189 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
190 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
199 _deferred_ecore_evas_free(void *data)
201 ecore_evas_free(data);
202 _elm_win_deferred_free--;
206 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
208 elm_object_focus(obj);
212 _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
219 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
220 _elm_win_obj_callback_parent_del, win);
223 if (win->autodel_clear) *(win->autodel_clear) = -1;
224 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
225 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
226 ecore_evas_callback_delete_request_set(win->ee, NULL);
227 ecore_evas_callback_resize_set(win->ee, NULL);
228 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
229 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
230 while (((child = evas_object_bottom_get(win->evas))) &&
233 evas_object_del(child);
235 while (((child = evas_object_top_get(win->evas))) &&
238 evas_object_del(child);
240 #ifdef HAVE_ELEMENTARY_X
241 if (win->client_message_handler)
242 ecore_event_handler_del(win->client_message_handler);
244 // FIXME: Why are we flushing edje on every window destroy ??
245 // edje_file_cache_flush();
246 // edje_collection_cache_flush();
247 // evas_image_cache_flush(win->evas);
248 // evas_font_cache_flush(win->evas);
249 // FIXME: we are in the del handler for the object and delete the canvas
250 // that lives under it from the handler... nasty. deferring doesn't help either
252 ecore_job_add(_deferred_ecore_evas_free, win->ee);
253 _elm_win_deferred_free++;
254 // ecore_evas_free(win->ee);
256 _elm_win_focus_highlight_shutdown(win);
257 eina_stringshare_del(win->focus_highlight.style);
261 if ((!_elm_win_list) &&
262 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
264 edje_file_cache_flush();
265 edje_collection_cache_flush();
266 evas_image_cache_flush(e);
267 evas_font_cache_flush(e);
273 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
276 if (obj == win->parent) win->parent = NULL;
280 _elm_win_obj_intercept_show(void *data __UNUSED__, Evas_Object *obj)
282 // this is called to make sure all smart containers have calculated their
283 // sizes BEFORE we show the window to make sure it initially appears at
284 // our desired size (ie min size is known first)
285 evas_smart_objects_calculate(evas_object_evas_get(obj));
286 evas_object_show(obj);
290 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
294 if (ecore_evas_override_get(win->ee))
298 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
301 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
306 _elm_win_delete_request(Ecore_Evas *ee)
308 Evas_Object *obj = ecore_evas_object_associate_get(ee);
310 if (strcmp(elm_widget_type_get(obj), "win")) return;
312 win = elm_widget_data_get(obj);
314 int autodel = win->autodel;
315 win->autodel_clear = &autodel;
316 evas_object_smart_callback_call(win->win_obj, "delete-request", NULL); // FIXME: remove me
317 evas_object_smart_callback_call(win->win_obj, "delete,request", NULL);
318 // FIXME: if above callback deletes - then the below will be invalid
319 if (autodel) evas_object_del(win->win_obj);
320 else win->autodel_clear = NULL;
324 _elm_win_resize_job(void *data)
331 win->deferred_resize_job = NULL;
332 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
333 evas_object_resize(win->win_obj, w, h);
334 EINA_LIST_FOREACH(win->subobjs, l, obj)
336 evas_object_move(obj, 0, 0);
337 evas_object_resize(obj, w, h);
341 #ifdef HAVE_ELEMENTARY_X
343 _elm_win_xwindow_get(Elm_Win *win)
347 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
348 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
350 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
352 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
353 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
354 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
355 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
356 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
357 ENGINE_COMPARE(ELM_OPENGL_SDL))
360 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
362 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
364 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
366 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
368 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
370 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
372 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
374 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
376 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
378 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
380 #undef ENGINE_COMPARE
384 #ifdef HAVE_ELEMENTARY_X
386 _elm_win_xwin_update(Elm_Win *win)
388 _elm_win_xwindow_get(win);
393 win2 = elm_widget_data_get(win->parent);
397 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
401 if (!win->xwin) return; /* nothing more to do */
406 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
408 case ELM_WIN_DIALOG_BASIC:
409 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
411 case ELM_WIN_DESKTOP:
412 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
415 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
417 case ELM_WIN_TOOLBAR:
418 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
421 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
423 case ELM_WIN_UTILITY:
424 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
427 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
429 case ELM_WIN_DROPDOWN_MENU:
430 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
432 case ELM_WIN_POPUP_MENU:
433 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
435 case ELM_WIN_TOOLTIP:
436 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
438 case ELM_WIN_NOTIFICATION:
439 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
442 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
445 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
450 ecore_x_e_virtual_keyboard_state_set
451 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
456 _elm_win_eval_subobjs(Evas_Object *obj)
459 const Evas_Object *child;
461 Elm_Win *win = elm_widget_data_get(obj);
462 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
466 EINA_LIST_FOREACH(win->subobjs, l, child)
468 evas_object_size_hint_weight_get(child, &wx, &wy);
469 if (wx == 0.0) xx = 0;
470 if (wy == 0.0) xy = 0;
472 evas_object_size_hint_min_get(child, &w, &h);
475 if (w > minw) minw = w;
476 if (h > minh) minh = h;
478 evas_object_size_hint_max_get(child, &w, &h);
481 if (maxw == -1) maxw = w;
482 else if ((w > 0) && (w < maxw)) maxw = w;
483 if (maxh == -1) maxh = h;
484 else if ((h > 0) && (h < maxh)) maxh = h;
486 if (!xx) maxw = minw;
488 if (!xy) maxh = minh;
490 evas_object_size_hint_min_set(obj, minw, minh);
491 evas_object_size_hint_max_set(obj, maxw, maxh);
492 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
493 if (w < minw) w = minw;
494 if (h < minh) h = minh;
495 if ((maxw >= 0) && (w > maxw)) w = maxw;
496 if ((maxh >= 0) && (h > maxh)) h = maxh;
497 evas_object_resize(obj, w, h);
501 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
503 Elm_Win *win = elm_widget_data_get(data);
504 win->subobjs = eina_list_remove(win->subobjs, obj);
505 _elm_win_eval_subobjs(win->win_obj);
509 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
511 _elm_win_eval_subobjs(data);
515 _elm_win_shutdown(void)
517 while (_elm_win_list)
518 evas_object_del(_elm_win_list->data);
522 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
529 EINA_LIST_FOREACH(_elm_win_list, l, obj)
530 elm_widget_theme(obj);
534 EINA_LIST_FOREACH(_elm_win_list, l, obj)
535 elm_widget_theme_specific(obj, th, EINA_FALSE);
539 #ifdef HAVE_ELEMENTARY_X
541 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
544 Ecore_X_Event_Client_Message *e = event;
546 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
547 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
549 if ((unsigned)e->data.l[0] == win->xwin)
551 Evas *evas = evas_object_evas_get(win->win_obj);
554 edje_file_cache_flush();
555 edje_collection_cache_flush();
556 evas_image_cache_flush(evas);
557 evas_font_cache_flush(evas);
561 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
563 if ((unsigned)e->data.l[0] == win->xwin)
565 Evas *evas = evas_object_evas_get(win->win_obj);
568 edje_file_cache_flush();
569 edje_collection_cache_flush();
570 evas_image_cache_flush(evas);
571 evas_font_cache_flush(evas);
572 evas_render_dump(evas);
576 return ECORE_CALLBACK_PASS_ON;
581 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
585 win->focus_highlight.geometry_changed = EINA_TRUE;
586 _elm_win_focus_highlight_reconfigure_job_start(win);
590 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
594 win->focus_highlight.geometry_changed = EINA_TRUE;
595 _elm_win_focus_highlight_reconfigure_job_start(win);
599 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
603 win->focus_highlight.cur.target = NULL;
605 _elm_win_focus_highlight_reconfigure_job_start(win);
609 _elm_win_focus_target_callbacks_add(Elm_Win *win)
611 Evas_Object *obj = win->focus_highlight.cur.target;
613 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
614 _elm_win_focus_target_move, win);
615 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
616 _elm_win_focus_target_resize, win);
617 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
618 _elm_win_focus_target_del, win);
622 _elm_win_focus_target_callbacks_del(Elm_Win *win)
624 Evas_Object *obj = win->focus_highlight.cur.target;
626 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
627 _elm_win_focus_target_move, win);
628 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
629 _elm_win_focus_target_resize, win);
630 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
631 _elm_win_focus_target_del, win);
635 _elm_win_focus_target_get(Evas_Object *obj)
637 Evas_Object *o = obj;
641 if (elm_widget_is(o))
643 if (!elm_widget_highlight_ignore_get(o))
645 o = elm_widget_parent_get(o);
647 o = evas_object_smart_parent_get(o);
651 o = elm_widget_parent_widget_get(o);
653 o = evas_object_smart_parent_get(o);
662 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
664 Evas_Object *obj = event_info, *target;
667 if (win->focus_highlight.cur.target == obj)
670 target = _elm_win_focus_target_get(obj);
671 win->focus_highlight.cur.target = target;
672 if (elm_widget_highlight_in_theme_get(target))
673 win->focus_highlight.cur.handled = EINA_TRUE;
675 _elm_win_focus_target_callbacks_add(win);
677 _elm_win_focus_highlight_reconfigure_job_start(win);
681 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
685 if (!win->focus_highlight.cur.target)
688 if (!win->focus_highlight.cur.handled)
689 _elm_win_focus_target_callbacks_del(win);
690 win->focus_highlight.cur.target = NULL;
691 win->focus_highlight.cur.handled = EINA_FALSE;
693 _elm_win_focus_highlight_reconfigure_job_start(win);
697 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
699 evas_object_hide(obj);
703 _elm_win_focus_highlight_init(Elm_Win *win)
705 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
706 _elm_win_object_focus_in, win);
707 evas_event_callback_add(win->evas,
708 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
709 _elm_win_object_focus_out, win);
711 win->focus_highlight.cur.target = evas_focus_get(win->evas);
713 win->focus_highlight.top = edje_object_add(win->evas);
714 win->focus_highlight.changed_theme = EINA_TRUE;
715 edje_object_signal_callback_add(win->focus_highlight.top,
716 "elm,action,focus,hide,end", "",
717 _elm_win_focus_highlight_hide, NULL);
718 edje_object_signal_callback_add(win->focus_highlight.top,
719 "elm,action,focus,anim,end", "",
720 _elm_win_focus_highlight_anim_end, win);
721 _elm_win_focus_highlight_reconfigure_job_start(win);
725 _elm_win_focus_highlight_shutdown(Elm_Win *win)
727 _elm_win_focus_highlight_reconfigure_job_stop(win);
728 if (win->focus_highlight.cur.target)
730 _elm_win_focus_target_callbacks_del(win);
731 win->focus_highlight.cur.target = NULL;
733 if (win->focus_highlight.top)
735 evas_object_del(win->focus_highlight.top);
736 win->focus_highlight.top = NULL;
739 evas_event_callback_del_full(win->evas,
740 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
741 _elm_win_object_focus_in, win);
742 evas_event_callback_del_full(win->evas,
743 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
744 _elm_win_object_focus_out, win);
748 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
752 top = win->focus_highlight.top;
757 evas_object_show(top);
758 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
764 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
769 _elm_win_focus_highlight_reconfigure_job(void *data)
771 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
775 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
777 if (win->focus_highlight.reconf_job)
778 ecore_job_del(win->focus_highlight.reconf_job);
779 win->focus_highlight.reconf_job = ecore_job_add(
780 _elm_win_focus_highlight_reconfigure_job, win);
784 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
786 if (win->focus_highlight.reconf_job)
787 ecore_job_del(win->focus_highlight.reconf_job);
788 win->focus_highlight.reconf_job = NULL;
792 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
794 Evas_Object *clip, *target = win->focus_highlight.cur.target;
795 Evas_Coord x, y, w, h;
797 clip = evas_object_clip_get(target);
798 evas_object_geometry_get(target, &x, &y, &w, &h);
800 evas_object_move(obj, x, y);
801 evas_object_resize(obj, w, h);
802 evas_object_clip_set(obj, clip);
806 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
808 Evas_Coord tx, ty, tw, th;
809 Evas_Coord w, h, px, py, pw, ph;
810 Edje_Message_Int_Set *m;
811 Evas_Object *previous = win->focus_highlight.prev.target;
812 Evas_Object *target = win->focus_highlight.cur.target;
814 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
815 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
816 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
817 evas_object_move(obj, 0, 0);
818 evas_object_resize(obj, tw, th);
819 evas_object_clip_unset(obj);
821 m = alloca(sizeof(*m) + (sizeof(int) * 8));
831 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
835 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
838 _elm_win_focus_highlight_simple_setup(win, obj);
842 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
844 Evas_Object *target = win->focus_highlight.cur.target;
845 Evas_Object *previous = win->focus_highlight.prev.target;
846 Evas_Object *top = win->focus_highlight.top;
847 Eina_Bool visible_changed;
848 Eina_Bool common_visible;
849 const char *sig = NULL;
851 _elm_win_focus_highlight_reconfigure_job_stop(win);
853 visible_changed = (win->focus_highlight.cur.visible !=
854 win->focus_highlight.prev.visible);
856 if ((target == previous) && (!visible_changed) &&
857 (!win->focus_highlight.geometry_changed))
860 if ((previous) && (win->focus_highlight.prev.handled))
861 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
864 common_visible = EINA_FALSE;
865 else if (win->focus_highlight.cur.handled)
867 common_visible = EINA_FALSE;
868 if (win->focus_highlight.cur.visible)
869 sig = "elm,action,focus_highlight,show";
871 sig = "elm,action,focus_highlight,hide";
874 common_visible = win->focus_highlight.cur.visible;
876 _elm_win_focus_highlight_visible_set(win, common_visible);
878 elm_widget_signal_emit(target, sig, "elm");
880 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
883 if (win->focus_highlight.changed_theme)
886 if (win->focus_highlight.style)
887 str = win->focus_highlight.style;
890 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
892 win->focus_highlight.changed_theme = EINA_FALSE;
894 if (_elm_config->focus_highlight_animate)
896 str = edje_object_data_get(win->focus_highlight.top, "animate");
897 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
901 if ((win->focus_highlight.top_animate) && (previous) &&
902 (!win->focus_highlight.prev.handled))
903 _elm_win_focus_highlight_anim_setup(win, top);
905 _elm_win_focus_highlight_simple_setup(win, top);
906 evas_object_raise(top);
909 win->focus_highlight.geometry_changed = EINA_FALSE;
910 win->focus_highlight.prev = win->focus_highlight.cur;
915 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
917 Evas_Event_Key_Down *ev = event_info;
919 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
923 if ((strcmp(ev->keyname, "F12")) ||
924 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
927 printf("Tree graph generated.\n");
928 elm_object_tree_dot_dump(obj, "./dump.dot");
933 * Adds a window object. If this is the first window created, pass NULL as
936 * @param parent Parent object to add the window to, or NULL
937 * @param name The name of the window
938 * @param type The window type, one of the following:
940 * ELM_WIN_DIALOG_BASIC
948 * @return The created object, or NULL on failure
953 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
957 const char *fontpath;
959 win = ELM_NEW(Elm_Win);
961 #define FALLBACK_TRY(engine) \
964 CRITICAL(engine " engine creation failed. Trying software X11."); \
965 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
968 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
969 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
971 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
972 #ifdef HAVE_ELEMENTARY_X
973 win->client_message_handler = ecore_event_handler_add
974 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
977 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
979 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
980 FALLBACK_TRY("Sofware FB");
982 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
984 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
985 FALLBACK_TRY("Sofware DirectFB");
987 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
989 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
990 FALLBACK_TRY("Sofware-16");
991 #ifdef HAVE_ELEMENTARY_X
992 win->client_message_handler = ecore_event_handler_add
993 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
996 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
998 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
999 FALLBACK_TRY("Sofware-8");
1000 #ifdef HAVE_ELEMENTARY_X
1001 win->client_message_handler = ecore_event_handler_add
1002 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1005 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1007 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1008 FALLBACK_TRY("XRender");
1009 #ifdef HAVE_ELEMENTARY_X
1010 win->client_message_handler = ecore_event_handler_add
1011 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1014 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1016 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1017 FALLBACK_TRY("OpenGL");
1018 #ifdef HAVE_ELEMENTARY_X
1019 win->client_message_handler = ecore_event_handler_add
1020 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1023 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1025 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1026 FALLBACK_TRY("Sofware Win32");
1028 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1030 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1031 FALLBACK_TRY("Sofware-16-WinCE");
1033 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1035 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1036 FALLBACK_TRY("Sofware SDL");
1038 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1040 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1041 FALLBACK_TRY("Sofware-16-SDL");
1043 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1045 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1046 FALLBACK_TRY("OpenGL SDL");
1052 ERR("Cannot create window.");
1056 #ifdef HAVE_ELEMENTARY_X
1057 _elm_win_xwindow_get(win);
1059 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1060 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1061 // bg pixmap done by x - has other issues like can be redrawn by x before it
1062 // is filled/ready by app
1063 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1066 win->parent = parent;
1068 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1069 _elm_win_obj_callback_parent_del, win);
1071 win->evas = ecore_evas_get(win->ee);
1072 win->win_obj = elm_widget_add(win->evas);
1073 elm_widget_type_set(win->win_obj, "win");
1074 ELM_SET_WIDTYPE(widtype, "win");
1075 elm_widget_data_set(win->win_obj, win);
1076 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1077 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1078 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1079 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1080 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1081 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1082 evas_object_move(win->win_obj, 0, 0);
1083 evas_object_resize(win->win_obj, 1, 1);
1084 evas_object_layer_set(win->win_obj, 50);
1085 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1087 evas_object_intercept_show_callback_add(win->win_obj,
1088 _elm_win_obj_intercept_show, win);
1089 ecore_evas_object_associate(win->ee, win->win_obj,
1090 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1091 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1092 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1093 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1094 _elm_win_obj_callback_show, win);
1095 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1096 _elm_win_obj_callback_del, win);
1097 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1098 _elm_win_obj_callback_move, win);
1100 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1101 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1102 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1103 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1104 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1105 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1106 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1107 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1108 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1109 evas_font_path_append(win->evas, fontpath);
1110 if (!_elm_config->font_hinting)
1111 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1112 else if (_elm_config->font_hinting == 1)
1113 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1114 else if (_elm_config->font_hinting == 2)
1115 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1117 #ifdef HAVE_ELEMENTARY_X
1118 _elm_win_xwin_update(win);
1121 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1123 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1125 ecore_evas_fullscreen_set(win->ee, 1);
1127 #undef ENGINE_COMPARE
1129 if (_elm_config->focus_highlight_enable)
1130 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1133 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1134 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1135 _debug_key_down, win);
1136 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0, EINA_TRUE);
1137 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1139 return win->win_obj;
1143 * Add @p subobj as a resize object of window @p obj.
1145 * @param obj The window object
1146 * @param subobj The resize object to add
1151 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1155 ELM_CHECK_WIDTYPE(obj, widtype);
1156 win = elm_widget_data_get(obj);
1158 win->subobjs = eina_list_append(win->subobjs, subobj);
1159 elm_widget_sub_object_add(obj, subobj);
1160 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1161 _elm_win_subobj_callback_del, obj);
1162 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1163 _elm_win_subobj_callback_changed_size_hints,
1165 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1166 evas_object_move(subobj, 0, 0);
1167 evas_object_resize(subobj, w, h);
1168 _elm_win_eval_subobjs(obj);
1172 * Delete @p subobj as a resize object of window @p obj.
1174 * @param obj The window object
1175 * @param subobj The resize object to add
1180 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1183 ELM_CHECK_WIDTYPE(obj, widtype);
1184 win = elm_widget_data_get(obj);
1186 evas_object_event_callback_del_full(subobj,
1187 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1188 _elm_win_subobj_callback_changed_size_hints,
1190 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1191 _elm_win_subobj_callback_del, obj);
1192 win->subobjs = eina_list_remove(win->subobjs, subobj);
1193 elm_widget_sub_object_del(obj, subobj);
1194 _elm_win_eval_subobjs(obj);
1198 * Set the title of the window
1200 * @param obj The window object
1201 * @param title The title to set
1206 elm_win_title_set(Evas_Object *obj, const char *title)
1209 ELM_CHECK_WIDTYPE(obj, widtype);
1210 win = elm_widget_data_get(obj);
1212 ecore_evas_title_set(win->ee, title);
1216 * Get the title of the window
1218 * @param obj The window object
1224 elm_win_title_get(const Evas_Object *obj)
1227 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1228 win = elm_widget_data_get(obj);
1229 if (!win) return NULL;
1230 return ecore_evas_title_get(win->ee);
1234 * Set the window's autodel state.
1236 * @param obj The window object
1237 * @param autodel If true, the window will automatically delete itself when closed
1242 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1245 ELM_CHECK_WIDTYPE(obj, widtype);
1246 win = elm_widget_data_get(obj);
1248 win->autodel = autodel;
1252 * Get the window's autodel state.
1254 * @param obj The window object
1255 * @return If the window will automatically delete itself when closed
1260 elm_win_autodel_get(const Evas_Object *obj)
1263 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1264 win = elm_widget_data_get(obj);
1265 if (!win) return EINA_FALSE;
1266 return win->autodel;
1270 * Activate a window object.
1272 * @param obj The window object
1277 elm_win_activate(Evas_Object *obj)
1280 ELM_CHECK_WIDTYPE(obj, widtype);
1281 win = elm_widget_data_get(obj);
1283 ecore_evas_activate(win->ee);
1287 * Lower a window object.
1289 * @param obj The window object
1294 elm_win_lower(Evas_Object *obj)
1297 ELM_CHECK_WIDTYPE(obj, widtype);
1298 win = elm_widget_data_get(obj);
1300 ecore_evas_lower(win->ee);
1304 * Raise a window object.
1306 * @param obj The window object
1311 elm_win_raise(Evas_Object *obj)
1314 ELM_CHECK_WIDTYPE(obj, widtype);
1315 win = elm_widget_data_get(obj);
1317 ecore_evas_raise(win->ee);
1321 * Set the borderless state of a window.
1323 * @param obj The window object
1324 * @param borderless If true, the window is borderless
1329 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1332 ELM_CHECK_WIDTYPE(obj, widtype);
1333 win = elm_widget_data_get(obj);
1335 ecore_evas_borderless_set(win->ee, borderless);
1336 #ifdef HAVE_ELEMENTARY_X
1337 _elm_win_xwin_update(win);
1342 * Get the borderless state of a window.
1344 * @param obj The window object
1345 * @return If true, the window is borderless
1350 elm_win_borderless_get(const Evas_Object *obj)
1353 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1354 win = elm_widget_data_get(obj);
1355 if (!win) return EINA_FALSE;
1356 return ecore_evas_borderless_get(win->ee);
1360 * Set the shaped state of a window.
1362 * @param obj The window object
1363 * @param shaped If true, the window is shaped
1368 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1371 ELM_CHECK_WIDTYPE(obj, widtype);
1372 win = elm_widget_data_get(obj);
1374 ecore_evas_shaped_set(win->ee, shaped);
1375 #ifdef HAVE_ELEMENTARY_X
1376 _elm_win_xwin_update(win);
1381 * Get the shaped state of a window.
1383 * @param obj The window object
1384 * @return If true, the window is shaped
1389 elm_win_shaped_get(const Evas_Object *obj)
1392 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1393 win = elm_widget_data_get(obj);
1394 if (!win) return EINA_FALSE;
1395 return ecore_evas_shaped_get(win->ee);
1399 * Set the alpha channel state of a window.
1401 * @param obj The window object
1402 * @param alpha If true, the window has an alpha channel
1407 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1410 ELM_CHECK_WIDTYPE(obj, widtype);
1411 win = elm_widget_data_get(obj);
1413 #ifdef HAVE_ELEMENTARY_X
1418 if (!_elm_config->compositing)
1419 elm_win_shaped_set(obj, alpha);
1421 ecore_evas_alpha_set(win->ee, alpha);
1424 ecore_evas_alpha_set(win->ee, alpha);
1425 _elm_win_xwin_update(win);
1429 ecore_evas_alpha_set(win->ee, alpha);
1433 * Get the alpha channel state of a window.
1435 * @param obj The window object
1436 * @return If true, the window has an alpha channel
1441 elm_win_alpha_get(const Evas_Object *obj)
1444 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1445 win = elm_widget_data_get(obj);
1446 if (!win) return EINA_FALSE;
1447 return ecore_evas_alpha_get(win->ee);
1451 * Set the transparency state of a window.
1453 * @param obj The window object
1454 * @param transparent If true, the window is transparent
1459 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1462 ELM_CHECK_WIDTYPE(obj, widtype);
1463 win = elm_widget_data_get(obj);
1466 #ifdef HAVE_ELEMENTARY_X
1469 ecore_evas_transparent_set(win->ee, transparent);
1470 _elm_win_xwin_update(win);
1474 ecore_evas_transparent_set(win->ee, transparent);
1478 * Get the transparency state of a window.
1480 * @param obj The window object
1481 * @return If true, the window is transparent
1486 elm_win_transparent_get(const Evas_Object *obj)
1489 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1490 win = elm_widget_data_get(obj);
1491 if (!win) return EINA_FALSE;
1493 return ecore_evas_transparent_get(win->ee);
1497 * Set the override state of a window.
1499 * @param obj The window object
1500 * @param override If true, the window is overridden
1505 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1508 ELM_CHECK_WIDTYPE(obj, widtype);
1509 win = elm_widget_data_get(obj);
1511 ecore_evas_override_set(win->ee, override);
1512 #ifdef HAVE_ELEMENTARY_X
1513 _elm_win_xwin_update(win);
1518 * Get the override state of a window.
1520 * @param obj The window object
1521 * @return If true, the window is overridden
1526 elm_win_override_get(const Evas_Object *obj)
1529 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1530 win = elm_widget_data_get(obj);
1531 if (!win) return EINA_FALSE;
1532 return ecore_evas_override_get(win->ee);
1536 * Set the fullscreen state of a window.
1538 * @param obj The window object
1539 * @param fullscreen If true, the window is fullscreen
1544 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1547 ELM_CHECK_WIDTYPE(obj, widtype);
1548 win = elm_widget_data_get(obj);
1551 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1552 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1553 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1555 // these engines... can ONLY be fullscreen
1560 ecore_evas_fullscreen_set(win->ee, fullscreen);
1561 #ifdef HAVE_ELEMENTARY_X
1562 _elm_win_xwin_update(win);
1565 #undef ENGINE_COMPARE
1569 * Get the fullscreen state of a window.
1571 * @param obj The window object
1572 * @return If true, the window is fullscreen
1577 elm_win_fullscreen_get(const Evas_Object *obj)
1580 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1581 win = elm_widget_data_get(obj);
1582 if (!win) return EINA_FALSE;
1584 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1585 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1586 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1588 // these engines... can ONLY be fullscreen
1593 return ecore_evas_fullscreen_get(win->ee);
1595 #undef ENGINE_COMPARE
1599 * Set the maximized state of a window.
1601 * @param obj The window object
1602 * @param maximized If true, the window is maximized
1607 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1610 ELM_CHECK_WIDTYPE(obj, widtype);
1611 win = elm_widget_data_get(obj);
1613 ecore_evas_maximized_set(win->ee, maximized);
1614 #ifdef HAVE_ELEMENTARY_X
1615 _elm_win_xwin_update(win);
1620 * Get the maximized state of a window.
1622 * @param obj The window object
1623 * @return If true, the window is maximized
1628 elm_win_maximized_get(const Evas_Object *obj)
1631 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1632 win = elm_widget_data_get(obj);
1633 if (!win) return EINA_FALSE;
1634 return ecore_evas_maximized_get(win->ee);
1638 * Set the iconified state of a window.
1640 * @param obj The window object
1641 * @param iconified If true, the window is iconified
1646 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1649 ELM_CHECK_WIDTYPE(obj, widtype);
1650 win = elm_widget_data_get(obj);
1652 ecore_evas_iconified_set(win->ee, iconified);
1653 #ifdef HAVE_ELEMENTARY_X
1654 _elm_win_xwin_update(win);
1659 * Get the iconified state of a window.
1661 * @param obj The window object
1662 * @return If true, the window is iconified
1667 elm_win_iconified_get(const Evas_Object *obj)
1670 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1671 win = elm_widget_data_get(obj);
1672 if (!win) return EINA_FALSE;
1673 return ecore_evas_iconified_get(win->ee);
1677 * Set the layer of the window.
1679 * @param obj The window object
1680 * @param layer The layer of the window
1685 elm_win_layer_set(Evas_Object *obj, int layer)
1688 ELM_CHECK_WIDTYPE(obj, widtype);
1689 win = elm_widget_data_get(obj);
1691 ecore_evas_layer_set(win->ee, layer);
1692 #ifdef HAVE_ELEMENTARY_X
1693 _elm_win_xwin_update(win);
1698 * Get the layer of the window.
1700 * @param obj The window object
1701 * @return The layer of the window
1706 elm_win_layer_get(const Evas_Object *obj)
1709 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1710 win = elm_widget_data_get(obj);
1711 if (!win) return -1;
1712 return ecore_evas_layer_get(win->ee);
1716 * Set the rotation of the window.
1718 * @param obj The window object
1719 * @param rotation The rotation of the window, in degrees (0-360)
1724 elm_win_rotation_set(Evas_Object *obj, int rotation)
1727 ELM_CHECK_WIDTYPE(obj, widtype);
1728 win = elm_widget_data_get(obj);
1730 if (win->rot == rotation) return;
1731 win->rot = rotation;
1732 ecore_evas_rotation_set(win->ee, rotation);
1733 evas_object_size_hint_min_set(obj, -1, -1);
1734 evas_object_size_hint_max_set(obj, -1, -1);
1735 _elm_win_eval_subobjs(obj);
1736 #ifdef HAVE_ELEMENTARY_X
1737 _elm_win_xwin_update(win);
1742 * Rotates the window and resizes it
1744 * @param obj The window object
1745 * @param layer The rotation of the window in degrees (0-360)
1750 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1753 ELM_CHECK_WIDTYPE(obj, widtype);
1754 win = elm_widget_data_get(obj);
1756 if (win->rot == rotation) return;
1757 win->rot = rotation;
1758 ecore_evas_rotation_with_resize_set(win->ee, rotation);
1759 evas_object_size_hint_min_set(obj, -1, -1);
1760 evas_object_size_hint_max_set(obj, -1, -1);
1761 _elm_win_eval_subobjs(obj);
1762 #ifdef HAVE_ELEMENTARY_X
1763 _elm_win_xwin_update(win);
1768 * Get the rotation of the window.
1770 * @param obj The window object
1771 * @return The rotation of the window in degrees (0-360)
1776 elm_win_rotation_get(const Evas_Object *obj)
1779 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1780 win = elm_widget_data_get(obj);
1781 if (!win) return -1;
1786 * Set the sticky state of the window.
1788 * @param obj The window object
1789 * @param sticky If true, the window's sticky state is enabled
1794 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
1797 ELM_CHECK_WIDTYPE(obj, widtype);
1798 win = elm_widget_data_get(obj);
1800 ecore_evas_sticky_set(win->ee, sticky);
1801 #ifdef HAVE_ELEMENTARY_X
1802 _elm_win_xwin_update(win);
1807 * Get the sticky state of the window.
1809 * @param obj The window object
1810 * @return If true, the window's sticky state is enabled
1815 elm_win_sticky_get(const Evas_Object *obj)
1818 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1819 win = elm_widget_data_get(obj);
1820 if (!win) return EINA_FALSE;
1821 return ecore_evas_sticky_get(win->ee);
1825 * Sets the keyboard mode of the window.
1827 * @param obj The window object
1828 * @param mode The mode to set; one of:
1829 * ELM_WIN_KEYBOARD_UNKNOWN
1830 * ELM_WIN_KEYBOARD_OFF
1831 * ELM_WIN_KEYBOARD_ON
1832 * ELM_WIN_KEYBOARD_ALPHA
1833 * ELM_WIN_KEYBOARD_NUMERIC
1834 * ELM_WIN_KEYBOARD_PIN
1835 * ELM_WIN_KEYBOARD_PHONE_NUMBER
1836 * ELM_WIN_KEYBOARD_HEX
1837 * ELM_WIN_KEYBOARD_TERMINAL
1838 * ELM_WIN_KEYBOARD_PASSWORD
1839 * ELM_WIN_KEYBOARD_IP
1840 * ELM_WIN_KEYBOARD_HOST
1841 * ELM_WIN_KEYBOARD_FILE
1842 * ELM_WIN_KEYBOARD_URL
1843 * ELM_WIN_KEYBOARD_KEYPAD
1844 * ELM_WIN_KEYBOARD_J2ME
1849 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
1852 ELM_CHECK_WIDTYPE(obj, widtype);
1853 win = elm_widget_data_get(obj);
1855 if (mode == win->kbdmode) return;
1856 #ifdef HAVE_ELEMENTARY_X
1857 _elm_win_xwindow_get(win);
1859 win->kbdmode = mode;
1860 #ifdef HAVE_ELEMENTARY_X
1862 ecore_x_e_virtual_keyboard_state_set
1863 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1868 * Gets the keyboard mode of the window.
1870 * @param obj The window object
1871 * @return The mode; one of:
1872 * ELM_WIN_KEYBOARD_UNKNOWN
1873 * ELM_WIN_KEYBOARD_OFF
1874 * ELM_WIN_KEYBOARD_ON
1875 * ELM_WIN_KEYBOARD_ALPHA
1876 * ELM_WIN_KEYBOARD_NUMERIC
1877 * ELM_WIN_KEYBOARD_PIN
1878 * ELM_WIN_KEYBOARD_PHONE_NUMBER
1879 * ELM_WIN_KEYBOARD_HEX
1880 * ELM_WIN_KEYBOARD_TERMINAL
1881 * ELM_WIN_KEYBOARD_PASSWORD
1882 * ELM_WIN_KEYBOARD_IP
1883 * ELM_WIN_KEYBOARD_HOST
1884 * ELM_WIN_KEYBOARD_FILE
1885 * ELM_WIN_KEYBOARD_URL
1886 * ELM_WIN_KEYBOARD_KEYPAD
1887 * ELM_WIN_KEYBOARD_J2ME
1891 EAPI Elm_Win_Keyboard_Mode
1892 elm_win_keyboard_mode_get(const Evas_Object *obj)
1895 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
1896 win = elm_widget_data_get(obj);
1897 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
1898 return win->kbdmode;
1902 * Sets whether the window is a keyboard.
1904 * @param obj The window object
1905 * @param is_keyboard If true, the window is a virtual keyboard
1910 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
1913 ELM_CHECK_WIDTYPE(obj, widtype);
1914 win = elm_widget_data_get(obj);
1916 #ifdef HAVE_ELEMENTARY_X
1917 _elm_win_xwindow_get(win);
1919 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
1924 * Gets whether the window is a keyboard.
1926 * @param obj The window object
1927 * @return If the window is a virtual keyboard
1932 elm_win_keyboard_win_get(const Evas_Object *obj)
1935 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1936 win = elm_widget_data_get(obj);
1937 if (!win) return EINA_FALSE;
1938 #ifdef HAVE_ELEMENTARY_X
1939 _elm_win_xwindow_get(win);
1941 return ecore_x_e_virtual_keyboard_get(win->xwin);
1947 * Get the screen position of a window.
1949 * @param obj The window object
1950 * @param x The int to store the x coordinate to
1951 * @param y The int to store the y coordinate to
1956 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
1959 ELM_CHECK_WIDTYPE(obj, widtype);
1960 win = elm_widget_data_get(obj);
1962 if (x) *x = win->screen.x;
1963 if (y) *y = win->screen.y;
1967 * Set if this window is an illume conformant window
1969 * @param obj The window object
1970 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
1975 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
1978 ELM_CHECK_WIDTYPE(obj, widtype);
1979 win = elm_widget_data_get(obj);
1981 #ifdef HAVE_ELEMENTARY_X
1982 _elm_win_xwindow_get(win);
1984 ecore_x_e_illume_conformant_set(win->xwin, conformant);
1989 * Get if this window is an illume conformant window
1991 * @param obj The window object
1992 * @return A boolean if this window is illume conformant or not
1997 elm_win_conformant_get(const Evas_Object *obj)
2000 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2001 win = elm_widget_data_get(obj);
2002 if (!win) return EINA_FALSE;
2003 #ifdef HAVE_ELEMENTARY_X
2004 _elm_win_xwindow_get(win);
2006 return ecore_x_e_illume_conformant_get(win->xwin);
2012 * Set a window to be an illume quickpanel window
2014 * By default window objects are not quickpanel windows.
2016 * @param obj The window object
2017 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2022 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2025 ELM_CHECK_WIDTYPE(obj, widtype);
2026 win = elm_widget_data_get(obj);
2028 #ifdef HAVE_ELEMENTARY_X
2029 _elm_win_xwindow_get(win);
2032 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2035 Ecore_X_Window_State states[2];
2037 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2038 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2039 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2040 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2047 * Get if this window is a quickpanel or not
2049 * @param obj The window object
2050 * @return A boolean if this window is a quickpanel or not
2055 elm_win_quickpanel_get(const Evas_Object *obj)
2058 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2059 win = elm_widget_data_get(obj);
2060 if (!win) return EINA_FALSE;
2061 #ifdef HAVE_ELEMENTARY_X
2062 _elm_win_xwindow_get(win);
2064 return ecore_x_e_illume_quickpanel_get(win->xwin);
2070 * Set the major priority of a quickpanel window
2072 * @param obj The window object
2073 * @param priority The major priority for this quickpanel
2078 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2081 ELM_CHECK_WIDTYPE(obj, widtype);
2082 win = elm_widget_data_get(obj);
2084 #ifdef HAVE_ELEMENTARY_X
2085 _elm_win_xwindow_get(win);
2087 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2092 * Get the major priority of a quickpanel window
2094 * @param obj The window object
2095 * @return The major priority of this quickpanel
2100 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2103 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2104 win = elm_widget_data_get(obj);
2105 if (!win) return -1;
2106 #ifdef HAVE_ELEMENTARY_X
2107 _elm_win_xwindow_get(win);
2109 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2115 * Set the minor priority of a quickpanel window
2117 * @param obj The window object
2118 * @param priority The minor priority for this quickpanel
2123 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2126 ELM_CHECK_WIDTYPE(obj, widtype);
2127 win = elm_widget_data_get(obj);
2129 #ifdef HAVE_ELEMENTARY_X
2130 _elm_win_xwindow_get(win);
2132 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2137 * Get the minor priority of a quickpanel window
2139 * @param obj The window object
2140 * @return The minor priority of this quickpanel
2145 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2148 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2149 win = elm_widget_data_get(obj);
2150 if (!win) return -1;
2151 #ifdef HAVE_ELEMENTARY_X
2152 _elm_win_xwindow_get(win);
2154 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2160 * Set which zone this quickpanel should appear in
2162 * @param obj The window object
2163 * @param zone The requested zone for this quickpanel
2168 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2171 ELM_CHECK_WIDTYPE(obj, widtype);
2172 win = elm_widget_data_get(obj);
2174 #ifdef HAVE_ELEMENTARY_X
2175 _elm_win_xwindow_get(win);
2177 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2182 * Get which zone this quickpanel should appear in
2184 * @param obj The window object
2185 * @return The requested zone for this quickpanel
2190 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2193 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2194 win = elm_widget_data_get(obj);
2196 #ifdef HAVE_ELEMENTARY_X
2197 _elm_win_xwindow_get(win);
2199 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2205 * Set the window to be skipped by keyboard focus
2207 * This sets the window to be skipped by normal keyboard input. This means
2208 * a window manager will be asked to not focus this window as well as omit
2209 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2211 * Call this and enable it on a window BEFORE you show it for the first time,
2212 * otherwise it may have no effect.
2214 * Use this for windows that have only output information or might only be
2215 * interacted with by the mouse or fingers, and never for typing input.
2216 * Be careful that this may have side-effects like making the window
2217 * non-accessible in some cases unless the window is specially handled. Use
2220 * @param obj The window object
2221 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2226 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2229 ELM_CHECK_WIDTYPE(obj, widtype);
2230 win = elm_widget_data_get(obj);
2232 #ifdef HAVE_ELEMENTARY_X
2233 _elm_win_xwindow_get(win);
2238 Ecore_X_Window_State states[2];
2240 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2241 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2242 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2243 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2250 * Send a command to the windowing environment
2252 * This is intended to work in touchscreen or small screen device environments
2253 * where there is a more simplistic window management policy in place. This
2254 * uses the window object indicated to select which part of the environment
2255 * to control (the part that this window lives in), and provides a command
2256 * and an optional parameter structure (use NULL for this if not needed).
2258 * @param obj The window object that lives in the environment to control
2259 * @param command The command to send
2260 * @param params Optional parameters for the command
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 * Set the enabled status for the focus highlight in a window
2299 * This function will enable or disable the focus highlight only for the
2300 * given window, regardless of the global setting for it
2302 * @param obj The window where to enable the highlight
2303 * @param enabled The enabled value for the highlight
2308 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2312 ELM_CHECK_WIDTYPE(obj, widtype);
2314 win = elm_widget_data_get(obj);
2315 enabled = !!enabled;
2316 if (win->focus_highlight.enabled == enabled)
2319 win->focus_highlight.enabled = enabled;
2321 if (win->focus_highlight.enabled)
2322 _elm_win_focus_highlight_init(win);
2324 _elm_win_focus_highlight_shutdown(win);
2328 * Get the enabled value of the focus highlight for this window
2330 * @param obj The window in which to check if the focus highlight is enabled
2332 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2337 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2341 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2343 win = elm_widget_data_get(obj);
2344 return win->focus_highlight.enabled;
2348 * Set the style for the focus highlight on this window
2350 * Sets the style to use for theming the highlight of focused objects on
2351 * the given window. If @p style is NULL, the default will be used.
2353 * @param obj The window where to set the style
2354 * @param style The style to set
2359 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2363 ELM_CHECK_WIDTYPE(obj, widtype);
2365 win = elm_widget_data_get(obj);
2366 eina_stringshare_replace(&win->focus_highlight.style, style);
2367 win->focus_highlight.changed_theme = EINA_TRUE;
2368 _elm_win_focus_highlight_reconfigure_job_start(win);
2372 * Get the style set for the focus highlight object
2374 * Gets the style set for this windows highilght object, or NULL if none
2377 * @param obj The window to retrieve the highlights style from
2379 * @return The style set or NULL if none was. Default is used in that case.
2384 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2388 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2390 win = elm_widget_data_get(obj);
2391 return win->focus_highlight.style;
2394 typedef struct _Widget_Data Widget_Data;
2399 Evas_Object *content;
2402 static void _del_hook(Evas_Object *obj);
2403 static void _theme_hook(Evas_Object *obj);
2404 static void _sizing_eval(Evas_Object *obj);
2405 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2406 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2408 static const char *widtype2 = NULL;
2411 _del_hook(Evas_Object *obj)
2413 Widget_Data *wd = elm_widget_data_get(obj);
2419 _theme_hook(Evas_Object *obj)
2421 Widget_Data *wd = elm_widget_data_get(obj);
2422 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2424 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2429 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2431 Widget_Data *wd = elm_widget_data_get(obj);
2436 /* Try Focus cycle in subitem */
2439 elm_widget_focus_next_get(wd->content, dir, next);
2444 *next = (Evas_Object *)obj;
2449 _sizing_eval(Evas_Object *obj)
2451 Widget_Data *wd = elm_widget_data_get(obj);
2452 Evas_Coord minw = -1, minh = -1;
2454 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2455 edje_object_size_min_calc(wd->frm, &minw, &minh);
2456 evas_object_size_hint_min_set(obj, minw, minh);
2457 evas_object_size_hint_max_set(obj, -1, -1);
2461 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2467 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2469 Widget_Data *wd = elm_widget_data_get(obj);
2470 Evas_Object *sub = event_info;
2471 if (sub == wd->content)
2473 evas_object_event_callback_del_full
2474 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2481 * @defgroup Inwin Inwin
2483 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2486 elm_win_inwin_add(Evas_Object *obj)
2492 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2493 win = elm_widget_data_get(obj);
2494 if (!win) return NULL;
2495 wd = ELM_NEW(Widget_Data);
2496 obj2 = elm_widget_add(win->evas);
2497 elm_widget_type_set(obj2, "inwin");
2498 ELM_SET_WIDTYPE(widtype2, "inwin");
2499 elm_widget_sub_object_add(obj, obj2);
2500 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2501 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2502 elm_win_resize_object_add(obj, obj2);
2504 elm_widget_data_set(obj2, wd);
2505 elm_widget_del_hook_set(obj2, _del_hook);
2506 elm_widget_theme_hook_set(obj2, _theme_hook);
2507 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2508 elm_widget_can_focus_set(obj2, EINA_TRUE);
2509 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2511 wd->frm = edje_object_add(win->evas);
2512 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2513 elm_widget_resize_object_set(obj2, wd->frm);
2515 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2522 * Activates an inwin object
2524 * @param obj The inwin to activate
2529 elm_win_inwin_activate(Evas_Object *obj)
2531 ELM_CHECK_WIDTYPE(obj, widtype2);
2532 Widget_Data *wd = elm_widget_data_get(obj);
2534 evas_object_raise(obj);
2535 evas_object_show(obj);
2536 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2537 elm_object_focus(obj);
2541 * Set the content of an inwin object.
2543 * Once the content object is set, a previously set one will be deleted.
2544 * If you want to keep that old content object, use the
2545 * elm_win_inwin_content_unset() function.
2547 * @param obj The inwin object
2548 * @param content The object to set as content
2553 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2555 ELM_CHECK_WIDTYPE(obj, widtype2);
2556 Widget_Data *wd = elm_widget_data_get(obj);
2558 if (wd->content == content) return;
2559 if (wd->content) evas_object_del(wd->content);
2560 wd->content = content;
2563 elm_widget_sub_object_add(obj, content);
2564 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2565 _changed_size_hints, obj);
2566 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2572 * Get the content of an inwin object.
2574 * Return the content object which is set for this widget.
2576 * @param obj The inwin object
2577 * @return The content that is being used
2582 elm_win_inwin_content_get(const Evas_Object *obj)
2584 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2585 Widget_Data *wd = elm_widget_data_get(obj);
2586 if (!wd) return NULL;
2591 * Unset the content of an inwin object.
2593 * Unparent and return the content object which was set for this widget.
2595 * @param obj The inwin object
2596 * @return The content that was being used
2601 elm_win_inwin_content_unset(Evas_Object *obj)
2603 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2604 Widget_Data *wd = elm_widget_data_get(obj);
2605 if (!wd) return NULL;
2606 if (!wd->content) return NULL;
2607 Evas_Object *content = wd->content;
2608 elm_widget_sub_object_del(obj, wd->content);
2609 edje_object_part_unswallow(wd->frm, wd->content);
2614 /* windowing spcific calls - shall we do this differently? */
2616 * Get the Ecore_X_Window of an Evas_Object
2618 * @param obj The object
2620 * @return The Ecore_X_Window of @p obj
2625 elm_win_xwindow_get(const Evas_Object *obj)
2627 Ecore_X_Window xwin = 0;
2628 Ecore_Evas *ee = NULL;
2630 #ifdef HAVE_ELEMENTARY_X
2631 ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2632 if (ee) xwin = (Ecore_X_Window)ecore_evas_window_get(ee);