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;
39 Eina_Bool autodel : 1;
40 int *autodel_clear, rot;
50 Eina_Bool visible : 1;
51 Eina_Bool handled : 1;
55 Ecore_Job *reconf_job;
57 Eina_Bool enabled : 1;
58 Eina_Bool changed_theme : 1;
59 Eina_Bool top_animate : 1;
60 Eina_Bool geometry_changed : 1;
64 static const char *widtype = NULL;
65 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
66 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
67 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
68 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
69 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
70 static void _elm_win_move(Ecore_Evas *ee);
71 static void _elm_win_resize(Ecore_Evas *ee);
72 static void _elm_win_delete_request(Ecore_Evas *ee);
73 static void _elm_win_resize_job(void *data);
74 #ifdef HAVE_ELEMENTARY_X
75 static void _elm_win_xwin_update(Elm_Win *win);
77 static void _elm_win_eval_subobjs(Evas_Object *obj);
78 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
79 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
80 static void _elm_win_focus_highlight_init(Elm_Win *win);
81 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
82 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
83 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
84 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
85 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
86 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
88 static const char SIG_DELETE_REQUEST[] = "delete,request";
89 static const char SIG_FOCUS_OUT[] = "focus,in";
90 static const char SIG_FOCUS_IN[] = "focus,out";
91 static const char SIG_MOVED[] = "moved";
93 static const Evas_Smart_Cb_Description _signals[] = {
94 {SIG_DELETE_REQUEST, ""},
103 Eina_List *_elm_win_list = NULL;
104 int _elm_win_deferred_free = 0;
106 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
107 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
110 _shot_delay_get(Elm_Win *win)
113 char *d = strdup(win->shot.info);
116 for (p = (char *)win->shot.info; *p; p++)
118 if (!strncmp(p, "delay=", 6))
122 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
137 _shot_file_get(Elm_Win *win)
140 char *tmp = strdup(win->shot.info);
142 if (!tmp) return NULL;
143 for (p = (char *)win->shot.info; *p; p++)
145 if (!strncmp(p, "file=", 5))
152 return strdup("out.png");
156 _shot_key_get(Elm_Win *win __UNUSED__)
162 _shot_flags_get(Elm_Win *win __UNUSED__)
168 _shot_do(Elm_Win *win)
172 unsigned int *pixels;
174 char *file, *key, *flags;
176 ecore_evas_manual_render(win->ee);
177 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
179 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
180 if ((w < 1) || (h < 1)) return;
181 file = _shot_file_get(win);
183 key = _shot_key_get(win);
184 flags = _shot_flags_get(win);
185 ee = ecore_evas_buffer_new(1, 1);
186 o = evas_object_image_add(ecore_evas_get(ee));
187 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
188 evas_object_image_size_set(o, w, h);
189 evas_object_image_data_set(o, pixels);
190 if (!evas_object_image_save(o, file, key, flags))
192 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
197 if (flags) free(flags);
202 _shot_delay(void *data)
206 win->shot.timer = NULL;
212 _shot_handle(Elm_Win *win)
214 if (!win->shot.info) return;
215 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
219 _elm_win_move(Ecore_Evas *ee)
221 Evas_Object *obj = ecore_evas_object_associate_get(ee);
226 win = elm_widget_data_get(obj);
228 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
231 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
235 _elm_win_resize(Ecore_Evas *ee)
237 Evas_Object *obj = ecore_evas_object_associate_get(ee);
241 win = elm_widget_data_get(obj);
243 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
244 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
248 _elm_win_focus_in(Ecore_Evas *ee)
250 Evas_Object *obj = ecore_evas_object_associate_get(ee);
254 win = elm_widget_data_get(obj);
256 /*NB: Why two different "focus signals" here ??? */
257 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL); // FIXME: remove me
258 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
259 win->focus_highlight.cur.visible = EINA_TRUE;
260 _elm_win_focus_highlight_reconfigure_job_start(win);
264 else if (win->img_obj)
271 _elm_win_focus_out(Ecore_Evas *ee)
273 Evas_Object *obj = ecore_evas_object_associate_get(ee);
277 win = elm_widget_data_get(obj);
279 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL); // FIXME: remove me
280 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
281 win->focus_highlight.cur.visible = EINA_FALSE;
282 _elm_win_focus_highlight_reconfigure_job_start(win);
286 else if (win->img_obj)
293 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
295 Elm_Win *wd = elm_widget_data_get(obj);
296 const Eina_List *items;
297 void *(*list_data_get) (const Eina_List *list);
305 if (!(items = elm_widget_focus_custom_chain_get(obj)))
311 list_data_get = eina_list_data_get;
313 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
319 *next = (Evas_Object *)obj;
324 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
326 Elm_Win *win = elm_widget_data_get(obj);
330 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
332 evas_object_focus_set(obj, elm_widget_focus_get(obj));
336 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
338 if (type == EVAS_CALLBACK_KEY_DOWN)
340 Evas_Event_Key_Down *ev = event_info;
341 if (!strcmp(ev->keyname, "Tab"))
343 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
344 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
346 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
347 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
356 _deferred_ecore_evas_free(void *data)
358 ecore_evas_free(data);
359 _elm_win_deferred_free--;
363 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
367 elm_object_focus(obj);
368 if (win->shot.info) _shot_handle(win);
372 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
379 else if (win->img_obj)
381 evas_object_hide(win->img_obj);
386 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
393 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
394 _elm_win_obj_callback_parent_del, win);
397 if (win->autodel_clear) *(win->autodel_clear) = -1;
398 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
399 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
402 ecore_evas_callback_delete_request_set(win->ee, NULL);
403 ecore_evas_callback_resize_set(win->ee, NULL);
405 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
406 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
407 if (win->shot.info) eina_stringshare_del(win->shot.info);
408 if (win->shot.timer) ecore_timer_del(win->shot.timer);
409 while (((child = evas_object_bottom_get(win->evas))) &&
412 evas_object_del(child);
414 while (((child = evas_object_top_get(win->evas))) &&
417 evas_object_del(child);
419 #ifdef HAVE_ELEMENTARY_X
420 if (win->client_message_handler)
421 ecore_event_handler_del(win->client_message_handler);
423 // FIXME: Why are we flushing edje on every window destroy ??
424 // edje_file_cache_flush();
425 // edje_collection_cache_flush();
426 // evas_image_cache_flush(win->evas);
427 // evas_font_cache_flush(win->evas);
428 // FIXME: we are in the del handler for the object and delete the canvas
429 // that lives under it from the handler... nasty. deferring doesn't help either
439 ecore_job_add(_deferred_ecore_evas_free, win->ee);
440 _elm_win_deferred_free++;
444 _elm_win_focus_highlight_shutdown(win);
445 eina_stringshare_del(win->focus_highlight.style);
449 if ((!_elm_win_list) &&
450 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
452 edje_file_cache_flush();
453 edje_collection_cache_flush();
454 evas_image_cache_flush(e);
455 evas_font_cache_flush(e);
461 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
464 if (!win->img_obj) return;
465 evas_object_event_callback_del_full
466 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
467 evas_object_del(win->img_obj);
471 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
474 if (obj == win->parent) win->parent = NULL;
478 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
484 if ((x != win->screen.x) || (y != win->screen.y))
488 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
493 evas_object_move(obj, x, y);
498 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
501 // this is called to make sure all smart containers have calculated their
502 // sizes BEFORE we show the window to make sure it initially appears at
503 // our desired size (ie min size is known first)
504 evas_smart_objects_calculate(evas_object_evas_get(obj));
505 evas_object_show(obj);
509 else if (win->img_obj)
511 evas_object_show(win->img_obj);
516 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
520 if (ecore_evas_override_get(win->ee))
524 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
527 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
532 else if (win->img_obj)
536 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
539 // evas_object_move(win->img_obj, x, y);
544 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
551 else if (win->img_obj)
553 Evas_Coord w = 1, h = 1;
555 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
558 evas_object_image_size_set(win->img_obj, w, h);
563 _elm_win_delete_request(Ecore_Evas *ee)
565 Evas_Object *obj = ecore_evas_object_associate_get(ee);
567 if (strcmp(elm_widget_type_get(obj), "win")) return;
569 win = elm_widget_data_get(obj);
571 int autodel = win->autodel;
572 win->autodel_clear = &autodel;
573 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL); // FIXME: remove me.
574 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
575 // FIXME: if above callback deletes - then the below will be invalid
576 if (autodel) evas_object_del(win->win_obj);
577 else win->autodel_clear = NULL;
581 _elm_win_resize_job(void *data)
588 win->deferred_resize_job = NULL;
589 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
590 evas_object_resize(win->win_obj, w, h);
594 else if (win->img_obj)
597 EINA_LIST_FOREACH(win->subobjs, l, obj)
599 evas_object_move(obj, 0, 0);
600 evas_object_resize(obj, w, h);
604 #ifdef HAVE_ELEMENTARY_X
606 _elm_win_xwindow_get(Elm_Win *win)
610 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
611 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
613 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
615 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
616 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
617 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
618 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
619 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
620 ENGINE_COMPARE(ELM_OPENGL_SDL))
623 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
625 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
627 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
629 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
632 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
634 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
637 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
639 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
641 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
643 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
645 #undef ENGINE_COMPARE
649 #ifdef HAVE_ELEMENTARY_X
651 _elm_win_xwin_update(Elm_Win *win)
653 _elm_win_xwindow_get(win);
658 win2 = elm_widget_data_get(win->parent);
662 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
666 if (!win->xwin) return; /* nothing more to do */
671 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
673 case ELM_WIN_DIALOG_BASIC:
674 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
676 case ELM_WIN_DESKTOP:
677 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
680 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
682 case ELM_WIN_TOOLBAR:
683 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
686 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
688 case ELM_WIN_UTILITY:
689 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
692 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
694 case ELM_WIN_DROPDOWN_MENU:
695 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
697 case ELM_WIN_POPUP_MENU:
698 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
700 case ELM_WIN_TOOLTIP:
701 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
703 case ELM_WIN_NOTIFICATION:
704 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
707 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
710 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
715 ecore_x_e_virtual_keyboard_state_set
716 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
721 _elm_win_eval_subobjs(Evas_Object *obj)
724 const Evas_Object *child;
726 Elm_Win *win = elm_widget_data_get(obj);
727 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
731 EINA_LIST_FOREACH(win->subobjs, l, child)
733 evas_object_size_hint_weight_get(child, &wx, &wy);
734 if (wx == 0.0) xx = 0;
735 if (wy == 0.0) xy = 0;
737 evas_object_size_hint_min_get(child, &w, &h);
740 if (w > minw) minw = w;
741 if (h > minh) minh = h;
743 evas_object_size_hint_max_get(child, &w, &h);
746 if (maxw == -1) maxw = w;
747 else if ((w > 0) && (w < maxw)) maxw = w;
748 if (maxh == -1) maxh = h;
749 else if ((h > 0) && (h < maxh)) maxh = h;
751 if (!xx) maxw = minw;
753 if (!xy) maxh = minh;
755 evas_object_size_hint_min_set(obj, minw, minh);
756 evas_object_size_hint_max_set(obj, maxw, maxh);
757 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
758 if (w < minw) w = minw;
759 if (h < minh) h = minh;
760 if ((maxw >= 0) && (w > maxw)) w = maxw;
761 if ((maxh >= 0) && (h > maxh)) h = maxh;
762 evas_object_resize(obj, w, h);
766 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
768 Elm_Win *win = elm_widget_data_get(data);
769 win->subobjs = eina_list_remove(win->subobjs, obj);
770 _elm_win_eval_subobjs(win->win_obj);
774 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
776 _elm_win_eval_subobjs(data);
780 _elm_win_shutdown(void)
782 while (_elm_win_list)
783 evas_object_del(_elm_win_list->data);
787 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
794 EINA_LIST_FOREACH(_elm_win_list, l, obj)
795 elm_widget_theme(obj);
799 EINA_LIST_FOREACH(_elm_win_list, l, obj)
800 elm_widget_theme_specific(obj, th, EINA_FALSE);
804 #ifdef HAVE_ELEMENTARY_X
806 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
809 Ecore_X_Event_Client_Message *e = event;
811 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
812 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
814 if ((unsigned)e->data.l[0] == win->xwin)
816 Evas *evas = evas_object_evas_get(win->win_obj);
819 edje_file_cache_flush();
820 edje_collection_cache_flush();
821 evas_image_cache_flush(evas);
822 evas_font_cache_flush(evas);
826 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
828 if ((unsigned)e->data.l[0] == win->xwin)
830 Evas *evas = evas_object_evas_get(win->win_obj);
833 edje_file_cache_flush();
834 edje_collection_cache_flush();
835 evas_image_cache_flush(evas);
836 evas_font_cache_flush(evas);
837 evas_render_dump(evas);
841 return ECORE_CALLBACK_PASS_ON;
846 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
850 win->focus_highlight.geometry_changed = EINA_TRUE;
851 _elm_win_focus_highlight_reconfigure_job_start(win);
855 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
859 win->focus_highlight.geometry_changed = EINA_TRUE;
860 _elm_win_focus_highlight_reconfigure_job_start(win);
864 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
868 win->focus_highlight.cur.target = NULL;
870 _elm_win_focus_highlight_reconfigure_job_start(win);
874 _elm_win_focus_target_callbacks_add(Elm_Win *win)
876 Evas_Object *obj = win->focus_highlight.cur.target;
878 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
879 _elm_win_focus_target_move, win);
880 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
881 _elm_win_focus_target_resize, win);
882 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
883 _elm_win_focus_target_del, win);
887 _elm_win_focus_target_callbacks_del(Elm_Win *win)
889 Evas_Object *obj = win->focus_highlight.cur.target;
891 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
892 _elm_win_focus_target_move, win);
893 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
894 _elm_win_focus_target_resize, win);
895 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
896 _elm_win_focus_target_del, win);
900 _elm_win_focus_target_get(Evas_Object *obj)
902 Evas_Object *o = obj;
906 if (elm_widget_is(o))
908 if (!elm_widget_highlight_ignore_get(o))
910 o = elm_widget_parent_get(o);
912 o = evas_object_smart_parent_get(o);
916 o = elm_widget_parent_widget_get(o);
918 o = evas_object_smart_parent_get(o);
927 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
929 Evas_Object *obj = event_info, *target;
932 if (win->focus_highlight.cur.target == obj)
935 target = _elm_win_focus_target_get(obj);
936 win->focus_highlight.cur.target = target;
937 if (elm_widget_highlight_in_theme_get(target))
938 win->focus_highlight.cur.handled = EINA_TRUE;
940 _elm_win_focus_target_callbacks_add(win);
942 _elm_win_focus_highlight_reconfigure_job_start(win);
946 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
950 if (!win->focus_highlight.cur.target)
953 if (!win->focus_highlight.cur.handled)
954 _elm_win_focus_target_callbacks_del(win);
955 win->focus_highlight.cur.target = NULL;
956 win->focus_highlight.cur.handled = EINA_FALSE;
958 _elm_win_focus_highlight_reconfigure_job_start(win);
962 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
964 evas_object_hide(obj);
968 _elm_win_focus_highlight_init(Elm_Win *win)
970 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
971 _elm_win_object_focus_in, win);
972 evas_event_callback_add(win->evas,
973 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
974 _elm_win_object_focus_out, win);
976 win->focus_highlight.cur.target = evas_focus_get(win->evas);
978 win->focus_highlight.top = edje_object_add(win->evas);
979 win->focus_highlight.changed_theme = EINA_TRUE;
980 edje_object_signal_callback_add(win->focus_highlight.top,
981 "elm,action,focus,hide,end", "",
982 _elm_win_focus_highlight_hide, NULL);
983 edje_object_signal_callback_add(win->focus_highlight.top,
984 "elm,action,focus,anim,end", "",
985 _elm_win_focus_highlight_anim_end, win);
986 _elm_win_focus_highlight_reconfigure_job_start(win);
990 _elm_win_focus_highlight_shutdown(Elm_Win *win)
992 _elm_win_focus_highlight_reconfigure_job_stop(win);
993 if (win->focus_highlight.cur.target)
995 _elm_win_focus_target_callbacks_del(win);
996 win->focus_highlight.cur.target = NULL;
998 if (win->focus_highlight.top)
1000 evas_object_del(win->focus_highlight.top);
1001 win->focus_highlight.top = NULL;
1004 evas_event_callback_del_full(win->evas,
1005 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1006 _elm_win_object_focus_in, win);
1007 evas_event_callback_del_full(win->evas,
1008 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1009 _elm_win_object_focus_out, win);
1013 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1017 top = win->focus_highlight.top;
1022 evas_object_show(top);
1023 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1029 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1034 _elm_win_focus_highlight_reconfigure_job(void *data)
1036 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1040 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1042 if (win->focus_highlight.reconf_job)
1043 ecore_job_del(win->focus_highlight.reconf_job);
1044 win->focus_highlight.reconf_job = ecore_job_add(
1045 _elm_win_focus_highlight_reconfigure_job, win);
1049 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1051 if (win->focus_highlight.reconf_job)
1052 ecore_job_del(win->focus_highlight.reconf_job);
1053 win->focus_highlight.reconf_job = NULL;
1057 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1059 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1060 Evas_Coord x, y, w, h;
1062 clip = evas_object_clip_get(target);
1063 evas_object_geometry_get(target, &x, &y, &w, &h);
1065 evas_object_move(obj, x, y);
1066 evas_object_resize(obj, w, h);
1067 evas_object_clip_set(obj, clip);
1071 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1073 Evas_Coord tx, ty, tw, th;
1074 Evas_Coord w, h, px, py, pw, ph;
1075 Edje_Message_Int_Set *m;
1076 Evas_Object *previous = win->focus_highlight.prev.target;
1077 Evas_Object *target = win->focus_highlight.cur.target;
1079 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1080 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1081 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1082 evas_object_move(obj, 0, 0);
1083 evas_object_resize(obj, tw, th);
1084 evas_object_clip_unset(obj);
1086 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1096 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1100 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1102 Elm_Win *win = data;
1103 _elm_win_focus_highlight_simple_setup(win, obj);
1107 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1109 Evas_Object *target = win->focus_highlight.cur.target;
1110 Evas_Object *previous = win->focus_highlight.prev.target;
1111 Evas_Object *top = win->focus_highlight.top;
1112 Eina_Bool visible_changed;
1113 Eina_Bool common_visible;
1114 const char *sig = NULL;
1116 _elm_win_focus_highlight_reconfigure_job_stop(win);
1118 visible_changed = (win->focus_highlight.cur.visible !=
1119 win->focus_highlight.prev.visible);
1121 if ((target == previous) && (!visible_changed) &&
1122 (!win->focus_highlight.geometry_changed))
1125 if ((previous) && (win->focus_highlight.prev.handled))
1126 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1129 common_visible = EINA_FALSE;
1130 else if (win->focus_highlight.cur.handled)
1132 common_visible = EINA_FALSE;
1133 if (win->focus_highlight.cur.visible)
1134 sig = "elm,action,focus_highlight,show";
1136 sig = "elm,action,focus_highlight,hide";
1139 common_visible = win->focus_highlight.cur.visible;
1141 _elm_win_focus_highlight_visible_set(win, common_visible);
1143 elm_widget_signal_emit(target, sig, "elm");
1145 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1148 if (win->focus_highlight.changed_theme)
1151 if (win->focus_highlight.style)
1152 str = win->focus_highlight.style;
1155 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1157 win->focus_highlight.changed_theme = EINA_FALSE;
1159 if (_elm_config->focus_highlight_animate)
1161 str = edje_object_data_get(win->focus_highlight.top, "animate");
1162 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1166 if ((win->focus_highlight.top_animate) && (previous) &&
1167 (!win->focus_highlight.prev.handled))
1168 _elm_win_focus_highlight_anim_setup(win, top);
1170 _elm_win_focus_highlight_simple_setup(win, top);
1171 evas_object_raise(top);
1174 win->focus_highlight.geometry_changed = EINA_FALSE;
1175 win->focus_highlight.prev = win->focus_highlight.cur;
1180 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1182 Evas_Event_Key_Down *ev = event_info;
1184 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1188 if ((strcmp(ev->keyname, "F12")) ||
1189 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1192 printf("Tree graph generated.\n");
1193 elm_object_tree_dot_dump(obj, "./dump.dot");
1198 _win_img_hide(void *data,
1200 Evas_Object *obj __UNUSED__,
1201 void *event_info __UNUSED__)
1203 Elm_Win *win = data;
1205 elm_widget_focus_hide_handle(win->win_obj);
1209 _win_img_mouse_down(void *data,
1211 Evas_Object *obj __UNUSED__,
1212 void *event_info __UNUSED__)
1214 Elm_Win *win = data;
1215 elm_widget_focus_mouse_down_handle(win->win_obj);
1219 _win_img_focus_in(void *data,
1221 Evas_Object *obj __UNUSED__,
1222 void *event_info __UNUSED__)
1224 Elm_Win *win = data;
1225 elm_widget_focus_steal(win->win_obj);
1229 _win_img_focus_out(void *data,
1231 Evas_Object *obj __UNUSED__,
1232 void *event_info __UNUSED__)
1234 Elm_Win *win = data;
1235 elm_widget_focused_object_clear(win->win_obj);
1239 _win_inlined_image_set(Elm_Win *win)
1241 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1242 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1243 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1244 _elm_win_obj_callback_img_obj_del, win);
1246 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1247 _win_img_hide, win);
1248 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1249 _win_img_mouse_down, win);
1250 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1251 _win_img_focus_in, win);
1252 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1253 _win_img_focus_out, win);
1257 * Adds a window object. If this is the first window created, pass NULL as
1260 * @param parent Parent object to add the window to, or NULL
1261 * @param name The name of the window
1262 * @param type The window type, one of the following:
1264 * ELM_WIN_DIALOG_BASIC
1272 * @return The created object, or NULL on failure
1277 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1281 const char *fontpath;
1283 win = ELM_NEW(Elm_Win);
1285 #define FALLBACK_TRY(engine) \
1288 CRITICAL(engine " engine creation failed. Trying software X11."); \
1289 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1291 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1295 case ELM_WIN_INLINED_IMAGE:
1299 Evas *e = evas_object_evas_get(parent);
1302 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1305 win->img_obj = ecore_evas_object_image_new(ee);
1308 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1311 _win_inlined_image_set(win);
1315 evas_object_del(win->img_obj);
1316 win->img_obj = NULL;
1325 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1327 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1328 #ifdef HAVE_ELEMENTARY_X
1329 win->client_message_handler = ecore_event_handler_add
1330 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1333 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1335 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1336 FALLBACK_TRY("Sofware FB");
1338 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1340 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1341 FALLBACK_TRY("Sofware DirectFB");
1343 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1345 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1346 FALLBACK_TRY("Sofware-16");
1347 #ifdef HAVE_ELEMENTARY_X
1348 win->client_message_handler = ecore_event_handler_add
1349 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1352 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1354 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1355 FALLBACK_TRY("Sofware-8");
1356 #ifdef HAVE_ELEMENTARY_X
1357 win->client_message_handler = ecore_event_handler_add
1358 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1362 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1364 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1365 FALLBACK_TRY("XRender");
1366 #ifdef HAVE_ELEMENTARY_X
1367 win->client_message_handler = ecore_event_handler_add
1368 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1372 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1377 if (_elm_config->vsync)
1379 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1385 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1387 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1388 FALLBACK_TRY("OpenGL");
1389 #ifdef HAVE_ELEMENTARY_X
1390 win->client_message_handler = ecore_event_handler_add
1391 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1394 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1396 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1397 FALLBACK_TRY("Sofware Win32");
1399 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1401 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1402 FALLBACK_TRY("Sofware-16-WinCE");
1404 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1406 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1407 FALLBACK_TRY("Sofware SDL");
1409 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1411 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1412 FALLBACK_TRY("Sofware-16-SDL");
1414 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1416 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1417 FALLBACK_TRY("OpenGL SDL");
1419 else if (!strncmp(_elm_config->engine, "shot:", 5))
1421 win->ee = ecore_evas_buffer_new(1, 1);
1422 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1423 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1431 ERR("Cannot create window.");
1435 #ifdef HAVE_ELEMENTARY_X
1436 _elm_win_xwindow_get(win);
1438 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1439 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1440 // bg pixmap done by x - has other issues like can be redrawn by x before it
1441 // is filled/ready by app
1442 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1445 win->parent = parent;
1447 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1448 _elm_win_obj_callback_parent_del, win);
1450 win->evas = ecore_evas_get(win->ee);
1451 win->win_obj = elm_widget_add(win->evas);
1452 elm_widget_type_set(win->win_obj, "win");
1453 ELM_SET_WIDTYPE(widtype, "win");
1454 elm_widget_data_set(win->win_obj, win);
1455 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1456 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1457 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1458 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1459 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1460 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1461 evas_object_move(win->win_obj, 0, 0);
1462 evas_object_resize(win->win_obj, 1, 1);
1463 evas_object_layer_set(win->win_obj, 50);
1464 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1466 ecore_evas_object_associate(win->ee, win->win_obj,
1467 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1468 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1469 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1470 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1471 _elm_win_obj_callback_show, win);
1472 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1473 _elm_win_obj_callback_hide, win);
1474 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1475 _elm_win_obj_callback_del, win);
1476 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1477 _elm_win_obj_callback_move, win);
1478 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1479 _elm_win_obj_callback_resize, win);
1481 evas_object_intercept_move_callback_add(win->win_obj,
1482 _elm_win_obj_intercept_move, win);
1483 evas_object_intercept_show_callback_add(win->win_obj,
1484 _elm_win_obj_intercept_show, win);
1486 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1487 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1488 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1489 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1490 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1491 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1492 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1493 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1494 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1495 evas_font_path_append(win->evas, fontpath);
1496 if (!_elm_config->font_hinting)
1497 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1498 else if (_elm_config->font_hinting == 1)
1499 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1500 else if (_elm_config->font_hinting == 2)
1501 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1503 #ifdef HAVE_ELEMENTARY_X
1504 _elm_win_xwin_update(win);
1507 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1509 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1511 ecore_evas_fullscreen_set(win->ee, 1);
1513 #undef ENGINE_COMPARE
1515 if (_elm_config->focus_highlight_enable)
1516 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1519 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1520 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1521 _debug_key_down, win);
1523 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1525 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1528 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1530 return win->win_obj;
1534 * Add @p subobj as a resize object of window @p obj.
1536 * @param obj The window object
1537 * @param subobj The resize object to add
1542 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1546 ELM_CHECK_WIDTYPE(obj, widtype);
1547 win = elm_widget_data_get(obj);
1549 win->subobjs = eina_list_append(win->subobjs, subobj);
1550 elm_widget_sub_object_add(obj, subobj);
1551 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1552 _elm_win_subobj_callback_del, obj);
1553 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1554 _elm_win_subobj_callback_changed_size_hints,
1556 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1557 evas_object_move(subobj, 0, 0);
1558 evas_object_resize(subobj, w, h);
1559 _elm_win_eval_subobjs(obj);
1563 * Delete @p subobj as a resize object of window @p obj.
1565 * @param obj The window object
1566 * @param subobj The resize object to add
1571 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1574 ELM_CHECK_WIDTYPE(obj, widtype);
1575 win = elm_widget_data_get(obj);
1577 evas_object_event_callback_del_full(subobj,
1578 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1579 _elm_win_subobj_callback_changed_size_hints,
1581 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1582 _elm_win_subobj_callback_del, obj);
1583 win->subobjs = eina_list_remove(win->subobjs, subobj);
1584 elm_widget_sub_object_del(obj, subobj);
1585 _elm_win_eval_subobjs(obj);
1589 * Set the title of the window
1591 * @param obj The window object
1592 * @param title The title to set
1597 elm_win_title_set(Evas_Object *obj, const char *title)
1600 ELM_CHECK_WIDTYPE(obj, widtype);
1601 win = elm_widget_data_get(obj);
1603 ecore_evas_title_set(win->ee, title);
1607 * Get the title of the window
1609 * @param obj The window object
1615 elm_win_title_get(const Evas_Object *obj)
1618 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1619 win = elm_widget_data_get(obj);
1620 if (!win) return NULL;
1621 return ecore_evas_title_get(win->ee);
1625 * Set the window's autodel state.
1627 * @param obj The window object
1628 * @param autodel If true, the window will automatically delete itself when closed
1633 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1636 ELM_CHECK_WIDTYPE(obj, widtype);
1637 win = elm_widget_data_get(obj);
1639 win->autodel = autodel;
1643 * Get the window's autodel state.
1645 * @param obj The window object
1646 * @return If the window will automatically delete itself when closed
1651 elm_win_autodel_get(const Evas_Object *obj)
1654 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1655 win = elm_widget_data_get(obj);
1656 if (!win) return EINA_FALSE;
1657 return win->autodel;
1661 * Activate a window object.
1663 * @param obj The window object
1668 elm_win_activate(Evas_Object *obj)
1671 ELM_CHECK_WIDTYPE(obj, widtype);
1672 win = elm_widget_data_get(obj);
1674 ecore_evas_activate(win->ee);
1678 * Lower a window object.
1680 * @param obj The window object
1685 elm_win_lower(Evas_Object *obj)
1688 ELM_CHECK_WIDTYPE(obj, widtype);
1689 win = elm_widget_data_get(obj);
1691 ecore_evas_lower(win->ee);
1695 * Raise a window object.
1697 * @param obj The window object
1702 elm_win_raise(Evas_Object *obj)
1705 ELM_CHECK_WIDTYPE(obj, widtype);
1706 win = elm_widget_data_get(obj);
1708 ecore_evas_raise(win->ee);
1712 * Set the borderless state of a window.
1714 * @param obj The window object
1715 * @param borderless If true, the window is borderless
1720 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1723 ELM_CHECK_WIDTYPE(obj, widtype);
1724 win = elm_widget_data_get(obj);
1726 ecore_evas_borderless_set(win->ee, borderless);
1727 #ifdef HAVE_ELEMENTARY_X
1728 _elm_win_xwin_update(win);
1733 * Get the borderless state of a window.
1735 * @param obj The window object
1736 * @return If true, the window is borderless
1741 elm_win_borderless_get(const Evas_Object *obj)
1744 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1745 win = elm_widget_data_get(obj);
1746 if (!win) return EINA_FALSE;
1747 return ecore_evas_borderless_get(win->ee);
1751 * Set the shaped state of a window.
1753 * @param obj The window object
1754 * @param shaped If true, the window is shaped
1759 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1762 ELM_CHECK_WIDTYPE(obj, widtype);
1763 win = elm_widget_data_get(obj);
1765 ecore_evas_shaped_set(win->ee, shaped);
1766 #ifdef HAVE_ELEMENTARY_X
1767 _elm_win_xwin_update(win);
1772 * Get the shaped state of a window.
1774 * @param obj The window object
1775 * @return If true, the window is shaped
1780 elm_win_shaped_get(const Evas_Object *obj)
1783 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1784 win = elm_widget_data_get(obj);
1785 if (!win) return EINA_FALSE;
1786 return ecore_evas_shaped_get(win->ee);
1790 * Set the alpha channel state of a window.
1792 * @param obj The window object
1793 * @param alpha If true, the window has an alpha channel
1798 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1801 ELM_CHECK_WIDTYPE(obj, widtype);
1802 win = elm_widget_data_get(obj);
1807 else if (win->img_obj)
1809 evas_object_image_alpha_set(win->img_obj, alpha);
1813 #ifdef HAVE_ELEMENTARY_X
1818 if (!_elm_config->compositing)
1819 elm_win_shaped_set(obj, alpha);
1821 ecore_evas_alpha_set(win->ee, alpha);
1824 ecore_evas_alpha_set(win->ee, alpha);
1825 _elm_win_xwin_update(win);
1829 ecore_evas_alpha_set(win->ee, alpha);
1834 * Get the alpha channel state of a window.
1836 * @param obj The window object
1837 * @return If true, the window has an alpha channel
1842 elm_win_alpha_get(const Evas_Object *obj)
1845 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1846 win = elm_widget_data_get(obj);
1847 if (!win) return EINA_FALSE;
1848 return ecore_evas_alpha_get(win->ee);
1852 * Set the transparency state of a window.
1854 * @param obj The window object
1855 * @param transparent If true, the window is transparent
1860 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1863 ELM_CHECK_WIDTYPE(obj, widtype);
1864 win = elm_widget_data_get(obj);
1870 else if (win->img_obj)
1872 evas_object_image_alpha_set(win->img_obj, transparent);
1876 #ifdef HAVE_ELEMENTARY_X
1879 ecore_evas_transparent_set(win->ee, transparent);
1880 _elm_win_xwin_update(win);
1884 ecore_evas_transparent_set(win->ee, transparent);
1889 * Get the transparency state of a window.
1891 * @param obj The window object
1892 * @return If true, the window is transparent
1897 elm_win_transparent_get(const Evas_Object *obj)
1900 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1901 win = elm_widget_data_get(obj);
1902 if (!win) return EINA_FALSE;
1904 return ecore_evas_transparent_get(win->ee);
1908 * Set the override state of a window.
1910 * @param obj The window object
1911 * @param override If true, the window is overridden
1916 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1919 ELM_CHECK_WIDTYPE(obj, widtype);
1920 win = elm_widget_data_get(obj);
1922 ecore_evas_override_set(win->ee, override);
1923 #ifdef HAVE_ELEMENTARY_X
1924 _elm_win_xwin_update(win);
1929 * Get the override state of a window.
1931 * @param obj The window object
1932 * @return If true, the window is overridden
1937 elm_win_override_get(const Evas_Object *obj)
1940 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1941 win = elm_widget_data_get(obj);
1942 if (!win) return EINA_FALSE;
1943 return ecore_evas_override_get(win->ee);
1947 * Set the fullscreen state of a window.
1949 * @param obj The window object
1950 * @param fullscreen If true, the window is fullscreen
1955 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1958 ELM_CHECK_WIDTYPE(obj, widtype);
1959 win = elm_widget_data_get(obj);
1962 // YYY: handle if win->img_obj
1963 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1964 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1965 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1967 // these engines... can ONLY be fullscreen
1972 ecore_evas_fullscreen_set(win->ee, fullscreen);
1973 #ifdef HAVE_ELEMENTARY_X
1974 _elm_win_xwin_update(win);
1977 #undef ENGINE_COMPARE
1981 * Get the fullscreen state of a window.
1983 * @param obj The window object
1984 * @return If true, the window is fullscreen
1989 elm_win_fullscreen_get(const Evas_Object *obj)
1992 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1993 win = elm_widget_data_get(obj);
1994 if (!win) return EINA_FALSE;
1996 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1997 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1998 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2000 // these engines... can ONLY be fullscreen
2005 return ecore_evas_fullscreen_get(win->ee);
2007 #undef ENGINE_COMPARE
2011 * Set the maximized state of a window.
2013 * @param obj The window object
2014 * @param maximized If true, the window is maximized
2019 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2022 ELM_CHECK_WIDTYPE(obj, widtype);
2023 win = elm_widget_data_get(obj);
2025 // YYY: handle if win->img_obj
2026 ecore_evas_maximized_set(win->ee, maximized);
2027 #ifdef HAVE_ELEMENTARY_X
2028 _elm_win_xwin_update(win);
2033 * Get the maximized state of a window.
2035 * @param obj The window object
2036 * @return If true, the window is maximized
2041 elm_win_maximized_get(const Evas_Object *obj)
2044 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2045 win = elm_widget_data_get(obj);
2046 if (!win) return EINA_FALSE;
2047 return ecore_evas_maximized_get(win->ee);
2051 * Set the iconified state of a window.
2053 * @param obj The window object
2054 * @param iconified If true, the window is iconified
2059 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2062 ELM_CHECK_WIDTYPE(obj, widtype);
2063 win = elm_widget_data_get(obj);
2065 ecore_evas_iconified_set(win->ee, iconified);
2066 #ifdef HAVE_ELEMENTARY_X
2067 _elm_win_xwin_update(win);
2072 * Get the iconified state of a window.
2074 * @param obj The window object
2075 * @return If true, the window is iconified
2080 elm_win_iconified_get(const Evas_Object *obj)
2083 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2084 win = elm_widget_data_get(obj);
2085 if (!win) return EINA_FALSE;
2086 return ecore_evas_iconified_get(win->ee);
2090 * Set the layer of the window.
2092 * @param obj The window object
2093 * @param layer The layer of the window
2098 elm_win_layer_set(Evas_Object *obj, int layer)
2101 ELM_CHECK_WIDTYPE(obj, widtype);
2102 win = elm_widget_data_get(obj);
2104 ecore_evas_layer_set(win->ee, layer);
2105 #ifdef HAVE_ELEMENTARY_X
2106 _elm_win_xwin_update(win);
2111 * Get the layer of the window.
2113 * @param obj The window object
2114 * @return The layer of the window
2119 elm_win_layer_get(const Evas_Object *obj)
2122 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2123 win = elm_widget_data_get(obj);
2124 if (!win) return -1;
2125 return ecore_evas_layer_get(win->ee);
2129 * Set the rotation of the window.
2131 * @param obj The window object
2132 * @param rotation The rotation of the window, in degrees (0-360)
2137 elm_win_rotation_set(Evas_Object *obj, int rotation)
2140 ELM_CHECK_WIDTYPE(obj, widtype);
2141 win = elm_widget_data_get(obj);
2143 if (win->rot == rotation) return;
2144 win->rot = rotation;
2145 ecore_evas_rotation_set(win->ee, rotation);
2146 evas_object_size_hint_min_set(obj, -1, -1);
2147 evas_object_size_hint_max_set(obj, -1, -1);
2148 _elm_win_eval_subobjs(obj);
2149 #ifdef HAVE_ELEMENTARY_X
2150 _elm_win_xwin_update(win);
2155 * Rotates the window and resizes it
2157 * @param obj The window object
2158 * @param layer The rotation of the window in degrees (0-360)
2163 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2166 ELM_CHECK_WIDTYPE(obj, widtype);
2167 win = elm_widget_data_get(obj);
2169 if (win->rot == rotation) return;
2170 win->rot = rotation;
2171 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2172 evas_object_size_hint_min_set(obj, -1, -1);
2173 evas_object_size_hint_max_set(obj, -1, -1);
2174 _elm_win_eval_subobjs(obj);
2175 #ifdef HAVE_ELEMENTARY_X
2176 _elm_win_xwin_update(win);
2181 * Get the rotation of the window.
2183 * @param obj The window object
2184 * @return The rotation of the window in degrees (0-360)
2189 elm_win_rotation_get(const Evas_Object *obj)
2192 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2193 win = elm_widget_data_get(obj);
2194 if (!win) return -1;
2199 * Set the sticky state of the window.
2201 * @param obj The window object
2202 * @param sticky If true, the window's sticky state is enabled
2207 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2210 ELM_CHECK_WIDTYPE(obj, widtype);
2211 win = elm_widget_data_get(obj);
2213 ecore_evas_sticky_set(win->ee, sticky);
2214 #ifdef HAVE_ELEMENTARY_X
2215 _elm_win_xwin_update(win);
2220 * Get the sticky state of the window.
2222 * @param obj The window object
2223 * @return If true, the window's sticky state is enabled
2228 elm_win_sticky_get(const Evas_Object *obj)
2231 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2232 win = elm_widget_data_get(obj);
2233 if (!win) return EINA_FALSE;
2234 return ecore_evas_sticky_get(win->ee);
2238 * Sets the keyboard mode of the window.
2240 * @param obj The window object
2241 * @param mode The mode to set; one of:
2242 * ELM_WIN_KEYBOARD_UNKNOWN
2243 * ELM_WIN_KEYBOARD_OFF
2244 * ELM_WIN_KEYBOARD_ON
2245 * ELM_WIN_KEYBOARD_ALPHA
2246 * ELM_WIN_KEYBOARD_NUMERIC
2247 * ELM_WIN_KEYBOARD_PIN
2248 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2249 * ELM_WIN_KEYBOARD_HEX
2250 * ELM_WIN_KEYBOARD_TERMINAL
2251 * ELM_WIN_KEYBOARD_PASSWORD
2252 * ELM_WIN_KEYBOARD_IP
2253 * ELM_WIN_KEYBOARD_HOST
2254 * ELM_WIN_KEYBOARD_FILE
2255 * ELM_WIN_KEYBOARD_URL
2256 * ELM_WIN_KEYBOARD_KEYPAD
2257 * ELM_WIN_KEYBOARD_J2ME
2262 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2265 ELM_CHECK_WIDTYPE(obj, widtype);
2266 win = elm_widget_data_get(obj);
2268 if (mode == win->kbdmode) return;
2269 #ifdef HAVE_ELEMENTARY_X
2270 _elm_win_xwindow_get(win);
2272 win->kbdmode = mode;
2273 #ifdef HAVE_ELEMENTARY_X
2275 ecore_x_e_virtual_keyboard_state_set
2276 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2281 * Gets the keyboard mode of the window.
2283 * @param obj The window object
2284 * @return The mode; one of:
2285 * ELM_WIN_KEYBOARD_UNKNOWN
2286 * ELM_WIN_KEYBOARD_OFF
2287 * ELM_WIN_KEYBOARD_ON
2288 * ELM_WIN_KEYBOARD_ALPHA
2289 * ELM_WIN_KEYBOARD_NUMERIC
2290 * ELM_WIN_KEYBOARD_PIN
2291 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2292 * ELM_WIN_KEYBOARD_HEX
2293 * ELM_WIN_KEYBOARD_TERMINAL
2294 * ELM_WIN_KEYBOARD_PASSWORD
2295 * ELM_WIN_KEYBOARD_IP
2296 * ELM_WIN_KEYBOARD_HOST
2297 * ELM_WIN_KEYBOARD_FILE
2298 * ELM_WIN_KEYBOARD_URL
2299 * ELM_WIN_KEYBOARD_KEYPAD
2300 * ELM_WIN_KEYBOARD_J2ME
2304 EAPI Elm_Win_Keyboard_Mode
2305 elm_win_keyboard_mode_get(const Evas_Object *obj)
2308 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2309 win = elm_widget_data_get(obj);
2310 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2311 return win->kbdmode;
2315 * Sets whether the window is a keyboard.
2317 * @param obj The window object
2318 * @param is_keyboard If true, the window is a virtual keyboard
2323 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2326 ELM_CHECK_WIDTYPE(obj, widtype);
2327 win = elm_widget_data_get(obj);
2329 #ifdef HAVE_ELEMENTARY_X
2330 _elm_win_xwindow_get(win);
2332 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2337 * Gets whether the window is a keyboard.
2339 * @param obj The window object
2340 * @return If the window is a virtual keyboard
2345 elm_win_keyboard_win_get(const Evas_Object *obj)
2348 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2349 win = elm_widget_data_get(obj);
2350 if (!win) return EINA_FALSE;
2351 #ifdef HAVE_ELEMENTARY_X
2352 _elm_win_xwindow_get(win);
2354 return ecore_x_e_virtual_keyboard_get(win->xwin);
2360 * Get the screen position of a window.
2362 * @param obj The window object
2363 * @param x The int to store the x coordinate to
2364 * @param y The int to store the y coordinate to
2369 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2372 ELM_CHECK_WIDTYPE(obj, widtype);
2373 win = elm_widget_data_get(obj);
2375 if (x) *x = win->screen.x;
2376 if (y) *y = win->screen.y;
2380 * Set if this window is an illume conformant window
2382 * @param obj The window object
2383 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2388 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2391 ELM_CHECK_WIDTYPE(obj, widtype);
2392 win = elm_widget_data_get(obj);
2394 #ifdef HAVE_ELEMENTARY_X
2395 _elm_win_xwindow_get(win);
2397 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2402 * Get if this window is an illume conformant window
2404 * @param obj The window object
2405 * @return A boolean if this window is illume conformant or not
2410 elm_win_conformant_get(const Evas_Object *obj)
2413 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2414 win = elm_widget_data_get(obj);
2415 if (!win) return EINA_FALSE;
2416 #ifdef HAVE_ELEMENTARY_X
2417 _elm_win_xwindow_get(win);
2419 return ecore_x_e_illume_conformant_get(win->xwin);
2425 * Set a window to be an illume quickpanel window
2427 * By default window objects are not quickpanel windows.
2429 * @param obj The window object
2430 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2435 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2438 ELM_CHECK_WIDTYPE(obj, widtype);
2439 win = elm_widget_data_get(obj);
2441 #ifdef HAVE_ELEMENTARY_X
2442 _elm_win_xwindow_get(win);
2445 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2448 Ecore_X_Window_State states[2];
2450 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2451 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2452 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2453 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2460 * Get if this window is a quickpanel or not
2462 * @param obj The window object
2463 * @return A boolean if this window is a quickpanel or not
2468 elm_win_quickpanel_get(const Evas_Object *obj)
2471 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2472 win = elm_widget_data_get(obj);
2473 if (!win) return EINA_FALSE;
2474 #ifdef HAVE_ELEMENTARY_X
2475 _elm_win_xwindow_get(win);
2477 return ecore_x_e_illume_quickpanel_get(win->xwin);
2483 * Set the major priority of a quickpanel window
2485 * @param obj The window object
2486 * @param priority The major priority for this quickpanel
2491 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2494 ELM_CHECK_WIDTYPE(obj, widtype);
2495 win = elm_widget_data_get(obj);
2497 #ifdef HAVE_ELEMENTARY_X
2498 _elm_win_xwindow_get(win);
2500 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2505 * Get the major priority of a quickpanel window
2507 * @param obj The window object
2508 * @return The major priority of this quickpanel
2513 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2516 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2517 win = elm_widget_data_get(obj);
2518 if (!win) return -1;
2519 #ifdef HAVE_ELEMENTARY_X
2520 _elm_win_xwindow_get(win);
2522 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2528 * Set the minor priority of a quickpanel window
2530 * @param obj The window object
2531 * @param priority The minor priority for this quickpanel
2536 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2539 ELM_CHECK_WIDTYPE(obj, widtype);
2540 win = elm_widget_data_get(obj);
2542 #ifdef HAVE_ELEMENTARY_X
2543 _elm_win_xwindow_get(win);
2545 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2550 * Get the minor priority of a quickpanel window
2552 * @param obj The window object
2553 * @return The minor priority of this quickpanel
2558 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2561 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2562 win = elm_widget_data_get(obj);
2563 if (!win) return -1;
2564 #ifdef HAVE_ELEMENTARY_X
2565 _elm_win_xwindow_get(win);
2567 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2573 * Set which zone this quickpanel should appear in
2575 * @param obj The window object
2576 * @param zone The requested zone for this quickpanel
2581 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2584 ELM_CHECK_WIDTYPE(obj, widtype);
2585 win = elm_widget_data_get(obj);
2587 #ifdef HAVE_ELEMENTARY_X
2588 _elm_win_xwindow_get(win);
2590 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2595 * Get which zone this quickpanel should appear in
2597 * @param obj The window object
2598 * @return The requested zone for this quickpanel
2603 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2606 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2607 win = elm_widget_data_get(obj);
2609 #ifdef HAVE_ELEMENTARY_X
2610 _elm_win_xwindow_get(win);
2612 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2618 * Set the window to be skipped by keyboard focus
2620 * This sets the window to be skipped by normal keyboard input. This means
2621 * a window manager will be asked to not focus this window as well as omit
2622 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2624 * Call this and enable it on a window BEFORE you show it for the first time,
2625 * otherwise it may have no effect.
2627 * Use this for windows that have only output information or might only be
2628 * interacted with by the mouse or fingers, and never for typing input.
2629 * Be careful that this may have side-effects like making the window
2630 * non-accessible in some cases unless the window is specially handled. Use
2633 * @param obj The window object
2634 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2639 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2642 ELM_CHECK_WIDTYPE(obj, widtype);
2643 win = elm_widget_data_get(obj);
2645 #ifdef HAVE_ELEMENTARY_X
2646 _elm_win_xwindow_get(win);
2651 Ecore_X_Window_State states[2];
2653 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2654 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2655 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2656 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2663 * Send a command to the windowing environment
2665 * This is intended to work in touchscreen or small screen device environments
2666 * where there is a more simplistic window management policy in place. This
2667 * uses the window object indicated to select which part of the environment
2668 * to control (the part that this window lives in), and provides a command
2669 * and an optional parameter structure (use NULL for this if not needed).
2671 * @param obj The window object that lives in the environment to control
2672 * @param command The command to send
2673 * @param params Optional parameters for the command
2678 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2681 ELM_CHECK_WIDTYPE(obj, widtype);
2682 win = elm_widget_data_get(obj);
2684 #ifdef HAVE_ELEMENTARY_X
2685 _elm_win_xwindow_get(win);
2690 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2691 ecore_x_e_illume_focus_back_send(win->xwin);
2693 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2694 ecore_x_e_illume_focus_forward_send(win->xwin);
2696 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2697 ecore_x_e_illume_focus_home_send(win->xwin);
2699 case ELM_ILLUME_COMMAND_CLOSE:
2700 ecore_x_e_illume_close_send(win->xwin);
2710 * Get the inlined image object handle
2712 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2713 * then the window is in fact an evas image object inlined in the parent
2714 * canvas. You can get this object (be careful to not manipulate it as it
2715 * is under control of elementary), and use it to do things like get pixel
2716 * data, save the image to a file, etc.
2718 * @param obj The window object to get the inlined image from
2719 * @return The inlined image object, or NULL if none exists
2724 elm_win_inlined_image_object_get(Evas_Object *obj)
2727 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2728 win = elm_widget_data_get(obj);
2729 if (!win) return NULL;
2730 return win->img_obj;
2734 * Set the enabled status for the focus highlight in a window
2736 * This function will enable or disable the focus highlight only for the
2737 * given window, regardless of the global setting for it
2739 * @param obj The window where to enable the highlight
2740 * @param enabled The enabled value for the highlight
2745 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2749 ELM_CHECK_WIDTYPE(obj, widtype);
2751 win = elm_widget_data_get(obj);
2752 enabled = !!enabled;
2753 if (win->focus_highlight.enabled == enabled)
2756 win->focus_highlight.enabled = enabled;
2758 if (win->focus_highlight.enabled)
2759 _elm_win_focus_highlight_init(win);
2761 _elm_win_focus_highlight_shutdown(win);
2765 * Get the enabled value of the focus highlight for this window
2767 * @param obj The window in which to check if the focus highlight is enabled
2769 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2774 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2778 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2780 win = elm_widget_data_get(obj);
2781 return win->focus_highlight.enabled;
2785 * Set the style for the focus highlight on this window
2787 * Sets the style to use for theming the highlight of focused objects on
2788 * the given window. If @p style is NULL, the default will be used.
2790 * @param obj The window where to set the style
2791 * @param style The style to set
2796 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2800 ELM_CHECK_WIDTYPE(obj, widtype);
2802 win = elm_widget_data_get(obj);
2803 eina_stringshare_replace(&win->focus_highlight.style, style);
2804 win->focus_highlight.changed_theme = EINA_TRUE;
2805 _elm_win_focus_highlight_reconfigure_job_start(win);
2809 * Get the style set for the focus highlight object
2811 * Gets the style set for this windows highilght object, or NULL if none
2814 * @param obj The window to retrieve the highlights style from
2816 * @return The style set or NULL if none was. Default is used in that case.
2821 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2825 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2827 win = elm_widget_data_get(obj);
2828 return win->focus_highlight.style;
2831 typedef struct _Widget_Data Widget_Data;
2836 Evas_Object *content;
2839 static void _del_hook(Evas_Object *obj);
2840 static void _theme_hook(Evas_Object *obj);
2841 static void _sizing_eval(Evas_Object *obj);
2842 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2843 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2845 static const char *widtype2 = NULL;
2848 _del_hook(Evas_Object *obj)
2850 Widget_Data *wd = elm_widget_data_get(obj);
2856 _theme_hook(Evas_Object *obj)
2858 Widget_Data *wd = elm_widget_data_get(obj);
2859 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2861 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2866 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2868 Widget_Data *wd = elm_widget_data_get(obj);
2873 /* Try Focus cycle in subitem */
2876 elm_widget_focus_next_get(wd->content, dir, next);
2881 *next = (Evas_Object *)obj;
2886 _sizing_eval(Evas_Object *obj)
2888 Widget_Data *wd = elm_widget_data_get(obj);
2889 Evas_Coord minw = -1, minh = -1;
2891 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2892 edje_object_size_min_calc(wd->frm, &minw, &minh);
2893 evas_object_size_hint_min_set(obj, minw, minh);
2894 evas_object_size_hint_max_set(obj, -1, -1);
2898 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2904 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2906 Widget_Data *wd = elm_widget_data_get(obj);
2907 Evas_Object *sub = event_info;
2908 if (sub == wd->content)
2910 evas_object_event_callback_del_full
2911 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2918 * @defgroup Inwin Inwin
2920 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2923 elm_win_inwin_add(Evas_Object *obj)
2929 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2930 win = elm_widget_data_get(obj);
2931 if (!win) return NULL;
2932 wd = ELM_NEW(Widget_Data);
2933 obj2 = elm_widget_add(win->evas);
2934 elm_widget_type_set(obj2, "inwin");
2935 ELM_SET_WIDTYPE(widtype2, "inwin");
2936 elm_widget_sub_object_add(obj, obj2);
2937 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2938 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2939 elm_win_resize_object_add(obj, obj2);
2941 elm_widget_data_set(obj2, wd);
2942 elm_widget_del_hook_set(obj2, _del_hook);
2943 elm_widget_theme_hook_set(obj2, _theme_hook);
2944 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2945 elm_widget_can_focus_set(obj2, EINA_TRUE);
2946 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2948 wd->frm = edje_object_add(win->evas);
2949 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2950 elm_widget_resize_object_set(obj2, wd->frm);
2952 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2959 * Activates an inwin object
2961 * @param obj The inwin to activate
2966 elm_win_inwin_activate(Evas_Object *obj)
2968 ELM_CHECK_WIDTYPE(obj, widtype2);
2969 Widget_Data *wd = elm_widget_data_get(obj);
2971 evas_object_raise(obj);
2972 evas_object_show(obj);
2973 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2974 elm_object_focus(obj);
2978 * Set the content of an inwin object.
2980 * Once the content object is set, a previously set one will be deleted.
2981 * If you want to keep that old content object, use the
2982 * elm_win_inwin_content_unset() function.
2984 * @param obj The inwin object
2985 * @param content The object to set as content
2990 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2992 ELM_CHECK_WIDTYPE(obj, widtype2);
2993 Widget_Data *wd = elm_widget_data_get(obj);
2995 if (wd->content == content) return;
2996 if (wd->content) evas_object_del(wd->content);
2997 wd->content = content;
3000 elm_widget_sub_object_add(obj, content);
3001 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3002 _changed_size_hints, obj);
3003 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3009 * Get the content of an inwin object.
3011 * Return the content object which is set for this widget.
3013 * @param obj The inwin object
3014 * @return The content that is being used
3019 elm_win_inwin_content_get(const Evas_Object *obj)
3021 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3022 Widget_Data *wd = elm_widget_data_get(obj);
3023 if (!wd) return NULL;
3028 * Unset the content of an inwin object.
3030 * Unparent and return the content object which was set for this widget.
3032 * @param obj The inwin object
3033 * @return The content that was being used
3038 elm_win_inwin_content_unset(Evas_Object *obj)
3040 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3041 Widget_Data *wd = elm_widget_data_get(obj);
3042 if (!wd) return NULL;
3043 if (!wd->content) return NULL;
3044 Evas_Object *content = wd->content;
3045 elm_widget_sub_object_del(obj, wd->content);
3046 edje_object_part_unswallow(wd->frm, wd->content);
3051 /* windowing spcific calls - shall we do this differently? */
3053 static Ecore_X_Window
3054 _elm_ee_win_get(const Evas_Object *obj)
3057 #ifdef HAVE_ELEMENTARY_X
3058 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3059 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3065 * Get the Ecore_X_Window of an Evas_Object
3067 * @param obj The object
3069 * @return The Ecore_X_Window of @p obj
3074 elm_win_xwindow_get(const Evas_Object *obj)
3076 Ecore_X_Window xwin = 0;
3081 type = elm_widget_type_get(obj);
3082 if (!type) return 0;
3083 if (type != widtype) return _elm_ee_win_get(obj);
3084 #ifdef HAVE_ELEMENTARY_X
3085 win = elm_widget_data_get(obj);
3086 if (!win) return xwin;
3087 if (win->xwin) return win->xwin;
3088 if (win->parent) return elm_win_xwindow_get(win->parent);