1 #include <Elementary.h>
8 * The window class of Elementary. Contains functions to manipulate
9 * windows. The Evas engine used to render the window contents is specified
10 * in the system or user elementary config files (whichever is found last),
11 * and can be overridden with the ELM_ENGINE environment variable for testing.
12 * Engines that may be supported (depending on Evas and Ecore-Evas compilation
13 * setup and modules actually installed at runtime) are (listed in order of
14 * best supported and most likely to be complete and work to lowest quality).
16 * "x11", "x", "software-x11", "software_x11"
17 * (Software rendering in X11)
18 * "gl", "opengl", "opengl-x11", "opengl_x11"
19 * (OpenGL or OpenGL-ES2 rendering in X11)
21 * (Virtual screenshot renderer - renders to output file and exits)
22 * "fb", "software-fb", "software_fb"
23 * (Linux framebuffer direct software rendering)
24 * "sdl", "software-sdl", "software_sdl"
25 * (SDL software rendering to SDL buffer)
26 * "gl-sdl", "gl_sdl", "opengl-sdl", "opengl_sdl"
27 * (OpenGL or OpenGL-ES2 rendering using SDL as the buffer)
28 * "gdi", "software-gdi", "software_gdi"
29 * (Windows WIN32 rendering via GDI with software)
31 * (Rendering to a DirectFB window)
32 * "x11-8", "x8", "software-8-x11", "software_8_x11"
33 * (Rendering in grayscale using dedicated 8bit software engine in X11)
34 * "x11-16", "x16", "software-16-x11", "software_16_x11"
35 * (Rendering in X11 using 16bit software engine)
36 * "wince-gdi", "software-16-wince-gdi", "software_16_wince_gdi"
37 * (Windows CE rendering via GDI with 16bit software renderer)
38 * "sdl-16", "software-16-sdl", "software_16_sdl"
39 * (Rendering to SDL buffer with 16bit software renderer)
41 * All engines use a simple string to select the engine to render, EXCEPT
42 * the "shot" engine. This actually encodes the output of the virtual
43 * screenshot and how long to delay in the engine string. The engine string
44 * is encoded in the following way:
46 * "shot:[delay=XX][:][file=XX]"
48 * Where options are separated by a ":" char if more than one option is given,
49 * with delay, if provided being the first option and file the last (order
50 * is important). The delay specifies how long to wait after the window is
51 * shown before doing the virtual "in memory" rendering and then save the
52 * output to the file specified by the file option (and then exit). If no
53 * delay is given, the default is 0.5 seconds. If no file is given the
54 * default output file is "out.png". Some examples of using the shot engine:
56 * ELM_ENGINE="shot:delay=1.0:file=elm_test.png" elementary_test
57 * ELM_ENGINE="shot:file=elm_test2.png" elementary_test
58 * ELM_ENGINE="shot:delay=2.0" elementary_test
59 * ELM_ENGINE="shot:" elementary_test
61 * Signals that you can add callbacks for are:
63 * "delete,request" - the user requested to delete the window
64 * "focus,in" - window got focus
65 * "focus,out" - window lost focus
66 * "moved" - window that holds the canvas was moved
69 typedef struct _Elm_Win Elm_Win;
75 Evas_Object *parent, *win_obj;
77 #ifdef HAVE_ELEMENTARY_X
79 Ecore_Event_Handler *client_message_handler;
81 Ecore_Job *deferred_resize_job;
82 Ecore_Job *deferred_child_eval_job;
85 Elm_Win_Keyboard_Mode kbdmode;
90 Eina_Bool autodel : 1;
91 int *autodel_clear, rot;
101 Eina_Bool visible : 1;
102 Eina_Bool handled : 1;
106 Ecore_Job *reconf_job;
108 Eina_Bool enabled : 1;
109 Eina_Bool changed_theme : 1;
110 Eina_Bool top_animate : 1;
111 Eina_Bool geometry_changed : 1;
115 static const char *widtype = NULL;
116 static void _elm_win_obj_callback_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_show(void *data, Evas_Object *obj);
119 static void _elm_win_move(Ecore_Evas *ee);
120 static void _elm_win_resize(Ecore_Evas *ee);
121 static void _elm_win_delete_request(Ecore_Evas *ee);
122 static void _elm_win_resize_job(void *data);
123 #ifdef HAVE_ELEMENTARY_X
124 static void _elm_win_xwin_update(Elm_Win *win);
126 static void _elm_win_eval_subobjs(Evas_Object *obj);
127 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
128 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
129 static void _elm_win_focus_highlight_init(Elm_Win *win);
130 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
131 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
132 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
133 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
134 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
135 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
137 static const char SIG_DELETE_REQUEST[] = "delete,request";
138 static const char SIG_FOCUS_OUT[] = "focus,in";
139 static const char SIG_FOCUS_IN[] = "focus,out";
140 static const char SIG_MOVED[] = "moved";
142 static const Evas_Smart_Cb_Description _signals[] = {
143 {SIG_DELETE_REQUEST, ""},
152 Eina_List *_elm_win_list = NULL;
153 int _elm_win_deferred_free = 0;
155 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
156 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
159 _shot_delay_get(Elm_Win *win)
162 char *d = strdup(win->shot.info);
165 for (p = (char *)win->shot.info; *p; p++)
167 if (!strncmp(p, "delay=", 6))
171 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
186 _shot_file_get(Elm_Win *win)
189 char *tmp = strdup(win->shot.info);
191 if (!tmp) return NULL;
192 for (p = (char *)win->shot.info; *p; p++)
194 if (!strncmp(p, "file=", 5))
201 return strdup("out.png");
205 _shot_key_get(Elm_Win *win __UNUSED__)
211 _shot_flags_get(Elm_Win *win __UNUSED__)
217 _shot_do(Elm_Win *win)
221 unsigned int *pixels;
223 char *file, *key, *flags;
225 ecore_evas_manual_render(win->ee);
226 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
228 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
229 if ((w < 1) || (h < 1)) return;
230 file = _shot_file_get(win);
232 key = _shot_key_get(win);
233 flags = _shot_flags_get(win);
234 ee = ecore_evas_buffer_new(1, 1);
235 o = evas_object_image_add(ecore_evas_get(ee));
236 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
237 evas_object_image_size_set(o, w, h);
238 evas_object_image_data_set(o, pixels);
239 if (!evas_object_image_save(o, file, key, flags))
241 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
246 if (flags) free(flags);
251 _shot_delay(void *data)
255 win->shot.timer = NULL;
261 _shot_handle(Elm_Win *win)
263 if (!win->shot.info) return;
264 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
268 _elm_win_move(Ecore_Evas *ee)
270 Evas_Object *obj = ecore_evas_object_associate_get(ee);
275 win = elm_widget_data_get(obj);
277 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
280 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
284 _elm_win_resize(Ecore_Evas *ee)
286 Evas_Object *obj = ecore_evas_object_associate_get(ee);
290 win = elm_widget_data_get(obj);
292 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
293 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
297 _elm_win_focus_in(Ecore_Evas *ee)
299 Evas_Object *obj = ecore_evas_object_associate_get(ee);
303 win = elm_widget_data_get(obj);
305 /*NB: Why two different "focus signals" here ??? */
306 evas_object_smart_callback_call(win->win_obj, "focus-in", NULL); // FIXME: remove me
307 evas_object_smart_callback_call(win->win_obj, "focus,in", NULL);
308 win->focus_highlight.cur.visible = EINA_TRUE;
309 _elm_win_focus_highlight_reconfigure_job_start(win);
313 _elm_win_focus_out(Ecore_Evas *ee)
315 Evas_Object *obj = ecore_evas_object_associate_get(ee);
319 win = elm_widget_data_get(obj);
321 evas_object_smart_callback_call(win->win_obj, "focus-out", NULL); // FIXME: remove me
322 evas_object_smart_callback_call(win->win_obj, "focus,out", NULL);
323 win->focus_highlight.cur.visible = EINA_FALSE;
324 _elm_win_focus_highlight_reconfigure_job_start(win);
328 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
330 Elm_Win *wd = elm_widget_data_get(obj);
331 const Eina_List *items;
332 void *(*list_data_get) (const Eina_List *list);
340 if (!(items = elm_widget_focus_custom_chain_get(obj)))
346 list_data_get = eina_list_data_get;
348 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
354 *next = (Evas_Object *)obj;
359 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
361 if (elm_widget_focus_get(obj))
362 evas_object_focus_set(obj, EINA_TRUE);
364 evas_object_focus_set(obj, EINA_FALSE);
368 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
370 if (type == EVAS_CALLBACK_KEY_DOWN)
372 Evas_Event_Key_Down *ev = event_info;
373 if (!strcmp(ev->keyname, "Tab"))
375 if(evas_key_modifier_is_set(ev->modifiers, "Shift"))
376 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
378 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
379 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
388 _deferred_ecore_evas_free(void *data)
390 ecore_evas_free(data);
391 _elm_win_deferred_free--;
395 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
399 elm_object_focus(obj);
400 if (win->shot.info) _shot_handle(win);
404 _elm_win_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
411 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
412 _elm_win_obj_callback_parent_del, win);
415 if (win->autodel_clear) *(win->autodel_clear) = -1;
416 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
417 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
418 ecore_evas_callback_delete_request_set(win->ee, NULL);
419 ecore_evas_callback_resize_set(win->ee, NULL);
420 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
421 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
422 if (win->shot.info) eina_stringshare_del(win->shot.info);
423 if (win->shot.timer) ecore_timer_del(win->shot.timer);
424 while (((child = evas_object_bottom_get(win->evas))) &&
427 evas_object_del(child);
429 while (((child = evas_object_top_get(win->evas))) &&
432 evas_object_del(child);
434 #ifdef HAVE_ELEMENTARY_X
435 if (win->client_message_handler)
436 ecore_event_handler_del(win->client_message_handler);
438 // FIXME: Why are we flushing edje on every window destroy ??
439 // edje_file_cache_flush();
440 // edje_collection_cache_flush();
441 // evas_image_cache_flush(win->evas);
442 // evas_font_cache_flush(win->evas);
443 // FIXME: we are in the del handler for the object and delete the canvas
444 // that lives under it from the handler... nasty. deferring doesn't help either
446 ecore_job_add(_deferred_ecore_evas_free, win->ee);
447 _elm_win_deferred_free++;
448 // ecore_evas_free(win->ee);
450 _elm_win_focus_highlight_shutdown(win);
451 eina_stringshare_del(win->focus_highlight.style);
455 if ((!_elm_win_list) &&
456 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
458 edje_file_cache_flush();
459 edje_collection_cache_flush();
460 evas_image_cache_flush(e);
461 evas_font_cache_flush(e);
467 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
470 if (obj == win->parent) win->parent = NULL;
474 _elm_win_obj_intercept_show(void *data __UNUSED__, Evas_Object *obj)
476 // this is called to make sure all smart containers have calculated their
477 // sizes BEFORE we show the window to make sure it initially appears at
478 // our desired size (ie min size is known first)
479 evas_smart_objects_calculate(evas_object_evas_get(obj));
480 evas_object_show(obj);
484 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
488 if (ecore_evas_override_get(win->ee))
492 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
495 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
500 _elm_win_delete_request(Ecore_Evas *ee)
502 Evas_Object *obj = ecore_evas_object_associate_get(ee);
504 if (strcmp(elm_widget_type_get(obj), "win")) return;
506 win = elm_widget_data_get(obj);
508 int autodel = win->autodel;
509 win->autodel_clear = &autodel;
510 evas_object_smart_callback_call(win->win_obj, "delete-request", NULL); // FIXME: remove me
511 evas_object_smart_callback_call(win->win_obj, "delete,request", NULL);
512 // FIXME: if above callback deletes - then the below will be invalid
513 if (autodel) evas_object_del(win->win_obj);
514 else win->autodel_clear = NULL;
518 _elm_win_resize_job(void *data)
525 win->deferred_resize_job = NULL;
526 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
527 evas_object_resize(win->win_obj, w, h);
528 EINA_LIST_FOREACH(win->subobjs, l, obj)
530 evas_object_move(obj, 0, 0);
531 evas_object_resize(obj, w, h);
535 #ifdef HAVE_ELEMENTARY_X
537 _elm_win_xwindow_get(Elm_Win *win)
541 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
542 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
544 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
546 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
547 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
548 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
549 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
550 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
551 ENGINE_COMPARE(ELM_OPENGL_SDL))
554 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
556 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
558 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
560 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
562 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
564 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
566 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
568 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
570 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
572 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
574 #undef ENGINE_COMPARE
578 #ifdef HAVE_ELEMENTARY_X
580 _elm_win_xwin_update(Elm_Win *win)
582 _elm_win_xwindow_get(win);
587 win2 = elm_widget_data_get(win->parent);
591 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
595 if (!win->xwin) return; /* nothing more to do */
600 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
602 case ELM_WIN_DIALOG_BASIC:
603 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
605 case ELM_WIN_DESKTOP:
606 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
609 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
611 case ELM_WIN_TOOLBAR:
612 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
615 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
617 case ELM_WIN_UTILITY:
618 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
621 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
623 case ELM_WIN_DROPDOWN_MENU:
624 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
626 case ELM_WIN_POPUP_MENU:
627 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
629 case ELM_WIN_TOOLTIP:
630 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
632 case ELM_WIN_NOTIFICATION:
633 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
636 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
639 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
644 ecore_x_e_virtual_keyboard_state_set
645 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
650 _elm_win_eval_subobjs(Evas_Object *obj)
653 const Evas_Object *child;
655 Elm_Win *win = elm_widget_data_get(obj);
656 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
660 EINA_LIST_FOREACH(win->subobjs, l, child)
662 evas_object_size_hint_weight_get(child, &wx, &wy);
663 if (wx == 0.0) xx = 0;
664 if (wy == 0.0) xy = 0;
666 evas_object_size_hint_min_get(child, &w, &h);
669 if (w > minw) minw = w;
670 if (h > minh) minh = h;
672 evas_object_size_hint_max_get(child, &w, &h);
675 if (maxw == -1) maxw = w;
676 else if ((w > 0) && (w < maxw)) maxw = w;
677 if (maxh == -1) maxh = h;
678 else if ((h > 0) && (h < maxh)) maxh = h;
680 if (!xx) maxw = minw;
682 if (!xy) maxh = minh;
684 evas_object_size_hint_min_set(obj, minw, minh);
685 evas_object_size_hint_max_set(obj, maxw, maxh);
686 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
687 if (w < minw) w = minw;
688 if (h < minh) h = minh;
689 if ((maxw >= 0) && (w > maxw)) w = maxw;
690 if ((maxh >= 0) && (h > maxh)) h = maxh;
691 evas_object_resize(obj, w, h);
695 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
697 Elm_Win *win = elm_widget_data_get(data);
698 win->subobjs = eina_list_remove(win->subobjs, obj);
699 _elm_win_eval_subobjs(win->win_obj);
703 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
705 _elm_win_eval_subobjs(data);
709 _elm_win_shutdown(void)
711 while (_elm_win_list)
712 evas_object_del(_elm_win_list->data);
716 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
723 EINA_LIST_FOREACH(_elm_win_list, l, obj)
724 elm_widget_theme(obj);
728 EINA_LIST_FOREACH(_elm_win_list, l, obj)
729 elm_widget_theme_specific(obj, th, EINA_FALSE);
733 #ifdef HAVE_ELEMENTARY_X
735 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
738 Ecore_X_Event_Client_Message *e = event;
740 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
741 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
743 if ((unsigned)e->data.l[0] == win->xwin)
745 Evas *evas = evas_object_evas_get(win->win_obj);
748 edje_file_cache_flush();
749 edje_collection_cache_flush();
750 evas_image_cache_flush(evas);
751 evas_font_cache_flush(evas);
755 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
757 if ((unsigned)e->data.l[0] == win->xwin)
759 Evas *evas = evas_object_evas_get(win->win_obj);
762 edje_file_cache_flush();
763 edje_collection_cache_flush();
764 evas_image_cache_flush(evas);
765 evas_font_cache_flush(evas);
766 evas_render_dump(evas);
770 return ECORE_CALLBACK_PASS_ON;
775 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
779 win->focus_highlight.geometry_changed = EINA_TRUE;
780 _elm_win_focus_highlight_reconfigure_job_start(win);
784 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
788 win->focus_highlight.geometry_changed = EINA_TRUE;
789 _elm_win_focus_highlight_reconfigure_job_start(win);
793 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
797 win->focus_highlight.cur.target = NULL;
799 _elm_win_focus_highlight_reconfigure_job_start(win);
803 _elm_win_focus_target_callbacks_add(Elm_Win *win)
805 Evas_Object *obj = win->focus_highlight.cur.target;
807 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
808 _elm_win_focus_target_move, win);
809 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
810 _elm_win_focus_target_resize, win);
811 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
812 _elm_win_focus_target_del, win);
816 _elm_win_focus_target_callbacks_del(Elm_Win *win)
818 Evas_Object *obj = win->focus_highlight.cur.target;
820 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
821 _elm_win_focus_target_move, win);
822 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
823 _elm_win_focus_target_resize, win);
824 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
825 _elm_win_focus_target_del, win);
829 _elm_win_focus_target_get(Evas_Object *obj)
831 Evas_Object *o = obj;
835 if (elm_widget_is(o))
837 if (!elm_widget_highlight_ignore_get(o))
839 o = elm_widget_parent_get(o);
841 o = evas_object_smart_parent_get(o);
845 o = elm_widget_parent_widget_get(o);
847 o = evas_object_smart_parent_get(o);
856 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
858 Evas_Object *obj = event_info, *target;
861 if (win->focus_highlight.cur.target == obj)
864 target = _elm_win_focus_target_get(obj);
865 win->focus_highlight.cur.target = target;
866 if (elm_widget_highlight_in_theme_get(target))
867 win->focus_highlight.cur.handled = EINA_TRUE;
869 _elm_win_focus_target_callbacks_add(win);
871 _elm_win_focus_highlight_reconfigure_job_start(win);
875 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
879 if (!win->focus_highlight.cur.target)
882 if (!win->focus_highlight.cur.handled)
883 _elm_win_focus_target_callbacks_del(win);
884 win->focus_highlight.cur.target = NULL;
885 win->focus_highlight.cur.handled = EINA_FALSE;
887 _elm_win_focus_highlight_reconfigure_job_start(win);
891 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
893 evas_object_hide(obj);
897 _elm_win_focus_highlight_init(Elm_Win *win)
899 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
900 _elm_win_object_focus_in, win);
901 evas_event_callback_add(win->evas,
902 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
903 _elm_win_object_focus_out, win);
905 win->focus_highlight.cur.target = evas_focus_get(win->evas);
907 win->focus_highlight.top = edje_object_add(win->evas);
908 win->focus_highlight.changed_theme = EINA_TRUE;
909 edje_object_signal_callback_add(win->focus_highlight.top,
910 "elm,action,focus,hide,end", "",
911 _elm_win_focus_highlight_hide, NULL);
912 edje_object_signal_callback_add(win->focus_highlight.top,
913 "elm,action,focus,anim,end", "",
914 _elm_win_focus_highlight_anim_end, win);
915 _elm_win_focus_highlight_reconfigure_job_start(win);
919 _elm_win_focus_highlight_shutdown(Elm_Win *win)
921 _elm_win_focus_highlight_reconfigure_job_stop(win);
922 if (win->focus_highlight.cur.target)
924 _elm_win_focus_target_callbacks_del(win);
925 win->focus_highlight.cur.target = NULL;
927 if (win->focus_highlight.top)
929 evas_object_del(win->focus_highlight.top);
930 win->focus_highlight.top = NULL;
933 evas_event_callback_del_full(win->evas,
934 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
935 _elm_win_object_focus_in, win);
936 evas_event_callback_del_full(win->evas,
937 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
938 _elm_win_object_focus_out, win);
942 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
946 top = win->focus_highlight.top;
951 evas_object_show(top);
952 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
958 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
963 _elm_win_focus_highlight_reconfigure_job(void *data)
965 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
969 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
971 if (win->focus_highlight.reconf_job)
972 ecore_job_del(win->focus_highlight.reconf_job);
973 win->focus_highlight.reconf_job = ecore_job_add(
974 _elm_win_focus_highlight_reconfigure_job, win);
978 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
980 if (win->focus_highlight.reconf_job)
981 ecore_job_del(win->focus_highlight.reconf_job);
982 win->focus_highlight.reconf_job = NULL;
986 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
988 Evas_Object *clip, *target = win->focus_highlight.cur.target;
989 Evas_Coord x, y, w, h;
991 clip = evas_object_clip_get(target);
992 evas_object_geometry_get(target, &x, &y, &w, &h);
994 evas_object_move(obj, x, y);
995 evas_object_resize(obj, w, h);
996 evas_object_clip_set(obj, clip);
1000 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1002 Evas_Coord tx, ty, tw, th;
1003 Evas_Coord w, h, px, py, pw, ph;
1004 Edje_Message_Int_Set *m;
1005 Evas_Object *previous = win->focus_highlight.prev.target;
1006 Evas_Object *target = win->focus_highlight.cur.target;
1008 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1009 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1010 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1011 evas_object_move(obj, 0, 0);
1012 evas_object_resize(obj, tw, th);
1013 evas_object_clip_unset(obj);
1015 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1025 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1029 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1031 Elm_Win *win = data;
1032 _elm_win_focus_highlight_simple_setup(win, obj);
1036 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1038 Evas_Object *target = win->focus_highlight.cur.target;
1039 Evas_Object *previous = win->focus_highlight.prev.target;
1040 Evas_Object *top = win->focus_highlight.top;
1041 Eina_Bool visible_changed;
1042 Eina_Bool common_visible;
1043 const char *sig = NULL;
1045 _elm_win_focus_highlight_reconfigure_job_stop(win);
1047 visible_changed = (win->focus_highlight.cur.visible !=
1048 win->focus_highlight.prev.visible);
1050 if ((target == previous) && (!visible_changed) &&
1051 (!win->focus_highlight.geometry_changed))
1054 if ((previous) && (win->focus_highlight.prev.handled))
1055 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1058 common_visible = EINA_FALSE;
1059 else if (win->focus_highlight.cur.handled)
1061 common_visible = EINA_FALSE;
1062 if (win->focus_highlight.cur.visible)
1063 sig = "elm,action,focus_highlight,show";
1065 sig = "elm,action,focus_highlight,hide";
1068 common_visible = win->focus_highlight.cur.visible;
1070 _elm_win_focus_highlight_visible_set(win, common_visible);
1072 elm_widget_signal_emit(target, sig, "elm");
1074 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1077 if (win->focus_highlight.changed_theme)
1080 if (win->focus_highlight.style)
1081 str = win->focus_highlight.style;
1084 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1086 win->focus_highlight.changed_theme = EINA_FALSE;
1088 if (_elm_config->focus_highlight_animate)
1090 str = edje_object_data_get(win->focus_highlight.top, "animate");
1091 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1095 if ((win->focus_highlight.top_animate) && (previous) &&
1096 (!win->focus_highlight.prev.handled))
1097 _elm_win_focus_highlight_anim_setup(win, top);
1099 _elm_win_focus_highlight_simple_setup(win, top);
1100 evas_object_raise(top);
1103 win->focus_highlight.geometry_changed = EINA_FALSE;
1104 win->focus_highlight.prev = win->focus_highlight.cur;
1109 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1111 Evas_Event_Key_Down *ev = event_info;
1113 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1117 if ((strcmp(ev->keyname, "F12")) ||
1118 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1121 printf("Tree graph generated.\n");
1122 elm_object_tree_dot_dump(obj, "./dump.dot");
1127 * Adds a window object. If this is the first window created, pass NULL as
1130 * @param parent Parent object to add the window to, or NULL
1131 * @param name The name of the window
1132 * @param type The window type, one of the following:
1134 * ELM_WIN_DIALOG_BASIC
1142 * @return The created object, or NULL on failure
1147 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1151 const char *fontpath;
1153 win = ELM_NEW(Elm_Win);
1155 #define FALLBACK_TRY(engine) \
1158 CRITICAL(engine " engine creation failed. Trying software X11."); \
1159 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1162 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1163 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1165 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1166 #ifdef HAVE_ELEMENTARY_X
1167 win->client_message_handler = ecore_event_handler_add
1168 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1171 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1173 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1174 FALLBACK_TRY("Sofware FB");
1176 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1178 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1179 FALLBACK_TRY("Sofware DirectFB");
1181 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1183 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1184 FALLBACK_TRY("Sofware-16");
1185 #ifdef HAVE_ELEMENTARY_X
1186 win->client_message_handler = ecore_event_handler_add
1187 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1190 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1192 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1193 FALLBACK_TRY("Sofware-8");
1194 #ifdef HAVE_ELEMENTARY_X
1195 win->client_message_handler = ecore_event_handler_add
1196 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1199 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1201 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1202 FALLBACK_TRY("XRender");
1203 #ifdef HAVE_ELEMENTARY_X
1204 win->client_message_handler = ecore_event_handler_add
1205 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1208 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1213 if (_elm_config->vsync)
1215 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1221 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1223 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1224 FALLBACK_TRY("OpenGL");
1225 #ifdef HAVE_ELEMENTARY_X
1226 win->client_message_handler = ecore_event_handler_add
1227 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1230 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1232 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1233 FALLBACK_TRY("Sofware Win32");
1235 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1237 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1238 FALLBACK_TRY("Sofware-16-WinCE");
1240 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1242 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1243 FALLBACK_TRY("Sofware SDL");
1245 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1247 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1248 FALLBACK_TRY("Sofware-16-SDL");
1250 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1252 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1253 FALLBACK_TRY("OpenGL SDL");
1255 else if (!strncmp(_elm_config->engine, "shot:", 5))
1257 win->ee = ecore_evas_buffer_new(1, 1);
1258 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1259 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1265 ERR("Cannot create window.");
1269 #ifdef HAVE_ELEMENTARY_X
1270 _elm_win_xwindow_get(win);
1272 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1273 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1274 // bg pixmap done by x - has other issues like can be redrawn by x before it
1275 // is filled/ready by app
1276 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1279 win->parent = parent;
1281 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1282 _elm_win_obj_callback_parent_del, win);
1284 win->evas = ecore_evas_get(win->ee);
1285 win->win_obj = elm_widget_add(win->evas);
1286 elm_widget_type_set(win->win_obj, "win");
1287 ELM_SET_WIDTYPE(widtype, "win");
1288 elm_widget_data_set(win->win_obj, win);
1289 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1290 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1291 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1292 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1293 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1294 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1295 evas_object_move(win->win_obj, 0, 0);
1296 evas_object_resize(win->win_obj, 1, 1);
1297 evas_object_layer_set(win->win_obj, 50);
1298 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1300 evas_object_intercept_show_callback_add(win->win_obj,
1301 _elm_win_obj_intercept_show, win);
1302 ecore_evas_object_associate(win->ee, win->win_obj,
1303 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1304 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1305 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1306 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1307 _elm_win_obj_callback_show, win);
1308 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1309 _elm_win_obj_callback_del, win);
1310 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1311 _elm_win_obj_callback_move, win);
1313 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1314 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1315 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1316 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1317 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1318 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1319 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1320 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1321 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1322 evas_font_path_append(win->evas, fontpath);
1323 if (!_elm_config->font_hinting)
1324 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1325 else if (_elm_config->font_hinting == 1)
1326 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1327 else if (_elm_config->font_hinting == 2)
1328 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1330 #ifdef HAVE_ELEMENTARY_X
1331 _elm_win_xwin_update(win);
1334 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1336 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1338 ecore_evas_fullscreen_set(win->ee, 1);
1340 #undef ENGINE_COMPARE
1342 if (_elm_config->focus_highlight_enable)
1343 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1346 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1347 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1348 _debug_key_down, win);
1349 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0, EINA_TRUE);
1350 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1352 return win->win_obj;
1356 * Add @p subobj as a resize object of window @p obj. Note, do not move and
1357 * resize window and sub object at the same time. It will cause problem.
1359 * @param obj The window object
1360 * @param subobj The resize object to add
1365 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1369 ELM_CHECK_WIDTYPE(obj, widtype);
1370 win = elm_widget_data_get(obj);
1372 win->subobjs = eina_list_append(win->subobjs, subobj);
1373 elm_widget_sub_object_add(obj, subobj);
1374 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1375 _elm_win_subobj_callback_del, obj);
1376 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1377 _elm_win_subobj_callback_changed_size_hints,
1379 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1380 evas_object_move(subobj, 0, 0);
1381 evas_object_resize(subobj, w, h);
1382 _elm_win_eval_subobjs(obj);
1386 * Delete @p subobj as a resize object of window @p obj.
1388 * @param obj The window object
1389 * @param subobj The resize object to add
1394 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1397 ELM_CHECK_WIDTYPE(obj, widtype);
1398 win = elm_widget_data_get(obj);
1400 evas_object_event_callback_del_full(subobj,
1401 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1402 _elm_win_subobj_callback_changed_size_hints,
1404 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1405 _elm_win_subobj_callback_del, obj);
1406 win->subobjs = eina_list_remove(win->subobjs, subobj);
1407 elm_widget_sub_object_del(obj, subobj);
1408 _elm_win_eval_subobjs(obj);
1412 * Set the title of the window
1414 * @param obj The window object
1415 * @param title The title to set
1420 elm_win_title_set(Evas_Object *obj, const char *title)
1423 ELM_CHECK_WIDTYPE(obj, widtype);
1424 win = elm_widget_data_get(obj);
1426 ecore_evas_title_set(win->ee, title);
1430 * Get the title of the window
1432 * @param obj The window object
1438 elm_win_title_get(const Evas_Object *obj)
1441 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1442 win = elm_widget_data_get(obj);
1443 if (!win) return NULL;
1444 return ecore_evas_title_get(win->ee);
1448 * Set the window's autodel state.
1450 * @param obj The window object
1451 * @param autodel If true, the window will automatically delete itself when closed
1456 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1459 ELM_CHECK_WIDTYPE(obj, widtype);
1460 win = elm_widget_data_get(obj);
1462 win->autodel = autodel;
1466 * Get the window's autodel state.
1468 * @param obj The window object
1469 * @return If the window will automatically delete itself when closed
1474 elm_win_autodel_get(const Evas_Object *obj)
1477 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1478 win = elm_widget_data_get(obj);
1479 if (!win) return EINA_FALSE;
1480 return win->autodel;
1484 * Activate a window object.
1486 * @param obj The window object
1491 elm_win_activate(Evas_Object *obj)
1494 ELM_CHECK_WIDTYPE(obj, widtype);
1495 win = elm_widget_data_get(obj);
1497 ecore_evas_activate(win->ee);
1501 * Lower a window object.
1503 * @param obj The window object
1508 elm_win_lower(Evas_Object *obj)
1511 ELM_CHECK_WIDTYPE(obj, widtype);
1512 win = elm_widget_data_get(obj);
1514 ecore_evas_lower(win->ee);
1518 * Raise a window object.
1520 * @param obj The window object
1525 elm_win_raise(Evas_Object *obj)
1528 ELM_CHECK_WIDTYPE(obj, widtype);
1529 win = elm_widget_data_get(obj);
1531 ecore_evas_raise(win->ee);
1535 * Set the borderless state of a window.
1537 * @param obj The window object
1538 * @param borderless If true, the window is borderless
1543 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1546 ELM_CHECK_WIDTYPE(obj, widtype);
1547 win = elm_widget_data_get(obj);
1549 ecore_evas_borderless_set(win->ee, borderless);
1550 #ifdef HAVE_ELEMENTARY_X
1551 _elm_win_xwin_update(win);
1556 * Get the borderless state of a window.
1558 * @param obj The window object
1559 * @return If true, the window is borderless
1564 elm_win_borderless_get(const Evas_Object *obj)
1567 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1568 win = elm_widget_data_get(obj);
1569 if (!win) return EINA_FALSE;
1570 return ecore_evas_borderless_get(win->ee);
1574 * Set the shaped state of a window.
1576 * @param obj The window object
1577 * @param shaped If true, the window is shaped
1582 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1585 ELM_CHECK_WIDTYPE(obj, widtype);
1586 win = elm_widget_data_get(obj);
1588 ecore_evas_shaped_set(win->ee, shaped);
1589 #ifdef HAVE_ELEMENTARY_X
1590 _elm_win_xwin_update(win);
1595 * Get the shaped state of a window.
1597 * @param obj The window object
1598 * @return If true, the window is shaped
1603 elm_win_shaped_get(const Evas_Object *obj)
1606 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1607 win = elm_widget_data_get(obj);
1608 if (!win) return EINA_FALSE;
1609 return ecore_evas_shaped_get(win->ee);
1613 * Set the alpha channel state of a window.
1615 * @param obj The window object
1616 * @param alpha If true, the window has an alpha channel
1621 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1624 ELM_CHECK_WIDTYPE(obj, widtype);
1625 win = elm_widget_data_get(obj);
1627 #ifdef HAVE_ELEMENTARY_X
1632 if (!_elm_config->compositing)
1633 elm_win_shaped_set(obj, alpha);
1635 ecore_evas_alpha_set(win->ee, alpha);
1638 ecore_evas_alpha_set(win->ee, alpha);
1639 _elm_win_xwin_update(win);
1643 ecore_evas_alpha_set(win->ee, alpha);
1647 * Get the alpha channel state of a window.
1649 * @param obj The window object
1650 * @return If true, the window has an alpha channel
1655 elm_win_alpha_get(const Evas_Object *obj)
1658 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1659 win = elm_widget_data_get(obj);
1660 if (!win) return EINA_FALSE;
1661 return ecore_evas_alpha_get(win->ee);
1665 * Set the transparency state of a window.
1667 * @param obj The window object
1668 * @param transparent If true, the window is transparent
1673 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1676 ELM_CHECK_WIDTYPE(obj, widtype);
1677 win = elm_widget_data_get(obj);
1680 #ifdef HAVE_ELEMENTARY_X
1683 ecore_evas_transparent_set(win->ee, transparent);
1684 _elm_win_xwin_update(win);
1688 ecore_evas_transparent_set(win->ee, transparent);
1692 * Get the transparency state of a window.
1694 * @param obj The window object
1695 * @return If true, the window is transparent
1700 elm_win_transparent_get(const Evas_Object *obj)
1703 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1704 win = elm_widget_data_get(obj);
1705 if (!win) return EINA_FALSE;
1707 return ecore_evas_transparent_get(win->ee);
1711 * Set the override state of a window.
1713 * @param obj The window object
1714 * @param override If true, the window is overridden
1719 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1722 ELM_CHECK_WIDTYPE(obj, widtype);
1723 win = elm_widget_data_get(obj);
1725 ecore_evas_override_set(win->ee, override);
1726 #ifdef HAVE_ELEMENTARY_X
1727 _elm_win_xwin_update(win);
1732 * Get the override state of a window.
1734 * @param obj The window object
1735 * @return If true, the window is overridden
1740 elm_win_override_get(const Evas_Object *obj)
1743 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1744 win = elm_widget_data_get(obj);
1745 if (!win) return EINA_FALSE;
1746 return ecore_evas_override_get(win->ee);
1750 * Set the fullscreen state of a window.
1752 * @param obj The window object
1753 * @param fullscreen If true, the window is fullscreen
1758 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1761 ELM_CHECK_WIDTYPE(obj, widtype);
1762 win = elm_widget_data_get(obj);
1765 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1766 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1767 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1769 // these engines... can ONLY be fullscreen
1774 ecore_evas_fullscreen_set(win->ee, fullscreen);
1775 #ifdef HAVE_ELEMENTARY_X
1776 _elm_win_xwin_update(win);
1779 #undef ENGINE_COMPARE
1783 * Get the fullscreen state of a window.
1785 * @param obj The window object
1786 * @return If true, the window is fullscreen
1791 elm_win_fullscreen_get(const Evas_Object *obj)
1794 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1795 win = elm_widget_data_get(obj);
1796 if (!win) return EINA_FALSE;
1798 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1799 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1800 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1802 // these engines... can ONLY be fullscreen
1807 return ecore_evas_fullscreen_get(win->ee);
1809 #undef ENGINE_COMPARE
1813 * Set the maximized state of a window.
1815 * @param obj The window object
1816 * @param maximized If true, the window is maximized
1821 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1824 ELM_CHECK_WIDTYPE(obj, widtype);
1825 win = elm_widget_data_get(obj);
1827 ecore_evas_maximized_set(win->ee, maximized);
1828 #ifdef HAVE_ELEMENTARY_X
1829 _elm_win_xwin_update(win);
1834 * Get the maximized state of a window.
1836 * @param obj The window object
1837 * @return If true, the window is maximized
1842 elm_win_maximized_get(const Evas_Object *obj)
1845 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1846 win = elm_widget_data_get(obj);
1847 if (!win) return EINA_FALSE;
1848 return ecore_evas_maximized_get(win->ee);
1852 * Set the iconified state of a window.
1854 * @param obj The window object
1855 * @param iconified If true, the window is iconified
1860 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1863 ELM_CHECK_WIDTYPE(obj, widtype);
1864 win = elm_widget_data_get(obj);
1866 ecore_evas_iconified_set(win->ee, iconified);
1867 #ifdef HAVE_ELEMENTARY_X
1868 _elm_win_xwin_update(win);
1873 * Get the iconified state of a window.
1875 * @param obj The window object
1876 * @return If true, the window is iconified
1881 elm_win_iconified_get(const Evas_Object *obj)
1884 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1885 win = elm_widget_data_get(obj);
1886 if (!win) return EINA_FALSE;
1887 return ecore_evas_iconified_get(win->ee);
1891 * Set the layer of the window.
1893 * @param obj The window object
1894 * @param layer The layer of the window
1899 elm_win_layer_set(Evas_Object *obj, int layer)
1902 ELM_CHECK_WIDTYPE(obj, widtype);
1903 win = elm_widget_data_get(obj);
1905 ecore_evas_layer_set(win->ee, layer);
1906 #ifdef HAVE_ELEMENTARY_X
1907 _elm_win_xwin_update(win);
1912 * Get the layer of the window.
1914 * @param obj The window object
1915 * @return The layer of the window
1920 elm_win_layer_get(const Evas_Object *obj)
1923 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1924 win = elm_widget_data_get(obj);
1925 if (!win) return -1;
1926 return ecore_evas_layer_get(win->ee);
1930 * Set the rotation of the window.
1932 * @param obj The window object
1933 * @param rotation The rotation of the window, in degrees (0-360)
1938 elm_win_rotation_set(Evas_Object *obj, int rotation)
1941 ELM_CHECK_WIDTYPE(obj, widtype);
1942 win = elm_widget_data_get(obj);
1944 if (win->rot == rotation) return;
1945 win->rot = rotation;
1946 ecore_evas_rotation_set(win->ee, rotation);
1947 evas_object_size_hint_min_set(obj, -1, -1);
1948 evas_object_size_hint_max_set(obj, -1, -1);
1949 _elm_win_eval_subobjs(obj);
1950 #ifdef HAVE_ELEMENTARY_X
1951 _elm_win_xwin_update(win);
1956 * Rotates the window and resizes it
1958 * @param obj The window object
1959 * @param layer The rotation of the window in degrees (0-360)
1964 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1967 ELM_CHECK_WIDTYPE(obj, widtype);
1968 win = elm_widget_data_get(obj);
1970 if (win->rot == rotation) return;
1971 win->rot = rotation;
1972 ecore_evas_rotation_with_resize_set(win->ee, rotation);
1973 evas_object_size_hint_min_set(obj, -1, -1);
1974 evas_object_size_hint_max_set(obj, -1, -1);
1975 _elm_win_eval_subobjs(obj);
1976 #ifdef HAVE_ELEMENTARY_X
1977 _elm_win_xwin_update(win);
1982 * Get the rotation of the window.
1984 * @param obj The window object
1985 * @return The rotation of the window in degrees (0-360)
1990 elm_win_rotation_get(const Evas_Object *obj)
1993 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1994 win = elm_widget_data_get(obj);
1995 if (!win) return -1;
2000 * Set the sticky state of the window.
2002 * @param obj The window object
2003 * @param sticky If true, the window's sticky state is enabled
2008 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2011 ELM_CHECK_WIDTYPE(obj, widtype);
2012 win = elm_widget_data_get(obj);
2014 ecore_evas_sticky_set(win->ee, sticky);
2015 #ifdef HAVE_ELEMENTARY_X
2016 _elm_win_xwin_update(win);
2021 * Get the sticky state of the window.
2023 * @param obj The window object
2024 * @return If true, the window's sticky state is enabled
2029 elm_win_sticky_get(const Evas_Object *obj)
2032 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2033 win = elm_widget_data_get(obj);
2034 if (!win) return EINA_FALSE;
2035 return ecore_evas_sticky_get(win->ee);
2039 * Sets the keyboard mode of the window.
2041 * @param obj The window object
2042 * @param mode The mode to set; one of:
2043 * ELM_WIN_KEYBOARD_UNKNOWN
2044 * ELM_WIN_KEYBOARD_OFF
2045 * ELM_WIN_KEYBOARD_ON
2046 * ELM_WIN_KEYBOARD_ALPHA
2047 * ELM_WIN_KEYBOARD_NUMERIC
2048 * ELM_WIN_KEYBOARD_PIN
2049 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2050 * ELM_WIN_KEYBOARD_HEX
2051 * ELM_WIN_KEYBOARD_TERMINAL
2052 * ELM_WIN_KEYBOARD_PASSWORD
2053 * ELM_WIN_KEYBOARD_IP
2054 * ELM_WIN_KEYBOARD_HOST
2055 * ELM_WIN_KEYBOARD_FILE
2056 * ELM_WIN_KEYBOARD_URL
2057 * ELM_WIN_KEYBOARD_KEYPAD
2058 * ELM_WIN_KEYBOARD_J2ME
2063 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2066 ELM_CHECK_WIDTYPE(obj, widtype);
2067 win = elm_widget_data_get(obj);
2069 if (mode == win->kbdmode) return;
2070 #ifdef HAVE_ELEMENTARY_X
2071 _elm_win_xwindow_get(win);
2073 win->kbdmode = mode;
2074 #ifdef HAVE_ELEMENTARY_X
2076 ecore_x_e_virtual_keyboard_state_set
2077 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2082 * Gets the keyboard mode of the window.
2084 * @param obj The window object
2085 * @return The mode; one of:
2086 * ELM_WIN_KEYBOARD_UNKNOWN
2087 * ELM_WIN_KEYBOARD_OFF
2088 * ELM_WIN_KEYBOARD_ON
2089 * ELM_WIN_KEYBOARD_ALPHA
2090 * ELM_WIN_KEYBOARD_NUMERIC
2091 * ELM_WIN_KEYBOARD_PIN
2092 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2093 * ELM_WIN_KEYBOARD_HEX
2094 * ELM_WIN_KEYBOARD_TERMINAL
2095 * ELM_WIN_KEYBOARD_PASSWORD
2096 * ELM_WIN_KEYBOARD_IP
2097 * ELM_WIN_KEYBOARD_HOST
2098 * ELM_WIN_KEYBOARD_FILE
2099 * ELM_WIN_KEYBOARD_URL
2100 * ELM_WIN_KEYBOARD_KEYPAD
2101 * ELM_WIN_KEYBOARD_J2ME
2105 EAPI Elm_Win_Keyboard_Mode
2106 elm_win_keyboard_mode_get(const Evas_Object *obj)
2109 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2110 win = elm_widget_data_get(obj);
2111 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2112 return win->kbdmode;
2116 * Sets whether the window is a keyboard.
2118 * @param obj The window object
2119 * @param is_keyboard If true, the window is a virtual keyboard
2124 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2127 ELM_CHECK_WIDTYPE(obj, widtype);
2128 win = elm_widget_data_get(obj);
2130 #ifdef HAVE_ELEMENTARY_X
2131 _elm_win_xwindow_get(win);
2133 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2138 * Gets whether the window is a keyboard.
2140 * @param obj The window object
2141 * @return If the window is a virtual keyboard
2146 elm_win_keyboard_win_get(const Evas_Object *obj)
2149 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2150 win = elm_widget_data_get(obj);
2151 if (!win) return EINA_FALSE;
2152 #ifdef HAVE_ELEMENTARY_X
2153 _elm_win_xwindow_get(win);
2155 return ecore_x_e_virtual_keyboard_get(win->xwin);
2161 * Get the screen position of a window.
2163 * @param obj The window object
2164 * @param x The int to store the x coordinate to
2165 * @param y The int to store the y coordinate to
2170 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2173 ELM_CHECK_WIDTYPE(obj, widtype);
2174 win = elm_widget_data_get(obj);
2176 if (x) *x = win->screen.x;
2177 if (y) *y = win->screen.y;
2181 * Set if this window is an illume conformant window
2183 * @param obj The window object
2184 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2189 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2192 ELM_CHECK_WIDTYPE(obj, widtype);
2193 win = elm_widget_data_get(obj);
2195 #ifdef HAVE_ELEMENTARY_X
2196 _elm_win_xwindow_get(win);
2198 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2203 * Get if this window is an illume conformant window
2205 * @param obj The window object
2206 * @return A boolean if this window is illume conformant or not
2211 elm_win_conformant_get(const Evas_Object *obj)
2214 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2215 win = elm_widget_data_get(obj);
2216 if (!win) return EINA_FALSE;
2217 #ifdef HAVE_ELEMENTARY_X
2218 _elm_win_xwindow_get(win);
2220 return ecore_x_e_illume_conformant_get(win->xwin);
2226 * Set a window to be an illume quickpanel window
2228 * By default window objects are not quickpanel windows.
2230 * @param obj The window object
2231 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2236 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2239 ELM_CHECK_WIDTYPE(obj, widtype);
2240 win = elm_widget_data_get(obj);
2242 #ifdef HAVE_ELEMENTARY_X
2243 _elm_win_xwindow_get(win);
2246 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2249 Ecore_X_Window_State states[2];
2251 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2252 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2253 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2254 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2261 * Get if this window is a quickpanel or not
2263 * @param obj The window object
2264 * @return A boolean if this window is a quickpanel or not
2269 elm_win_quickpanel_get(const Evas_Object *obj)
2272 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2273 win = elm_widget_data_get(obj);
2274 if (!win) return EINA_FALSE;
2275 #ifdef HAVE_ELEMENTARY_X
2276 _elm_win_xwindow_get(win);
2278 return ecore_x_e_illume_quickpanel_get(win->xwin);
2284 * Set the major priority of a quickpanel window
2286 * @param obj The window object
2287 * @param priority The major priority for this quickpanel
2292 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2295 ELM_CHECK_WIDTYPE(obj, widtype);
2296 win = elm_widget_data_get(obj);
2298 #ifdef HAVE_ELEMENTARY_X
2299 _elm_win_xwindow_get(win);
2301 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2306 * Get the major priority of a quickpanel window
2308 * @param obj The window object
2309 * @return The major priority of this quickpanel
2314 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2317 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2318 win = elm_widget_data_get(obj);
2319 if (!win) return -1;
2320 #ifdef HAVE_ELEMENTARY_X
2321 _elm_win_xwindow_get(win);
2323 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2329 * Set the minor priority of a quickpanel window
2331 * @param obj The window object
2332 * @param priority The minor priority for this quickpanel
2337 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2340 ELM_CHECK_WIDTYPE(obj, widtype);
2341 win = elm_widget_data_get(obj);
2343 #ifdef HAVE_ELEMENTARY_X
2344 _elm_win_xwindow_get(win);
2346 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2351 * Get the minor priority of a quickpanel window
2353 * @param obj The window object
2354 * @return The minor priority of this quickpanel
2359 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2362 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2363 win = elm_widget_data_get(obj);
2364 if (!win) return -1;
2365 #ifdef HAVE_ELEMENTARY_X
2366 _elm_win_xwindow_get(win);
2368 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2374 * Set which zone this quickpanel should appear in
2376 * @param obj The window object
2377 * @param zone The requested zone for this quickpanel
2382 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2385 ELM_CHECK_WIDTYPE(obj, widtype);
2386 win = elm_widget_data_get(obj);
2388 #ifdef HAVE_ELEMENTARY_X
2389 _elm_win_xwindow_get(win);
2391 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2396 * Get which zone this quickpanel should appear in
2398 * @param obj The window object
2399 * @return The requested zone for this quickpanel
2404 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2407 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2408 win = elm_widget_data_get(obj);
2410 #ifdef HAVE_ELEMENTARY_X
2411 _elm_win_xwindow_get(win);
2413 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2419 * Set the window to be skipped by keyboard focus
2421 * This sets the window to be skipped by normal keyboard input. This means
2422 * a window manager will be asked to not focus this window as well as omit
2423 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2425 * Call this and enable it on a window BEFORE you show it for the first time,
2426 * otherwise it may have no effect.
2428 * Use this for windows that have only output information or might only be
2429 * interacted with by the mouse or fingers, and never for typing input.
2430 * Be careful that this may have side-effects like making the window
2431 * non-accessible in some cases unless the window is specially handled. Use
2434 * @param obj The window object
2435 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2440 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2443 ELM_CHECK_WIDTYPE(obj, widtype);
2444 win = elm_widget_data_get(obj);
2446 #ifdef HAVE_ELEMENTARY_X
2447 _elm_win_xwindow_get(win);
2452 Ecore_X_Window_State states[2];
2454 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2455 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2456 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2457 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2464 * Send a command to the windowing environment
2466 * This is intended to work in touchscreen or small screen device environments
2467 * where there is a more simplistic window management policy in place. This
2468 * uses the window object indicated to select which part of the environment
2469 * to control (the part that this window lives in), and provides a command
2470 * and an optional parameter structure (use NULL for this if not needed).
2472 * @param obj The window object that lives in the environment to control
2473 * @param command The command to send
2474 * @param params Optional parameters for the command
2479 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2482 ELM_CHECK_WIDTYPE(obj, widtype);
2483 win = elm_widget_data_get(obj);
2485 #ifdef HAVE_ELEMENTARY_X
2486 _elm_win_xwindow_get(win);
2491 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2492 ecore_x_e_illume_focus_back_send(win->xwin);
2494 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2495 ecore_x_e_illume_focus_forward_send(win->xwin);
2497 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2498 ecore_x_e_illume_focus_home_send(win->xwin);
2500 case ELM_ILLUME_COMMAND_CLOSE:
2501 ecore_x_e_illume_close_send(win->xwin);
2511 * Set the enabled status for the focus highlight in a window
2513 * This function will enable or disable the focus highlight only for the
2514 * given window, regardless of the global setting for it
2516 * @param obj The window where to enable the highlight
2517 * @param enabled The enabled value for the highlight
2522 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2526 ELM_CHECK_WIDTYPE(obj, widtype);
2528 win = elm_widget_data_get(obj);
2529 enabled = !!enabled;
2530 if (win->focus_highlight.enabled == enabled)
2533 win->focus_highlight.enabled = enabled;
2535 if (win->focus_highlight.enabled)
2536 _elm_win_focus_highlight_init(win);
2538 _elm_win_focus_highlight_shutdown(win);
2542 * Get the enabled value of the focus highlight for this window
2544 * @param obj The window in which to check if the focus highlight is enabled
2546 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2551 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2555 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2557 win = elm_widget_data_get(obj);
2558 return win->focus_highlight.enabled;
2562 * Set the style for the focus highlight on this window
2564 * Sets the style to use for theming the highlight of focused objects on
2565 * the given window. If @p style is NULL, the default will be used.
2567 * @param obj The window where to set the style
2568 * @param style The style to set
2573 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2577 ELM_CHECK_WIDTYPE(obj, widtype);
2579 win = elm_widget_data_get(obj);
2580 eina_stringshare_replace(&win->focus_highlight.style, style);
2581 win->focus_highlight.changed_theme = EINA_TRUE;
2582 _elm_win_focus_highlight_reconfigure_job_start(win);
2586 * Get the style set for the focus highlight object
2588 * Gets the style set for this windows highilght object, or NULL if none
2591 * @param obj The window to retrieve the highlights style from
2593 * @return The style set or NULL if none was. Default is used in that case.
2598 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2602 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2604 win = elm_widget_data_get(obj);
2605 return win->focus_highlight.style;
2609 elm_win_indicator_state_set(Evas_Object *obj, int show_state)
2612 if (strcmp(elm_widget_type_get(obj), "win")) return;
2613 win = elm_widget_data_get(obj);
2615 #ifdef HAVE_ELEMENTARY_X
2616 _elm_win_xwindow_get(win);
2618 return ecore_x_window_prop_property_set (win->xwin,
2619 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
2625 elm_win_indicator_state_get(Evas_Object *obj)
2628 if (strcmp(elm_widget_type_get(obj), "win")) return -1;
2629 win = elm_widget_data_get(obj);
2630 if (!win) return -1;
2631 #ifdef HAVE_ELEMENTARY_X
2632 _elm_win_xwindow_get(win);
2638 unsigned int *prop_data = NULL;
2640 ret = ecore_x_window_prop_property_get (win->xwin,
2641 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, (void *)&prop_data, &count);
2642 if( ret && prop_data )
2643 memcpy (&show, prop_data, sizeof (int));
2645 if (prop_data) free (prop_data);
2654 typedef struct _Widget_Data Widget_Data;
2659 Evas_Object *content;
2662 static void _del_hook(Evas_Object *obj);
2663 static void _theme_hook(Evas_Object *obj);
2664 static void _sizing_eval(Evas_Object *obj);
2665 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2666 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2668 static const char *widtype2 = NULL;
2671 _del_hook(Evas_Object *obj)
2673 Widget_Data *wd = elm_widget_data_get(obj);
2679 _theme_hook(Evas_Object *obj)
2681 Widget_Data *wd = elm_widget_data_get(obj);
2682 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2684 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2689 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2691 Widget_Data *wd = elm_widget_data_get(obj);
2696 /* Try Focus cycle in subitem */
2699 elm_widget_focus_next_get(wd->content, dir, next);
2704 *next = (Evas_Object *)obj;
2709 _sizing_eval(Evas_Object *obj)
2711 Widget_Data *wd = elm_widget_data_get(obj);
2712 Evas_Coord minw = -1, minh = -1;
2714 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2715 edje_object_size_min_calc(wd->frm, &minw, &minh);
2716 evas_object_size_hint_min_set(obj, minw, minh);
2717 evas_object_size_hint_max_set(obj, -1, -1);
2721 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2727 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2729 Widget_Data *wd = elm_widget_data_get(obj);
2730 Evas_Object *sub = event_info;
2731 if (sub == wd->content)
2733 evas_object_event_callback_del_full
2734 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2741 * @defgroup Inwin Inwin
2743 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2746 elm_win_inwin_add(Evas_Object *obj)
2752 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2753 win = elm_widget_data_get(obj);
2754 if (!win) return NULL;
2755 wd = ELM_NEW(Widget_Data);
2756 obj2 = elm_widget_add(win->evas);
2757 elm_widget_type_set(obj2, "inwin");
2758 ELM_SET_WIDTYPE(widtype2, "inwin");
2759 elm_widget_sub_object_add(obj, obj2);
2760 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2761 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2762 elm_win_resize_object_add(obj, obj2);
2764 elm_widget_data_set(obj2, wd);
2765 elm_widget_del_hook_set(obj2, _del_hook);
2766 elm_widget_theme_hook_set(obj2, _theme_hook);
2767 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2768 elm_widget_can_focus_set(obj2, EINA_TRUE);
2769 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2771 wd->frm = edje_object_add(win->evas);
2772 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2773 elm_widget_resize_object_set(obj2, wd->frm);
2775 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2782 * Activates an inwin object
2784 * @param obj The inwin to activate
2789 elm_win_inwin_activate(Evas_Object *obj)
2791 ELM_CHECK_WIDTYPE(obj, widtype2);
2792 Widget_Data *wd = elm_widget_data_get(obj);
2794 evas_object_raise(obj);
2795 evas_object_show(obj);
2796 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2797 elm_object_focus(obj);
2801 * Set the content of an inwin object.
2803 * Once the content object is set, a previously set one will be deleted.
2804 * If you want to keep that old content object, use the
2805 * elm_win_inwin_content_unset() function.
2807 * @param obj The inwin object
2808 * @param content The object to set as content
2813 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2815 ELM_CHECK_WIDTYPE(obj, widtype2);
2816 Widget_Data *wd = elm_widget_data_get(obj);
2818 if (wd->content == content) return;
2819 if (wd->content) evas_object_del(wd->content);
2820 wd->content = content;
2823 elm_widget_sub_object_add(obj, content);
2824 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2825 _changed_size_hints, obj);
2826 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2832 * Get the content of an inwin object.
2834 * Return the content object which is set for this widget.
2836 * @param obj The inwin object
2837 * @return The content that is being used
2842 elm_win_inwin_content_get(const Evas_Object *obj)
2844 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2845 Widget_Data *wd = elm_widget_data_get(obj);
2846 if (!wd) return NULL;
2851 * Unset the content of an inwin object.
2853 * Unparent and return the content object which was set for this widget.
2855 * @param obj The inwin object
2856 * @return The content that was being used
2861 elm_win_inwin_content_unset(Evas_Object *obj)
2863 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2864 Widget_Data *wd = elm_widget_data_get(obj);
2865 if (!wd) return NULL;
2866 if (!wd->content) return NULL;
2867 Evas_Object *content = wd->content;
2868 elm_widget_sub_object_del(obj, wd->content);
2869 edje_object_part_unswallow(wd->frm, wd->content);
2874 /* windowing spcific calls - shall we do this differently? */
2876 * Get the Ecore_X_Window of an Evas_Object
2878 * @param obj The object
2880 * @return The Ecore_X_Window of @p obj
2885 elm_win_xwindow_get(const Evas_Object *obj)
2887 Ecore_X_Window xwin = 0;
2888 Ecore_Evas *ee = NULL;
2890 #ifdef HAVE_ELEMENTARY_X
2891 ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2892 if (ee) xwin = (Ecore_X_Window)ecore_evas_window_get(ee);