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))
1374 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1375 FALLBACK_TRY("OpenGL");
1376 #ifdef HAVE_ELEMENTARY_X
1377 win->client_message_handler = ecore_event_handler_add
1378 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1381 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1383 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1384 FALLBACK_TRY("Sofware Win32");
1386 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1388 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1389 FALLBACK_TRY("Sofware-16-WinCE");
1391 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1393 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1394 FALLBACK_TRY("Sofware SDL");
1396 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1398 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1399 FALLBACK_TRY("Sofware-16-SDL");
1401 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1403 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1404 FALLBACK_TRY("OpenGL SDL");
1406 else if (!strncmp(_elm_config->engine, "shot:", 5))
1408 win->ee = ecore_evas_buffer_new(1, 1);
1409 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1410 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1418 ERR("Cannot create window.");
1422 #ifdef HAVE_ELEMENTARY_X
1423 _elm_win_xwindow_get(win);
1425 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1426 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1427 // bg pixmap done by x - has other issues like can be redrawn by x before it
1428 // is filled/ready by app
1429 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1432 win->parent = parent;
1434 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1435 _elm_win_obj_callback_parent_del, win);
1437 win->evas = ecore_evas_get(win->ee);
1438 win->win_obj = elm_widget_add(win->evas);
1439 elm_widget_type_set(win->win_obj, "win");
1440 ELM_SET_WIDTYPE(widtype, "win");
1441 elm_widget_data_set(win->win_obj, win);
1442 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1443 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1444 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1445 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1446 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1447 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1448 evas_object_move(win->win_obj, 0, 0);
1449 evas_object_resize(win->win_obj, 1, 1);
1450 evas_object_layer_set(win->win_obj, 50);
1451 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1453 ecore_evas_object_associate(win->ee, win->win_obj,
1454 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1455 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1456 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1457 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1458 _elm_win_obj_callback_show, win);
1459 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1460 _elm_win_obj_callback_hide, win);
1461 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1462 _elm_win_obj_callback_del, win);
1463 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1464 _elm_win_obj_callback_move, win);
1465 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1466 _elm_win_obj_callback_resize, win);
1468 evas_object_intercept_move_callback_add(win->win_obj,
1469 _elm_win_obj_intercept_move, win);
1470 evas_object_intercept_show_callback_add(win->win_obj,
1471 _elm_win_obj_intercept_show, win);
1473 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1474 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1475 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1476 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1477 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1478 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1479 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1480 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1481 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1482 evas_font_path_append(win->evas, fontpath);
1483 if (!_elm_config->font_hinting)
1484 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1485 else if (_elm_config->font_hinting == 1)
1486 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1487 else if (_elm_config->font_hinting == 2)
1488 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1490 #ifdef HAVE_ELEMENTARY_X
1491 _elm_win_xwin_update(win);
1494 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1496 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1498 ecore_evas_fullscreen_set(win->ee, 1);
1500 #undef ENGINE_COMPARE
1502 if (_elm_config->focus_highlight_enable)
1503 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1506 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1507 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1508 _debug_key_down, win);
1510 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1512 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1515 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1517 return win->win_obj;
1521 * Add @p subobj as a resize object of window @p obj.
1523 * @param obj The window object
1524 * @param subobj The resize object to add
1529 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1533 ELM_CHECK_WIDTYPE(obj, widtype);
1534 win = elm_widget_data_get(obj);
1536 win->subobjs = eina_list_append(win->subobjs, subobj);
1537 elm_widget_sub_object_add(obj, subobj);
1538 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1539 _elm_win_subobj_callback_del, obj);
1540 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1541 _elm_win_subobj_callback_changed_size_hints,
1543 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1544 evas_object_move(subobj, 0, 0);
1545 evas_object_resize(subobj, w, h);
1546 _elm_win_eval_subobjs(obj);
1550 * Delete @p subobj as a resize object of window @p obj.
1552 * @param obj The window object
1553 * @param subobj The resize object to add
1558 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1561 ELM_CHECK_WIDTYPE(obj, widtype);
1562 win = elm_widget_data_get(obj);
1564 evas_object_event_callback_del_full(subobj,
1565 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1566 _elm_win_subobj_callback_changed_size_hints,
1568 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1569 _elm_win_subobj_callback_del, obj);
1570 win->subobjs = eina_list_remove(win->subobjs, subobj);
1571 elm_widget_sub_object_del(obj, subobj);
1572 _elm_win_eval_subobjs(obj);
1576 * Set the title of the window
1578 * @param obj The window object
1579 * @param title The title to set
1584 elm_win_title_set(Evas_Object *obj, const char *title)
1587 ELM_CHECK_WIDTYPE(obj, widtype);
1588 win = elm_widget_data_get(obj);
1590 ecore_evas_title_set(win->ee, title);
1594 * Get the title of the window
1596 * @param obj The window object
1602 elm_win_title_get(const Evas_Object *obj)
1605 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1606 win = elm_widget_data_get(obj);
1607 if (!win) return NULL;
1608 return ecore_evas_title_get(win->ee);
1612 * Set the window's autodel state.
1614 * @param obj The window object
1615 * @param autodel If true, the window will automatically delete itself when closed
1620 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1623 ELM_CHECK_WIDTYPE(obj, widtype);
1624 win = elm_widget_data_get(obj);
1626 win->autodel = autodel;
1630 * Get the window's autodel state.
1632 * @param obj The window object
1633 * @return If the window will automatically delete itself when closed
1638 elm_win_autodel_get(const Evas_Object *obj)
1641 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1642 win = elm_widget_data_get(obj);
1643 if (!win) return EINA_FALSE;
1644 return win->autodel;
1648 * Activate a window object.
1650 * @param obj The window object
1655 elm_win_activate(Evas_Object *obj)
1658 ELM_CHECK_WIDTYPE(obj, widtype);
1659 win = elm_widget_data_get(obj);
1661 ecore_evas_activate(win->ee);
1665 * Lower a window object.
1667 * @param obj The window object
1672 elm_win_lower(Evas_Object *obj)
1675 ELM_CHECK_WIDTYPE(obj, widtype);
1676 win = elm_widget_data_get(obj);
1678 ecore_evas_lower(win->ee);
1682 * Raise a window object.
1684 * @param obj The window object
1689 elm_win_raise(Evas_Object *obj)
1692 ELM_CHECK_WIDTYPE(obj, widtype);
1693 win = elm_widget_data_get(obj);
1695 ecore_evas_raise(win->ee);
1699 * Set the borderless state of a window.
1701 * @param obj The window object
1702 * @param borderless If true, the window is borderless
1707 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1710 ELM_CHECK_WIDTYPE(obj, widtype);
1711 win = elm_widget_data_get(obj);
1713 ecore_evas_borderless_set(win->ee, borderless);
1714 #ifdef HAVE_ELEMENTARY_X
1715 _elm_win_xwin_update(win);
1720 * Get the borderless state of a window.
1722 * @param obj The window object
1723 * @return If true, the window is borderless
1728 elm_win_borderless_get(const Evas_Object *obj)
1731 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1732 win = elm_widget_data_get(obj);
1733 if (!win) return EINA_FALSE;
1734 return ecore_evas_borderless_get(win->ee);
1738 * Set the shaped state of a window.
1740 * @param obj The window object
1741 * @param shaped If true, the window is shaped
1746 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1749 ELM_CHECK_WIDTYPE(obj, widtype);
1750 win = elm_widget_data_get(obj);
1752 ecore_evas_shaped_set(win->ee, shaped);
1753 #ifdef HAVE_ELEMENTARY_X
1754 _elm_win_xwin_update(win);
1759 * Get the shaped state of a window.
1761 * @param obj The window object
1762 * @return If true, the window is shaped
1767 elm_win_shaped_get(const Evas_Object *obj)
1770 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1771 win = elm_widget_data_get(obj);
1772 if (!win) return EINA_FALSE;
1773 return ecore_evas_shaped_get(win->ee);
1777 * Set the alpha channel state of a window.
1779 * @param obj The window object
1780 * @param alpha If true, the window has an alpha channel
1785 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1788 ELM_CHECK_WIDTYPE(obj, widtype);
1789 win = elm_widget_data_get(obj);
1794 else if (win->img_obj)
1796 evas_object_image_alpha_set(win->img_obj, alpha);
1800 #ifdef HAVE_ELEMENTARY_X
1805 if (!_elm_config->compositing)
1806 elm_win_shaped_set(obj, alpha);
1808 ecore_evas_alpha_set(win->ee, alpha);
1811 ecore_evas_alpha_set(win->ee, alpha);
1812 _elm_win_xwin_update(win);
1816 ecore_evas_alpha_set(win->ee, alpha);
1821 * Get the alpha channel state of a window.
1823 * @param obj The window object
1824 * @return If true, the window has an alpha channel
1829 elm_win_alpha_get(const Evas_Object *obj)
1832 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1833 win = elm_widget_data_get(obj);
1834 if (!win) return EINA_FALSE;
1835 return ecore_evas_alpha_get(win->ee);
1839 * Set the transparency state of a window.
1841 * @param obj The window object
1842 * @param transparent If true, the window is transparent
1847 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1850 ELM_CHECK_WIDTYPE(obj, widtype);
1851 win = elm_widget_data_get(obj);
1857 else if (win->img_obj)
1859 evas_object_image_alpha_set(win->img_obj, transparent);
1863 #ifdef HAVE_ELEMENTARY_X
1866 ecore_evas_transparent_set(win->ee, transparent);
1867 _elm_win_xwin_update(win);
1871 ecore_evas_transparent_set(win->ee, transparent);
1876 * Get the transparency state of a window.
1878 * @param obj The window object
1879 * @return If true, the window is transparent
1884 elm_win_transparent_get(const Evas_Object *obj)
1887 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1888 win = elm_widget_data_get(obj);
1889 if (!win) return EINA_FALSE;
1891 return ecore_evas_transparent_get(win->ee);
1895 * Set the override state of a window.
1897 * @param obj The window object
1898 * @param override If true, the window is overridden
1903 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1906 ELM_CHECK_WIDTYPE(obj, widtype);
1907 win = elm_widget_data_get(obj);
1909 ecore_evas_override_set(win->ee, override);
1910 #ifdef HAVE_ELEMENTARY_X
1911 _elm_win_xwin_update(win);
1916 * Get the override state of a window.
1918 * @param obj The window object
1919 * @return If true, the window is overridden
1924 elm_win_override_get(const Evas_Object *obj)
1927 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1928 win = elm_widget_data_get(obj);
1929 if (!win) return EINA_FALSE;
1930 return ecore_evas_override_get(win->ee);
1934 * Set the fullscreen state of a window.
1936 * @param obj The window object
1937 * @param fullscreen If true, the window is fullscreen
1942 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1945 ELM_CHECK_WIDTYPE(obj, widtype);
1946 win = elm_widget_data_get(obj);
1949 // YYY: handle if win->img_obj
1950 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1951 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1952 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1954 // these engines... can ONLY be fullscreen
1959 ecore_evas_fullscreen_set(win->ee, fullscreen);
1960 #ifdef HAVE_ELEMENTARY_X
1961 _elm_win_xwin_update(win);
1964 #undef ENGINE_COMPARE
1968 * Get the fullscreen state of a window.
1970 * @param obj The window object
1971 * @return If true, the window is fullscreen
1976 elm_win_fullscreen_get(const Evas_Object *obj)
1979 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1980 win = elm_widget_data_get(obj);
1981 if (!win) return EINA_FALSE;
1983 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1984 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1985 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1987 // these engines... can ONLY be fullscreen
1992 return ecore_evas_fullscreen_get(win->ee);
1994 #undef ENGINE_COMPARE
1998 * Set the maximized state of a window.
2000 * @param obj The window object
2001 * @param maximized If true, the window is maximized
2006 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2009 ELM_CHECK_WIDTYPE(obj, widtype);
2010 win = elm_widget_data_get(obj);
2012 // YYY: handle if win->img_obj
2013 ecore_evas_maximized_set(win->ee, maximized);
2014 #ifdef HAVE_ELEMENTARY_X
2015 _elm_win_xwin_update(win);
2020 * Get the maximized state of a window.
2022 * @param obj The window object
2023 * @return If true, the window is maximized
2028 elm_win_maximized_get(const Evas_Object *obj)
2031 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2032 win = elm_widget_data_get(obj);
2033 if (!win) return EINA_FALSE;
2034 return ecore_evas_maximized_get(win->ee);
2038 * Set the iconified state of a window.
2040 * @param obj The window object
2041 * @param iconified If true, the window is iconified
2046 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2049 ELM_CHECK_WIDTYPE(obj, widtype);
2050 win = elm_widget_data_get(obj);
2052 ecore_evas_iconified_set(win->ee, iconified);
2053 #ifdef HAVE_ELEMENTARY_X
2054 _elm_win_xwin_update(win);
2059 * Get the iconified state of a window.
2061 * @param obj The window object
2062 * @return If true, the window is iconified
2067 elm_win_iconified_get(const Evas_Object *obj)
2070 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2071 win = elm_widget_data_get(obj);
2072 if (!win) return EINA_FALSE;
2073 return ecore_evas_iconified_get(win->ee);
2077 * Set the layer of the window.
2079 * @param obj The window object
2080 * @param layer The layer of the window
2085 elm_win_layer_set(Evas_Object *obj, int layer)
2088 ELM_CHECK_WIDTYPE(obj, widtype);
2089 win = elm_widget_data_get(obj);
2091 ecore_evas_layer_set(win->ee, layer);
2092 #ifdef HAVE_ELEMENTARY_X
2093 _elm_win_xwin_update(win);
2098 * Get the layer of the window.
2100 * @param obj The window object
2101 * @return The layer of the window
2106 elm_win_layer_get(const Evas_Object *obj)
2109 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2110 win = elm_widget_data_get(obj);
2111 if (!win) return -1;
2112 return ecore_evas_layer_get(win->ee);
2116 * Set the rotation of the window.
2118 * @param obj The window object
2119 * @param rotation The rotation of the window, in degrees (0-360)
2124 elm_win_rotation_set(Evas_Object *obj, int rotation)
2127 ELM_CHECK_WIDTYPE(obj, widtype);
2128 win = elm_widget_data_get(obj);
2130 if (win->rot == rotation) return;
2131 win->rot = rotation;
2132 ecore_evas_rotation_set(win->ee, rotation);
2133 evas_object_size_hint_min_set(obj, -1, -1);
2134 evas_object_size_hint_max_set(obj, -1, -1);
2135 _elm_win_eval_subobjs(obj);
2136 #ifdef HAVE_ELEMENTARY_X
2137 _elm_win_xwin_update(win);
2142 * Rotates the window and resizes it
2144 * @param obj The window object
2145 * @param layer The rotation of the window in degrees (0-360)
2150 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2153 ELM_CHECK_WIDTYPE(obj, widtype);
2154 win = elm_widget_data_get(obj);
2156 if (win->rot == rotation) return;
2157 win->rot = rotation;
2158 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2159 evas_object_size_hint_min_set(obj, -1, -1);
2160 evas_object_size_hint_max_set(obj, -1, -1);
2161 _elm_win_eval_subobjs(obj);
2162 #ifdef HAVE_ELEMENTARY_X
2163 _elm_win_xwin_update(win);
2168 * Get the rotation of the window.
2170 * @param obj The window object
2171 * @return The rotation of the window in degrees (0-360)
2176 elm_win_rotation_get(const Evas_Object *obj)
2179 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2180 win = elm_widget_data_get(obj);
2181 if (!win) return -1;
2186 * Set the sticky state of the window.
2188 * @param obj The window object
2189 * @param sticky If true, the window's sticky state is enabled
2194 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2197 ELM_CHECK_WIDTYPE(obj, widtype);
2198 win = elm_widget_data_get(obj);
2200 ecore_evas_sticky_set(win->ee, sticky);
2201 #ifdef HAVE_ELEMENTARY_X
2202 _elm_win_xwin_update(win);
2207 * Get the sticky state of the window.
2209 * @param obj The window object
2210 * @return If true, the window's sticky state is enabled
2215 elm_win_sticky_get(const Evas_Object *obj)
2218 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2219 win = elm_widget_data_get(obj);
2220 if (!win) return EINA_FALSE;
2221 return ecore_evas_sticky_get(win->ee);
2225 * Sets the keyboard mode of the window.
2227 * @param obj The window object
2228 * @param mode The mode to set; one of:
2229 * ELM_WIN_KEYBOARD_UNKNOWN
2230 * ELM_WIN_KEYBOARD_OFF
2231 * ELM_WIN_KEYBOARD_ON
2232 * ELM_WIN_KEYBOARD_ALPHA
2233 * ELM_WIN_KEYBOARD_NUMERIC
2234 * ELM_WIN_KEYBOARD_PIN
2235 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2236 * ELM_WIN_KEYBOARD_HEX
2237 * ELM_WIN_KEYBOARD_TERMINAL
2238 * ELM_WIN_KEYBOARD_PASSWORD
2239 * ELM_WIN_KEYBOARD_IP
2240 * ELM_WIN_KEYBOARD_HOST
2241 * ELM_WIN_KEYBOARD_FILE
2242 * ELM_WIN_KEYBOARD_URL
2243 * ELM_WIN_KEYBOARD_KEYPAD
2244 * ELM_WIN_KEYBOARD_J2ME
2249 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2252 ELM_CHECK_WIDTYPE(obj, widtype);
2253 win = elm_widget_data_get(obj);
2255 if (mode == win->kbdmode) return;
2256 #ifdef HAVE_ELEMENTARY_X
2257 _elm_win_xwindow_get(win);
2259 win->kbdmode = mode;
2260 #ifdef HAVE_ELEMENTARY_X
2262 ecore_x_e_virtual_keyboard_state_set
2263 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2268 * Gets the keyboard mode of the window.
2270 * @param obj The window object
2271 * @return The mode; one of:
2272 * ELM_WIN_KEYBOARD_UNKNOWN
2273 * ELM_WIN_KEYBOARD_OFF
2274 * ELM_WIN_KEYBOARD_ON
2275 * ELM_WIN_KEYBOARD_ALPHA
2276 * ELM_WIN_KEYBOARD_NUMERIC
2277 * ELM_WIN_KEYBOARD_PIN
2278 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2279 * ELM_WIN_KEYBOARD_HEX
2280 * ELM_WIN_KEYBOARD_TERMINAL
2281 * ELM_WIN_KEYBOARD_PASSWORD
2282 * ELM_WIN_KEYBOARD_IP
2283 * ELM_WIN_KEYBOARD_HOST
2284 * ELM_WIN_KEYBOARD_FILE
2285 * ELM_WIN_KEYBOARD_URL
2286 * ELM_WIN_KEYBOARD_KEYPAD
2287 * ELM_WIN_KEYBOARD_J2ME
2291 EAPI Elm_Win_Keyboard_Mode
2292 elm_win_keyboard_mode_get(const Evas_Object *obj)
2295 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2296 win = elm_widget_data_get(obj);
2297 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2298 return win->kbdmode;
2302 * Sets whether the window is a keyboard.
2304 * @param obj The window object
2305 * @param is_keyboard If true, the window is a virtual keyboard
2310 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2313 ELM_CHECK_WIDTYPE(obj, widtype);
2314 win = elm_widget_data_get(obj);
2316 #ifdef HAVE_ELEMENTARY_X
2317 _elm_win_xwindow_get(win);
2319 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2324 * Gets whether the window is a keyboard.
2326 * @param obj The window object
2327 * @return If the window is a virtual keyboard
2332 elm_win_keyboard_win_get(const Evas_Object *obj)
2335 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2336 win = elm_widget_data_get(obj);
2337 if (!win) return EINA_FALSE;
2338 #ifdef HAVE_ELEMENTARY_X
2339 _elm_win_xwindow_get(win);
2341 return ecore_x_e_virtual_keyboard_get(win->xwin);
2347 * Get the screen position of a window.
2349 * @param obj The window object
2350 * @param x The int to store the x coordinate to
2351 * @param y The int to store the y coordinate to
2356 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2359 ELM_CHECK_WIDTYPE(obj, widtype);
2360 win = elm_widget_data_get(obj);
2362 if (x) *x = win->screen.x;
2363 if (y) *y = win->screen.y;
2367 * Set if this window is an illume conformant window
2369 * @param obj The window object
2370 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2375 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2378 ELM_CHECK_WIDTYPE(obj, widtype);
2379 win = elm_widget_data_get(obj);
2381 #ifdef HAVE_ELEMENTARY_X
2382 _elm_win_xwindow_get(win);
2384 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2389 * Get if this window is an illume conformant window
2391 * @param obj The window object
2392 * @return A boolean if this window is illume conformant or not
2397 elm_win_conformant_get(const Evas_Object *obj)
2400 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2401 win = elm_widget_data_get(obj);
2402 if (!win) return EINA_FALSE;
2403 #ifdef HAVE_ELEMENTARY_X
2404 _elm_win_xwindow_get(win);
2406 return ecore_x_e_illume_conformant_get(win->xwin);
2412 * Set a window to be an illume quickpanel window
2414 * By default window objects are not quickpanel windows.
2416 * @param obj The window object
2417 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2422 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2425 ELM_CHECK_WIDTYPE(obj, widtype);
2426 win = elm_widget_data_get(obj);
2428 #ifdef HAVE_ELEMENTARY_X
2429 _elm_win_xwindow_get(win);
2432 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2435 Ecore_X_Window_State states[2];
2437 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2438 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2439 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2440 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2447 * Get if this window is a quickpanel or not
2449 * @param obj The window object
2450 * @return A boolean if this window is a quickpanel or not
2455 elm_win_quickpanel_get(const Evas_Object *obj)
2458 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2459 win = elm_widget_data_get(obj);
2460 if (!win) return EINA_FALSE;
2461 #ifdef HAVE_ELEMENTARY_X
2462 _elm_win_xwindow_get(win);
2464 return ecore_x_e_illume_quickpanel_get(win->xwin);
2470 * Set the major priority of a quickpanel window
2472 * @param obj The window object
2473 * @param priority The major priority for this quickpanel
2478 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2481 ELM_CHECK_WIDTYPE(obj, widtype);
2482 win = elm_widget_data_get(obj);
2484 #ifdef HAVE_ELEMENTARY_X
2485 _elm_win_xwindow_get(win);
2487 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2492 * Get the major priority of a quickpanel window
2494 * @param obj The window object
2495 * @return The major priority of this quickpanel
2500 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2503 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2504 win = elm_widget_data_get(obj);
2505 if (!win) return -1;
2506 #ifdef HAVE_ELEMENTARY_X
2507 _elm_win_xwindow_get(win);
2509 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2515 * Set the minor priority of a quickpanel window
2517 * @param obj The window object
2518 * @param priority The minor priority for this quickpanel
2523 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2526 ELM_CHECK_WIDTYPE(obj, widtype);
2527 win = elm_widget_data_get(obj);
2529 #ifdef HAVE_ELEMENTARY_X
2530 _elm_win_xwindow_get(win);
2532 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2537 * Get the minor priority of a quickpanel window
2539 * @param obj The window object
2540 * @return The minor priority of this quickpanel
2545 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2548 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2549 win = elm_widget_data_get(obj);
2550 if (!win) return -1;
2551 #ifdef HAVE_ELEMENTARY_X
2552 _elm_win_xwindow_get(win);
2554 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2560 * Set which zone this quickpanel should appear in
2562 * @param obj The window object
2563 * @param zone The requested zone for this quickpanel
2568 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2571 ELM_CHECK_WIDTYPE(obj, widtype);
2572 win = elm_widget_data_get(obj);
2574 #ifdef HAVE_ELEMENTARY_X
2575 _elm_win_xwindow_get(win);
2577 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2582 * Get which zone this quickpanel should appear in
2584 * @param obj The window object
2585 * @return The requested zone for this quickpanel
2590 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2593 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2594 win = elm_widget_data_get(obj);
2596 #ifdef HAVE_ELEMENTARY_X
2597 _elm_win_xwindow_get(win);
2599 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2605 * Set the window to be skipped by keyboard focus
2607 * This sets the window to be skipped by normal keyboard input. This means
2608 * a window manager will be asked to not focus this window as well as omit
2609 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2611 * Call this and enable it on a window BEFORE you show it for the first time,
2612 * otherwise it may have no effect.
2614 * Use this for windows that have only output information or might only be
2615 * interacted with by the mouse or fingers, and never for typing input.
2616 * Be careful that this may have side-effects like making the window
2617 * non-accessible in some cases unless the window is specially handled. Use
2620 * @param obj The window object
2621 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2626 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2629 ELM_CHECK_WIDTYPE(obj, widtype);
2630 win = elm_widget_data_get(obj);
2632 #ifdef HAVE_ELEMENTARY_X
2633 _elm_win_xwindow_get(win);
2638 Ecore_X_Window_State states[2];
2640 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2641 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2642 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2643 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2650 * Send a command to the windowing environment
2652 * This is intended to work in touchscreen or small screen device environments
2653 * where there is a more simplistic window management policy in place. This
2654 * uses the window object indicated to select which part of the environment
2655 * to control (the part that this window lives in), and provides a command
2656 * and an optional parameter structure (use NULL for this if not needed).
2658 * @param obj The window object that lives in the environment to control
2659 * @param command The command to send
2660 * @param params Optional parameters for the command
2665 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2668 ELM_CHECK_WIDTYPE(obj, widtype);
2669 win = elm_widget_data_get(obj);
2671 #ifdef HAVE_ELEMENTARY_X
2672 _elm_win_xwindow_get(win);
2677 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2678 ecore_x_e_illume_focus_back_send(win->xwin);
2680 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2681 ecore_x_e_illume_focus_forward_send(win->xwin);
2683 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2684 ecore_x_e_illume_focus_home_send(win->xwin);
2686 case ELM_ILLUME_COMMAND_CLOSE:
2687 ecore_x_e_illume_close_send(win->xwin);
2697 * Get the inlined image object handle
2699 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2700 * then the window is in fact an evas image object inlined in the parent
2701 * canvas. You can get this object (be careful to not manipulate it as it
2702 * is under control of elementary), and use it to do things like get pixel
2703 * data, save the image to a file, etc.
2705 * @param obj The window object to get the inlined image from
2706 * @return The inlined image object, or NULL if none exists
2711 elm_win_inlined_image_object_get(Evas_Object *obj)
2714 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2715 win = elm_widget_data_get(obj);
2716 if (!win) return NULL;
2717 return win->img_obj;
2721 * Set the enabled status for the focus highlight in a window
2723 * This function will enable or disable the focus highlight only for the
2724 * given window, regardless of the global setting for it
2726 * @param obj The window where to enable the highlight
2727 * @param enabled The enabled value for the highlight
2732 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2736 ELM_CHECK_WIDTYPE(obj, widtype);
2738 win = elm_widget_data_get(obj);
2739 enabled = !!enabled;
2740 if (win->focus_highlight.enabled == enabled)
2743 win->focus_highlight.enabled = enabled;
2745 if (win->focus_highlight.enabled)
2746 _elm_win_focus_highlight_init(win);
2748 _elm_win_focus_highlight_shutdown(win);
2752 * Get the enabled value of the focus highlight for this window
2754 * @param obj The window in which to check if the focus highlight is enabled
2756 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2761 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2765 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2767 win = elm_widget_data_get(obj);
2768 return win->focus_highlight.enabled;
2772 * Set the style for the focus highlight on this window
2774 * Sets the style to use for theming the highlight of focused objects on
2775 * the given window. If @p style is NULL, the default will be used.
2777 * @param obj The window where to set the style
2778 * @param style The style to set
2783 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2787 ELM_CHECK_WIDTYPE(obj, widtype);
2789 win = elm_widget_data_get(obj);
2790 eina_stringshare_replace(&win->focus_highlight.style, style);
2791 win->focus_highlight.changed_theme = EINA_TRUE;
2792 _elm_win_focus_highlight_reconfigure_job_start(win);
2796 * Get the style set for the focus highlight object
2798 * Gets the style set for this windows highilght object, or NULL if none
2801 * @param obj The window to retrieve the highlights style from
2803 * @return The style set or NULL if none was. Default is used in that case.
2808 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2812 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2814 win = elm_widget_data_get(obj);
2815 return win->focus_highlight.style;
2818 typedef struct _Widget_Data Widget_Data;
2823 Evas_Object *content;
2826 static void _del_hook(Evas_Object *obj);
2827 static void _theme_hook(Evas_Object *obj);
2828 static void _sizing_eval(Evas_Object *obj);
2829 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2830 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2832 static const char *widtype2 = NULL;
2835 _del_hook(Evas_Object *obj)
2837 Widget_Data *wd = elm_widget_data_get(obj);
2843 _theme_hook(Evas_Object *obj)
2845 Widget_Data *wd = elm_widget_data_get(obj);
2846 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2848 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2853 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2855 Widget_Data *wd = elm_widget_data_get(obj);
2860 /* Try Focus cycle in subitem */
2863 elm_widget_focus_next_get(wd->content, dir, next);
2868 *next = (Evas_Object *)obj;
2873 _sizing_eval(Evas_Object *obj)
2875 Widget_Data *wd = elm_widget_data_get(obj);
2876 Evas_Coord minw = -1, minh = -1;
2878 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2879 edje_object_size_min_calc(wd->frm, &minw, &minh);
2880 evas_object_size_hint_min_set(obj, minw, minh);
2881 evas_object_size_hint_max_set(obj, -1, -1);
2885 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2891 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2893 Widget_Data *wd = elm_widget_data_get(obj);
2894 Evas_Object *sub = event_info;
2895 if (sub == wd->content)
2897 evas_object_event_callback_del_full
2898 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2905 * @defgroup Inwin Inwin
2907 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2910 elm_win_inwin_add(Evas_Object *obj)
2916 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2917 win = elm_widget_data_get(obj);
2918 if (!win) return NULL;
2919 wd = ELM_NEW(Widget_Data);
2920 obj2 = elm_widget_add(win->evas);
2921 elm_widget_type_set(obj2, "inwin");
2922 ELM_SET_WIDTYPE(widtype2, "inwin");
2923 elm_widget_sub_object_add(obj, obj2);
2924 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2925 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2926 elm_win_resize_object_add(obj, obj2);
2928 elm_widget_data_set(obj2, wd);
2929 elm_widget_del_hook_set(obj2, _del_hook);
2930 elm_widget_theme_hook_set(obj2, _theme_hook);
2931 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2932 elm_widget_can_focus_set(obj2, EINA_TRUE);
2933 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2935 wd->frm = edje_object_add(win->evas);
2936 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2937 elm_widget_resize_object_set(obj2, wd->frm);
2939 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2946 * Activates an inwin object
2948 * @param obj The inwin to activate
2953 elm_win_inwin_activate(Evas_Object *obj)
2955 ELM_CHECK_WIDTYPE(obj, widtype2);
2956 Widget_Data *wd = elm_widget_data_get(obj);
2958 evas_object_raise(obj);
2959 evas_object_show(obj);
2960 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2961 elm_object_focus(obj);
2965 * Set the content of an inwin object.
2967 * Once the content object is set, a previously set one will be deleted.
2968 * If you want to keep that old content object, use the
2969 * elm_win_inwin_content_unset() function.
2971 * @param obj The inwin object
2972 * @param content The object to set as content
2977 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2979 ELM_CHECK_WIDTYPE(obj, widtype2);
2980 Widget_Data *wd = elm_widget_data_get(obj);
2982 if (wd->content == content) return;
2983 if (wd->content) evas_object_del(wd->content);
2984 wd->content = content;
2987 elm_widget_sub_object_add(obj, content);
2988 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2989 _changed_size_hints, obj);
2990 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2996 * Get the content of an inwin object.
2998 * Return the content object which is set for this widget.
3000 * @param obj The inwin object
3001 * @return The content that is being used
3006 elm_win_inwin_content_get(const Evas_Object *obj)
3008 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3009 Widget_Data *wd = elm_widget_data_get(obj);
3010 if (!wd) return NULL;
3015 * Unset the content of an inwin object.
3017 * Unparent and return the content object which was set for this widget.
3019 * @param obj The inwin object
3020 * @return The content that was being used
3025 elm_win_inwin_content_unset(Evas_Object *obj)
3027 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3028 Widget_Data *wd = elm_widget_data_get(obj);
3029 if (!wd) return NULL;
3030 if (!wd->content) return NULL;
3031 Evas_Object *content = wd->content;
3032 elm_widget_sub_object_del(obj, wd->content);
3033 edje_object_part_unswallow(wd->frm, wd->content);
3038 /* windowing spcific calls - shall we do this differently? */
3040 static Ecore_X_Window
3041 _elm_ee_win_get(const Evas_Object *obj)
3044 #ifdef HAVE_ELEMENTARY_X
3045 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3046 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3052 * Get the Ecore_X_Window of an Evas_Object
3054 * @param obj The object
3056 * @return The Ecore_X_Window of @p obj
3061 elm_win_xwindow_get(const Evas_Object *obj)
3063 Ecore_X_Window xwin = 0;
3068 type = elm_widget_type_get(obj);
3069 if (!type) return 0;
3070 if (type != widtype) return _elm_ee_win_get(obj);
3071 #ifdef HAVE_ELEMENTARY_X
3072 win = elm_widget_data_get(obj);
3073 if (!win) return xwin;
3074 if (win->xwin) return win->xwin;
3075 if (win->parent) return elm_win_xwindow_get(win->parent);