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); // FIXME: remove me
308 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
309 win->focus_highlight.cur.visible = EINA_TRUE;
310 _elm_win_focus_highlight_reconfigure_job_start(win);
314 else if (win->img_obj)
321 _elm_win_focus_out(Ecore_Evas *ee)
323 Evas_Object *obj = ecore_evas_object_associate_get(ee);
327 win = elm_widget_data_get(obj);
329 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL); // FIXME: remove me
330 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
331 win->focus_highlight.cur.visible = EINA_FALSE;
332 _elm_win_focus_highlight_reconfigure_job_start(win);
336 else if (win->img_obj)
343 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
345 Elm_Win *wd = elm_widget_data_get(obj);
346 const Eina_List *items;
347 void *(*list_data_get) (const Eina_List *list);
355 if (!(items = elm_widget_focus_custom_chain_get(obj)))
361 list_data_get = eina_list_data_get;
363 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
369 *next = (Evas_Object *)obj;
374 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
376 Elm_Win *win = elm_widget_data_get(obj);
380 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
382 evas_object_focus_set(obj, elm_widget_focus_get(obj));
386 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
388 if (type == EVAS_CALLBACK_KEY_DOWN)
390 Evas_Event_Key_Down *ev = event_info;
391 if (!strcmp(ev->keyname, "Tab"))
393 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
394 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
396 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
397 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
406 _deferred_ecore_evas_free(void *data)
408 ecore_evas_free(data);
409 _elm_win_deferred_free--;
413 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
417 elm_object_focus(obj);
418 if (win->shot.info) _shot_handle(win);
422 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
429 else if (win->img_obj)
431 evas_object_hide(win->img_obj);
436 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
443 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
444 _elm_win_obj_callback_parent_del, win);
447 if (win->autodel_clear) *(win->autodel_clear) = -1;
448 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
449 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
452 ecore_evas_callback_delete_request_set(win->ee, NULL);
453 ecore_evas_callback_resize_set(win->ee, NULL);
455 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
456 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
457 if (win->shot.info) eina_stringshare_del(win->shot.info);
458 if (win->shot.timer) ecore_timer_del(win->shot.timer);
459 while (((child = evas_object_bottom_get(win->evas))) &&
462 evas_object_del(child);
464 while (((child = evas_object_top_get(win->evas))) &&
467 evas_object_del(child);
469 #ifdef HAVE_ELEMENTARY_X
470 if (win->client_message_handler)
471 ecore_event_handler_del(win->client_message_handler);
473 // FIXME: Why are we flushing edje on every window destroy ??
474 // edje_file_cache_flush();
475 // edje_collection_cache_flush();
476 // evas_image_cache_flush(win->evas);
477 // evas_font_cache_flush(win->evas);
478 // FIXME: we are in the del handler for the object and delete the canvas
479 // that lives under it from the handler... nasty. deferring doesn't help either
489 ecore_job_add(_deferred_ecore_evas_free, win->ee);
490 _elm_win_deferred_free++;
494 _elm_win_focus_highlight_shutdown(win);
495 eina_stringshare_del(win->focus_highlight.style);
499 if ((!_elm_win_list) &&
500 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
502 edje_file_cache_flush();
503 edje_collection_cache_flush();
504 evas_image_cache_flush(e);
505 evas_font_cache_flush(e);
511 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
514 if (!win->img_obj) return;
515 evas_object_event_callback_del_full
516 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
517 evas_object_del(win->img_obj);
521 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
524 if (obj == win->parent) win->parent = NULL;
528 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
534 if ((x != win->screen.x) || (y != win->screen.y))
538 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
543 evas_object_move(obj, x, y);
548 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
551 // this is called to make sure all smart containers have calculated their
552 // sizes BEFORE we show the window to make sure it initially appears at
553 // our desired size (ie min size is known first)
554 evas_smart_objects_calculate(evas_object_evas_get(obj));
555 evas_object_show(obj);
559 else if (win->img_obj)
561 evas_object_show(win->img_obj);
566 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
570 if (ecore_evas_override_get(win->ee))
574 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
577 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
582 else if (win->img_obj)
586 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
589 // evas_object_move(win->img_obj, x, y);
594 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
601 else if (win->img_obj)
603 Evas_Coord w = 1, h = 1;
605 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
608 evas_object_image_size_set(win->img_obj, w, h);
613 _elm_win_delete_request(Ecore_Evas *ee)
615 Evas_Object *obj = ecore_evas_object_associate_get(ee);
617 if (strcmp(elm_widget_type_get(obj), "win")) return;
619 win = elm_widget_data_get(obj);
621 int autodel = win->autodel;
622 win->autodel_clear = &autodel;
623 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL); // FIXME: remove me.
624 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
625 // FIXME: if above callback deletes - then the below will be invalid
626 if (autodel) evas_object_del(win->win_obj);
627 else win->autodel_clear = NULL;
631 _elm_win_resize_job(void *data)
638 win->deferred_resize_job = NULL;
639 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
640 evas_object_resize(win->win_obj, w, h);
644 else if (win->img_obj)
647 EINA_LIST_FOREACH(win->subobjs, l, obj)
649 evas_object_move(obj, 0, 0);
650 evas_object_resize(obj, w, h);
654 #ifdef HAVE_ELEMENTARY_X
656 _elm_win_xwindow_get(Elm_Win *win)
660 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
661 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
663 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
665 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
666 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
667 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
668 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
669 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
670 ENGINE_COMPARE(ELM_OPENGL_SDL))
673 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
675 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
677 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
679 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
682 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
684 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
687 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
689 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
691 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
693 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
695 #undef ENGINE_COMPARE
699 #ifdef HAVE_ELEMENTARY_X
701 _elm_win_xwin_update(Elm_Win *win)
703 _elm_win_xwindow_get(win);
708 win2 = elm_widget_data_get(win->parent);
712 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
716 if (!win->xwin) return; /* nothing more to do */
721 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
723 case ELM_WIN_DIALOG_BASIC:
724 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
726 case ELM_WIN_DESKTOP:
727 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
730 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
732 case ELM_WIN_TOOLBAR:
733 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
736 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
738 case ELM_WIN_UTILITY:
739 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
742 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
744 case ELM_WIN_DROPDOWN_MENU:
745 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
747 case ELM_WIN_POPUP_MENU:
748 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
750 case ELM_WIN_TOOLTIP:
751 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
753 case ELM_WIN_NOTIFICATION:
754 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
757 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
760 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
765 ecore_x_e_virtual_keyboard_state_set
766 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
771 _elm_win_eval_subobjs(Evas_Object *obj)
774 const Evas_Object *child;
776 Elm_Win *win = elm_widget_data_get(obj);
777 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
781 EINA_LIST_FOREACH(win->subobjs, l, child)
783 evas_object_size_hint_weight_get(child, &wx, &wy);
784 if (wx == 0.0) xx = 0;
785 if (wy == 0.0) xy = 0;
787 evas_object_size_hint_min_get(child, &w, &h);
790 if (w > minw) minw = w;
791 if (h > minh) minh = h;
793 evas_object_size_hint_max_get(child, &w, &h);
796 if (maxw == -1) maxw = w;
797 else if ((w > 0) && (w < maxw)) maxw = w;
798 if (maxh == -1) maxh = h;
799 else if ((h > 0) && (h < maxh)) maxh = h;
801 if (!xx) maxw = minw;
803 if (!xy) maxh = minh;
805 evas_object_size_hint_min_set(obj, minw, minh);
806 evas_object_size_hint_max_set(obj, maxw, maxh);
807 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
808 if (w < minw) w = minw;
809 if (h < minh) h = minh;
810 if ((maxw >= 0) && (w > maxw)) w = maxw;
811 if ((maxh >= 0) && (h > maxh)) h = maxh;
812 evas_object_resize(obj, w, h);
816 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
818 Elm_Win *win = elm_widget_data_get(data);
819 win->subobjs = eina_list_remove(win->subobjs, obj);
820 _elm_win_eval_subobjs(win->win_obj);
824 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
826 _elm_win_eval_subobjs(data);
830 _elm_win_shutdown(void)
832 while (_elm_win_list)
833 evas_object_del(_elm_win_list->data);
837 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
844 EINA_LIST_FOREACH(_elm_win_list, l, obj)
845 elm_widget_theme(obj);
849 EINA_LIST_FOREACH(_elm_win_list, l, obj)
850 elm_widget_theme_specific(obj, th, EINA_FALSE);
854 #ifdef HAVE_ELEMENTARY_X
856 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
859 Ecore_X_Event_Client_Message *e = event;
861 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
862 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
864 if ((unsigned)e->data.l[0] == win->xwin)
866 Evas *evas = evas_object_evas_get(win->win_obj);
869 edje_file_cache_flush();
870 edje_collection_cache_flush();
871 evas_image_cache_flush(evas);
872 evas_font_cache_flush(evas);
876 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
878 if ((unsigned)e->data.l[0] == win->xwin)
880 Evas *evas = evas_object_evas_get(win->win_obj);
883 edje_file_cache_flush();
884 edje_collection_cache_flush();
885 evas_image_cache_flush(evas);
886 evas_font_cache_flush(evas);
887 evas_render_dump(evas);
891 return ECORE_CALLBACK_PASS_ON;
896 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
900 win->focus_highlight.geometry_changed = EINA_TRUE;
901 _elm_win_focus_highlight_reconfigure_job_start(win);
905 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
909 win->focus_highlight.geometry_changed = EINA_TRUE;
910 _elm_win_focus_highlight_reconfigure_job_start(win);
914 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
918 win->focus_highlight.cur.target = NULL;
920 _elm_win_focus_highlight_reconfigure_job_start(win);
924 _elm_win_focus_target_callbacks_add(Elm_Win *win)
926 Evas_Object *obj = win->focus_highlight.cur.target;
928 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
929 _elm_win_focus_target_move, win);
930 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
931 _elm_win_focus_target_resize, win);
932 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
933 _elm_win_focus_target_del, win);
937 _elm_win_focus_target_callbacks_del(Elm_Win *win)
939 Evas_Object *obj = win->focus_highlight.cur.target;
941 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
942 _elm_win_focus_target_move, win);
943 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
944 _elm_win_focus_target_resize, win);
945 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
946 _elm_win_focus_target_del, win);
950 _elm_win_focus_target_get(Evas_Object *obj)
952 Evas_Object *o = obj;
956 if (elm_widget_is(o))
958 if (!elm_widget_highlight_ignore_get(o))
960 o = elm_widget_parent_get(o);
962 o = evas_object_smart_parent_get(o);
966 o = elm_widget_parent_widget_get(o);
968 o = evas_object_smart_parent_get(o);
977 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
979 Evas_Object *obj = event_info, *target;
982 if (win->focus_highlight.cur.target == obj)
985 target = _elm_win_focus_target_get(obj);
986 win->focus_highlight.cur.target = target;
987 if (elm_widget_highlight_in_theme_get(target))
988 win->focus_highlight.cur.handled = EINA_TRUE;
990 _elm_win_focus_target_callbacks_add(win);
992 _elm_win_focus_highlight_reconfigure_job_start(win);
996 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1000 if (!win->focus_highlight.cur.target)
1003 if (!win->focus_highlight.cur.handled)
1004 _elm_win_focus_target_callbacks_del(win);
1005 win->focus_highlight.cur.target = NULL;
1006 win->focus_highlight.cur.handled = EINA_FALSE;
1008 _elm_win_focus_highlight_reconfigure_job_start(win);
1012 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1014 evas_object_hide(obj);
1018 _elm_win_focus_highlight_init(Elm_Win *win)
1020 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1021 _elm_win_object_focus_in, win);
1022 evas_event_callback_add(win->evas,
1023 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1024 _elm_win_object_focus_out, win);
1026 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1028 win->focus_highlight.top = edje_object_add(win->evas);
1029 win->focus_highlight.changed_theme = EINA_TRUE;
1030 edje_object_signal_callback_add(win->focus_highlight.top,
1031 "elm,action,focus,hide,end", "",
1032 _elm_win_focus_highlight_hide, NULL);
1033 edje_object_signal_callback_add(win->focus_highlight.top,
1034 "elm,action,focus,anim,end", "",
1035 _elm_win_focus_highlight_anim_end, win);
1036 _elm_win_focus_highlight_reconfigure_job_start(win);
1040 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1042 _elm_win_focus_highlight_reconfigure_job_stop(win);
1043 if (win->focus_highlight.cur.target)
1045 _elm_win_focus_target_callbacks_del(win);
1046 win->focus_highlight.cur.target = NULL;
1048 if (win->focus_highlight.top)
1050 evas_object_del(win->focus_highlight.top);
1051 win->focus_highlight.top = NULL;
1054 evas_event_callback_del_full(win->evas,
1055 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1056 _elm_win_object_focus_in, win);
1057 evas_event_callback_del_full(win->evas,
1058 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1059 _elm_win_object_focus_out, win);
1063 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1067 top = win->focus_highlight.top;
1072 evas_object_show(top);
1073 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1079 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1084 _elm_win_focus_highlight_reconfigure_job(void *data)
1086 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1090 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1092 if (win->focus_highlight.reconf_job)
1093 ecore_job_del(win->focus_highlight.reconf_job);
1094 win->focus_highlight.reconf_job = ecore_job_add(
1095 _elm_win_focus_highlight_reconfigure_job, win);
1099 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1101 if (win->focus_highlight.reconf_job)
1102 ecore_job_del(win->focus_highlight.reconf_job);
1103 win->focus_highlight.reconf_job = NULL;
1107 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1109 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1110 Evas_Coord x, y, w, h;
1112 clip = evas_object_clip_get(target);
1113 evas_object_geometry_get(target, &x, &y, &w, &h);
1115 evas_object_move(obj, x, y);
1116 evas_object_resize(obj, w, h);
1117 evas_object_clip_set(obj, clip);
1121 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1123 Evas_Coord tx, ty, tw, th;
1124 Evas_Coord w, h, px, py, pw, ph;
1125 Edje_Message_Int_Set *m;
1126 Evas_Object *previous = win->focus_highlight.prev.target;
1127 Evas_Object *target = win->focus_highlight.cur.target;
1129 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1130 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1131 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1132 evas_object_move(obj, 0, 0);
1133 evas_object_resize(obj, tw, th);
1134 evas_object_clip_unset(obj);
1136 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1146 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1150 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1152 Elm_Win *win = data;
1153 _elm_win_focus_highlight_simple_setup(win, obj);
1157 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1159 Evas_Object *target = win->focus_highlight.cur.target;
1160 Evas_Object *previous = win->focus_highlight.prev.target;
1161 Evas_Object *top = win->focus_highlight.top;
1162 Eina_Bool visible_changed;
1163 Eina_Bool common_visible;
1164 const char *sig = NULL;
1166 _elm_win_focus_highlight_reconfigure_job_stop(win);
1168 visible_changed = (win->focus_highlight.cur.visible !=
1169 win->focus_highlight.prev.visible);
1171 if ((target == previous) && (!visible_changed) &&
1172 (!win->focus_highlight.geometry_changed))
1175 if ((previous) && (win->focus_highlight.prev.handled))
1176 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1179 common_visible = EINA_FALSE;
1180 else if (win->focus_highlight.cur.handled)
1182 common_visible = EINA_FALSE;
1183 if (win->focus_highlight.cur.visible)
1184 sig = "elm,action,focus_highlight,show";
1186 sig = "elm,action,focus_highlight,hide";
1189 common_visible = win->focus_highlight.cur.visible;
1191 _elm_win_focus_highlight_visible_set(win, common_visible);
1193 elm_widget_signal_emit(target, sig, "elm");
1195 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1198 if (win->focus_highlight.changed_theme)
1201 if (win->focus_highlight.style)
1202 str = win->focus_highlight.style;
1205 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1207 win->focus_highlight.changed_theme = EINA_FALSE;
1209 if (_elm_config->focus_highlight_animate)
1211 str = edje_object_data_get(win->focus_highlight.top, "animate");
1212 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1216 if ((win->focus_highlight.top_animate) && (previous) &&
1217 (!win->focus_highlight.prev.handled))
1218 _elm_win_focus_highlight_anim_setup(win, top);
1220 _elm_win_focus_highlight_simple_setup(win, top);
1221 evas_object_raise(top);
1224 win->focus_highlight.geometry_changed = EINA_FALSE;
1225 win->focus_highlight.prev = win->focus_highlight.cur;
1230 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1232 Evas_Event_Key_Down *ev = event_info;
1234 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1238 if ((strcmp(ev->keyname, "F12")) ||
1239 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1242 printf("Tree graph generated.\n");
1243 elm_object_tree_dot_dump(obj, "./dump.dot");
1248 _win_img_hide(void *data,
1250 Evas_Object *obj __UNUSED__,
1251 void *event_info __UNUSED__)
1253 Elm_Win *win = data;
1255 elm_widget_focus_hide_handle(win->win_obj);
1259 _win_img_mouse_down(void *data,
1261 Evas_Object *obj __UNUSED__,
1262 void *event_info __UNUSED__)
1264 Elm_Win *win = data;
1265 elm_widget_focus_mouse_down_handle(win->win_obj);
1269 _win_img_focus_in(void *data,
1271 Evas_Object *obj __UNUSED__,
1272 void *event_info __UNUSED__)
1274 Elm_Win *win = data;
1275 elm_widget_focus_steal(win->win_obj);
1279 _win_img_focus_out(void *data,
1281 Evas_Object *obj __UNUSED__,
1282 void *event_info __UNUSED__)
1284 Elm_Win *win = data;
1285 elm_widget_focused_object_clear(win->win_obj);
1289 _win_inlined_image_set(Elm_Win *win)
1291 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1292 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1293 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1294 _elm_win_obj_callback_img_obj_del, win);
1296 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1297 _win_img_hide, win);
1298 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1299 _win_img_mouse_down, win);
1300 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1301 _win_img_focus_in, win);
1302 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1303 _win_img_focus_out, win);
1307 * Adds a window object. If this is the first window created, pass NULL as
1310 * @param parent Parent object to add the window to, or NULL
1311 * @param name The name of the window
1312 * @param type The window type, one of the following:
1314 * ELM_WIN_DIALOG_BASIC
1322 * @return The created object, or NULL on failure
1327 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1331 const char *fontpath;
1333 win = ELM_NEW(Elm_Win);
1335 #define FALLBACK_TRY(engine) \
1338 CRITICAL(engine " engine creation failed. Trying software X11."); \
1339 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1341 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1345 case ELM_WIN_INLINED_IMAGE:
1349 Evas *e = evas_object_evas_get(parent);
1352 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1355 win->img_obj = ecore_evas_object_image_new(ee);
1358 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1361 _win_inlined_image_set(win);
1365 evas_object_del(win->img_obj);
1366 win->img_obj = NULL;
1375 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1377 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1378 #ifdef HAVE_ELEMENTARY_X
1379 win->client_message_handler = ecore_event_handler_add
1380 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1383 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1385 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1386 FALLBACK_TRY("Sofware FB");
1388 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1390 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1391 FALLBACK_TRY("Sofware DirectFB");
1393 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1395 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1396 FALLBACK_TRY("Sofware-16");
1397 #ifdef HAVE_ELEMENTARY_X
1398 win->client_message_handler = ecore_event_handler_add
1399 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1402 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1404 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1405 FALLBACK_TRY("Sofware-8");
1406 #ifdef HAVE_ELEMENTARY_X
1407 win->client_message_handler = ecore_event_handler_add
1408 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1412 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1414 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1415 FALLBACK_TRY("XRender");
1416 #ifdef HAVE_ELEMENTARY_X
1417 win->client_message_handler = ecore_event_handler_add
1418 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1422 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1427 if (_elm_config->vsync)
1429 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1435 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1437 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1438 FALLBACK_TRY("OpenGL");
1439 #ifdef HAVE_ELEMENTARY_X
1440 win->client_message_handler = ecore_event_handler_add
1441 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1444 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1446 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1447 FALLBACK_TRY("Sofware Win32");
1449 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1451 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1452 FALLBACK_TRY("Sofware-16-WinCE");
1454 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1456 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1457 FALLBACK_TRY("Sofware SDL");
1459 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1461 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1462 FALLBACK_TRY("Sofware-16-SDL");
1464 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1466 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1467 FALLBACK_TRY("OpenGL SDL");
1469 else if (!strncmp(_elm_config->engine, "shot:", 5))
1471 win->ee = ecore_evas_buffer_new(1, 1);
1472 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1473 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1481 ERR("Cannot create window.");
1485 #ifdef HAVE_ELEMENTARY_X
1486 _elm_win_xwindow_get(win);
1488 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1489 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1490 // bg pixmap done by x - has other issues like can be redrawn by x before it
1491 // is filled/ready by app
1492 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1495 win->parent = parent;
1497 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1498 _elm_win_obj_callback_parent_del, win);
1500 win->evas = ecore_evas_get(win->ee);
1501 win->win_obj = elm_widget_add(win->evas);
1502 elm_widget_type_set(win->win_obj, "win");
1503 ELM_SET_WIDTYPE(widtype, "win");
1504 elm_widget_data_set(win->win_obj, win);
1505 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1506 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1507 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1508 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1509 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1510 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1511 evas_object_move(win->win_obj, 0, 0);
1512 evas_object_resize(win->win_obj, 1, 1);
1513 evas_object_layer_set(win->win_obj, 50);
1514 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1516 ecore_evas_object_associate(win->ee, win->win_obj,
1517 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1518 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1519 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1520 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1521 _elm_win_obj_callback_show, win);
1522 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1523 _elm_win_obj_callback_hide, win);
1524 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1525 _elm_win_obj_callback_del, win);
1526 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1527 _elm_win_obj_callback_move, win);
1528 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1529 _elm_win_obj_callback_resize, win);
1531 evas_object_intercept_move_callback_add(win->win_obj,
1532 _elm_win_obj_intercept_move, win);
1533 evas_object_intercept_show_callback_add(win->win_obj,
1534 _elm_win_obj_intercept_show, win);
1536 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1537 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1538 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1539 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1540 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1541 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1542 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1543 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1544 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1545 evas_font_path_append(win->evas, fontpath);
1546 if (!_elm_config->font_hinting)
1547 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1548 else if (_elm_config->font_hinting == 1)
1549 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1550 else if (_elm_config->font_hinting == 2)
1551 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1553 #ifdef HAVE_ELEMENTARY_X
1554 _elm_win_xwin_update(win);
1557 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1559 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1561 ecore_evas_fullscreen_set(win->ee, 1);
1563 #undef ENGINE_COMPARE
1565 if (_elm_config->focus_highlight_enable)
1566 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1569 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1570 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1571 _debug_key_down, win);
1573 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1575 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1578 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1580 return win->win_obj;
1584 * Add @p subobj as a resize object of window @p obj.
1586 * @param obj The window object
1587 * @param subobj The resize object to add
1592 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1596 ELM_CHECK_WIDTYPE(obj, widtype);
1597 win = elm_widget_data_get(obj);
1599 if (eina_list_data_find(win->subobjs, subobj)) return;
1600 win->subobjs = eina_list_append(win->subobjs, subobj);
1601 elm_widget_sub_object_add(obj, subobj);
1602 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1603 _elm_win_subobj_callback_del, obj);
1604 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1605 _elm_win_subobj_callback_changed_size_hints,
1607 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1608 evas_object_move(subobj, 0, 0);
1609 evas_object_resize(subobj, w, h);
1610 _elm_win_eval_subobjs(obj);
1614 * Delete @p subobj as a resize object of window @p obj.
1616 * @param obj The window object
1617 * @param subobj The resize object to add
1622 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1625 ELM_CHECK_WIDTYPE(obj, widtype);
1626 win = elm_widget_data_get(obj);
1628 evas_object_event_callback_del_full(subobj,
1629 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1630 _elm_win_subobj_callback_changed_size_hints,
1632 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1633 _elm_win_subobj_callback_del, obj);
1634 win->subobjs = eina_list_remove(win->subobjs, subobj);
1635 elm_widget_sub_object_del(obj, subobj);
1636 _elm_win_eval_subobjs(obj);
1640 * Set the title of the window
1642 * @param obj The window object
1643 * @param title The title to set
1648 elm_win_title_set(Evas_Object *obj, const char *title)
1651 ELM_CHECK_WIDTYPE(obj, widtype);
1652 win = elm_widget_data_get(obj);
1654 ecore_evas_title_set(win->ee, title);
1658 * Get the title of the window
1660 * @param obj The window object
1666 elm_win_title_get(const Evas_Object *obj)
1669 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1670 win = elm_widget_data_get(obj);
1671 if (!win) return NULL;
1672 return ecore_evas_title_get(win->ee);
1676 * Set the window's autodel state.
1678 * @param obj The window object
1679 * @param autodel If true, the window will automatically delete itself when closed
1684 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1687 ELM_CHECK_WIDTYPE(obj, widtype);
1688 win = elm_widget_data_get(obj);
1690 win->autodel = autodel;
1694 * Get the window's autodel state.
1696 * @param obj The window object
1697 * @return If the window will automatically delete itself when closed
1702 elm_win_autodel_get(const Evas_Object *obj)
1705 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1706 win = elm_widget_data_get(obj);
1707 if (!win) return EINA_FALSE;
1708 return win->autodel;
1712 * Activate a window object.
1714 * @param obj The window object
1719 elm_win_activate(Evas_Object *obj)
1722 ELM_CHECK_WIDTYPE(obj, widtype);
1723 win = elm_widget_data_get(obj);
1725 ecore_evas_activate(win->ee);
1729 * Lower a window object.
1731 * @param obj The window object
1736 elm_win_lower(Evas_Object *obj)
1739 ELM_CHECK_WIDTYPE(obj, widtype);
1740 win = elm_widget_data_get(obj);
1742 ecore_evas_lower(win->ee);
1746 * Raise a window object.
1748 * @param obj The window object
1753 elm_win_raise(Evas_Object *obj)
1756 ELM_CHECK_WIDTYPE(obj, widtype);
1757 win = elm_widget_data_get(obj);
1759 ecore_evas_raise(win->ee);
1763 * Set the borderless state of a window.
1765 * @param obj The window object
1766 * @param borderless If true, the window is borderless
1771 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1774 ELM_CHECK_WIDTYPE(obj, widtype);
1775 win = elm_widget_data_get(obj);
1777 ecore_evas_borderless_set(win->ee, borderless);
1778 #ifdef HAVE_ELEMENTARY_X
1779 _elm_win_xwin_update(win);
1784 * Get the borderless state of a window.
1786 * @param obj The window object
1787 * @return If true, the window is borderless
1792 elm_win_borderless_get(const Evas_Object *obj)
1795 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1796 win = elm_widget_data_get(obj);
1797 if (!win) return EINA_FALSE;
1798 return ecore_evas_borderless_get(win->ee);
1802 * Set the shaped state of a window.
1804 * @param obj The window object
1805 * @param shaped If true, the window is shaped
1810 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1813 ELM_CHECK_WIDTYPE(obj, widtype);
1814 win = elm_widget_data_get(obj);
1816 ecore_evas_shaped_set(win->ee, shaped);
1817 #ifdef HAVE_ELEMENTARY_X
1818 _elm_win_xwin_update(win);
1823 * Get the shaped state of a window.
1825 * @param obj The window object
1826 * @return If true, the window is shaped
1831 elm_win_shaped_get(const Evas_Object *obj)
1834 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1835 win = elm_widget_data_get(obj);
1836 if (!win) return EINA_FALSE;
1837 return ecore_evas_shaped_get(win->ee);
1841 * Set the alpha channel state of a window.
1843 * @param obj The window object
1844 * @param alpha If true, the window has an alpha channel
1849 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1852 ELM_CHECK_WIDTYPE(obj, widtype);
1853 win = elm_widget_data_get(obj);
1858 else if (win->img_obj)
1860 evas_object_image_alpha_set(win->img_obj, alpha);
1864 #ifdef HAVE_ELEMENTARY_X
1869 if (!_elm_config->compositing)
1870 elm_win_shaped_set(obj, alpha);
1872 ecore_evas_alpha_set(win->ee, alpha);
1875 ecore_evas_alpha_set(win->ee, alpha);
1876 _elm_win_xwin_update(win);
1880 ecore_evas_alpha_set(win->ee, alpha);
1885 * Get the alpha channel state of a window.
1887 * @param obj The window object
1888 * @return If true, the window has an alpha channel
1893 elm_win_alpha_get(const Evas_Object *obj)
1896 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1897 win = elm_widget_data_get(obj);
1898 if (!win) return EINA_FALSE;
1899 return ecore_evas_alpha_get(win->ee);
1903 * Set the transparency state of a window.
1905 * @param obj The window object
1906 * @param transparent If true, the window is transparent
1911 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1914 ELM_CHECK_WIDTYPE(obj, widtype);
1915 win = elm_widget_data_get(obj);
1921 else if (win->img_obj)
1923 evas_object_image_alpha_set(win->img_obj, transparent);
1927 #ifdef HAVE_ELEMENTARY_X
1930 ecore_evas_transparent_set(win->ee, transparent);
1931 _elm_win_xwin_update(win);
1935 ecore_evas_transparent_set(win->ee, transparent);
1940 * Get the transparency state of a window.
1942 * @param obj The window object
1943 * @return If true, the window is transparent
1948 elm_win_transparent_get(const Evas_Object *obj)
1951 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1952 win = elm_widget_data_get(obj);
1953 if (!win) return EINA_FALSE;
1955 return ecore_evas_transparent_get(win->ee);
1959 * Set the override state of a window.
1961 * @param obj The window object
1962 * @param override If true, the window is overridden
1967 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1970 ELM_CHECK_WIDTYPE(obj, widtype);
1971 win = elm_widget_data_get(obj);
1973 ecore_evas_override_set(win->ee, override);
1974 #ifdef HAVE_ELEMENTARY_X
1975 _elm_win_xwin_update(win);
1980 * Get the override state of a window.
1982 * @param obj The window object
1983 * @return If true, the window is overridden
1988 elm_win_override_get(const Evas_Object *obj)
1991 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1992 win = elm_widget_data_get(obj);
1993 if (!win) return EINA_FALSE;
1994 return ecore_evas_override_get(win->ee);
1998 * Set the fullscreen state of a window.
2000 * @param obj The window object
2001 * @param fullscreen If true, the window is fullscreen
2006 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2009 ELM_CHECK_WIDTYPE(obj, widtype);
2010 win = elm_widget_data_get(obj);
2013 // YYY: handle if win->img_obj
2014 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2015 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2016 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2018 // these engines... can ONLY be fullscreen
2023 ecore_evas_fullscreen_set(win->ee, fullscreen);
2024 #ifdef HAVE_ELEMENTARY_X
2025 _elm_win_xwin_update(win);
2028 #undef ENGINE_COMPARE
2032 * Get the fullscreen state of a window.
2034 * @param obj The window object
2035 * @return If true, the window is fullscreen
2040 elm_win_fullscreen_get(const Evas_Object *obj)
2043 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2044 win = elm_widget_data_get(obj);
2045 if (!win) return EINA_FALSE;
2047 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2048 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2049 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2051 // these engines... can ONLY be fullscreen
2056 return ecore_evas_fullscreen_get(win->ee);
2058 #undef ENGINE_COMPARE
2062 * Set the maximized state of a window.
2064 * @param obj The window object
2065 * @param maximized If true, the window is maximized
2070 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2073 ELM_CHECK_WIDTYPE(obj, widtype);
2074 win = elm_widget_data_get(obj);
2076 // YYY: handle if win->img_obj
2077 ecore_evas_maximized_set(win->ee, maximized);
2078 #ifdef HAVE_ELEMENTARY_X
2079 _elm_win_xwin_update(win);
2084 * Get the maximized state of a window.
2086 * @param obj The window object
2087 * @return If true, the window is maximized
2092 elm_win_maximized_get(const Evas_Object *obj)
2095 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2096 win = elm_widget_data_get(obj);
2097 if (!win) return EINA_FALSE;
2098 return ecore_evas_maximized_get(win->ee);
2102 * Set the iconified state of a window.
2104 * @param obj The window object
2105 * @param iconified If true, the window is iconified
2110 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2113 ELM_CHECK_WIDTYPE(obj, widtype);
2114 win = elm_widget_data_get(obj);
2116 ecore_evas_iconified_set(win->ee, iconified);
2117 #ifdef HAVE_ELEMENTARY_X
2118 _elm_win_xwin_update(win);
2123 * Get the iconified state of a window.
2125 * @param obj The window object
2126 * @return If true, the window is iconified
2131 elm_win_iconified_get(const Evas_Object *obj)
2134 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2135 win = elm_widget_data_get(obj);
2136 if (!win) return EINA_FALSE;
2137 return ecore_evas_iconified_get(win->ee);
2141 * Set the layer of the window.
2143 * @param obj The window object
2144 * @param layer The layer of the window
2149 elm_win_layer_set(Evas_Object *obj, int layer)
2152 ELM_CHECK_WIDTYPE(obj, widtype);
2153 win = elm_widget_data_get(obj);
2155 ecore_evas_layer_set(win->ee, layer);
2156 #ifdef HAVE_ELEMENTARY_X
2157 _elm_win_xwin_update(win);
2162 * Get the layer of the window.
2164 * @param obj The window object
2165 * @return The layer of the window
2170 elm_win_layer_get(const Evas_Object *obj)
2173 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2174 win = elm_widget_data_get(obj);
2175 if (!win) return -1;
2176 return ecore_evas_layer_get(win->ee);
2180 * Set the rotation of the window.
2182 * @param obj The window object
2183 * @param rotation The rotation of the window, in degrees (0-360)
2188 elm_win_rotation_set(Evas_Object *obj, int rotation)
2191 ELM_CHECK_WIDTYPE(obj, widtype);
2192 win = elm_widget_data_get(obj);
2194 if (win->rot == rotation) return;
2195 win->rot = rotation;
2196 ecore_evas_rotation_set(win->ee, rotation);
2197 evas_object_size_hint_min_set(obj, -1, -1);
2198 evas_object_size_hint_max_set(obj, -1, -1);
2199 _elm_win_eval_subobjs(obj);
2200 #ifdef HAVE_ELEMENTARY_X
2201 _elm_win_xwin_update(win);
2206 * Rotates the window and resizes it
2208 * @param obj The window object
2209 * @param layer The rotation of the window in degrees (0-360)
2214 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2217 ELM_CHECK_WIDTYPE(obj, widtype);
2218 win = elm_widget_data_get(obj);
2220 if (win->rot == rotation) return;
2221 win->rot = rotation;
2222 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2223 evas_object_size_hint_min_set(obj, -1, -1);
2224 evas_object_size_hint_max_set(obj, -1, -1);
2225 _elm_win_eval_subobjs(obj);
2226 #ifdef HAVE_ELEMENTARY_X
2227 _elm_win_xwin_update(win);
2232 * Get the rotation of the window.
2234 * @param obj The window object
2235 * @return The rotation of the window in degrees (0-360)
2240 elm_win_rotation_get(const Evas_Object *obj)
2243 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2244 win = elm_widget_data_get(obj);
2245 if (!win) return -1;
2250 * Set the sticky state of the window.
2252 * @param obj The window object
2253 * @param sticky If true, the window's sticky state is enabled
2258 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2261 ELM_CHECK_WIDTYPE(obj, widtype);
2262 win = elm_widget_data_get(obj);
2264 ecore_evas_sticky_set(win->ee, sticky);
2265 #ifdef HAVE_ELEMENTARY_X
2266 _elm_win_xwin_update(win);
2271 * Get the sticky state of the window.
2273 * @param obj The window object
2274 * @return If true, the window's sticky state is enabled
2279 elm_win_sticky_get(const Evas_Object *obj)
2282 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2283 win = elm_widget_data_get(obj);
2284 if (!win) return EINA_FALSE;
2285 return ecore_evas_sticky_get(win->ee);
2289 * Sets the keyboard mode of the window.
2291 * @param obj The window object
2292 * @param mode The mode to set; one of:
2293 * ELM_WIN_KEYBOARD_UNKNOWN
2294 * ELM_WIN_KEYBOARD_OFF
2295 * ELM_WIN_KEYBOARD_ON
2296 * ELM_WIN_KEYBOARD_ALPHA
2297 * ELM_WIN_KEYBOARD_NUMERIC
2298 * ELM_WIN_KEYBOARD_PIN
2299 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2300 * ELM_WIN_KEYBOARD_HEX
2301 * ELM_WIN_KEYBOARD_TERMINAL
2302 * ELM_WIN_KEYBOARD_PASSWORD
2303 * ELM_WIN_KEYBOARD_IP
2304 * ELM_WIN_KEYBOARD_HOST
2305 * ELM_WIN_KEYBOARD_FILE
2306 * ELM_WIN_KEYBOARD_URL
2307 * ELM_WIN_KEYBOARD_KEYPAD
2308 * ELM_WIN_KEYBOARD_J2ME
2313 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2316 ELM_CHECK_WIDTYPE(obj, widtype);
2317 win = elm_widget_data_get(obj);
2319 if (mode == win->kbdmode) return;
2320 #ifdef HAVE_ELEMENTARY_X
2321 _elm_win_xwindow_get(win);
2323 win->kbdmode = mode;
2324 #ifdef HAVE_ELEMENTARY_X
2326 ecore_x_e_virtual_keyboard_state_set
2327 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2332 * Gets the keyboard mode of the window.
2334 * @param obj The window object
2335 * @return The mode; one of:
2336 * ELM_WIN_KEYBOARD_UNKNOWN
2337 * ELM_WIN_KEYBOARD_OFF
2338 * ELM_WIN_KEYBOARD_ON
2339 * ELM_WIN_KEYBOARD_ALPHA
2340 * ELM_WIN_KEYBOARD_NUMERIC
2341 * ELM_WIN_KEYBOARD_PIN
2342 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2343 * ELM_WIN_KEYBOARD_HEX
2344 * ELM_WIN_KEYBOARD_TERMINAL
2345 * ELM_WIN_KEYBOARD_PASSWORD
2346 * ELM_WIN_KEYBOARD_IP
2347 * ELM_WIN_KEYBOARD_HOST
2348 * ELM_WIN_KEYBOARD_FILE
2349 * ELM_WIN_KEYBOARD_URL
2350 * ELM_WIN_KEYBOARD_KEYPAD
2351 * ELM_WIN_KEYBOARD_J2ME
2355 EAPI Elm_Win_Keyboard_Mode
2356 elm_win_keyboard_mode_get(const Evas_Object *obj)
2359 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2360 win = elm_widget_data_get(obj);
2361 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2362 return win->kbdmode;
2366 * Sets whether the window is a keyboard.
2368 * @param obj The window object
2369 * @param is_keyboard If true, the window is a virtual keyboard
2374 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2377 ELM_CHECK_WIDTYPE(obj, widtype);
2378 win = elm_widget_data_get(obj);
2380 #ifdef HAVE_ELEMENTARY_X
2381 _elm_win_xwindow_get(win);
2383 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2388 * Gets whether the window is a keyboard.
2390 * @param obj The window object
2391 * @return If the window is a virtual keyboard
2396 elm_win_keyboard_win_get(const Evas_Object *obj)
2399 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2400 win = elm_widget_data_get(obj);
2401 if (!win) return EINA_FALSE;
2402 #ifdef HAVE_ELEMENTARY_X
2403 _elm_win_xwindow_get(win);
2405 return ecore_x_e_virtual_keyboard_get(win->xwin);
2411 * Get the screen position of a window.
2413 * @param obj The window object
2414 * @param x The int to store the x coordinate to
2415 * @param y The int to store the y coordinate to
2420 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2423 ELM_CHECK_WIDTYPE(obj, widtype);
2424 win = elm_widget_data_get(obj);
2426 if (x) *x = win->screen.x;
2427 if (y) *y = win->screen.y;
2431 * Set if this window is an illume conformant window
2433 * @param obj The window object
2434 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2439 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2442 ELM_CHECK_WIDTYPE(obj, widtype);
2443 win = elm_widget_data_get(obj);
2445 #ifdef HAVE_ELEMENTARY_X
2446 _elm_win_xwindow_get(win);
2448 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2453 * Get if this window is an illume conformant window
2455 * @param obj The window object
2456 * @return A boolean if this window is illume conformant or not
2461 elm_win_conformant_get(const Evas_Object *obj)
2464 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2465 win = elm_widget_data_get(obj);
2466 if (!win) return EINA_FALSE;
2467 #ifdef HAVE_ELEMENTARY_X
2468 _elm_win_xwindow_get(win);
2470 return ecore_x_e_illume_conformant_get(win->xwin);
2476 * Set a window to be an illume quickpanel window
2478 * By default window objects are not quickpanel windows.
2480 * @param obj The window object
2481 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2486 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2489 ELM_CHECK_WIDTYPE(obj, widtype);
2490 win = elm_widget_data_get(obj);
2492 #ifdef HAVE_ELEMENTARY_X
2493 _elm_win_xwindow_get(win);
2496 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2499 Ecore_X_Window_State states[2];
2501 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2502 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2503 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2504 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2511 * Get if this window is a quickpanel or not
2513 * @param obj The window object
2514 * @return A boolean if this window is a quickpanel or not
2519 elm_win_quickpanel_get(const Evas_Object *obj)
2522 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2523 win = elm_widget_data_get(obj);
2524 if (!win) return EINA_FALSE;
2525 #ifdef HAVE_ELEMENTARY_X
2526 _elm_win_xwindow_get(win);
2528 return ecore_x_e_illume_quickpanel_get(win->xwin);
2534 * Set the major priority of a quickpanel window
2536 * @param obj The window object
2537 * @param priority The major priority for this quickpanel
2542 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2545 ELM_CHECK_WIDTYPE(obj, widtype);
2546 win = elm_widget_data_get(obj);
2548 #ifdef HAVE_ELEMENTARY_X
2549 _elm_win_xwindow_get(win);
2551 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2556 * Get the major priority of a quickpanel window
2558 * @param obj The window object
2559 * @return The major priority of this quickpanel
2564 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2567 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2568 win = elm_widget_data_get(obj);
2569 if (!win) return -1;
2570 #ifdef HAVE_ELEMENTARY_X
2571 _elm_win_xwindow_get(win);
2573 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2579 * Set the minor priority of a quickpanel window
2581 * @param obj The window object
2582 * @param priority The minor priority for this quickpanel
2587 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2590 ELM_CHECK_WIDTYPE(obj, widtype);
2591 win = elm_widget_data_get(obj);
2593 #ifdef HAVE_ELEMENTARY_X
2594 _elm_win_xwindow_get(win);
2596 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2601 * Get the minor priority of a quickpanel window
2603 * @param obj The window object
2604 * @return The minor priority of this quickpanel
2609 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2612 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2613 win = elm_widget_data_get(obj);
2614 if (!win) return -1;
2615 #ifdef HAVE_ELEMENTARY_X
2616 _elm_win_xwindow_get(win);
2618 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2624 * Set which zone this quickpanel should appear in
2626 * @param obj The window object
2627 * @param zone The requested zone for this quickpanel
2632 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2635 ELM_CHECK_WIDTYPE(obj, widtype);
2636 win = elm_widget_data_get(obj);
2638 #ifdef HAVE_ELEMENTARY_X
2639 _elm_win_xwindow_get(win);
2641 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2646 * Get which zone this quickpanel should appear in
2648 * @param obj The window object
2649 * @return The requested zone for this quickpanel
2654 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2657 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2658 win = elm_widget_data_get(obj);
2660 #ifdef HAVE_ELEMENTARY_X
2661 _elm_win_xwindow_get(win);
2663 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2669 * Set the window to be skipped by keyboard focus
2671 * This sets the window to be skipped by normal keyboard input. This means
2672 * a window manager will be asked to not focus this window as well as omit
2673 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2675 * Call this and enable it on a window BEFORE you show it for the first time,
2676 * otherwise it may have no effect.
2678 * Use this for windows that have only output information or might only be
2679 * interacted with by the mouse or fingers, and never for typing input.
2680 * Be careful that this may have side-effects like making the window
2681 * non-accessible in some cases unless the window is specially handled. Use
2684 * @param obj The window object
2685 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2690 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2693 ELM_CHECK_WIDTYPE(obj, widtype);
2694 win = elm_widget_data_get(obj);
2696 #ifdef HAVE_ELEMENTARY_X
2697 _elm_win_xwindow_get(win);
2702 Ecore_X_Window_State states[2];
2704 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2705 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2706 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2707 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2714 * Send a command to the windowing environment
2716 * This is intended to work in touchscreen or small screen device environments
2717 * where there is a more simplistic window management policy in place. This
2718 * uses the window object indicated to select which part of the environment
2719 * to control (the part that this window lives in), and provides a command
2720 * and an optional parameter structure (use NULL for this if not needed).
2722 * @param obj The window object that lives in the environment to control
2723 * @param command The command to send
2724 * @param params Optional parameters for the command
2729 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2732 ELM_CHECK_WIDTYPE(obj, widtype);
2733 win = elm_widget_data_get(obj);
2735 #ifdef HAVE_ELEMENTARY_X
2736 _elm_win_xwindow_get(win);
2741 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2742 ecore_x_e_illume_focus_back_send(win->xwin);
2744 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2745 ecore_x_e_illume_focus_forward_send(win->xwin);
2747 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2748 ecore_x_e_illume_focus_home_send(win->xwin);
2750 case ELM_ILLUME_COMMAND_CLOSE:
2751 ecore_x_e_illume_close_send(win->xwin);
2761 * Get the inlined image object handle
2763 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2764 * then the window is in fact an evas image object inlined in the parent
2765 * canvas. You can get this object (be careful to not manipulate it as it
2766 * is under control of elementary), and use it to do things like get pixel
2767 * data, save the image to a file, etc.
2769 * @param obj The window object to get the inlined image from
2770 * @return The inlined image object, or NULL if none exists
2775 elm_win_inlined_image_object_get(Evas_Object *obj)
2778 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2779 win = elm_widget_data_get(obj);
2780 if (!win) return NULL;
2781 return win->img_obj;
2785 * Set the enabled status for the focus highlight in a window
2787 * This function will enable or disable the focus highlight only for the
2788 * given window, regardless of the global setting for it
2790 * @param obj The window where to enable the highlight
2791 * @param enabled The enabled value for the highlight
2796 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2800 ELM_CHECK_WIDTYPE(obj, widtype);
2802 win = elm_widget_data_get(obj);
2803 enabled = !!enabled;
2804 if (win->focus_highlight.enabled == enabled)
2807 win->focus_highlight.enabled = enabled;
2809 if (win->focus_highlight.enabled)
2810 _elm_win_focus_highlight_init(win);
2812 _elm_win_focus_highlight_shutdown(win);
2816 * Get the enabled value of the focus highlight for this window
2818 * @param obj The window in which to check if the focus highlight is enabled
2820 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2825 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2829 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2831 win = elm_widget_data_get(obj);
2832 return win->focus_highlight.enabled;
2836 * Set the style for the focus highlight on this window
2838 * Sets the style to use for theming the highlight of focused objects on
2839 * the given window. If @p style is NULL, the default will be used.
2841 * @param obj The window where to set the style
2842 * @param style The style to set
2847 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2851 ELM_CHECK_WIDTYPE(obj, widtype);
2853 win = elm_widget_data_get(obj);
2854 eina_stringshare_replace(&win->focus_highlight.style, style);
2855 win->focus_highlight.changed_theme = EINA_TRUE;
2856 _elm_win_focus_highlight_reconfigure_job_start(win);
2860 * Get the style set for the focus highlight object
2862 * Gets the style set for this windows highilght object, or NULL if none
2865 * @param obj The window to retrieve the highlights style from
2867 * @return The style set or NULL if none was. Default is used in that case.
2872 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2876 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2878 win = elm_widget_data_get(obj);
2879 return win->focus_highlight.style;
2882 typedef struct _Widget_Data Widget_Data;
2887 Evas_Object *content;
2890 static void _del_hook(Evas_Object *obj);
2891 static void _theme_hook(Evas_Object *obj);
2892 static void _sizing_eval(Evas_Object *obj);
2893 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2894 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2896 static const char *widtype2 = NULL;
2899 _del_hook(Evas_Object *obj)
2901 Widget_Data *wd = elm_widget_data_get(obj);
2907 _theme_hook(Evas_Object *obj)
2909 Widget_Data *wd = elm_widget_data_get(obj);
2910 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2912 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2917 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2919 Widget_Data *wd = elm_widget_data_get(obj);
2924 /* Try Focus cycle in subitem */
2927 elm_widget_focus_next_get(wd->content, dir, next);
2932 *next = (Evas_Object *)obj;
2937 _sizing_eval(Evas_Object *obj)
2939 Widget_Data *wd = elm_widget_data_get(obj);
2940 Evas_Coord minw = -1, minh = -1;
2942 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2943 edje_object_size_min_calc(wd->frm, &minw, &minh);
2944 evas_object_size_hint_min_set(obj, minw, minh);
2945 evas_object_size_hint_max_set(obj, -1, -1);
2949 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2955 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2957 Widget_Data *wd = elm_widget_data_get(obj);
2958 Evas_Object *sub = event_info;
2959 if (sub == wd->content)
2961 evas_object_event_callback_del_full
2962 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2969 * @defgroup Inwin Inwin
2971 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2974 elm_win_inwin_add(Evas_Object *obj)
2980 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2981 win = elm_widget_data_get(obj);
2982 if (!win) return NULL;
2983 wd = ELM_NEW(Widget_Data);
2984 obj2 = elm_widget_add(win->evas);
2985 elm_widget_type_set(obj2, "inwin");
2986 ELM_SET_WIDTYPE(widtype2, "inwin");
2987 elm_widget_sub_object_add(obj, obj2);
2988 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2989 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2990 elm_win_resize_object_add(obj, obj2);
2992 elm_widget_data_set(obj2, wd);
2993 elm_widget_del_hook_set(obj2, _del_hook);
2994 elm_widget_theme_hook_set(obj2, _theme_hook);
2995 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2996 elm_widget_can_focus_set(obj2, EINA_TRUE);
2997 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2999 wd->frm = edje_object_add(win->evas);
3000 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3001 elm_widget_resize_object_set(obj2, wd->frm);
3003 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3010 * Activates an inwin object
3012 * @param obj The inwin to activate
3017 elm_win_inwin_activate(Evas_Object *obj)
3019 ELM_CHECK_WIDTYPE(obj, widtype2);
3020 Widget_Data *wd = elm_widget_data_get(obj);
3022 evas_object_raise(obj);
3023 evas_object_show(obj);
3024 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3025 elm_object_focus(obj);
3029 * Set the content of an inwin object.
3031 * Once the content object is set, a previously set one will be deleted.
3032 * If you want to keep that old content object, use the
3033 * elm_win_inwin_content_unset() function.
3035 * @param obj The inwin object
3036 * @param content The object to set as content
3041 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3043 ELM_CHECK_WIDTYPE(obj, widtype2);
3044 Widget_Data *wd = elm_widget_data_get(obj);
3046 if (wd->content == content) return;
3047 if (wd->content) evas_object_del(wd->content);
3048 wd->content = content;
3051 elm_widget_sub_object_add(obj, content);
3052 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3053 _changed_size_hints, obj);
3054 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3060 * Get the content of an inwin object.
3062 * Return the content object which is set for this widget.
3064 * @param obj The inwin object
3065 * @return The content that is being used
3070 elm_win_inwin_content_get(const Evas_Object *obj)
3072 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3073 Widget_Data *wd = elm_widget_data_get(obj);
3074 if (!wd) return NULL;
3079 * Unset the content of an inwin object.
3081 * Unparent and return the content object which was set for this widget.
3083 * @param obj The inwin object
3084 * @return The content that was being used
3089 elm_win_inwin_content_unset(Evas_Object *obj)
3091 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3092 Widget_Data *wd = elm_widget_data_get(obj);
3093 if (!wd) return NULL;
3094 if (!wd->content) return NULL;
3095 Evas_Object *content = wd->content;
3096 elm_widget_sub_object_del(obj, wd->content);
3097 edje_object_part_unswallow(wd->frm, wd->content);
3102 /* windowing spcific calls - shall we do this differently? */
3104 static Ecore_X_Window
3105 _elm_ee_win_get(const Evas_Object *obj)
3108 #ifdef HAVE_ELEMENTARY_X
3109 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3110 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3116 * Get the Ecore_X_Window of an Evas_Object
3118 * @param obj The object
3120 * @return The Ecore_X_Window of @p obj
3125 elm_win_xwindow_get(const Evas_Object *obj)
3127 Ecore_X_Window xwin = 0;
3132 type = elm_widget_type_get(obj);
3133 if (!type) return 0;
3134 if (type != widtype) return _elm_ee_win_get(obj);
3135 #ifdef HAVE_ELEMENTARY_X
3136 win = elm_widget_data_get(obj);
3137 if (!win) return xwin;
3138 if (win->xwin) return win->xwin;
3139 if (win->parent) return elm_win_xwindow_get(win->parent);