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][:][repeat=DDD][:][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". Repeat option is for continous
54 * capturing screenshots. Repeat range is from 1 to 999 and
55 * filename is fixed to "out001.png"
56 * Some examples of using the shot engine:
58 * ELM_ENGINE="shot:delay=1.0:repeat=5:file=elm_test.png" elementary_test
59 * ELM_ENGINE="shot:delay=1.0:file=elm_test.png" elementary_test
60 * ELM_ENGINE="shot:file=elm_test2.png" elementary_test
61 * ELM_ENGINE="shot:delay=2.0" elementary_test
62 * ELM_ENGINE="shot:" elementary_test
64 * Signals that you can add callbacks for are:
66 * "delete,request" - the user requested to delete the window
67 * "focus,in" - window got focus
68 * "focus,out" - window lost focus
69 * "moved" - window that holds the canvas was moved
72 typedef struct _Elm_Win Elm_Win;
78 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
80 #ifdef HAVE_ELEMENTARY_X
82 Ecore_Event_Handler *client_message_handler;
84 Ecore_Job *deferred_resize_job;
85 Ecore_Job *deferred_child_eval_job;
88 Elm_Win_Keyboard_Mode kbdmode;
95 Eina_Bool autodel : 1;
96 int *autodel_clear, rot;
106 Eina_Bool visible : 1;
107 Eina_Bool handled : 1;
111 Ecore_Job *reconf_job;
113 Eina_Bool enabled : 1;
114 Eina_Bool changed_theme : 1;
115 Eina_Bool top_animate : 1;
116 Eina_Bool geometry_changed : 1;
120 static const char *widtype = NULL;
121 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
122 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
123 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
124 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
125 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
126 static void _elm_win_move(Ecore_Evas *ee);
127 static void _elm_win_resize(Ecore_Evas *ee);
128 static void _elm_win_delete_request(Ecore_Evas *ee);
129 static void _elm_win_resize_job(void *data);
130 #ifdef HAVE_ELEMENTARY_X
131 static void _elm_win_xwin_update(Elm_Win *win);
133 static void _elm_win_eval_subobjs(Evas_Object *obj);
134 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
135 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
136 static void _elm_win_focus_highlight_init(Elm_Win *win);
137 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
138 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
139 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
140 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
141 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
142 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
144 static const char SIG_DELETE_REQUEST[] = "delete,request";
145 static const char SIG_FOCUS_OUT[] = "focus,in";
146 static const char SIG_FOCUS_IN[] = "focus,out";
147 static const char SIG_MOVED[] = "moved";
149 static const Evas_Smart_Cb_Description _signals[] = {
150 {SIG_DELETE_REQUEST, ""},
159 Eina_List *_elm_win_list = NULL;
160 int _elm_win_deferred_free = 0;
162 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
163 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
166 _shot_delay_get(Elm_Win *win)
169 char *d = strdup(win->shot.info);
172 for (p = (char *)win->shot.info; *p; p++)
174 if (!strncmp(p, "delay=", 6))
178 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
193 _shot_file_get(Elm_Win *win)
196 char *tmp = strdup(win->shot.info);
197 char *repname = NULL;
199 if (!tmp) return NULL;
201 for (p = (char *)win->shot.info; *p; p++)
203 if (!strncmp(p, "file=", 5))
206 if (!win->shot.repeat_count) return tmp;
209 char *dotptr = strrchr(tmp, '.');
212 repname = malloc(sizeof(char)*(strlen(tmp) + 16));
213 strncpy(repname, tmp, dotptr - tmp);
214 sprintf(repname + (dotptr - tmp), "%03i",
215 win->shot.shot_counter + 1);
216 strcat(repname, dotptr);
223 if (!win->shot.repeat_count) return strdup("out.png");
226 repname = malloc(sizeof(char) * 24);
227 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
233 _shot_repeat_count_get(Elm_Win *win)
237 char *d = strdup(win->shot.info);
240 for (p = (char *)win->shot.info; *p; p++)
242 if (!strncmp(p, "repeat=", 7))
246 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
253 if (v > 1000) v = 999;
263 _shot_key_get(Elm_Win *win __UNUSED__)
269 _shot_flags_get(Elm_Win *win __UNUSED__)
275 _shot_do(Elm_Win *win)
279 unsigned int *pixels;
281 char *file, *key, *flags;
283 ecore_evas_manual_render(win->ee);
284 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
286 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
287 if ((w < 1) || (h < 1)) return;
288 file = _shot_file_get(win);
290 key = _shot_key_get(win);
291 flags = _shot_flags_get(win);
292 ee = ecore_evas_buffer_new(1, 1);
293 o = evas_object_image_add(ecore_evas_get(ee));
294 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
295 evas_object_image_size_set(o, w, h);
296 evas_object_image_data_set(o, pixels);
297 if (!evas_object_image_save(o, file, key, flags))
299 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
304 if (flags) free(flags);
306 if (win->shot.repeat_count) win->shot.shot_counter++;
310 _shot_delay(void *data)
314 if (win->shot.repeat_count)
316 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
317 if (remainshot > 0) return EINA_TRUE;
319 win->shot.timer = NULL;
325 _shot_init(Elm_Win *win)
327 if (!win->shot.info) return;
328 win->shot.repeat_count = _shot_repeat_count_get(win);
329 win->shot.shot_counter = 0;
333 _shot_handle(Elm_Win *win)
335 if (!win->shot.info) return;
336 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
340 _elm_win_move(Ecore_Evas *ee)
342 Evas_Object *obj = ecore_evas_object_associate_get(ee);
347 win = elm_widget_data_get(obj);
349 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
352 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
356 _elm_win_resize(Ecore_Evas *ee)
358 Evas_Object *obj = ecore_evas_object_associate_get(ee);
362 win = elm_widget_data_get(obj);
364 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
365 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
369 _elm_win_focus_in(Ecore_Evas *ee)
371 Evas_Object *obj = ecore_evas_object_associate_get(ee);
375 win = elm_widget_data_get(obj);
377 /*NB: Why two different "focus signals" here ??? */
378 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
379 win->focus_highlight.cur.visible = EINA_TRUE;
380 _elm_win_focus_highlight_reconfigure_job_start(win);
384 else if (win->img_obj)
391 _elm_win_focus_out(Ecore_Evas *ee)
393 Evas_Object *obj = ecore_evas_object_associate_get(ee);
397 win = elm_widget_data_get(obj);
399 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
400 win->focus_highlight.cur.visible = EINA_FALSE;
401 _elm_win_focus_highlight_reconfigure_job_start(win);
405 else if (win->img_obj)
412 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
414 Elm_Win *wd = elm_widget_data_get(obj);
415 const Eina_List *items;
416 void *(*list_data_get) (const Eina_List *list);
424 if (!(items = elm_widget_focus_custom_chain_get(obj)))
430 list_data_get = eina_list_data_get;
432 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
438 *next = (Evas_Object *)obj;
443 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
445 Elm_Win *win = elm_widget_data_get(obj);
449 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
451 evas_object_focus_set(obj, elm_widget_focus_get(obj));
455 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
457 if (type == EVAS_CALLBACK_KEY_DOWN)
459 Evas_Event_Key_Down *ev = event_info;
460 if (!strcmp(ev->keyname, "Tab"))
462 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
463 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
465 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
466 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
475 _deferred_ecore_evas_free(void *data)
477 ecore_evas_free(data);
478 _elm_win_deferred_free--;
482 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
486 elm_object_focus(obj);
487 if (win->shot.info) _shot_handle(win);
491 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
498 else if (win->img_obj)
500 evas_object_hide(win->img_obj);
505 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
512 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
513 _elm_win_obj_callback_parent_del, win);
516 if (win->autodel_clear) *(win->autodel_clear) = -1;
517 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
518 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
521 ecore_evas_callback_delete_request_set(win->ee, NULL);
522 ecore_evas_callback_resize_set(win->ee, NULL);
524 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
525 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
526 if (win->shot.info) eina_stringshare_del(win->shot.info);
527 if (win->shot.timer) ecore_timer_del(win->shot.timer);
528 while (((child = evas_object_bottom_get(win->evas))) &&
531 evas_object_del(child);
533 while (((child = evas_object_top_get(win->evas))) &&
536 evas_object_del(child);
538 #ifdef HAVE_ELEMENTARY_X
539 if (win->client_message_handler)
540 ecore_event_handler_del(win->client_message_handler);
542 // FIXME: Why are we flushing edje on every window destroy ??
543 // edje_file_cache_flush();
544 // edje_collection_cache_flush();
545 // evas_image_cache_flush(win->evas);
546 // evas_font_cache_flush(win->evas);
547 // FIXME: we are in the del handler for the object and delete the canvas
548 // that lives under it from the handler... nasty. deferring doesn't help either
558 ecore_job_add(_deferred_ecore_evas_free, win->ee);
559 _elm_win_deferred_free++;
563 _elm_win_focus_highlight_shutdown(win);
564 eina_stringshare_del(win->focus_highlight.style);
568 if ((!_elm_win_list) &&
569 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
571 edje_file_cache_flush();
572 edje_collection_cache_flush();
573 evas_image_cache_flush(e);
574 evas_font_cache_flush(e);
580 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
583 if (!win->img_obj) return;
584 evas_object_event_callback_del_full
585 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
586 evas_object_del(win->img_obj);
590 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
593 if (obj == win->parent) win->parent = NULL;
597 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
603 if ((x != win->screen.x) || (y != win->screen.y))
607 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
612 evas_object_move(obj, x, y);
617 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
620 // this is called to make sure all smart containers have calculated their
621 // sizes BEFORE we show the window to make sure it initially appears at
622 // our desired size (ie min size is known first)
623 evas_smart_objects_calculate(evas_object_evas_get(obj));
624 evas_object_show(obj);
628 else if (win->img_obj)
630 evas_object_show(win->img_obj);
635 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
639 if (ecore_evas_override_get(win->ee))
643 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
646 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
651 else if (win->img_obj)
655 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
658 // evas_object_move(win->img_obj, x, y);
663 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
670 else if (win->img_obj)
672 Evas_Coord w = 1, h = 1;
674 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
677 evas_object_image_size_set(win->img_obj, w, h);
682 _elm_win_delete_request(Ecore_Evas *ee)
684 Evas_Object *obj = ecore_evas_object_associate_get(ee);
686 if (strcmp(elm_widget_type_get(obj), "win")) return;
688 win = elm_widget_data_get(obj);
690 int autodel = win->autodel;
691 win->autodel_clear = &autodel;
692 evas_object_ref(win->win_obj);
693 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
694 // FIXME: if above callback deletes - then the below will be invalid
695 if (autodel) evas_object_del(win->win_obj);
696 else win->autodel_clear = NULL;
697 evas_object_unref(win->win_obj);
701 _elm_win_resize_job(void *data)
708 win->deferred_resize_job = NULL;
709 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
710 evas_object_resize(win->win_obj, w, h);
714 else if (win->img_obj)
717 EINA_LIST_FOREACH(win->subobjs, l, obj)
719 evas_object_move(obj, 0, 0);
720 evas_object_resize(obj, w, h);
724 #ifdef HAVE_ELEMENTARY_X
726 _elm_win_xwindow_get(Elm_Win *win)
730 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
731 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
733 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
735 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
736 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
737 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
738 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
739 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
740 ENGINE_COMPARE(ELM_OPENGL_SDL))
743 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
745 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
747 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
749 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
752 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
754 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
757 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
759 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
761 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
763 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
765 #undef ENGINE_COMPARE
769 #ifdef HAVE_ELEMENTARY_X
771 _elm_win_xwin_update(Elm_Win *win)
773 _elm_win_xwindow_get(win);
778 win2 = elm_widget_data_get(win->parent);
782 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
786 if (!win->xwin) return; /* nothing more to do */
791 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
793 case ELM_WIN_DIALOG_BASIC:
794 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
796 case ELM_WIN_DESKTOP:
797 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
800 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
802 case ELM_WIN_TOOLBAR:
803 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
806 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
808 case ELM_WIN_UTILITY:
809 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
812 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
814 case ELM_WIN_DROPDOWN_MENU:
815 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
817 case ELM_WIN_POPUP_MENU:
818 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
820 case ELM_WIN_TOOLTIP:
821 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
823 case ELM_WIN_NOTIFICATION:
824 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
827 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
830 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
835 ecore_x_e_virtual_keyboard_state_set
836 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
841 _elm_win_eval_subobjs(Evas_Object *obj)
844 const Evas_Object *child;
846 Elm_Win *win = elm_widget_data_get(obj);
847 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
851 EINA_LIST_FOREACH(win->subobjs, l, child)
853 evas_object_size_hint_weight_get(child, &wx, &wy);
854 if (wx == 0.0) xx = 0;
855 if (wy == 0.0) xy = 0;
857 evas_object_size_hint_min_get(child, &w, &h);
860 if (w > minw) minw = w;
861 if (h > minh) minh = h;
863 evas_object_size_hint_max_get(child, &w, &h);
866 if (maxw == -1) maxw = w;
867 else if ((w > 0) && (w < maxw)) maxw = w;
868 if (maxh == -1) maxh = h;
869 else if ((h > 0) && (h < maxh)) maxh = h;
871 if (!xx) maxw = minw;
873 if (!xy) maxh = minh;
875 evas_object_size_hint_min_set(obj, minw, minh);
876 evas_object_size_hint_max_set(obj, maxw, maxh);
877 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
878 if (w < minw) w = minw;
879 if (h < minh) h = minh;
880 if ((maxw >= 0) && (w > maxw)) w = maxw;
881 if ((maxh >= 0) && (h > maxh)) h = maxh;
882 evas_object_resize(obj, w, h);
886 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
888 Elm_Win *win = elm_widget_data_get(data);
889 win->subobjs = eina_list_remove(win->subobjs, obj);
890 _elm_win_eval_subobjs(win->win_obj);
894 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
896 _elm_win_eval_subobjs(data);
900 _elm_win_shutdown(void)
902 while (_elm_win_list)
903 evas_object_del(_elm_win_list->data);
907 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
914 EINA_LIST_FOREACH(_elm_win_list, l, obj)
915 elm_widget_theme(obj);
919 EINA_LIST_FOREACH(_elm_win_list, l, obj)
920 elm_widget_theme_specific(obj, th, EINA_FALSE);
924 #ifdef HAVE_ELEMENTARY_X
926 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
929 Ecore_X_Event_Client_Message *e = event;
931 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
932 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
934 if ((unsigned)e->data.l[0] == win->xwin)
936 Evas *evas = evas_object_evas_get(win->win_obj);
939 edje_file_cache_flush();
940 edje_collection_cache_flush();
941 evas_image_cache_flush(evas);
942 evas_font_cache_flush(evas);
946 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
948 if ((unsigned)e->data.l[0] == win->xwin)
950 Evas *evas = evas_object_evas_get(win->win_obj);
953 edje_file_cache_flush();
954 edje_collection_cache_flush();
955 evas_image_cache_flush(evas);
956 evas_font_cache_flush(evas);
957 evas_render_dump(evas);
961 return ECORE_CALLBACK_PASS_ON;
966 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
970 win->focus_highlight.geometry_changed = EINA_TRUE;
971 _elm_win_focus_highlight_reconfigure_job_start(win);
975 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
979 win->focus_highlight.geometry_changed = EINA_TRUE;
980 _elm_win_focus_highlight_reconfigure_job_start(win);
984 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
988 win->focus_highlight.cur.target = NULL;
990 _elm_win_focus_highlight_reconfigure_job_start(win);
994 _elm_win_focus_target_callbacks_add(Elm_Win *win)
996 Evas_Object *obj = win->focus_highlight.cur.target;
998 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
999 _elm_win_focus_target_move, win);
1000 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1001 _elm_win_focus_target_resize, win);
1002 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1003 _elm_win_focus_target_del, win);
1007 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1009 Evas_Object *obj = win->focus_highlight.cur.target;
1011 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1012 _elm_win_focus_target_move, win);
1013 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1014 _elm_win_focus_target_resize, win);
1015 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1016 _elm_win_focus_target_del, win);
1019 static Evas_Object *
1020 _elm_win_focus_target_get(Evas_Object *obj)
1022 Evas_Object *o = obj;
1026 if (elm_widget_is(o))
1028 if (!elm_widget_highlight_ignore_get(o))
1030 o = elm_widget_parent_get(o);
1032 o = evas_object_smart_parent_get(o);
1036 o = elm_widget_parent_widget_get(o);
1038 o = evas_object_smart_parent_get(o);
1047 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1049 Evas_Object *obj = event_info, *target;
1050 Elm_Win *win = data;
1052 if (win->focus_highlight.cur.target == obj)
1055 target = _elm_win_focus_target_get(obj);
1056 win->focus_highlight.cur.target = target;
1057 if (elm_widget_highlight_in_theme_get(target))
1058 win->focus_highlight.cur.handled = EINA_TRUE;
1060 _elm_win_focus_target_callbacks_add(win);
1062 _elm_win_focus_highlight_reconfigure_job_start(win);
1066 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1068 Elm_Win *win = data;
1070 if (!win->focus_highlight.cur.target)
1073 if (!win->focus_highlight.cur.handled)
1074 _elm_win_focus_target_callbacks_del(win);
1075 win->focus_highlight.cur.target = NULL;
1076 win->focus_highlight.cur.handled = EINA_FALSE;
1078 _elm_win_focus_highlight_reconfigure_job_start(win);
1082 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1084 evas_object_hide(obj);
1088 _elm_win_focus_highlight_init(Elm_Win *win)
1090 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1091 _elm_win_object_focus_in, win);
1092 evas_event_callback_add(win->evas,
1093 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1094 _elm_win_object_focus_out, win);
1096 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1098 win->focus_highlight.top = edje_object_add(win->evas);
1099 win->focus_highlight.changed_theme = EINA_TRUE;
1100 edje_object_signal_callback_add(win->focus_highlight.top,
1101 "elm,action,focus,hide,end", "",
1102 _elm_win_focus_highlight_hide, NULL);
1103 edje_object_signal_callback_add(win->focus_highlight.top,
1104 "elm,action,focus,anim,end", "",
1105 _elm_win_focus_highlight_anim_end, win);
1106 _elm_win_focus_highlight_reconfigure_job_start(win);
1110 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1112 _elm_win_focus_highlight_reconfigure_job_stop(win);
1113 if (win->focus_highlight.cur.target)
1115 _elm_win_focus_target_callbacks_del(win);
1116 win->focus_highlight.cur.target = NULL;
1118 if (win->focus_highlight.top)
1120 evas_object_del(win->focus_highlight.top);
1121 win->focus_highlight.top = NULL;
1124 evas_event_callback_del_full(win->evas,
1125 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1126 _elm_win_object_focus_in, win);
1127 evas_event_callback_del_full(win->evas,
1128 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1129 _elm_win_object_focus_out, win);
1133 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1137 top = win->focus_highlight.top;
1142 evas_object_show(top);
1143 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1149 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1154 _elm_win_focus_highlight_reconfigure_job(void *data)
1156 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1160 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1162 if (win->focus_highlight.reconf_job)
1163 ecore_job_del(win->focus_highlight.reconf_job);
1164 win->focus_highlight.reconf_job = ecore_job_add(
1165 _elm_win_focus_highlight_reconfigure_job, win);
1169 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1171 if (win->focus_highlight.reconf_job)
1172 ecore_job_del(win->focus_highlight.reconf_job);
1173 win->focus_highlight.reconf_job = NULL;
1177 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1179 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1180 Evas_Coord x, y, w, h;
1182 clip = evas_object_clip_get(target);
1183 evas_object_geometry_get(target, &x, &y, &w, &h);
1185 evas_object_move(obj, x, y);
1186 evas_object_resize(obj, w, h);
1187 evas_object_clip_set(obj, clip);
1191 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1193 Evas_Coord tx, ty, tw, th;
1194 Evas_Coord w, h, px, py, pw, ph;
1195 Edje_Message_Int_Set *m;
1196 Evas_Object *previous = win->focus_highlight.prev.target;
1197 Evas_Object *target = win->focus_highlight.cur.target;
1199 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1200 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1201 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1202 evas_object_move(obj, 0, 0);
1203 evas_object_resize(obj, tw, th);
1204 evas_object_clip_unset(obj);
1206 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1216 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1220 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1222 Elm_Win *win = data;
1223 _elm_win_focus_highlight_simple_setup(win, obj);
1227 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1229 Evas_Object *target = win->focus_highlight.cur.target;
1230 Evas_Object *previous = win->focus_highlight.prev.target;
1231 Evas_Object *top = win->focus_highlight.top;
1232 Eina_Bool visible_changed;
1233 Eina_Bool common_visible;
1234 const char *sig = NULL;
1236 _elm_win_focus_highlight_reconfigure_job_stop(win);
1238 visible_changed = (win->focus_highlight.cur.visible !=
1239 win->focus_highlight.prev.visible);
1241 if ((target == previous) && (!visible_changed) &&
1242 (!win->focus_highlight.geometry_changed))
1245 if ((previous) && (win->focus_highlight.prev.handled))
1246 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1249 common_visible = EINA_FALSE;
1250 else if (win->focus_highlight.cur.handled)
1252 common_visible = EINA_FALSE;
1253 if (win->focus_highlight.cur.visible)
1254 sig = "elm,action,focus_highlight,show";
1256 sig = "elm,action,focus_highlight,hide";
1259 common_visible = win->focus_highlight.cur.visible;
1261 _elm_win_focus_highlight_visible_set(win, common_visible);
1263 elm_widget_signal_emit(target, sig, "elm");
1265 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1268 if (win->focus_highlight.changed_theme)
1271 if (win->focus_highlight.style)
1272 str = win->focus_highlight.style;
1275 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1277 win->focus_highlight.changed_theme = EINA_FALSE;
1279 if (_elm_config->focus_highlight_animate)
1281 str = edje_object_data_get(win->focus_highlight.top, "animate");
1282 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1286 if ((win->focus_highlight.top_animate) && (previous) &&
1287 (!win->focus_highlight.prev.handled))
1288 _elm_win_focus_highlight_anim_setup(win, top);
1290 _elm_win_focus_highlight_simple_setup(win, top);
1291 evas_object_raise(top);
1294 win->focus_highlight.geometry_changed = EINA_FALSE;
1295 win->focus_highlight.prev = win->focus_highlight.cur;
1300 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1302 Evas_Event_Key_Down *ev = event_info;
1304 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1308 if ((strcmp(ev->keyname, "F12")) ||
1309 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1312 printf("Tree graph generated.\n");
1313 elm_object_tree_dot_dump(obj, "./dump.dot");
1318 _win_img_hide(void *data,
1320 Evas_Object *obj __UNUSED__,
1321 void *event_info __UNUSED__)
1323 Elm_Win *win = data;
1325 elm_widget_focus_hide_handle(win->win_obj);
1329 _win_img_mouse_down(void *data,
1331 Evas_Object *obj __UNUSED__,
1332 void *event_info __UNUSED__)
1334 Elm_Win *win = data;
1335 elm_widget_focus_mouse_down_handle(win->win_obj);
1339 _win_img_focus_in(void *data,
1341 Evas_Object *obj __UNUSED__,
1342 void *event_info __UNUSED__)
1344 Elm_Win *win = data;
1345 elm_widget_focus_steal(win->win_obj);
1349 _win_img_focus_out(void *data,
1351 Evas_Object *obj __UNUSED__,
1352 void *event_info __UNUSED__)
1354 Elm_Win *win = data;
1355 elm_widget_focused_object_clear(win->win_obj);
1359 _win_inlined_image_set(Elm_Win *win)
1361 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1362 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1363 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1364 _elm_win_obj_callback_img_obj_del, win);
1366 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1367 _win_img_hide, win);
1368 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1369 _win_img_mouse_down, win);
1370 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1371 _win_img_focus_in, win);
1372 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1373 _win_img_focus_out, win);
1377 * Adds a window object. If this is the first window created, pass NULL as
1380 * @param parent Parent object to add the window to, or NULL
1381 * @param name The name of the window
1382 * @param type The window type, one of the following:
1384 * ELM_WIN_DIALOG_BASIC
1392 * @return The created object, or NULL on failure
1397 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1401 const char *fontpath;
1403 win = ELM_NEW(Elm_Win);
1405 #define FALLBACK_TRY(engine) \
1408 CRITICAL(engine " engine creation failed. Trying software X11."); \
1409 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1411 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1415 case ELM_WIN_INLINED_IMAGE:
1418 Evas *e = evas_object_evas_get(parent);
1421 ee = ecore_evas_ecore_evas_get(e);
1423 win->img_obj = ecore_evas_object_image_new(ee);
1424 if (!win->img_obj) break;
1425 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1428 _win_inlined_image_set(win);
1431 evas_object_del(win->img_obj);
1432 win->img_obj = NULL;
1436 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1438 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
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_FB))
1446 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1447 FALLBACK_TRY("Sofware FB");
1449 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1451 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1452 FALLBACK_TRY("Sofware DirectFB");
1454 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1456 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1457 FALLBACK_TRY("Sofware-16");
1458 #ifdef HAVE_ELEMENTARY_X
1459 win->client_message_handler = ecore_event_handler_add
1460 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1463 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1465 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1466 FALLBACK_TRY("Sofware-8");
1467 #ifdef HAVE_ELEMENTARY_X
1468 win->client_message_handler = ecore_event_handler_add
1469 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1473 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1475 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1476 FALLBACK_TRY("XRender");
1477 #ifdef HAVE_ELEMENTARY_X
1478 win->client_message_handler = ecore_event_handler_add
1479 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1483 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1488 if (_elm_config->vsync)
1490 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1496 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1498 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1499 FALLBACK_TRY("OpenGL");
1500 #ifdef HAVE_ELEMENTARY_X
1501 win->client_message_handler = ecore_event_handler_add
1502 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1505 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1507 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1508 FALLBACK_TRY("Sofware Win32");
1510 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1512 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1513 FALLBACK_TRY("Sofware-16-WinCE");
1515 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1517 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1518 FALLBACK_TRY("Sofware SDL");
1520 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1522 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1523 FALLBACK_TRY("Sofware-16-SDL");
1525 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1527 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1528 FALLBACK_TRY("OpenGL SDL");
1530 else if (!strncmp(_elm_config->engine, "shot:", 5))
1532 win->ee = ecore_evas_buffer_new(1, 1);
1533 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1534 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1543 ERR("Cannot create window.");
1547 #ifdef HAVE_ELEMENTARY_X
1548 _elm_win_xwindow_get(win);
1550 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1551 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1552 // bg pixmap done by x - has other issues like can be redrawn by x before it
1553 // is filled/ready by app
1554 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1557 win->parent = parent;
1559 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1560 _elm_win_obj_callback_parent_del, win);
1562 win->evas = ecore_evas_get(win->ee);
1563 win->win_obj = elm_widget_add(win->evas);
1564 elm_widget_type_set(win->win_obj, "win");
1565 ELM_SET_WIDTYPE(widtype, "win");
1566 elm_widget_data_set(win->win_obj, win);
1567 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1568 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1569 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1570 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1571 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1572 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1573 evas_object_move(win->win_obj, 0, 0);
1574 evas_object_resize(win->win_obj, 1, 1);
1575 evas_object_layer_set(win->win_obj, 50);
1576 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1578 ecore_evas_object_associate(win->ee, win->win_obj,
1579 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1580 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1581 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1582 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1583 _elm_win_obj_callback_show, win);
1584 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1585 _elm_win_obj_callback_hide, win);
1586 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1587 _elm_win_obj_callback_del, win);
1588 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1589 _elm_win_obj_callback_move, win);
1590 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1591 _elm_win_obj_callback_resize, win);
1593 evas_object_intercept_move_callback_add(win->win_obj,
1594 _elm_win_obj_intercept_move, win);
1595 evas_object_intercept_show_callback_add(win->win_obj,
1596 _elm_win_obj_intercept_show, win);
1598 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1599 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1600 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1601 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1602 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1603 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1604 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1605 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1606 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1607 evas_font_path_append(win->evas, fontpath);
1608 if (!_elm_config->font_hinting)
1609 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1610 else if (_elm_config->font_hinting == 1)
1611 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1612 else if (_elm_config->font_hinting == 2)
1613 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1615 #ifdef HAVE_ELEMENTARY_X
1616 _elm_win_xwin_update(win);
1619 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1621 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1623 ecore_evas_fullscreen_set(win->ee, 1);
1625 #undef ENGINE_COMPARE
1627 if (_elm_config->focus_highlight_enable)
1628 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1631 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1632 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1633 _debug_key_down, win);
1635 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1637 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1640 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1642 return win->win_obj;
1646 * Add @p subobj as a resize object of window @p obj. Note, do not move and
1647 * resize window and sub object at the same time. It will cause problem.
1649 * @param obj The window object
1650 * @param subobj The resize object to add
1655 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1659 ELM_CHECK_WIDTYPE(obj, widtype);
1660 win = elm_widget_data_get(obj);
1662 if (eina_list_data_find(win->subobjs, subobj)) return;
1663 win->subobjs = eina_list_append(win->subobjs, subobj);
1664 elm_widget_sub_object_add(obj, subobj);
1665 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1666 _elm_win_subobj_callback_del, obj);
1667 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1668 _elm_win_subobj_callback_changed_size_hints,
1670 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1671 evas_object_move(subobj, 0, 0);
1672 evas_object_resize(subobj, w, h);
1673 _elm_win_eval_subobjs(obj);
1677 * Delete @p subobj as a resize object of window @p obj.
1679 * @param obj The window object
1680 * @param subobj The resize object to add
1685 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1688 ELM_CHECK_WIDTYPE(obj, widtype);
1689 win = elm_widget_data_get(obj);
1691 evas_object_event_callback_del_full(subobj,
1692 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1693 _elm_win_subobj_callback_changed_size_hints,
1695 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1696 _elm_win_subobj_callback_del, obj);
1697 win->subobjs = eina_list_remove(win->subobjs, subobj);
1698 elm_widget_sub_object_del(obj, subobj);
1699 _elm_win_eval_subobjs(obj);
1703 * Set the title of the window
1705 * @param obj The window object
1706 * @param title The title to set
1711 elm_win_title_set(Evas_Object *obj, const char *title)
1714 ELM_CHECK_WIDTYPE(obj, widtype);
1715 win = elm_widget_data_get(obj);
1717 ecore_evas_title_set(win->ee, title);
1721 * Get the title of the window
1723 * @param obj The window object
1729 elm_win_title_get(const Evas_Object *obj)
1732 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1733 win = elm_widget_data_get(obj);
1734 if (!win) return NULL;
1735 return ecore_evas_title_get(win->ee);
1739 * Set the window's autodel state.
1741 * @param obj The window object
1742 * @param autodel If true, the window will automatically delete itself when closed
1747 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1750 ELM_CHECK_WIDTYPE(obj, widtype);
1751 win = elm_widget_data_get(obj);
1753 win->autodel = autodel;
1757 * Get the window's autodel state.
1759 * @param obj The window object
1760 * @return If the window will automatically delete itself when closed
1765 elm_win_autodel_get(const Evas_Object *obj)
1768 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1769 win = elm_widget_data_get(obj);
1770 if (!win) return EINA_FALSE;
1771 return win->autodel;
1775 * Activate a window object.
1777 * @param obj The window object
1782 elm_win_activate(Evas_Object *obj)
1785 ELM_CHECK_WIDTYPE(obj, widtype);
1786 win = elm_widget_data_get(obj);
1788 ecore_evas_activate(win->ee);
1792 * Lower a window object.
1794 * @param obj The window object
1799 elm_win_lower(Evas_Object *obj)
1802 ELM_CHECK_WIDTYPE(obj, widtype);
1803 win = elm_widget_data_get(obj);
1805 ecore_evas_lower(win->ee);
1809 * Raise a window object.
1811 * @param obj The window object
1816 elm_win_raise(Evas_Object *obj)
1819 ELM_CHECK_WIDTYPE(obj, widtype);
1820 win = elm_widget_data_get(obj);
1822 ecore_evas_raise(win->ee);
1826 * Set the borderless state of a window.
1828 * @param obj The window object
1829 * @param borderless If true, the window is borderless
1834 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1837 ELM_CHECK_WIDTYPE(obj, widtype);
1838 win = elm_widget_data_get(obj);
1840 ecore_evas_borderless_set(win->ee, borderless);
1841 #ifdef HAVE_ELEMENTARY_X
1842 _elm_win_xwin_update(win);
1847 * Get the borderless state of a window.
1849 * @param obj The window object
1850 * @return If true, the window is borderless
1855 elm_win_borderless_get(const Evas_Object *obj)
1858 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1859 win = elm_widget_data_get(obj);
1860 if (!win) return EINA_FALSE;
1861 return ecore_evas_borderless_get(win->ee);
1865 * Set the shaped state of a window.
1867 * @param obj The window object
1868 * @param shaped If true, the window is shaped
1873 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1876 ELM_CHECK_WIDTYPE(obj, widtype);
1877 win = elm_widget_data_get(obj);
1879 ecore_evas_shaped_set(win->ee, shaped);
1880 #ifdef HAVE_ELEMENTARY_X
1881 _elm_win_xwin_update(win);
1886 * Get the shaped state of a window.
1888 * @param obj The window object
1889 * @return If true, the window is shaped
1894 elm_win_shaped_get(const Evas_Object *obj)
1897 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1898 win = elm_widget_data_get(obj);
1899 if (!win) return EINA_FALSE;
1900 return ecore_evas_shaped_get(win->ee);
1904 * Set the alpha channel state of a window.
1906 * @param obj The window object
1907 * @param alpha If true, the window has an alpha channel
1912 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1915 ELM_CHECK_WIDTYPE(obj, widtype);
1916 win = elm_widget_data_get(obj);
1921 else if (win->img_obj)
1923 evas_object_image_alpha_set(win->img_obj, alpha);
1927 #ifdef HAVE_ELEMENTARY_X
1932 if (!_elm_config->compositing)
1933 elm_win_shaped_set(obj, alpha);
1935 ecore_evas_alpha_set(win->ee, alpha);
1938 ecore_evas_alpha_set(win->ee, alpha);
1939 _elm_win_xwin_update(win);
1943 ecore_evas_alpha_set(win->ee, alpha);
1948 * Get the alpha channel state of a window.
1950 * @param obj The window object
1951 * @return If true, the window has an alpha channel
1956 elm_win_alpha_get(const Evas_Object *obj)
1959 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1960 win = elm_widget_data_get(obj);
1961 if (!win) return EINA_FALSE;
1962 return ecore_evas_alpha_get(win->ee);
1966 * Set the transparency state of a window.
1968 * @param obj The window object
1969 * @param transparent If true, the window is transparent
1974 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1977 ELM_CHECK_WIDTYPE(obj, widtype);
1978 win = elm_widget_data_get(obj);
1984 else if (win->img_obj)
1986 evas_object_image_alpha_set(win->img_obj, transparent);
1990 #ifdef HAVE_ELEMENTARY_X
1993 ecore_evas_transparent_set(win->ee, transparent);
1994 _elm_win_xwin_update(win);
1998 ecore_evas_transparent_set(win->ee, transparent);
2003 * Get the transparency state of a window.
2005 * @param obj The window object
2006 * @return If true, the window is transparent
2011 elm_win_transparent_get(const Evas_Object *obj)
2014 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2015 win = elm_widget_data_get(obj);
2016 if (!win) return EINA_FALSE;
2018 return ecore_evas_transparent_get(win->ee);
2022 * Set the override state of a window.
2024 * @param obj The window object
2025 * @param override If true, the window is overridden
2030 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2033 ELM_CHECK_WIDTYPE(obj, widtype);
2034 win = elm_widget_data_get(obj);
2036 ecore_evas_override_set(win->ee, override);
2037 #ifdef HAVE_ELEMENTARY_X
2038 _elm_win_xwin_update(win);
2043 * Get the override state of a window.
2045 * @param obj The window object
2046 * @return If true, the window is overridden
2051 elm_win_override_get(const Evas_Object *obj)
2054 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2055 win = elm_widget_data_get(obj);
2056 if (!win) return EINA_FALSE;
2057 return ecore_evas_override_get(win->ee);
2061 * Set the fullscreen state of a window.
2063 * @param obj The window object
2064 * @param fullscreen If true, the window is fullscreen
2069 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2072 ELM_CHECK_WIDTYPE(obj, widtype);
2073 win = elm_widget_data_get(obj);
2076 // YYY: handle if win->img_obj
2077 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2078 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2079 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2081 // these engines... can ONLY be fullscreen
2086 ecore_evas_fullscreen_set(win->ee, fullscreen);
2087 #ifdef HAVE_ELEMENTARY_X
2088 _elm_win_xwin_update(win);
2091 #undef ENGINE_COMPARE
2095 * Get the fullscreen state of a window.
2097 * @param obj The window object
2098 * @return If true, the window is fullscreen
2103 elm_win_fullscreen_get(const Evas_Object *obj)
2106 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2107 win = elm_widget_data_get(obj);
2108 if (!win) return EINA_FALSE;
2110 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2111 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2112 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2114 // these engines... can ONLY be fullscreen
2119 return ecore_evas_fullscreen_get(win->ee);
2121 #undef ENGINE_COMPARE
2125 * Set the maximized state of a window.
2127 * @param obj The window object
2128 * @param maximized If true, the window is maximized
2133 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2136 ELM_CHECK_WIDTYPE(obj, widtype);
2137 win = elm_widget_data_get(obj);
2139 // YYY: handle if win->img_obj
2140 ecore_evas_maximized_set(win->ee, maximized);
2141 #ifdef HAVE_ELEMENTARY_X
2142 _elm_win_xwin_update(win);
2147 * Get the maximized state of a window.
2149 * @param obj The window object
2150 * @return If true, the window is maximized
2155 elm_win_maximized_get(const Evas_Object *obj)
2158 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2159 win = elm_widget_data_get(obj);
2160 if (!win) return EINA_FALSE;
2161 return ecore_evas_maximized_get(win->ee);
2165 * Set the iconified state of a window.
2167 * @param obj The window object
2168 * @param iconified If true, the window is iconified
2173 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2176 ELM_CHECK_WIDTYPE(obj, widtype);
2177 win = elm_widget_data_get(obj);
2179 ecore_evas_iconified_set(win->ee, iconified);
2180 #ifdef HAVE_ELEMENTARY_X
2181 _elm_win_xwin_update(win);
2186 * Get the iconified state of a window.
2188 * @param obj The window object
2189 * @return If true, the window is iconified
2194 elm_win_iconified_get(const Evas_Object *obj)
2197 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2198 win = elm_widget_data_get(obj);
2199 if (!win) return EINA_FALSE;
2200 return ecore_evas_iconified_get(win->ee);
2204 * Set the layer of the window.
2206 * @param obj The window object
2207 * @param layer The layer of the window
2212 elm_win_layer_set(Evas_Object *obj, int layer)
2215 ELM_CHECK_WIDTYPE(obj, widtype);
2216 win = elm_widget_data_get(obj);
2218 ecore_evas_layer_set(win->ee, layer);
2219 #ifdef HAVE_ELEMENTARY_X
2220 _elm_win_xwin_update(win);
2225 * Get the layer of the window.
2227 * @param obj The window object
2228 * @return The layer of the window
2233 elm_win_layer_get(const Evas_Object *obj)
2236 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2237 win = elm_widget_data_get(obj);
2238 if (!win) return -1;
2239 return ecore_evas_layer_get(win->ee);
2243 * Set the rotation of the window.
2245 * @param obj The window object
2246 * @param rotation The rotation of the window, in degrees (0-360)
2251 elm_win_rotation_set(Evas_Object *obj, int rotation)
2254 ELM_CHECK_WIDTYPE(obj, widtype);
2255 win = elm_widget_data_get(obj);
2257 if (win->rot == rotation) return;
2258 win->rot = rotation;
2259 ecore_evas_rotation_set(win->ee, rotation);
2260 evas_object_size_hint_min_set(obj, -1, -1);
2261 evas_object_size_hint_max_set(obj, -1, -1);
2262 _elm_win_eval_subobjs(obj);
2263 #ifdef HAVE_ELEMENTARY_X
2264 _elm_win_xwin_update(win);
2269 * Rotates the window and resizes it
2271 * @param obj The window object
2272 * @param layer The rotation of the window in degrees (0-360)
2277 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2280 ELM_CHECK_WIDTYPE(obj, widtype);
2281 win = elm_widget_data_get(obj);
2283 if (win->rot == rotation) return;
2284 win->rot = rotation;
2285 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2286 evas_object_size_hint_min_set(obj, -1, -1);
2287 evas_object_size_hint_max_set(obj, -1, -1);
2288 _elm_win_eval_subobjs(obj);
2289 #ifdef HAVE_ELEMENTARY_X
2290 _elm_win_xwin_update(win);
2295 * Get the rotation of the window.
2297 * @param obj The window object
2298 * @return The rotation of the window in degrees (0-360)
2303 elm_win_rotation_get(const Evas_Object *obj)
2306 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2307 win = elm_widget_data_get(obj);
2308 if (!win) return -1;
2313 * Set the sticky state of the window.
2315 * @param obj The window object
2316 * @param sticky If true, the window's sticky state is enabled
2321 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2324 ELM_CHECK_WIDTYPE(obj, widtype);
2325 win = elm_widget_data_get(obj);
2327 ecore_evas_sticky_set(win->ee, sticky);
2328 #ifdef HAVE_ELEMENTARY_X
2329 _elm_win_xwin_update(win);
2334 * Get the sticky state of the window.
2336 * @param obj The window object
2337 * @return If true, the window's sticky state is enabled
2342 elm_win_sticky_get(const Evas_Object *obj)
2345 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2346 win = elm_widget_data_get(obj);
2347 if (!win) return EINA_FALSE;
2348 return ecore_evas_sticky_get(win->ee);
2352 * Sets the keyboard mode of the window.
2354 * @param obj The window object
2355 * @param mode The mode to set; one of:
2356 * ELM_WIN_KEYBOARD_UNKNOWN
2357 * ELM_WIN_KEYBOARD_OFF
2358 * ELM_WIN_KEYBOARD_ON
2359 * ELM_WIN_KEYBOARD_ALPHA
2360 * ELM_WIN_KEYBOARD_NUMERIC
2361 * ELM_WIN_KEYBOARD_PIN
2362 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2363 * ELM_WIN_KEYBOARD_HEX
2364 * ELM_WIN_KEYBOARD_TERMINAL
2365 * ELM_WIN_KEYBOARD_PASSWORD
2366 * ELM_WIN_KEYBOARD_IP
2367 * ELM_WIN_KEYBOARD_HOST
2368 * ELM_WIN_KEYBOARD_FILE
2369 * ELM_WIN_KEYBOARD_URL
2370 * ELM_WIN_KEYBOARD_KEYPAD
2371 * ELM_WIN_KEYBOARD_J2ME
2376 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2379 ELM_CHECK_WIDTYPE(obj, widtype);
2380 win = elm_widget_data_get(obj);
2382 if (mode == win->kbdmode) return;
2383 #ifdef HAVE_ELEMENTARY_X
2384 _elm_win_xwindow_get(win);
2386 win->kbdmode = mode;
2387 #ifdef HAVE_ELEMENTARY_X
2389 ecore_x_e_virtual_keyboard_state_set
2390 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2395 * Gets the keyboard mode of the window.
2397 * @param obj The window object
2398 * @return The mode; one of:
2399 * ELM_WIN_KEYBOARD_UNKNOWN
2400 * ELM_WIN_KEYBOARD_OFF
2401 * ELM_WIN_KEYBOARD_ON
2402 * ELM_WIN_KEYBOARD_ALPHA
2403 * ELM_WIN_KEYBOARD_NUMERIC
2404 * ELM_WIN_KEYBOARD_PIN
2405 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2406 * ELM_WIN_KEYBOARD_HEX
2407 * ELM_WIN_KEYBOARD_TERMINAL
2408 * ELM_WIN_KEYBOARD_PASSWORD
2409 * ELM_WIN_KEYBOARD_IP
2410 * ELM_WIN_KEYBOARD_HOST
2411 * ELM_WIN_KEYBOARD_FILE
2412 * ELM_WIN_KEYBOARD_URL
2413 * ELM_WIN_KEYBOARD_KEYPAD
2414 * ELM_WIN_KEYBOARD_J2ME
2418 EAPI Elm_Win_Keyboard_Mode
2419 elm_win_keyboard_mode_get(const Evas_Object *obj)
2422 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2423 win = elm_widget_data_get(obj);
2424 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2425 return win->kbdmode;
2429 * Sets whether the window is a keyboard.
2431 * @param obj The window object
2432 * @param is_keyboard If true, the window is a virtual keyboard
2437 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2440 ELM_CHECK_WIDTYPE(obj, widtype);
2441 win = elm_widget_data_get(obj);
2443 #ifdef HAVE_ELEMENTARY_X
2444 _elm_win_xwindow_get(win);
2446 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2451 * Gets whether the window is a keyboard.
2453 * @param obj The window object
2454 * @return If the window is a virtual keyboard
2459 elm_win_keyboard_win_get(const Evas_Object *obj)
2462 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2463 win = elm_widget_data_get(obj);
2464 if (!win) return EINA_FALSE;
2465 #ifdef HAVE_ELEMENTARY_X
2466 _elm_win_xwindow_get(win);
2468 return ecore_x_e_virtual_keyboard_get(win->xwin);
2474 * Get the screen position of a window.
2476 * @param obj The window object
2477 * @param x The int to store the x coordinate to
2478 * @param y The int to store the y coordinate to
2483 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2486 ELM_CHECK_WIDTYPE(obj, widtype);
2487 win = elm_widget_data_get(obj);
2489 if (x) *x = win->screen.x;
2490 if (y) *y = win->screen.y;
2494 * Set if this window is an illume conformant window
2496 * @param obj The window object
2497 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2502 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2505 ELM_CHECK_WIDTYPE(obj, widtype);
2506 win = elm_widget_data_get(obj);
2508 #ifdef HAVE_ELEMENTARY_X
2509 _elm_win_xwindow_get(win);
2511 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2516 * Get if this window is an illume conformant window
2518 * @param obj The window object
2519 * @return A boolean if this window is illume conformant or not
2524 elm_win_conformant_get(const Evas_Object *obj)
2527 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2528 win = elm_widget_data_get(obj);
2529 if (!win) return EINA_FALSE;
2530 #ifdef HAVE_ELEMENTARY_X
2531 _elm_win_xwindow_get(win);
2533 return ecore_x_e_illume_conformant_get(win->xwin);
2539 * Set a window to be an illume quickpanel window
2541 * By default window objects are not quickpanel windows.
2543 * @param obj The window object
2544 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2549 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2552 ELM_CHECK_WIDTYPE(obj, widtype);
2553 win = elm_widget_data_get(obj);
2555 #ifdef HAVE_ELEMENTARY_X
2556 _elm_win_xwindow_get(win);
2559 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2562 Ecore_X_Window_State states[2];
2564 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2565 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2566 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2567 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2574 * Get if this window is a quickpanel or not
2576 * @param obj The window object
2577 * @return A boolean if this window is a quickpanel or not
2582 elm_win_quickpanel_get(const Evas_Object *obj)
2585 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2586 win = elm_widget_data_get(obj);
2587 if (!win) return EINA_FALSE;
2588 #ifdef HAVE_ELEMENTARY_X
2589 _elm_win_xwindow_get(win);
2591 return ecore_x_e_illume_quickpanel_get(win->xwin);
2597 * Set the major priority of a quickpanel window
2599 * @param obj The window object
2600 * @param priority The major priority for this quickpanel
2605 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2608 ELM_CHECK_WIDTYPE(obj, widtype);
2609 win = elm_widget_data_get(obj);
2611 #ifdef HAVE_ELEMENTARY_X
2612 _elm_win_xwindow_get(win);
2614 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2619 * Get the major priority of a quickpanel window
2621 * @param obj The window object
2622 * @return The major priority of this quickpanel
2627 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2630 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2631 win = elm_widget_data_get(obj);
2632 if (!win) return -1;
2633 #ifdef HAVE_ELEMENTARY_X
2634 _elm_win_xwindow_get(win);
2636 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2642 * Set the minor priority of a quickpanel window
2644 * @param obj The window object
2645 * @param priority The minor priority for this quickpanel
2650 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2653 ELM_CHECK_WIDTYPE(obj, widtype);
2654 win = elm_widget_data_get(obj);
2656 #ifdef HAVE_ELEMENTARY_X
2657 _elm_win_xwindow_get(win);
2659 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2664 * Get the minor priority of a quickpanel window
2666 * @param obj The window object
2667 * @return The minor priority of this quickpanel
2672 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2675 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2676 win = elm_widget_data_get(obj);
2677 if (!win) return -1;
2678 #ifdef HAVE_ELEMENTARY_X
2679 _elm_win_xwindow_get(win);
2681 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2687 * Set which zone this quickpanel should appear in
2689 * @param obj The window object
2690 * @param zone The requested zone for this quickpanel
2695 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2698 ELM_CHECK_WIDTYPE(obj, widtype);
2699 win = elm_widget_data_get(obj);
2701 #ifdef HAVE_ELEMENTARY_X
2702 _elm_win_xwindow_get(win);
2704 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2709 * Get which zone this quickpanel should appear in
2711 * @param obj The window object
2712 * @return The requested zone for this quickpanel
2717 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2720 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2721 win = elm_widget_data_get(obj);
2723 #ifdef HAVE_ELEMENTARY_X
2724 _elm_win_xwindow_get(win);
2726 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2732 * Set the window to be skipped by keyboard focus
2734 * This sets the window to be skipped by normal keyboard input. This means
2735 * a window manager will be asked to not focus this window as well as omit
2736 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2738 * Call this and enable it on a window BEFORE you show it for the first time,
2739 * otherwise it may have no effect.
2741 * Use this for windows that have only output information or might only be
2742 * interacted with by the mouse or fingers, and never for typing input.
2743 * Be careful that this may have side-effects like making the window
2744 * non-accessible in some cases unless the window is specially handled. Use
2747 * @param obj The window object
2748 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2753 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2756 ELM_CHECK_WIDTYPE(obj, widtype);
2757 win = elm_widget_data_get(obj);
2759 #ifdef HAVE_ELEMENTARY_X
2760 _elm_win_xwindow_get(win);
2765 Ecore_X_Window_State states[2];
2767 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2768 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2769 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2770 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2777 * Send a command to the windowing environment
2779 * This is intended to work in touchscreen or small screen device environments
2780 * where there is a more simplistic window management policy in place. This
2781 * uses the window object indicated to select which part of the environment
2782 * to control (the part that this window lives in), and provides a command
2783 * and an optional parameter structure (use NULL for this if not needed).
2785 * @param obj The window object that lives in the environment to control
2786 * @param command The command to send
2787 * @param params Optional parameters for the command
2792 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2795 ELM_CHECK_WIDTYPE(obj, widtype);
2796 win = elm_widget_data_get(obj);
2798 #ifdef HAVE_ELEMENTARY_X
2799 _elm_win_xwindow_get(win);
2804 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2805 ecore_x_e_illume_focus_back_send(win->xwin);
2807 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2808 ecore_x_e_illume_focus_forward_send(win->xwin);
2810 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2811 ecore_x_e_illume_focus_home_send(win->xwin);
2813 case ELM_ILLUME_COMMAND_CLOSE:
2814 ecore_x_e_illume_close_send(win->xwin);
2824 * Get the inlined image object handle
2826 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2827 * then the window is in fact an evas image object inlined in the parent
2828 * canvas. You can get this object (be careful to not manipulate it as it
2829 * is under control of elementary), and use it to do things like get pixel
2830 * data, save the image to a file, etc.
2832 * @param obj The window object to get the inlined image from
2833 * @return The inlined image object, or NULL if none exists
2838 elm_win_inlined_image_object_get(Evas_Object *obj)
2841 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2842 win = elm_widget_data_get(obj);
2843 if (!win) return NULL;
2844 return win->img_obj;
2848 * Set the enabled status for the focus highlight in a window
2850 * This function will enable or disable the focus highlight only for the
2851 * given window, regardless of the global setting for it
2853 * @param obj The window where to enable the highlight
2854 * @param enabled The enabled value for the highlight
2859 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2863 ELM_CHECK_WIDTYPE(obj, widtype);
2865 win = elm_widget_data_get(obj);
2866 enabled = !!enabled;
2867 if (win->focus_highlight.enabled == enabled)
2870 win->focus_highlight.enabled = enabled;
2872 if (win->focus_highlight.enabled)
2873 _elm_win_focus_highlight_init(win);
2875 _elm_win_focus_highlight_shutdown(win);
2879 * Get the enabled value of the focus highlight for this window
2881 * @param obj The window in which to check if the focus highlight is enabled
2883 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2888 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2892 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2894 win = elm_widget_data_get(obj);
2895 return win->focus_highlight.enabled;
2899 * Set the style for the focus highlight on this window
2901 * Sets the style to use for theming the highlight of focused objects on
2902 * the given window. If @p style is NULL, the default will be used.
2904 * @param obj The window where to set the style
2905 * @param style The style to set
2910 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2914 ELM_CHECK_WIDTYPE(obj, widtype);
2916 win = elm_widget_data_get(obj);
2917 eina_stringshare_replace(&win->focus_highlight.style, style);
2918 win->focus_highlight.changed_theme = EINA_TRUE;
2919 _elm_win_focus_highlight_reconfigure_job_start(win);
2923 * Get the style set for the focus highlight object
2925 * Gets the style set for this windows highilght object, or NULL if none
2928 * @param obj The window to retrieve the highlights style from
2930 * @return The style set or NULL if none was. Default is used in that case.
2935 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2939 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2941 win = elm_widget_data_get(obj);
2942 return win->focus_highlight.style;
2945 typedef struct _Widget_Data Widget_Data;
2950 Evas_Object *content;
2953 static void _del_hook(Evas_Object *obj);
2954 static void _theme_hook(Evas_Object *obj);
2955 static void _sizing_eval(Evas_Object *obj);
2956 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2957 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2959 static const char *widtype2 = NULL;
2962 _del_hook(Evas_Object *obj)
2964 Widget_Data *wd = elm_widget_data_get(obj);
2970 _theme_hook(Evas_Object *obj)
2972 Widget_Data *wd = elm_widget_data_get(obj);
2973 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2975 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2980 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2982 Widget_Data *wd = elm_widget_data_get(obj);
2987 /* Try Focus cycle in subitem */
2990 elm_widget_focus_next_get(wd->content, dir, next);
2995 *next = (Evas_Object *)obj;
3000 _sizing_eval(Evas_Object *obj)
3002 Widget_Data *wd = elm_widget_data_get(obj);
3003 Evas_Coord minw = -1, minh = -1;
3005 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3006 edje_object_size_min_calc(wd->frm, &minw, &minh);
3007 evas_object_size_hint_min_set(obj, minw, minh);
3008 evas_object_size_hint_max_set(obj, -1, -1);
3012 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3018 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3020 Widget_Data *wd = elm_widget_data_get(obj);
3021 Evas_Object *sub = event_info;
3022 if (sub == wd->content)
3024 evas_object_event_callback_del_full
3025 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3032 * @defgroup Inwin Inwin
3034 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
3037 elm_win_inwin_add(Evas_Object *obj)
3043 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3044 win = elm_widget_data_get(obj);
3045 if (!win) return NULL;
3046 wd = ELM_NEW(Widget_Data);
3047 obj2 = elm_widget_add(win->evas);
3048 elm_widget_type_set(obj2, "inwin");
3049 ELM_SET_WIDTYPE(widtype2, "inwin");
3050 elm_widget_sub_object_add(obj, obj2);
3051 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3052 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3053 elm_win_resize_object_add(obj, obj2);
3055 elm_widget_data_set(obj2, wd);
3056 elm_widget_del_hook_set(obj2, _del_hook);
3057 elm_widget_theme_hook_set(obj2, _theme_hook);
3058 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3059 elm_widget_can_focus_set(obj2, EINA_TRUE);
3060 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3062 wd->frm = edje_object_add(win->evas);
3063 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3064 elm_widget_resize_object_set(obj2, wd->frm);
3066 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3073 * Activates an inwin object
3075 * @param obj The inwin to activate
3080 elm_win_inwin_activate(Evas_Object *obj)
3082 ELM_CHECK_WIDTYPE(obj, widtype2);
3083 Widget_Data *wd = elm_widget_data_get(obj);
3085 evas_object_raise(obj);
3086 evas_object_show(obj);
3087 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3088 elm_object_focus(obj);
3092 * Set the content of an inwin object.
3094 * Once the content object is set, a previously set one will be deleted.
3095 * If you want to keep that old content object, use the
3096 * elm_win_inwin_content_unset() function.
3098 * @param obj The inwin object
3099 * @param content The object to set as content
3104 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3106 ELM_CHECK_WIDTYPE(obj, widtype2);
3107 Widget_Data *wd = elm_widget_data_get(obj);
3109 if (wd->content == content) return;
3110 if (wd->content) evas_object_del(wd->content);
3111 wd->content = content;
3114 elm_widget_sub_object_add(obj, content);
3115 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3116 _changed_size_hints, obj);
3117 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3123 * Get the content of an inwin object.
3125 * Return the content object which is set for this widget.
3127 * @param obj The inwin object
3128 * @return The content that is being used
3133 elm_win_inwin_content_get(const Evas_Object *obj)
3135 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3136 Widget_Data *wd = elm_widget_data_get(obj);
3137 if (!wd) return NULL;
3142 * Unset the content of an inwin object.
3144 * Unparent and return the content object which was set for this widget.
3146 * @param obj The inwin object
3147 * @return The content that was being used
3152 elm_win_inwin_content_unset(Evas_Object *obj)
3154 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3155 Widget_Data *wd = elm_widget_data_get(obj);
3156 if (!wd) return NULL;
3157 if (!wd->content) return NULL;
3158 Evas_Object *content = wd->content;
3159 elm_widget_sub_object_del(obj, wd->content);
3160 edje_object_part_unswallow(wd->frm, wd->content);
3165 /* windowing spcific calls - shall we do this differently? */
3167 static Ecore_X_Window
3168 _elm_ee_win_get(const Evas_Object *obj)
3171 #ifdef HAVE_ELEMENTARY_X
3172 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3173 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3179 * Get the Ecore_X_Window of an Evas_Object
3181 * @param obj The object
3183 * @return The Ecore_X_Window of @p obj
3188 elm_win_xwindow_get(const Evas_Object *obj)
3190 Ecore_X_Window xwin = 0;
3195 type = elm_widget_type_get(obj);
3196 if (!type) return 0;
3197 if (type != widtype) return _elm_ee_win_get(obj);
3198 #ifdef HAVE_ELEMENTARY_X
3199 win = elm_widget_data_get(obj);
3200 if (!win) return xwin;
3201 if (win->xwin) return win->xwin;
3202 if (win->parent) return elm_win_xwindow_get(win->parent);