1 #include <Elementary.h>
7 * The window class of Elementary. Contains functions to manipulate
8 * windows. The Evas engine used to render the window contents is specified
9 * in the system or user elementary config files (whichever is found last),
10 * and can be overridden with the ELM_ENGINE environment variable for testing.
11 * Engines that may be supported (depending on Evas and Ecore-Evas compilation
12 * setup and modules actually installed at runtime) are (listed in order of
13 * best supported and most likely to be complete and work to lowest quality).
15 * "x11", "x", "software-x11", "software_x11"
16 * (Software rendering in X11)
17 * "gl", "opengl", "opengl-x11", "opengl_x11"
18 * (OpenGL or OpenGL-ES2 rendering in X11)
20 * (Virtual screenshot renderer - renders to output file and exits)
21 * "fb", "software-fb", "software_fb"
22 * (Linux framebuffer direct software rendering)
23 * "sdl", "software-sdl", "software_sdl"
24 * (SDL software rendering to SDL buffer)
25 * "gl-sdl", "gl_sdl", "opengl-sdl", "opengl_sdl"
26 * (OpenGL or OpenGL-ES2 rendering using SDL as the buffer)
27 * "gdi", "software-gdi", "software_gdi"
28 * (Windows WIN32 rendering via GDI with software)
30 * (Rendering to a DirectFB window)
31 * "x11-8", "x8", "software-8-x11", "software_8_x11"
32 * (Rendering in grayscale using dedicated 8bit software engine in X11)
33 * "x11-16", "x16", "software-16-x11", "software_16_x11"
34 * (Rendering in X11 using 16bit software engine)
35 * "wince-gdi", "software-16-wince-gdi", "software_16_wince_gdi"
36 * (Windows CE rendering via GDI with 16bit software renderer)
37 * "sdl-16", "software-16-sdl", "software_16_sdl"
38 * (Rendering to SDL buffer with 16bit software renderer)
40 * All engines use a simple string to select the engine to render, EXCEPT
41 * the "shot" engine. This actually encodes the output of the virtual
42 * screenshot and how long to delay in the engine string. The engine string
43 * is encoded in the following way:
45 * "shot:[delay=XX][:][file=XX]"
47 * Where options are separated by a ":" char if more than one option is given,
48 * with delay, if provided being the first option and file the last (order
49 * is important). The delay specifies how long to wait after the window is
50 * shown before doing the virtual "in memory" rendering and then save the
51 * output to the file specified by the file option (and then exit). If no
52 * delay is given, the default is 0.5 seconds. If no file is given the
53 * default output file is "out.png". Some examples of using the shot engine:
55 * ELM_ENGINE="shot:delay=1.0:file=elm_test.png" elementary_test
56 * ELM_ENGINE="shot:file=elm_test2.png" elementary_test
57 * ELM_ENGINE="shot:delay=2.0" elementary_test
58 * ELM_ENGINE="shot:" elementary_test
60 * Signals that you can add callbacks for are:
62 * "delete,request" - the user requested to delete the window
63 * "focus,in" - window got focus
64 * "focus,out" - window lost focus
65 * "moved" - window that holds the canvas was moved
68 typedef struct _Elm_Win Elm_Win;
74 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
76 #ifdef HAVE_ELEMENTARY_X
78 Ecore_Event_Handler *client_message_handler;
80 Ecore_Job *deferred_resize_job;
81 Ecore_Job *deferred_child_eval_job;
84 Elm_Win_Keyboard_Mode kbdmode;
89 Eina_Bool autodel : 1;
90 int *autodel_clear, rot;
100 Eina_Bool visible : 1;
101 Eina_Bool handled : 1;
105 Ecore_Job *reconf_job;
107 Eina_Bool enabled : 1;
108 Eina_Bool changed_theme : 1;
109 Eina_Bool top_animate : 1;
110 Eina_Bool geometry_changed : 1;
114 static const char *widtype = NULL;
115 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
116 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
117 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
118 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
119 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
120 static void _elm_win_move(Ecore_Evas *ee);
121 static void _elm_win_resize(Ecore_Evas *ee);
122 static void _elm_win_delete_request(Ecore_Evas *ee);
123 static void _elm_win_resize_job(void *data);
124 #ifdef HAVE_ELEMENTARY_X
125 static void _elm_win_xwin_update(Elm_Win *win);
127 static void _elm_win_eval_subobjs(Evas_Object *obj);
128 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
129 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
130 static void _elm_win_focus_highlight_init(Elm_Win *win);
131 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
132 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
133 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
134 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
135 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
136 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
138 static const char SIG_DELETE_REQUEST[] = "delete,request";
139 static const char SIG_FOCUS_OUT[] = "focus,in";
140 static const char SIG_FOCUS_IN[] = "focus,out";
141 static const char SIG_MOVED[] = "moved";
143 static const Evas_Smart_Cb_Description _signals[] = {
144 {SIG_DELETE_REQUEST, ""},
153 Eina_List *_elm_win_list = NULL;
154 int _elm_win_deferred_free = 0;
156 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
157 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
160 _shot_delay_get(Elm_Win *win)
163 char *d = strdup(win->shot.info);
166 for (p = (char *)win->shot.info; *p; p++)
168 if (!strncmp(p, "delay=", 6))
172 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
187 _shot_file_get(Elm_Win *win)
190 char *tmp = strdup(win->shot.info);
192 if (!tmp) return NULL;
193 for (p = (char *)win->shot.info; *p; p++)
195 if (!strncmp(p, "file=", 5))
202 return strdup("out.png");
206 _shot_key_get(Elm_Win *win __UNUSED__)
212 _shot_flags_get(Elm_Win *win __UNUSED__)
218 _shot_do(Elm_Win *win)
222 unsigned int *pixels;
224 char *file, *key, *flags;
226 ecore_evas_manual_render(win->ee);
227 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
229 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
230 if ((w < 1) || (h < 1)) return;
231 file = _shot_file_get(win);
233 key = _shot_key_get(win);
234 flags = _shot_flags_get(win);
235 ee = ecore_evas_buffer_new(1, 1);
236 o = evas_object_image_add(ecore_evas_get(ee));
237 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
238 evas_object_image_size_set(o, w, h);
239 evas_object_image_data_set(o, pixels);
240 if (!evas_object_image_save(o, file, key, flags))
242 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
247 if (flags) free(flags);
252 _shot_delay(void *data)
256 win->shot.timer = NULL;
262 _shot_handle(Elm_Win *win)
264 if (!win->shot.info) return;
265 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
269 _elm_win_move(Ecore_Evas *ee)
271 Evas_Object *obj = ecore_evas_object_associate_get(ee);
276 win = elm_widget_data_get(obj);
278 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
281 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
285 _elm_win_resize(Ecore_Evas *ee)
287 Evas_Object *obj = ecore_evas_object_associate_get(ee);
291 win = elm_widget_data_get(obj);
293 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
294 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
298 _elm_win_focus_in(Ecore_Evas *ee)
300 Evas_Object *obj = ecore_evas_object_associate_get(ee);
304 win = elm_widget_data_get(obj);
306 /*NB: Why two different "focus signals" here ??? */
307 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL); // FIXME: remove me
308 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
309 win->focus_highlight.cur.visible = EINA_TRUE;
310 _elm_win_focus_highlight_reconfigure_job_start(win);
314 else if (win->img_obj)
321 _elm_win_focus_out(Ecore_Evas *ee)
323 Evas_Object *obj = ecore_evas_object_associate_get(ee);
327 win = elm_widget_data_get(obj);
329 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL); // FIXME: remove me
330 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
331 win->focus_highlight.cur.visible = EINA_FALSE;
332 _elm_win_focus_highlight_reconfigure_job_start(win);
336 else if (win->img_obj)
343 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
345 Elm_Win *wd = elm_widget_data_get(obj);
346 const Eina_List *items;
347 void *(*list_data_get) (const Eina_List *list);
355 if (!(items = elm_widget_focus_custom_chain_get(obj)))
361 list_data_get = eina_list_data_get;
363 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
369 *next = (Evas_Object *)obj;
374 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
376 Elm_Win *win = elm_widget_data_get(obj);
380 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
382 evas_object_focus_set(obj, elm_widget_focus_get(obj));
386 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
388 if (type == EVAS_CALLBACK_KEY_DOWN)
390 Evas_Event_Key_Down *ev = event_info;
391 if (!strcmp(ev->keyname, "Tab"))
393 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
394 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
396 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
397 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
406 _deferred_ecore_evas_free(void *data)
408 ecore_evas_free(data);
409 _elm_win_deferred_free--;
413 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
417 elm_object_focus(obj);
418 if (win->shot.info) _shot_handle(win);
422 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
429 else if (win->img_obj)
431 evas_object_hide(win->img_obj);
436 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
443 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
444 _elm_win_obj_callback_parent_del, win);
447 if (win->autodel_clear) *(win->autodel_clear) = -1;
448 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
449 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
452 ecore_evas_callback_delete_request_set(win->ee, NULL);
453 ecore_evas_callback_resize_set(win->ee, NULL);
455 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
456 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
457 if (win->shot.info) eina_stringshare_del(win->shot.info);
458 if (win->shot.timer) ecore_timer_del(win->shot.timer);
459 while (((child = evas_object_bottom_get(win->evas))) &&
462 evas_object_del(child);
464 while (((child = evas_object_top_get(win->evas))) &&
467 evas_object_del(child);
469 #ifdef HAVE_ELEMENTARY_X
470 if (win->client_message_handler)
471 ecore_event_handler_del(win->client_message_handler);
473 // FIXME: Why are we flushing edje on every window destroy ??
474 // edje_file_cache_flush();
475 // edje_collection_cache_flush();
476 // evas_image_cache_flush(win->evas);
477 // evas_font_cache_flush(win->evas);
478 // FIXME: we are in the del handler for the object and delete the canvas
479 // that lives under it from the handler... nasty. deferring doesn't help either
489 ecore_job_add(_deferred_ecore_evas_free, win->ee);
490 _elm_win_deferred_free++;
494 _elm_win_focus_highlight_shutdown(win);
495 eina_stringshare_del(win->focus_highlight.style);
499 if ((!_elm_win_list) &&
500 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
502 edje_file_cache_flush();
503 edje_collection_cache_flush();
504 evas_image_cache_flush(e);
505 evas_font_cache_flush(e);
511 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
514 if (!win->img_obj) return;
515 evas_object_event_callback_del_full
516 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
517 evas_object_del(win->img_obj);
521 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
524 if (obj == win->parent) win->parent = NULL;
528 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
534 if ((x != win->screen.x) || (y != win->screen.y))
538 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
543 evas_object_move(obj, x, y);
548 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
551 // this is called to make sure all smart containers have calculated their
552 // sizes BEFORE we show the window to make sure it initially appears at
553 // our desired size (ie min size is known first)
554 evas_smart_objects_calculate(evas_object_evas_get(obj));
555 evas_object_show(obj);
559 else if (win->img_obj)
561 evas_object_show(win->img_obj);
566 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
570 if (ecore_evas_override_get(win->ee))
574 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
577 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
582 else if (win->img_obj)
586 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
589 // evas_object_move(win->img_obj, x, y);
594 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
601 else if (win->img_obj)
603 Evas_Coord w = 1, h = 1;
605 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
608 evas_object_image_size_set(win->img_obj, w, h);
613 _elm_win_delete_request(Ecore_Evas *ee)
615 Evas_Object *obj = ecore_evas_object_associate_get(ee);
617 if (strcmp(elm_widget_type_get(obj), "win")) return;
619 win = elm_widget_data_get(obj);
621 int autodel = win->autodel;
622 win->autodel_clear = &autodel;
623 evas_object_ref(win->win_obj);
624 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
625 // FIXME: if above callback deletes - then the below will be invalid
626 if (autodel) evas_object_del(win->win_obj);
627 else win->autodel_clear = NULL;
628 evas_object_unref(win->win_obj);
632 _elm_win_resize_job(void *data)
639 win->deferred_resize_job = NULL;
640 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
641 evas_object_resize(win->win_obj, w, h);
645 else if (win->img_obj)
648 EINA_LIST_FOREACH(win->subobjs, l, obj)
650 evas_object_move(obj, 0, 0);
651 evas_object_resize(obj, w, h);
655 #ifdef HAVE_ELEMENTARY_X
657 _elm_win_xwindow_get(Elm_Win *win)
661 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
662 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
664 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
666 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
667 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
668 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
669 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
670 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
671 ENGINE_COMPARE(ELM_OPENGL_SDL))
674 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
676 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
678 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
680 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
683 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
685 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
688 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
690 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
692 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
694 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
696 #undef ENGINE_COMPARE
700 #ifdef HAVE_ELEMENTARY_X
702 _elm_win_xwin_update(Elm_Win *win)
704 _elm_win_xwindow_get(win);
709 win2 = elm_widget_data_get(win->parent);
713 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
717 if (!win->xwin) return; /* nothing more to do */
722 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
724 case ELM_WIN_DIALOG_BASIC:
725 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
727 case ELM_WIN_DESKTOP:
728 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
731 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
733 case ELM_WIN_TOOLBAR:
734 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
737 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
739 case ELM_WIN_UTILITY:
740 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
743 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
745 case ELM_WIN_DROPDOWN_MENU:
746 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
748 case ELM_WIN_POPUP_MENU:
749 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
751 case ELM_WIN_TOOLTIP:
752 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
754 case ELM_WIN_NOTIFICATION:
755 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
758 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
761 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
766 ecore_x_e_virtual_keyboard_state_set
767 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
772 _elm_win_eval_subobjs(Evas_Object *obj)
775 const Evas_Object *child;
777 Elm_Win *win = elm_widget_data_get(obj);
778 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
782 EINA_LIST_FOREACH(win->subobjs, l, child)
784 evas_object_size_hint_weight_get(child, &wx, &wy);
785 if (wx == 0.0) xx = 0;
786 if (wy == 0.0) xy = 0;
788 evas_object_size_hint_min_get(child, &w, &h);
791 if (w > minw) minw = w;
792 if (h > minh) minh = h;
794 evas_object_size_hint_max_get(child, &w, &h);
797 if (maxw == -1) maxw = w;
798 else if ((w > 0) && (w < maxw)) maxw = w;
799 if (maxh == -1) maxh = h;
800 else if ((h > 0) && (h < maxh)) maxh = h;
802 if (!xx) maxw = minw;
804 if (!xy) maxh = minh;
806 evas_object_size_hint_min_set(obj, minw, minh);
807 evas_object_size_hint_max_set(obj, maxw, maxh);
808 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
809 if (w < minw) w = minw;
810 if (h < minh) h = minh;
811 if ((maxw >= 0) && (w > maxw)) w = maxw;
812 if ((maxh >= 0) && (h > maxh)) h = maxh;
813 evas_object_resize(obj, w, h);
817 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
819 Elm_Win *win = elm_widget_data_get(data);
820 win->subobjs = eina_list_remove(win->subobjs, obj);
821 _elm_win_eval_subobjs(win->win_obj);
825 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
827 _elm_win_eval_subobjs(data);
831 _elm_win_shutdown(void)
833 while (_elm_win_list)
834 evas_object_del(_elm_win_list->data);
838 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
845 EINA_LIST_FOREACH(_elm_win_list, l, obj)
846 elm_widget_theme(obj);
850 EINA_LIST_FOREACH(_elm_win_list, l, obj)
851 elm_widget_theme_specific(obj, th, EINA_FALSE);
855 #ifdef HAVE_ELEMENTARY_X
857 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
860 Ecore_X_Event_Client_Message *e = event;
862 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
863 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
865 if ((unsigned)e->data.l[0] == win->xwin)
867 Evas *evas = evas_object_evas_get(win->win_obj);
870 edje_file_cache_flush();
871 edje_collection_cache_flush();
872 evas_image_cache_flush(evas);
873 evas_font_cache_flush(evas);
877 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
879 if ((unsigned)e->data.l[0] == win->xwin)
881 Evas *evas = evas_object_evas_get(win->win_obj);
884 edje_file_cache_flush();
885 edje_collection_cache_flush();
886 evas_image_cache_flush(evas);
887 evas_font_cache_flush(evas);
888 evas_render_dump(evas);
892 return ECORE_CALLBACK_PASS_ON;
897 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
901 win->focus_highlight.geometry_changed = EINA_TRUE;
902 _elm_win_focus_highlight_reconfigure_job_start(win);
906 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
910 win->focus_highlight.geometry_changed = EINA_TRUE;
911 _elm_win_focus_highlight_reconfigure_job_start(win);
915 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
919 win->focus_highlight.cur.target = NULL;
921 _elm_win_focus_highlight_reconfigure_job_start(win);
925 _elm_win_focus_target_callbacks_add(Elm_Win *win)
927 Evas_Object *obj = win->focus_highlight.cur.target;
929 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
930 _elm_win_focus_target_move, win);
931 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
932 _elm_win_focus_target_resize, win);
933 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
934 _elm_win_focus_target_del, win);
938 _elm_win_focus_target_callbacks_del(Elm_Win *win)
940 Evas_Object *obj = win->focus_highlight.cur.target;
942 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
943 _elm_win_focus_target_move, win);
944 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
945 _elm_win_focus_target_resize, win);
946 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
947 _elm_win_focus_target_del, win);
951 _elm_win_focus_target_get(Evas_Object *obj)
953 Evas_Object *o = obj;
957 if (elm_widget_is(o))
959 if (!elm_widget_highlight_ignore_get(o))
961 o = elm_widget_parent_get(o);
963 o = evas_object_smart_parent_get(o);
967 o = elm_widget_parent_widget_get(o);
969 o = evas_object_smart_parent_get(o);
978 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
980 Evas_Object *obj = event_info, *target;
983 if (win->focus_highlight.cur.target == obj)
986 target = _elm_win_focus_target_get(obj);
987 win->focus_highlight.cur.target = target;
988 if (elm_widget_highlight_in_theme_get(target))
989 win->focus_highlight.cur.handled = EINA_TRUE;
991 _elm_win_focus_target_callbacks_add(win);
993 _elm_win_focus_highlight_reconfigure_job_start(win);
997 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1001 if (!win->focus_highlight.cur.target)
1004 if (!win->focus_highlight.cur.handled)
1005 _elm_win_focus_target_callbacks_del(win);
1006 win->focus_highlight.cur.target = NULL;
1007 win->focus_highlight.cur.handled = EINA_FALSE;
1009 _elm_win_focus_highlight_reconfigure_job_start(win);
1013 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1015 evas_object_hide(obj);
1019 _elm_win_focus_highlight_init(Elm_Win *win)
1021 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1022 _elm_win_object_focus_in, win);
1023 evas_event_callback_add(win->evas,
1024 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1025 _elm_win_object_focus_out, win);
1027 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1029 win->focus_highlight.top = edje_object_add(win->evas);
1030 win->focus_highlight.changed_theme = EINA_TRUE;
1031 edje_object_signal_callback_add(win->focus_highlight.top,
1032 "elm,action,focus,hide,end", "",
1033 _elm_win_focus_highlight_hide, NULL);
1034 edje_object_signal_callback_add(win->focus_highlight.top,
1035 "elm,action,focus,anim,end", "",
1036 _elm_win_focus_highlight_anim_end, win);
1037 _elm_win_focus_highlight_reconfigure_job_start(win);
1041 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1043 _elm_win_focus_highlight_reconfigure_job_stop(win);
1044 if (win->focus_highlight.cur.target)
1046 _elm_win_focus_target_callbacks_del(win);
1047 win->focus_highlight.cur.target = NULL;
1049 if (win->focus_highlight.top)
1051 evas_object_del(win->focus_highlight.top);
1052 win->focus_highlight.top = NULL;
1055 evas_event_callback_del_full(win->evas,
1056 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1057 _elm_win_object_focus_in, win);
1058 evas_event_callback_del_full(win->evas,
1059 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1060 _elm_win_object_focus_out, win);
1064 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1068 top = win->focus_highlight.top;
1073 evas_object_show(top);
1074 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1080 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1085 _elm_win_focus_highlight_reconfigure_job(void *data)
1087 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1091 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1093 if (win->focus_highlight.reconf_job)
1094 ecore_job_del(win->focus_highlight.reconf_job);
1095 win->focus_highlight.reconf_job = ecore_job_add(
1096 _elm_win_focus_highlight_reconfigure_job, win);
1100 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1102 if (win->focus_highlight.reconf_job)
1103 ecore_job_del(win->focus_highlight.reconf_job);
1104 win->focus_highlight.reconf_job = NULL;
1108 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1110 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1111 Evas_Coord x, y, w, h;
1113 clip = evas_object_clip_get(target);
1114 evas_object_geometry_get(target, &x, &y, &w, &h);
1116 evas_object_move(obj, x, y);
1117 evas_object_resize(obj, w, h);
1118 evas_object_clip_set(obj, clip);
1122 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1124 Evas_Coord tx, ty, tw, th;
1125 Evas_Coord w, h, px, py, pw, ph;
1126 Edje_Message_Int_Set *m;
1127 Evas_Object *previous = win->focus_highlight.prev.target;
1128 Evas_Object *target = win->focus_highlight.cur.target;
1130 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1131 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1132 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1133 evas_object_move(obj, 0, 0);
1134 evas_object_resize(obj, tw, th);
1135 evas_object_clip_unset(obj);
1137 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1147 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1151 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1153 Elm_Win *win = data;
1154 _elm_win_focus_highlight_simple_setup(win, obj);
1158 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1160 Evas_Object *target = win->focus_highlight.cur.target;
1161 Evas_Object *previous = win->focus_highlight.prev.target;
1162 Evas_Object *top = win->focus_highlight.top;
1163 Eina_Bool visible_changed;
1164 Eina_Bool common_visible;
1165 const char *sig = NULL;
1167 _elm_win_focus_highlight_reconfigure_job_stop(win);
1169 visible_changed = (win->focus_highlight.cur.visible !=
1170 win->focus_highlight.prev.visible);
1172 if ((target == previous) && (!visible_changed) &&
1173 (!win->focus_highlight.geometry_changed))
1176 if ((previous) && (win->focus_highlight.prev.handled))
1177 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1180 common_visible = EINA_FALSE;
1181 else if (win->focus_highlight.cur.handled)
1183 common_visible = EINA_FALSE;
1184 if (win->focus_highlight.cur.visible)
1185 sig = "elm,action,focus_highlight,show";
1187 sig = "elm,action,focus_highlight,hide";
1190 common_visible = win->focus_highlight.cur.visible;
1192 _elm_win_focus_highlight_visible_set(win, common_visible);
1194 elm_widget_signal_emit(target, sig, "elm");
1196 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1199 if (win->focus_highlight.changed_theme)
1202 if (win->focus_highlight.style)
1203 str = win->focus_highlight.style;
1206 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1208 win->focus_highlight.changed_theme = EINA_FALSE;
1210 if (_elm_config->focus_highlight_animate)
1212 str = edje_object_data_get(win->focus_highlight.top, "animate");
1213 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1217 if ((win->focus_highlight.top_animate) && (previous) &&
1218 (!win->focus_highlight.prev.handled))
1219 _elm_win_focus_highlight_anim_setup(win, top);
1221 _elm_win_focus_highlight_simple_setup(win, top);
1222 evas_object_raise(top);
1225 win->focus_highlight.geometry_changed = EINA_FALSE;
1226 win->focus_highlight.prev = win->focus_highlight.cur;
1231 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1233 Evas_Event_Key_Down *ev = event_info;
1235 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1239 if ((strcmp(ev->keyname, "F12")) ||
1240 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1243 printf("Tree graph generated.\n");
1244 elm_object_tree_dot_dump(obj, "./dump.dot");
1249 _win_img_hide(void *data,
1251 Evas_Object *obj __UNUSED__,
1252 void *event_info __UNUSED__)
1254 Elm_Win *win = data;
1256 elm_widget_focus_hide_handle(win->win_obj);
1260 _win_img_mouse_down(void *data,
1262 Evas_Object *obj __UNUSED__,
1263 void *event_info __UNUSED__)
1265 Elm_Win *win = data;
1266 elm_widget_focus_mouse_down_handle(win->win_obj);
1270 _win_img_focus_in(void *data,
1272 Evas_Object *obj __UNUSED__,
1273 void *event_info __UNUSED__)
1275 Elm_Win *win = data;
1276 elm_widget_focus_steal(win->win_obj);
1280 _win_img_focus_out(void *data,
1282 Evas_Object *obj __UNUSED__,
1283 void *event_info __UNUSED__)
1285 Elm_Win *win = data;
1286 elm_widget_focused_object_clear(win->win_obj);
1290 _win_inlined_image_set(Elm_Win *win)
1292 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1293 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1294 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1295 _elm_win_obj_callback_img_obj_del, win);
1297 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1298 _win_img_hide, win);
1299 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1300 _win_img_mouse_down, win);
1301 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1302 _win_img_focus_in, win);
1303 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1304 _win_img_focus_out, win);
1308 * Adds a window object. If this is the first window created, pass NULL as
1311 * @param parent Parent object to add the window to, or NULL
1312 * @param name The name of the window
1313 * @param type The window type, one of the following:
1315 * ELM_WIN_DIALOG_BASIC
1323 * @return The created object, or NULL on failure
1328 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1332 const char *fontpath;
1334 win = ELM_NEW(Elm_Win);
1336 #define FALLBACK_TRY(engine) \
1339 CRITICAL(engine " engine creation failed. Trying software X11."); \
1340 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1342 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1346 case ELM_WIN_INLINED_IMAGE:
1350 Evas *e = evas_object_evas_get(parent);
1353 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1356 win->img_obj = ecore_evas_object_image_new(ee);
1359 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1362 _win_inlined_image_set(win);
1366 evas_object_del(win->img_obj);
1367 win->img_obj = NULL;
1376 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1378 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1379 #ifdef HAVE_ELEMENTARY_X
1380 win->client_message_handler = ecore_event_handler_add
1381 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1384 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1386 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1387 FALLBACK_TRY("Sofware FB");
1389 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1391 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1392 FALLBACK_TRY("Sofware DirectFB");
1394 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1396 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1397 FALLBACK_TRY("Sofware-16");
1398 #ifdef HAVE_ELEMENTARY_X
1399 win->client_message_handler = ecore_event_handler_add
1400 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1403 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1405 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1406 FALLBACK_TRY("Sofware-8");
1407 #ifdef HAVE_ELEMENTARY_X
1408 win->client_message_handler = ecore_event_handler_add
1409 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1413 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1415 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1416 FALLBACK_TRY("XRender");
1417 #ifdef HAVE_ELEMENTARY_X
1418 win->client_message_handler = ecore_event_handler_add
1419 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1423 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1428 if (_elm_config->vsync)
1430 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1436 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1438 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1439 FALLBACK_TRY("OpenGL");
1440 #ifdef HAVE_ELEMENTARY_X
1441 win->client_message_handler = ecore_event_handler_add
1442 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1445 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1447 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1448 FALLBACK_TRY("Sofware Win32");
1450 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1452 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1453 FALLBACK_TRY("Sofware-16-WinCE");
1455 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1457 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1458 FALLBACK_TRY("Sofware SDL");
1460 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1462 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1463 FALLBACK_TRY("Sofware-16-SDL");
1465 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1467 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1468 FALLBACK_TRY("OpenGL SDL");
1470 else if (!strncmp(_elm_config->engine, "shot:", 5))
1472 win->ee = ecore_evas_buffer_new(1, 1);
1473 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1474 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1482 ERR("Cannot create window.");
1486 #ifdef HAVE_ELEMENTARY_X
1487 _elm_win_xwindow_get(win);
1489 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1490 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1491 // bg pixmap done by x - has other issues like can be redrawn by x before it
1492 // is filled/ready by app
1493 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1496 win->parent = parent;
1498 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1499 _elm_win_obj_callback_parent_del, win);
1501 win->evas = ecore_evas_get(win->ee);
1502 win->win_obj = elm_widget_add(win->evas);
1503 elm_widget_type_set(win->win_obj, "win");
1504 ELM_SET_WIDTYPE(widtype, "win");
1505 elm_widget_data_set(win->win_obj, win);
1506 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1507 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1508 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1509 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1510 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1511 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1512 evas_object_move(win->win_obj, 0, 0);
1513 evas_object_resize(win->win_obj, 1, 1);
1514 evas_object_layer_set(win->win_obj, 50);
1515 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1517 ecore_evas_object_associate(win->ee, win->win_obj,
1518 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1519 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1520 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1521 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1522 _elm_win_obj_callback_show, win);
1523 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1524 _elm_win_obj_callback_hide, win);
1525 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1526 _elm_win_obj_callback_del, win);
1527 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1528 _elm_win_obj_callback_move, win);
1529 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1530 _elm_win_obj_callback_resize, win);
1532 evas_object_intercept_move_callback_add(win->win_obj,
1533 _elm_win_obj_intercept_move, win);
1534 evas_object_intercept_show_callback_add(win->win_obj,
1535 _elm_win_obj_intercept_show, win);
1537 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1538 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1539 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1540 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1541 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1542 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1543 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1544 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1545 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1546 evas_font_path_append(win->evas, fontpath);
1547 if (!_elm_config->font_hinting)
1548 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1549 else if (_elm_config->font_hinting == 1)
1550 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1551 else if (_elm_config->font_hinting == 2)
1552 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1554 #ifdef HAVE_ELEMENTARY_X
1555 _elm_win_xwin_update(win);
1558 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1560 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1562 ecore_evas_fullscreen_set(win->ee, 1);
1564 #undef ENGINE_COMPARE
1566 if (_elm_config->focus_highlight_enable)
1567 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1570 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1571 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1572 _debug_key_down, win);
1574 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1576 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1579 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1581 return win->win_obj;
1585 * Add @p subobj as a resize object of window @p obj.
1587 * @param obj The window object
1588 * @param subobj The resize object to add
1593 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1597 ELM_CHECK_WIDTYPE(obj, widtype);
1598 win = elm_widget_data_get(obj);
1600 if (eina_list_data_find(win->subobjs, subobj)) return;
1601 win->subobjs = eina_list_append(win->subobjs, subobj);
1602 elm_widget_sub_object_add(obj, subobj);
1603 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1604 _elm_win_subobj_callback_del, obj);
1605 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1606 _elm_win_subobj_callback_changed_size_hints,
1608 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1609 evas_object_move(subobj, 0, 0);
1610 evas_object_resize(subobj, w, h);
1611 _elm_win_eval_subobjs(obj);
1615 * Delete @p subobj as a resize object of window @p obj.
1617 * @param obj The window object
1618 * @param subobj The resize object to add
1623 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1626 ELM_CHECK_WIDTYPE(obj, widtype);
1627 win = elm_widget_data_get(obj);
1629 evas_object_event_callback_del_full(subobj,
1630 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1631 _elm_win_subobj_callback_changed_size_hints,
1633 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1634 _elm_win_subobj_callback_del, obj);
1635 win->subobjs = eina_list_remove(win->subobjs, subobj);
1636 elm_widget_sub_object_del(obj, subobj);
1637 _elm_win_eval_subobjs(obj);
1641 * Set the title of the window
1643 * @param obj The window object
1644 * @param title The title to set
1649 elm_win_title_set(Evas_Object *obj, const char *title)
1652 ELM_CHECK_WIDTYPE(obj, widtype);
1653 win = elm_widget_data_get(obj);
1655 ecore_evas_title_set(win->ee, title);
1659 * Get the title of the window
1661 * @param obj The window object
1667 elm_win_title_get(const Evas_Object *obj)
1670 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1671 win = elm_widget_data_get(obj);
1672 if (!win) return NULL;
1673 return ecore_evas_title_get(win->ee);
1677 * Set the window's autodel state.
1679 * @param obj The window object
1680 * @param autodel If true, the window will automatically delete itself when closed
1685 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1688 ELM_CHECK_WIDTYPE(obj, widtype);
1689 win = elm_widget_data_get(obj);
1691 win->autodel = autodel;
1695 * Get the window's autodel state.
1697 * @param obj The window object
1698 * @return If the window will automatically delete itself when closed
1703 elm_win_autodel_get(const Evas_Object *obj)
1706 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1707 win = elm_widget_data_get(obj);
1708 if (!win) return EINA_FALSE;
1709 return win->autodel;
1713 * Activate a window object.
1715 * @param obj The window object
1720 elm_win_activate(Evas_Object *obj)
1723 ELM_CHECK_WIDTYPE(obj, widtype);
1724 win = elm_widget_data_get(obj);
1726 ecore_evas_activate(win->ee);
1730 * Lower a window object.
1732 * @param obj The window object
1737 elm_win_lower(Evas_Object *obj)
1740 ELM_CHECK_WIDTYPE(obj, widtype);
1741 win = elm_widget_data_get(obj);
1743 ecore_evas_lower(win->ee);
1747 * Raise a window object.
1749 * @param obj The window object
1754 elm_win_raise(Evas_Object *obj)
1757 ELM_CHECK_WIDTYPE(obj, widtype);
1758 win = elm_widget_data_get(obj);
1760 ecore_evas_raise(win->ee);
1764 * Set the borderless state of a window.
1766 * @param obj The window object
1767 * @param borderless If true, the window is borderless
1772 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1775 ELM_CHECK_WIDTYPE(obj, widtype);
1776 win = elm_widget_data_get(obj);
1778 ecore_evas_borderless_set(win->ee, borderless);
1779 #ifdef HAVE_ELEMENTARY_X
1780 _elm_win_xwin_update(win);
1785 * Get the borderless state of a window.
1787 * @param obj The window object
1788 * @return If true, the window is borderless
1793 elm_win_borderless_get(const Evas_Object *obj)
1796 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1797 win = elm_widget_data_get(obj);
1798 if (!win) return EINA_FALSE;
1799 return ecore_evas_borderless_get(win->ee);
1803 * Set the shaped state of a window.
1805 * @param obj The window object
1806 * @param shaped If true, the window is shaped
1811 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1814 ELM_CHECK_WIDTYPE(obj, widtype);
1815 win = elm_widget_data_get(obj);
1817 ecore_evas_shaped_set(win->ee, shaped);
1818 #ifdef HAVE_ELEMENTARY_X
1819 _elm_win_xwin_update(win);
1824 * Get the shaped state of a window.
1826 * @param obj The window object
1827 * @return If true, the window is shaped
1832 elm_win_shaped_get(const Evas_Object *obj)
1835 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1836 win = elm_widget_data_get(obj);
1837 if (!win) return EINA_FALSE;
1838 return ecore_evas_shaped_get(win->ee);
1842 * Set the alpha channel state of a window.
1844 * @param obj The window object
1845 * @param alpha If true, the window has an alpha channel
1850 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1853 ELM_CHECK_WIDTYPE(obj, widtype);
1854 win = elm_widget_data_get(obj);
1859 else if (win->img_obj)
1861 evas_object_image_alpha_set(win->img_obj, alpha);
1865 #ifdef HAVE_ELEMENTARY_X
1870 if (!_elm_config->compositing)
1871 elm_win_shaped_set(obj, alpha);
1873 ecore_evas_alpha_set(win->ee, alpha);
1876 ecore_evas_alpha_set(win->ee, alpha);
1877 _elm_win_xwin_update(win);
1881 ecore_evas_alpha_set(win->ee, alpha);
1886 * Get the alpha channel state of a window.
1888 * @param obj The window object
1889 * @return If true, the window has an alpha channel
1894 elm_win_alpha_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_alpha_get(win->ee);
1904 * Set the transparency state of a window.
1906 * @param obj The window object
1907 * @param transparent If true, the window is transparent
1912 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1915 ELM_CHECK_WIDTYPE(obj, widtype);
1916 win = elm_widget_data_get(obj);
1922 else if (win->img_obj)
1924 evas_object_image_alpha_set(win->img_obj, transparent);
1928 #ifdef HAVE_ELEMENTARY_X
1931 ecore_evas_transparent_set(win->ee, transparent);
1932 _elm_win_xwin_update(win);
1936 ecore_evas_transparent_set(win->ee, transparent);
1941 * Get the transparency state of a window.
1943 * @param obj The window object
1944 * @return If true, the window is transparent
1949 elm_win_transparent_get(const Evas_Object *obj)
1952 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1953 win = elm_widget_data_get(obj);
1954 if (!win) return EINA_FALSE;
1956 return ecore_evas_transparent_get(win->ee);
1960 * Set the override state of a window.
1962 * @param obj The window object
1963 * @param override If true, the window is overridden
1968 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1971 ELM_CHECK_WIDTYPE(obj, widtype);
1972 win = elm_widget_data_get(obj);
1974 ecore_evas_override_set(win->ee, override);
1975 #ifdef HAVE_ELEMENTARY_X
1976 _elm_win_xwin_update(win);
1981 * Get the override state of a window.
1983 * @param obj The window object
1984 * @return If true, the window is overridden
1989 elm_win_override_get(const Evas_Object *obj)
1992 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1993 win = elm_widget_data_get(obj);
1994 if (!win) return EINA_FALSE;
1995 return ecore_evas_override_get(win->ee);
1999 * Set the fullscreen state of a window.
2001 * @param obj The window object
2002 * @param fullscreen If true, the window is fullscreen
2007 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2010 ELM_CHECK_WIDTYPE(obj, widtype);
2011 win = elm_widget_data_get(obj);
2014 // YYY: handle if win->img_obj
2015 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2016 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2017 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2019 // these engines... can ONLY be fullscreen
2024 ecore_evas_fullscreen_set(win->ee, fullscreen);
2025 #ifdef HAVE_ELEMENTARY_X
2026 _elm_win_xwin_update(win);
2029 #undef ENGINE_COMPARE
2033 * Get the fullscreen state of a window.
2035 * @param obj The window object
2036 * @return If true, the window is fullscreen
2041 elm_win_fullscreen_get(const Evas_Object *obj)
2044 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2045 win = elm_widget_data_get(obj);
2046 if (!win) return EINA_FALSE;
2048 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2049 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2050 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2052 // these engines... can ONLY be fullscreen
2057 return ecore_evas_fullscreen_get(win->ee);
2059 #undef ENGINE_COMPARE
2063 * Set the maximized state of a window.
2065 * @param obj The window object
2066 * @param maximized If true, the window is maximized
2071 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2074 ELM_CHECK_WIDTYPE(obj, widtype);
2075 win = elm_widget_data_get(obj);
2077 // YYY: handle if win->img_obj
2078 ecore_evas_maximized_set(win->ee, maximized);
2079 #ifdef HAVE_ELEMENTARY_X
2080 _elm_win_xwin_update(win);
2085 * Get the maximized state of a window.
2087 * @param obj The window object
2088 * @return If true, the window is maximized
2093 elm_win_maximized_get(const Evas_Object *obj)
2096 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2097 win = elm_widget_data_get(obj);
2098 if (!win) return EINA_FALSE;
2099 return ecore_evas_maximized_get(win->ee);
2103 * Set the iconified state of a window.
2105 * @param obj The window object
2106 * @param iconified If true, the window is iconified
2111 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2114 ELM_CHECK_WIDTYPE(obj, widtype);
2115 win = elm_widget_data_get(obj);
2117 ecore_evas_iconified_set(win->ee, iconified);
2118 #ifdef HAVE_ELEMENTARY_X
2119 _elm_win_xwin_update(win);
2124 * Get the iconified state of a window.
2126 * @param obj The window object
2127 * @return If true, the window is iconified
2132 elm_win_iconified_get(const Evas_Object *obj)
2135 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2136 win = elm_widget_data_get(obj);
2137 if (!win) return EINA_FALSE;
2138 return ecore_evas_iconified_get(win->ee);
2142 * Set the layer of the window.
2144 * @param obj The window object
2145 * @param layer The layer of the window
2150 elm_win_layer_set(Evas_Object *obj, int layer)
2153 ELM_CHECK_WIDTYPE(obj, widtype);
2154 win = elm_widget_data_get(obj);
2156 ecore_evas_layer_set(win->ee, layer);
2157 #ifdef HAVE_ELEMENTARY_X
2158 _elm_win_xwin_update(win);
2163 * Get the layer of the window.
2165 * @param obj The window object
2166 * @return The layer of the window
2171 elm_win_layer_get(const Evas_Object *obj)
2174 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2175 win = elm_widget_data_get(obj);
2176 if (!win) return -1;
2177 return ecore_evas_layer_get(win->ee);
2181 * Set the rotation of the window.
2183 * @param obj The window object
2184 * @param rotation The rotation of the window, in degrees (0-360)
2189 elm_win_rotation_set(Evas_Object *obj, int rotation)
2192 ELM_CHECK_WIDTYPE(obj, widtype);
2193 win = elm_widget_data_get(obj);
2195 if (win->rot == rotation) return;
2196 win->rot = rotation;
2197 ecore_evas_rotation_set(win->ee, rotation);
2198 evas_object_size_hint_min_set(obj, -1, -1);
2199 evas_object_size_hint_max_set(obj, -1, -1);
2200 _elm_win_eval_subobjs(obj);
2201 #ifdef HAVE_ELEMENTARY_X
2202 _elm_win_xwin_update(win);
2207 * Rotates the window and resizes it
2209 * @param obj The window object
2210 * @param layer The rotation of the window in degrees (0-360)
2215 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2218 ELM_CHECK_WIDTYPE(obj, widtype);
2219 win = elm_widget_data_get(obj);
2221 if (win->rot == rotation) return;
2222 win->rot = rotation;
2223 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2224 evas_object_size_hint_min_set(obj, -1, -1);
2225 evas_object_size_hint_max_set(obj, -1, -1);
2226 _elm_win_eval_subobjs(obj);
2227 #ifdef HAVE_ELEMENTARY_X
2228 _elm_win_xwin_update(win);
2233 * Get the rotation of the window.
2235 * @param obj The window object
2236 * @return The rotation of the window in degrees (0-360)
2241 elm_win_rotation_get(const Evas_Object *obj)
2244 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2245 win = elm_widget_data_get(obj);
2246 if (!win) return -1;
2251 * Set the sticky state of the window.
2253 * @param obj The window object
2254 * @param sticky If true, the window's sticky state is enabled
2259 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2262 ELM_CHECK_WIDTYPE(obj, widtype);
2263 win = elm_widget_data_get(obj);
2265 ecore_evas_sticky_set(win->ee, sticky);
2266 #ifdef HAVE_ELEMENTARY_X
2267 _elm_win_xwin_update(win);
2272 * Get the sticky state of the window.
2274 * @param obj The window object
2275 * @return If true, the window's sticky state is enabled
2280 elm_win_sticky_get(const Evas_Object *obj)
2283 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2284 win = elm_widget_data_get(obj);
2285 if (!win) return EINA_FALSE;
2286 return ecore_evas_sticky_get(win->ee);
2290 * Sets the keyboard mode of the window.
2292 * @param obj The window object
2293 * @param mode The mode to set; one of:
2294 * ELM_WIN_KEYBOARD_UNKNOWN
2295 * ELM_WIN_KEYBOARD_OFF
2296 * ELM_WIN_KEYBOARD_ON
2297 * ELM_WIN_KEYBOARD_ALPHA
2298 * ELM_WIN_KEYBOARD_NUMERIC
2299 * ELM_WIN_KEYBOARD_PIN
2300 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2301 * ELM_WIN_KEYBOARD_HEX
2302 * ELM_WIN_KEYBOARD_TERMINAL
2303 * ELM_WIN_KEYBOARD_PASSWORD
2304 * ELM_WIN_KEYBOARD_IP
2305 * ELM_WIN_KEYBOARD_HOST
2306 * ELM_WIN_KEYBOARD_FILE
2307 * ELM_WIN_KEYBOARD_URL
2308 * ELM_WIN_KEYBOARD_KEYPAD
2309 * ELM_WIN_KEYBOARD_J2ME
2314 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2317 ELM_CHECK_WIDTYPE(obj, widtype);
2318 win = elm_widget_data_get(obj);
2320 if (mode == win->kbdmode) return;
2321 #ifdef HAVE_ELEMENTARY_X
2322 _elm_win_xwindow_get(win);
2324 win->kbdmode = mode;
2325 #ifdef HAVE_ELEMENTARY_X
2327 ecore_x_e_virtual_keyboard_state_set
2328 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2333 * Gets the keyboard mode of the window.
2335 * @param obj The window object
2336 * @return The mode; one of:
2337 * ELM_WIN_KEYBOARD_UNKNOWN
2338 * ELM_WIN_KEYBOARD_OFF
2339 * ELM_WIN_KEYBOARD_ON
2340 * ELM_WIN_KEYBOARD_ALPHA
2341 * ELM_WIN_KEYBOARD_NUMERIC
2342 * ELM_WIN_KEYBOARD_PIN
2343 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2344 * ELM_WIN_KEYBOARD_HEX
2345 * ELM_WIN_KEYBOARD_TERMINAL
2346 * ELM_WIN_KEYBOARD_PASSWORD
2347 * ELM_WIN_KEYBOARD_IP
2348 * ELM_WIN_KEYBOARD_HOST
2349 * ELM_WIN_KEYBOARD_FILE
2350 * ELM_WIN_KEYBOARD_URL
2351 * ELM_WIN_KEYBOARD_KEYPAD
2352 * ELM_WIN_KEYBOARD_J2ME
2356 EAPI Elm_Win_Keyboard_Mode
2357 elm_win_keyboard_mode_get(const Evas_Object *obj)
2360 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2361 win = elm_widget_data_get(obj);
2362 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2363 return win->kbdmode;
2367 * Sets whether the window is a keyboard.
2369 * @param obj The window object
2370 * @param is_keyboard If true, the window is a virtual keyboard
2375 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2378 ELM_CHECK_WIDTYPE(obj, widtype);
2379 win = elm_widget_data_get(obj);
2381 #ifdef HAVE_ELEMENTARY_X
2382 _elm_win_xwindow_get(win);
2384 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2389 * Gets whether the window is a keyboard.
2391 * @param obj The window object
2392 * @return If the window is a virtual keyboard
2397 elm_win_keyboard_win_get(const Evas_Object *obj)
2400 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2401 win = elm_widget_data_get(obj);
2402 if (!win) return EINA_FALSE;
2403 #ifdef HAVE_ELEMENTARY_X
2404 _elm_win_xwindow_get(win);
2406 return ecore_x_e_virtual_keyboard_get(win->xwin);
2412 * Get the screen position of a window.
2414 * @param obj The window object
2415 * @param x The int to store the x coordinate to
2416 * @param y The int to store the y coordinate to
2421 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2424 ELM_CHECK_WIDTYPE(obj, widtype);
2425 win = elm_widget_data_get(obj);
2427 if (x) *x = win->screen.x;
2428 if (y) *y = win->screen.y;
2432 * Set if this window is an illume conformant window
2434 * @param obj The window object
2435 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2440 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2443 ELM_CHECK_WIDTYPE(obj, widtype);
2444 win = elm_widget_data_get(obj);
2446 #ifdef HAVE_ELEMENTARY_X
2447 _elm_win_xwindow_get(win);
2449 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2454 * Get if this window is an illume conformant window
2456 * @param obj The window object
2457 * @return A boolean if this window is illume conformant or not
2462 elm_win_conformant_get(const Evas_Object *obj)
2465 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2466 win = elm_widget_data_get(obj);
2467 if (!win) return EINA_FALSE;
2468 #ifdef HAVE_ELEMENTARY_X
2469 _elm_win_xwindow_get(win);
2471 return ecore_x_e_illume_conformant_get(win->xwin);
2477 * Set a window to be an illume quickpanel window
2479 * By default window objects are not quickpanel windows.
2481 * @param obj The window object
2482 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2487 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2490 ELM_CHECK_WIDTYPE(obj, widtype);
2491 win = elm_widget_data_get(obj);
2493 #ifdef HAVE_ELEMENTARY_X
2494 _elm_win_xwindow_get(win);
2497 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2500 Ecore_X_Window_State states[2];
2502 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2503 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2504 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2505 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2512 * Get if this window is a quickpanel or not
2514 * @param obj The window object
2515 * @return A boolean if this window is a quickpanel or not
2520 elm_win_quickpanel_get(const Evas_Object *obj)
2523 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2524 win = elm_widget_data_get(obj);
2525 if (!win) return EINA_FALSE;
2526 #ifdef HAVE_ELEMENTARY_X
2527 _elm_win_xwindow_get(win);
2529 return ecore_x_e_illume_quickpanel_get(win->xwin);
2535 * Set the major priority of a quickpanel window
2537 * @param obj The window object
2538 * @param priority The major priority for this quickpanel
2543 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2546 ELM_CHECK_WIDTYPE(obj, widtype);
2547 win = elm_widget_data_get(obj);
2549 #ifdef HAVE_ELEMENTARY_X
2550 _elm_win_xwindow_get(win);
2552 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2557 * Get the major priority of a quickpanel window
2559 * @param obj The window object
2560 * @return The major priority of this quickpanel
2565 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2568 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2569 win = elm_widget_data_get(obj);
2570 if (!win) return -1;
2571 #ifdef HAVE_ELEMENTARY_X
2572 _elm_win_xwindow_get(win);
2574 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2580 * Set the minor priority of a quickpanel window
2582 * @param obj The window object
2583 * @param priority The minor priority for this quickpanel
2588 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2591 ELM_CHECK_WIDTYPE(obj, widtype);
2592 win = elm_widget_data_get(obj);
2594 #ifdef HAVE_ELEMENTARY_X
2595 _elm_win_xwindow_get(win);
2597 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2602 * Get the minor priority of a quickpanel window
2604 * @param obj The window object
2605 * @return The minor priority of this quickpanel
2610 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2613 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2614 win = elm_widget_data_get(obj);
2615 if (!win) return -1;
2616 #ifdef HAVE_ELEMENTARY_X
2617 _elm_win_xwindow_get(win);
2619 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2625 * Set which zone this quickpanel should appear in
2627 * @param obj The window object
2628 * @param zone The requested zone for this quickpanel
2633 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2636 ELM_CHECK_WIDTYPE(obj, widtype);
2637 win = elm_widget_data_get(obj);
2639 #ifdef HAVE_ELEMENTARY_X
2640 _elm_win_xwindow_get(win);
2642 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2647 * Get which zone this quickpanel should appear in
2649 * @param obj The window object
2650 * @return The requested zone for this quickpanel
2655 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2658 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2659 win = elm_widget_data_get(obj);
2661 #ifdef HAVE_ELEMENTARY_X
2662 _elm_win_xwindow_get(win);
2664 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2670 * Set the window to be skipped by keyboard focus
2672 * This sets the window to be skipped by normal keyboard input. This means
2673 * a window manager will be asked to not focus this window as well as omit
2674 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2676 * Call this and enable it on a window BEFORE you show it for the first time,
2677 * otherwise it may have no effect.
2679 * Use this for windows that have only output information or might only be
2680 * interacted with by the mouse or fingers, and never for typing input.
2681 * Be careful that this may have side-effects like making the window
2682 * non-accessible in some cases unless the window is specially handled. Use
2685 * @param obj The window object
2686 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2691 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2694 ELM_CHECK_WIDTYPE(obj, widtype);
2695 win = elm_widget_data_get(obj);
2697 #ifdef HAVE_ELEMENTARY_X
2698 _elm_win_xwindow_get(win);
2703 Ecore_X_Window_State states[2];
2705 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2706 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2707 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2708 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2715 * Send a command to the windowing environment
2717 * This is intended to work in touchscreen or small screen device environments
2718 * where there is a more simplistic window management policy in place. This
2719 * uses the window object indicated to select which part of the environment
2720 * to control (the part that this window lives in), and provides a command
2721 * and an optional parameter structure (use NULL for this if not needed).
2723 * @param obj The window object that lives in the environment to control
2724 * @param command The command to send
2725 * @param params Optional parameters for the command
2730 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2733 ELM_CHECK_WIDTYPE(obj, widtype);
2734 win = elm_widget_data_get(obj);
2736 #ifdef HAVE_ELEMENTARY_X
2737 _elm_win_xwindow_get(win);
2742 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2743 ecore_x_e_illume_focus_back_send(win->xwin);
2745 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2746 ecore_x_e_illume_focus_forward_send(win->xwin);
2748 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2749 ecore_x_e_illume_focus_home_send(win->xwin);
2751 case ELM_ILLUME_COMMAND_CLOSE:
2752 ecore_x_e_illume_close_send(win->xwin);
2762 * Get the inlined image object handle
2764 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2765 * then the window is in fact an evas image object inlined in the parent
2766 * canvas. You can get this object (be careful to not manipulate it as it
2767 * is under control of elementary), and use it to do things like get pixel
2768 * data, save the image to a file, etc.
2770 * @param obj The window object to get the inlined image from
2771 * @return The inlined image object, or NULL if none exists
2776 elm_win_inlined_image_object_get(Evas_Object *obj)
2779 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2780 win = elm_widget_data_get(obj);
2781 if (!win) return NULL;
2782 return win->img_obj;
2786 * Set the enabled status for the focus highlight in a window
2788 * This function will enable or disable the focus highlight only for the
2789 * given window, regardless of the global setting for it
2791 * @param obj The window where to enable the highlight
2792 * @param enabled The enabled value for the highlight
2797 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2801 ELM_CHECK_WIDTYPE(obj, widtype);
2803 win = elm_widget_data_get(obj);
2804 enabled = !!enabled;
2805 if (win->focus_highlight.enabled == enabled)
2808 win->focus_highlight.enabled = enabled;
2810 if (win->focus_highlight.enabled)
2811 _elm_win_focus_highlight_init(win);
2813 _elm_win_focus_highlight_shutdown(win);
2817 * Get the enabled value of the focus highlight for this window
2819 * @param obj The window in which to check if the focus highlight is enabled
2821 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2826 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2830 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2832 win = elm_widget_data_get(obj);
2833 return win->focus_highlight.enabled;
2837 * Set the style for the focus highlight on this window
2839 * Sets the style to use for theming the highlight of focused objects on
2840 * the given window. If @p style is NULL, the default will be used.
2842 * @param obj The window where to set the style
2843 * @param style The style to set
2848 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2852 ELM_CHECK_WIDTYPE(obj, widtype);
2854 win = elm_widget_data_get(obj);
2855 eina_stringshare_replace(&win->focus_highlight.style, style);
2856 win->focus_highlight.changed_theme = EINA_TRUE;
2857 _elm_win_focus_highlight_reconfigure_job_start(win);
2861 * Get the style set for the focus highlight object
2863 * Gets the style set for this windows highilght object, or NULL if none
2866 * @param obj The window to retrieve the highlights style from
2868 * @return The style set or NULL if none was. Default is used in that case.
2873 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2877 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2879 win = elm_widget_data_get(obj);
2880 return win->focus_highlight.style;
2883 typedef struct _Widget_Data Widget_Data;
2888 Evas_Object *content;
2891 static void _del_hook(Evas_Object *obj);
2892 static void _theme_hook(Evas_Object *obj);
2893 static void _sizing_eval(Evas_Object *obj);
2894 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2895 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2897 static const char *widtype2 = NULL;
2900 _del_hook(Evas_Object *obj)
2902 Widget_Data *wd = elm_widget_data_get(obj);
2908 _theme_hook(Evas_Object *obj)
2910 Widget_Data *wd = elm_widget_data_get(obj);
2911 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2913 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2918 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2920 Widget_Data *wd = elm_widget_data_get(obj);
2925 /* Try Focus cycle in subitem */
2928 elm_widget_focus_next_get(wd->content, dir, next);
2933 *next = (Evas_Object *)obj;
2938 _sizing_eval(Evas_Object *obj)
2940 Widget_Data *wd = elm_widget_data_get(obj);
2941 Evas_Coord minw = -1, minh = -1;
2943 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2944 edje_object_size_min_calc(wd->frm, &minw, &minh);
2945 evas_object_size_hint_min_set(obj, minw, minh);
2946 evas_object_size_hint_max_set(obj, -1, -1);
2950 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2956 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2958 Widget_Data *wd = elm_widget_data_get(obj);
2959 Evas_Object *sub = event_info;
2960 if (sub == wd->content)
2962 evas_object_event_callback_del_full
2963 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2970 * @defgroup Inwin Inwin
2972 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2975 elm_win_inwin_add(Evas_Object *obj)
2981 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2982 win = elm_widget_data_get(obj);
2983 if (!win) return NULL;
2984 wd = ELM_NEW(Widget_Data);
2985 obj2 = elm_widget_add(win->evas);
2986 elm_widget_type_set(obj2, "inwin");
2987 ELM_SET_WIDTYPE(widtype2, "inwin");
2988 elm_widget_sub_object_add(obj, obj2);
2989 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2990 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2991 elm_win_resize_object_add(obj, obj2);
2993 elm_widget_data_set(obj2, wd);
2994 elm_widget_del_hook_set(obj2, _del_hook);
2995 elm_widget_theme_hook_set(obj2, _theme_hook);
2996 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2997 elm_widget_can_focus_set(obj2, EINA_TRUE);
2998 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3000 wd->frm = edje_object_add(win->evas);
3001 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3002 elm_widget_resize_object_set(obj2, wd->frm);
3004 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3011 * Activates an inwin object
3013 * @param obj The inwin to activate
3018 elm_win_inwin_activate(Evas_Object *obj)
3020 ELM_CHECK_WIDTYPE(obj, widtype2);
3021 Widget_Data *wd = elm_widget_data_get(obj);
3023 evas_object_raise(obj);
3024 evas_object_show(obj);
3025 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3026 elm_object_focus(obj);
3030 * Set the content of an inwin object.
3032 * Once the content object is set, a previously set one will be deleted.
3033 * If you want to keep that old content object, use the
3034 * elm_win_inwin_content_unset() function.
3036 * @param obj The inwin object
3037 * @param content The object to set as content
3042 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3044 ELM_CHECK_WIDTYPE(obj, widtype2);
3045 Widget_Data *wd = elm_widget_data_get(obj);
3047 if (wd->content == content) return;
3048 if (wd->content) evas_object_del(wd->content);
3049 wd->content = content;
3052 elm_widget_sub_object_add(obj, content);
3053 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3054 _changed_size_hints, obj);
3055 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3061 * Get the content of an inwin object.
3063 * Return the content object which is set for this widget.
3065 * @param obj The inwin object
3066 * @return The content that is being used
3071 elm_win_inwin_content_get(const Evas_Object *obj)
3073 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3074 Widget_Data *wd = elm_widget_data_get(obj);
3075 if (!wd) return NULL;
3080 * Unset the content of an inwin object.
3082 * Unparent and return the content object which was set for this widget.
3084 * @param obj The inwin object
3085 * @return The content that was being used
3090 elm_win_inwin_content_unset(Evas_Object *obj)
3092 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3093 Widget_Data *wd = elm_widget_data_get(obj);
3094 if (!wd) return NULL;
3095 if (!wd->content) return NULL;
3096 Evas_Object *content = wd->content;
3097 elm_widget_sub_object_del(obj, wd->content);
3098 edje_object_part_unswallow(wd->frm, wd->content);
3103 /* windowing spcific calls - shall we do this differently? */
3105 static Ecore_X_Window
3106 _elm_ee_win_get(const Evas_Object *obj)
3109 #ifdef HAVE_ELEMENTARY_X
3110 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3111 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3117 * Get the Ecore_X_Window of an Evas_Object
3119 * @param obj The object
3121 * @return The Ecore_X_Window of @p obj
3126 elm_win_xwindow_get(const Evas_Object *obj)
3128 Ecore_X_Window xwin = 0;
3133 type = elm_widget_type_get(obj);
3134 if (!type) return 0;
3135 if (type != widtype) return _elm_ee_win_get(obj);
3136 #ifdef HAVE_ELEMENTARY_X
3137 win = elm_widget_data_get(obj);
3138 if (!win) return xwin;
3139 if (win->xwin) return win->xwin;
3140 if (win->parent) return elm_win_xwindow_get(win->parent);