1 #include <Elementary.h>
7 * The window class of Elementary. Contains functions to manipulate
10 * Signals that you can add callbacks for are:
12 * "delete,request" - the user requested to delete the window
13 * "focus,in" - window got focus
14 * "focus,out" - window lost focus
15 * "moved" - window that holds the canvas was moved
18 typedef struct _Elm_Win Elm_Win;
24 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
26 #ifdef HAVE_ELEMENTARY_X
28 Ecore_Event_Handler *client_message_handler;
30 Ecore_Job *deferred_resize_job;
31 Ecore_Job *deferred_child_eval_job;
34 Elm_Win_Keyboard_Mode kbdmode;
35 Eina_Bool autodel : 1;
36 int *autodel_clear, rot;
46 Eina_Bool visible : 1;
47 Eina_Bool handled : 1;
51 Ecore_Job *reconf_job;
53 Eina_Bool enabled : 1;
54 Eina_Bool changed_theme : 1;
55 Eina_Bool top_animate : 1;
56 Eina_Bool geometry_changed : 1;
60 static const char *widtype = NULL;
61 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
62 static void _elm_win_obj_callback_img_obj_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_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
65 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
66 static void _elm_win_move(Ecore_Evas *ee);
67 static void _elm_win_resize(Ecore_Evas *ee);
68 static void _elm_win_delete_request(Ecore_Evas *ee);
69 static void _elm_win_resize_job(void *data);
70 #ifdef HAVE_ELEMENTARY_X
71 static void _elm_win_xwin_update(Elm_Win *win);
73 static void _elm_win_eval_subobjs(Evas_Object *obj);
74 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
75 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
76 static void _elm_win_focus_highlight_init(Elm_Win *win);
77 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
78 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
79 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
80 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
81 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
82 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
84 static const char SIG_DELETE_REQUEST[] = "delete,request";
85 static const char SIG_FOCUS_OUT[] = "focus,in";
86 static const char SIG_FOCUS_IN[] = "focus,out";
87 static const char SIG_MOVED[] = "moved";
89 static const Evas_Smart_Cb_Description _signals[] = {
90 {SIG_DELETE_REQUEST, ""},
99 Eina_List *_elm_win_list = NULL;
100 int _elm_win_deferred_free = 0;
103 _elm_win_move(Ecore_Evas *ee)
105 Evas_Object *obj = ecore_evas_object_associate_get(ee);
110 win = elm_widget_data_get(obj);
112 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
115 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
119 _elm_win_resize(Ecore_Evas *ee)
121 Evas_Object *obj = ecore_evas_object_associate_get(ee);
125 win = elm_widget_data_get(obj);
127 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
128 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
132 _elm_win_focus_in(Ecore_Evas *ee)
134 Evas_Object *obj = ecore_evas_object_associate_get(ee);
138 win = elm_widget_data_get(obj);
140 /*NB: Why two different "focus signals" here ??? */
141 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL); // FIXME: remove me
142 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
143 win->focus_highlight.cur.visible = EINA_TRUE;
144 _elm_win_focus_highlight_reconfigure_job_start(win);
148 else if (win->img_obj)
155 _elm_win_focus_out(Ecore_Evas *ee)
157 Evas_Object *obj = ecore_evas_object_associate_get(ee);
161 win = elm_widget_data_get(obj);
163 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL); // FIXME: remove me
164 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
165 win->focus_highlight.cur.visible = EINA_FALSE;
166 _elm_win_focus_highlight_reconfigure_job_start(win);
170 else if (win->img_obj)
177 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
179 Elm_Win *wd = elm_widget_data_get(obj);
180 const Eina_List *items;
181 void *(*list_data_get) (const Eina_List *list);
189 if (!(items = elm_widget_focus_custom_chain_get(obj)))
195 list_data_get = eina_list_data_get;
197 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
203 *next = (Evas_Object *)obj;
208 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
210 Elm_Win *win = elm_widget_data_get(obj);
214 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
216 evas_object_focus_set(obj, elm_widget_focus_get(obj));
220 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
222 if (type == EVAS_CALLBACK_KEY_DOWN)
224 Evas_Event_Key_Down *ev = event_info;
225 if (!strcmp(ev->keyname, "Tab"))
227 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
228 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
230 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
231 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
240 _deferred_ecore_evas_free(void *data)
242 ecore_evas_free(data);
243 _elm_win_deferred_free--;
247 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
249 elm_object_focus(obj);
253 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
260 else if (win->img_obj)
262 evas_object_hide(win->img_obj);
267 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
274 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
275 _elm_win_obj_callback_parent_del, win);
278 if (win->autodel_clear) *(win->autodel_clear) = -1;
279 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
280 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
283 ecore_evas_callback_delete_request_set(win->ee, NULL);
284 ecore_evas_callback_resize_set(win->ee, NULL);
286 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
287 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
288 while (((child = evas_object_bottom_get(win->evas))) &&
291 evas_object_del(child);
293 while (((child = evas_object_top_get(win->evas))) &&
296 evas_object_del(child);
298 #ifdef HAVE_ELEMENTARY_X
299 if (win->client_message_handler)
300 ecore_event_handler_del(win->client_message_handler);
302 // FIXME: Why are we flushing edje on every window destroy ??
303 // edje_file_cache_flush();
304 // edje_collection_cache_flush();
305 // evas_image_cache_flush(win->evas);
306 // evas_font_cache_flush(win->evas);
307 // FIXME: we are in the del handler for the object and delete the canvas
308 // that lives under it from the handler... nasty. deferring doesn't help either
318 ecore_job_add(_deferred_ecore_evas_free, win->ee);
319 _elm_win_deferred_free++;
323 _elm_win_focus_highlight_shutdown(win);
324 eina_stringshare_del(win->focus_highlight.style);
328 if ((!_elm_win_list) &&
329 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
331 edje_file_cache_flush();
332 edje_collection_cache_flush();
333 evas_image_cache_flush(e);
334 evas_font_cache_flush(e);
340 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
343 if (!win->img_obj) return;
344 evas_object_event_callback_del_full
345 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
346 evas_object_del(win->img_obj);
350 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
353 if (obj == win->parent) win->parent = NULL;
357 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
363 if ((x != win->screen.x) || (y != win->screen.y))
367 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
372 evas_object_move(obj, x, y);
377 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
380 // this is called to make sure all smart containers have calculated their
381 // sizes BEFORE we show the window to make sure it initially appears at
382 // our desired size (ie min size is known first)
383 evas_smart_objects_calculate(evas_object_evas_get(obj));
384 evas_object_show(obj);
388 else if (win->img_obj)
390 evas_object_show(win->img_obj);
395 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
399 if (ecore_evas_override_get(win->ee))
403 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
406 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
411 else if (win->img_obj)
415 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
418 // evas_object_move(win->img_obj, x, y);
423 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
430 else if (win->img_obj)
432 Evas_Coord w = 1, h = 1;
434 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
437 evas_object_image_size_set(win->img_obj, w, h);
442 _elm_win_delete_request(Ecore_Evas *ee)
444 Evas_Object *obj = ecore_evas_object_associate_get(ee);
446 if (strcmp(elm_widget_type_get(obj), "win")) return;
448 win = elm_widget_data_get(obj);
450 int autodel = win->autodel;
451 win->autodel_clear = &autodel;
452 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL); // FIXME: remove me.
453 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
454 // FIXME: if above callback deletes - then the below will be invalid
455 if (autodel) evas_object_del(win->win_obj);
456 else win->autodel_clear = NULL;
460 _elm_win_resize_job(void *data)
467 win->deferred_resize_job = NULL;
468 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
469 evas_object_resize(win->win_obj, w, h);
473 else if (win->img_obj)
476 EINA_LIST_FOREACH(win->subobjs, l, obj)
478 evas_object_move(obj, 0, 0);
479 evas_object_resize(obj, w, h);
483 #ifdef HAVE_ELEMENTARY_X
485 _elm_win_xwindow_get(Elm_Win *win)
489 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
490 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
492 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
494 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
495 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
496 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
497 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
498 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
499 ENGINE_COMPARE(ELM_OPENGL_SDL))
502 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
504 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
506 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
508 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
510 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
512 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
514 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
516 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
518 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
520 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
522 #undef ENGINE_COMPARE
526 #ifdef HAVE_ELEMENTARY_X
528 _elm_win_xwin_update(Elm_Win *win)
530 _elm_win_xwindow_get(win);
535 win2 = elm_widget_data_get(win->parent);
539 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
543 if (!win->xwin) return; /* nothing more to do */
548 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
550 case ELM_WIN_DIALOG_BASIC:
551 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
553 case ELM_WIN_DESKTOP:
554 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
557 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
559 case ELM_WIN_TOOLBAR:
560 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
563 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
565 case ELM_WIN_UTILITY:
566 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
569 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
571 case ELM_WIN_DROPDOWN_MENU:
572 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
574 case ELM_WIN_POPUP_MENU:
575 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
577 case ELM_WIN_TOOLTIP:
578 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
580 case ELM_WIN_NOTIFICATION:
581 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
584 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
587 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
592 ecore_x_e_virtual_keyboard_state_set
593 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
598 _elm_win_eval_subobjs(Evas_Object *obj)
601 const Evas_Object *child;
603 Elm_Win *win = elm_widget_data_get(obj);
604 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
608 EINA_LIST_FOREACH(win->subobjs, l, child)
610 evas_object_size_hint_weight_get(child, &wx, &wy);
611 if (wx == 0.0) xx = 0;
612 if (wy == 0.0) xy = 0;
614 evas_object_size_hint_min_get(child, &w, &h);
617 if (w > minw) minw = w;
618 if (h > minh) minh = h;
620 evas_object_size_hint_max_get(child, &w, &h);
623 if (maxw == -1) maxw = w;
624 else if ((w > 0) && (w < maxw)) maxw = w;
625 if (maxh == -1) maxh = h;
626 else if ((h > 0) && (h < maxh)) maxh = h;
628 if (!xx) maxw = minw;
630 if (!xy) maxh = minh;
632 evas_object_size_hint_min_set(obj, minw, minh);
633 evas_object_size_hint_max_set(obj, maxw, maxh);
634 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
635 if (w < minw) w = minw;
636 if (h < minh) h = minh;
637 if ((maxw >= 0) && (w > maxw)) w = maxw;
638 if ((maxh >= 0) && (h > maxh)) h = maxh;
639 evas_object_resize(obj, w, h);
643 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
645 Elm_Win *win = elm_widget_data_get(data);
646 win->subobjs = eina_list_remove(win->subobjs, obj);
647 _elm_win_eval_subobjs(win->win_obj);
651 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
653 _elm_win_eval_subobjs(data);
657 _elm_win_shutdown(void)
659 while (_elm_win_list)
660 evas_object_del(_elm_win_list->data);
664 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
671 EINA_LIST_FOREACH(_elm_win_list, l, obj)
672 elm_widget_theme(obj);
676 EINA_LIST_FOREACH(_elm_win_list, l, obj)
677 elm_widget_theme_specific(obj, th, EINA_FALSE);
681 #ifdef HAVE_ELEMENTARY_X
683 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
686 Ecore_X_Event_Client_Message *e = event;
688 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
689 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
691 if ((unsigned)e->data.l[0] == win->xwin)
693 Evas *evas = evas_object_evas_get(win->win_obj);
696 edje_file_cache_flush();
697 edje_collection_cache_flush();
698 evas_image_cache_flush(evas);
699 evas_font_cache_flush(evas);
703 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
705 if ((unsigned)e->data.l[0] == win->xwin)
707 Evas *evas = evas_object_evas_get(win->win_obj);
710 edje_file_cache_flush();
711 edje_collection_cache_flush();
712 evas_image_cache_flush(evas);
713 evas_font_cache_flush(evas);
714 evas_render_dump(evas);
718 return ECORE_CALLBACK_PASS_ON;
723 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
727 win->focus_highlight.geometry_changed = EINA_TRUE;
728 _elm_win_focus_highlight_reconfigure_job_start(win);
732 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
736 win->focus_highlight.geometry_changed = EINA_TRUE;
737 _elm_win_focus_highlight_reconfigure_job_start(win);
741 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
745 win->focus_highlight.cur.target = NULL;
747 _elm_win_focus_highlight_reconfigure_job_start(win);
751 _elm_win_focus_target_callbacks_add(Elm_Win *win)
753 Evas_Object *obj = win->focus_highlight.cur.target;
755 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
756 _elm_win_focus_target_move, win);
757 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
758 _elm_win_focus_target_resize, win);
759 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
760 _elm_win_focus_target_del, win);
764 _elm_win_focus_target_callbacks_del(Elm_Win *win)
766 Evas_Object *obj = win->focus_highlight.cur.target;
768 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
769 _elm_win_focus_target_move, win);
770 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
771 _elm_win_focus_target_resize, win);
772 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
773 _elm_win_focus_target_del, win);
777 _elm_win_focus_target_get(Evas_Object *obj)
779 Evas_Object *o = obj;
783 if (elm_widget_is(o))
785 if (!elm_widget_highlight_ignore_get(o))
787 o = elm_widget_parent_get(o);
789 o = evas_object_smart_parent_get(o);
793 o = elm_widget_parent_widget_get(o);
795 o = evas_object_smart_parent_get(o);
804 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
806 Evas_Object *obj = event_info, *target;
809 if (win->focus_highlight.cur.target == obj)
812 target = _elm_win_focus_target_get(obj);
813 win->focus_highlight.cur.target = target;
814 if (elm_widget_highlight_in_theme_get(target))
815 win->focus_highlight.cur.handled = EINA_TRUE;
817 _elm_win_focus_target_callbacks_add(win);
819 _elm_win_focus_highlight_reconfigure_job_start(win);
823 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
827 if (!win->focus_highlight.cur.target)
830 if (!win->focus_highlight.cur.handled)
831 _elm_win_focus_target_callbacks_del(win);
832 win->focus_highlight.cur.target = NULL;
833 win->focus_highlight.cur.handled = EINA_FALSE;
835 _elm_win_focus_highlight_reconfigure_job_start(win);
839 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
841 evas_object_hide(obj);
845 _elm_win_focus_highlight_init(Elm_Win *win)
847 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
848 _elm_win_object_focus_in, win);
849 evas_event_callback_add(win->evas,
850 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
851 _elm_win_object_focus_out, win);
853 win->focus_highlight.cur.target = evas_focus_get(win->evas);
855 win->focus_highlight.top = edje_object_add(win->evas);
856 win->focus_highlight.changed_theme = EINA_TRUE;
857 edje_object_signal_callback_add(win->focus_highlight.top,
858 "elm,action,focus,hide,end", "",
859 _elm_win_focus_highlight_hide, NULL);
860 edje_object_signal_callback_add(win->focus_highlight.top,
861 "elm,action,focus,anim,end", "",
862 _elm_win_focus_highlight_anim_end, win);
863 _elm_win_focus_highlight_reconfigure_job_start(win);
867 _elm_win_focus_highlight_shutdown(Elm_Win *win)
869 _elm_win_focus_highlight_reconfigure_job_stop(win);
870 if (win->focus_highlight.cur.target)
872 _elm_win_focus_target_callbacks_del(win);
873 win->focus_highlight.cur.target = NULL;
875 if (win->focus_highlight.top)
877 evas_object_del(win->focus_highlight.top);
878 win->focus_highlight.top = NULL;
881 evas_event_callback_del_full(win->evas,
882 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
883 _elm_win_object_focus_in, win);
884 evas_event_callback_del_full(win->evas,
885 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
886 _elm_win_object_focus_out, win);
890 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
894 top = win->focus_highlight.top;
899 evas_object_show(top);
900 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
906 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
911 _elm_win_focus_highlight_reconfigure_job(void *data)
913 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
917 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
919 if (win->focus_highlight.reconf_job)
920 ecore_job_del(win->focus_highlight.reconf_job);
921 win->focus_highlight.reconf_job = ecore_job_add(
922 _elm_win_focus_highlight_reconfigure_job, win);
926 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
928 if (win->focus_highlight.reconf_job)
929 ecore_job_del(win->focus_highlight.reconf_job);
930 win->focus_highlight.reconf_job = NULL;
934 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
936 Evas_Object *clip, *target = win->focus_highlight.cur.target;
937 Evas_Coord x, y, w, h;
939 clip = evas_object_clip_get(target);
940 evas_object_geometry_get(target, &x, &y, &w, &h);
942 evas_object_move(obj, x, y);
943 evas_object_resize(obj, w, h);
944 evas_object_clip_set(obj, clip);
948 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
950 Evas_Coord tx, ty, tw, th;
951 Evas_Coord w, h, px, py, pw, ph;
952 Edje_Message_Int_Set *m;
953 Evas_Object *previous = win->focus_highlight.prev.target;
954 Evas_Object *target = win->focus_highlight.cur.target;
956 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
957 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
958 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
959 evas_object_move(obj, 0, 0);
960 evas_object_resize(obj, tw, th);
961 evas_object_clip_unset(obj);
963 m = alloca(sizeof(*m) + (sizeof(int) * 8));
973 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
977 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
980 _elm_win_focus_highlight_simple_setup(win, obj);
984 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
986 Evas_Object *target = win->focus_highlight.cur.target;
987 Evas_Object *previous = win->focus_highlight.prev.target;
988 Evas_Object *top = win->focus_highlight.top;
989 Eina_Bool visible_changed;
990 Eina_Bool common_visible;
991 const char *sig = NULL;
993 _elm_win_focus_highlight_reconfigure_job_stop(win);
995 visible_changed = (win->focus_highlight.cur.visible !=
996 win->focus_highlight.prev.visible);
998 if ((target == previous) && (!visible_changed) &&
999 (!win->focus_highlight.geometry_changed))
1002 if ((previous) && (win->focus_highlight.prev.handled))
1003 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1006 common_visible = EINA_FALSE;
1007 else if (win->focus_highlight.cur.handled)
1009 common_visible = EINA_FALSE;
1010 if (win->focus_highlight.cur.visible)
1011 sig = "elm,action,focus_highlight,show";
1013 sig = "elm,action,focus_highlight,hide";
1016 common_visible = win->focus_highlight.cur.visible;
1018 _elm_win_focus_highlight_visible_set(win, common_visible);
1020 elm_widget_signal_emit(target, sig, "elm");
1022 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1025 if (win->focus_highlight.changed_theme)
1028 if (win->focus_highlight.style)
1029 str = win->focus_highlight.style;
1032 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1034 win->focus_highlight.changed_theme = EINA_FALSE;
1036 if (_elm_config->focus_highlight_animate)
1038 str = edje_object_data_get(win->focus_highlight.top, "animate");
1039 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1043 if ((win->focus_highlight.top_animate) && (previous) &&
1044 (!win->focus_highlight.prev.handled))
1045 _elm_win_focus_highlight_anim_setup(win, top);
1047 _elm_win_focus_highlight_simple_setup(win, top);
1048 evas_object_raise(top);
1051 win->focus_highlight.geometry_changed = EINA_FALSE;
1052 win->focus_highlight.prev = win->focus_highlight.cur;
1057 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1059 Evas_Event_Key_Down *ev = event_info;
1061 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1065 if ((strcmp(ev->keyname, "F12")) ||
1066 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1069 printf("Tree graph generated.\n");
1070 elm_object_tree_dot_dump(obj, "./dump.dot");
1075 _win_img_hide(void *data,
1077 Evas_Object *obj __UNUSED__,
1078 void *event_info __UNUSED__)
1080 Elm_Win *win = data;
1082 elm_widget_focus_hide_handle(win->win_obj);
1086 _win_img_mouse_down(void *data,
1088 Evas_Object *obj __UNUSED__,
1089 void *event_info __UNUSED__)
1091 Elm_Win *win = data;
1092 elm_widget_focus_mouse_down_handle(win->win_obj);
1096 _win_img_focus_in(void *data,
1098 Evas_Object *obj __UNUSED__,
1099 void *event_info __UNUSED__)
1101 Elm_Win *win = data;
1102 elm_widget_focus_steal(win->win_obj);
1106 _win_img_focus_out(void *data,
1108 Evas_Object *obj __UNUSED__,
1109 void *event_info __UNUSED__)
1111 Elm_Win *win = data;
1112 elm_widget_focused_object_clear(win->win_obj);
1116 _win_inlined_image_set(Elm_Win *win)
1118 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1119 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1120 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1121 _elm_win_obj_callback_img_obj_del, win);
1123 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1124 _win_img_hide, win);
1125 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1126 _win_img_mouse_down, win);
1127 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1128 _win_img_focus_in, win);
1129 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1130 _win_img_focus_out, win);
1134 * Adds a window object. If this is the first window created, pass NULL as
1137 * @param parent Parent object to add the window to, or NULL
1138 * @param name The name of the window
1139 * @param type The window type, one of the following:
1141 * ELM_WIN_DIALOG_BASIC
1149 * @return The created object, or NULL on failure
1154 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1158 const char *fontpath;
1160 win = ELM_NEW(Elm_Win);
1162 #define FALLBACK_TRY(engine) \
1165 CRITICAL(engine " engine creation failed. Trying software X11."); \
1166 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1168 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1172 case ELM_WIN_INLINED_IMAGE:
1176 Evas *e = evas_object_evas_get(parent);
1179 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1182 win->img_obj = ecore_evas_object_image_new(ee);
1185 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1188 _win_inlined_image_set(win);
1192 evas_object_del(win->img_obj);
1193 win->img_obj = NULL;
1202 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1204 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1205 #ifdef HAVE_ELEMENTARY_X
1206 win->client_message_handler = ecore_event_handler_add
1207 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1210 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1212 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1213 FALLBACK_TRY("Sofware FB");
1215 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1217 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1218 FALLBACK_TRY("Sofware DirectFB");
1220 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1222 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1223 FALLBACK_TRY("Sofware-16");
1224 #ifdef HAVE_ELEMENTARY_X
1225 win->client_message_handler = ecore_event_handler_add
1226 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1229 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1231 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1232 FALLBACK_TRY("Sofware-8");
1233 #ifdef HAVE_ELEMENTARY_X
1234 win->client_message_handler = ecore_event_handler_add
1235 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1238 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1240 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1241 FALLBACK_TRY("XRender");
1242 #ifdef HAVE_ELEMENTARY_X
1243 win->client_message_handler = ecore_event_handler_add
1244 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1247 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1249 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1250 FALLBACK_TRY("OpenGL");
1251 #ifdef HAVE_ELEMENTARY_X
1252 win->client_message_handler = ecore_event_handler_add
1253 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1256 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1258 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1259 FALLBACK_TRY("Sofware Win32");
1261 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1263 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1264 FALLBACK_TRY("Sofware-16-WinCE");
1266 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1268 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1269 FALLBACK_TRY("Sofware SDL");
1271 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1273 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1274 FALLBACK_TRY("Sofware-16-SDL");
1276 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1278 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1279 FALLBACK_TRY("OpenGL SDL");
1287 ERR("Cannot create window.");
1291 #ifdef HAVE_ELEMENTARY_X
1292 _elm_win_xwindow_get(win);
1294 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1295 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1296 // bg pixmap done by x - has other issues like can be redrawn by x before it
1297 // is filled/ready by app
1298 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1301 win->parent = parent;
1303 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1304 _elm_win_obj_callback_parent_del, win);
1306 win->evas = ecore_evas_get(win->ee);
1307 win->win_obj = elm_widget_add(win->evas);
1308 elm_widget_type_set(win->win_obj, "win");
1309 ELM_SET_WIDTYPE(widtype, "win");
1310 elm_widget_data_set(win->win_obj, win);
1311 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1312 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1313 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1314 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1315 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1316 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1317 evas_object_move(win->win_obj, 0, 0);
1318 evas_object_resize(win->win_obj, 1, 1);
1319 evas_object_layer_set(win->win_obj, 50);
1320 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1322 ecore_evas_object_associate(win->ee, win->win_obj,
1323 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1324 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1325 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1326 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1327 _elm_win_obj_callback_show, win);
1328 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1329 _elm_win_obj_callback_hide, win);
1330 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1331 _elm_win_obj_callback_del, win);
1332 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1333 _elm_win_obj_callback_move, win);
1334 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1335 _elm_win_obj_callback_resize, win);
1337 evas_object_intercept_move_callback_add(win->win_obj,
1338 _elm_win_obj_intercept_move, win);
1339 evas_object_intercept_show_callback_add(win->win_obj,
1340 _elm_win_obj_intercept_show, win);
1342 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1343 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1344 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1345 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1346 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1347 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1348 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1349 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1350 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1351 evas_font_path_append(win->evas, fontpath);
1352 if (!_elm_config->font_hinting)
1353 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1354 else if (_elm_config->font_hinting == 1)
1355 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1356 else if (_elm_config->font_hinting == 2)
1357 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1359 #ifdef HAVE_ELEMENTARY_X
1360 _elm_win_xwin_update(win);
1363 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1365 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1367 ecore_evas_fullscreen_set(win->ee, 1);
1369 #undef ENGINE_COMPARE
1371 if (_elm_config->focus_highlight_enable)
1372 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1375 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1376 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1377 _debug_key_down, win);
1379 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1381 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1384 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1386 return win->win_obj;
1390 * Add @p subobj as a resize object of window @p obj.
1392 * @param obj The window object
1393 * @param subobj The resize object to add
1398 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1402 ELM_CHECK_WIDTYPE(obj, widtype);
1403 win = elm_widget_data_get(obj);
1405 win->subobjs = eina_list_append(win->subobjs, subobj);
1406 elm_widget_sub_object_add(obj, subobj);
1407 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1408 _elm_win_subobj_callback_del, obj);
1409 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1410 _elm_win_subobj_callback_changed_size_hints,
1412 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1413 evas_object_move(subobj, 0, 0);
1414 evas_object_resize(subobj, w, h);
1415 _elm_win_eval_subobjs(obj);
1419 * Delete @p subobj as a resize object of window @p obj.
1421 * @param obj The window object
1422 * @param subobj The resize object to add
1427 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1430 ELM_CHECK_WIDTYPE(obj, widtype);
1431 win = elm_widget_data_get(obj);
1433 evas_object_event_callback_del_full(subobj,
1434 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1435 _elm_win_subobj_callback_changed_size_hints,
1437 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1438 _elm_win_subobj_callback_del, obj);
1439 win->subobjs = eina_list_remove(win->subobjs, subobj);
1440 elm_widget_sub_object_del(obj, subobj);
1441 _elm_win_eval_subobjs(obj);
1445 * Set the title of the window
1447 * @param obj The window object
1448 * @param title The title to set
1453 elm_win_title_set(Evas_Object *obj, const char *title)
1456 ELM_CHECK_WIDTYPE(obj, widtype);
1457 win = elm_widget_data_get(obj);
1459 ecore_evas_title_set(win->ee, title);
1463 * Get the title of the window
1465 * @param obj The window object
1471 elm_win_title_get(const Evas_Object *obj)
1474 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1475 win = elm_widget_data_get(obj);
1476 if (!win) return NULL;
1477 return ecore_evas_title_get(win->ee);
1481 * Set the window's autodel state.
1483 * @param obj The window object
1484 * @param autodel If true, the window will automatically delete itself when closed
1489 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1492 ELM_CHECK_WIDTYPE(obj, widtype);
1493 win = elm_widget_data_get(obj);
1495 win->autodel = autodel;
1499 * Get the window's autodel state.
1501 * @param obj The window object
1502 * @return If the window will automatically delete itself when closed
1507 elm_win_autodel_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;
1513 return win->autodel;
1517 * Activate a window object.
1519 * @param obj The window object
1524 elm_win_activate(Evas_Object *obj)
1527 ELM_CHECK_WIDTYPE(obj, widtype);
1528 win = elm_widget_data_get(obj);
1530 ecore_evas_activate(win->ee);
1534 * Lower a window object.
1536 * @param obj The window object
1541 elm_win_lower(Evas_Object *obj)
1544 ELM_CHECK_WIDTYPE(obj, widtype);
1545 win = elm_widget_data_get(obj);
1547 ecore_evas_lower(win->ee);
1551 * Raise a window object.
1553 * @param obj The window object
1558 elm_win_raise(Evas_Object *obj)
1561 ELM_CHECK_WIDTYPE(obj, widtype);
1562 win = elm_widget_data_get(obj);
1564 ecore_evas_raise(win->ee);
1568 * Set the borderless state of a window.
1570 * @param obj The window object
1571 * @param borderless If true, the window is borderless
1576 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1579 ELM_CHECK_WIDTYPE(obj, widtype);
1580 win = elm_widget_data_get(obj);
1582 ecore_evas_borderless_set(win->ee, borderless);
1583 #ifdef HAVE_ELEMENTARY_X
1584 _elm_win_xwin_update(win);
1589 * Get the borderless state of a window.
1591 * @param obj The window object
1592 * @return If true, the window is borderless
1597 elm_win_borderless_get(const Evas_Object *obj)
1600 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1601 win = elm_widget_data_get(obj);
1602 if (!win) return EINA_FALSE;
1603 return ecore_evas_borderless_get(win->ee);
1607 * Set the shaped state of a window.
1609 * @param obj The window object
1610 * @param shaped If true, the window is shaped
1615 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1618 ELM_CHECK_WIDTYPE(obj, widtype);
1619 win = elm_widget_data_get(obj);
1621 ecore_evas_shaped_set(win->ee, shaped);
1622 #ifdef HAVE_ELEMENTARY_X
1623 _elm_win_xwin_update(win);
1628 * Get the shaped state of a window.
1630 * @param obj The window object
1631 * @return If true, the window is shaped
1636 elm_win_shaped_get(const Evas_Object *obj)
1639 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1640 win = elm_widget_data_get(obj);
1641 if (!win) return EINA_FALSE;
1642 return ecore_evas_shaped_get(win->ee);
1646 * Set the alpha channel state of a window.
1648 * @param obj The window object
1649 * @param alpha If true, the window has an alpha channel
1654 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1657 ELM_CHECK_WIDTYPE(obj, widtype);
1658 win = elm_widget_data_get(obj);
1663 else if (win->img_obj)
1665 evas_object_image_alpha_set(win->img_obj, alpha);
1669 #ifdef HAVE_ELEMENTARY_X
1674 if (!_elm_config->compositing)
1675 elm_win_shaped_set(obj, alpha);
1677 ecore_evas_alpha_set(win->ee, alpha);
1680 ecore_evas_alpha_set(win->ee, alpha);
1681 _elm_win_xwin_update(win);
1685 ecore_evas_alpha_set(win->ee, alpha);
1690 * Get the alpha channel state of a window.
1692 * @param obj The window object
1693 * @return If true, the window has an alpha channel
1698 elm_win_alpha_get(const Evas_Object *obj)
1701 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1702 win = elm_widget_data_get(obj);
1703 if (!win) return EINA_FALSE;
1704 return ecore_evas_alpha_get(win->ee);
1708 * Set the transparency state of a window.
1710 * @param obj The window object
1711 * @param transparent If true, the window is transparent
1716 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1719 ELM_CHECK_WIDTYPE(obj, widtype);
1720 win = elm_widget_data_get(obj);
1726 else if (win->img_obj)
1728 evas_object_image_alpha_set(win->img_obj, transparent);
1732 #ifdef HAVE_ELEMENTARY_X
1735 ecore_evas_transparent_set(win->ee, transparent);
1736 _elm_win_xwin_update(win);
1740 ecore_evas_transparent_set(win->ee, transparent);
1745 * Get the transparency state of a window.
1747 * @param obj The window object
1748 * @return If true, the window is transparent
1753 elm_win_transparent_get(const Evas_Object *obj)
1756 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1757 win = elm_widget_data_get(obj);
1758 if (!win) return EINA_FALSE;
1760 return ecore_evas_transparent_get(win->ee);
1764 * Set the override state of a window.
1766 * @param obj The window object
1767 * @param override If true, the window is overridden
1772 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1775 ELM_CHECK_WIDTYPE(obj, widtype);
1776 win = elm_widget_data_get(obj);
1778 ecore_evas_override_set(win->ee, override);
1779 #ifdef HAVE_ELEMENTARY_X
1780 _elm_win_xwin_update(win);
1785 * Get the override state of a window.
1787 * @param obj The window object
1788 * @return If true, the window is overridden
1793 elm_win_override_get(const Evas_Object *obj)
1796 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1797 win = elm_widget_data_get(obj);
1798 if (!win) return EINA_FALSE;
1799 return ecore_evas_override_get(win->ee);
1803 * Set the fullscreen state of a window.
1805 * @param obj The window object
1806 * @param fullscreen If true, the window is fullscreen
1811 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1814 ELM_CHECK_WIDTYPE(obj, widtype);
1815 win = elm_widget_data_get(obj);
1818 // YYY: handle if win->img_obj
1819 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1820 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1821 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1823 // these engines... can ONLY be fullscreen
1828 ecore_evas_fullscreen_set(win->ee, fullscreen);
1829 #ifdef HAVE_ELEMENTARY_X
1830 _elm_win_xwin_update(win);
1833 #undef ENGINE_COMPARE
1837 * Get the fullscreen state of a window.
1839 * @param obj The window object
1840 * @return If true, the window is fullscreen
1845 elm_win_fullscreen_get(const Evas_Object *obj)
1848 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1849 win = elm_widget_data_get(obj);
1850 if (!win) return EINA_FALSE;
1852 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1853 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1854 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1856 // these engines... can ONLY be fullscreen
1861 return ecore_evas_fullscreen_get(win->ee);
1863 #undef ENGINE_COMPARE
1867 * Set the maximized state of a window.
1869 * @param obj The window object
1870 * @param maximized If true, the window is maximized
1875 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1878 ELM_CHECK_WIDTYPE(obj, widtype);
1879 win = elm_widget_data_get(obj);
1881 // YYY: handle if win->img_obj
1882 ecore_evas_maximized_set(win->ee, maximized);
1883 #ifdef HAVE_ELEMENTARY_X
1884 _elm_win_xwin_update(win);
1889 * Get the maximized state of a window.
1891 * @param obj The window object
1892 * @return If true, the window is maximized
1897 elm_win_maximized_get(const Evas_Object *obj)
1900 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1901 win = elm_widget_data_get(obj);
1902 if (!win) return EINA_FALSE;
1903 return ecore_evas_maximized_get(win->ee);
1907 * Set the iconified state of a window.
1909 * @param obj The window object
1910 * @param iconified If true, the window is iconified
1915 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1918 ELM_CHECK_WIDTYPE(obj, widtype);
1919 win = elm_widget_data_get(obj);
1921 ecore_evas_iconified_set(win->ee, iconified);
1922 #ifdef HAVE_ELEMENTARY_X
1923 _elm_win_xwin_update(win);
1928 * Get the iconified state of a window.
1930 * @param obj The window object
1931 * @return If true, the window is iconified
1936 elm_win_iconified_get(const Evas_Object *obj)
1939 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1940 win = elm_widget_data_get(obj);
1941 if (!win) return EINA_FALSE;
1942 return ecore_evas_iconified_get(win->ee);
1946 * Set the layer of the window.
1948 * @param obj The window object
1949 * @param layer The layer of the window
1954 elm_win_layer_set(Evas_Object *obj, int layer)
1957 ELM_CHECK_WIDTYPE(obj, widtype);
1958 win = elm_widget_data_get(obj);
1960 ecore_evas_layer_set(win->ee, layer);
1961 #ifdef HAVE_ELEMENTARY_X
1962 _elm_win_xwin_update(win);
1967 * Get the layer of the window.
1969 * @param obj The window object
1970 * @return The layer of the window
1975 elm_win_layer_get(const Evas_Object *obj)
1978 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1979 win = elm_widget_data_get(obj);
1980 if (!win) return -1;
1981 return ecore_evas_layer_get(win->ee);
1985 * Set the rotation of the window.
1987 * @param obj The window object
1988 * @param rotation The rotation of the window, in degrees (0-360)
1993 elm_win_rotation_set(Evas_Object *obj, int rotation)
1996 ELM_CHECK_WIDTYPE(obj, widtype);
1997 win = elm_widget_data_get(obj);
1999 if (win->rot == rotation) return;
2000 win->rot = rotation;
2001 ecore_evas_rotation_set(win->ee, rotation);
2002 evas_object_size_hint_min_set(obj, -1, -1);
2003 evas_object_size_hint_max_set(obj, -1, -1);
2004 _elm_win_eval_subobjs(obj);
2005 #ifdef HAVE_ELEMENTARY_X
2006 _elm_win_xwin_update(win);
2011 * Rotates the window and resizes it
2013 * @param obj The window object
2014 * @param layer The rotation of the window in degrees (0-360)
2019 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2022 ELM_CHECK_WIDTYPE(obj, widtype);
2023 win = elm_widget_data_get(obj);
2025 if (win->rot == rotation) return;
2026 win->rot = rotation;
2027 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2028 evas_object_size_hint_min_set(obj, -1, -1);
2029 evas_object_size_hint_max_set(obj, -1, -1);
2030 _elm_win_eval_subobjs(obj);
2031 #ifdef HAVE_ELEMENTARY_X
2032 _elm_win_xwin_update(win);
2037 * Get the rotation of the window.
2039 * @param obj The window object
2040 * @return The rotation of the window in degrees (0-360)
2045 elm_win_rotation_get(const Evas_Object *obj)
2048 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2049 win = elm_widget_data_get(obj);
2050 if (!win) return -1;
2055 * Set the sticky state of the window.
2057 * @param obj The window object
2058 * @param sticky If true, the window's sticky state is enabled
2063 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2066 ELM_CHECK_WIDTYPE(obj, widtype);
2067 win = elm_widget_data_get(obj);
2069 ecore_evas_sticky_set(win->ee, sticky);
2070 #ifdef HAVE_ELEMENTARY_X
2071 _elm_win_xwin_update(win);
2076 * Get the sticky state of the window.
2078 * @param obj The window object
2079 * @return If true, the window's sticky state is enabled
2084 elm_win_sticky_get(const Evas_Object *obj)
2087 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2088 win = elm_widget_data_get(obj);
2089 if (!win) return EINA_FALSE;
2090 return ecore_evas_sticky_get(win->ee);
2094 * Sets the keyboard mode of the window.
2096 * @param obj The window object
2097 * @param mode The mode to set; one of:
2098 * ELM_WIN_KEYBOARD_UNKNOWN
2099 * ELM_WIN_KEYBOARD_OFF
2100 * ELM_WIN_KEYBOARD_ON
2101 * ELM_WIN_KEYBOARD_ALPHA
2102 * ELM_WIN_KEYBOARD_NUMERIC
2103 * ELM_WIN_KEYBOARD_PIN
2104 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2105 * ELM_WIN_KEYBOARD_HEX
2106 * ELM_WIN_KEYBOARD_TERMINAL
2107 * ELM_WIN_KEYBOARD_PASSWORD
2108 * ELM_WIN_KEYBOARD_IP
2109 * ELM_WIN_KEYBOARD_HOST
2110 * ELM_WIN_KEYBOARD_FILE
2111 * ELM_WIN_KEYBOARD_URL
2112 * ELM_WIN_KEYBOARD_KEYPAD
2113 * ELM_WIN_KEYBOARD_J2ME
2118 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2121 ELM_CHECK_WIDTYPE(obj, widtype);
2122 win = elm_widget_data_get(obj);
2124 if (mode == win->kbdmode) return;
2125 #ifdef HAVE_ELEMENTARY_X
2126 _elm_win_xwindow_get(win);
2128 win->kbdmode = mode;
2129 #ifdef HAVE_ELEMENTARY_X
2131 ecore_x_e_virtual_keyboard_state_set
2132 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2137 * Gets the keyboard mode of the window.
2139 * @param obj The window object
2140 * @return The mode; one of:
2141 * ELM_WIN_KEYBOARD_UNKNOWN
2142 * ELM_WIN_KEYBOARD_OFF
2143 * ELM_WIN_KEYBOARD_ON
2144 * ELM_WIN_KEYBOARD_ALPHA
2145 * ELM_WIN_KEYBOARD_NUMERIC
2146 * ELM_WIN_KEYBOARD_PIN
2147 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2148 * ELM_WIN_KEYBOARD_HEX
2149 * ELM_WIN_KEYBOARD_TERMINAL
2150 * ELM_WIN_KEYBOARD_PASSWORD
2151 * ELM_WIN_KEYBOARD_IP
2152 * ELM_WIN_KEYBOARD_HOST
2153 * ELM_WIN_KEYBOARD_FILE
2154 * ELM_WIN_KEYBOARD_URL
2155 * ELM_WIN_KEYBOARD_KEYPAD
2156 * ELM_WIN_KEYBOARD_J2ME
2160 EAPI Elm_Win_Keyboard_Mode
2161 elm_win_keyboard_mode_get(const Evas_Object *obj)
2164 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2165 win = elm_widget_data_get(obj);
2166 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2167 return win->kbdmode;
2171 * Sets whether the window is a keyboard.
2173 * @param obj The window object
2174 * @param is_keyboard If true, the window is a virtual keyboard
2179 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2182 ELM_CHECK_WIDTYPE(obj, widtype);
2183 win = elm_widget_data_get(obj);
2185 #ifdef HAVE_ELEMENTARY_X
2186 _elm_win_xwindow_get(win);
2188 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2193 * Gets whether the window is a keyboard.
2195 * @param obj The window object
2196 * @return If the window is a virtual keyboard
2201 elm_win_keyboard_win_get(const Evas_Object *obj)
2204 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2205 win = elm_widget_data_get(obj);
2206 if (!win) return EINA_FALSE;
2207 #ifdef HAVE_ELEMENTARY_X
2208 _elm_win_xwindow_get(win);
2210 return ecore_x_e_virtual_keyboard_get(win->xwin);
2216 * Get the screen position of a window.
2218 * @param obj The window object
2219 * @param x The int to store the x coordinate to
2220 * @param y The int to store the y coordinate to
2225 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2228 ELM_CHECK_WIDTYPE(obj, widtype);
2229 win = elm_widget_data_get(obj);
2231 if (x) *x = win->screen.x;
2232 if (y) *y = win->screen.y;
2236 * Set if this window is an illume conformant window
2238 * @param obj The window object
2239 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2244 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2247 ELM_CHECK_WIDTYPE(obj, widtype);
2248 win = elm_widget_data_get(obj);
2250 #ifdef HAVE_ELEMENTARY_X
2251 _elm_win_xwindow_get(win);
2253 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2258 * Get if this window is an illume conformant window
2260 * @param obj The window object
2261 * @return A boolean if this window is illume conformant or not
2266 elm_win_conformant_get(const Evas_Object *obj)
2269 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2270 win = elm_widget_data_get(obj);
2271 if (!win) return EINA_FALSE;
2272 #ifdef HAVE_ELEMENTARY_X
2273 _elm_win_xwindow_get(win);
2275 return ecore_x_e_illume_conformant_get(win->xwin);
2281 * Set a window to be an illume quickpanel window
2283 * By default window objects are not quickpanel windows.
2285 * @param obj The window object
2286 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2291 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2294 ELM_CHECK_WIDTYPE(obj, widtype);
2295 win = elm_widget_data_get(obj);
2297 #ifdef HAVE_ELEMENTARY_X
2298 _elm_win_xwindow_get(win);
2301 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2304 Ecore_X_Window_State states[2];
2306 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2307 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2308 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2309 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2316 * Get if this window is a quickpanel or not
2318 * @param obj The window object
2319 * @return A boolean if this window is a quickpanel or not
2324 elm_win_quickpanel_get(const Evas_Object *obj)
2327 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2328 win = elm_widget_data_get(obj);
2329 if (!win) return EINA_FALSE;
2330 #ifdef HAVE_ELEMENTARY_X
2331 _elm_win_xwindow_get(win);
2333 return ecore_x_e_illume_quickpanel_get(win->xwin);
2339 * Set the major priority of a quickpanel window
2341 * @param obj The window object
2342 * @param priority The major priority for this quickpanel
2347 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2350 ELM_CHECK_WIDTYPE(obj, widtype);
2351 win = elm_widget_data_get(obj);
2353 #ifdef HAVE_ELEMENTARY_X
2354 _elm_win_xwindow_get(win);
2356 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2361 * Get the major priority of a quickpanel window
2363 * @param obj The window object
2364 * @return The major priority of this quickpanel
2369 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2372 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2373 win = elm_widget_data_get(obj);
2374 if (!win) return -1;
2375 #ifdef HAVE_ELEMENTARY_X
2376 _elm_win_xwindow_get(win);
2378 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2384 * Set the minor priority of a quickpanel window
2386 * @param obj The window object
2387 * @param priority The minor priority for this quickpanel
2392 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2395 ELM_CHECK_WIDTYPE(obj, widtype);
2396 win = elm_widget_data_get(obj);
2398 #ifdef HAVE_ELEMENTARY_X
2399 _elm_win_xwindow_get(win);
2401 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2406 * Get the minor priority of a quickpanel window
2408 * @param obj The window object
2409 * @return The minor priority of this quickpanel
2414 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2417 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2418 win = elm_widget_data_get(obj);
2419 if (!win) return -1;
2420 #ifdef HAVE_ELEMENTARY_X
2421 _elm_win_xwindow_get(win);
2423 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2429 * Set which zone this quickpanel should appear in
2431 * @param obj The window object
2432 * @param zone The requested zone for this quickpanel
2437 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2440 ELM_CHECK_WIDTYPE(obj, widtype);
2441 win = elm_widget_data_get(obj);
2443 #ifdef HAVE_ELEMENTARY_X
2444 _elm_win_xwindow_get(win);
2446 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2451 * Get which zone this quickpanel should appear in
2453 * @param obj The window object
2454 * @return The requested zone for this quickpanel
2459 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2462 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2463 win = elm_widget_data_get(obj);
2465 #ifdef HAVE_ELEMENTARY_X
2466 _elm_win_xwindow_get(win);
2468 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2474 * Set the window to be skipped by keyboard focus
2476 * This sets the window to be skipped by normal keyboard input. This means
2477 * a window manager will be asked to not focus this window as well as omit
2478 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2480 * Call this and enable it on a window BEFORE you show it for the first time,
2481 * otherwise it may have no effect.
2483 * Use this for windows that have only output information or might only be
2484 * interacted with by the mouse or fingers, and never for typing input.
2485 * Be careful that this may have side-effects like making the window
2486 * non-accessible in some cases unless the window is specially handled. Use
2489 * @param obj The window object
2490 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2495 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2498 ELM_CHECK_WIDTYPE(obj, widtype);
2499 win = elm_widget_data_get(obj);
2501 #ifdef HAVE_ELEMENTARY_X
2502 _elm_win_xwindow_get(win);
2507 Ecore_X_Window_State states[2];
2509 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2510 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2511 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2512 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2519 * Send a command to the windowing environment
2521 * This is intended to work in touchscreen or small screen device environments
2522 * where there is a more simplistic window management policy in place. This
2523 * uses the window object indicated to select which part of the environment
2524 * to control (the part that this window lives in), and provides a command
2525 * and an optional parameter structure (use NULL for this if not needed).
2527 * @param obj The window object that lives in the environment to control
2528 * @param command The command to send
2529 * @param params Optional parameters for the command
2534 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2537 ELM_CHECK_WIDTYPE(obj, widtype);
2538 win = elm_widget_data_get(obj);
2540 #ifdef HAVE_ELEMENTARY_X
2541 _elm_win_xwindow_get(win);
2546 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2547 ecore_x_e_illume_focus_back_send(win->xwin);
2549 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2550 ecore_x_e_illume_focus_forward_send(win->xwin);
2552 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2553 ecore_x_e_illume_focus_home_send(win->xwin);
2555 case ELM_ILLUME_COMMAND_CLOSE:
2556 ecore_x_e_illume_close_send(win->xwin);
2566 * Get the inlined image object handle
2568 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2569 * then the window is in fact an evas image object inlined in the parent
2570 * canvas. You can get this object (be careful to not manipulate it as it
2571 * is under control of elementary), and use it to do things like get pixel
2572 * data, save the image to a file, etc.
2574 * @param obj The window object to get the inlined image from
2575 * @return The inlined image object, or NULL if none exists
2580 elm_win_inlined_image_object_get(Evas_Object *obj)
2583 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2584 win = elm_widget_data_get(obj);
2585 if (!win) return NULL;
2586 return win->img_obj;
2590 * Set the enabled status for the focus highlight in a window
2592 * This function will enable or disable the focus highlight only for the
2593 * given window, regardless of the global setting for it
2595 * @param obj The window where to enable the highlight
2596 * @param enabled The enabled value for the highlight
2601 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2605 ELM_CHECK_WIDTYPE(obj, widtype);
2607 win = elm_widget_data_get(obj);
2608 enabled = !!enabled;
2609 if (win->focus_highlight.enabled == enabled)
2612 win->focus_highlight.enabled = enabled;
2614 if (win->focus_highlight.enabled)
2615 _elm_win_focus_highlight_init(win);
2617 _elm_win_focus_highlight_shutdown(win);
2621 * Get the enabled value of the focus highlight for this window
2623 * @param obj The window in which to check if the focus highlight is enabled
2625 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2630 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2634 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2636 win = elm_widget_data_get(obj);
2637 return win->focus_highlight.enabled;
2641 * Set the style for the focus highlight on this window
2643 * Sets the style to use for theming the highlight of focused objects on
2644 * the given window. If @p style is NULL, the default will be used.
2646 * @param obj The window where to set the style
2647 * @param style The style to set
2652 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2656 ELM_CHECK_WIDTYPE(obj, widtype);
2658 win = elm_widget_data_get(obj);
2659 eina_stringshare_replace(&win->focus_highlight.style, style);
2660 win->focus_highlight.changed_theme = EINA_TRUE;
2661 _elm_win_focus_highlight_reconfigure_job_start(win);
2665 * Get the style set for the focus highlight object
2667 * Gets the style set for this windows highilght object, or NULL if none
2670 * @param obj The window to retrieve the highlights style from
2672 * @return The style set or NULL if none was. Default is used in that case.
2677 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2681 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2683 win = elm_widget_data_get(obj);
2684 return win->focus_highlight.style;
2687 typedef struct _Widget_Data Widget_Data;
2692 Evas_Object *content;
2695 static void _del_hook(Evas_Object *obj);
2696 static void _theme_hook(Evas_Object *obj);
2697 static void _sizing_eval(Evas_Object *obj);
2698 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2699 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2701 static const char *widtype2 = NULL;
2704 _del_hook(Evas_Object *obj)
2706 Widget_Data *wd = elm_widget_data_get(obj);
2712 _theme_hook(Evas_Object *obj)
2714 Widget_Data *wd = elm_widget_data_get(obj);
2715 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2717 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2722 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2724 Widget_Data *wd = elm_widget_data_get(obj);
2729 /* Try Focus cycle in subitem */
2732 elm_widget_focus_next_get(wd->content, dir, next);
2737 *next = (Evas_Object *)obj;
2742 _sizing_eval(Evas_Object *obj)
2744 Widget_Data *wd = elm_widget_data_get(obj);
2745 Evas_Coord minw = -1, minh = -1;
2747 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2748 edje_object_size_min_calc(wd->frm, &minw, &minh);
2749 evas_object_size_hint_min_set(obj, minw, minh);
2750 evas_object_size_hint_max_set(obj, -1, -1);
2754 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2760 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2762 Widget_Data *wd = elm_widget_data_get(obj);
2763 Evas_Object *sub = event_info;
2764 if (sub == wd->content)
2766 evas_object_event_callback_del_full
2767 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2774 * @defgroup Inwin Inwin
2776 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2779 elm_win_inwin_add(Evas_Object *obj)
2785 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2786 win = elm_widget_data_get(obj);
2787 if (!win) return NULL;
2788 wd = ELM_NEW(Widget_Data);
2789 obj2 = elm_widget_add(win->evas);
2790 elm_widget_type_set(obj2, "inwin");
2791 ELM_SET_WIDTYPE(widtype2, "inwin");
2792 elm_widget_sub_object_add(obj, obj2);
2793 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2794 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2795 elm_win_resize_object_add(obj, obj2);
2797 elm_widget_data_set(obj2, wd);
2798 elm_widget_del_hook_set(obj2, _del_hook);
2799 elm_widget_theme_hook_set(obj2, _theme_hook);
2800 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2801 elm_widget_can_focus_set(obj2, EINA_TRUE);
2802 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2804 wd->frm = edje_object_add(win->evas);
2805 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2806 elm_widget_resize_object_set(obj2, wd->frm);
2808 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2815 * Activates an inwin object
2817 * @param obj The inwin to activate
2822 elm_win_inwin_activate(Evas_Object *obj)
2824 ELM_CHECK_WIDTYPE(obj, widtype2);
2825 Widget_Data *wd = elm_widget_data_get(obj);
2827 evas_object_raise(obj);
2828 evas_object_show(obj);
2829 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2830 elm_object_focus(obj);
2834 * Set the content of an inwin object.
2836 * Once the content object is set, a previously set one will be deleted.
2837 * If you want to keep that old content object, use the
2838 * elm_win_inwin_content_unset() function.
2840 * @param obj The inwin object
2841 * @param content The object to set as content
2846 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2848 ELM_CHECK_WIDTYPE(obj, widtype2);
2849 Widget_Data *wd = elm_widget_data_get(obj);
2851 if (wd->content == content) return;
2852 if (wd->content) evas_object_del(wd->content);
2853 wd->content = content;
2856 elm_widget_sub_object_add(obj, content);
2857 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2858 _changed_size_hints, obj);
2859 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2865 * Get the content of an inwin object.
2867 * Return the content object which is set for this widget.
2869 * @param obj The inwin object
2870 * @return The content that is being used
2875 elm_win_inwin_content_get(const Evas_Object *obj)
2877 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2878 Widget_Data *wd = elm_widget_data_get(obj);
2879 if (!wd) return NULL;
2884 * Unset the content of an inwin object.
2886 * Unparent and return the content object which was set for this widget.
2888 * @param obj The inwin object
2889 * @return The content that was being used
2894 elm_win_inwin_content_unset(Evas_Object *obj)
2896 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2897 Widget_Data *wd = elm_widget_data_get(obj);
2898 if (!wd) return NULL;
2899 if (!wd->content) return NULL;
2900 Evas_Object *content = wd->content;
2901 elm_widget_sub_object_del(obj, wd->content);
2902 edje_object_part_unswallow(wd->frm, wd->content);
2907 /* windowing spcific calls - shall we do this differently? */
2909 static Ecore_X_Window
2910 _elm_ee_win_get(const Evas_Object *obj)
2913 #ifdef HAVE_ELEMENTARY_X
2914 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2915 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2921 * Get the Ecore_X_Window of an Evas_Object
2923 * @param obj The object
2925 * @return The Ecore_X_Window of @p obj
2930 elm_win_xwindow_get(const Evas_Object *obj)
2932 Ecore_X_Window xwin = 0;
2937 type = elm_widget_type_get(obj);
2938 if (!type) return 0;
2939 if (type != widtype) return _elm_ee_win_get(obj);
2940 #ifdef HAVE_ELEMENTARY_X
2941 win = elm_widget_data_get(obj);
2942 if (!win) return xwin;
2943 if (win->xwin) return win->xwin;
2944 if (win->parent) return elm_win_xwindow_get(win->parent);