1 #include <Elementary.h>
8 * The window class of Elementary. Contains functions to manipulate
11 * Signals that you can add callbacks for are:
13 * "delete,request" - the user requested to delete the window
14 * "focus,in" - window got focus
15 * "focus,out" - window lost focus
16 * "moved" - window that holds the canvas was moved
19 typedef struct _Elm_Win Elm_Win;
25 Evas_Object *parent, *win_obj;
27 #ifdef HAVE_ELEMENTARY_X
29 Ecore_Event_Handler *client_message_handler;
31 Ecore_Job *deferred_resize_job;
32 Ecore_Job *deferred_child_eval_job;
35 Elm_Win_Keyboard_Mode kbdmode;
36 Eina_Bool autodel : 1;
37 int *autodel_clear, rot;
47 Eina_Bool visible : 1;
48 Eina_Bool handled : 1;
52 Ecore_Job *reconf_job;
54 Eina_Bool enabled : 1;
55 Eina_Bool changed_theme : 1;
56 Eina_Bool top_animate : 1;
57 Eina_Bool geometry_changed : 1;
61 static const char *widtype = NULL;
62 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
63 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
64 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
65 static void _elm_win_move(Ecore_Evas *ee);
66 static void _elm_win_resize(Ecore_Evas *ee);
67 static void _elm_win_delete_request(Ecore_Evas *ee);
68 static void _elm_win_resize_job(void *data);
69 #ifdef HAVE_ELEMENTARY_X
70 static void _elm_win_xwin_update(Elm_Win *win);
72 static void _elm_win_eval_subobjs(Evas_Object *obj);
73 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
74 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
75 static void _elm_win_focus_highlight_init(Elm_Win *win);
76 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
77 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
78 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
79 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
80 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
81 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
83 Eina_List *_elm_win_list = NULL;
84 int _elm_win_deferred_free = 0;
87 _elm_win_move(Ecore_Evas *ee)
89 Evas_Object *obj = ecore_evas_object_associate_get(ee);
94 win = elm_widget_data_get(obj);
96 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
99 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
103 _elm_win_resize(Ecore_Evas *ee)
105 Evas_Object *obj = ecore_evas_object_associate_get(ee);
109 win = elm_widget_data_get(obj);
111 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
112 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
116 _elm_win_focus_in(Ecore_Evas *ee)
118 Evas_Object *obj = ecore_evas_object_associate_get(ee);
122 win = elm_widget_data_get(obj);
124 /*NB: Why two different "focus signals" here ??? */
125 evas_object_smart_callback_call(win->win_obj, "focus-in", NULL); // FIXME: remove me
126 evas_object_smart_callback_call(win->win_obj, "focus,in", NULL);
127 win->focus_highlight.cur.visible = EINA_TRUE;
128 _elm_win_focus_highlight_reconfigure_job_start(win);
132 _elm_win_focus_out(Ecore_Evas *ee)
134 Evas_Object *obj = ecore_evas_object_associate_get(ee);
138 win = elm_widget_data_get(obj);
140 evas_object_smart_callback_call(win->win_obj, "focus-out", NULL); // FIXME: remove me
141 evas_object_smart_callback_call(win->win_obj, "focus,out", NULL);
142 win->focus_highlight.cur.visible = EINA_FALSE;
143 _elm_win_focus_highlight_reconfigure_job_start(win);
147 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
149 Elm_Win *wd = elm_widget_data_get(obj);
150 const Eina_List *items;
151 void *(*list_data_get) (const Eina_List *list);
159 if (!(items = elm_widget_focus_custom_chain_get(obj)))
165 list_data_get = eina_list_data_get;
167 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
173 *next = (Evas_Object *)obj;
178 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
180 if (elm_widget_focus_get(obj))
181 evas_object_focus_set(obj, EINA_TRUE);
183 evas_object_focus_set(obj, EINA_FALSE);
187 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
189 if (type == EVAS_CALLBACK_KEY_DOWN)
191 Evas_Event_Key_Down *ev = event_info;
192 if (!strcmp(ev->keyname, "Tab"))
194 if(evas_key_modifier_is_set(ev->modifiers, "Shift"))
195 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
197 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
198 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
207 _deferred_ecore_evas_free(void *data)
209 ecore_evas_free(data);
210 _elm_win_deferred_free--;
214 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
216 elm_object_focus(obj);
220 _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
227 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
228 _elm_win_obj_callback_parent_del, win);
231 if (win->autodel_clear) *(win->autodel_clear) = -1;
232 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
233 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
234 ecore_evas_callback_delete_request_set(win->ee, NULL);
235 ecore_evas_callback_resize_set(win->ee, NULL);
236 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
237 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
238 while (((child = evas_object_bottom_get(win->evas))) &&
241 evas_object_del(child);
243 while (((child = evas_object_top_get(win->evas))) &&
246 evas_object_del(child);
248 #ifdef HAVE_ELEMENTARY_X
249 if (win->client_message_handler)
250 ecore_event_handler_del(win->client_message_handler);
252 // FIXME: Why are we flushing edje on every window destroy ??
253 // edje_file_cache_flush();
254 // edje_collection_cache_flush();
255 // evas_image_cache_flush(win->evas);
256 // evas_font_cache_flush(win->evas);
257 // FIXME: we are in the del handler for the object and delete the canvas
258 // that lives under it from the handler... nasty. deferring doesn't help either
260 ecore_job_add(_deferred_ecore_evas_free, win->ee);
261 _elm_win_deferred_free++;
262 // ecore_evas_free(win->ee);
264 _elm_win_focus_highlight_shutdown(win);
265 eina_stringshare_del(win->focus_highlight.style);
269 if ((!_elm_win_list) &&
270 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
272 edje_file_cache_flush();
273 edje_collection_cache_flush();
274 evas_image_cache_flush(e);
275 evas_font_cache_flush(e);
281 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
284 if (obj == win->parent) win->parent = NULL;
288 _elm_win_obj_intercept_show(void *data __UNUSED__, Evas_Object *obj)
290 // this is called to make sure all smart containers have calculated their
291 // sizes BEFORE we show the window to make sure it initially appears at
292 // our desired size (ie min size is known first)
293 evas_smart_objects_calculate(evas_object_evas_get(obj));
294 evas_object_show(obj);
298 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
302 if (ecore_evas_override_get(win->ee))
306 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
309 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
314 _elm_win_delete_request(Ecore_Evas *ee)
316 Evas_Object *obj = ecore_evas_object_associate_get(ee);
318 if (strcmp(elm_widget_type_get(obj), "win")) return;
320 win = elm_widget_data_get(obj);
322 int autodel = win->autodel;
323 win->autodel_clear = &autodel;
324 evas_object_smart_callback_call(win->win_obj, "delete-request", NULL); // FIXME: remove me
325 evas_object_smart_callback_call(win->win_obj, "delete,request", NULL);
326 // FIXME: if above callback deletes - then the below will be invalid
327 if (autodel) evas_object_del(win->win_obj);
328 else win->autodel_clear = NULL;
332 _elm_win_resize_job(void *data)
339 win->deferred_resize_job = NULL;
340 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
341 evas_object_resize(win->win_obj, w, h);
342 EINA_LIST_FOREACH(win->subobjs, l, obj)
344 evas_object_move(obj, 0, 0);
345 evas_object_resize(obj, w, h);
349 #ifdef HAVE_ELEMENTARY_X
351 _elm_win_xwindow_get(Elm_Win *win)
355 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
356 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
358 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
360 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
361 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
362 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
363 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
364 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
365 ENGINE_COMPARE(ELM_OPENGL_SDL))
368 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
370 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
372 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
374 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
376 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
378 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
380 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
382 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
384 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
386 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
388 #undef ENGINE_COMPARE
392 #ifdef HAVE_ELEMENTARY_X
394 _elm_win_xwin_update(Elm_Win *win)
396 _elm_win_xwindow_get(win);
401 win2 = elm_widget_data_get(win->parent);
405 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
409 if (!win->xwin) return; /* nothing more to do */
414 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
416 case ELM_WIN_DIALOG_BASIC:
417 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
419 case ELM_WIN_DESKTOP:
420 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
423 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
425 case ELM_WIN_TOOLBAR:
426 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
429 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
431 case ELM_WIN_UTILITY:
432 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
435 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
437 case ELM_WIN_DROPDOWN_MENU:
438 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
440 case ELM_WIN_POPUP_MENU:
441 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
443 case ELM_WIN_TOOLTIP:
444 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
446 case ELM_WIN_NOTIFICATION:
447 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
450 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
453 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
458 ecore_x_e_virtual_keyboard_state_set
459 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
464 _elm_win_eval_subobjs(Evas_Object *obj)
467 const Evas_Object *child;
469 Elm_Win *win = elm_widget_data_get(obj);
470 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
474 EINA_LIST_FOREACH(win->subobjs, l, child)
476 evas_object_size_hint_weight_get(child, &wx, &wy);
477 if (wx == 0.0) xx = 0;
478 if (wy == 0.0) xy = 0;
480 evas_object_size_hint_min_get(child, &w, &h);
483 if (w > minw) minw = w;
484 if (h > minh) minh = h;
486 evas_object_size_hint_max_get(child, &w, &h);
489 if (maxw == -1) maxw = w;
490 else if ((w > 0) && (w < maxw)) maxw = w;
491 if (maxh == -1) maxh = h;
492 else if ((h > 0) && (h < maxh)) maxh = h;
494 if (!xx) maxw = minw;
496 if (!xy) maxh = minh;
498 evas_object_size_hint_min_set(obj, minw, minh);
499 evas_object_size_hint_max_set(obj, maxw, maxh);
500 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
501 if (w < minw) w = minw;
502 if (h < minh) h = minh;
503 if ((maxw >= 0) && (w > maxw)) w = maxw;
504 if ((maxh >= 0) && (h > maxh)) h = maxh;
505 evas_object_resize(obj, w, h);
509 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
511 Elm_Win *win = elm_widget_data_get(data);
512 win->subobjs = eina_list_remove(win->subobjs, obj);
513 _elm_win_eval_subobjs(win->win_obj);
517 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
519 _elm_win_eval_subobjs(data);
523 _elm_win_shutdown(void)
525 while (_elm_win_list)
526 evas_object_del(_elm_win_list->data);
530 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
537 EINA_LIST_FOREACH(_elm_win_list, l, obj)
538 elm_widget_theme(obj);
542 EINA_LIST_FOREACH(_elm_win_list, l, obj)
543 elm_widget_theme_specific(obj, th, EINA_FALSE);
547 #ifdef HAVE_ELEMENTARY_X
549 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
552 Ecore_X_Event_Client_Message *e = event;
554 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
555 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
557 if ((unsigned)e->data.l[0] == win->xwin)
559 Evas *evas = evas_object_evas_get(win->win_obj);
562 edje_file_cache_flush();
563 edje_collection_cache_flush();
564 evas_image_cache_flush(evas);
565 evas_font_cache_flush(evas);
569 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
571 if ((unsigned)e->data.l[0] == win->xwin)
573 Evas *evas = evas_object_evas_get(win->win_obj);
576 edje_file_cache_flush();
577 edje_collection_cache_flush();
578 evas_image_cache_flush(evas);
579 evas_font_cache_flush(evas);
580 evas_render_dump(evas);
584 return ECORE_CALLBACK_PASS_ON;
589 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
593 win->focus_highlight.geometry_changed = EINA_TRUE;
594 _elm_win_focus_highlight_reconfigure_job_start(win);
598 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
602 win->focus_highlight.geometry_changed = EINA_TRUE;
603 _elm_win_focus_highlight_reconfigure_job_start(win);
607 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
611 win->focus_highlight.cur.target = NULL;
613 _elm_win_focus_highlight_reconfigure_job_start(win);
617 _elm_win_focus_target_callbacks_add(Elm_Win *win)
619 Evas_Object *obj = win->focus_highlight.cur.target;
621 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
622 _elm_win_focus_target_move, win);
623 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
624 _elm_win_focus_target_resize, win);
625 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
626 _elm_win_focus_target_del, win);
630 _elm_win_focus_target_callbacks_del(Elm_Win *win)
632 Evas_Object *obj = win->focus_highlight.cur.target;
634 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
635 _elm_win_focus_target_move, win);
636 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
637 _elm_win_focus_target_resize, win);
638 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
639 _elm_win_focus_target_del, win);
643 _elm_win_focus_target_get(Evas_Object *obj)
645 Evas_Object *o = obj;
649 if (elm_widget_is(o))
651 if (!elm_widget_highlight_ignore_get(o))
653 o = elm_widget_parent_get(o);
655 o = evas_object_smart_parent_get(o);
659 o = elm_widget_parent_widget_get(o);
661 o = evas_object_smart_parent_get(o);
670 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
672 Evas_Object *obj = event_info, *target;
675 if (win->focus_highlight.cur.target == obj)
678 target = _elm_win_focus_target_get(obj);
679 win->focus_highlight.cur.target = target;
680 if (elm_widget_highlight_in_theme_get(target))
681 win->focus_highlight.cur.handled = EINA_TRUE;
683 _elm_win_focus_target_callbacks_add(win);
685 _elm_win_focus_highlight_reconfigure_job_start(win);
689 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
693 if (!win->focus_highlight.cur.target)
696 if (!win->focus_highlight.cur.handled)
697 _elm_win_focus_target_callbacks_del(win);
698 win->focus_highlight.cur.target = NULL;
699 win->focus_highlight.cur.handled = EINA_FALSE;
701 _elm_win_focus_highlight_reconfigure_job_start(win);
705 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
707 evas_object_hide(obj);
711 _elm_win_focus_highlight_init(Elm_Win *win)
713 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
714 _elm_win_object_focus_in, win);
715 evas_event_callback_add(win->evas,
716 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
717 _elm_win_object_focus_out, win);
719 win->focus_highlight.cur.target = evas_focus_get(win->evas);
721 win->focus_highlight.top = edje_object_add(win->evas);
722 win->focus_highlight.changed_theme = EINA_TRUE;
723 edje_object_signal_callback_add(win->focus_highlight.top,
724 "elm,action,focus,hide,end", "",
725 _elm_win_focus_highlight_hide, NULL);
726 edje_object_signal_callback_add(win->focus_highlight.top,
727 "elm,action,focus,anim,end", "",
728 _elm_win_focus_highlight_anim_end, win);
729 _elm_win_focus_highlight_reconfigure_job_start(win);
733 _elm_win_focus_highlight_shutdown(Elm_Win *win)
735 _elm_win_focus_highlight_reconfigure_job_stop(win);
736 if (win->focus_highlight.cur.target)
738 _elm_win_focus_target_callbacks_del(win);
739 win->focus_highlight.cur.target = NULL;
741 if (win->focus_highlight.top)
743 evas_object_del(win->focus_highlight.top);
744 win->focus_highlight.top = NULL;
747 evas_event_callback_del_full(win->evas,
748 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
749 _elm_win_object_focus_in, win);
750 evas_event_callback_del_full(win->evas,
751 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
752 _elm_win_object_focus_out, win);
756 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
760 top = win->focus_highlight.top;
765 evas_object_show(top);
766 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
772 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
777 _elm_win_focus_highlight_reconfigure_job(void *data)
779 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
783 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
785 if (win->focus_highlight.reconf_job)
786 ecore_job_del(win->focus_highlight.reconf_job);
787 win->focus_highlight.reconf_job = ecore_job_add(
788 _elm_win_focus_highlight_reconfigure_job, win);
792 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
794 if (win->focus_highlight.reconf_job)
795 ecore_job_del(win->focus_highlight.reconf_job);
796 win->focus_highlight.reconf_job = NULL;
800 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
802 Evas_Object *clip, *target = win->focus_highlight.cur.target;
803 Evas_Coord x, y, w, h;
805 clip = evas_object_clip_get(target);
806 evas_object_geometry_get(target, &x, &y, &w, &h);
808 evas_object_move(obj, x, y);
809 evas_object_resize(obj, w, h);
810 evas_object_clip_set(obj, clip);
814 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
816 Evas_Coord tx, ty, tw, th;
817 Evas_Coord w, h, px, py, pw, ph;
818 Edje_Message_Int_Set *m;
819 Evas_Object *previous = win->focus_highlight.prev.target;
820 Evas_Object *target = win->focus_highlight.cur.target;
822 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
823 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
824 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
825 evas_object_move(obj, 0, 0);
826 evas_object_resize(obj, tw, th);
827 evas_object_clip_unset(obj);
829 m = alloca(sizeof(*m) + (sizeof(int) * 8));
839 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
843 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
846 _elm_win_focus_highlight_simple_setup(win, obj);
850 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
852 Evas_Object *target = win->focus_highlight.cur.target;
853 Evas_Object *previous = win->focus_highlight.prev.target;
854 Evas_Object *top = win->focus_highlight.top;
855 Eina_Bool visible_changed;
856 Eina_Bool common_visible;
857 const char *sig = NULL;
859 _elm_win_focus_highlight_reconfigure_job_stop(win);
861 visible_changed = (win->focus_highlight.cur.visible !=
862 win->focus_highlight.prev.visible);
864 if ((target == previous) && (!visible_changed) &&
865 (!win->focus_highlight.geometry_changed))
868 if ((previous) && (win->focus_highlight.prev.handled))
869 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
872 common_visible = EINA_FALSE;
873 else if (win->focus_highlight.cur.handled)
875 common_visible = EINA_FALSE;
876 if (win->focus_highlight.cur.visible)
877 sig = "elm,action,focus_highlight,show";
879 sig = "elm,action,focus_highlight,hide";
882 common_visible = win->focus_highlight.cur.visible;
884 _elm_win_focus_highlight_visible_set(win, common_visible);
886 elm_widget_signal_emit(target, sig, "elm");
888 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
891 if (win->focus_highlight.changed_theme)
894 if (win->focus_highlight.style)
895 str = win->focus_highlight.style;
898 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
900 win->focus_highlight.changed_theme = EINA_FALSE;
902 if (_elm_config->focus_highlight_animate)
904 str = edje_object_data_get(win->focus_highlight.top, "animate");
905 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
909 if ((win->focus_highlight.top_animate) && (previous) &&
910 (!win->focus_highlight.prev.handled))
911 _elm_win_focus_highlight_anim_setup(win, top);
913 _elm_win_focus_highlight_simple_setup(win, top);
914 evas_object_raise(top);
917 win->focus_highlight.geometry_changed = EINA_FALSE;
918 win->focus_highlight.prev = win->focus_highlight.cur;
923 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
925 Evas_Event_Key_Down *ev = event_info;
927 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
931 if ((strcmp(ev->keyname, "F12")) ||
932 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
935 printf("Tree graph generated.\n");
936 elm_object_tree_dot_dump(obj, "./dump.dot");
941 * Adds a window object. If this is the first window created, pass NULL as
944 * @param parent Parent object to add the window to, or NULL
945 * @param name The name of the window
946 * @param type The window type, one of the following:
948 * ELM_WIN_DIALOG_BASIC
956 * @return The created object, or NULL on failure
961 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
965 const char *fontpath;
967 win = ELM_NEW(Elm_Win);
969 #define FALLBACK_TRY(engine) \
972 CRITICAL(engine " engine creation failed. Trying software X11."); \
973 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
976 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
977 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
979 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
980 #ifdef HAVE_ELEMENTARY_X
981 win->client_message_handler = ecore_event_handler_add
982 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
985 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
987 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
988 FALLBACK_TRY("Sofware FB");
990 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
992 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
993 FALLBACK_TRY("Sofware DirectFB");
995 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
997 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
998 FALLBACK_TRY("Sofware-16");
999 #ifdef HAVE_ELEMENTARY_X
1000 win->client_message_handler = ecore_event_handler_add
1001 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1004 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1006 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1007 FALLBACK_TRY("Sofware-8");
1008 #ifdef HAVE_ELEMENTARY_X
1009 win->client_message_handler = ecore_event_handler_add
1010 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1013 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1015 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1016 FALLBACK_TRY("XRender");
1017 #ifdef HAVE_ELEMENTARY_X
1018 win->client_message_handler = ecore_event_handler_add
1019 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1022 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1027 if (_elm_config->vsync)
1029 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1035 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1037 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1038 FALLBACK_TRY("OpenGL");
1039 #ifdef HAVE_ELEMENTARY_X
1040 win->client_message_handler = ecore_event_handler_add
1041 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1044 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1046 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1047 FALLBACK_TRY("Sofware Win32");
1049 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1051 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1052 FALLBACK_TRY("Sofware-16-WinCE");
1054 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1056 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1057 FALLBACK_TRY("Sofware SDL");
1059 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1061 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1062 FALLBACK_TRY("Sofware-16-SDL");
1064 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1066 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1067 FALLBACK_TRY("OpenGL SDL");
1073 ERR("Cannot create window.");
1077 #ifdef HAVE_ELEMENTARY_X
1078 _elm_win_xwindow_get(win);
1080 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1081 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1082 // bg pixmap done by x - has other issues like can be redrawn by x before it
1083 // is filled/ready by app
1084 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1087 win->parent = parent;
1089 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1090 _elm_win_obj_callback_parent_del, win);
1092 win->evas = ecore_evas_get(win->ee);
1093 win->win_obj = elm_widget_add(win->evas);
1094 elm_widget_type_set(win->win_obj, "win");
1095 ELM_SET_WIDTYPE(widtype, "win");
1096 elm_widget_data_set(win->win_obj, win);
1097 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1098 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1099 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1100 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1101 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1102 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1103 evas_object_move(win->win_obj, 0, 0);
1104 evas_object_resize(win->win_obj, 1, 1);
1105 evas_object_layer_set(win->win_obj, 50);
1106 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1108 evas_object_intercept_show_callback_add(win->win_obj,
1109 _elm_win_obj_intercept_show, win);
1110 ecore_evas_object_associate(win->ee, win->win_obj,
1111 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1112 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1113 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1114 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1115 _elm_win_obj_callback_show, win);
1116 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1117 _elm_win_obj_callback_del, win);
1118 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1119 _elm_win_obj_callback_move, win);
1121 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1122 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1123 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1124 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1125 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1126 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1127 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1128 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1129 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1130 evas_font_path_append(win->evas, fontpath);
1131 if (!_elm_config->font_hinting)
1132 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1133 else if (_elm_config->font_hinting == 1)
1134 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1135 else if (_elm_config->font_hinting == 2)
1136 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1138 #ifdef HAVE_ELEMENTARY_X
1139 _elm_win_xwin_update(win);
1142 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1144 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1146 ecore_evas_fullscreen_set(win->ee, 1);
1148 #undef ENGINE_COMPARE
1150 if (_elm_config->focus_highlight_enable)
1151 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1154 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1155 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1156 _debug_key_down, win);
1157 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0, EINA_TRUE);
1158 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1160 return win->win_obj;
1164 * Add @p subobj as a resize object of window @p obj.
1166 * @param obj The window object
1167 * @param subobj The resize object to add
1172 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1176 ELM_CHECK_WIDTYPE(obj, widtype);
1177 win = elm_widget_data_get(obj);
1179 win->subobjs = eina_list_append(win->subobjs, subobj);
1180 elm_widget_sub_object_add(obj, subobj);
1181 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1182 _elm_win_subobj_callback_del, obj);
1183 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1184 _elm_win_subobj_callback_changed_size_hints,
1186 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1187 evas_object_move(subobj, 0, 0);
1188 evas_object_resize(subobj, w, h);
1189 _elm_win_eval_subobjs(obj);
1193 * Delete @p subobj as a resize object of window @p obj.
1195 * @param obj The window object
1196 * @param subobj The resize object to add
1201 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1204 ELM_CHECK_WIDTYPE(obj, widtype);
1205 win = elm_widget_data_get(obj);
1207 evas_object_event_callback_del_full(subobj,
1208 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1209 _elm_win_subobj_callback_changed_size_hints,
1211 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1212 _elm_win_subobj_callback_del, obj);
1213 win->subobjs = eina_list_remove(win->subobjs, subobj);
1214 elm_widget_sub_object_del(obj, subobj);
1215 _elm_win_eval_subobjs(obj);
1219 * Set the title of the window
1221 * @param obj The window object
1222 * @param title The title to set
1227 elm_win_title_set(Evas_Object *obj, const char *title)
1230 ELM_CHECK_WIDTYPE(obj, widtype);
1231 win = elm_widget_data_get(obj);
1233 ecore_evas_title_set(win->ee, title);
1237 * Get the title of the window
1239 * @param obj The window object
1245 elm_win_title_get(const Evas_Object *obj)
1248 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1249 win = elm_widget_data_get(obj);
1250 if (!win) return NULL;
1251 return ecore_evas_title_get(win->ee);
1255 * Set the window's autodel state.
1257 * @param obj The window object
1258 * @param autodel If true, the window will automatically delete itself when closed
1263 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1266 ELM_CHECK_WIDTYPE(obj, widtype);
1267 win = elm_widget_data_get(obj);
1269 win->autodel = autodel;
1273 * Get the window's autodel state.
1275 * @param obj The window object
1276 * @return If the window will automatically delete itself when closed
1281 elm_win_autodel_get(const Evas_Object *obj)
1284 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1285 win = elm_widget_data_get(obj);
1286 if (!win) return EINA_FALSE;
1287 return win->autodel;
1291 * Activate a window object.
1293 * @param obj The window object
1298 elm_win_activate(Evas_Object *obj)
1301 ELM_CHECK_WIDTYPE(obj, widtype);
1302 win = elm_widget_data_get(obj);
1304 ecore_evas_activate(win->ee);
1308 * Lower a window object.
1310 * @param obj The window object
1315 elm_win_lower(Evas_Object *obj)
1318 ELM_CHECK_WIDTYPE(obj, widtype);
1319 win = elm_widget_data_get(obj);
1321 ecore_evas_lower(win->ee);
1325 * Raise a window object.
1327 * @param obj The window object
1332 elm_win_raise(Evas_Object *obj)
1335 ELM_CHECK_WIDTYPE(obj, widtype);
1336 win = elm_widget_data_get(obj);
1338 ecore_evas_raise(win->ee);
1342 * Set the borderless state of a window.
1344 * @param obj The window object
1345 * @param borderless If true, the window is borderless
1350 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1353 ELM_CHECK_WIDTYPE(obj, widtype);
1354 win = elm_widget_data_get(obj);
1356 ecore_evas_borderless_set(win->ee, borderless);
1357 #ifdef HAVE_ELEMENTARY_X
1358 _elm_win_xwin_update(win);
1363 * Get the borderless state of a window.
1365 * @param obj The window object
1366 * @return If true, the window is borderless
1371 elm_win_borderless_get(const Evas_Object *obj)
1374 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1375 win = elm_widget_data_get(obj);
1376 if (!win) return EINA_FALSE;
1377 return ecore_evas_borderless_get(win->ee);
1381 * Set the shaped state of a window.
1383 * @param obj The window object
1384 * @param shaped If true, the window is shaped
1389 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1392 ELM_CHECK_WIDTYPE(obj, widtype);
1393 win = elm_widget_data_get(obj);
1395 ecore_evas_shaped_set(win->ee, shaped);
1396 #ifdef HAVE_ELEMENTARY_X
1397 _elm_win_xwin_update(win);
1402 * Get the shaped state of a window.
1404 * @param obj The window object
1405 * @return If true, the window is shaped
1410 elm_win_shaped_get(const Evas_Object *obj)
1413 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1414 win = elm_widget_data_get(obj);
1415 if (!win) return EINA_FALSE;
1416 return ecore_evas_shaped_get(win->ee);
1420 * Set the alpha channel state of a window.
1422 * @param obj The window object
1423 * @param alpha If true, the window has an alpha channel
1428 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1431 ELM_CHECK_WIDTYPE(obj, widtype);
1432 win = elm_widget_data_get(obj);
1434 #ifdef HAVE_ELEMENTARY_X
1439 if (!_elm_config->compositing)
1440 elm_win_shaped_set(obj, alpha);
1442 ecore_evas_alpha_set(win->ee, alpha);
1445 ecore_evas_alpha_set(win->ee, alpha);
1446 _elm_win_xwin_update(win);
1450 ecore_evas_alpha_set(win->ee, alpha);
1454 * Get the alpha channel state of a window.
1456 * @param obj The window object
1457 * @return If true, the window has an alpha channel
1462 elm_win_alpha_get(const Evas_Object *obj)
1465 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1466 win = elm_widget_data_get(obj);
1467 if (!win) return EINA_FALSE;
1468 return ecore_evas_alpha_get(win->ee);
1472 * Set the transparency state of a window.
1474 * @param obj The window object
1475 * @param transparent If true, the window is transparent
1480 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1483 ELM_CHECK_WIDTYPE(obj, widtype);
1484 win = elm_widget_data_get(obj);
1487 #ifdef HAVE_ELEMENTARY_X
1490 ecore_evas_transparent_set(win->ee, transparent);
1491 _elm_win_xwin_update(win);
1495 ecore_evas_transparent_set(win->ee, transparent);
1499 * Get the transparency state of a window.
1501 * @param obj The window object
1502 * @return If true, the window is transparent
1507 elm_win_transparent_get(const Evas_Object *obj)
1510 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1511 win = elm_widget_data_get(obj);
1512 if (!win) return EINA_FALSE;
1514 return ecore_evas_transparent_get(win->ee);
1518 * Set the override state of a window.
1520 * @param obj The window object
1521 * @param override If true, the window is overridden
1526 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1529 ELM_CHECK_WIDTYPE(obj, widtype);
1530 win = elm_widget_data_get(obj);
1532 ecore_evas_override_set(win->ee, override);
1533 #ifdef HAVE_ELEMENTARY_X
1534 _elm_win_xwin_update(win);
1539 * Get the override state of a window.
1541 * @param obj The window object
1542 * @return If true, the window is overridden
1547 elm_win_override_get(const Evas_Object *obj)
1550 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1551 win = elm_widget_data_get(obj);
1552 if (!win) return EINA_FALSE;
1553 return ecore_evas_override_get(win->ee);
1557 * Set the fullscreen state of a window.
1559 * @param obj The window object
1560 * @param fullscreen If true, the window is fullscreen
1565 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1568 ELM_CHECK_WIDTYPE(obj, widtype);
1569 win = elm_widget_data_get(obj);
1572 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1573 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1574 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1576 // these engines... can ONLY be fullscreen
1581 ecore_evas_fullscreen_set(win->ee, fullscreen);
1582 #ifdef HAVE_ELEMENTARY_X
1583 _elm_win_xwin_update(win);
1586 #undef ENGINE_COMPARE
1590 * Get the fullscreen state of a window.
1592 * @param obj The window object
1593 * @return If true, the window is fullscreen
1598 elm_win_fullscreen_get(const Evas_Object *obj)
1601 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1602 win = elm_widget_data_get(obj);
1603 if (!win) return EINA_FALSE;
1605 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1606 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1607 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1609 // these engines... can ONLY be fullscreen
1614 return ecore_evas_fullscreen_get(win->ee);
1616 #undef ENGINE_COMPARE
1620 * Set the maximized state of a window.
1622 * @param obj The window object
1623 * @param maximized If true, the window is maximized
1628 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1631 ELM_CHECK_WIDTYPE(obj, widtype);
1632 win = elm_widget_data_get(obj);
1634 ecore_evas_maximized_set(win->ee, maximized);
1635 #ifdef HAVE_ELEMENTARY_X
1636 _elm_win_xwin_update(win);
1641 * Get the maximized state of a window.
1643 * @param obj The window object
1644 * @return If true, the window is maximized
1649 elm_win_maximized_get(const Evas_Object *obj)
1652 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1653 win = elm_widget_data_get(obj);
1654 if (!win) return EINA_FALSE;
1655 return ecore_evas_maximized_get(win->ee);
1659 * Set the iconified state of a window.
1661 * @param obj The window object
1662 * @param iconified If true, the window is iconified
1667 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1670 ELM_CHECK_WIDTYPE(obj, widtype);
1671 win = elm_widget_data_get(obj);
1673 ecore_evas_iconified_set(win->ee, iconified);
1674 #ifdef HAVE_ELEMENTARY_X
1675 _elm_win_xwin_update(win);
1680 * Get the iconified state of a window.
1682 * @param obj The window object
1683 * @return If true, the window is iconified
1688 elm_win_iconified_get(const Evas_Object *obj)
1691 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1692 win = elm_widget_data_get(obj);
1693 if (!win) return EINA_FALSE;
1694 return ecore_evas_iconified_get(win->ee);
1698 * Set the layer of the window.
1700 * @param obj The window object
1701 * @param layer The layer of the window
1706 elm_win_layer_set(Evas_Object *obj, int layer)
1709 ELM_CHECK_WIDTYPE(obj, widtype);
1710 win = elm_widget_data_get(obj);
1712 ecore_evas_layer_set(win->ee, layer);
1713 #ifdef HAVE_ELEMENTARY_X
1714 _elm_win_xwin_update(win);
1719 * Get the layer of the window.
1721 * @param obj The window object
1722 * @return The layer of the window
1727 elm_win_layer_get(const Evas_Object *obj)
1730 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1731 win = elm_widget_data_get(obj);
1732 if (!win) return -1;
1733 return ecore_evas_layer_get(win->ee);
1737 * Set the rotation of the window.
1739 * @param obj The window object
1740 * @param rotation The rotation of the window, in degrees (0-360)
1745 elm_win_rotation_set(Evas_Object *obj, int rotation)
1748 ELM_CHECK_WIDTYPE(obj, widtype);
1749 win = elm_widget_data_get(obj);
1751 if (win->rot == rotation) return;
1752 win->rot = rotation;
1753 ecore_evas_rotation_set(win->ee, rotation);
1754 evas_object_size_hint_min_set(obj, -1, -1);
1755 evas_object_size_hint_max_set(obj, -1, -1);
1756 _elm_win_eval_subobjs(obj);
1757 #ifdef HAVE_ELEMENTARY_X
1758 _elm_win_xwin_update(win);
1763 * Rotates the window and resizes it
1765 * @param obj The window object
1766 * @param layer The rotation of the window in degrees (0-360)
1771 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1774 ELM_CHECK_WIDTYPE(obj, widtype);
1775 win = elm_widget_data_get(obj);
1777 if (win->rot == rotation) return;
1778 win->rot = rotation;
1779 ecore_evas_rotation_with_resize_set(win->ee, rotation);
1780 evas_object_size_hint_min_set(obj, -1, -1);
1781 evas_object_size_hint_max_set(obj, -1, -1);
1782 _elm_win_eval_subobjs(obj);
1783 #ifdef HAVE_ELEMENTARY_X
1784 _elm_win_xwin_update(win);
1789 * Get the rotation of the window.
1791 * @param obj The window object
1792 * @return The rotation of the window in degrees (0-360)
1797 elm_win_rotation_get(const Evas_Object *obj)
1800 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1801 win = elm_widget_data_get(obj);
1802 if (!win) return -1;
1807 * Set the sticky state of the window.
1809 * @param obj The window object
1810 * @param sticky If true, the window's sticky state is enabled
1815 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
1818 ELM_CHECK_WIDTYPE(obj, widtype);
1819 win = elm_widget_data_get(obj);
1821 ecore_evas_sticky_set(win->ee, sticky);
1822 #ifdef HAVE_ELEMENTARY_X
1823 _elm_win_xwin_update(win);
1828 * Get the sticky state of the window.
1830 * @param obj The window object
1831 * @return If true, the window's sticky state is enabled
1836 elm_win_sticky_get(const Evas_Object *obj)
1839 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1840 win = elm_widget_data_get(obj);
1841 if (!win) return EINA_FALSE;
1842 return ecore_evas_sticky_get(win->ee);
1846 * Sets the keyboard mode of the window.
1848 * @param obj The window object
1849 * @param mode The mode to set; one of:
1850 * ELM_WIN_KEYBOARD_UNKNOWN
1851 * ELM_WIN_KEYBOARD_OFF
1852 * ELM_WIN_KEYBOARD_ON
1853 * ELM_WIN_KEYBOARD_ALPHA
1854 * ELM_WIN_KEYBOARD_NUMERIC
1855 * ELM_WIN_KEYBOARD_PIN
1856 * ELM_WIN_KEYBOARD_PHONE_NUMBER
1857 * ELM_WIN_KEYBOARD_HEX
1858 * ELM_WIN_KEYBOARD_TERMINAL
1859 * ELM_WIN_KEYBOARD_PASSWORD
1860 * ELM_WIN_KEYBOARD_IP
1861 * ELM_WIN_KEYBOARD_HOST
1862 * ELM_WIN_KEYBOARD_FILE
1863 * ELM_WIN_KEYBOARD_URL
1864 * ELM_WIN_KEYBOARD_KEYPAD
1865 * ELM_WIN_KEYBOARD_J2ME
1870 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
1873 ELM_CHECK_WIDTYPE(obj, widtype);
1874 win = elm_widget_data_get(obj);
1876 if (mode == win->kbdmode) return;
1877 #ifdef HAVE_ELEMENTARY_X
1878 _elm_win_xwindow_get(win);
1880 win->kbdmode = mode;
1881 #ifdef HAVE_ELEMENTARY_X
1883 ecore_x_e_virtual_keyboard_state_set
1884 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1889 * Gets the keyboard mode of the window.
1891 * @param obj The window object
1892 * @return The mode; one of:
1893 * ELM_WIN_KEYBOARD_UNKNOWN
1894 * ELM_WIN_KEYBOARD_OFF
1895 * ELM_WIN_KEYBOARD_ON
1896 * ELM_WIN_KEYBOARD_ALPHA
1897 * ELM_WIN_KEYBOARD_NUMERIC
1898 * ELM_WIN_KEYBOARD_PIN
1899 * ELM_WIN_KEYBOARD_PHONE_NUMBER
1900 * ELM_WIN_KEYBOARD_HEX
1901 * ELM_WIN_KEYBOARD_TERMINAL
1902 * ELM_WIN_KEYBOARD_PASSWORD
1903 * ELM_WIN_KEYBOARD_IP
1904 * ELM_WIN_KEYBOARD_HOST
1905 * ELM_WIN_KEYBOARD_FILE
1906 * ELM_WIN_KEYBOARD_URL
1907 * ELM_WIN_KEYBOARD_KEYPAD
1908 * ELM_WIN_KEYBOARD_J2ME
1912 EAPI Elm_Win_Keyboard_Mode
1913 elm_win_keyboard_mode_get(const Evas_Object *obj)
1916 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
1917 win = elm_widget_data_get(obj);
1918 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
1919 return win->kbdmode;
1923 * Sets whether the window is a keyboard.
1925 * @param obj The window object
1926 * @param is_keyboard If true, the window is a virtual keyboard
1931 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
1934 ELM_CHECK_WIDTYPE(obj, widtype);
1935 win = elm_widget_data_get(obj);
1937 #ifdef HAVE_ELEMENTARY_X
1938 _elm_win_xwindow_get(win);
1940 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
1945 * Gets whether the window is a keyboard.
1947 * @param obj The window object
1948 * @return If the window is a virtual keyboard
1953 elm_win_keyboard_win_get(const Evas_Object *obj)
1956 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1957 win = elm_widget_data_get(obj);
1958 if (!win) return EINA_FALSE;
1959 #ifdef HAVE_ELEMENTARY_X
1960 _elm_win_xwindow_get(win);
1962 return ecore_x_e_virtual_keyboard_get(win->xwin);
1968 * Get the screen position of a window.
1970 * @param obj The window object
1971 * @param x The int to store the x coordinate to
1972 * @param y The int to store the y coordinate to
1977 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
1980 ELM_CHECK_WIDTYPE(obj, widtype);
1981 win = elm_widget_data_get(obj);
1983 if (x) *x = win->screen.x;
1984 if (y) *y = win->screen.y;
1988 * Set if this window is an illume conformant window
1990 * @param obj The window object
1991 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
1996 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
1999 ELM_CHECK_WIDTYPE(obj, widtype);
2000 win = elm_widget_data_get(obj);
2002 #ifdef HAVE_ELEMENTARY_X
2003 _elm_win_xwindow_get(win);
2005 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2010 * Get if this window is an illume conformant window
2012 * @param obj The window object
2013 * @return A boolean if this window is illume conformant or not
2018 elm_win_conformant_get(const Evas_Object *obj)
2021 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2022 win = elm_widget_data_get(obj);
2023 if (!win) return EINA_FALSE;
2024 #ifdef HAVE_ELEMENTARY_X
2025 _elm_win_xwindow_get(win);
2027 return ecore_x_e_illume_conformant_get(win->xwin);
2033 * Set a window to be an illume quickpanel window
2035 * By default window objects are not quickpanel windows.
2037 * @param obj The window object
2038 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2043 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2046 ELM_CHECK_WIDTYPE(obj, widtype);
2047 win = elm_widget_data_get(obj);
2049 #ifdef HAVE_ELEMENTARY_X
2050 _elm_win_xwindow_get(win);
2053 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2056 Ecore_X_Window_State states[2];
2058 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2059 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2060 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2061 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2068 * Get if this window is a quickpanel or not
2070 * @param obj The window object
2071 * @return A boolean if this window is a quickpanel or not
2076 elm_win_quickpanel_get(const Evas_Object *obj)
2079 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2080 win = elm_widget_data_get(obj);
2081 if (!win) return EINA_FALSE;
2082 #ifdef HAVE_ELEMENTARY_X
2083 _elm_win_xwindow_get(win);
2085 return ecore_x_e_illume_quickpanel_get(win->xwin);
2091 * Set the major priority of a quickpanel window
2093 * @param obj The window object
2094 * @param priority The major priority for this quickpanel
2099 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2102 ELM_CHECK_WIDTYPE(obj, widtype);
2103 win = elm_widget_data_get(obj);
2105 #ifdef HAVE_ELEMENTARY_X
2106 _elm_win_xwindow_get(win);
2108 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2113 * Get the major priority of a quickpanel window
2115 * @param obj The window object
2116 * @return The major priority of this quickpanel
2121 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2124 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2125 win = elm_widget_data_get(obj);
2126 if (!win) return -1;
2127 #ifdef HAVE_ELEMENTARY_X
2128 _elm_win_xwindow_get(win);
2130 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2136 * Set the minor priority of a quickpanel window
2138 * @param obj The window object
2139 * @param priority The minor priority for this quickpanel
2144 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2147 ELM_CHECK_WIDTYPE(obj, widtype);
2148 win = elm_widget_data_get(obj);
2150 #ifdef HAVE_ELEMENTARY_X
2151 _elm_win_xwindow_get(win);
2153 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2158 * Get the minor priority of a quickpanel window
2160 * @param obj The window object
2161 * @return The minor priority of this quickpanel
2166 elm_win_quickpanel_priority_minor_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_minor_get(win->xwin);
2181 * Set which zone this quickpanel should appear in
2183 * @param obj The window object
2184 * @param zone The requested zone for this quickpanel
2189 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2192 ELM_CHECK_WIDTYPE(obj, widtype);
2193 win = elm_widget_data_get(obj);
2195 #ifdef HAVE_ELEMENTARY_X
2196 _elm_win_xwindow_get(win);
2198 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2203 * Get which zone this quickpanel should appear in
2205 * @param obj The window object
2206 * @return The requested zone for this quickpanel
2211 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2214 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2215 win = elm_widget_data_get(obj);
2217 #ifdef HAVE_ELEMENTARY_X
2218 _elm_win_xwindow_get(win);
2220 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2226 * Set the window to be skipped by keyboard focus
2228 * This sets the window to be skipped by normal keyboard input. This means
2229 * a window manager will be asked to not focus this window as well as omit
2230 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2232 * Call this and enable it on a window BEFORE you show it for the first time,
2233 * otherwise it may have no effect.
2235 * Use this for windows that have only output information or might only be
2236 * interacted with by the mouse or fingers, and never for typing input.
2237 * Be careful that this may have side-effects like making the window
2238 * non-accessible in some cases unless the window is specially handled. Use
2241 * @param obj The window object
2242 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2247 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2250 ELM_CHECK_WIDTYPE(obj, widtype);
2251 win = elm_widget_data_get(obj);
2253 #ifdef HAVE_ELEMENTARY_X
2254 _elm_win_xwindow_get(win);
2259 Ecore_X_Window_State states[2];
2261 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2262 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2263 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2264 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2271 * Send a command to the windowing environment
2273 * This is intended to work in touchscreen or small screen device environments
2274 * where there is a more simplistic window management policy in place. This
2275 * uses the window object indicated to select which part of the environment
2276 * to control (the part that this window lives in), and provides a command
2277 * and an optional parameter structure (use NULL for this if not needed).
2279 * @param obj The window object that lives in the environment to control
2280 * @param command The command to send
2281 * @param params Optional parameters for the command
2286 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2289 ELM_CHECK_WIDTYPE(obj, widtype);
2290 win = elm_widget_data_get(obj);
2292 #ifdef HAVE_ELEMENTARY_X
2293 _elm_win_xwindow_get(win);
2298 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2299 ecore_x_e_illume_focus_back_send(win->xwin);
2301 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2302 ecore_x_e_illume_focus_forward_send(win->xwin);
2304 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2305 ecore_x_e_illume_focus_home_send(win->xwin);
2307 case ELM_ILLUME_COMMAND_CLOSE:
2308 ecore_x_e_illume_close_send(win->xwin);
2318 * Set the enabled status for the focus highlight in a window
2320 * This function will enable or disable the focus highlight only for the
2321 * given window, regardless of the global setting for it
2323 * @param obj The window where to enable the highlight
2324 * @param enabled The enabled value for the highlight
2329 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2333 ELM_CHECK_WIDTYPE(obj, widtype);
2335 win = elm_widget_data_get(obj);
2336 enabled = !!enabled;
2337 if (win->focus_highlight.enabled == enabled)
2340 win->focus_highlight.enabled = enabled;
2342 if (win->focus_highlight.enabled)
2343 _elm_win_focus_highlight_init(win);
2345 _elm_win_focus_highlight_shutdown(win);
2349 * Get the enabled value of the focus highlight for this window
2351 * @param obj The window in which to check if the focus highlight is enabled
2353 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2358 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2362 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2364 win = elm_widget_data_get(obj);
2365 return win->focus_highlight.enabled;
2369 * Set the style for the focus highlight on this window
2371 * Sets the style to use for theming the highlight of focused objects on
2372 * the given window. If @p style is NULL, the default will be used.
2374 * @param obj The window where to set the style
2375 * @param style The style to set
2380 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2384 ELM_CHECK_WIDTYPE(obj, widtype);
2386 win = elm_widget_data_get(obj);
2387 eina_stringshare_replace(&win->focus_highlight.style, style);
2388 win->focus_highlight.changed_theme = EINA_TRUE;
2389 _elm_win_focus_highlight_reconfigure_job_start(win);
2393 * Get the style set for the focus highlight object
2395 * Gets the style set for this windows highilght object, or NULL if none
2398 * @param obj The window to retrieve the highlights style from
2400 * @return The style set or NULL if none was. Default is used in that case.
2405 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2409 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2411 win = elm_widget_data_get(obj);
2412 return win->focus_highlight.style;
2416 elm_win_indicator_state_set(Evas_Object *obj, int show_state)
2419 if (strcmp(elm_widget_type_get(obj), "win")) return;
2420 win = elm_widget_data_get(obj);
2422 _elm_win_xwindow_get(win);
2423 #ifdef HAVE_ELEMENTARY_X
2425 return ecore_x_window_prop_property_set (win->xwin,
2426 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
2432 elm_win_indicator_state_get(Evas_Object *obj)
2435 if (strcmp(elm_widget_type_get(obj), "win")) return -1;
2436 win = elm_widget_data_get(obj);
2437 if (!win) return -1;
2438 _elm_win_xwindow_get(win);
2439 #ifdef HAVE_ELEMENTARY_X
2445 unsigned int *prop_data = NULL;
2447 ret = ecore_x_window_prop_property_get (win->xwin,
2448 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, (void *)&prop_data, &count);
2449 if( ret && prop_data )
2450 memcpy (&show, prop_data, sizeof (int));
2452 if (prop_data) free (prop_data);
2461 typedef struct _Widget_Data Widget_Data;
2466 Evas_Object *content;
2469 static void _del_hook(Evas_Object *obj);
2470 static void _theme_hook(Evas_Object *obj);
2471 static void _sizing_eval(Evas_Object *obj);
2472 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2473 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2475 static const char *widtype2 = NULL;
2478 _del_hook(Evas_Object *obj)
2480 Widget_Data *wd = elm_widget_data_get(obj);
2486 _theme_hook(Evas_Object *obj)
2488 Widget_Data *wd = elm_widget_data_get(obj);
2489 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2491 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2496 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2498 Widget_Data *wd = elm_widget_data_get(obj);
2503 /* Try Focus cycle in subitem */
2506 elm_widget_focus_next_get(wd->content, dir, next);
2511 *next = (Evas_Object *)obj;
2516 _sizing_eval(Evas_Object *obj)
2518 Widget_Data *wd = elm_widget_data_get(obj);
2519 Evas_Coord minw = -1, minh = -1;
2521 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2522 edje_object_size_min_calc(wd->frm, &minw, &minh);
2523 evas_object_size_hint_min_set(obj, minw, minh);
2524 evas_object_size_hint_max_set(obj, -1, -1);
2528 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2534 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2536 Widget_Data *wd = elm_widget_data_get(obj);
2537 Evas_Object *sub = event_info;
2538 if (sub == wd->content)
2540 evas_object_event_callback_del_full
2541 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2548 * @defgroup Inwin Inwin
2550 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2553 elm_win_inwin_add(Evas_Object *obj)
2559 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2560 win = elm_widget_data_get(obj);
2561 if (!win) return NULL;
2562 wd = ELM_NEW(Widget_Data);
2563 obj2 = elm_widget_add(win->evas);
2564 elm_widget_type_set(obj2, "inwin");
2565 ELM_SET_WIDTYPE(widtype2, "inwin");
2566 elm_widget_sub_object_add(obj, obj2);
2567 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2568 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2569 elm_win_resize_object_add(obj, obj2);
2571 elm_widget_data_set(obj2, wd);
2572 elm_widget_del_hook_set(obj2, _del_hook);
2573 elm_widget_theme_hook_set(obj2, _theme_hook);
2574 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2575 elm_widget_can_focus_set(obj2, EINA_TRUE);
2576 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2578 wd->frm = edje_object_add(win->evas);
2579 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2580 elm_widget_resize_object_set(obj2, wd->frm);
2582 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2589 * Activates an inwin object
2591 * @param obj The inwin to activate
2596 elm_win_inwin_activate(Evas_Object *obj)
2598 ELM_CHECK_WIDTYPE(obj, widtype2);
2599 Widget_Data *wd = elm_widget_data_get(obj);
2601 evas_object_raise(obj);
2602 evas_object_show(obj);
2603 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2604 elm_object_focus(obj);
2608 * Set the content of an inwin object.
2610 * Once the content object is set, a previously set one will be deleted.
2611 * If you want to keep that old content object, use the
2612 * elm_win_inwin_content_unset() function.
2614 * @param obj The inwin object
2615 * @param content The object to set as content
2620 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2622 ELM_CHECK_WIDTYPE(obj, widtype2);
2623 Widget_Data *wd = elm_widget_data_get(obj);
2625 if (wd->content == content) return;
2626 if (wd->content) evas_object_del(wd->content);
2627 wd->content = content;
2630 elm_widget_sub_object_add(obj, content);
2631 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2632 _changed_size_hints, obj);
2633 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2639 * Get the content of an inwin object.
2641 * Return the content object which is set for this widget.
2643 * @param obj The inwin object
2644 * @return The content that is being used
2649 elm_win_inwin_content_get(const Evas_Object *obj)
2651 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2652 Widget_Data *wd = elm_widget_data_get(obj);
2653 if (!wd) return NULL;
2658 * Unset the content of an inwin object.
2660 * Unparent and return the content object which was set for this widget.
2662 * @param obj The inwin object
2663 * @return The content that was being used
2668 elm_win_inwin_content_unset(Evas_Object *obj)
2670 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2671 Widget_Data *wd = elm_widget_data_get(obj);
2672 if (!wd) return NULL;
2673 if (!wd->content) return NULL;
2674 Evas_Object *content = wd->content;
2675 elm_widget_sub_object_del(obj, wd->content);
2676 edje_object_part_unswallow(wd->frm, wd->content);
2681 /* windowing spcific calls - shall we do this differently? */
2683 * Get the Ecore_X_Window of an Evas_Object
2685 * @param obj The object
2687 * @return The Ecore_X_Window of @p obj
2692 elm_win_xwindow_get(const Evas_Object *obj)
2694 Ecore_X_Window xwin = 0;
2695 Ecore_Evas *ee = NULL;
2697 #ifdef HAVE_ELEMENTARY_X
2698 ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2699 if (ee) xwin = (Ecore_X_Window)ecore_evas_window_get(ee);