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,out";
146 static const char SIG_FOCUS_IN[] = "focus,in";
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 if (!elm_widget_focus_get(win->win_obj))
378 elm_widget_focus_restore(win->win_obj);
379 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
380 win->focus_highlight.cur.visible = EINA_TRUE;
381 _elm_win_focus_highlight_reconfigure_job_start(win);
385 else if (win->img_obj)
392 _elm_win_focus_out(Ecore_Evas *ee)
394 Evas_Object *obj = ecore_evas_object_associate_get(ee);
398 win = elm_widget_data_get(obj);
400 elm_object_unfocus(win->win_obj);
401 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
402 win->focus_highlight.cur.visible = EINA_FALSE;
403 _elm_win_focus_highlight_reconfigure_job_start(win);
407 else if (win->img_obj)
414 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
416 Elm_Win *wd = elm_widget_data_get(obj);
417 const Eina_List *items;
418 void *(*list_data_get) (const Eina_List *list);
426 if (!(items = elm_widget_focus_custom_chain_get(obj)))
432 list_data_get = eina_list_data_get;
434 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
440 *next = (Evas_Object *)obj;
445 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
447 Elm_Win *win = elm_widget_data_get(obj);
451 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
453 evas_object_focus_set(obj, elm_widget_focus_get(obj));
457 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
459 if (type == EVAS_CALLBACK_KEY_DOWN)
461 Evas_Event_Key_Down *ev = event_info;
462 if (!strcmp(ev->keyname, "Tab"))
464 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
465 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
467 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
468 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
477 _deferred_ecore_evas_free(void *data)
479 ecore_evas_free(data);
480 _elm_win_deferred_free--;
484 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
488 elm_object_focus(obj);
489 if (win->shot.info) _shot_handle(win);
493 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
500 else if (win->img_obj)
502 evas_object_hide(win->img_obj);
507 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
514 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
515 _elm_win_obj_callback_parent_del, win);
518 if (win->autodel_clear) *(win->autodel_clear) = -1;
519 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
520 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
523 ecore_evas_callback_delete_request_set(win->ee, NULL);
524 ecore_evas_callback_resize_set(win->ee, NULL);
526 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
527 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
528 if (win->shot.info) eina_stringshare_del(win->shot.info);
529 if (win->shot.timer) ecore_timer_del(win->shot.timer);
530 while (((child = evas_object_bottom_get(win->evas))) &&
533 evas_object_del(child);
535 while (((child = evas_object_top_get(win->evas))) &&
538 evas_object_del(child);
540 #ifdef HAVE_ELEMENTARY_X
541 if (win->client_message_handler)
542 ecore_event_handler_del(win->client_message_handler);
544 // FIXME: Why are we flushing edje on every window destroy ??
545 // edje_file_cache_flush();
546 // edje_collection_cache_flush();
547 // evas_image_cache_flush(win->evas);
548 // evas_font_cache_flush(win->evas);
549 // FIXME: we are in the del handler for the object and delete the canvas
550 // that lives under it from the handler... nasty. deferring doesn't help either
560 ecore_job_add(_deferred_ecore_evas_free, win->ee);
561 _elm_win_deferred_free++;
565 _elm_win_focus_highlight_shutdown(win);
566 eina_stringshare_del(win->focus_highlight.style);
570 if ((!_elm_win_list) &&
571 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
573 edje_file_cache_flush();
574 edje_collection_cache_flush();
575 evas_image_cache_flush(e);
576 evas_font_cache_flush(e);
582 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
585 if (!win->img_obj) return;
586 evas_object_event_callback_del_full
587 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
588 evas_object_del(win->img_obj);
592 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
595 if (obj == win->parent) win->parent = NULL;
599 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
605 if ((x != win->screen.x) || (y != win->screen.y))
609 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
614 evas_object_move(obj, x, y);
619 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
622 // this is called to make sure all smart containers have calculated their
623 // sizes BEFORE we show the window to make sure it initially appears at
624 // our desired size (ie min size is known first)
625 evas_smart_objects_calculate(evas_object_evas_get(obj));
626 evas_object_show(obj);
630 else if (win->img_obj)
632 evas_object_show(win->img_obj);
637 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
641 if (ecore_evas_override_get(win->ee))
645 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
648 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
653 else if (win->img_obj)
657 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
660 // evas_object_move(win->img_obj, x, y);
665 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
672 else if (win->img_obj)
674 Evas_Coord w = 1, h = 1;
676 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
679 evas_object_image_size_set(win->img_obj, w, h);
684 _elm_win_delete_request(Ecore_Evas *ee)
686 Evas_Object *obj = ecore_evas_object_associate_get(ee);
688 if (strcmp(elm_widget_type_get(obj), "win")) return;
690 win = elm_widget_data_get(obj);
692 int autodel = win->autodel;
693 win->autodel_clear = &autodel;
694 evas_object_ref(win->win_obj);
695 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
696 // FIXME: if above callback deletes - then the below will be invalid
697 if (autodel) evas_object_del(win->win_obj);
698 else win->autodel_clear = NULL;
699 evas_object_unref(win->win_obj);
703 _elm_win_resize_job(void *data)
710 win->deferred_resize_job = NULL;
711 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
712 evas_object_resize(win->win_obj, w, h);
716 else if (win->img_obj)
719 EINA_LIST_FOREACH(win->subobjs, l, obj)
721 evas_object_move(obj, 0, 0);
722 evas_object_resize(obj, w, h);
726 #ifdef HAVE_ELEMENTARY_X
728 _elm_win_xwindow_get(Elm_Win *win)
732 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
733 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
735 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
737 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
738 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
739 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
740 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
741 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
742 ENGINE_COMPARE(ELM_OPENGL_SDL))
745 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
747 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
749 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
751 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
754 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
756 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
759 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
761 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
763 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
765 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
767 #undef ENGINE_COMPARE
771 #ifdef HAVE_ELEMENTARY_X
773 _elm_win_xwin_update(Elm_Win *win)
775 _elm_win_xwindow_get(win);
780 win2 = elm_widget_data_get(win->parent);
784 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
788 if (!win->xwin) return; /* nothing more to do */
793 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
795 case ELM_WIN_DIALOG_BASIC:
796 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
798 case ELM_WIN_DESKTOP:
799 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
802 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
804 case ELM_WIN_TOOLBAR:
805 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
808 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
810 case ELM_WIN_UTILITY:
811 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
814 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
816 case ELM_WIN_DROPDOWN_MENU:
817 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
819 case ELM_WIN_POPUP_MENU:
820 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
822 case ELM_WIN_TOOLTIP:
823 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
825 case ELM_WIN_NOTIFICATION:
826 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
829 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
832 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
837 ecore_x_e_virtual_keyboard_state_set
838 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
843 _elm_win_eval_subobjs(Evas_Object *obj)
846 const Evas_Object *child;
848 Elm_Win *win = elm_widget_data_get(obj);
849 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
853 EINA_LIST_FOREACH(win->subobjs, l, child)
855 evas_object_size_hint_weight_get(child, &wx, &wy);
856 if (wx == 0.0) xx = 0;
857 if (wy == 0.0) xy = 0;
859 evas_object_size_hint_min_get(child, &w, &h);
862 if (w > minw) minw = w;
863 if (h > minh) minh = h;
865 evas_object_size_hint_max_get(child, &w, &h);
868 if (maxw == -1) maxw = w;
869 else if ((w > 0) && (w < maxw)) maxw = w;
870 if (maxh == -1) maxh = h;
871 else if ((h > 0) && (h < maxh)) maxh = h;
873 if (!xx) maxw = minw;
875 if (!xy) maxh = minh;
877 evas_object_size_hint_min_set(obj, minw, minh);
878 evas_object_size_hint_max_set(obj, maxw, maxh);
879 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
880 if (w < minw) w = minw;
881 if (h < minh) h = minh;
882 if ((maxw >= 0) && (w > maxw)) w = maxw;
883 if ((maxh >= 0) && (h > maxh)) h = maxh;
884 evas_object_resize(obj, w, h);
888 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
890 Elm_Win *win = elm_widget_data_get(data);
891 win->subobjs = eina_list_remove(win->subobjs, obj);
892 _elm_win_eval_subobjs(win->win_obj);
896 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
898 _elm_win_eval_subobjs(data);
902 _elm_win_shutdown(void)
904 while (_elm_win_list)
905 evas_object_del(_elm_win_list->data);
909 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
916 EINA_LIST_FOREACH(_elm_win_list, l, obj)
917 elm_widget_theme(obj);
921 EINA_LIST_FOREACH(_elm_win_list, l, obj)
922 elm_widget_theme_specific(obj, th, EINA_FALSE);
926 #ifdef HAVE_ELEMENTARY_X
928 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
931 Ecore_X_Event_Client_Message *e = event;
933 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
934 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
936 if ((unsigned)e->data.l[0] == win->xwin)
938 Evas *evas = evas_object_evas_get(win->win_obj);
941 edje_file_cache_flush();
942 edje_collection_cache_flush();
943 evas_image_cache_flush(evas);
944 evas_font_cache_flush(evas);
948 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
950 if ((unsigned)e->data.l[0] == win->xwin)
952 Evas *evas = evas_object_evas_get(win->win_obj);
955 edje_file_cache_flush();
956 edje_collection_cache_flush();
957 evas_image_cache_flush(evas);
958 evas_font_cache_flush(evas);
959 evas_render_dump(evas);
963 return ECORE_CALLBACK_PASS_ON;
968 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
972 win->focus_highlight.geometry_changed = EINA_TRUE;
973 _elm_win_focus_highlight_reconfigure_job_start(win);
977 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
981 win->focus_highlight.geometry_changed = EINA_TRUE;
982 _elm_win_focus_highlight_reconfigure_job_start(win);
986 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
990 win->focus_highlight.cur.target = NULL;
992 _elm_win_focus_highlight_reconfigure_job_start(win);
996 _elm_win_focus_target_callbacks_add(Elm_Win *win)
998 Evas_Object *obj = win->focus_highlight.cur.target;
1000 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1001 _elm_win_focus_target_move, win);
1002 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1003 _elm_win_focus_target_resize, win);
1004 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1005 _elm_win_focus_target_del, win);
1009 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1011 Evas_Object *obj = win->focus_highlight.cur.target;
1013 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1014 _elm_win_focus_target_move, win);
1015 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1016 _elm_win_focus_target_resize, win);
1017 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1018 _elm_win_focus_target_del, win);
1021 static Evas_Object *
1022 _elm_win_focus_target_get(Evas_Object *obj)
1024 Evas_Object *o = obj;
1028 if (elm_widget_is(o))
1030 if (!elm_widget_highlight_ignore_get(o))
1032 o = elm_widget_parent_get(o);
1034 o = evas_object_smart_parent_get(o);
1038 o = elm_widget_parent_widget_get(o);
1040 o = evas_object_smart_parent_get(o);
1049 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1051 Evas_Object *obj = event_info, *target;
1052 Elm_Win *win = data;
1054 if (win->focus_highlight.cur.target == obj)
1057 target = _elm_win_focus_target_get(obj);
1058 win->focus_highlight.cur.target = target;
1059 if (elm_widget_highlight_in_theme_get(target))
1060 win->focus_highlight.cur.handled = EINA_TRUE;
1062 _elm_win_focus_target_callbacks_add(win);
1064 _elm_win_focus_highlight_reconfigure_job_start(win);
1068 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1070 Elm_Win *win = data;
1072 if (!win->focus_highlight.cur.target)
1075 if (!win->focus_highlight.cur.handled)
1076 _elm_win_focus_target_callbacks_del(win);
1077 win->focus_highlight.cur.target = NULL;
1078 win->focus_highlight.cur.handled = EINA_FALSE;
1080 _elm_win_focus_highlight_reconfigure_job_start(win);
1084 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1086 evas_object_hide(obj);
1090 _elm_win_focus_highlight_init(Elm_Win *win)
1092 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1093 _elm_win_object_focus_in, win);
1094 evas_event_callback_add(win->evas,
1095 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1096 _elm_win_object_focus_out, win);
1098 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1100 win->focus_highlight.top = edje_object_add(win->evas);
1101 win->focus_highlight.changed_theme = EINA_TRUE;
1102 edje_object_signal_callback_add(win->focus_highlight.top,
1103 "elm,action,focus,hide,end", "",
1104 _elm_win_focus_highlight_hide, NULL);
1105 edje_object_signal_callback_add(win->focus_highlight.top,
1106 "elm,action,focus,anim,end", "",
1107 _elm_win_focus_highlight_anim_end, win);
1108 _elm_win_focus_highlight_reconfigure_job_start(win);
1112 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1114 _elm_win_focus_highlight_reconfigure_job_stop(win);
1115 if (win->focus_highlight.cur.target)
1117 _elm_win_focus_target_callbacks_del(win);
1118 win->focus_highlight.cur.target = NULL;
1120 if (win->focus_highlight.top)
1122 evas_object_del(win->focus_highlight.top);
1123 win->focus_highlight.top = NULL;
1126 evas_event_callback_del_full(win->evas,
1127 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1128 _elm_win_object_focus_in, win);
1129 evas_event_callback_del_full(win->evas,
1130 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1131 _elm_win_object_focus_out, win);
1135 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1139 top = win->focus_highlight.top;
1144 evas_object_show(top);
1145 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1151 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1156 _elm_win_focus_highlight_reconfigure_job(void *data)
1158 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1162 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1164 if (win->focus_highlight.reconf_job)
1165 ecore_job_del(win->focus_highlight.reconf_job);
1166 win->focus_highlight.reconf_job = ecore_job_add(
1167 _elm_win_focus_highlight_reconfigure_job, win);
1171 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1173 if (win->focus_highlight.reconf_job)
1174 ecore_job_del(win->focus_highlight.reconf_job);
1175 win->focus_highlight.reconf_job = NULL;
1179 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1181 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1182 Evas_Coord x, y, w, h;
1184 clip = evas_object_clip_get(target);
1185 evas_object_geometry_get(target, &x, &y, &w, &h);
1187 evas_object_move(obj, x, y);
1188 evas_object_resize(obj, w, h);
1189 evas_object_clip_set(obj, clip);
1193 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1195 Evas_Coord tx, ty, tw, th;
1196 Evas_Coord w, h, px, py, pw, ph;
1197 Edje_Message_Int_Set *m;
1198 Evas_Object *previous = win->focus_highlight.prev.target;
1199 Evas_Object *target = win->focus_highlight.cur.target;
1201 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1202 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1203 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1204 evas_object_move(obj, 0, 0);
1205 evas_object_resize(obj, tw, th);
1206 evas_object_clip_unset(obj);
1208 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1218 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1222 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1224 Elm_Win *win = data;
1225 _elm_win_focus_highlight_simple_setup(win, obj);
1229 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1231 Evas_Object *target = win->focus_highlight.cur.target;
1232 Evas_Object *previous = win->focus_highlight.prev.target;
1233 Evas_Object *top = win->focus_highlight.top;
1234 Eina_Bool visible_changed;
1235 Eina_Bool common_visible;
1236 const char *sig = NULL;
1238 _elm_win_focus_highlight_reconfigure_job_stop(win);
1240 visible_changed = (win->focus_highlight.cur.visible !=
1241 win->focus_highlight.prev.visible);
1243 if ((target == previous) && (!visible_changed) &&
1244 (!win->focus_highlight.geometry_changed))
1247 if ((previous) && (win->focus_highlight.prev.handled))
1248 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1251 common_visible = EINA_FALSE;
1252 else if (win->focus_highlight.cur.handled)
1254 common_visible = EINA_FALSE;
1255 if (win->focus_highlight.cur.visible)
1256 sig = "elm,action,focus_highlight,show";
1258 sig = "elm,action,focus_highlight,hide";
1261 common_visible = win->focus_highlight.cur.visible;
1263 _elm_win_focus_highlight_visible_set(win, common_visible);
1265 elm_widget_signal_emit(target, sig, "elm");
1267 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1270 if (win->focus_highlight.changed_theme)
1273 if (win->focus_highlight.style)
1274 str = win->focus_highlight.style;
1277 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1279 win->focus_highlight.changed_theme = EINA_FALSE;
1281 if (_elm_config->focus_highlight_animate)
1283 str = edje_object_data_get(win->focus_highlight.top, "animate");
1284 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1288 if ((win->focus_highlight.top_animate) && (previous) &&
1289 (!win->focus_highlight.prev.handled))
1290 _elm_win_focus_highlight_anim_setup(win, top);
1292 _elm_win_focus_highlight_simple_setup(win, top);
1293 evas_object_raise(top);
1296 win->focus_highlight.geometry_changed = EINA_FALSE;
1297 win->focus_highlight.prev = win->focus_highlight.cur;
1302 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1304 Evas_Event_Key_Down *ev = event_info;
1306 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1310 if ((strcmp(ev->keyname, "F12")) ||
1311 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1314 printf("Tree graph generated.\n");
1315 elm_object_tree_dot_dump(obj, "./dump.dot");
1320 _win_img_hide(void *data,
1322 Evas_Object *obj __UNUSED__,
1323 void *event_info __UNUSED__)
1325 Elm_Win *win = data;
1327 elm_widget_focus_hide_handle(win->win_obj);
1331 _win_img_mouse_down(void *data,
1333 Evas_Object *obj __UNUSED__,
1334 void *event_info __UNUSED__)
1336 Elm_Win *win = data;
1337 elm_widget_focus_mouse_down_handle(win->win_obj);
1341 _win_img_focus_in(void *data,
1343 Evas_Object *obj __UNUSED__,
1344 void *event_info __UNUSED__)
1346 Elm_Win *win = data;
1347 elm_widget_focus_steal(win->win_obj);
1351 _win_img_focus_out(void *data,
1353 Evas_Object *obj __UNUSED__,
1354 void *event_info __UNUSED__)
1356 Elm_Win *win = data;
1357 elm_widget_focused_object_clear(win->win_obj);
1361 _win_inlined_image_set(Elm_Win *win)
1363 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1364 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1365 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1366 _elm_win_obj_callback_img_obj_del, win);
1368 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1369 _win_img_hide, win);
1370 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1371 _win_img_mouse_down, win);
1372 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1373 _win_img_focus_in, win);
1374 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1375 _win_img_focus_out, win);
1379 * Adds a window object. If this is the first window created, pass NULL as
1382 * @param parent Parent object to add the window to, or NULL
1383 * @param name The name of the window
1384 * @param type The window type, one of the following:
1386 * ELM_WIN_DIALOG_BASIC
1394 * @return The created object, or NULL on failure
1399 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1403 const char *fontpath;
1405 win = ELM_NEW(Elm_Win);
1407 #define FALLBACK_TRY(engine) \
1410 CRITICAL(engine " engine creation failed. Trying software X11."); \
1411 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1412 elm_engine_set(ELM_SOFTWARE_X11); \
1414 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1418 case ELM_WIN_INLINED_IMAGE:
1422 Evas *e = evas_object_evas_get(parent);
1425 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1428 win->img_obj = ecore_evas_object_image_new(ee);
1431 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1434 _win_inlined_image_set(win);
1438 evas_object_del(win->img_obj);
1439 win->img_obj = NULL;
1448 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1450 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1451 #ifdef HAVE_ELEMENTARY_X
1452 win->client_message_handler = ecore_event_handler_add
1453 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1456 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1458 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1459 FALLBACK_TRY("Sofware FB");
1461 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1463 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1464 FALLBACK_TRY("Sofware DirectFB");
1466 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1468 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1469 FALLBACK_TRY("Sofware-16");
1470 #ifdef HAVE_ELEMENTARY_X
1471 win->client_message_handler = ecore_event_handler_add
1472 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1475 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1477 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1478 FALLBACK_TRY("Sofware-8");
1479 #ifdef HAVE_ELEMENTARY_X
1480 win->client_message_handler = ecore_event_handler_add
1481 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1485 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1487 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1488 FALLBACK_TRY("XRender");
1489 #ifdef HAVE_ELEMENTARY_X
1490 win->client_message_handler = ecore_event_handler_add
1491 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1495 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1500 if (_elm_config->vsync)
1502 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1508 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1510 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1511 FALLBACK_TRY("OpenGL");
1512 #ifdef HAVE_ELEMENTARY_X
1513 win->client_message_handler = ecore_event_handler_add
1514 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1517 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1519 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1520 FALLBACK_TRY("Sofware Win32");
1522 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1524 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1525 FALLBACK_TRY("Sofware-16-WinCE");
1527 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1529 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1530 FALLBACK_TRY("Sofware SDL");
1532 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1534 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1535 FALLBACK_TRY("Sofware-16-SDL");
1537 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1539 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1540 FALLBACK_TRY("OpenGL SDL");
1542 else if (!strncmp(_elm_config->engine, "shot:", 5))
1544 win->ee = ecore_evas_buffer_new(1, 1);
1545 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1546 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1555 ERR("Cannot create window.");
1559 #ifdef HAVE_ELEMENTARY_X
1560 _elm_win_xwindow_get(win);
1562 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1563 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1564 // bg pixmap done by x - has other issues like can be redrawn by x before it
1565 // is filled/ready by app
1566 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1569 win->parent = parent;
1571 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1572 _elm_win_obj_callback_parent_del, win);
1574 win->evas = ecore_evas_get(win->ee);
1575 win->win_obj = elm_widget_add(win->evas);
1576 elm_widget_type_set(win->win_obj, "win");
1577 ELM_SET_WIDTYPE(widtype, "win");
1578 elm_widget_data_set(win->win_obj, win);
1579 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1580 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1581 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1582 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1583 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1584 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1585 evas_object_move(win->win_obj, 0, 0);
1586 evas_object_resize(win->win_obj, 1, 1);
1587 evas_object_layer_set(win->win_obj, 50);
1588 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1590 ecore_evas_object_associate(win->ee, win->win_obj,
1591 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1592 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1593 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1594 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1595 _elm_win_obj_callback_show, win);
1596 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1597 _elm_win_obj_callback_hide, win);
1598 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1599 _elm_win_obj_callback_del, win);
1600 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1601 _elm_win_obj_callback_move, win);
1602 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1603 _elm_win_obj_callback_resize, win);
1605 evas_object_intercept_move_callback_add(win->win_obj,
1606 _elm_win_obj_intercept_move, win);
1607 evas_object_intercept_show_callback_add(win->win_obj,
1608 _elm_win_obj_intercept_show, win);
1610 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1611 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1612 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1613 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1614 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1615 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1616 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1617 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1618 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1619 evas_font_path_append(win->evas, fontpath);
1620 if (!_elm_config->font_hinting)
1621 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1622 else if (_elm_config->font_hinting == 1)
1623 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1624 else if (_elm_config->font_hinting == 2)
1625 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1627 #ifdef HAVE_ELEMENTARY_X
1628 _elm_win_xwin_update(win);
1631 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1633 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1635 ecore_evas_fullscreen_set(win->ee, 1);
1637 #undef ENGINE_COMPARE
1639 if (_elm_config->focus_highlight_enable)
1640 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1643 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1644 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1645 _debug_key_down, win);
1647 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1649 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1652 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1654 return win->win_obj;
1658 * Add @p subobj as a resize object of window @p obj. Note, do not move and
1659 * resize window and sub object at the same time. It will cause problem.
1661 * @param obj The window object
1662 * @param subobj The resize object to add
1667 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1671 ELM_CHECK_WIDTYPE(obj, widtype);
1672 win = elm_widget_data_get(obj);
1674 if (eina_list_data_find(win->subobjs, subobj)) return;
1675 win->subobjs = eina_list_append(win->subobjs, subobj);
1676 elm_widget_sub_object_add(obj, subobj);
1677 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1678 _elm_win_subobj_callback_del, obj);
1679 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1680 _elm_win_subobj_callback_changed_size_hints,
1682 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1683 evas_object_move(subobj, 0, 0);
1684 evas_object_resize(subobj, w, h);
1685 _elm_win_eval_subobjs(obj);
1689 * Delete @p subobj as a resize object of window @p obj.
1691 * @param obj The window object
1692 * @param subobj The resize object to add
1697 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1700 ELM_CHECK_WIDTYPE(obj, widtype);
1701 win = elm_widget_data_get(obj);
1703 evas_object_event_callback_del_full(subobj,
1704 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1705 _elm_win_subobj_callback_changed_size_hints,
1707 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1708 _elm_win_subobj_callback_del, obj);
1709 win->subobjs = eina_list_remove(win->subobjs, subobj);
1710 elm_widget_sub_object_del(obj, subobj);
1711 _elm_win_eval_subobjs(obj);
1715 * Set the title of the window
1717 * @param obj The window object
1718 * @param title The title to set
1723 elm_win_title_set(Evas_Object *obj, const char *title)
1726 ELM_CHECK_WIDTYPE(obj, widtype);
1727 win = elm_widget_data_get(obj);
1729 ecore_evas_title_set(win->ee, title);
1733 * Get the title of the window
1735 * @param obj The window object
1741 elm_win_title_get(const Evas_Object *obj)
1744 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1745 win = elm_widget_data_get(obj);
1746 if (!win) return NULL;
1747 return ecore_evas_title_get(win->ee);
1751 * Set the window's autodel state.
1753 * @param obj The window object
1754 * @param autodel If true, the window will automatically delete itself when closed
1759 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1762 ELM_CHECK_WIDTYPE(obj, widtype);
1763 win = elm_widget_data_get(obj);
1765 win->autodel = autodel;
1769 * Get the window's autodel state.
1771 * @param obj The window object
1772 * @return If the window will automatically delete itself when closed
1777 elm_win_autodel_get(const Evas_Object *obj)
1780 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1781 win = elm_widget_data_get(obj);
1782 if (!win) return EINA_FALSE;
1783 return win->autodel;
1787 * Activate a window object.
1789 * @param obj The window object
1794 elm_win_activate(Evas_Object *obj)
1797 ELM_CHECK_WIDTYPE(obj, widtype);
1798 win = elm_widget_data_get(obj);
1800 ecore_evas_activate(win->ee);
1804 * Lower a window object.
1806 * @param obj The window object
1811 elm_win_lower(Evas_Object *obj)
1814 ELM_CHECK_WIDTYPE(obj, widtype);
1815 win = elm_widget_data_get(obj);
1817 ecore_evas_lower(win->ee);
1821 * Raise a window object.
1823 * @param obj The window object
1828 elm_win_raise(Evas_Object *obj)
1831 ELM_CHECK_WIDTYPE(obj, widtype);
1832 win = elm_widget_data_get(obj);
1834 ecore_evas_raise(win->ee);
1838 * Set the borderless state of a window.
1840 * @param obj The window object
1841 * @param borderless If true, the window is borderless
1846 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1849 ELM_CHECK_WIDTYPE(obj, widtype);
1850 win = elm_widget_data_get(obj);
1852 ecore_evas_borderless_set(win->ee, borderless);
1853 #ifdef HAVE_ELEMENTARY_X
1854 _elm_win_xwin_update(win);
1859 * Get the borderless state of a window.
1861 * @param obj The window object
1862 * @return If true, the window is borderless
1867 elm_win_borderless_get(const Evas_Object *obj)
1870 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1871 win = elm_widget_data_get(obj);
1872 if (!win) return EINA_FALSE;
1873 return ecore_evas_borderless_get(win->ee);
1877 * Set the shaped state of a window.
1879 * @param obj The window object
1880 * @param shaped If true, the window is shaped
1885 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1888 ELM_CHECK_WIDTYPE(obj, widtype);
1889 win = elm_widget_data_get(obj);
1891 ecore_evas_shaped_set(win->ee, shaped);
1892 #ifdef HAVE_ELEMENTARY_X
1893 _elm_win_xwin_update(win);
1898 * Get the shaped state of a window.
1900 * @param obj The window object
1901 * @return If true, the window is shaped
1906 elm_win_shaped_get(const Evas_Object *obj)
1909 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1910 win = elm_widget_data_get(obj);
1911 if (!win) return EINA_FALSE;
1912 return ecore_evas_shaped_get(win->ee);
1916 * Set the alpha channel state of a window.
1918 * @param obj The window object
1919 * @param alpha If true, the window has an alpha channel
1924 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1927 ELM_CHECK_WIDTYPE(obj, widtype);
1928 win = elm_widget_data_get(obj);
1933 else if (win->img_obj)
1935 evas_object_image_alpha_set(win->img_obj, alpha);
1939 #ifdef HAVE_ELEMENTARY_X
1944 if (!_elm_config->compositing)
1945 elm_win_shaped_set(obj, alpha);
1947 ecore_evas_alpha_set(win->ee, alpha);
1950 ecore_evas_alpha_set(win->ee, alpha);
1951 _elm_win_xwin_update(win);
1955 ecore_evas_alpha_set(win->ee, alpha);
1960 * Get the alpha channel state of a window.
1962 * @param obj The window object
1963 * @return If true, the window has an alpha channel
1968 elm_win_alpha_get(const Evas_Object *obj)
1971 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1972 win = elm_widget_data_get(obj);
1973 if (!win) return EINA_FALSE;
1974 return ecore_evas_alpha_get(win->ee);
1978 * Set the transparency state of a window.
1980 * @param obj The window object
1981 * @param transparent If true, the window is transparent
1986 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1989 ELM_CHECK_WIDTYPE(obj, widtype);
1990 win = elm_widget_data_get(obj);
1996 else if (win->img_obj)
1998 evas_object_image_alpha_set(win->img_obj, transparent);
2002 #ifdef HAVE_ELEMENTARY_X
2005 ecore_evas_transparent_set(win->ee, transparent);
2006 _elm_win_xwin_update(win);
2010 ecore_evas_transparent_set(win->ee, transparent);
2015 * Get the transparency state of a window.
2017 * @param obj The window object
2018 * @return If true, the window is transparent
2023 elm_win_transparent_get(const Evas_Object *obj)
2026 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2027 win = elm_widget_data_get(obj);
2028 if (!win) return EINA_FALSE;
2030 return ecore_evas_transparent_get(win->ee);
2034 * Set the override state of a window.
2036 * @param obj The window object
2037 * @param override If true, the window is overridden
2042 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2045 ELM_CHECK_WIDTYPE(obj, widtype);
2046 win = elm_widget_data_get(obj);
2048 ecore_evas_override_set(win->ee, override);
2049 #ifdef HAVE_ELEMENTARY_X
2050 _elm_win_xwin_update(win);
2055 * Get the override state of a window.
2057 * @param obj The window object
2058 * @return If true, the window is overridden
2063 elm_win_override_get(const Evas_Object *obj)
2066 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2067 win = elm_widget_data_get(obj);
2068 if (!win) return EINA_FALSE;
2069 return ecore_evas_override_get(win->ee);
2073 * Set the fullscreen state of a window.
2075 * @param obj The window object
2076 * @param fullscreen If true, the window is fullscreen
2081 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2084 ELM_CHECK_WIDTYPE(obj, widtype);
2085 win = elm_widget_data_get(obj);
2088 // YYY: handle if win->img_obj
2089 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2090 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2091 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2093 // these engines... can ONLY be fullscreen
2098 ecore_evas_fullscreen_set(win->ee, fullscreen);
2099 #ifdef HAVE_ELEMENTARY_X
2100 _elm_win_xwin_update(win);
2103 #undef ENGINE_COMPARE
2107 * Get the fullscreen state of a window.
2109 * @param obj The window object
2110 * @return If true, the window is fullscreen
2115 elm_win_fullscreen_get(const Evas_Object *obj)
2118 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2119 win = elm_widget_data_get(obj);
2120 if (!win) return EINA_FALSE;
2122 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2123 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2124 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2126 // these engines... can ONLY be fullscreen
2131 return ecore_evas_fullscreen_get(win->ee);
2133 #undef ENGINE_COMPARE
2137 * Set the maximized state of a window.
2139 * @param obj The window object
2140 * @param maximized If true, the window is maximized
2145 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2148 ELM_CHECK_WIDTYPE(obj, widtype);
2149 win = elm_widget_data_get(obj);
2151 // YYY: handle if win->img_obj
2152 ecore_evas_maximized_set(win->ee, maximized);
2153 #ifdef HAVE_ELEMENTARY_X
2154 _elm_win_xwin_update(win);
2159 * Get the maximized state of a window.
2161 * @param obj The window object
2162 * @return If true, the window is maximized
2167 elm_win_maximized_get(const Evas_Object *obj)
2170 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2171 win = elm_widget_data_get(obj);
2172 if (!win) return EINA_FALSE;
2173 return ecore_evas_maximized_get(win->ee);
2177 * Set the iconified state of a window.
2179 * @param obj The window object
2180 * @param iconified If true, the window is iconified
2185 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2188 ELM_CHECK_WIDTYPE(obj, widtype);
2189 win = elm_widget_data_get(obj);
2191 ecore_evas_iconified_set(win->ee, iconified);
2192 #ifdef HAVE_ELEMENTARY_X
2193 _elm_win_xwin_update(win);
2198 * Get the iconified state of a window.
2200 * @param obj The window object
2201 * @return If true, the window is iconified
2206 elm_win_iconified_get(const Evas_Object *obj)
2209 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2210 win = elm_widget_data_get(obj);
2211 if (!win) return EINA_FALSE;
2212 return ecore_evas_iconified_get(win->ee);
2216 * Set the layer of the window.
2218 * @param obj The window object
2219 * @param layer The layer of the window
2224 elm_win_layer_set(Evas_Object *obj, int layer)
2227 ELM_CHECK_WIDTYPE(obj, widtype);
2228 win = elm_widget_data_get(obj);
2230 ecore_evas_layer_set(win->ee, layer);
2231 #ifdef HAVE_ELEMENTARY_X
2232 _elm_win_xwin_update(win);
2237 * Get the layer of the window.
2239 * @param obj The window object
2240 * @return The layer of the window
2245 elm_win_layer_get(const Evas_Object *obj)
2248 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2249 win = elm_widget_data_get(obj);
2250 if (!win) return -1;
2251 return ecore_evas_layer_get(win->ee);
2255 * Set the rotation of the window.
2257 * @param obj The window object
2258 * @param rotation The rotation of the window, in degrees (0-360)
2263 elm_win_rotation_set(Evas_Object *obj, int rotation)
2266 ELM_CHECK_WIDTYPE(obj, widtype);
2267 win = elm_widget_data_get(obj);
2269 if (win->rot == rotation) return;
2270 win->rot = rotation;
2271 ecore_evas_rotation_set(win->ee, rotation);
2272 evas_object_size_hint_min_set(obj, -1, -1);
2273 evas_object_size_hint_max_set(obj, -1, -1);
2274 _elm_win_eval_subobjs(obj);
2275 #ifdef HAVE_ELEMENTARY_X
2276 _elm_win_xwin_update(win);
2281 * Rotates the window and resizes it
2283 * @param obj The window object
2284 * @param layer The rotation of the window in degrees (0-360)
2289 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2292 ELM_CHECK_WIDTYPE(obj, widtype);
2293 win = elm_widget_data_get(obj);
2295 if (win->rot == rotation) return;
2296 win->rot = rotation;
2297 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2298 evas_object_size_hint_min_set(obj, -1, -1);
2299 evas_object_size_hint_max_set(obj, -1, -1);
2300 _elm_win_eval_subobjs(obj);
2301 #ifdef HAVE_ELEMENTARY_X
2302 _elm_win_xwin_update(win);
2307 * Get the rotation of the window.
2309 * @param obj The window object
2310 * @return The rotation of the window in degrees (0-360)
2315 elm_win_rotation_get(const Evas_Object *obj)
2318 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2319 win = elm_widget_data_get(obj);
2320 if (!win) return -1;
2325 * Set the sticky state of the window.
2327 * @param obj The window object
2328 * @param sticky If true, the window's sticky state is enabled
2333 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2336 ELM_CHECK_WIDTYPE(obj, widtype);
2337 win = elm_widget_data_get(obj);
2339 ecore_evas_sticky_set(win->ee, sticky);
2340 #ifdef HAVE_ELEMENTARY_X
2341 _elm_win_xwin_update(win);
2346 * Get the sticky state of the window.
2348 * @param obj The window object
2349 * @return If true, the window's sticky state is enabled
2354 elm_win_sticky_get(const Evas_Object *obj)
2357 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2358 win = elm_widget_data_get(obj);
2359 if (!win) return EINA_FALSE;
2360 return ecore_evas_sticky_get(win->ee);
2364 * Sets the keyboard mode of the window.
2366 * @param obj The window object
2367 * @param mode The mode to set; one of:
2368 * ELM_WIN_KEYBOARD_UNKNOWN
2369 * ELM_WIN_KEYBOARD_OFF
2370 * ELM_WIN_KEYBOARD_ON
2371 * ELM_WIN_KEYBOARD_ALPHA
2372 * ELM_WIN_KEYBOARD_NUMERIC
2373 * ELM_WIN_KEYBOARD_PIN
2374 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2375 * ELM_WIN_KEYBOARD_HEX
2376 * ELM_WIN_KEYBOARD_TERMINAL
2377 * ELM_WIN_KEYBOARD_PASSWORD
2378 * ELM_WIN_KEYBOARD_IP
2379 * ELM_WIN_KEYBOARD_HOST
2380 * ELM_WIN_KEYBOARD_FILE
2381 * ELM_WIN_KEYBOARD_URL
2382 * ELM_WIN_KEYBOARD_KEYPAD
2383 * ELM_WIN_KEYBOARD_J2ME
2388 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2391 ELM_CHECK_WIDTYPE(obj, widtype);
2392 win = elm_widget_data_get(obj);
2394 if (mode == win->kbdmode) return;
2395 #ifdef HAVE_ELEMENTARY_X
2396 _elm_win_xwindow_get(win);
2398 win->kbdmode = mode;
2399 #ifdef HAVE_ELEMENTARY_X
2401 ecore_x_e_virtual_keyboard_state_set
2402 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2407 * Gets the keyboard mode of the window.
2409 * @param obj The window object
2410 * @return The mode; one of:
2411 * ELM_WIN_KEYBOARD_UNKNOWN
2412 * ELM_WIN_KEYBOARD_OFF
2413 * ELM_WIN_KEYBOARD_ON
2414 * ELM_WIN_KEYBOARD_ALPHA
2415 * ELM_WIN_KEYBOARD_NUMERIC
2416 * ELM_WIN_KEYBOARD_PIN
2417 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2418 * ELM_WIN_KEYBOARD_HEX
2419 * ELM_WIN_KEYBOARD_TERMINAL
2420 * ELM_WIN_KEYBOARD_PASSWORD
2421 * ELM_WIN_KEYBOARD_IP
2422 * ELM_WIN_KEYBOARD_HOST
2423 * ELM_WIN_KEYBOARD_FILE
2424 * ELM_WIN_KEYBOARD_URL
2425 * ELM_WIN_KEYBOARD_KEYPAD
2426 * ELM_WIN_KEYBOARD_J2ME
2430 EAPI Elm_Win_Keyboard_Mode
2431 elm_win_keyboard_mode_get(const Evas_Object *obj)
2434 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2435 win = elm_widget_data_get(obj);
2436 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2437 return win->kbdmode;
2441 * Sets whether the window is a keyboard.
2443 * @param obj The window object
2444 * @param is_keyboard If true, the window is a virtual keyboard
2449 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2452 ELM_CHECK_WIDTYPE(obj, widtype);
2453 win = elm_widget_data_get(obj);
2455 #ifdef HAVE_ELEMENTARY_X
2456 _elm_win_xwindow_get(win);
2458 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2463 * Gets whether the window is a keyboard.
2465 * @param obj The window object
2466 * @return If the window is a virtual keyboard
2471 elm_win_keyboard_win_get(const Evas_Object *obj)
2474 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2475 win = elm_widget_data_get(obj);
2476 if (!win) return EINA_FALSE;
2477 #ifdef HAVE_ELEMENTARY_X
2478 _elm_win_xwindow_get(win);
2480 return ecore_x_e_virtual_keyboard_get(win->xwin);
2486 * Get the screen position of a window.
2488 * @param obj The window object
2489 * @param x The int to store the x coordinate to
2490 * @param y The int to store the y coordinate to
2495 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2498 ELM_CHECK_WIDTYPE(obj, widtype);
2499 win = elm_widget_data_get(obj);
2501 if (x) *x = win->screen.x;
2502 if (y) *y = win->screen.y;
2506 * Set if this window is an illume conformant window
2508 * @param obj The window object
2509 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2514 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2517 ELM_CHECK_WIDTYPE(obj, widtype);
2518 win = elm_widget_data_get(obj);
2520 #ifdef HAVE_ELEMENTARY_X
2521 _elm_win_xwindow_get(win);
2523 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2528 * Get if this window is an illume conformant window
2530 * @param obj The window object
2531 * @return A boolean if this window is illume conformant or not
2536 elm_win_conformant_get(const Evas_Object *obj)
2539 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2540 win = elm_widget_data_get(obj);
2541 if (!win) return EINA_FALSE;
2542 #ifdef HAVE_ELEMENTARY_X
2543 _elm_win_xwindow_get(win);
2545 return ecore_x_e_illume_conformant_get(win->xwin);
2551 * Set a window to be an illume quickpanel window
2553 * By default window objects are not quickpanel windows.
2555 * @param obj The window object
2556 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2561 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2564 ELM_CHECK_WIDTYPE(obj, widtype);
2565 win = elm_widget_data_get(obj);
2567 #ifdef HAVE_ELEMENTARY_X
2568 _elm_win_xwindow_get(win);
2571 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2574 Ecore_X_Window_State states[2];
2576 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2577 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2578 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2579 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2586 * Get if this window is a quickpanel or not
2588 * @param obj The window object
2589 * @return A boolean if this window is a quickpanel or not
2594 elm_win_quickpanel_get(const Evas_Object *obj)
2597 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2598 win = elm_widget_data_get(obj);
2599 if (!win) return EINA_FALSE;
2600 #ifdef HAVE_ELEMENTARY_X
2601 _elm_win_xwindow_get(win);
2603 return ecore_x_e_illume_quickpanel_get(win->xwin);
2609 * Set the major priority of a quickpanel window
2611 * @param obj The window object
2612 * @param priority The major priority for this quickpanel
2617 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2620 ELM_CHECK_WIDTYPE(obj, widtype);
2621 win = elm_widget_data_get(obj);
2623 #ifdef HAVE_ELEMENTARY_X
2624 _elm_win_xwindow_get(win);
2626 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2631 * Get the major priority of a quickpanel window
2633 * @param obj The window object
2634 * @return The major priority of this quickpanel
2639 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2642 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2643 win = elm_widget_data_get(obj);
2644 if (!win) return -1;
2645 #ifdef HAVE_ELEMENTARY_X
2646 _elm_win_xwindow_get(win);
2648 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2654 * Set the minor priority of a quickpanel window
2656 * @param obj The window object
2657 * @param priority The minor priority for this quickpanel
2662 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2665 ELM_CHECK_WIDTYPE(obj, widtype);
2666 win = elm_widget_data_get(obj);
2668 #ifdef HAVE_ELEMENTARY_X
2669 _elm_win_xwindow_get(win);
2671 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2676 * Get the minor priority of a quickpanel window
2678 * @param obj The window object
2679 * @return The minor priority of this quickpanel
2684 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2687 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2688 win = elm_widget_data_get(obj);
2689 if (!win) return -1;
2690 #ifdef HAVE_ELEMENTARY_X
2691 _elm_win_xwindow_get(win);
2693 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2699 * Set which zone this quickpanel should appear in
2701 * @param obj The window object
2702 * @param zone The requested zone for this quickpanel
2707 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2710 ELM_CHECK_WIDTYPE(obj, widtype);
2711 win = elm_widget_data_get(obj);
2713 #ifdef HAVE_ELEMENTARY_X
2714 _elm_win_xwindow_get(win);
2716 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2721 * Get which zone this quickpanel should appear in
2723 * @param obj The window object
2724 * @return The requested zone for this quickpanel
2729 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2732 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2733 win = elm_widget_data_get(obj);
2735 #ifdef HAVE_ELEMENTARY_X
2736 _elm_win_xwindow_get(win);
2738 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2744 * Set the window to be skipped by keyboard focus
2746 * This sets the window to be skipped by normal keyboard input. This means
2747 * a window manager will be asked to not focus this window as well as omit
2748 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2750 * Call this and enable it on a window BEFORE you show it for the first time,
2751 * otherwise it may have no effect.
2753 * Use this for windows that have only output information or might only be
2754 * interacted with by the mouse or fingers, and never for typing input.
2755 * Be careful that this may have side-effects like making the window
2756 * non-accessible in some cases unless the window is specially handled. Use
2759 * @param obj The window object
2760 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2765 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2768 ELM_CHECK_WIDTYPE(obj, widtype);
2769 win = elm_widget_data_get(obj);
2771 #ifdef HAVE_ELEMENTARY_X
2772 _elm_win_xwindow_get(win);
2777 Ecore_X_Window_State states[2];
2779 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2780 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2781 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2782 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2789 * Send a command to the windowing environment
2791 * This is intended to work in touchscreen or small screen device environments
2792 * where there is a more simplistic window management policy in place. This
2793 * uses the window object indicated to select which part of the environment
2794 * to control (the part that this window lives in), and provides a command
2795 * and an optional parameter structure (use NULL for this if not needed).
2797 * @param obj The window object that lives in the environment to control
2798 * @param command The command to send
2799 * @param params Optional parameters for the command
2804 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2807 ELM_CHECK_WIDTYPE(obj, widtype);
2808 win = elm_widget_data_get(obj);
2810 #ifdef HAVE_ELEMENTARY_X
2811 _elm_win_xwindow_get(win);
2816 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2817 ecore_x_e_illume_focus_back_send(win->xwin);
2819 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2820 ecore_x_e_illume_focus_forward_send(win->xwin);
2822 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2823 ecore_x_e_illume_focus_home_send(win->xwin);
2825 case ELM_ILLUME_COMMAND_CLOSE:
2826 ecore_x_e_illume_close_send(win->xwin);
2836 * Get the inlined image object handle
2838 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2839 * then the window is in fact an evas image object inlined in the parent
2840 * canvas. You can get this object (be careful to not manipulate it as it
2841 * is under control of elementary), and use it to do things like get pixel
2842 * data, save the image to a file, etc.
2844 * @param obj The window object to get the inlined image from
2845 * @return The inlined image object, or NULL if none exists
2850 elm_win_inlined_image_object_get(Evas_Object *obj)
2853 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2854 win = elm_widget_data_get(obj);
2855 if (!win) return NULL;
2856 return win->img_obj;
2860 * Set the enabled status for the focus highlight in a window
2862 * This function will enable or disable the focus highlight only for the
2863 * given window, regardless of the global setting for it
2865 * @param obj The window where to enable the highlight
2866 * @param enabled The enabled value for the highlight
2871 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2875 ELM_CHECK_WIDTYPE(obj, widtype);
2877 win = elm_widget_data_get(obj);
2878 enabled = !!enabled;
2879 if (win->focus_highlight.enabled == enabled)
2882 win->focus_highlight.enabled = enabled;
2884 if (win->focus_highlight.enabled)
2885 _elm_win_focus_highlight_init(win);
2887 _elm_win_focus_highlight_shutdown(win);
2891 * Get the enabled value of the focus highlight for this window
2893 * @param obj The window in which to check if the focus highlight is enabled
2895 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2900 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2904 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2906 win = elm_widget_data_get(obj);
2907 return win->focus_highlight.enabled;
2911 * Set the style for the focus highlight on this window
2913 * Sets the style to use for theming the highlight of focused objects on
2914 * the given window. If @p style is NULL, the default will be used.
2916 * @param obj The window where to set the style
2917 * @param style The style to set
2922 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2926 ELM_CHECK_WIDTYPE(obj, widtype);
2928 win = elm_widget_data_get(obj);
2929 eina_stringshare_replace(&win->focus_highlight.style, style);
2930 win->focus_highlight.changed_theme = EINA_TRUE;
2931 _elm_win_focus_highlight_reconfigure_job_start(win);
2935 * Get the style set for the focus highlight object
2937 * Gets the style set for this windows highilght object, or NULL if none
2940 * @param obj The window to retrieve the highlights style from
2942 * @return The style set or NULL if none was. Default is used in that case.
2947 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2951 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2953 win = elm_widget_data_get(obj);
2954 return win->focus_highlight.style;
2958 elm_win_indicator_state_set(Evas_Object *obj, int show_state)
2961 if (strcmp(elm_widget_type_get(obj), "win")) return;
2962 win = elm_widget_data_get(obj);
2964 #ifdef HAVE_ELEMENTARY_X
2965 _elm_win_xwindow_get(win);
2967 return ecore_x_window_prop_property_set (win->xwin,
2968 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
2974 elm_win_indicator_state_get(Evas_Object *obj)
2977 if (strcmp(elm_widget_type_get(obj), "win")) return -1;
2978 win = elm_widget_data_get(obj);
2979 if (!win) return -1;
2980 #ifdef HAVE_ELEMENTARY_X
2981 _elm_win_xwindow_get(win);
2987 unsigned int *prop_data = NULL;
2989 ret = ecore_x_window_prop_property_get (win->xwin,
2990 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, (void *)&prop_data, &count);
2991 if( ret && prop_data )
2992 memcpy (&show, prop_data, sizeof (int));
2994 if (prop_data) free (prop_data);
3003 typedef struct _Widget_Data Widget_Data;
3008 Evas_Object *content;
3011 static void _del_hook(Evas_Object *obj);
3012 static void _theme_hook(Evas_Object *obj);
3013 static void _sizing_eval(Evas_Object *obj);
3014 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3015 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3017 static const char *widtype2 = NULL;
3020 _del_hook(Evas_Object *obj)
3022 Widget_Data *wd = elm_widget_data_get(obj);
3028 _theme_hook(Evas_Object *obj)
3030 Widget_Data *wd = elm_widget_data_get(obj);
3031 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3033 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3038 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3040 Widget_Data *wd = elm_widget_data_get(obj);
3045 /* Try Focus cycle in subitem */
3048 elm_widget_focus_next_get(wd->content, dir, next);
3053 *next = (Evas_Object *)obj;
3058 _sizing_eval(Evas_Object *obj)
3060 Widget_Data *wd = elm_widget_data_get(obj);
3061 Evas_Coord minw = -1, minh = -1;
3063 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3064 edje_object_size_min_calc(wd->frm, &minw, &minh);
3065 evas_object_size_hint_min_set(obj, minw, minh);
3066 evas_object_size_hint_max_set(obj, -1, -1);
3070 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3076 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3078 Widget_Data *wd = elm_widget_data_get(obj);
3079 Evas_Object *sub = event_info;
3080 if (sub == wd->content)
3082 evas_object_event_callback_del_full
3083 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3090 * @defgroup Inwin Inwin
3092 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
3095 elm_win_inwin_add(Evas_Object *obj)
3101 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3102 win = elm_widget_data_get(obj);
3103 if (!win) return NULL;
3104 wd = ELM_NEW(Widget_Data);
3105 obj2 = elm_widget_add(win->evas);
3106 elm_widget_type_set(obj2, "inwin");
3107 ELM_SET_WIDTYPE(widtype2, "inwin");
3108 elm_widget_sub_object_add(obj, obj2);
3109 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3110 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3111 elm_win_resize_object_add(obj, obj2);
3113 elm_widget_data_set(obj2, wd);
3114 elm_widget_del_hook_set(obj2, _del_hook);
3115 elm_widget_theme_hook_set(obj2, _theme_hook);
3116 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3117 elm_widget_can_focus_set(obj2, EINA_TRUE);
3118 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3120 wd->frm = edje_object_add(win->evas);
3121 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3122 elm_widget_resize_object_set(obj2, wd->frm);
3124 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3131 * Activates an inwin object
3133 * @param obj The inwin to activate
3138 elm_win_inwin_activate(Evas_Object *obj)
3140 ELM_CHECK_WIDTYPE(obj, widtype2);
3141 Widget_Data *wd = elm_widget_data_get(obj);
3143 evas_object_raise(obj);
3144 evas_object_show(obj);
3145 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3146 elm_object_focus(obj);
3150 * Set the content of an inwin object.
3152 * Once the content object is set, a previously set one will be deleted.
3153 * If you want to keep that old content object, use the
3154 * elm_win_inwin_content_unset() function.
3156 * @param obj The inwin object
3157 * @param content The object to set as content
3162 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3164 ELM_CHECK_WIDTYPE(obj, widtype2);
3165 Widget_Data *wd = elm_widget_data_get(obj);
3167 if (wd->content == content) return;
3168 if (wd->content) evas_object_del(wd->content);
3169 wd->content = content;
3172 elm_widget_sub_object_add(obj, content);
3173 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3174 _changed_size_hints, obj);
3175 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3181 * Get the content of an inwin object.
3183 * Return the content object which is set for this widget.
3185 * @param obj The inwin object
3186 * @return The content that is being used
3191 elm_win_inwin_content_get(const Evas_Object *obj)
3193 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3194 Widget_Data *wd = elm_widget_data_get(obj);
3195 if (!wd) return NULL;
3200 * Unset the content of an inwin object.
3202 * Unparent and return the content object which was set for this widget.
3204 * @param obj The inwin object
3205 * @return The content that was being used
3210 elm_win_inwin_content_unset(Evas_Object *obj)
3212 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3213 Widget_Data *wd = elm_widget_data_get(obj);
3214 if (!wd) return NULL;
3215 if (!wd->content) return NULL;
3216 Evas_Object *content = wd->content;
3217 elm_widget_sub_object_del(obj, wd->content);
3218 edje_object_part_unswallow(wd->frm, wd->content);
3223 /* windowing spcific calls - shall we do this differently? */
3225 static Ecore_X_Window
3226 _elm_ee_win_get(const Evas_Object *obj)
3229 #ifdef HAVE_ELEMENTARY_X
3230 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3231 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3237 * Get the Ecore_X_Window of an Evas_Object
3239 * @param obj The object
3241 * @return The Ecore_X_Window of @p obj
3246 elm_win_xwindow_get(const Evas_Object *obj)
3248 Ecore_X_Window xwin = 0;
3253 type = elm_widget_type_get(obj);
3254 if (!type) return 0;
3255 if (type != widtype) return _elm_ee_win_get(obj);
3256 #ifdef HAVE_ELEMENTARY_X
3257 win = elm_widget_data_get(obj);
3258 if (!win) return xwin;
3259 if (win->xwin) return win->xwin;
3260 if (win->parent) return elm_win_xwindow_get(win->parent);