1 #include <Elementary.h>
7 * The window class of Elementary. Contains functions to manipulate
8 * windows. The Evas engine used to render the window contents is specified
9 * in the system or user elementary config files (whichever is found last),
10 * and can be overridden with the ELM_ENGINE environment variable for testing.
11 * Engines that may be supported (depending on Evas and Ecore-Evas compilation
12 * setup and modules actually installed at runtime) are (listed in order of
13 * best supported and most likely to be complete and work to lowest quality).
15 * "x11", "x", "software-x11", "software_x11"
16 * (Software rendering in X11)
17 * "gl", "opengl", "opengl-x11", "opengl_x11"
18 * (OpenGL or OpenGL-ES2 rendering in X11)
20 * (Virtual screenshot renderer - renders to output file and exits)
21 * "fb", "software-fb", "software_fb"
22 * (Linux framebuffer direct software rendering)
23 * "sdl", "software-sdl", "software_sdl"
24 * (SDL software rendering to SDL buffer)
25 * "gl-sdl", "gl_sdl", "opengl-sdl", "opengl_sdl"
26 * (OpenGL or OpenGL-ES2 rendering using SDL as the buffer)
27 * "gdi", "software-gdi", "software_gdi"
28 * (Windows WIN32 rendering via GDI with software)
30 * (Rendering to a DirectFB window)
31 * "x11-8", "x8", "software-8-x11", "software_8_x11"
32 * (Rendering in grayscale using dedicated 8bit software engine in X11)
33 * "x11-16", "x16", "software-16-x11", "software_16_x11"
34 * (Rendering in X11 using 16bit software engine)
35 * "wince-gdi", "software-16-wince-gdi", "software_16_wince_gdi"
36 * (Windows CE rendering via GDI with 16bit software renderer)
37 * "sdl-16", "software-16-sdl", "software_16_sdl"
38 * (Rendering to SDL buffer with 16bit software renderer)
40 * All engines use a simple string to select the engine to render, EXCEPT
41 * the "shot" engine. This actually encodes the output of the virtual
42 * screenshot and how long to delay in the engine string. The engine string
43 * is encoded in the following way:
45 * "shot:[delay=XX][:][file=XX]"
47 * Where options are separated by a ":" char if more than one option is given,
48 * with delay, if provided being the first option and file the last (order
49 * is important). The delay specifies how long to wait after the window is
50 * shown before doing the virtual "in memory" rendering and then save the
51 * output to the file specified by the file option (and then exit). If no
52 * delay is given, the default is 0.5 seconds. If no file is given the
53 * default output file is "out.png". Some examples of using the shot engine:
55 * ELM_ENGINE="shot:delay=1.0:file=elm_test.png" elementary_test
56 * ELM_ENGINE="shot:file=elm_test2.png" elementary_test
57 * ELM_ENGINE="shot:delay=2.0" elementary_test
58 * ELM_ENGINE="shot:" elementary_test
60 * Signals that you can add callbacks for are:
62 * "delete,request" - the user requested to delete the window
63 * "focus,in" - window got focus
64 * "focus,out" - window lost focus
65 * "moved" - window that holds the canvas was moved
68 typedef struct _Elm_Win Elm_Win;
74 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
76 #ifdef HAVE_ELEMENTARY_X
78 Ecore_Event_Handler *client_message_handler;
80 Ecore_Job *deferred_resize_job;
81 Ecore_Job *deferred_child_eval_job;
84 Elm_Win_Keyboard_Mode kbdmode;
89 Eina_Bool autodel : 1;
90 int *autodel_clear, rot;
100 Eina_Bool visible : 1;
101 Eina_Bool handled : 1;
105 Ecore_Job *reconf_job;
107 Eina_Bool enabled : 1;
108 Eina_Bool changed_theme : 1;
109 Eina_Bool top_animate : 1;
110 Eina_Bool geometry_changed : 1;
114 static const char *widtype = NULL;
115 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
116 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
117 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
118 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
119 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
120 static void _elm_win_move(Ecore_Evas *ee);
121 static void _elm_win_resize(Ecore_Evas *ee);
122 static void _elm_win_delete_request(Ecore_Evas *ee);
123 static void _elm_win_resize_job(void *data);
124 #ifdef HAVE_ELEMENTARY_X
125 static void _elm_win_xwin_update(Elm_Win *win);
127 static void _elm_win_eval_subobjs(Evas_Object *obj);
128 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
129 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
130 static void _elm_win_focus_highlight_init(Elm_Win *win);
131 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
132 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
133 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
134 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
135 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
136 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
138 static const char SIG_DELETE_REQUEST[] = "delete,request";
139 static const char SIG_FOCUS_OUT[] = "focus,in";
140 static const char SIG_FOCUS_IN[] = "focus,out";
141 static const char SIG_MOVED[] = "moved";
143 static const Evas_Smart_Cb_Description _signals[] = {
144 {SIG_DELETE_REQUEST, ""},
153 Eina_List *_elm_win_list = NULL;
154 int _elm_win_deferred_free = 0;
156 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
157 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
160 _shot_delay_get(Elm_Win *win)
163 char *d = strdup(win->shot.info);
166 for (p = (char *)win->shot.info; *p; p++)
168 if (!strncmp(p, "delay=", 6))
172 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
187 _shot_file_get(Elm_Win *win)
190 char *tmp = strdup(win->shot.info);
192 if (!tmp) return NULL;
193 for (p = (char *)win->shot.info; *p; p++)
195 if (!strncmp(p, "file=", 5))
202 return strdup("out.png");
206 _shot_key_get(Elm_Win *win __UNUSED__)
212 _shot_flags_get(Elm_Win *win __UNUSED__)
218 _shot_do(Elm_Win *win)
222 unsigned int *pixels;
224 char *file, *key, *flags;
226 ecore_evas_manual_render(win->ee);
227 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
229 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
230 if ((w < 1) || (h < 1)) return;
231 file = _shot_file_get(win);
233 key = _shot_key_get(win);
234 flags = _shot_flags_get(win);
235 ee = ecore_evas_buffer_new(1, 1);
236 o = evas_object_image_add(ecore_evas_get(ee));
237 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
238 evas_object_image_size_set(o, w, h);
239 evas_object_image_data_set(o, pixels);
240 if (!evas_object_image_save(o, file, key, flags))
242 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
247 if (flags) free(flags);
252 _shot_delay(void *data)
256 win->shot.timer = NULL;
262 _shot_handle(Elm_Win *win)
264 if (!win->shot.info) return;
265 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
269 _elm_win_move(Ecore_Evas *ee)
271 Evas_Object *obj = ecore_evas_object_associate_get(ee);
276 win = elm_widget_data_get(obj);
278 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
281 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
285 _elm_win_resize(Ecore_Evas *ee)
287 Evas_Object *obj = ecore_evas_object_associate_get(ee);
291 win = elm_widget_data_get(obj);
293 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
294 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
298 _elm_win_focus_in(Ecore_Evas *ee)
300 Evas_Object *obj = ecore_evas_object_associate_get(ee);
304 win = elm_widget_data_get(obj);
306 /*NB: Why two different "focus signals" here ??? */
307 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
308 win->focus_highlight.cur.visible = EINA_TRUE;
309 _elm_win_focus_highlight_reconfigure_job_start(win);
313 else if (win->img_obj)
320 _elm_win_focus_out(Ecore_Evas *ee)
322 Evas_Object *obj = ecore_evas_object_associate_get(ee);
326 win = elm_widget_data_get(obj);
328 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
329 win->focus_highlight.cur.visible = EINA_FALSE;
330 _elm_win_focus_highlight_reconfigure_job_start(win);
334 else if (win->img_obj)
341 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
343 Elm_Win *wd = elm_widget_data_get(obj);
344 const Eina_List *items;
345 void *(*list_data_get) (const Eina_List *list);
353 if (!(items = elm_widget_focus_custom_chain_get(obj)))
359 list_data_get = eina_list_data_get;
361 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
367 *next = (Evas_Object *)obj;
372 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
374 Elm_Win *win = elm_widget_data_get(obj);
378 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
380 evas_object_focus_set(obj, elm_widget_focus_get(obj));
384 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
386 if (type == EVAS_CALLBACK_KEY_DOWN)
388 Evas_Event_Key_Down *ev = event_info;
389 if (!strcmp(ev->keyname, "Tab"))
391 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
392 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
394 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
395 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
404 _deferred_ecore_evas_free(void *data)
406 ecore_evas_free(data);
407 _elm_win_deferred_free--;
411 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
415 elm_object_focus(obj);
416 if (win->shot.info) _shot_handle(win);
420 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
427 else if (win->img_obj)
429 evas_object_hide(win->img_obj);
434 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
441 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
442 _elm_win_obj_callback_parent_del, win);
445 if (win->autodel_clear) *(win->autodel_clear) = -1;
446 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
447 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
450 ecore_evas_callback_delete_request_set(win->ee, NULL);
451 ecore_evas_callback_resize_set(win->ee, NULL);
453 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
454 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
455 if (win->shot.info) eina_stringshare_del(win->shot.info);
456 if (win->shot.timer) ecore_timer_del(win->shot.timer);
457 while (((child = evas_object_bottom_get(win->evas))) &&
460 evas_object_del(child);
462 while (((child = evas_object_top_get(win->evas))) &&
465 evas_object_del(child);
467 #ifdef HAVE_ELEMENTARY_X
468 if (win->client_message_handler)
469 ecore_event_handler_del(win->client_message_handler);
471 // FIXME: Why are we flushing edje on every window destroy ??
472 // edje_file_cache_flush();
473 // edje_collection_cache_flush();
474 // evas_image_cache_flush(win->evas);
475 // evas_font_cache_flush(win->evas);
476 // FIXME: we are in the del handler for the object and delete the canvas
477 // that lives under it from the handler... nasty. deferring doesn't help either
487 ecore_job_add(_deferred_ecore_evas_free, win->ee);
488 _elm_win_deferred_free++;
492 _elm_win_focus_highlight_shutdown(win);
493 eina_stringshare_del(win->focus_highlight.style);
497 if ((!_elm_win_list) &&
498 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
500 edje_file_cache_flush();
501 edje_collection_cache_flush();
502 evas_image_cache_flush(e);
503 evas_font_cache_flush(e);
509 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
512 if (!win->img_obj) return;
513 evas_object_event_callback_del_full
514 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
515 evas_object_del(win->img_obj);
519 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
522 if (obj == win->parent) win->parent = NULL;
526 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
532 if ((x != win->screen.x) || (y != win->screen.y))
536 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
541 evas_object_move(obj, x, y);
546 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
549 // this is called to make sure all smart containers have calculated their
550 // sizes BEFORE we show the window to make sure it initially appears at
551 // our desired size (ie min size is known first)
552 evas_smart_objects_calculate(evas_object_evas_get(obj));
553 evas_object_show(obj);
557 else if (win->img_obj)
559 evas_object_show(win->img_obj);
564 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
568 if (ecore_evas_override_get(win->ee))
572 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
575 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
580 else if (win->img_obj)
584 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
587 // evas_object_move(win->img_obj, x, y);
592 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
599 else if (win->img_obj)
601 Evas_Coord w = 1, h = 1;
603 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
606 evas_object_image_size_set(win->img_obj, w, h);
611 _elm_win_delete_request(Ecore_Evas *ee)
613 Evas_Object *obj = ecore_evas_object_associate_get(ee);
615 if (strcmp(elm_widget_type_get(obj), "win")) return;
617 win = elm_widget_data_get(obj);
619 int autodel = win->autodel;
620 win->autodel_clear = &autodel;
621 evas_object_ref(win->win_obj);
622 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
623 // FIXME: if above callback deletes - then the below will be invalid
624 if (autodel) evas_object_del(win->win_obj);
625 else win->autodel_clear = NULL;
626 evas_object_unref(win->win_obj);
630 _elm_win_resize_job(void *data)
637 win->deferred_resize_job = NULL;
638 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
639 evas_object_resize(win->win_obj, w, h);
643 else if (win->img_obj)
646 EINA_LIST_FOREACH(win->subobjs, l, obj)
648 evas_object_move(obj, 0, 0);
649 evas_object_resize(obj, w, h);
653 #ifdef HAVE_ELEMENTARY_X
655 _elm_win_xwindow_get(Elm_Win *win)
659 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
660 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
662 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
664 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
665 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
666 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
667 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
668 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
669 ENGINE_COMPARE(ELM_OPENGL_SDL))
672 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
674 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
676 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
678 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
681 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
683 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
686 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
688 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
690 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
692 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
694 #undef ENGINE_COMPARE
698 #ifdef HAVE_ELEMENTARY_X
700 _elm_win_xwin_update(Elm_Win *win)
702 _elm_win_xwindow_get(win);
707 win2 = elm_widget_data_get(win->parent);
711 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
715 if (!win->xwin) return; /* nothing more to do */
720 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
722 case ELM_WIN_DIALOG_BASIC:
723 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
725 case ELM_WIN_DESKTOP:
726 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
729 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
731 case ELM_WIN_TOOLBAR:
732 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
735 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
737 case ELM_WIN_UTILITY:
738 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
741 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
743 case ELM_WIN_DROPDOWN_MENU:
744 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
746 case ELM_WIN_POPUP_MENU:
747 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
749 case ELM_WIN_TOOLTIP:
750 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
752 case ELM_WIN_NOTIFICATION:
753 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
756 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
759 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
764 ecore_x_e_virtual_keyboard_state_set
765 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
770 _elm_win_eval_subobjs(Evas_Object *obj)
773 const Evas_Object *child;
775 Elm_Win *win = elm_widget_data_get(obj);
776 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
780 EINA_LIST_FOREACH(win->subobjs, l, child)
782 evas_object_size_hint_weight_get(child, &wx, &wy);
783 if (wx == 0.0) xx = 0;
784 if (wy == 0.0) xy = 0;
786 evas_object_size_hint_min_get(child, &w, &h);
789 if (w > minw) minw = w;
790 if (h > minh) minh = h;
792 evas_object_size_hint_max_get(child, &w, &h);
795 if (maxw == -1) maxw = w;
796 else if ((w > 0) && (w < maxw)) maxw = w;
797 if (maxh == -1) maxh = h;
798 else if ((h > 0) && (h < maxh)) maxh = h;
800 if (!xx) maxw = minw;
802 if (!xy) maxh = minh;
804 evas_object_size_hint_min_set(obj, minw, minh);
805 evas_object_size_hint_max_set(obj, maxw, maxh);
806 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
807 if (w < minw) w = minw;
808 if (h < minh) h = minh;
809 if ((maxw >= 0) && (w > maxw)) w = maxw;
810 if ((maxh >= 0) && (h > maxh)) h = maxh;
811 evas_object_resize(obj, w, h);
815 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
817 Elm_Win *win = elm_widget_data_get(data);
818 win->subobjs = eina_list_remove(win->subobjs, obj);
819 _elm_win_eval_subobjs(win->win_obj);
823 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
825 _elm_win_eval_subobjs(data);
829 _elm_win_shutdown(void)
831 while (_elm_win_list)
832 evas_object_del(_elm_win_list->data);
836 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
843 EINA_LIST_FOREACH(_elm_win_list, l, obj)
844 elm_widget_theme(obj);
848 EINA_LIST_FOREACH(_elm_win_list, l, obj)
849 elm_widget_theme_specific(obj, th, EINA_FALSE);
853 #ifdef HAVE_ELEMENTARY_X
855 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
858 Ecore_X_Event_Client_Message *e = event;
860 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
861 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
863 if ((unsigned)e->data.l[0] == win->xwin)
865 Evas *evas = evas_object_evas_get(win->win_obj);
868 edje_file_cache_flush();
869 edje_collection_cache_flush();
870 evas_image_cache_flush(evas);
871 evas_font_cache_flush(evas);
875 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
877 if ((unsigned)e->data.l[0] == win->xwin)
879 Evas *evas = evas_object_evas_get(win->win_obj);
882 edje_file_cache_flush();
883 edje_collection_cache_flush();
884 evas_image_cache_flush(evas);
885 evas_font_cache_flush(evas);
886 evas_render_dump(evas);
890 return ECORE_CALLBACK_PASS_ON;
895 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
899 win->focus_highlight.geometry_changed = EINA_TRUE;
900 _elm_win_focus_highlight_reconfigure_job_start(win);
904 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
908 win->focus_highlight.geometry_changed = EINA_TRUE;
909 _elm_win_focus_highlight_reconfigure_job_start(win);
913 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
917 win->focus_highlight.cur.target = NULL;
919 _elm_win_focus_highlight_reconfigure_job_start(win);
923 _elm_win_focus_target_callbacks_add(Elm_Win *win)
925 Evas_Object *obj = win->focus_highlight.cur.target;
927 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
928 _elm_win_focus_target_move, win);
929 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
930 _elm_win_focus_target_resize, win);
931 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
932 _elm_win_focus_target_del, win);
936 _elm_win_focus_target_callbacks_del(Elm_Win *win)
938 Evas_Object *obj = win->focus_highlight.cur.target;
940 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
941 _elm_win_focus_target_move, win);
942 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
943 _elm_win_focus_target_resize, win);
944 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
945 _elm_win_focus_target_del, win);
949 _elm_win_focus_target_get(Evas_Object *obj)
951 Evas_Object *o = obj;
955 if (elm_widget_is(o))
957 if (!elm_widget_highlight_ignore_get(o))
959 o = elm_widget_parent_get(o);
961 o = evas_object_smart_parent_get(o);
965 o = elm_widget_parent_widget_get(o);
967 o = evas_object_smart_parent_get(o);
976 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
978 Evas_Object *obj = event_info, *target;
981 if (win->focus_highlight.cur.target == obj)
984 target = _elm_win_focus_target_get(obj);
985 win->focus_highlight.cur.target = target;
986 if (elm_widget_highlight_in_theme_get(target))
987 win->focus_highlight.cur.handled = EINA_TRUE;
989 _elm_win_focus_target_callbacks_add(win);
991 _elm_win_focus_highlight_reconfigure_job_start(win);
995 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
999 if (!win->focus_highlight.cur.target)
1002 if (!win->focus_highlight.cur.handled)
1003 _elm_win_focus_target_callbacks_del(win);
1004 win->focus_highlight.cur.target = NULL;
1005 win->focus_highlight.cur.handled = EINA_FALSE;
1007 _elm_win_focus_highlight_reconfigure_job_start(win);
1011 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1013 evas_object_hide(obj);
1017 _elm_win_focus_highlight_init(Elm_Win *win)
1019 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1020 _elm_win_object_focus_in, win);
1021 evas_event_callback_add(win->evas,
1022 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1023 _elm_win_object_focus_out, win);
1025 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1027 win->focus_highlight.top = edje_object_add(win->evas);
1028 win->focus_highlight.changed_theme = EINA_TRUE;
1029 edje_object_signal_callback_add(win->focus_highlight.top,
1030 "elm,action,focus,hide,end", "",
1031 _elm_win_focus_highlight_hide, NULL);
1032 edje_object_signal_callback_add(win->focus_highlight.top,
1033 "elm,action,focus,anim,end", "",
1034 _elm_win_focus_highlight_anim_end, win);
1035 _elm_win_focus_highlight_reconfigure_job_start(win);
1039 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1041 _elm_win_focus_highlight_reconfigure_job_stop(win);
1042 if (win->focus_highlight.cur.target)
1044 _elm_win_focus_target_callbacks_del(win);
1045 win->focus_highlight.cur.target = NULL;
1047 if (win->focus_highlight.top)
1049 evas_object_del(win->focus_highlight.top);
1050 win->focus_highlight.top = NULL;
1053 evas_event_callback_del_full(win->evas,
1054 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1055 _elm_win_object_focus_in, win);
1056 evas_event_callback_del_full(win->evas,
1057 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1058 _elm_win_object_focus_out, win);
1062 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1066 top = win->focus_highlight.top;
1071 evas_object_show(top);
1072 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1078 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1083 _elm_win_focus_highlight_reconfigure_job(void *data)
1085 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1089 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1091 if (win->focus_highlight.reconf_job)
1092 ecore_job_del(win->focus_highlight.reconf_job);
1093 win->focus_highlight.reconf_job = ecore_job_add(
1094 _elm_win_focus_highlight_reconfigure_job, win);
1098 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1100 if (win->focus_highlight.reconf_job)
1101 ecore_job_del(win->focus_highlight.reconf_job);
1102 win->focus_highlight.reconf_job = NULL;
1106 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1108 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1109 Evas_Coord x, y, w, h;
1111 clip = evas_object_clip_get(target);
1112 evas_object_geometry_get(target, &x, &y, &w, &h);
1114 evas_object_move(obj, x, y);
1115 evas_object_resize(obj, w, h);
1116 evas_object_clip_set(obj, clip);
1120 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1122 Evas_Coord tx, ty, tw, th;
1123 Evas_Coord w, h, px, py, pw, ph;
1124 Edje_Message_Int_Set *m;
1125 Evas_Object *previous = win->focus_highlight.prev.target;
1126 Evas_Object *target = win->focus_highlight.cur.target;
1128 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1129 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1130 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1131 evas_object_move(obj, 0, 0);
1132 evas_object_resize(obj, tw, th);
1133 evas_object_clip_unset(obj);
1135 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1145 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1149 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1151 Elm_Win *win = data;
1152 _elm_win_focus_highlight_simple_setup(win, obj);
1156 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1158 Evas_Object *target = win->focus_highlight.cur.target;
1159 Evas_Object *previous = win->focus_highlight.prev.target;
1160 Evas_Object *top = win->focus_highlight.top;
1161 Eina_Bool visible_changed;
1162 Eina_Bool common_visible;
1163 const char *sig = NULL;
1165 _elm_win_focus_highlight_reconfigure_job_stop(win);
1167 visible_changed = (win->focus_highlight.cur.visible !=
1168 win->focus_highlight.prev.visible);
1170 if ((target == previous) && (!visible_changed) &&
1171 (!win->focus_highlight.geometry_changed))
1174 if ((previous) && (win->focus_highlight.prev.handled))
1175 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1178 common_visible = EINA_FALSE;
1179 else if (win->focus_highlight.cur.handled)
1181 common_visible = EINA_FALSE;
1182 if (win->focus_highlight.cur.visible)
1183 sig = "elm,action,focus_highlight,show";
1185 sig = "elm,action,focus_highlight,hide";
1188 common_visible = win->focus_highlight.cur.visible;
1190 _elm_win_focus_highlight_visible_set(win, common_visible);
1192 elm_widget_signal_emit(target, sig, "elm");
1194 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1197 if (win->focus_highlight.changed_theme)
1200 if (win->focus_highlight.style)
1201 str = win->focus_highlight.style;
1204 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1206 win->focus_highlight.changed_theme = EINA_FALSE;
1208 if (_elm_config->focus_highlight_animate)
1210 str = edje_object_data_get(win->focus_highlight.top, "animate");
1211 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1215 if ((win->focus_highlight.top_animate) && (previous) &&
1216 (!win->focus_highlight.prev.handled))
1217 _elm_win_focus_highlight_anim_setup(win, top);
1219 _elm_win_focus_highlight_simple_setup(win, top);
1220 evas_object_raise(top);
1223 win->focus_highlight.geometry_changed = EINA_FALSE;
1224 win->focus_highlight.prev = win->focus_highlight.cur;
1229 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1231 Evas_Event_Key_Down *ev = event_info;
1233 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1237 if ((strcmp(ev->keyname, "F12")) ||
1238 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1241 printf("Tree graph generated.\n");
1242 elm_object_tree_dot_dump(obj, "./dump.dot");
1247 _win_img_hide(void *data,
1249 Evas_Object *obj __UNUSED__,
1250 void *event_info __UNUSED__)
1252 Elm_Win *win = data;
1254 elm_widget_focus_hide_handle(win->win_obj);
1258 _win_img_mouse_down(void *data,
1260 Evas_Object *obj __UNUSED__,
1261 void *event_info __UNUSED__)
1263 Elm_Win *win = data;
1264 elm_widget_focus_mouse_down_handle(win->win_obj);
1268 _win_img_focus_in(void *data,
1270 Evas_Object *obj __UNUSED__,
1271 void *event_info __UNUSED__)
1273 Elm_Win *win = data;
1274 elm_widget_focus_steal(win->win_obj);
1278 _win_img_focus_out(void *data,
1280 Evas_Object *obj __UNUSED__,
1281 void *event_info __UNUSED__)
1283 Elm_Win *win = data;
1284 elm_widget_focused_object_clear(win->win_obj);
1288 _win_inlined_image_set(Elm_Win *win)
1290 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1291 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1292 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1293 _elm_win_obj_callback_img_obj_del, win);
1295 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1296 _win_img_hide, win);
1297 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1298 _win_img_mouse_down, win);
1299 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1300 _win_img_focus_in, win);
1301 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1302 _win_img_focus_out, win);
1306 * Adds a window object. If this is the first window created, pass NULL as
1309 * @param parent Parent object to add the window to, or NULL
1310 * @param name The name of the window
1311 * @param type The window type, one of the following:
1313 * ELM_WIN_DIALOG_BASIC
1321 * @return The created object, or NULL on failure
1326 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1330 const char *fontpath;
1332 win = ELM_NEW(Elm_Win);
1334 #define FALLBACK_TRY(engine) \
1337 CRITICAL(engine " engine creation failed. Trying software X11."); \
1338 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1340 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1344 case ELM_WIN_INLINED_IMAGE:
1348 Evas *e = evas_object_evas_get(parent);
1351 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1354 win->img_obj = ecore_evas_object_image_new(ee);
1357 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1360 _win_inlined_image_set(win);
1364 evas_object_del(win->img_obj);
1365 win->img_obj = NULL;
1374 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1376 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1377 #ifdef HAVE_ELEMENTARY_X
1378 win->client_message_handler = ecore_event_handler_add
1379 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1382 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1384 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1385 FALLBACK_TRY("Sofware FB");
1387 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1389 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1390 FALLBACK_TRY("Sofware DirectFB");
1392 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1394 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1395 FALLBACK_TRY("Sofware-16");
1396 #ifdef HAVE_ELEMENTARY_X
1397 win->client_message_handler = ecore_event_handler_add
1398 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1401 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1403 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1404 FALLBACK_TRY("Sofware-8");
1405 #ifdef HAVE_ELEMENTARY_X
1406 win->client_message_handler = ecore_event_handler_add
1407 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1411 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1413 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1414 FALLBACK_TRY("XRender");
1415 #ifdef HAVE_ELEMENTARY_X
1416 win->client_message_handler = ecore_event_handler_add
1417 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1421 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1426 if (_elm_config->vsync)
1428 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1434 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1436 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1437 FALLBACK_TRY("OpenGL");
1438 #ifdef HAVE_ELEMENTARY_X
1439 win->client_message_handler = ecore_event_handler_add
1440 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1443 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1445 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1446 FALLBACK_TRY("Sofware Win32");
1448 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1450 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1451 FALLBACK_TRY("Sofware-16-WinCE");
1453 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1455 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1456 FALLBACK_TRY("Sofware SDL");
1458 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1460 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1461 FALLBACK_TRY("Sofware-16-SDL");
1463 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1465 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1466 FALLBACK_TRY("OpenGL SDL");
1468 else if (!strncmp(_elm_config->engine, "shot:", 5))
1470 win->ee = ecore_evas_buffer_new(1, 1);
1471 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1472 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1480 ERR("Cannot create window.");
1484 #ifdef HAVE_ELEMENTARY_X
1485 _elm_win_xwindow_get(win);
1487 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1488 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1489 // bg pixmap done by x - has other issues like can be redrawn by x before it
1490 // is filled/ready by app
1491 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1494 win->parent = parent;
1496 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1497 _elm_win_obj_callback_parent_del, win);
1499 win->evas = ecore_evas_get(win->ee);
1500 win->win_obj = elm_widget_add(win->evas);
1501 elm_widget_type_set(win->win_obj, "win");
1502 ELM_SET_WIDTYPE(widtype, "win");
1503 elm_widget_data_set(win->win_obj, win);
1504 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1505 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1506 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1507 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1508 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1509 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1510 evas_object_move(win->win_obj, 0, 0);
1511 evas_object_resize(win->win_obj, 1, 1);
1512 evas_object_layer_set(win->win_obj, 50);
1513 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1515 ecore_evas_object_associate(win->ee, win->win_obj,
1516 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1517 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1518 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1519 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1520 _elm_win_obj_callback_show, win);
1521 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1522 _elm_win_obj_callback_hide, win);
1523 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1524 _elm_win_obj_callback_del, win);
1525 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1526 _elm_win_obj_callback_move, win);
1527 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1528 _elm_win_obj_callback_resize, win);
1530 evas_object_intercept_move_callback_add(win->win_obj,
1531 _elm_win_obj_intercept_move, win);
1532 evas_object_intercept_show_callback_add(win->win_obj,
1533 _elm_win_obj_intercept_show, win);
1535 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1536 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1537 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1538 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1539 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1540 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1541 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1542 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1543 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1544 evas_font_path_append(win->evas, fontpath);
1545 if (!_elm_config->font_hinting)
1546 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1547 else if (_elm_config->font_hinting == 1)
1548 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1549 else if (_elm_config->font_hinting == 2)
1550 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1552 #ifdef HAVE_ELEMENTARY_X
1553 _elm_win_xwin_update(win);
1556 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1558 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1560 ecore_evas_fullscreen_set(win->ee, 1);
1562 #undef ENGINE_COMPARE
1564 if (_elm_config->focus_highlight_enable)
1565 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1568 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1569 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1570 _debug_key_down, win);
1572 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1574 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1577 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1579 return win->win_obj;
1583 * Add @p subobj as a resize object of window @p obj.
1585 * @param obj The window object
1586 * @param subobj The resize object to add
1591 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1595 ELM_CHECK_WIDTYPE(obj, widtype);
1596 win = elm_widget_data_get(obj);
1598 if (eina_list_data_find(win->subobjs, subobj)) return;
1599 win->subobjs = eina_list_append(win->subobjs, subobj);
1600 elm_widget_sub_object_add(obj, subobj);
1601 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1602 _elm_win_subobj_callback_del, obj);
1603 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1604 _elm_win_subobj_callback_changed_size_hints,
1606 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1607 evas_object_move(subobj, 0, 0);
1608 evas_object_resize(subobj, w, h);
1609 _elm_win_eval_subobjs(obj);
1613 * Delete @p subobj as a resize object of window @p obj.
1615 * @param obj The window object
1616 * @param subobj The resize object to add
1621 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1624 ELM_CHECK_WIDTYPE(obj, widtype);
1625 win = elm_widget_data_get(obj);
1627 evas_object_event_callback_del_full(subobj,
1628 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1629 _elm_win_subobj_callback_changed_size_hints,
1631 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1632 _elm_win_subobj_callback_del, obj);
1633 win->subobjs = eina_list_remove(win->subobjs, subobj);
1634 elm_widget_sub_object_del(obj, subobj);
1635 _elm_win_eval_subobjs(obj);
1639 * Set the title of the window
1641 * @param obj The window object
1642 * @param title The title to set
1647 elm_win_title_set(Evas_Object *obj, const char *title)
1650 ELM_CHECK_WIDTYPE(obj, widtype);
1651 win = elm_widget_data_get(obj);
1653 ecore_evas_title_set(win->ee, title);
1657 * Get the title of the window
1659 * @param obj The window object
1665 elm_win_title_get(const Evas_Object *obj)
1668 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1669 win = elm_widget_data_get(obj);
1670 if (!win) return NULL;
1671 return ecore_evas_title_get(win->ee);
1675 * Set the window's autodel state.
1677 * @param obj The window object
1678 * @param autodel If true, the window will automatically delete itself when closed
1683 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1686 ELM_CHECK_WIDTYPE(obj, widtype);
1687 win = elm_widget_data_get(obj);
1689 win->autodel = autodel;
1693 * Get the window's autodel state.
1695 * @param obj The window object
1696 * @return If the window will automatically delete itself when closed
1701 elm_win_autodel_get(const Evas_Object *obj)
1704 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1705 win = elm_widget_data_get(obj);
1706 if (!win) return EINA_FALSE;
1707 return win->autodel;
1711 * Activate a window object.
1713 * @param obj The window object
1718 elm_win_activate(Evas_Object *obj)
1721 ELM_CHECK_WIDTYPE(obj, widtype);
1722 win = elm_widget_data_get(obj);
1724 ecore_evas_activate(win->ee);
1728 * Lower a window object.
1730 * @param obj The window object
1735 elm_win_lower(Evas_Object *obj)
1738 ELM_CHECK_WIDTYPE(obj, widtype);
1739 win = elm_widget_data_get(obj);
1741 ecore_evas_lower(win->ee);
1745 * Raise a window object.
1747 * @param obj The window object
1752 elm_win_raise(Evas_Object *obj)
1755 ELM_CHECK_WIDTYPE(obj, widtype);
1756 win = elm_widget_data_get(obj);
1758 ecore_evas_raise(win->ee);
1762 * Set the borderless state of a window.
1764 * @param obj The window object
1765 * @param borderless If true, the window is borderless
1770 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1773 ELM_CHECK_WIDTYPE(obj, widtype);
1774 win = elm_widget_data_get(obj);
1776 ecore_evas_borderless_set(win->ee, borderless);
1777 #ifdef HAVE_ELEMENTARY_X
1778 _elm_win_xwin_update(win);
1783 * Get the borderless state of a window.
1785 * @param obj The window object
1786 * @return If true, the window is borderless
1791 elm_win_borderless_get(const Evas_Object *obj)
1794 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1795 win = elm_widget_data_get(obj);
1796 if (!win) return EINA_FALSE;
1797 return ecore_evas_borderless_get(win->ee);
1801 * Set the shaped state of a window.
1803 * @param obj The window object
1804 * @param shaped If true, the window is shaped
1809 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1812 ELM_CHECK_WIDTYPE(obj, widtype);
1813 win = elm_widget_data_get(obj);
1815 ecore_evas_shaped_set(win->ee, shaped);
1816 #ifdef HAVE_ELEMENTARY_X
1817 _elm_win_xwin_update(win);
1822 * Get the shaped state of a window.
1824 * @param obj The window object
1825 * @return If true, the window is shaped
1830 elm_win_shaped_get(const Evas_Object *obj)
1833 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1834 win = elm_widget_data_get(obj);
1835 if (!win) return EINA_FALSE;
1836 return ecore_evas_shaped_get(win->ee);
1840 * Set the alpha channel state of a window.
1842 * @param obj The window object
1843 * @param alpha If true, the window has an alpha channel
1848 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1851 ELM_CHECK_WIDTYPE(obj, widtype);
1852 win = elm_widget_data_get(obj);
1857 else if (win->img_obj)
1859 evas_object_image_alpha_set(win->img_obj, alpha);
1863 #ifdef HAVE_ELEMENTARY_X
1868 if (!_elm_config->compositing)
1869 elm_win_shaped_set(obj, alpha);
1871 ecore_evas_alpha_set(win->ee, alpha);
1874 ecore_evas_alpha_set(win->ee, alpha);
1875 _elm_win_xwin_update(win);
1879 ecore_evas_alpha_set(win->ee, alpha);
1884 * Get the alpha channel state of a window.
1886 * @param obj The window object
1887 * @return If true, the window has an alpha channel
1892 elm_win_alpha_get(const Evas_Object *obj)
1895 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1896 win = elm_widget_data_get(obj);
1897 if (!win) return EINA_FALSE;
1898 return ecore_evas_alpha_get(win->ee);
1902 * Set the transparency state of a window.
1904 * @param obj The window object
1905 * @param transparent If true, the window is transparent
1910 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1913 ELM_CHECK_WIDTYPE(obj, widtype);
1914 win = elm_widget_data_get(obj);
1920 else if (win->img_obj)
1922 evas_object_image_alpha_set(win->img_obj, transparent);
1926 #ifdef HAVE_ELEMENTARY_X
1929 ecore_evas_transparent_set(win->ee, transparent);
1930 _elm_win_xwin_update(win);
1934 ecore_evas_transparent_set(win->ee, transparent);
1939 * Get the transparency state of a window.
1941 * @param obj The window object
1942 * @return If true, the window is transparent
1947 elm_win_transparent_get(const Evas_Object *obj)
1950 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1951 win = elm_widget_data_get(obj);
1952 if (!win) return EINA_FALSE;
1954 return ecore_evas_transparent_get(win->ee);
1958 * Set the override state of a window.
1960 * @param obj The window object
1961 * @param override If true, the window is overridden
1966 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1969 ELM_CHECK_WIDTYPE(obj, widtype);
1970 win = elm_widget_data_get(obj);
1972 ecore_evas_override_set(win->ee, override);
1973 #ifdef HAVE_ELEMENTARY_X
1974 _elm_win_xwin_update(win);
1979 * Get the override state of a window.
1981 * @param obj The window object
1982 * @return If true, the window is overridden
1987 elm_win_override_get(const Evas_Object *obj)
1990 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1991 win = elm_widget_data_get(obj);
1992 if (!win) return EINA_FALSE;
1993 return ecore_evas_override_get(win->ee);
1997 * Set the fullscreen state of a window.
1999 * @param obj The window object
2000 * @param fullscreen If true, the window is fullscreen
2005 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2008 ELM_CHECK_WIDTYPE(obj, widtype);
2009 win = elm_widget_data_get(obj);
2012 // YYY: handle if win->img_obj
2013 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2014 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2015 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2017 // these engines... can ONLY be fullscreen
2022 ecore_evas_fullscreen_set(win->ee, fullscreen);
2023 #ifdef HAVE_ELEMENTARY_X
2024 _elm_win_xwin_update(win);
2027 #undef ENGINE_COMPARE
2031 * Get the fullscreen state of a window.
2033 * @param obj The window object
2034 * @return If true, the window is fullscreen
2039 elm_win_fullscreen_get(const Evas_Object *obj)
2042 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2043 win = elm_widget_data_get(obj);
2044 if (!win) return EINA_FALSE;
2046 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2047 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2048 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2050 // these engines... can ONLY be fullscreen
2055 return ecore_evas_fullscreen_get(win->ee);
2057 #undef ENGINE_COMPARE
2061 * Set the maximized state of a window.
2063 * @param obj The window object
2064 * @param maximized If true, the window is maximized
2069 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2072 ELM_CHECK_WIDTYPE(obj, widtype);
2073 win = elm_widget_data_get(obj);
2075 // YYY: handle if win->img_obj
2076 ecore_evas_maximized_set(win->ee, maximized);
2077 #ifdef HAVE_ELEMENTARY_X
2078 _elm_win_xwin_update(win);
2083 * Get the maximized state of a window.
2085 * @param obj The window object
2086 * @return If true, the window is maximized
2091 elm_win_maximized_get(const Evas_Object *obj)
2094 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2095 win = elm_widget_data_get(obj);
2096 if (!win) return EINA_FALSE;
2097 return ecore_evas_maximized_get(win->ee);
2101 * Set the iconified state of a window.
2103 * @param obj The window object
2104 * @param iconified If true, the window is iconified
2109 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2112 ELM_CHECK_WIDTYPE(obj, widtype);
2113 win = elm_widget_data_get(obj);
2115 ecore_evas_iconified_set(win->ee, iconified);
2116 #ifdef HAVE_ELEMENTARY_X
2117 _elm_win_xwin_update(win);
2122 * Get the iconified state of a window.
2124 * @param obj The window object
2125 * @return If true, the window is iconified
2130 elm_win_iconified_get(const Evas_Object *obj)
2133 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2134 win = elm_widget_data_get(obj);
2135 if (!win) return EINA_FALSE;
2136 return ecore_evas_iconified_get(win->ee);
2140 * Set the layer of the window.
2142 * @param obj The window object
2143 * @param layer The layer of the window
2148 elm_win_layer_set(Evas_Object *obj, int layer)
2151 ELM_CHECK_WIDTYPE(obj, widtype);
2152 win = elm_widget_data_get(obj);
2154 ecore_evas_layer_set(win->ee, layer);
2155 #ifdef HAVE_ELEMENTARY_X
2156 _elm_win_xwin_update(win);
2161 * Get the layer of the window.
2163 * @param obj The window object
2164 * @return The layer of the window
2169 elm_win_layer_get(const Evas_Object *obj)
2172 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2173 win = elm_widget_data_get(obj);
2174 if (!win) return -1;
2175 return ecore_evas_layer_get(win->ee);
2179 * Set the rotation of the window.
2181 * @param obj The window object
2182 * @param rotation The rotation of the window, in degrees (0-360)
2187 elm_win_rotation_set(Evas_Object *obj, int rotation)
2190 ELM_CHECK_WIDTYPE(obj, widtype);
2191 win = elm_widget_data_get(obj);
2193 if (win->rot == rotation) return;
2194 win->rot = rotation;
2195 ecore_evas_rotation_set(win->ee, rotation);
2196 evas_object_size_hint_min_set(obj, -1, -1);
2197 evas_object_size_hint_max_set(obj, -1, -1);
2198 _elm_win_eval_subobjs(obj);
2199 #ifdef HAVE_ELEMENTARY_X
2200 _elm_win_xwin_update(win);
2205 * Rotates the window and resizes it
2207 * @param obj The window object
2208 * @param layer The rotation of the window in degrees (0-360)
2213 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2216 ELM_CHECK_WIDTYPE(obj, widtype);
2217 win = elm_widget_data_get(obj);
2219 if (win->rot == rotation) return;
2220 win->rot = rotation;
2221 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2222 evas_object_size_hint_min_set(obj, -1, -1);
2223 evas_object_size_hint_max_set(obj, -1, -1);
2224 _elm_win_eval_subobjs(obj);
2225 #ifdef HAVE_ELEMENTARY_X
2226 _elm_win_xwin_update(win);
2231 * Get the rotation of the window.
2233 * @param obj The window object
2234 * @return The rotation of the window in degrees (0-360)
2239 elm_win_rotation_get(const Evas_Object *obj)
2242 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2243 win = elm_widget_data_get(obj);
2244 if (!win) return -1;
2249 * Set the sticky state of the window.
2251 * @param obj The window object
2252 * @param sticky If true, the window's sticky state is enabled
2257 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2260 ELM_CHECK_WIDTYPE(obj, widtype);
2261 win = elm_widget_data_get(obj);
2263 ecore_evas_sticky_set(win->ee, sticky);
2264 #ifdef HAVE_ELEMENTARY_X
2265 _elm_win_xwin_update(win);
2270 * Get the sticky state of the window.
2272 * @param obj The window object
2273 * @return If true, the window's sticky state is enabled
2278 elm_win_sticky_get(const Evas_Object *obj)
2281 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2282 win = elm_widget_data_get(obj);
2283 if (!win) return EINA_FALSE;
2284 return ecore_evas_sticky_get(win->ee);
2288 * Sets the keyboard mode of the window.
2290 * @param obj The window object
2291 * @param mode The mode to set; one of:
2292 * ELM_WIN_KEYBOARD_UNKNOWN
2293 * ELM_WIN_KEYBOARD_OFF
2294 * ELM_WIN_KEYBOARD_ON
2295 * ELM_WIN_KEYBOARD_ALPHA
2296 * ELM_WIN_KEYBOARD_NUMERIC
2297 * ELM_WIN_KEYBOARD_PIN
2298 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2299 * ELM_WIN_KEYBOARD_HEX
2300 * ELM_WIN_KEYBOARD_TERMINAL
2301 * ELM_WIN_KEYBOARD_PASSWORD
2302 * ELM_WIN_KEYBOARD_IP
2303 * ELM_WIN_KEYBOARD_HOST
2304 * ELM_WIN_KEYBOARD_FILE
2305 * ELM_WIN_KEYBOARD_URL
2306 * ELM_WIN_KEYBOARD_KEYPAD
2307 * ELM_WIN_KEYBOARD_J2ME
2312 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2315 ELM_CHECK_WIDTYPE(obj, widtype);
2316 win = elm_widget_data_get(obj);
2318 if (mode == win->kbdmode) return;
2319 #ifdef HAVE_ELEMENTARY_X
2320 _elm_win_xwindow_get(win);
2322 win->kbdmode = mode;
2323 #ifdef HAVE_ELEMENTARY_X
2325 ecore_x_e_virtual_keyboard_state_set
2326 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2331 * Gets the keyboard mode of the window.
2333 * @param obj The window object
2334 * @return The mode; one of:
2335 * ELM_WIN_KEYBOARD_UNKNOWN
2336 * ELM_WIN_KEYBOARD_OFF
2337 * ELM_WIN_KEYBOARD_ON
2338 * ELM_WIN_KEYBOARD_ALPHA
2339 * ELM_WIN_KEYBOARD_NUMERIC
2340 * ELM_WIN_KEYBOARD_PIN
2341 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2342 * ELM_WIN_KEYBOARD_HEX
2343 * ELM_WIN_KEYBOARD_TERMINAL
2344 * ELM_WIN_KEYBOARD_PASSWORD
2345 * ELM_WIN_KEYBOARD_IP
2346 * ELM_WIN_KEYBOARD_HOST
2347 * ELM_WIN_KEYBOARD_FILE
2348 * ELM_WIN_KEYBOARD_URL
2349 * ELM_WIN_KEYBOARD_KEYPAD
2350 * ELM_WIN_KEYBOARD_J2ME
2354 EAPI Elm_Win_Keyboard_Mode
2355 elm_win_keyboard_mode_get(const Evas_Object *obj)
2358 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2359 win = elm_widget_data_get(obj);
2360 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2361 return win->kbdmode;
2365 * Sets whether the window is a keyboard.
2367 * @param obj The window object
2368 * @param is_keyboard If true, the window is a virtual keyboard
2373 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2376 ELM_CHECK_WIDTYPE(obj, widtype);
2377 win = elm_widget_data_get(obj);
2379 #ifdef HAVE_ELEMENTARY_X
2380 _elm_win_xwindow_get(win);
2382 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2387 * Gets whether the window is a keyboard.
2389 * @param obj The window object
2390 * @return If the window is a virtual keyboard
2395 elm_win_keyboard_win_get(const Evas_Object *obj)
2398 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2399 win = elm_widget_data_get(obj);
2400 if (!win) return EINA_FALSE;
2401 #ifdef HAVE_ELEMENTARY_X
2402 _elm_win_xwindow_get(win);
2404 return ecore_x_e_virtual_keyboard_get(win->xwin);
2410 * Get the screen position of a window.
2412 * @param obj The window object
2413 * @param x The int to store the x coordinate to
2414 * @param y The int to store the y coordinate to
2419 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2422 ELM_CHECK_WIDTYPE(obj, widtype);
2423 win = elm_widget_data_get(obj);
2425 if (x) *x = win->screen.x;
2426 if (y) *y = win->screen.y;
2430 * Set if this window is an illume conformant window
2432 * @param obj The window object
2433 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2438 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2441 ELM_CHECK_WIDTYPE(obj, widtype);
2442 win = elm_widget_data_get(obj);
2444 #ifdef HAVE_ELEMENTARY_X
2445 _elm_win_xwindow_get(win);
2447 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2452 * Get if this window is an illume conformant window
2454 * @param obj The window object
2455 * @return A boolean if this window is illume conformant or not
2460 elm_win_conformant_get(const Evas_Object *obj)
2463 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2464 win = elm_widget_data_get(obj);
2465 if (!win) return EINA_FALSE;
2466 #ifdef HAVE_ELEMENTARY_X
2467 _elm_win_xwindow_get(win);
2469 return ecore_x_e_illume_conformant_get(win->xwin);
2475 * Set a window to be an illume quickpanel window
2477 * By default window objects are not quickpanel windows.
2479 * @param obj The window object
2480 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2485 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2488 ELM_CHECK_WIDTYPE(obj, widtype);
2489 win = elm_widget_data_get(obj);
2491 #ifdef HAVE_ELEMENTARY_X
2492 _elm_win_xwindow_get(win);
2495 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2498 Ecore_X_Window_State states[2];
2500 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2501 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2502 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2503 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2510 * Get if this window is a quickpanel or not
2512 * @param obj The window object
2513 * @return A boolean if this window is a quickpanel or not
2518 elm_win_quickpanel_get(const Evas_Object *obj)
2521 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2522 win = elm_widget_data_get(obj);
2523 if (!win) return EINA_FALSE;
2524 #ifdef HAVE_ELEMENTARY_X
2525 _elm_win_xwindow_get(win);
2527 return ecore_x_e_illume_quickpanel_get(win->xwin);
2533 * Set the major priority of a quickpanel window
2535 * @param obj The window object
2536 * @param priority The major priority for this quickpanel
2541 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2544 ELM_CHECK_WIDTYPE(obj, widtype);
2545 win = elm_widget_data_get(obj);
2547 #ifdef HAVE_ELEMENTARY_X
2548 _elm_win_xwindow_get(win);
2550 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2555 * Get the major priority of a quickpanel window
2557 * @param obj The window object
2558 * @return The major priority of this quickpanel
2563 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2566 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2567 win = elm_widget_data_get(obj);
2568 if (!win) return -1;
2569 #ifdef HAVE_ELEMENTARY_X
2570 _elm_win_xwindow_get(win);
2572 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2578 * Set the minor priority of a quickpanel window
2580 * @param obj The window object
2581 * @param priority The minor priority for this quickpanel
2586 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2589 ELM_CHECK_WIDTYPE(obj, widtype);
2590 win = elm_widget_data_get(obj);
2592 #ifdef HAVE_ELEMENTARY_X
2593 _elm_win_xwindow_get(win);
2595 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2600 * Get the minor priority of a quickpanel window
2602 * @param obj The window object
2603 * @return The minor priority of this quickpanel
2608 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2611 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2612 win = elm_widget_data_get(obj);
2613 if (!win) return -1;
2614 #ifdef HAVE_ELEMENTARY_X
2615 _elm_win_xwindow_get(win);
2617 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2623 * Set which zone this quickpanel should appear in
2625 * @param obj The window object
2626 * @param zone The requested zone for this quickpanel
2631 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2634 ELM_CHECK_WIDTYPE(obj, widtype);
2635 win = elm_widget_data_get(obj);
2637 #ifdef HAVE_ELEMENTARY_X
2638 _elm_win_xwindow_get(win);
2640 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2645 * Get which zone this quickpanel should appear in
2647 * @param obj The window object
2648 * @return The requested zone for this quickpanel
2653 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2656 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2657 win = elm_widget_data_get(obj);
2659 #ifdef HAVE_ELEMENTARY_X
2660 _elm_win_xwindow_get(win);
2662 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2668 * Set the window to be skipped by keyboard focus
2670 * This sets the window to be skipped by normal keyboard input. This means
2671 * a window manager will be asked to not focus this window as well as omit
2672 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2674 * Call this and enable it on a window BEFORE you show it for the first time,
2675 * otherwise it may have no effect.
2677 * Use this for windows that have only output information or might only be
2678 * interacted with by the mouse or fingers, and never for typing input.
2679 * Be careful that this may have side-effects like making the window
2680 * non-accessible in some cases unless the window is specially handled. Use
2683 * @param obj The window object
2684 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2689 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2692 ELM_CHECK_WIDTYPE(obj, widtype);
2693 win = elm_widget_data_get(obj);
2695 #ifdef HAVE_ELEMENTARY_X
2696 _elm_win_xwindow_get(win);
2701 Ecore_X_Window_State states[2];
2703 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2704 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2705 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2706 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2713 * Send a command to the windowing environment
2715 * This is intended to work in touchscreen or small screen device environments
2716 * where there is a more simplistic window management policy in place. This
2717 * uses the window object indicated to select which part of the environment
2718 * to control (the part that this window lives in), and provides a command
2719 * and an optional parameter structure (use NULL for this if not needed).
2721 * @param obj The window object that lives in the environment to control
2722 * @param command The command to send
2723 * @param params Optional parameters for the command
2728 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2731 ELM_CHECK_WIDTYPE(obj, widtype);
2732 win = elm_widget_data_get(obj);
2734 #ifdef HAVE_ELEMENTARY_X
2735 _elm_win_xwindow_get(win);
2740 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2741 ecore_x_e_illume_focus_back_send(win->xwin);
2743 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2744 ecore_x_e_illume_focus_forward_send(win->xwin);
2746 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2747 ecore_x_e_illume_focus_home_send(win->xwin);
2749 case ELM_ILLUME_COMMAND_CLOSE:
2750 ecore_x_e_illume_close_send(win->xwin);
2760 * Get the inlined image object handle
2762 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2763 * then the window is in fact an evas image object inlined in the parent
2764 * canvas. You can get this object (be careful to not manipulate it as it
2765 * is under control of elementary), and use it to do things like get pixel
2766 * data, save the image to a file, etc.
2768 * @param obj The window object to get the inlined image from
2769 * @return The inlined image object, or NULL if none exists
2774 elm_win_inlined_image_object_get(Evas_Object *obj)
2777 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2778 win = elm_widget_data_get(obj);
2779 if (!win) return NULL;
2780 return win->img_obj;
2784 * Set the enabled status for the focus highlight in a window
2786 * This function will enable or disable the focus highlight only for the
2787 * given window, regardless of the global setting for it
2789 * @param obj The window where to enable the highlight
2790 * @param enabled The enabled value for the highlight
2795 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2799 ELM_CHECK_WIDTYPE(obj, widtype);
2801 win = elm_widget_data_get(obj);
2802 enabled = !!enabled;
2803 if (win->focus_highlight.enabled == enabled)
2806 win->focus_highlight.enabled = enabled;
2808 if (win->focus_highlight.enabled)
2809 _elm_win_focus_highlight_init(win);
2811 _elm_win_focus_highlight_shutdown(win);
2815 * Get the enabled value of the focus highlight for this window
2817 * @param obj The window in which to check if the focus highlight is enabled
2819 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2824 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2828 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2830 win = elm_widget_data_get(obj);
2831 return win->focus_highlight.enabled;
2835 * Set the style for the focus highlight on this window
2837 * Sets the style to use for theming the highlight of focused objects on
2838 * the given window. If @p style is NULL, the default will be used.
2840 * @param obj The window where to set the style
2841 * @param style The style to set
2846 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2850 ELM_CHECK_WIDTYPE(obj, widtype);
2852 win = elm_widget_data_get(obj);
2853 eina_stringshare_replace(&win->focus_highlight.style, style);
2854 win->focus_highlight.changed_theme = EINA_TRUE;
2855 _elm_win_focus_highlight_reconfigure_job_start(win);
2859 * Get the style set for the focus highlight object
2861 * Gets the style set for this windows highilght object, or NULL if none
2864 * @param obj The window to retrieve the highlights style from
2866 * @return The style set or NULL if none was. Default is used in that case.
2871 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2875 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2877 win = elm_widget_data_get(obj);
2878 return win->focus_highlight.style;
2881 typedef struct _Widget_Data Widget_Data;
2886 Evas_Object *content;
2889 static void _del_hook(Evas_Object *obj);
2890 static void _theme_hook(Evas_Object *obj);
2891 static void _sizing_eval(Evas_Object *obj);
2892 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2893 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2895 static const char *widtype2 = NULL;
2898 _del_hook(Evas_Object *obj)
2900 Widget_Data *wd = elm_widget_data_get(obj);
2906 _theme_hook(Evas_Object *obj)
2908 Widget_Data *wd = elm_widget_data_get(obj);
2909 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2911 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2916 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2918 Widget_Data *wd = elm_widget_data_get(obj);
2923 /* Try Focus cycle in subitem */
2926 elm_widget_focus_next_get(wd->content, dir, next);
2931 *next = (Evas_Object *)obj;
2936 _sizing_eval(Evas_Object *obj)
2938 Widget_Data *wd = elm_widget_data_get(obj);
2939 Evas_Coord minw = -1, minh = -1;
2941 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2942 edje_object_size_min_calc(wd->frm, &minw, &minh);
2943 evas_object_size_hint_min_set(obj, minw, minh);
2944 evas_object_size_hint_max_set(obj, -1, -1);
2948 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2954 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2956 Widget_Data *wd = elm_widget_data_get(obj);
2957 Evas_Object *sub = event_info;
2958 if (sub == wd->content)
2960 evas_object_event_callback_del_full
2961 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2968 * @defgroup Inwin Inwin
2970 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2973 elm_win_inwin_add(Evas_Object *obj)
2979 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2980 win = elm_widget_data_get(obj);
2981 if (!win) return NULL;
2982 wd = ELM_NEW(Widget_Data);
2983 obj2 = elm_widget_add(win->evas);
2984 elm_widget_type_set(obj2, "inwin");
2985 ELM_SET_WIDTYPE(widtype2, "inwin");
2986 elm_widget_sub_object_add(obj, obj2);
2987 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2988 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2989 elm_win_resize_object_add(obj, obj2);
2991 elm_widget_data_set(obj2, wd);
2992 elm_widget_del_hook_set(obj2, _del_hook);
2993 elm_widget_theme_hook_set(obj2, _theme_hook);
2994 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2995 elm_widget_can_focus_set(obj2, EINA_TRUE);
2996 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2998 wd->frm = edje_object_add(win->evas);
2999 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3000 elm_widget_resize_object_set(obj2, wd->frm);
3002 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3009 * Activates an inwin object
3011 * @param obj The inwin to activate
3016 elm_win_inwin_activate(Evas_Object *obj)
3018 ELM_CHECK_WIDTYPE(obj, widtype2);
3019 Widget_Data *wd = elm_widget_data_get(obj);
3021 evas_object_raise(obj);
3022 evas_object_show(obj);
3023 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3024 elm_object_focus(obj);
3028 * Set the content of an inwin object.
3030 * Once the content object is set, a previously set one will be deleted.
3031 * If you want to keep that old content object, use the
3032 * elm_win_inwin_content_unset() function.
3034 * @param obj The inwin object
3035 * @param content The object to set as content
3040 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3042 ELM_CHECK_WIDTYPE(obj, widtype2);
3043 Widget_Data *wd = elm_widget_data_get(obj);
3045 if (wd->content == content) return;
3046 if (wd->content) evas_object_del(wd->content);
3047 wd->content = content;
3050 elm_widget_sub_object_add(obj, content);
3051 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3052 _changed_size_hints, obj);
3053 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3059 * Get the content of an inwin object.
3061 * Return the content object which is set for this widget.
3063 * @param obj The inwin object
3064 * @return The content that is being used
3069 elm_win_inwin_content_get(const Evas_Object *obj)
3071 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3072 Widget_Data *wd = elm_widget_data_get(obj);
3073 if (!wd) return NULL;
3078 * Unset the content of an inwin object.
3080 * Unparent and return the content object which was set for this widget.
3082 * @param obj The inwin object
3083 * @return The content that was being used
3088 elm_win_inwin_content_unset(Evas_Object *obj)
3090 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3091 Widget_Data *wd = elm_widget_data_get(obj);
3092 if (!wd) return NULL;
3093 if (!wd->content) return NULL;
3094 Evas_Object *content = wd->content;
3095 elm_widget_sub_object_del(obj, wd->content);
3096 edje_object_part_unswallow(wd->frm, wd->content);
3101 /* windowing spcific calls - shall we do this differently? */
3103 static Ecore_X_Window
3104 _elm_ee_win_get(const Evas_Object *obj)
3107 #ifdef HAVE_ELEMENTARY_X
3108 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3109 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3115 * Get the Ecore_X_Window of an Evas_Object
3117 * @param obj The object
3119 * @return The Ecore_X_Window of @p obj
3124 elm_win_xwindow_get(const Evas_Object *obj)
3126 Ecore_X_Window xwin = 0;
3131 type = elm_widget_type_get(obj);
3132 if (!type) return 0;
3133 if (type != widtype) return _elm_ee_win_get(obj);
3134 #ifdef HAVE_ELEMENTARY_X
3135 win = elm_widget_data_get(obj);
3136 if (!win) return xwin;
3137 if (win->xwin) return win->xwin;
3138 if (win->parent) return elm_win_xwindow_get(win->parent);