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 Eina_List *_elm_win_list = NULL;
85 int _elm_win_deferred_free = 0;
88 _elm_win_move(Ecore_Evas *ee)
90 Evas_Object *obj = ecore_evas_object_associate_get(ee);
95 win = elm_widget_data_get(obj);
97 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
100 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
104 _elm_win_resize(Ecore_Evas *ee)
106 Evas_Object *obj = ecore_evas_object_associate_get(ee);
110 win = elm_widget_data_get(obj);
112 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
113 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
117 _elm_win_focus_in(Ecore_Evas *ee)
119 Evas_Object *obj = ecore_evas_object_associate_get(ee);
123 win = elm_widget_data_get(obj);
125 /*NB: Why two different "focus signals" here ??? */
126 evas_object_smart_callback_call(win->win_obj, "focus-in", NULL); // FIXME: remove me
127 evas_object_smart_callback_call(win->win_obj, "focus,in", NULL);
128 win->focus_highlight.cur.visible = EINA_TRUE;
129 _elm_win_focus_highlight_reconfigure_job_start(win);
133 else if (win->img_obj)
140 _elm_win_focus_out(Ecore_Evas *ee)
142 Evas_Object *obj = ecore_evas_object_associate_get(ee);
146 win = elm_widget_data_get(obj);
148 evas_object_smart_callback_call(win->win_obj, "focus-out", NULL); // FIXME: remove me
149 evas_object_smart_callback_call(win->win_obj, "focus,out", NULL);
150 win->focus_highlight.cur.visible = EINA_FALSE;
151 _elm_win_focus_highlight_reconfigure_job_start(win);
155 else if (win->img_obj)
162 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
164 Elm_Win *wd = elm_widget_data_get(obj);
165 const Eina_List *items;
166 void *(*list_data_get) (const Eina_List *list);
174 if (!(items = elm_widget_focus_custom_chain_get(obj)))
180 list_data_get = eina_list_data_get;
182 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
188 *next = (Evas_Object *)obj;
193 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
195 Elm_Win *win = elm_widget_data_get(obj);
199 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
201 evas_object_focus_set(obj, elm_widget_focus_get(obj));
205 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
207 if (type == EVAS_CALLBACK_KEY_DOWN)
209 Evas_Event_Key_Down *ev = event_info;
210 if (!strcmp(ev->keyname, "Tab"))
212 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
213 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
215 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
216 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
225 _deferred_ecore_evas_free(void *data)
227 ecore_evas_free(data);
228 _elm_win_deferred_free--;
232 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
234 elm_object_focus(obj);
238 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
245 else if (win->img_obj)
247 evas_object_hide(win->img_obj);
252 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
259 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
260 _elm_win_obj_callback_parent_del, win);
263 if (win->autodel_clear) *(win->autodel_clear) = -1;
264 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
265 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
268 ecore_evas_callback_delete_request_set(win->ee, NULL);
269 ecore_evas_callback_resize_set(win->ee, NULL);
271 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
272 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
273 while (((child = evas_object_bottom_get(win->evas))) &&
276 evas_object_del(child);
278 while (((child = evas_object_top_get(win->evas))) &&
281 evas_object_del(child);
283 #ifdef HAVE_ELEMENTARY_X
284 if (win->client_message_handler)
285 ecore_event_handler_del(win->client_message_handler);
287 // FIXME: Why are we flushing edje on every window destroy ??
288 // edje_file_cache_flush();
289 // edje_collection_cache_flush();
290 // evas_image_cache_flush(win->evas);
291 // evas_font_cache_flush(win->evas);
292 // FIXME: we are in the del handler for the object and delete the canvas
293 // that lives under it from the handler... nasty. deferring doesn't help either
303 ecore_job_add(_deferred_ecore_evas_free, win->ee);
304 _elm_win_deferred_free++;
308 _elm_win_focus_highlight_shutdown(win);
309 eina_stringshare_del(win->focus_highlight.style);
313 if ((!_elm_win_list) &&
314 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
316 edje_file_cache_flush();
317 edje_collection_cache_flush();
318 evas_image_cache_flush(e);
319 evas_font_cache_flush(e);
325 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
328 if (!win->img_obj) return;
329 evas_object_event_callback_del_full
330 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
331 evas_object_del(win->img_obj);
335 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
338 if (obj == win->parent) win->parent = NULL;
342 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
353 evas_object_move(obj, x, y);
358 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
361 // this is called to make sure all smart containers have calculated their
362 // sizes BEFORE we show the window to make sure it initially appears at
363 // our desired size (ie min size is known first)
364 evas_smart_objects_calculate(evas_object_evas_get(obj));
365 evas_object_show(obj);
369 else if (win->img_obj)
371 evas_object_show(win->img_obj);
376 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
380 if (ecore_evas_override_get(win->ee))
384 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
387 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
392 else if (win->img_obj)
396 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
399 // evas_object_move(win->img_obj, x, y);
404 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
411 else if (win->img_obj)
413 Evas_Coord w = 1, h = 1;
415 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
418 evas_object_image_size_set(win->img_obj, w, h);
423 _elm_win_delete_request(Ecore_Evas *ee)
425 Evas_Object *obj = ecore_evas_object_associate_get(ee);
427 if (strcmp(elm_widget_type_get(obj), "win")) return;
429 win = elm_widget_data_get(obj);
431 int autodel = win->autodel;
432 win->autodel_clear = &autodel;
433 evas_object_smart_callback_call(win->win_obj, "delete-request", NULL); // FIXME: remove me
434 evas_object_smart_callback_call(win->win_obj, "delete,request", NULL);
435 // FIXME: if above callback deletes - then the below will be invalid
436 if (autodel) evas_object_del(win->win_obj);
437 else win->autodel_clear = NULL;
441 _elm_win_resize_job(void *data)
448 win->deferred_resize_job = NULL;
449 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
450 evas_object_resize(win->win_obj, w, h);
454 else if (win->img_obj)
457 EINA_LIST_FOREACH(win->subobjs, l, obj)
459 evas_object_move(obj, 0, 0);
460 evas_object_resize(obj, w, h);
464 #ifdef HAVE_ELEMENTARY_X
466 _elm_win_xwindow_get(Elm_Win *win)
470 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
471 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
473 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
475 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
476 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
477 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
478 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
479 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
480 ENGINE_COMPARE(ELM_OPENGL_SDL))
483 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
485 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
487 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
489 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
491 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
493 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
495 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
497 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
499 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
501 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
503 #undef ENGINE_COMPARE
507 #ifdef HAVE_ELEMENTARY_X
509 _elm_win_xwin_update(Elm_Win *win)
511 _elm_win_xwindow_get(win);
516 win2 = elm_widget_data_get(win->parent);
520 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
524 if (!win->xwin) return; /* nothing more to do */
529 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
531 case ELM_WIN_DIALOG_BASIC:
532 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
534 case ELM_WIN_DESKTOP:
535 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
538 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
540 case ELM_WIN_TOOLBAR:
541 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
544 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
546 case ELM_WIN_UTILITY:
547 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
550 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
552 case ELM_WIN_DROPDOWN_MENU:
553 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
555 case ELM_WIN_POPUP_MENU:
556 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
558 case ELM_WIN_TOOLTIP:
559 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
561 case ELM_WIN_NOTIFICATION:
562 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
565 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
568 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
573 ecore_x_e_virtual_keyboard_state_set
574 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
579 _elm_win_eval_subobjs(Evas_Object *obj)
582 const Evas_Object *child;
584 Elm_Win *win = elm_widget_data_get(obj);
585 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
589 EINA_LIST_FOREACH(win->subobjs, l, child)
591 evas_object_size_hint_weight_get(child, &wx, &wy);
592 if (wx == 0.0) xx = 0;
593 if (wy == 0.0) xy = 0;
595 evas_object_size_hint_min_get(child, &w, &h);
598 if (w > minw) minw = w;
599 if (h > minh) minh = h;
601 evas_object_size_hint_max_get(child, &w, &h);
604 if (maxw == -1) maxw = w;
605 else if ((w > 0) && (w < maxw)) maxw = w;
606 if (maxh == -1) maxh = h;
607 else if ((h > 0) && (h < maxh)) maxh = h;
609 if (!xx) maxw = minw;
611 if (!xy) maxh = minh;
613 evas_object_size_hint_min_set(obj, minw, minh);
614 evas_object_size_hint_max_set(obj, maxw, maxh);
615 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
616 if (w < minw) w = minw;
617 if (h < minh) h = minh;
618 if ((maxw >= 0) && (w > maxw)) w = maxw;
619 if ((maxh >= 0) && (h > maxh)) h = maxh;
620 evas_object_resize(obj, w, h);
624 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
626 Elm_Win *win = elm_widget_data_get(data);
627 win->subobjs = eina_list_remove(win->subobjs, obj);
628 _elm_win_eval_subobjs(win->win_obj);
632 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
634 _elm_win_eval_subobjs(data);
638 _elm_win_shutdown(void)
640 while (_elm_win_list)
641 evas_object_del(_elm_win_list->data);
645 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
652 EINA_LIST_FOREACH(_elm_win_list, l, obj)
653 elm_widget_theme(obj);
657 EINA_LIST_FOREACH(_elm_win_list, l, obj)
658 elm_widget_theme_specific(obj, th, EINA_FALSE);
662 #ifdef HAVE_ELEMENTARY_X
664 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
667 Ecore_X_Event_Client_Message *e = event;
669 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
670 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
672 if ((unsigned)e->data.l[0] == win->xwin)
674 Evas *evas = evas_object_evas_get(win->win_obj);
677 edje_file_cache_flush();
678 edje_collection_cache_flush();
679 evas_image_cache_flush(evas);
680 evas_font_cache_flush(evas);
684 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
686 if ((unsigned)e->data.l[0] == win->xwin)
688 Evas *evas = evas_object_evas_get(win->win_obj);
691 edje_file_cache_flush();
692 edje_collection_cache_flush();
693 evas_image_cache_flush(evas);
694 evas_font_cache_flush(evas);
695 evas_render_dump(evas);
699 return ECORE_CALLBACK_PASS_ON;
704 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
708 win->focus_highlight.geometry_changed = EINA_TRUE;
709 _elm_win_focus_highlight_reconfigure_job_start(win);
713 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
717 win->focus_highlight.geometry_changed = EINA_TRUE;
718 _elm_win_focus_highlight_reconfigure_job_start(win);
722 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
726 win->focus_highlight.cur.target = NULL;
728 _elm_win_focus_highlight_reconfigure_job_start(win);
732 _elm_win_focus_target_callbacks_add(Elm_Win *win)
734 Evas_Object *obj = win->focus_highlight.cur.target;
736 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
737 _elm_win_focus_target_move, win);
738 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
739 _elm_win_focus_target_resize, win);
740 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
741 _elm_win_focus_target_del, win);
745 _elm_win_focus_target_callbacks_del(Elm_Win *win)
747 Evas_Object *obj = win->focus_highlight.cur.target;
749 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
750 _elm_win_focus_target_move, win);
751 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
752 _elm_win_focus_target_resize, win);
753 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
754 _elm_win_focus_target_del, win);
758 _elm_win_focus_target_get(Evas_Object *obj)
760 Evas_Object *o = obj;
764 if (elm_widget_is(o))
766 if (!elm_widget_highlight_ignore_get(o))
768 o = elm_widget_parent_get(o);
770 o = evas_object_smart_parent_get(o);
774 o = elm_widget_parent_widget_get(o);
776 o = evas_object_smart_parent_get(o);
785 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
787 Evas_Object *obj = event_info, *target;
790 if (win->focus_highlight.cur.target == obj)
793 target = _elm_win_focus_target_get(obj);
794 win->focus_highlight.cur.target = target;
795 if (elm_widget_highlight_in_theme_get(target))
796 win->focus_highlight.cur.handled = EINA_TRUE;
798 _elm_win_focus_target_callbacks_add(win);
800 _elm_win_focus_highlight_reconfigure_job_start(win);
804 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
808 if (!win->focus_highlight.cur.target)
811 if (!win->focus_highlight.cur.handled)
812 _elm_win_focus_target_callbacks_del(win);
813 win->focus_highlight.cur.target = NULL;
814 win->focus_highlight.cur.handled = EINA_FALSE;
816 _elm_win_focus_highlight_reconfigure_job_start(win);
820 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
822 evas_object_hide(obj);
826 _elm_win_focus_highlight_init(Elm_Win *win)
828 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
829 _elm_win_object_focus_in, win);
830 evas_event_callback_add(win->evas,
831 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
832 _elm_win_object_focus_out, win);
834 win->focus_highlight.cur.target = evas_focus_get(win->evas);
836 win->focus_highlight.top = edje_object_add(win->evas);
837 win->focus_highlight.changed_theme = EINA_TRUE;
838 edje_object_signal_callback_add(win->focus_highlight.top,
839 "elm,action,focus,hide,end", "",
840 _elm_win_focus_highlight_hide, NULL);
841 edje_object_signal_callback_add(win->focus_highlight.top,
842 "elm,action,focus,anim,end", "",
843 _elm_win_focus_highlight_anim_end, win);
844 _elm_win_focus_highlight_reconfigure_job_start(win);
848 _elm_win_focus_highlight_shutdown(Elm_Win *win)
850 _elm_win_focus_highlight_reconfigure_job_stop(win);
851 if (win->focus_highlight.cur.target)
853 _elm_win_focus_target_callbacks_del(win);
854 win->focus_highlight.cur.target = NULL;
856 if (win->focus_highlight.top)
858 evas_object_del(win->focus_highlight.top);
859 win->focus_highlight.top = NULL;
862 evas_event_callback_del_full(win->evas,
863 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
864 _elm_win_object_focus_in, win);
865 evas_event_callback_del_full(win->evas,
866 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
867 _elm_win_object_focus_out, win);
871 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
875 top = win->focus_highlight.top;
880 evas_object_show(top);
881 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
887 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
892 _elm_win_focus_highlight_reconfigure_job(void *data)
894 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
898 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
900 if (win->focus_highlight.reconf_job)
901 ecore_job_del(win->focus_highlight.reconf_job);
902 win->focus_highlight.reconf_job = ecore_job_add(
903 _elm_win_focus_highlight_reconfigure_job, win);
907 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
909 if (win->focus_highlight.reconf_job)
910 ecore_job_del(win->focus_highlight.reconf_job);
911 win->focus_highlight.reconf_job = NULL;
915 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
917 Evas_Object *clip, *target = win->focus_highlight.cur.target;
918 Evas_Coord x, y, w, h;
920 clip = evas_object_clip_get(target);
921 evas_object_geometry_get(target, &x, &y, &w, &h);
923 evas_object_move(obj, x, y);
924 evas_object_resize(obj, w, h);
925 evas_object_clip_set(obj, clip);
929 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
931 Evas_Coord tx, ty, tw, th;
932 Evas_Coord w, h, px, py, pw, ph;
933 Edje_Message_Int_Set *m;
934 Evas_Object *previous = win->focus_highlight.prev.target;
935 Evas_Object *target = win->focus_highlight.cur.target;
937 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
938 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
939 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
940 evas_object_move(obj, 0, 0);
941 evas_object_resize(obj, tw, th);
942 evas_object_clip_unset(obj);
944 m = alloca(sizeof(*m) + (sizeof(int) * 8));
954 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
958 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
961 _elm_win_focus_highlight_simple_setup(win, obj);
965 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
967 Evas_Object *target = win->focus_highlight.cur.target;
968 Evas_Object *previous = win->focus_highlight.prev.target;
969 Evas_Object *top = win->focus_highlight.top;
970 Eina_Bool visible_changed;
971 Eina_Bool common_visible;
972 const char *sig = NULL;
974 _elm_win_focus_highlight_reconfigure_job_stop(win);
976 visible_changed = (win->focus_highlight.cur.visible !=
977 win->focus_highlight.prev.visible);
979 if ((target == previous) && (!visible_changed) &&
980 (!win->focus_highlight.geometry_changed))
983 if ((previous) && (win->focus_highlight.prev.handled))
984 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
987 common_visible = EINA_FALSE;
988 else if (win->focus_highlight.cur.handled)
990 common_visible = EINA_FALSE;
991 if (win->focus_highlight.cur.visible)
992 sig = "elm,action,focus_highlight,show";
994 sig = "elm,action,focus_highlight,hide";
997 common_visible = win->focus_highlight.cur.visible;
999 _elm_win_focus_highlight_visible_set(win, common_visible);
1001 elm_widget_signal_emit(target, sig, "elm");
1003 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1006 if (win->focus_highlight.changed_theme)
1009 if (win->focus_highlight.style)
1010 str = win->focus_highlight.style;
1013 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1015 win->focus_highlight.changed_theme = EINA_FALSE;
1017 if (_elm_config->focus_highlight_animate)
1019 str = edje_object_data_get(win->focus_highlight.top, "animate");
1020 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1024 if ((win->focus_highlight.top_animate) && (previous) &&
1025 (!win->focus_highlight.prev.handled))
1026 _elm_win_focus_highlight_anim_setup(win, top);
1028 _elm_win_focus_highlight_simple_setup(win, top);
1029 evas_object_raise(top);
1032 win->focus_highlight.geometry_changed = EINA_FALSE;
1033 win->focus_highlight.prev = win->focus_highlight.cur;
1038 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1040 Evas_Event_Key_Down *ev = event_info;
1042 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1046 if ((strcmp(ev->keyname, "F12")) ||
1047 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1050 printf("Tree graph generated.\n");
1051 elm_object_tree_dot_dump(obj, "./dump.dot");
1056 _win_img_hide(void *data,
1058 Evas_Object *obj __UNUSED__,
1059 void *event_info __UNUSED__)
1061 Elm_Win *win = data;
1063 elm_widget_focus_hide_handle(win->win_obj);
1067 _win_img_mouse_down(void *data,
1069 Evas_Object *obj __UNUSED__,
1070 void *event_info __UNUSED__)
1072 Elm_Win *win = data;
1073 elm_widget_focus_mouse_down_handle(win->win_obj);
1077 _win_img_focus_in(void *data,
1079 Evas_Object *obj __UNUSED__,
1080 void *event_info __UNUSED__)
1082 Elm_Win *win = data;
1083 elm_widget_focus_steal(win->win_obj);
1087 _win_img_focus_out(void *data,
1089 Evas_Object *obj __UNUSED__,
1090 void *event_info __UNUSED__)
1092 Elm_Win *win = data;
1093 elm_widget_focused_object_clear(win->win_obj);
1097 _win_inlined_image_set(Elm_Win *win)
1099 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1100 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1101 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1102 _elm_win_obj_callback_img_obj_del, win);
1104 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1105 _win_img_hide, win);
1106 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1107 _win_img_mouse_down, win);
1108 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1109 _win_img_focus_in, win);
1110 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1111 _win_img_focus_out, win);
1115 * Adds a window object. If this is the first window created, pass NULL as
1118 * @param parent Parent object to add the window to, or NULL
1119 * @param name The name of the window
1120 * @param type The window type, one of the following:
1122 * ELM_WIN_DIALOG_BASIC
1130 * @return The created object, or NULL on failure
1135 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1139 const char *fontpath;
1141 win = ELM_NEW(Elm_Win);
1143 #define FALLBACK_TRY(engine) \
1146 CRITICAL(engine " engine creation failed. Trying software X11."); \
1147 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1149 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1153 case ELM_WIN_INLINED:
1154 // FIXME: implement. same as ELM_WIN_INLINED_IMAGE but with border
1157 case ELM_WIN_INLINED_IMAGE:
1161 Evas *e = evas_object_evas_get(parent);
1164 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1167 win->img_obj = ecore_evas_object_image_new(ee);
1170 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1173 _win_inlined_image_set(win);
1177 evas_object_del(win->img_obj);
1178 win->img_obj = NULL;
1186 case ELM_WIN_MEMORY:
1190 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1192 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1193 #ifdef HAVE_ELEMENTARY_X
1194 win->client_message_handler = ecore_event_handler_add
1195 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1198 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1200 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1201 FALLBACK_TRY("Sofware FB");
1203 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1205 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1206 FALLBACK_TRY("Sofware DirectFB");
1208 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1210 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1211 FALLBACK_TRY("Sofware-16");
1212 #ifdef HAVE_ELEMENTARY_X
1213 win->client_message_handler = ecore_event_handler_add
1214 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1217 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1219 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1220 FALLBACK_TRY("Sofware-8");
1221 #ifdef HAVE_ELEMENTARY_X
1222 win->client_message_handler = ecore_event_handler_add
1223 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1226 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1228 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1229 FALLBACK_TRY("XRender");
1230 #ifdef HAVE_ELEMENTARY_X
1231 win->client_message_handler = ecore_event_handler_add
1232 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1235 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1237 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1238 FALLBACK_TRY("OpenGL");
1239 #ifdef HAVE_ELEMENTARY_X
1240 win->client_message_handler = ecore_event_handler_add
1241 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1244 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1246 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1247 FALLBACK_TRY("Sofware Win32");
1249 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1251 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1252 FALLBACK_TRY("Sofware-16-WinCE");
1254 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1256 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1257 FALLBACK_TRY("Sofware SDL");
1259 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1261 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1262 FALLBACK_TRY("Sofware-16-SDL");
1264 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1266 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1267 FALLBACK_TRY("OpenGL SDL");
1275 ERR("Cannot create window.");
1279 #ifdef HAVE_ELEMENTARY_X
1280 _elm_win_xwindow_get(win);
1282 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1283 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1284 // bg pixmap done by x - has other issues like can be redrawn by x before it
1285 // is filled/ready by app
1286 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1289 win->parent = parent;
1291 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1292 _elm_win_obj_callback_parent_del, win);
1294 win->evas = ecore_evas_get(win->ee);
1295 win->win_obj = elm_widget_add(win->evas);
1296 elm_widget_type_set(win->win_obj, "win");
1297 ELM_SET_WIDTYPE(widtype, "win");
1298 elm_widget_data_set(win->win_obj, win);
1299 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1300 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1301 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1302 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1303 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1304 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1305 evas_object_move(win->win_obj, 0, 0);
1306 evas_object_resize(win->win_obj, 1, 1);
1307 evas_object_layer_set(win->win_obj, 50);
1308 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1310 evas_object_intercept_move_callback_add(win->win_obj,
1311 _elm_win_obj_intercept_move, win);
1312 evas_object_intercept_show_callback_add(win->win_obj,
1313 _elm_win_obj_intercept_show, win);
1314 ecore_evas_object_associate(win->ee, win->win_obj,
1315 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1316 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1317 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1318 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1319 _elm_win_obj_callback_show, win);
1320 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1321 _elm_win_obj_callback_hide, win);
1322 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1323 _elm_win_obj_callback_del, win);
1324 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1325 _elm_win_obj_callback_move, win);
1326 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1327 _elm_win_obj_callback_resize, win);
1329 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1330 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1331 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1332 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1333 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1334 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1335 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1336 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1337 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1338 evas_font_path_append(win->evas, fontpath);
1339 if (!_elm_config->font_hinting)
1340 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1341 else if (_elm_config->font_hinting == 1)
1342 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1343 else if (_elm_config->font_hinting == 2)
1344 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1346 #ifdef HAVE_ELEMENTARY_X
1347 _elm_win_xwin_update(win);
1350 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1352 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1354 ecore_evas_fullscreen_set(win->ee, 1);
1356 #undef ENGINE_COMPARE
1358 if (_elm_config->focus_highlight_enable)
1359 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1362 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1363 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1364 _debug_key_down, win);
1366 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1368 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1370 return win->win_obj;
1374 * Add @p subobj as a resize object of window @p obj.
1376 * @param obj The window object
1377 * @param subobj The resize object to add
1382 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1386 ELM_CHECK_WIDTYPE(obj, widtype);
1387 win = elm_widget_data_get(obj);
1389 win->subobjs = eina_list_append(win->subobjs, subobj);
1390 elm_widget_sub_object_add(obj, subobj);
1391 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1392 _elm_win_subobj_callback_del, obj);
1393 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1394 _elm_win_subobj_callback_changed_size_hints,
1396 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1397 evas_object_move(subobj, 0, 0);
1398 evas_object_resize(subobj, w, h);
1399 _elm_win_eval_subobjs(obj);
1403 * Delete @p subobj as a resize object of window @p obj.
1405 * @param obj The window object
1406 * @param subobj The resize object to add
1411 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1414 ELM_CHECK_WIDTYPE(obj, widtype);
1415 win = elm_widget_data_get(obj);
1417 evas_object_event_callback_del_full(subobj,
1418 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1419 _elm_win_subobj_callback_changed_size_hints,
1421 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1422 _elm_win_subobj_callback_del, obj);
1423 win->subobjs = eina_list_remove(win->subobjs, subobj);
1424 elm_widget_sub_object_del(obj, subobj);
1425 _elm_win_eval_subobjs(obj);
1429 * Set the title of the window
1431 * @param obj The window object
1432 * @param title The title to set
1437 elm_win_title_set(Evas_Object *obj, const char *title)
1440 ELM_CHECK_WIDTYPE(obj, widtype);
1441 win = elm_widget_data_get(obj);
1443 ecore_evas_title_set(win->ee, title);
1447 * Get the title of the window
1449 * @param obj The window object
1455 elm_win_title_get(const Evas_Object *obj)
1458 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1459 win = elm_widget_data_get(obj);
1460 if (!win) return NULL;
1461 return ecore_evas_title_get(win->ee);
1465 * Set the window's autodel state.
1467 * @param obj The window object
1468 * @param autodel If true, the window will automatically delete itself when closed
1473 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1476 ELM_CHECK_WIDTYPE(obj, widtype);
1477 win = elm_widget_data_get(obj);
1479 win->autodel = autodel;
1483 * Get the window's autodel state.
1485 * @param obj The window object
1486 * @return If the window will automatically delete itself when closed
1491 elm_win_autodel_get(const Evas_Object *obj)
1494 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1495 win = elm_widget_data_get(obj);
1496 if (!win) return EINA_FALSE;
1497 return win->autodel;
1501 * Activate a window object.
1503 * @param obj The window object
1508 elm_win_activate(Evas_Object *obj)
1511 ELM_CHECK_WIDTYPE(obj, widtype);
1512 win = elm_widget_data_get(obj);
1514 ecore_evas_activate(win->ee);
1518 * Lower a window object.
1520 * @param obj The window object
1525 elm_win_lower(Evas_Object *obj)
1528 ELM_CHECK_WIDTYPE(obj, widtype);
1529 win = elm_widget_data_get(obj);
1531 ecore_evas_lower(win->ee);
1535 * Raise a window object.
1537 * @param obj The window object
1542 elm_win_raise(Evas_Object *obj)
1545 ELM_CHECK_WIDTYPE(obj, widtype);
1546 win = elm_widget_data_get(obj);
1548 ecore_evas_raise(win->ee);
1552 * Set the borderless state of a window.
1554 * @param obj The window object
1555 * @param borderless If true, the window is borderless
1560 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1563 ELM_CHECK_WIDTYPE(obj, widtype);
1564 win = elm_widget_data_get(obj);
1566 ecore_evas_borderless_set(win->ee, borderless);
1567 #ifdef HAVE_ELEMENTARY_X
1568 _elm_win_xwin_update(win);
1573 * Get the borderless state of a window.
1575 * @param obj The window object
1576 * @return If true, the window is borderless
1581 elm_win_borderless_get(const Evas_Object *obj)
1584 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1585 win = elm_widget_data_get(obj);
1586 if (!win) return EINA_FALSE;
1587 return ecore_evas_borderless_get(win->ee);
1591 * Set the shaped state of a window.
1593 * @param obj The window object
1594 * @param shaped If true, the window is shaped
1599 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1602 ELM_CHECK_WIDTYPE(obj, widtype);
1603 win = elm_widget_data_get(obj);
1605 ecore_evas_shaped_set(win->ee, shaped);
1606 #ifdef HAVE_ELEMENTARY_X
1607 _elm_win_xwin_update(win);
1612 * Get the shaped state of a window.
1614 * @param obj The window object
1615 * @return If true, the window is shaped
1620 elm_win_shaped_get(const Evas_Object *obj)
1623 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1624 win = elm_widget_data_get(obj);
1625 if (!win) return EINA_FALSE;
1626 return ecore_evas_shaped_get(win->ee);
1630 * Set the alpha channel state of a window.
1632 * @param obj The window object
1633 * @param alpha If true, the window has an alpha channel
1638 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1641 ELM_CHECK_WIDTYPE(obj, widtype);
1642 win = elm_widget_data_get(obj);
1647 else if (win->img_obj)
1649 evas_object_image_alpha_set(win->img_obj, alpha);
1653 #ifdef HAVE_ELEMENTARY_X
1658 if (!_elm_config->compositing)
1659 elm_win_shaped_set(obj, alpha);
1661 ecore_evas_alpha_set(win->ee, alpha);
1664 ecore_evas_alpha_set(win->ee, alpha);
1665 _elm_win_xwin_update(win);
1669 ecore_evas_alpha_set(win->ee, alpha);
1674 * Get the alpha channel state of a window.
1676 * @param obj The window object
1677 * @return If true, the window has an alpha channel
1682 elm_win_alpha_get(const Evas_Object *obj)
1685 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1686 win = elm_widget_data_get(obj);
1687 if (!win) return EINA_FALSE;
1688 return ecore_evas_alpha_get(win->ee);
1692 * Set the transparency state of a window.
1694 * @param obj The window object
1695 * @param transparent If true, the window is transparent
1700 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1703 ELM_CHECK_WIDTYPE(obj, widtype);
1704 win = elm_widget_data_get(obj);
1710 else if (win->img_obj)
1712 evas_object_image_alpha_set(win->img_obj, transparent);
1716 #ifdef HAVE_ELEMENTARY_X
1719 ecore_evas_transparent_set(win->ee, transparent);
1720 _elm_win_xwin_update(win);
1724 ecore_evas_transparent_set(win->ee, transparent);
1729 * Get the transparency state of a window.
1731 * @param obj The window object
1732 * @return If true, the window is transparent
1737 elm_win_transparent_get(const Evas_Object *obj)
1740 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1741 win = elm_widget_data_get(obj);
1742 if (!win) return EINA_FALSE;
1744 return ecore_evas_transparent_get(win->ee);
1748 * Set the override state of a window.
1750 * @param obj The window object
1751 * @param override If true, the window is overridden
1756 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1759 ELM_CHECK_WIDTYPE(obj, widtype);
1760 win = elm_widget_data_get(obj);
1762 ecore_evas_override_set(win->ee, override);
1763 #ifdef HAVE_ELEMENTARY_X
1764 _elm_win_xwin_update(win);
1769 * Get the override state of a window.
1771 * @param obj The window object
1772 * @return If true, the window is overridden
1777 elm_win_override_get(const Evas_Object *obj)
1780 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1781 win = elm_widget_data_get(obj);
1782 if (!win) return EINA_FALSE;
1783 return ecore_evas_override_get(win->ee);
1787 * Set the fullscreen state of a window.
1789 * @param obj The window object
1790 * @param fullscreen If true, the window is fullscreen
1795 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1798 ELM_CHECK_WIDTYPE(obj, widtype);
1799 win = elm_widget_data_get(obj);
1802 // YYY: handle if win->img_obj
1803 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1804 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1805 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1807 // these engines... can ONLY be fullscreen
1812 ecore_evas_fullscreen_set(win->ee, fullscreen);
1813 #ifdef HAVE_ELEMENTARY_X
1814 _elm_win_xwin_update(win);
1817 #undef ENGINE_COMPARE
1821 * Get the fullscreen state of a window.
1823 * @param obj The window object
1824 * @return If true, the window is fullscreen
1829 elm_win_fullscreen_get(const Evas_Object *obj)
1832 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1833 win = elm_widget_data_get(obj);
1834 if (!win) return EINA_FALSE;
1836 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1837 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1838 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1840 // these engines... can ONLY be fullscreen
1845 return ecore_evas_fullscreen_get(win->ee);
1847 #undef ENGINE_COMPARE
1851 * Set the maximized state of a window.
1853 * @param obj The window object
1854 * @param maximized If true, the window is maximized
1859 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1862 ELM_CHECK_WIDTYPE(obj, widtype);
1863 win = elm_widget_data_get(obj);
1865 // YYY: handle if win->img_obj
1866 ecore_evas_maximized_set(win->ee, maximized);
1867 #ifdef HAVE_ELEMENTARY_X
1868 _elm_win_xwin_update(win);
1873 * Get the maximized state of a window.
1875 * @param obj The window object
1876 * @return If true, the window is maximized
1881 elm_win_maximized_get(const Evas_Object *obj)
1884 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1885 win = elm_widget_data_get(obj);
1886 if (!win) return EINA_FALSE;
1887 return ecore_evas_maximized_get(win->ee);
1891 * Set the iconified state of a window.
1893 * @param obj The window object
1894 * @param iconified If true, the window is iconified
1899 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1902 ELM_CHECK_WIDTYPE(obj, widtype);
1903 win = elm_widget_data_get(obj);
1905 ecore_evas_iconified_set(win->ee, iconified);
1906 #ifdef HAVE_ELEMENTARY_X
1907 _elm_win_xwin_update(win);
1912 * Get the iconified state of a window.
1914 * @param obj The window object
1915 * @return If true, the window is iconified
1920 elm_win_iconified_get(const Evas_Object *obj)
1923 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1924 win = elm_widget_data_get(obj);
1925 if (!win) return EINA_FALSE;
1926 return ecore_evas_iconified_get(win->ee);
1930 * Set the layer of the window.
1932 * @param obj The window object
1933 * @param layer The layer of the window
1938 elm_win_layer_set(Evas_Object *obj, int layer)
1941 ELM_CHECK_WIDTYPE(obj, widtype);
1942 win = elm_widget_data_get(obj);
1944 ecore_evas_layer_set(win->ee, layer);
1945 #ifdef HAVE_ELEMENTARY_X
1946 _elm_win_xwin_update(win);
1951 * Get the layer of the window.
1953 * @param obj The window object
1954 * @return The layer of the window
1959 elm_win_layer_get(const Evas_Object *obj)
1962 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1963 win = elm_widget_data_get(obj);
1964 if (!win) return -1;
1965 return ecore_evas_layer_get(win->ee);
1969 * Set the rotation of the window.
1971 * @param obj The window object
1972 * @param rotation The rotation of the window, in degrees (0-360)
1977 elm_win_rotation_set(Evas_Object *obj, int rotation)
1980 ELM_CHECK_WIDTYPE(obj, widtype);
1981 win = elm_widget_data_get(obj);
1983 if (win->rot == rotation) return;
1984 win->rot = rotation;
1985 ecore_evas_rotation_set(win->ee, rotation);
1986 evas_object_size_hint_min_set(obj, -1, -1);
1987 evas_object_size_hint_max_set(obj, -1, -1);
1988 _elm_win_eval_subobjs(obj);
1989 #ifdef HAVE_ELEMENTARY_X
1990 _elm_win_xwin_update(win);
1995 * Rotates the window and resizes it
1997 * @param obj The window object
1998 * @param layer The rotation of the window in degrees (0-360)
2003 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2006 ELM_CHECK_WIDTYPE(obj, widtype);
2007 win = elm_widget_data_get(obj);
2009 if (win->rot == rotation) return;
2010 win->rot = rotation;
2011 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2012 evas_object_size_hint_min_set(obj, -1, -1);
2013 evas_object_size_hint_max_set(obj, -1, -1);
2014 _elm_win_eval_subobjs(obj);
2015 #ifdef HAVE_ELEMENTARY_X
2016 _elm_win_xwin_update(win);
2021 * Get the rotation of the window.
2023 * @param obj The window object
2024 * @return The rotation of the window in degrees (0-360)
2029 elm_win_rotation_get(const Evas_Object *obj)
2032 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2033 win = elm_widget_data_get(obj);
2034 if (!win) return -1;
2039 * Set the sticky state of the window.
2041 * @param obj The window object
2042 * @param sticky If true, the window's sticky state is enabled
2047 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2050 ELM_CHECK_WIDTYPE(obj, widtype);
2051 win = elm_widget_data_get(obj);
2053 ecore_evas_sticky_set(win->ee, sticky);
2054 #ifdef HAVE_ELEMENTARY_X
2055 _elm_win_xwin_update(win);
2060 * Get the sticky state of the window.
2062 * @param obj The window object
2063 * @return If true, the window's sticky state is enabled
2068 elm_win_sticky_get(const Evas_Object *obj)
2071 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2072 win = elm_widget_data_get(obj);
2073 if (!win) return EINA_FALSE;
2074 return ecore_evas_sticky_get(win->ee);
2078 * Sets the keyboard mode of the window.
2080 * @param obj The window object
2081 * @param mode The mode to set; one of:
2082 * ELM_WIN_KEYBOARD_UNKNOWN
2083 * ELM_WIN_KEYBOARD_OFF
2084 * ELM_WIN_KEYBOARD_ON
2085 * ELM_WIN_KEYBOARD_ALPHA
2086 * ELM_WIN_KEYBOARD_NUMERIC
2087 * ELM_WIN_KEYBOARD_PIN
2088 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2089 * ELM_WIN_KEYBOARD_HEX
2090 * ELM_WIN_KEYBOARD_TERMINAL
2091 * ELM_WIN_KEYBOARD_PASSWORD
2092 * ELM_WIN_KEYBOARD_IP
2093 * ELM_WIN_KEYBOARD_HOST
2094 * ELM_WIN_KEYBOARD_FILE
2095 * ELM_WIN_KEYBOARD_URL
2096 * ELM_WIN_KEYBOARD_KEYPAD
2097 * ELM_WIN_KEYBOARD_J2ME
2102 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2105 ELM_CHECK_WIDTYPE(obj, widtype);
2106 win = elm_widget_data_get(obj);
2108 if (mode == win->kbdmode) return;
2109 #ifdef HAVE_ELEMENTARY_X
2110 _elm_win_xwindow_get(win);
2112 win->kbdmode = mode;
2113 #ifdef HAVE_ELEMENTARY_X
2115 ecore_x_e_virtual_keyboard_state_set
2116 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2121 * Gets the keyboard mode of the window.
2123 * @param obj The window object
2124 * @return The mode; one of:
2125 * ELM_WIN_KEYBOARD_UNKNOWN
2126 * ELM_WIN_KEYBOARD_OFF
2127 * ELM_WIN_KEYBOARD_ON
2128 * ELM_WIN_KEYBOARD_ALPHA
2129 * ELM_WIN_KEYBOARD_NUMERIC
2130 * ELM_WIN_KEYBOARD_PIN
2131 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2132 * ELM_WIN_KEYBOARD_HEX
2133 * ELM_WIN_KEYBOARD_TERMINAL
2134 * ELM_WIN_KEYBOARD_PASSWORD
2135 * ELM_WIN_KEYBOARD_IP
2136 * ELM_WIN_KEYBOARD_HOST
2137 * ELM_WIN_KEYBOARD_FILE
2138 * ELM_WIN_KEYBOARD_URL
2139 * ELM_WIN_KEYBOARD_KEYPAD
2140 * ELM_WIN_KEYBOARD_J2ME
2144 EAPI Elm_Win_Keyboard_Mode
2145 elm_win_keyboard_mode_get(const Evas_Object *obj)
2148 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2149 win = elm_widget_data_get(obj);
2150 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2151 return win->kbdmode;
2155 * Sets whether the window is a keyboard.
2157 * @param obj The window object
2158 * @param is_keyboard If true, the window is a virtual keyboard
2163 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2166 ELM_CHECK_WIDTYPE(obj, widtype);
2167 win = elm_widget_data_get(obj);
2169 #ifdef HAVE_ELEMENTARY_X
2170 _elm_win_xwindow_get(win);
2172 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2177 * Gets whether the window is a keyboard.
2179 * @param obj The window object
2180 * @return If the window is a virtual keyboard
2185 elm_win_keyboard_win_get(const Evas_Object *obj)
2188 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2189 win = elm_widget_data_get(obj);
2190 if (!win) return EINA_FALSE;
2191 #ifdef HAVE_ELEMENTARY_X
2192 _elm_win_xwindow_get(win);
2194 return ecore_x_e_virtual_keyboard_get(win->xwin);
2200 * Get the screen position of a window.
2202 * @param obj The window object
2203 * @param x The int to store the x coordinate to
2204 * @param y The int to store the y coordinate to
2209 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2212 ELM_CHECK_WIDTYPE(obj, widtype);
2213 win = elm_widget_data_get(obj);
2215 if (x) *x = win->screen.x;
2216 if (y) *y = win->screen.y;
2220 * Set if this window is an illume conformant window
2222 * @param obj The window object
2223 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2228 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2231 ELM_CHECK_WIDTYPE(obj, widtype);
2232 win = elm_widget_data_get(obj);
2234 #ifdef HAVE_ELEMENTARY_X
2235 _elm_win_xwindow_get(win);
2237 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2242 * Get if this window is an illume conformant window
2244 * @param obj The window object
2245 * @return A boolean if this window is illume conformant or not
2250 elm_win_conformant_get(const Evas_Object *obj)
2253 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2254 win = elm_widget_data_get(obj);
2255 if (!win) return EINA_FALSE;
2256 #ifdef HAVE_ELEMENTARY_X
2257 _elm_win_xwindow_get(win);
2259 return ecore_x_e_illume_conformant_get(win->xwin);
2265 * Set a window to be an illume quickpanel window
2267 * By default window objects are not quickpanel windows.
2269 * @param obj The window object
2270 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2275 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2278 ELM_CHECK_WIDTYPE(obj, widtype);
2279 win = elm_widget_data_get(obj);
2281 #ifdef HAVE_ELEMENTARY_X
2282 _elm_win_xwindow_get(win);
2285 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2288 Ecore_X_Window_State states[2];
2290 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2291 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2292 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2293 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2300 * Get if this window is a quickpanel or not
2302 * @param obj The window object
2303 * @return A boolean if this window is a quickpanel or not
2308 elm_win_quickpanel_get(const Evas_Object *obj)
2311 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2312 win = elm_widget_data_get(obj);
2313 if (!win) return EINA_FALSE;
2314 #ifdef HAVE_ELEMENTARY_X
2315 _elm_win_xwindow_get(win);
2317 return ecore_x_e_illume_quickpanel_get(win->xwin);
2323 * Set the major priority of a quickpanel window
2325 * @param obj The window object
2326 * @param priority The major priority for this quickpanel
2331 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2334 ELM_CHECK_WIDTYPE(obj, widtype);
2335 win = elm_widget_data_get(obj);
2337 #ifdef HAVE_ELEMENTARY_X
2338 _elm_win_xwindow_get(win);
2340 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2345 * Get the major priority of a quickpanel window
2347 * @param obj The window object
2348 * @return The major priority of this quickpanel
2353 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2356 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2357 win = elm_widget_data_get(obj);
2358 if (!win) return -1;
2359 #ifdef HAVE_ELEMENTARY_X
2360 _elm_win_xwindow_get(win);
2362 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2368 * Set the minor priority of a quickpanel window
2370 * @param obj The window object
2371 * @param priority The minor priority for this quickpanel
2376 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2379 ELM_CHECK_WIDTYPE(obj, widtype);
2380 win = elm_widget_data_get(obj);
2382 #ifdef HAVE_ELEMENTARY_X
2383 _elm_win_xwindow_get(win);
2385 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2390 * Get the minor priority of a quickpanel window
2392 * @param obj The window object
2393 * @return The minor priority of this quickpanel
2398 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2401 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2402 win = elm_widget_data_get(obj);
2403 if (!win) return -1;
2404 #ifdef HAVE_ELEMENTARY_X
2405 _elm_win_xwindow_get(win);
2407 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2413 * Set which zone this quickpanel should appear in
2415 * @param obj The window object
2416 * @param zone The requested zone for this quickpanel
2421 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2424 ELM_CHECK_WIDTYPE(obj, widtype);
2425 win = elm_widget_data_get(obj);
2427 #ifdef HAVE_ELEMENTARY_X
2428 _elm_win_xwindow_get(win);
2430 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2435 * Get which zone this quickpanel should appear in
2437 * @param obj The window object
2438 * @return The requested zone for this quickpanel
2443 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2446 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2447 win = elm_widget_data_get(obj);
2449 #ifdef HAVE_ELEMENTARY_X
2450 _elm_win_xwindow_get(win);
2452 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2458 * Set the window to be skipped by keyboard focus
2460 * This sets the window to be skipped by normal keyboard input. This means
2461 * a window manager will be asked to not focus this window as well as omit
2462 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2464 * Call this and enable it on a window BEFORE you show it for the first time,
2465 * otherwise it may have no effect.
2467 * Use this for windows that have only output information or might only be
2468 * interacted with by the mouse or fingers, and never for typing input.
2469 * Be careful that this may have side-effects like making the window
2470 * non-accessible in some cases unless the window is specially handled. Use
2473 * @param obj The window object
2474 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2479 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2482 ELM_CHECK_WIDTYPE(obj, widtype);
2483 win = elm_widget_data_get(obj);
2485 #ifdef HAVE_ELEMENTARY_X
2486 _elm_win_xwindow_get(win);
2491 Ecore_X_Window_State states[2];
2493 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2494 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2495 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2496 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2503 * Send a command to the windowing environment
2505 * This is intended to work in touchscreen or small screen device environments
2506 * where there is a more simplistic window management policy in place. This
2507 * uses the window object indicated to select which part of the environment
2508 * to control (the part that this window lives in), and provides a command
2509 * and an optional parameter structure (use NULL for this if not needed).
2511 * @param obj The window object that lives in the environment to control
2512 * @param command The command to send
2513 * @param params Optional parameters for the command
2518 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2521 ELM_CHECK_WIDTYPE(obj, widtype);
2522 win = elm_widget_data_get(obj);
2524 #ifdef HAVE_ELEMENTARY_X
2525 _elm_win_xwindow_get(win);
2530 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2531 ecore_x_e_illume_focus_back_send(win->xwin);
2533 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2534 ecore_x_e_illume_focus_forward_send(win->xwin);
2536 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2537 ecore_x_e_illume_focus_home_send(win->xwin);
2539 case ELM_ILLUME_COMMAND_CLOSE:
2540 ecore_x_e_illume_close_send(win->xwin);
2550 * Get the inlined image object handle
2552 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2553 * then the window is in fact an evas image object inlined in the parent
2554 * canvas. You can get this object (be careful to not manipulate it as it
2555 * is under control of elementary), and use it to do things like get pixel
2556 * data, save the image to a file, etc.
2558 * @param obj The window object to get the inlined image from
2559 * @return The inlined image object, or NULL if none exists
2564 elm_win_inlined_image_object_get(Evas_Object *obj)
2567 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2568 win = elm_widget_data_get(obj);
2569 if (!win) return NULL;
2570 return win->img_obj;
2574 * Set the enabled status for the focus highlight in a window
2576 * This function will enable or disable the focus highlight only for the
2577 * given window, regardless of the global setting for it
2579 * @param obj The window where to enable the highlight
2580 * @param enabled The enabled value for the highlight
2585 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2589 ELM_CHECK_WIDTYPE(obj, widtype);
2591 win = elm_widget_data_get(obj);
2592 enabled = !!enabled;
2593 if (win->focus_highlight.enabled == enabled)
2596 win->focus_highlight.enabled = enabled;
2598 if (win->focus_highlight.enabled)
2599 _elm_win_focus_highlight_init(win);
2601 _elm_win_focus_highlight_shutdown(win);
2605 * Get the enabled value of the focus highlight for this window
2607 * @param obj The window in which to check if the focus highlight is enabled
2609 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2614 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2618 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2620 win = elm_widget_data_get(obj);
2621 return win->focus_highlight.enabled;
2625 * Set the style for the focus highlight on this window
2627 * Sets the style to use for theming the highlight of focused objects on
2628 * the given window. If @p style is NULL, the default will be used.
2630 * @param obj The window where to set the style
2631 * @param style The style to set
2636 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2640 ELM_CHECK_WIDTYPE(obj, widtype);
2642 win = elm_widget_data_get(obj);
2643 eina_stringshare_replace(&win->focus_highlight.style, style);
2644 win->focus_highlight.changed_theme = EINA_TRUE;
2645 _elm_win_focus_highlight_reconfigure_job_start(win);
2649 * Get the style set for the focus highlight object
2651 * Gets the style set for this windows highilght object, or NULL if none
2654 * @param obj The window to retrieve the highlights style from
2656 * @return The style set or NULL if none was. Default is used in that case.
2661 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2665 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2667 win = elm_widget_data_get(obj);
2668 return win->focus_highlight.style;
2671 typedef struct _Widget_Data Widget_Data;
2676 Evas_Object *content;
2679 static void _del_hook(Evas_Object *obj);
2680 static void _theme_hook(Evas_Object *obj);
2681 static void _sizing_eval(Evas_Object *obj);
2682 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2683 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2685 static const char *widtype2 = NULL;
2688 _del_hook(Evas_Object *obj)
2690 Widget_Data *wd = elm_widget_data_get(obj);
2696 _theme_hook(Evas_Object *obj)
2698 Widget_Data *wd = elm_widget_data_get(obj);
2699 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2701 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2706 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2708 Widget_Data *wd = elm_widget_data_get(obj);
2713 /* Try Focus cycle in subitem */
2716 elm_widget_focus_next_get(wd->content, dir, next);
2721 *next = (Evas_Object *)obj;
2726 _sizing_eval(Evas_Object *obj)
2728 Widget_Data *wd = elm_widget_data_get(obj);
2729 Evas_Coord minw = -1, minh = -1;
2731 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2732 edje_object_size_min_calc(wd->frm, &minw, &minh);
2733 evas_object_size_hint_min_set(obj, minw, minh);
2734 evas_object_size_hint_max_set(obj, -1, -1);
2738 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2744 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2746 Widget_Data *wd = elm_widget_data_get(obj);
2747 Evas_Object *sub = event_info;
2748 if (sub == wd->content)
2750 evas_object_event_callback_del_full
2751 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2758 * @defgroup Inwin Inwin
2760 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2763 elm_win_inwin_add(Evas_Object *obj)
2769 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2770 win = elm_widget_data_get(obj);
2771 if (!win) return NULL;
2772 wd = ELM_NEW(Widget_Data);
2773 obj2 = elm_widget_add(win->evas);
2774 elm_widget_type_set(obj2, "inwin");
2775 ELM_SET_WIDTYPE(widtype2, "inwin");
2776 elm_widget_sub_object_add(obj, obj2);
2777 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2778 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2779 elm_win_resize_object_add(obj, obj2);
2781 elm_widget_data_set(obj2, wd);
2782 elm_widget_del_hook_set(obj2, _del_hook);
2783 elm_widget_theme_hook_set(obj2, _theme_hook);
2784 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2785 elm_widget_can_focus_set(obj2, EINA_TRUE);
2786 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2788 wd->frm = edje_object_add(win->evas);
2789 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2790 elm_widget_resize_object_set(obj2, wd->frm);
2792 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2799 * Activates an inwin object
2801 * @param obj The inwin to activate
2806 elm_win_inwin_activate(Evas_Object *obj)
2808 ELM_CHECK_WIDTYPE(obj, widtype2);
2809 Widget_Data *wd = elm_widget_data_get(obj);
2811 evas_object_raise(obj);
2812 evas_object_show(obj);
2813 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2814 elm_object_focus(obj);
2818 * Set the content of an inwin object.
2820 * Once the content object is set, a previously set one will be deleted.
2821 * If you want to keep that old content object, use the
2822 * elm_win_inwin_content_unset() function.
2824 * @param obj The inwin object
2825 * @param content The object to set as content
2830 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2832 ELM_CHECK_WIDTYPE(obj, widtype2);
2833 Widget_Data *wd = elm_widget_data_get(obj);
2835 if (wd->content == content) return;
2836 if (wd->content) evas_object_del(wd->content);
2837 wd->content = content;
2840 elm_widget_sub_object_add(obj, content);
2841 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2842 _changed_size_hints, obj);
2843 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2849 * Get the content of an inwin object.
2851 * Return the content object which is set for this widget.
2853 * @param obj The inwin object
2854 * @return The content that is being used
2859 elm_win_inwin_content_get(const Evas_Object *obj)
2861 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2862 Widget_Data *wd = elm_widget_data_get(obj);
2863 if (!wd) return NULL;
2868 * Unset the content of an inwin object.
2870 * Unparent and return the content object which was set for this widget.
2872 * @param obj The inwin object
2873 * @return The content that was being used
2878 elm_win_inwin_content_unset(Evas_Object *obj)
2880 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2881 Widget_Data *wd = elm_widget_data_get(obj);
2882 if (!wd) return NULL;
2883 if (!wd->content) return NULL;
2884 Evas_Object *content = wd->content;
2885 elm_widget_sub_object_del(obj, wd->content);
2886 edje_object_part_unswallow(wd->frm, wd->content);
2891 /* windowing spcific calls - shall we do this differently? */
2893 static Ecore_X_Window
2894 _elm_ee_win_get(const Evas_Object *obj)
2897 #ifdef HAVE_ELEMENTARY_X
2898 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2899 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2905 * Get the Ecore_X_Window of an Evas_Object
2907 * @param obj The object
2909 * @return The Ecore_X_Window of @p obj
2914 elm_win_xwindow_get(const Evas_Object *obj)
2916 Ecore_X_Window xwin = 0;
2921 type = elm_widget_type_get(obj);
2922 if (!type) return 0;
2923 if (type != widtype) return _elm_ee_win_get(obj);
2924 #ifdef HAVE_ELEMENTARY_X
2925 win = elm_widget_data_get(obj);
2926 if (!win) return xwin;
2927 if (win->xwin) return win->xwin;
2928 if (win->parent) return elm_win_xwindow_get(win->parent);