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)
348 if ((x != win->screen.x) || (y != win->screen.y))
352 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
357 evas_object_move(obj, x, y);
362 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
365 // this is called to make sure all smart containers have calculated their
366 // sizes BEFORE we show the window to make sure it initially appears at
367 // our desired size (ie min size is known first)
368 evas_smart_objects_calculate(evas_object_evas_get(obj));
369 evas_object_show(obj);
373 else if (win->img_obj)
375 evas_object_show(win->img_obj);
380 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
384 if (ecore_evas_override_get(win->ee))
388 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
391 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
396 else if (win->img_obj)
400 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
403 // evas_object_move(win->img_obj, x, y);
408 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
415 else if (win->img_obj)
417 Evas_Coord w = 1, h = 1;
419 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
422 evas_object_image_size_set(win->img_obj, w, h);
427 _elm_win_delete_request(Ecore_Evas *ee)
429 Evas_Object *obj = ecore_evas_object_associate_get(ee);
431 if (strcmp(elm_widget_type_get(obj), "win")) return;
433 win = elm_widget_data_get(obj);
435 int autodel = win->autodel;
436 win->autodel_clear = &autodel;
437 evas_object_smart_callback_call(win->win_obj, "delete-request", NULL); // FIXME: remove me
438 evas_object_smart_callback_call(win->win_obj, "delete,request", NULL);
439 // FIXME: if above callback deletes - then the below will be invalid
440 if (autodel) evas_object_del(win->win_obj);
441 else win->autodel_clear = NULL;
445 _elm_win_resize_job(void *data)
452 win->deferred_resize_job = NULL;
453 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
454 evas_object_resize(win->win_obj, w, h);
458 else if (win->img_obj)
461 EINA_LIST_FOREACH(win->subobjs, l, obj)
463 evas_object_move(obj, 0, 0);
464 evas_object_resize(obj, w, h);
468 #ifdef HAVE_ELEMENTARY_X
470 _elm_win_xwindow_get(Elm_Win *win)
474 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
475 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
477 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
479 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
480 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
481 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
482 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
483 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
484 ENGINE_COMPARE(ELM_OPENGL_SDL))
487 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
489 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
491 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
493 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
495 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
497 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
499 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
501 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
503 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
505 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
507 #undef ENGINE_COMPARE
511 #ifdef HAVE_ELEMENTARY_X
513 _elm_win_xwin_update(Elm_Win *win)
515 _elm_win_xwindow_get(win);
520 win2 = elm_widget_data_get(win->parent);
524 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
528 if (!win->xwin) return; /* nothing more to do */
533 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
535 case ELM_WIN_DIALOG_BASIC:
536 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
538 case ELM_WIN_DESKTOP:
539 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
542 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
544 case ELM_WIN_TOOLBAR:
545 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
548 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
550 case ELM_WIN_UTILITY:
551 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
554 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
556 case ELM_WIN_DROPDOWN_MENU:
557 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
559 case ELM_WIN_POPUP_MENU:
560 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
562 case ELM_WIN_TOOLTIP:
563 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
565 case ELM_WIN_NOTIFICATION:
566 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
569 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
572 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
577 ecore_x_e_virtual_keyboard_state_set
578 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
583 _elm_win_eval_subobjs(Evas_Object *obj)
586 const Evas_Object *child;
588 Elm_Win *win = elm_widget_data_get(obj);
589 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
593 EINA_LIST_FOREACH(win->subobjs, l, child)
595 evas_object_size_hint_weight_get(child, &wx, &wy);
596 if (wx == 0.0) xx = 0;
597 if (wy == 0.0) xy = 0;
599 evas_object_size_hint_min_get(child, &w, &h);
602 if (w > minw) minw = w;
603 if (h > minh) minh = h;
605 evas_object_size_hint_max_get(child, &w, &h);
608 if (maxw == -1) maxw = w;
609 else if ((w > 0) && (w < maxw)) maxw = w;
610 if (maxh == -1) maxh = h;
611 else if ((h > 0) && (h < maxh)) maxh = h;
613 if (!xx) maxw = minw;
615 if (!xy) maxh = minh;
617 evas_object_size_hint_min_set(obj, minw, minh);
618 evas_object_size_hint_max_set(obj, maxw, maxh);
619 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
620 if (w < minw) w = minw;
621 if (h < minh) h = minh;
622 if ((maxw >= 0) && (w > maxw)) w = maxw;
623 if ((maxh >= 0) && (h > maxh)) h = maxh;
624 evas_object_resize(obj, w, h);
628 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
630 Elm_Win *win = elm_widget_data_get(data);
631 win->subobjs = eina_list_remove(win->subobjs, obj);
632 _elm_win_eval_subobjs(win->win_obj);
636 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
638 _elm_win_eval_subobjs(data);
642 _elm_win_shutdown(void)
644 while (_elm_win_list)
645 evas_object_del(_elm_win_list->data);
649 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
656 EINA_LIST_FOREACH(_elm_win_list, l, obj)
657 elm_widget_theme(obj);
661 EINA_LIST_FOREACH(_elm_win_list, l, obj)
662 elm_widget_theme_specific(obj, th, EINA_FALSE);
666 #ifdef HAVE_ELEMENTARY_X
668 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
671 Ecore_X_Event_Client_Message *e = event;
673 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
674 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
676 if ((unsigned)e->data.l[0] == win->xwin)
678 Evas *evas = evas_object_evas_get(win->win_obj);
681 edje_file_cache_flush();
682 edje_collection_cache_flush();
683 evas_image_cache_flush(evas);
684 evas_font_cache_flush(evas);
688 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
690 if ((unsigned)e->data.l[0] == win->xwin)
692 Evas *evas = evas_object_evas_get(win->win_obj);
695 edje_file_cache_flush();
696 edje_collection_cache_flush();
697 evas_image_cache_flush(evas);
698 evas_font_cache_flush(evas);
699 evas_render_dump(evas);
703 return ECORE_CALLBACK_PASS_ON;
708 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
712 win->focus_highlight.geometry_changed = EINA_TRUE;
713 _elm_win_focus_highlight_reconfigure_job_start(win);
717 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
721 win->focus_highlight.geometry_changed = EINA_TRUE;
722 _elm_win_focus_highlight_reconfigure_job_start(win);
726 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
730 win->focus_highlight.cur.target = NULL;
732 _elm_win_focus_highlight_reconfigure_job_start(win);
736 _elm_win_focus_target_callbacks_add(Elm_Win *win)
738 Evas_Object *obj = win->focus_highlight.cur.target;
740 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
741 _elm_win_focus_target_move, win);
742 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
743 _elm_win_focus_target_resize, win);
744 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
745 _elm_win_focus_target_del, win);
749 _elm_win_focus_target_callbacks_del(Elm_Win *win)
751 Evas_Object *obj = win->focus_highlight.cur.target;
753 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
754 _elm_win_focus_target_move, win);
755 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
756 _elm_win_focus_target_resize, win);
757 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
758 _elm_win_focus_target_del, win);
762 _elm_win_focus_target_get(Evas_Object *obj)
764 Evas_Object *o = obj;
768 if (elm_widget_is(o))
770 if (!elm_widget_highlight_ignore_get(o))
772 o = elm_widget_parent_get(o);
774 o = evas_object_smart_parent_get(o);
778 o = elm_widget_parent_widget_get(o);
780 o = evas_object_smart_parent_get(o);
789 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
791 Evas_Object *obj = event_info, *target;
794 if (win->focus_highlight.cur.target == obj)
797 target = _elm_win_focus_target_get(obj);
798 win->focus_highlight.cur.target = target;
799 if (elm_widget_highlight_in_theme_get(target))
800 win->focus_highlight.cur.handled = EINA_TRUE;
802 _elm_win_focus_target_callbacks_add(win);
804 _elm_win_focus_highlight_reconfigure_job_start(win);
808 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
812 if (!win->focus_highlight.cur.target)
815 if (!win->focus_highlight.cur.handled)
816 _elm_win_focus_target_callbacks_del(win);
817 win->focus_highlight.cur.target = NULL;
818 win->focus_highlight.cur.handled = EINA_FALSE;
820 _elm_win_focus_highlight_reconfigure_job_start(win);
824 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
826 evas_object_hide(obj);
830 _elm_win_focus_highlight_init(Elm_Win *win)
832 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
833 _elm_win_object_focus_in, win);
834 evas_event_callback_add(win->evas,
835 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
836 _elm_win_object_focus_out, win);
838 win->focus_highlight.cur.target = evas_focus_get(win->evas);
840 win->focus_highlight.top = edje_object_add(win->evas);
841 win->focus_highlight.changed_theme = EINA_TRUE;
842 edje_object_signal_callback_add(win->focus_highlight.top,
843 "elm,action,focus,hide,end", "",
844 _elm_win_focus_highlight_hide, NULL);
845 edje_object_signal_callback_add(win->focus_highlight.top,
846 "elm,action,focus,anim,end", "",
847 _elm_win_focus_highlight_anim_end, win);
848 _elm_win_focus_highlight_reconfigure_job_start(win);
852 _elm_win_focus_highlight_shutdown(Elm_Win *win)
854 _elm_win_focus_highlight_reconfigure_job_stop(win);
855 if (win->focus_highlight.cur.target)
857 _elm_win_focus_target_callbacks_del(win);
858 win->focus_highlight.cur.target = NULL;
860 if (win->focus_highlight.top)
862 evas_object_del(win->focus_highlight.top);
863 win->focus_highlight.top = NULL;
866 evas_event_callback_del_full(win->evas,
867 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
868 _elm_win_object_focus_in, win);
869 evas_event_callback_del_full(win->evas,
870 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
871 _elm_win_object_focus_out, win);
875 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
879 top = win->focus_highlight.top;
884 evas_object_show(top);
885 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
891 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
896 _elm_win_focus_highlight_reconfigure_job(void *data)
898 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
902 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
904 if (win->focus_highlight.reconf_job)
905 ecore_job_del(win->focus_highlight.reconf_job);
906 win->focus_highlight.reconf_job = ecore_job_add(
907 _elm_win_focus_highlight_reconfigure_job, win);
911 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
913 if (win->focus_highlight.reconf_job)
914 ecore_job_del(win->focus_highlight.reconf_job);
915 win->focus_highlight.reconf_job = NULL;
919 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
921 Evas_Object *clip, *target = win->focus_highlight.cur.target;
922 Evas_Coord x, y, w, h;
924 clip = evas_object_clip_get(target);
925 evas_object_geometry_get(target, &x, &y, &w, &h);
927 evas_object_move(obj, x, y);
928 evas_object_resize(obj, w, h);
929 evas_object_clip_set(obj, clip);
933 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
935 Evas_Coord tx, ty, tw, th;
936 Evas_Coord w, h, px, py, pw, ph;
937 Edje_Message_Int_Set *m;
938 Evas_Object *previous = win->focus_highlight.prev.target;
939 Evas_Object *target = win->focus_highlight.cur.target;
941 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
942 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
943 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
944 evas_object_move(obj, 0, 0);
945 evas_object_resize(obj, tw, th);
946 evas_object_clip_unset(obj);
948 m = alloca(sizeof(*m) + (sizeof(int) * 8));
958 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
962 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
965 _elm_win_focus_highlight_simple_setup(win, obj);
969 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
971 Evas_Object *target = win->focus_highlight.cur.target;
972 Evas_Object *previous = win->focus_highlight.prev.target;
973 Evas_Object *top = win->focus_highlight.top;
974 Eina_Bool visible_changed;
975 Eina_Bool common_visible;
976 const char *sig = NULL;
978 _elm_win_focus_highlight_reconfigure_job_stop(win);
980 visible_changed = (win->focus_highlight.cur.visible !=
981 win->focus_highlight.prev.visible);
983 if ((target == previous) && (!visible_changed) &&
984 (!win->focus_highlight.geometry_changed))
987 if ((previous) && (win->focus_highlight.prev.handled))
988 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
991 common_visible = EINA_FALSE;
992 else if (win->focus_highlight.cur.handled)
994 common_visible = EINA_FALSE;
995 if (win->focus_highlight.cur.visible)
996 sig = "elm,action,focus_highlight,show";
998 sig = "elm,action,focus_highlight,hide";
1001 common_visible = win->focus_highlight.cur.visible;
1003 _elm_win_focus_highlight_visible_set(win, common_visible);
1005 elm_widget_signal_emit(target, sig, "elm");
1007 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1010 if (win->focus_highlight.changed_theme)
1013 if (win->focus_highlight.style)
1014 str = win->focus_highlight.style;
1017 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1019 win->focus_highlight.changed_theme = EINA_FALSE;
1021 if (_elm_config->focus_highlight_animate)
1023 str = edje_object_data_get(win->focus_highlight.top, "animate");
1024 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1028 if ((win->focus_highlight.top_animate) && (previous) &&
1029 (!win->focus_highlight.prev.handled))
1030 _elm_win_focus_highlight_anim_setup(win, top);
1032 _elm_win_focus_highlight_simple_setup(win, top);
1033 evas_object_raise(top);
1036 win->focus_highlight.geometry_changed = EINA_FALSE;
1037 win->focus_highlight.prev = win->focus_highlight.cur;
1042 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1044 Evas_Event_Key_Down *ev = event_info;
1046 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1050 if ((strcmp(ev->keyname, "F12")) ||
1051 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1054 printf("Tree graph generated.\n");
1055 elm_object_tree_dot_dump(obj, "./dump.dot");
1060 _win_img_hide(void *data,
1062 Evas_Object *obj __UNUSED__,
1063 void *event_info __UNUSED__)
1065 Elm_Win *win = data;
1067 elm_widget_focus_hide_handle(win->win_obj);
1071 _win_img_mouse_down(void *data,
1073 Evas_Object *obj __UNUSED__,
1074 void *event_info __UNUSED__)
1076 Elm_Win *win = data;
1077 elm_widget_focus_mouse_down_handle(win->win_obj);
1081 _win_img_focus_in(void *data,
1083 Evas_Object *obj __UNUSED__,
1084 void *event_info __UNUSED__)
1086 Elm_Win *win = data;
1087 elm_widget_focus_steal(win->win_obj);
1091 _win_img_focus_out(void *data,
1093 Evas_Object *obj __UNUSED__,
1094 void *event_info __UNUSED__)
1096 Elm_Win *win = data;
1097 elm_widget_focused_object_clear(win->win_obj);
1101 _win_inlined_image_set(Elm_Win *win)
1103 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1104 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1105 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1106 _elm_win_obj_callback_img_obj_del, win);
1108 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1109 _win_img_hide, win);
1110 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1111 _win_img_mouse_down, win);
1112 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1113 _win_img_focus_in, win);
1114 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1115 _win_img_focus_out, win);
1119 * Adds a window object. If this is the first window created, pass NULL as
1122 * @param parent Parent object to add the window to, or NULL
1123 * @param name The name of the window
1124 * @param type The window type, one of the following:
1126 * ELM_WIN_DIALOG_BASIC
1134 * @return The created object, or NULL on failure
1139 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1143 const char *fontpath;
1145 win = ELM_NEW(Elm_Win);
1147 #define FALLBACK_TRY(engine) \
1150 CRITICAL(engine " engine creation failed. Trying software X11."); \
1151 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1153 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
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;
1187 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1189 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1190 #ifdef HAVE_ELEMENTARY_X
1191 win->client_message_handler = ecore_event_handler_add
1192 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1195 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1197 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1198 FALLBACK_TRY("Sofware FB");
1200 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1202 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1203 FALLBACK_TRY("Sofware DirectFB");
1205 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1207 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1208 FALLBACK_TRY("Sofware-16");
1209 #ifdef HAVE_ELEMENTARY_X
1210 win->client_message_handler = ecore_event_handler_add
1211 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1214 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1216 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1217 FALLBACK_TRY("Sofware-8");
1218 #ifdef HAVE_ELEMENTARY_X
1219 win->client_message_handler = ecore_event_handler_add
1220 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1223 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1225 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1226 FALLBACK_TRY("XRender");
1227 #ifdef HAVE_ELEMENTARY_X
1228 win->client_message_handler = ecore_event_handler_add
1229 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1232 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1234 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1235 FALLBACK_TRY("OpenGL");
1236 #ifdef HAVE_ELEMENTARY_X
1237 win->client_message_handler = ecore_event_handler_add
1238 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1241 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1243 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1244 FALLBACK_TRY("Sofware Win32");
1246 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1248 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1249 FALLBACK_TRY("Sofware-16-WinCE");
1251 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1253 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1254 FALLBACK_TRY("Sofware SDL");
1256 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1258 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1259 FALLBACK_TRY("Sofware-16-SDL");
1261 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1263 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1264 FALLBACK_TRY("OpenGL SDL");
1272 ERR("Cannot create window.");
1276 #ifdef HAVE_ELEMENTARY_X
1277 _elm_win_xwindow_get(win);
1279 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1280 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1281 // bg pixmap done by x - has other issues like can be redrawn by x before it
1282 // is filled/ready by app
1283 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1286 win->parent = parent;
1288 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1289 _elm_win_obj_callback_parent_del, win);
1291 win->evas = ecore_evas_get(win->ee);
1292 win->win_obj = elm_widget_add(win->evas);
1293 elm_widget_type_set(win->win_obj, "win");
1294 ELM_SET_WIDTYPE(widtype, "win");
1295 elm_widget_data_set(win->win_obj, win);
1296 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1297 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1298 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1299 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1300 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1301 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1302 evas_object_move(win->win_obj, 0, 0);
1303 evas_object_resize(win->win_obj, 1, 1);
1304 evas_object_layer_set(win->win_obj, 50);
1305 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1307 ecore_evas_object_associate(win->ee, win->win_obj,
1308 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1309 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1310 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1311 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1312 _elm_win_obj_callback_show, win);
1313 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1314 _elm_win_obj_callback_hide, win);
1315 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1316 _elm_win_obj_callback_del, win);
1317 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1318 _elm_win_obj_callback_move, win);
1319 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1320 _elm_win_obj_callback_resize, win);
1322 evas_object_intercept_move_callback_add(win->win_obj,
1323 _elm_win_obj_intercept_move, win);
1324 evas_object_intercept_show_callback_add(win->win_obj,
1325 _elm_win_obj_intercept_show, win);
1327 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1328 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1329 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1330 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1331 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1332 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1333 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1334 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1335 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1336 evas_font_path_append(win->evas, fontpath);
1337 if (!_elm_config->font_hinting)
1338 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1339 else if (_elm_config->font_hinting == 1)
1340 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1341 else if (_elm_config->font_hinting == 2)
1342 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1344 #ifdef HAVE_ELEMENTARY_X
1345 _elm_win_xwin_update(win);
1348 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1350 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1352 ecore_evas_fullscreen_set(win->ee, 1);
1354 #undef ENGINE_COMPARE
1356 if (_elm_config->focus_highlight_enable)
1357 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1360 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1361 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1362 _debug_key_down, win);
1364 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1366 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1368 return win->win_obj;
1372 * Add @p subobj as a resize object of window @p obj.
1374 * @param obj The window object
1375 * @param subobj The resize object to add
1380 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1384 ELM_CHECK_WIDTYPE(obj, widtype);
1385 win = elm_widget_data_get(obj);
1387 win->subobjs = eina_list_append(win->subobjs, subobj);
1388 elm_widget_sub_object_add(obj, subobj);
1389 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1390 _elm_win_subobj_callback_del, obj);
1391 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1392 _elm_win_subobj_callback_changed_size_hints,
1394 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1395 evas_object_move(subobj, 0, 0);
1396 evas_object_resize(subobj, w, h);
1397 _elm_win_eval_subobjs(obj);
1401 * Delete @p subobj as a resize object of window @p obj.
1403 * @param obj The window object
1404 * @param subobj The resize object to add
1409 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1412 ELM_CHECK_WIDTYPE(obj, widtype);
1413 win = elm_widget_data_get(obj);
1415 evas_object_event_callback_del_full(subobj,
1416 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1417 _elm_win_subobj_callback_changed_size_hints,
1419 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1420 _elm_win_subobj_callback_del, obj);
1421 win->subobjs = eina_list_remove(win->subobjs, subobj);
1422 elm_widget_sub_object_del(obj, subobj);
1423 _elm_win_eval_subobjs(obj);
1427 * Set the title of the window
1429 * @param obj The window object
1430 * @param title The title to set
1435 elm_win_title_set(Evas_Object *obj, const char *title)
1438 ELM_CHECK_WIDTYPE(obj, widtype);
1439 win = elm_widget_data_get(obj);
1441 ecore_evas_title_set(win->ee, title);
1445 * Get the title of the window
1447 * @param obj The window object
1453 elm_win_title_get(const Evas_Object *obj)
1456 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1457 win = elm_widget_data_get(obj);
1458 if (!win) return NULL;
1459 return ecore_evas_title_get(win->ee);
1463 * Set the window's autodel state.
1465 * @param obj The window object
1466 * @param autodel If true, the window will automatically delete itself when closed
1471 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1474 ELM_CHECK_WIDTYPE(obj, widtype);
1475 win = elm_widget_data_get(obj);
1477 win->autodel = autodel;
1481 * Get the window's autodel state.
1483 * @param obj The window object
1484 * @return If the window will automatically delete itself when closed
1489 elm_win_autodel_get(const Evas_Object *obj)
1492 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1493 win = elm_widget_data_get(obj);
1494 if (!win) return EINA_FALSE;
1495 return win->autodel;
1499 * Activate a window object.
1501 * @param obj The window object
1506 elm_win_activate(Evas_Object *obj)
1509 ELM_CHECK_WIDTYPE(obj, widtype);
1510 win = elm_widget_data_get(obj);
1512 ecore_evas_activate(win->ee);
1516 * Lower a window object.
1518 * @param obj The window object
1523 elm_win_lower(Evas_Object *obj)
1526 ELM_CHECK_WIDTYPE(obj, widtype);
1527 win = elm_widget_data_get(obj);
1529 ecore_evas_lower(win->ee);
1533 * Raise a window object.
1535 * @param obj The window object
1540 elm_win_raise(Evas_Object *obj)
1543 ELM_CHECK_WIDTYPE(obj, widtype);
1544 win = elm_widget_data_get(obj);
1546 ecore_evas_raise(win->ee);
1550 * Set the borderless state of a window.
1552 * @param obj The window object
1553 * @param borderless If true, the window is borderless
1558 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1561 ELM_CHECK_WIDTYPE(obj, widtype);
1562 win = elm_widget_data_get(obj);
1564 ecore_evas_borderless_set(win->ee, borderless);
1565 #ifdef HAVE_ELEMENTARY_X
1566 _elm_win_xwin_update(win);
1571 * Get the borderless state of a window.
1573 * @param obj The window object
1574 * @return If true, the window is borderless
1579 elm_win_borderless_get(const Evas_Object *obj)
1582 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1583 win = elm_widget_data_get(obj);
1584 if (!win) return EINA_FALSE;
1585 return ecore_evas_borderless_get(win->ee);
1589 * Set the shaped state of a window.
1591 * @param obj The window object
1592 * @param shaped If true, the window is shaped
1597 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1600 ELM_CHECK_WIDTYPE(obj, widtype);
1601 win = elm_widget_data_get(obj);
1603 ecore_evas_shaped_set(win->ee, shaped);
1604 #ifdef HAVE_ELEMENTARY_X
1605 _elm_win_xwin_update(win);
1610 * Get the shaped state of a window.
1612 * @param obj The window object
1613 * @return If true, the window is shaped
1618 elm_win_shaped_get(const Evas_Object *obj)
1621 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1622 win = elm_widget_data_get(obj);
1623 if (!win) return EINA_FALSE;
1624 return ecore_evas_shaped_get(win->ee);
1628 * Set the alpha channel state of a window.
1630 * @param obj The window object
1631 * @param alpha If true, the window has an alpha channel
1636 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1639 ELM_CHECK_WIDTYPE(obj, widtype);
1640 win = elm_widget_data_get(obj);
1645 else if (win->img_obj)
1647 evas_object_image_alpha_set(win->img_obj, alpha);
1651 #ifdef HAVE_ELEMENTARY_X
1656 if (!_elm_config->compositing)
1657 elm_win_shaped_set(obj, alpha);
1659 ecore_evas_alpha_set(win->ee, alpha);
1662 ecore_evas_alpha_set(win->ee, alpha);
1663 _elm_win_xwin_update(win);
1667 ecore_evas_alpha_set(win->ee, alpha);
1672 * Get the alpha channel state of a window.
1674 * @param obj The window object
1675 * @return If true, the window has an alpha channel
1680 elm_win_alpha_get(const Evas_Object *obj)
1683 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1684 win = elm_widget_data_get(obj);
1685 if (!win) return EINA_FALSE;
1686 return ecore_evas_alpha_get(win->ee);
1690 * Set the transparency state of a window.
1692 * @param obj The window object
1693 * @param transparent If true, the window is transparent
1698 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1701 ELM_CHECK_WIDTYPE(obj, widtype);
1702 win = elm_widget_data_get(obj);
1708 else if (win->img_obj)
1710 evas_object_image_alpha_set(win->img_obj, transparent);
1714 #ifdef HAVE_ELEMENTARY_X
1717 ecore_evas_transparent_set(win->ee, transparent);
1718 _elm_win_xwin_update(win);
1722 ecore_evas_transparent_set(win->ee, transparent);
1727 * Get the transparency state of a window.
1729 * @param obj The window object
1730 * @return If true, the window is transparent
1735 elm_win_transparent_get(const Evas_Object *obj)
1738 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1739 win = elm_widget_data_get(obj);
1740 if (!win) return EINA_FALSE;
1742 return ecore_evas_transparent_get(win->ee);
1746 * Set the override state of a window.
1748 * @param obj The window object
1749 * @param override If true, the window is overridden
1754 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1757 ELM_CHECK_WIDTYPE(obj, widtype);
1758 win = elm_widget_data_get(obj);
1760 ecore_evas_override_set(win->ee, override);
1761 #ifdef HAVE_ELEMENTARY_X
1762 _elm_win_xwin_update(win);
1767 * Get the override state of a window.
1769 * @param obj The window object
1770 * @return If true, the window is overridden
1775 elm_win_override_get(const Evas_Object *obj)
1778 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1779 win = elm_widget_data_get(obj);
1780 if (!win) return EINA_FALSE;
1781 return ecore_evas_override_get(win->ee);
1785 * Set the fullscreen state of a window.
1787 * @param obj The window object
1788 * @param fullscreen If true, the window is fullscreen
1793 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1796 ELM_CHECK_WIDTYPE(obj, widtype);
1797 win = elm_widget_data_get(obj);
1800 // YYY: handle if win->img_obj
1801 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1802 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1803 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1805 // these engines... can ONLY be fullscreen
1810 ecore_evas_fullscreen_set(win->ee, fullscreen);
1811 #ifdef HAVE_ELEMENTARY_X
1812 _elm_win_xwin_update(win);
1815 #undef ENGINE_COMPARE
1819 * Get the fullscreen state of a window.
1821 * @param obj The window object
1822 * @return If true, the window is fullscreen
1827 elm_win_fullscreen_get(const Evas_Object *obj)
1830 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1831 win = elm_widget_data_get(obj);
1832 if (!win) return EINA_FALSE;
1834 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1835 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1836 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1838 // these engines... can ONLY be fullscreen
1843 return ecore_evas_fullscreen_get(win->ee);
1845 #undef ENGINE_COMPARE
1849 * Set the maximized state of a window.
1851 * @param obj The window object
1852 * @param maximized If true, the window is maximized
1857 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1860 ELM_CHECK_WIDTYPE(obj, widtype);
1861 win = elm_widget_data_get(obj);
1863 // YYY: handle if win->img_obj
1864 ecore_evas_maximized_set(win->ee, maximized);
1865 #ifdef HAVE_ELEMENTARY_X
1866 _elm_win_xwin_update(win);
1871 * Get the maximized state of a window.
1873 * @param obj The window object
1874 * @return If true, the window is maximized
1879 elm_win_maximized_get(const Evas_Object *obj)
1882 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1883 win = elm_widget_data_get(obj);
1884 if (!win) return EINA_FALSE;
1885 return ecore_evas_maximized_get(win->ee);
1889 * Set the iconified state of a window.
1891 * @param obj The window object
1892 * @param iconified If true, the window is iconified
1897 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1900 ELM_CHECK_WIDTYPE(obj, widtype);
1901 win = elm_widget_data_get(obj);
1903 ecore_evas_iconified_set(win->ee, iconified);
1904 #ifdef HAVE_ELEMENTARY_X
1905 _elm_win_xwin_update(win);
1910 * Get the iconified state of a window.
1912 * @param obj The window object
1913 * @return If true, the window is iconified
1918 elm_win_iconified_get(const Evas_Object *obj)
1921 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1922 win = elm_widget_data_get(obj);
1923 if (!win) return EINA_FALSE;
1924 return ecore_evas_iconified_get(win->ee);
1928 * Set the layer of the window.
1930 * @param obj The window object
1931 * @param layer The layer of the window
1936 elm_win_layer_set(Evas_Object *obj, int layer)
1939 ELM_CHECK_WIDTYPE(obj, widtype);
1940 win = elm_widget_data_get(obj);
1942 ecore_evas_layer_set(win->ee, layer);
1943 #ifdef HAVE_ELEMENTARY_X
1944 _elm_win_xwin_update(win);
1949 * Get the layer of the window.
1951 * @param obj The window object
1952 * @return The layer of the window
1957 elm_win_layer_get(const Evas_Object *obj)
1960 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1961 win = elm_widget_data_get(obj);
1962 if (!win) return -1;
1963 return ecore_evas_layer_get(win->ee);
1967 * Set the rotation of the window.
1969 * @param obj The window object
1970 * @param rotation The rotation of the window, in degrees (0-360)
1975 elm_win_rotation_set(Evas_Object *obj, int rotation)
1978 ELM_CHECK_WIDTYPE(obj, widtype);
1979 win = elm_widget_data_get(obj);
1981 if (win->rot == rotation) return;
1982 win->rot = rotation;
1983 ecore_evas_rotation_set(win->ee, rotation);
1984 evas_object_size_hint_min_set(obj, -1, -1);
1985 evas_object_size_hint_max_set(obj, -1, -1);
1986 _elm_win_eval_subobjs(obj);
1987 #ifdef HAVE_ELEMENTARY_X
1988 _elm_win_xwin_update(win);
1993 * Rotates the window and resizes it
1995 * @param obj The window object
1996 * @param layer The rotation of the window in degrees (0-360)
2001 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2004 ELM_CHECK_WIDTYPE(obj, widtype);
2005 win = elm_widget_data_get(obj);
2007 if (win->rot == rotation) return;
2008 win->rot = rotation;
2009 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2010 evas_object_size_hint_min_set(obj, -1, -1);
2011 evas_object_size_hint_max_set(obj, -1, -1);
2012 _elm_win_eval_subobjs(obj);
2013 #ifdef HAVE_ELEMENTARY_X
2014 _elm_win_xwin_update(win);
2019 * Get the rotation of the window.
2021 * @param obj The window object
2022 * @return The rotation of the window in degrees (0-360)
2027 elm_win_rotation_get(const Evas_Object *obj)
2030 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2031 win = elm_widget_data_get(obj);
2032 if (!win) return -1;
2037 * Set the sticky state of the window.
2039 * @param obj The window object
2040 * @param sticky If true, the window's sticky state is enabled
2045 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2048 ELM_CHECK_WIDTYPE(obj, widtype);
2049 win = elm_widget_data_get(obj);
2051 ecore_evas_sticky_set(win->ee, sticky);
2052 #ifdef HAVE_ELEMENTARY_X
2053 _elm_win_xwin_update(win);
2058 * Get the sticky state of the window.
2060 * @param obj The window object
2061 * @return If true, the window's sticky state is enabled
2066 elm_win_sticky_get(const Evas_Object *obj)
2069 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2070 win = elm_widget_data_get(obj);
2071 if (!win) return EINA_FALSE;
2072 return ecore_evas_sticky_get(win->ee);
2076 * Sets the keyboard mode of the window.
2078 * @param obj The window object
2079 * @param mode The mode to set; one of:
2080 * ELM_WIN_KEYBOARD_UNKNOWN
2081 * ELM_WIN_KEYBOARD_OFF
2082 * ELM_WIN_KEYBOARD_ON
2083 * ELM_WIN_KEYBOARD_ALPHA
2084 * ELM_WIN_KEYBOARD_NUMERIC
2085 * ELM_WIN_KEYBOARD_PIN
2086 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2087 * ELM_WIN_KEYBOARD_HEX
2088 * ELM_WIN_KEYBOARD_TERMINAL
2089 * ELM_WIN_KEYBOARD_PASSWORD
2090 * ELM_WIN_KEYBOARD_IP
2091 * ELM_WIN_KEYBOARD_HOST
2092 * ELM_WIN_KEYBOARD_FILE
2093 * ELM_WIN_KEYBOARD_URL
2094 * ELM_WIN_KEYBOARD_KEYPAD
2095 * ELM_WIN_KEYBOARD_J2ME
2100 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2103 ELM_CHECK_WIDTYPE(obj, widtype);
2104 win = elm_widget_data_get(obj);
2106 if (mode == win->kbdmode) return;
2107 #ifdef HAVE_ELEMENTARY_X
2108 _elm_win_xwindow_get(win);
2110 win->kbdmode = mode;
2111 #ifdef HAVE_ELEMENTARY_X
2113 ecore_x_e_virtual_keyboard_state_set
2114 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2119 * Gets the keyboard mode of the window.
2121 * @param obj The window object
2122 * @return The mode; one of:
2123 * ELM_WIN_KEYBOARD_UNKNOWN
2124 * ELM_WIN_KEYBOARD_OFF
2125 * ELM_WIN_KEYBOARD_ON
2126 * ELM_WIN_KEYBOARD_ALPHA
2127 * ELM_WIN_KEYBOARD_NUMERIC
2128 * ELM_WIN_KEYBOARD_PIN
2129 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2130 * ELM_WIN_KEYBOARD_HEX
2131 * ELM_WIN_KEYBOARD_TERMINAL
2132 * ELM_WIN_KEYBOARD_PASSWORD
2133 * ELM_WIN_KEYBOARD_IP
2134 * ELM_WIN_KEYBOARD_HOST
2135 * ELM_WIN_KEYBOARD_FILE
2136 * ELM_WIN_KEYBOARD_URL
2137 * ELM_WIN_KEYBOARD_KEYPAD
2138 * ELM_WIN_KEYBOARD_J2ME
2142 EAPI Elm_Win_Keyboard_Mode
2143 elm_win_keyboard_mode_get(const Evas_Object *obj)
2146 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2147 win = elm_widget_data_get(obj);
2148 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2149 return win->kbdmode;
2153 * Sets whether the window is a keyboard.
2155 * @param obj The window object
2156 * @param is_keyboard If true, the window is a virtual keyboard
2161 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2164 ELM_CHECK_WIDTYPE(obj, widtype);
2165 win = elm_widget_data_get(obj);
2167 #ifdef HAVE_ELEMENTARY_X
2168 _elm_win_xwindow_get(win);
2170 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2175 * Gets whether the window is a keyboard.
2177 * @param obj The window object
2178 * @return If the window is a virtual keyboard
2183 elm_win_keyboard_win_get(const Evas_Object *obj)
2186 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2187 win = elm_widget_data_get(obj);
2188 if (!win) return EINA_FALSE;
2189 #ifdef HAVE_ELEMENTARY_X
2190 _elm_win_xwindow_get(win);
2192 return ecore_x_e_virtual_keyboard_get(win->xwin);
2198 * Get the screen position of a window.
2200 * @param obj The window object
2201 * @param x The int to store the x coordinate to
2202 * @param y The int to store the y coordinate to
2207 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2210 ELM_CHECK_WIDTYPE(obj, widtype);
2211 win = elm_widget_data_get(obj);
2213 if (x) *x = win->screen.x;
2214 if (y) *y = win->screen.y;
2218 * Set if this window is an illume conformant window
2220 * @param obj The window object
2221 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2226 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2229 ELM_CHECK_WIDTYPE(obj, widtype);
2230 win = elm_widget_data_get(obj);
2232 #ifdef HAVE_ELEMENTARY_X
2233 _elm_win_xwindow_get(win);
2235 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2240 * Get if this window is an illume conformant window
2242 * @param obj The window object
2243 * @return A boolean if this window is illume conformant or not
2248 elm_win_conformant_get(const Evas_Object *obj)
2251 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2252 win = elm_widget_data_get(obj);
2253 if (!win) return EINA_FALSE;
2254 #ifdef HAVE_ELEMENTARY_X
2255 _elm_win_xwindow_get(win);
2257 return ecore_x_e_illume_conformant_get(win->xwin);
2263 * Set a window to be an illume quickpanel window
2265 * By default window objects are not quickpanel windows.
2267 * @param obj The window object
2268 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2273 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2276 ELM_CHECK_WIDTYPE(obj, widtype);
2277 win = elm_widget_data_get(obj);
2279 #ifdef HAVE_ELEMENTARY_X
2280 _elm_win_xwindow_get(win);
2283 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2286 Ecore_X_Window_State states[2];
2288 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2289 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2290 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2291 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2298 * Get if this window is a quickpanel or not
2300 * @param obj The window object
2301 * @return A boolean if this window is a quickpanel or not
2306 elm_win_quickpanel_get(const Evas_Object *obj)
2309 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2310 win = elm_widget_data_get(obj);
2311 if (!win) return EINA_FALSE;
2312 #ifdef HAVE_ELEMENTARY_X
2313 _elm_win_xwindow_get(win);
2315 return ecore_x_e_illume_quickpanel_get(win->xwin);
2321 * Set the major priority of a quickpanel window
2323 * @param obj The window object
2324 * @param priority The major priority for this quickpanel
2329 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2332 ELM_CHECK_WIDTYPE(obj, widtype);
2333 win = elm_widget_data_get(obj);
2335 #ifdef HAVE_ELEMENTARY_X
2336 _elm_win_xwindow_get(win);
2338 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2343 * Get the major priority of a quickpanel window
2345 * @param obj The window object
2346 * @return The major priority of this quickpanel
2351 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2354 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2355 win = elm_widget_data_get(obj);
2356 if (!win) return -1;
2357 #ifdef HAVE_ELEMENTARY_X
2358 _elm_win_xwindow_get(win);
2360 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2366 * Set the minor priority of a quickpanel window
2368 * @param obj The window object
2369 * @param priority The minor priority for this quickpanel
2374 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2377 ELM_CHECK_WIDTYPE(obj, widtype);
2378 win = elm_widget_data_get(obj);
2380 #ifdef HAVE_ELEMENTARY_X
2381 _elm_win_xwindow_get(win);
2383 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2388 * Get the minor priority of a quickpanel window
2390 * @param obj The window object
2391 * @return The minor priority of this quickpanel
2396 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2399 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2400 win = elm_widget_data_get(obj);
2401 if (!win) return -1;
2402 #ifdef HAVE_ELEMENTARY_X
2403 _elm_win_xwindow_get(win);
2405 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2411 * Set which zone this quickpanel should appear in
2413 * @param obj The window object
2414 * @param zone The requested zone for this quickpanel
2419 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2422 ELM_CHECK_WIDTYPE(obj, widtype);
2423 win = elm_widget_data_get(obj);
2425 #ifdef HAVE_ELEMENTARY_X
2426 _elm_win_xwindow_get(win);
2428 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2433 * Get which zone this quickpanel should appear in
2435 * @param obj The window object
2436 * @return The requested zone for this quickpanel
2441 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2444 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2445 win = elm_widget_data_get(obj);
2447 #ifdef HAVE_ELEMENTARY_X
2448 _elm_win_xwindow_get(win);
2450 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2456 * Set the window to be skipped by keyboard focus
2458 * This sets the window to be skipped by normal keyboard input. This means
2459 * a window manager will be asked to not focus this window as well as omit
2460 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2462 * Call this and enable it on a window BEFORE you show it for the first time,
2463 * otherwise it may have no effect.
2465 * Use this for windows that have only output information or might only be
2466 * interacted with by the mouse or fingers, and never for typing input.
2467 * Be careful that this may have side-effects like making the window
2468 * non-accessible in some cases unless the window is specially handled. Use
2471 * @param obj The window object
2472 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2477 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2480 ELM_CHECK_WIDTYPE(obj, widtype);
2481 win = elm_widget_data_get(obj);
2483 #ifdef HAVE_ELEMENTARY_X
2484 _elm_win_xwindow_get(win);
2489 Ecore_X_Window_State states[2];
2491 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2492 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2493 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2494 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2501 * Send a command to the windowing environment
2503 * This is intended to work in touchscreen or small screen device environments
2504 * where there is a more simplistic window management policy in place. This
2505 * uses the window object indicated to select which part of the environment
2506 * to control (the part that this window lives in), and provides a command
2507 * and an optional parameter structure (use NULL for this if not needed).
2509 * @param obj The window object that lives in the environment to control
2510 * @param command The command to send
2511 * @param params Optional parameters for the command
2516 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2519 ELM_CHECK_WIDTYPE(obj, widtype);
2520 win = elm_widget_data_get(obj);
2522 #ifdef HAVE_ELEMENTARY_X
2523 _elm_win_xwindow_get(win);
2528 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2529 ecore_x_e_illume_focus_back_send(win->xwin);
2531 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2532 ecore_x_e_illume_focus_forward_send(win->xwin);
2534 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2535 ecore_x_e_illume_focus_home_send(win->xwin);
2537 case ELM_ILLUME_COMMAND_CLOSE:
2538 ecore_x_e_illume_close_send(win->xwin);
2548 * Get the inlined image object handle
2550 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2551 * then the window is in fact an evas image object inlined in the parent
2552 * canvas. You can get this object (be careful to not manipulate it as it
2553 * is under control of elementary), and use it to do things like get pixel
2554 * data, save the image to a file, etc.
2556 * @param obj The window object to get the inlined image from
2557 * @return The inlined image object, or NULL if none exists
2562 elm_win_inlined_image_object_get(Evas_Object *obj)
2565 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2566 win = elm_widget_data_get(obj);
2567 if (!win) return NULL;
2568 return win->img_obj;
2572 * Set the enabled status for the focus highlight in a window
2574 * This function will enable or disable the focus highlight only for the
2575 * given window, regardless of the global setting for it
2577 * @param obj The window where to enable the highlight
2578 * @param enabled The enabled value for the highlight
2583 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2587 ELM_CHECK_WIDTYPE(obj, widtype);
2589 win = elm_widget_data_get(obj);
2590 enabled = !!enabled;
2591 if (win->focus_highlight.enabled == enabled)
2594 win->focus_highlight.enabled = enabled;
2596 if (win->focus_highlight.enabled)
2597 _elm_win_focus_highlight_init(win);
2599 _elm_win_focus_highlight_shutdown(win);
2603 * Get the enabled value of the focus highlight for this window
2605 * @param obj The window in which to check if the focus highlight is enabled
2607 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2612 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2616 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2618 win = elm_widget_data_get(obj);
2619 return win->focus_highlight.enabled;
2623 * Set the style for the focus highlight on this window
2625 * Sets the style to use for theming the highlight of focused objects on
2626 * the given window. If @p style is NULL, the default will be used.
2628 * @param obj The window where to set the style
2629 * @param style The style to set
2634 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2638 ELM_CHECK_WIDTYPE(obj, widtype);
2640 win = elm_widget_data_get(obj);
2641 eina_stringshare_replace(&win->focus_highlight.style, style);
2642 win->focus_highlight.changed_theme = EINA_TRUE;
2643 _elm_win_focus_highlight_reconfigure_job_start(win);
2647 * Get the style set for the focus highlight object
2649 * Gets the style set for this windows highilght object, or NULL if none
2652 * @param obj The window to retrieve the highlights style from
2654 * @return The style set or NULL if none was. Default is used in that case.
2659 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2663 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2665 win = elm_widget_data_get(obj);
2666 return win->focus_highlight.style;
2669 typedef struct _Widget_Data Widget_Data;
2674 Evas_Object *content;
2677 static void _del_hook(Evas_Object *obj);
2678 static void _theme_hook(Evas_Object *obj);
2679 static void _sizing_eval(Evas_Object *obj);
2680 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2681 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2683 static const char *widtype2 = NULL;
2686 _del_hook(Evas_Object *obj)
2688 Widget_Data *wd = elm_widget_data_get(obj);
2694 _theme_hook(Evas_Object *obj)
2696 Widget_Data *wd = elm_widget_data_get(obj);
2697 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2699 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2704 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2706 Widget_Data *wd = elm_widget_data_get(obj);
2711 /* Try Focus cycle in subitem */
2714 elm_widget_focus_next_get(wd->content, dir, next);
2719 *next = (Evas_Object *)obj;
2724 _sizing_eval(Evas_Object *obj)
2726 Widget_Data *wd = elm_widget_data_get(obj);
2727 Evas_Coord minw = -1, minh = -1;
2729 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2730 edje_object_size_min_calc(wd->frm, &minw, &minh);
2731 evas_object_size_hint_min_set(obj, minw, minh);
2732 evas_object_size_hint_max_set(obj, -1, -1);
2736 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2742 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2744 Widget_Data *wd = elm_widget_data_get(obj);
2745 Evas_Object *sub = event_info;
2746 if (sub == wd->content)
2748 evas_object_event_callback_del_full
2749 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2756 * @defgroup Inwin Inwin
2758 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2761 elm_win_inwin_add(Evas_Object *obj)
2767 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2768 win = elm_widget_data_get(obj);
2769 if (!win) return NULL;
2770 wd = ELM_NEW(Widget_Data);
2771 obj2 = elm_widget_add(win->evas);
2772 elm_widget_type_set(obj2, "inwin");
2773 ELM_SET_WIDTYPE(widtype2, "inwin");
2774 elm_widget_sub_object_add(obj, obj2);
2775 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2776 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2777 elm_win_resize_object_add(obj, obj2);
2779 elm_widget_data_set(obj2, wd);
2780 elm_widget_del_hook_set(obj2, _del_hook);
2781 elm_widget_theme_hook_set(obj2, _theme_hook);
2782 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2783 elm_widget_can_focus_set(obj2, EINA_TRUE);
2784 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2786 wd->frm = edje_object_add(win->evas);
2787 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2788 elm_widget_resize_object_set(obj2, wd->frm);
2790 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2797 * Activates an inwin object
2799 * @param obj The inwin to activate
2804 elm_win_inwin_activate(Evas_Object *obj)
2806 ELM_CHECK_WIDTYPE(obj, widtype2);
2807 Widget_Data *wd = elm_widget_data_get(obj);
2809 evas_object_raise(obj);
2810 evas_object_show(obj);
2811 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2812 elm_object_focus(obj);
2816 * Set the content of an inwin object.
2818 * Once the content object is set, a previously set one will be deleted.
2819 * If you want to keep that old content object, use the
2820 * elm_win_inwin_content_unset() function.
2822 * @param obj The inwin object
2823 * @param content The object to set as content
2828 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2830 ELM_CHECK_WIDTYPE(obj, widtype2);
2831 Widget_Data *wd = elm_widget_data_get(obj);
2833 if (wd->content == content) return;
2834 if (wd->content) evas_object_del(wd->content);
2835 wd->content = content;
2838 elm_widget_sub_object_add(obj, content);
2839 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2840 _changed_size_hints, obj);
2841 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2847 * Get the content of an inwin object.
2849 * Return the content object which is set for this widget.
2851 * @param obj The inwin object
2852 * @return The content that is being used
2857 elm_win_inwin_content_get(const Evas_Object *obj)
2859 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2860 Widget_Data *wd = elm_widget_data_get(obj);
2861 if (!wd) return NULL;
2866 * Unset the content of an inwin object.
2868 * Unparent and return the content object which was set for this widget.
2870 * @param obj The inwin object
2871 * @return The content that was being used
2876 elm_win_inwin_content_unset(Evas_Object *obj)
2878 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2879 Widget_Data *wd = elm_widget_data_get(obj);
2880 if (!wd) return NULL;
2881 if (!wd->content) return NULL;
2882 Evas_Object *content = wd->content;
2883 elm_widget_sub_object_del(obj, wd->content);
2884 edje_object_part_unswallow(wd->frm, wd->content);
2889 /* windowing spcific calls - shall we do this differently? */
2891 static Ecore_X_Window
2892 _elm_ee_win_get(const Evas_Object *obj)
2895 #ifdef HAVE_ELEMENTARY_X
2896 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2897 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2903 * Get the Ecore_X_Window of an Evas_Object
2905 * @param obj The object
2907 * @return The Ecore_X_Window of @p obj
2912 elm_win_xwindow_get(const Evas_Object *obj)
2914 Ecore_X_Window xwin = 0;
2919 type = elm_widget_type_get(obj);
2920 if (!type) return 0;
2921 if (type != widtype) return _elm_ee_win_get(obj);
2922 #ifdef HAVE_ELEMENTARY_X
2923 win = elm_widget_data_get(obj);
2924 if (!win) return xwin;
2925 if (win->xwin) return win->xwin;
2926 if (win->parent) return elm_win_xwindow_get(win->parent);