1 #include <Elementary.h>
4 typedef struct _Elm_Win Elm_Win;
10 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
12 #ifdef HAVE_ELEMENTARY_X
14 Ecore_Event_Handler *client_message_handler;
16 Ecore_Job *deferred_resize_job;
17 Ecore_Job *deferred_child_eval_job;
20 Elm_Win_Keyboard_Mode kbdmode;
27 Eina_Bool autodel : 1;
28 Eina_Bool constrain : 1;
29 int *autodel_clear, rot;
40 Eina_Bool visible : 1;
41 Eina_Bool handled : 1;
45 Ecore_Job *reconf_job;
47 Eina_Bool enabled : 1;
48 Eina_Bool changed_theme : 1;
49 Eina_Bool top_animate : 1;
50 Eina_Bool geometry_changed : 1;
54 static const char *widtype = NULL;
55 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
56 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
57 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
58 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
59 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
60 static void _elm_win_move(Ecore_Evas *ee);
61 static void _elm_win_resize(Ecore_Evas *ee);
62 static void _elm_win_delete_request(Ecore_Evas *ee);
63 static void _elm_win_resize_job(void *data);
64 #ifdef HAVE_ELEMENTARY_X
65 static void _elm_win_xwin_update(Elm_Win *win);
67 static void _elm_win_eval_subobjs(Evas_Object *obj);
68 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
69 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
70 static void _elm_win_focus_highlight_init(Elm_Win *win);
71 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
72 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
73 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
74 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
75 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
76 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
78 static const char SIG_DELETE_REQUEST[] = "delete,request";
79 static const char SIG_FOCUS_OUT[] = "focus,out";
80 static const char SIG_FOCUS_IN[] = "focus,in";
81 static const char SIG_MOVED[] = "moved";
82 static const char SIG_THEME_CHANGED[] = "theme,changed";
84 static const Evas_Smart_Cb_Description _signals[] = {
85 {SIG_DELETE_REQUEST, ""},
94 Eina_List *_elm_win_list = NULL;
95 int _elm_win_deferred_free = 0;
97 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
98 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
101 _shot_delay_get(Elm_Win *win)
104 char *d = strdup(win->shot.info);
107 for (p = (char *)win->shot.info; *p; p++)
109 if (!strncmp(p, "delay=", 6))
113 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
128 _shot_file_get(Elm_Win *win)
131 char *tmp = strdup(win->shot.info);
132 char *repname = NULL;
134 if (!tmp) return NULL;
136 for (p = (char *)win->shot.info; *p; p++)
138 if (!strncmp(p, "file=", 5))
141 if (!win->shot.repeat_count) return tmp;
144 char *dotptr = strrchr(tmp, '.');
147 repname = malloc(sizeof(char)*(strlen(tmp) + 16));
148 strncpy(repname, tmp, dotptr - tmp);
149 sprintf(repname + (dotptr - tmp), "%03i",
150 win->shot.shot_counter + 1);
151 strcat(repname, dotptr);
159 if (!win->shot.repeat_count) return strdup("out.png");
162 repname = malloc(sizeof(char) * 24);
163 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
169 _shot_repeat_count_get(Elm_Win *win)
173 char *d = strdup(win->shot.info);
176 for (p = (char *)win->shot.info; *p; p++)
178 if (!strncmp(p, "repeat=", 7))
182 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
189 if (v > 1000) v = 999;
199 _shot_key_get(Elm_Win *win __UNUSED__)
205 _shot_flags_get(Elm_Win *win __UNUSED__)
211 _shot_do(Elm_Win *win)
215 unsigned int *pixels;
217 char *file, *key, *flags;
219 ecore_evas_manual_render(win->ee);
220 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
222 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
223 if ((w < 1) || (h < 1)) return;
224 file = _shot_file_get(win);
226 key = _shot_key_get(win);
227 flags = _shot_flags_get(win);
228 ee = ecore_evas_buffer_new(1, 1);
229 o = evas_object_image_add(ecore_evas_get(ee));
230 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
231 evas_object_image_size_set(o, w, h);
232 evas_object_image_data_set(o, pixels);
233 if (!evas_object_image_save(o, file, key, flags))
235 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
240 if (flags) free(flags);
242 if (win->shot.repeat_count) win->shot.shot_counter++;
246 _shot_delay(void *data)
250 if (win->shot.repeat_count)
252 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
253 if (remainshot > 0) return EINA_TRUE;
255 win->shot.timer = NULL;
261 _shot_init(Elm_Win *win)
263 if (!win->shot.info) return;
264 win->shot.repeat_count = _shot_repeat_count_get(win);
265 win->shot.shot_counter = 0;
269 _shot_handle(Elm_Win *win)
271 if (!win->shot.info) return;
272 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
276 _elm_win_move(Ecore_Evas *ee)
278 Evas_Object *obj = ecore_evas_object_associate_get(ee);
283 win = elm_widget_data_get(obj);
285 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
288 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
292 _elm_win_resize(Ecore_Evas *ee)
294 Evas_Object *obj = ecore_evas_object_associate_get(ee);
298 win = elm_widget_data_get(obj);
300 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
301 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
305 _elm_win_focus_in(Ecore_Evas *ee)
307 Evas_Object *obj = ecore_evas_object_associate_get(ee);
311 win = elm_widget_data_get(obj);
313 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
314 if (win->show_count == 1)
316 elm_object_focus_set(win->win_obj, EINA_TRUE);
320 elm_widget_focus_restore(win->win_obj);
321 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
322 win->focus_highlight.cur.visible = EINA_TRUE;
323 _elm_win_focus_highlight_reconfigure_job_start(win);
327 else if (win->img_obj)
334 _elm_win_focus_out(Ecore_Evas *ee)
336 Evas_Object *obj = ecore_evas_object_associate_get(ee);
340 win = elm_widget_data_get(obj);
342 elm_object_focus_set(win->win_obj, EINA_FALSE);
343 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
344 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
345 win->focus_highlight.cur.visible = EINA_FALSE;
346 _elm_win_focus_highlight_reconfigure_job_start(win);
350 else if (win->img_obj)
357 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
359 Elm_Win *wd = elm_widget_data_get(obj);
360 const Eina_List *items;
361 void *(*list_data_get) (const Eina_List *list);
369 if (!(items = elm_widget_focus_custom_chain_get(obj)))
375 list_data_get = eina_list_data_get;
377 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
383 *next = (Evas_Object *)obj;
388 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
390 Elm_Win *win = elm_widget_data_get(obj);
394 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
396 evas_object_focus_set(obj, elm_widget_focus_get(obj));
400 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
402 if (type == EVAS_CALLBACK_KEY_DOWN)
404 Evas_Event_Key_Down *ev = event_info;
405 if (!strcmp(ev->keyname, "Tab"))
407 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
408 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
410 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
411 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
414 else if ((!strcmp(ev->keyname, "Left")) ||
415 (!strcmp(ev->keyname, "KP_Left")))
417 //TODO : woohyun jung
419 else if ((!strcmp(ev->keyname, "Right")) ||
420 (!strcmp(ev->keyname, "KP_Right")))
422 //TODO : woohyun jung
424 else if ((!strcmp(ev->keyname, "Up")) ||
425 (!strcmp(ev->keyname, "KP_Up")))
427 //TODO : woohyun jung
429 else if ((!strcmp(ev->keyname, "Down")) ||
430 (!strcmp(ev->keyname, "KP_Down")))
432 //TODO : woohyun jung
440 _deferred_ecore_evas_free(void *data)
442 ecore_evas_free(data);
443 _elm_win_deferred_free--;
447 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
451 if (!win->show_count) win->show_count++;
452 if (win->shot.info) _shot_handle(win);
456 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
463 else if (win->img_obj)
465 evas_object_hide(win->img_obj);
470 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
477 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
478 _elm_win_obj_callback_parent_del, win);
481 if (win->autodel_clear) *(win->autodel_clear) = -1;
482 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
483 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
486 ecore_evas_callback_delete_request_set(win->ee, NULL);
487 ecore_evas_callback_resize_set(win->ee, NULL);
489 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
490 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
491 if (win->shot.info) eina_stringshare_del(win->shot.info);
492 if (win->shot.timer) ecore_timer_del(win->shot.timer);
493 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
494 _elm_win_obj_callback_del, win);
495 while (((child = evas_object_bottom_get(win->evas))) &&
498 evas_object_del(child);
500 while (((child = evas_object_top_get(win->evas))) &&
503 evas_object_del(child);
505 #ifdef HAVE_ELEMENTARY_X
506 if (win->client_message_handler)
507 ecore_event_handler_del(win->client_message_handler);
509 // FIXME: Why are we flushing edje on every window destroy ??
510 // edje_file_cache_flush();
511 // edje_collection_cache_flush();
512 // evas_image_cache_flush(win->evas);
513 // evas_font_cache_flush(win->evas);
514 // FIXME: we are in the del handler for the object and delete the canvas
515 // that lives under it from the handler... nasty. deferring doesn't help either
525 ecore_job_add(_deferred_ecore_evas_free, win->ee);
526 _elm_win_deferred_free++;
530 _elm_win_focus_highlight_shutdown(win);
531 eina_stringshare_del(win->focus_highlight.style);
535 if ((!_elm_win_list) &&
536 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
538 edje_file_cache_flush();
539 edje_collection_cache_flush();
540 evas_image_cache_flush(e);
541 evas_font_cache_flush(e);
547 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
550 if (!win->img_obj) return;
551 evas_object_event_callback_del_full
552 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
553 evas_object_del(win->img_obj);
557 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
560 if (obj == win->parent) win->parent = NULL;
564 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
570 if ((x != win->screen.x) || (y != win->screen.y))
574 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
579 evas_object_move(obj, x, y);
584 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
587 // this is called to make sure all smart containers have calculated their
588 // sizes BEFORE we show the window to make sure it initially appears at
589 // our desired size (ie min size is known first)
590 evas_smart_objects_calculate(evas_object_evas_get(obj));
591 evas_object_show(obj);
595 else if (win->img_obj)
597 evas_object_show(win->img_obj);
602 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
606 if (ecore_evas_override_get(win->ee))
610 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
613 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
618 else if (win->img_obj)
622 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
625 // evas_object_move(win->img_obj, x, y);
630 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
637 else if (win->img_obj)
639 Evas_Coord w = 1, h = 1;
641 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
645 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
651 evas_object_image_size_set(win->img_obj, w, h);
656 _elm_win_delete_request(Ecore_Evas *ee)
658 Evas_Object *obj = ecore_evas_object_associate_get(ee);
660 if (strcmp(elm_widget_type_get(obj), "win")) return;
662 win = elm_widget_data_get(obj);
664 int autodel = win->autodel;
665 win->autodel_clear = &autodel;
666 evas_object_ref(win->win_obj);
667 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
668 // FIXME: if above callback deletes - then the below will be invalid
669 if (autodel) evas_object_del(win->win_obj);
670 else win->autodel_clear = NULL;
671 evas_object_unref(win->win_obj);
675 _elm_win_resize_job(void *data)
682 win->deferred_resize_job = NULL;
683 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
687 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
691 evas_object_resize(win->win_obj, w, h);
695 else if (win->img_obj)
698 EINA_LIST_FOREACH(win->subobjs, l, obj)
700 evas_object_move(obj, 0, 0);
701 evas_object_resize(obj, w, h);
705 #ifdef HAVE_ELEMENTARY_X
707 _elm_win_xwindow_get(Elm_Win *win)
711 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
712 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
714 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
716 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
717 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
718 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
719 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
720 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
721 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
722 ENGINE_COMPARE(ELM_OPENGL_COCOA))
725 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
727 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
729 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
731 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
734 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
736 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
739 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
741 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
743 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
745 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
747 #undef ENGINE_COMPARE
751 #ifdef HAVE_ELEMENTARY_X
753 _elm_win_xwin_update(Elm_Win *win)
755 _elm_win_xwindow_get(win);
760 win2 = elm_widget_data_get(win->parent);
764 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
768 if (!win->xwin) return; /* nothing more to do */
773 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
775 case ELM_WIN_DIALOG_BASIC:
776 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
778 case ELM_WIN_DESKTOP:
779 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
782 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
784 case ELM_WIN_TOOLBAR:
785 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
788 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
790 case ELM_WIN_UTILITY:
791 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
794 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
796 case ELM_WIN_DROPDOWN_MENU:
797 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
799 case ELM_WIN_POPUP_MENU:
800 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
802 case ELM_WIN_TOOLTIP:
803 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
805 case ELM_WIN_NOTIFICATION:
806 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
809 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
812 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
817 ecore_x_e_virtual_keyboard_state_set
818 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
823 _elm_win_eval_subobjs(Evas_Object *obj)
826 const Evas_Object *child;
828 Elm_Win *win = elm_widget_data_get(obj);
829 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
833 EINA_LIST_FOREACH(win->subobjs, l, child)
835 evas_object_size_hint_weight_get(child, &wx, &wy);
836 if (wx == 0.0) xx = 0;
837 if (wy == 0.0) xy = 0;
839 evas_object_size_hint_min_get(child, &w, &h);
842 if (w > minw) minw = w;
843 if (h > minh) minh = h;
845 evas_object_size_hint_max_get(child, &w, &h);
848 if (maxw == -1) maxw = w;
849 else if ((w > 0) && (w < maxw)) maxw = w;
850 if (maxh == -1) maxh = h;
851 else if ((h > 0) && (h < maxh)) maxh = h;
853 if (!xx) maxw = minw;
855 if (!xy) maxh = minh;
857 evas_object_size_hint_min_set(obj, minw, minh);
858 evas_object_size_hint_max_set(obj, maxw, maxh);
859 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
860 if (w < minw) w = minw;
861 if (h < minh) h = minh;
862 if ((maxw >= 0) && (w > maxw)) w = maxw;
863 if ((maxh >= 0) && (h > maxh)) h = maxh;
864 evas_object_resize(obj, w, h);
868 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
870 Elm_Win *win = elm_widget_data_get(data);
871 win->subobjs = eina_list_remove(win->subobjs, obj);
872 _elm_win_eval_subobjs(win->win_obj);
876 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
878 _elm_win_eval_subobjs(data);
882 _elm_win_shutdown(void)
884 while (_elm_win_list)
885 evas_object_del(_elm_win_list->data);
889 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
896 EINA_LIST_FOREACH(_elm_win_list, l, obj)
897 elm_widget_theme(obj);
901 EINA_LIST_FOREACH(_elm_win_list, l, obj)
902 elm_widget_theme_specific(obj, th, EINA_FALSE);
907 _elm_win_translate(void)
912 EINA_LIST_FOREACH(_elm_win_list, l, obj)
913 elm_widget_translate(obj);
916 #ifdef HAVE_ELEMENTARY_X
918 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
921 Ecore_X_Event_Client_Message *e = event;
923 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
924 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
926 if ((unsigned)e->data.l[0] == win->xwin)
928 Evas *evas = evas_object_evas_get(win->win_obj);
931 edje_file_cache_flush();
932 edje_collection_cache_flush();
933 evas_image_cache_flush(evas);
934 evas_font_cache_flush(evas);
938 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
940 if ((unsigned)e->data.l[0] == win->xwin)
942 Evas *evas = evas_object_evas_get(win->win_obj);
945 edje_file_cache_flush();
946 edje_collection_cache_flush();
947 evas_image_cache_flush(evas);
948 evas_font_cache_flush(evas);
949 evas_render_dump(evas);
953 return ECORE_CALLBACK_PASS_ON;
958 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
962 win->focus_highlight.geometry_changed = EINA_TRUE;
963 _elm_win_focus_highlight_reconfigure_job_start(win);
967 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
971 win->focus_highlight.geometry_changed = EINA_TRUE;
972 _elm_win_focus_highlight_reconfigure_job_start(win);
976 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
980 win->focus_highlight.cur.target = NULL;
982 _elm_win_focus_highlight_reconfigure_job_start(win);
986 _elm_win_focus_target_callbacks_add(Elm_Win *win)
988 Evas_Object *obj = win->focus_highlight.cur.target;
990 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
991 _elm_win_focus_target_move, win);
992 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
993 _elm_win_focus_target_resize, win);
994 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
995 _elm_win_focus_target_del, win);
999 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1001 Evas_Object *obj = win->focus_highlight.cur.target;
1003 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1004 _elm_win_focus_target_move, win);
1005 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1006 _elm_win_focus_target_resize, win);
1007 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1008 _elm_win_focus_target_del, win);
1011 static Evas_Object *
1012 _elm_win_focus_target_get(Evas_Object *obj)
1014 Evas_Object *o = obj;
1018 if (elm_widget_is(o))
1020 if (!elm_widget_highlight_ignore_get(o))
1022 o = elm_widget_parent_get(o);
1024 o = evas_object_smart_parent_get(o);
1028 o = elm_widget_parent_widget_get(o);
1030 o = evas_object_smart_parent_get(o);
1039 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1041 Evas_Object *obj = event_info, *target;
1042 Elm_Win *win = data;
1044 if (win->focus_highlight.cur.target == obj)
1047 target = _elm_win_focus_target_get(obj);
1048 win->focus_highlight.cur.target = target;
1049 if (elm_widget_highlight_in_theme_get(target))
1050 win->focus_highlight.cur.handled = EINA_TRUE;
1052 _elm_win_focus_target_callbacks_add(win);
1054 _elm_win_focus_highlight_reconfigure_job_start(win);
1058 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1060 Elm_Win *win = data;
1062 if (!win->focus_highlight.cur.target)
1065 if (!win->focus_highlight.cur.handled)
1066 _elm_win_focus_target_callbacks_del(win);
1067 win->focus_highlight.cur.target = NULL;
1068 win->focus_highlight.cur.handled = EINA_FALSE;
1070 _elm_win_focus_highlight_reconfigure_job_start(win);
1074 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1076 evas_object_hide(obj);
1080 _elm_win_focus_highlight_init(Elm_Win *win)
1082 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1083 _elm_win_object_focus_in, win);
1084 evas_event_callback_add(win->evas,
1085 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1086 _elm_win_object_focus_out, win);
1088 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1090 win->focus_highlight.top = edje_object_add(win->evas);
1091 win->focus_highlight.changed_theme = EINA_TRUE;
1092 edje_object_signal_callback_add(win->focus_highlight.top,
1093 "elm,action,focus,hide,end", "",
1094 _elm_win_focus_highlight_hide, NULL);
1095 edje_object_signal_callback_add(win->focus_highlight.top,
1096 "elm,action,focus,anim,end", "",
1097 _elm_win_focus_highlight_anim_end, win);
1098 _elm_win_focus_highlight_reconfigure_job_start(win);
1102 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1104 _elm_win_focus_highlight_reconfigure_job_stop(win);
1105 if (win->focus_highlight.cur.target)
1107 _elm_win_focus_target_callbacks_del(win);
1108 win->focus_highlight.cur.target = NULL;
1110 if (win->focus_highlight.top)
1112 evas_object_del(win->focus_highlight.top);
1113 win->focus_highlight.top = NULL;
1116 evas_event_callback_del_full(win->evas,
1117 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1118 _elm_win_object_focus_in, win);
1119 evas_event_callback_del_full(win->evas,
1120 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1121 _elm_win_object_focus_out, win);
1125 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1129 top = win->focus_highlight.top;
1134 evas_object_show(top);
1135 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1141 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1146 _elm_win_focus_highlight_reconfigure_job(void *data)
1148 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1152 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1154 if (win->focus_highlight.reconf_job)
1155 ecore_job_del(win->focus_highlight.reconf_job);
1156 win->focus_highlight.reconf_job = ecore_job_add(
1157 _elm_win_focus_highlight_reconfigure_job, win);
1161 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1163 if (win->focus_highlight.reconf_job)
1164 ecore_job_del(win->focus_highlight.reconf_job);
1165 win->focus_highlight.reconf_job = NULL;
1169 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1171 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1172 Evas_Coord x, y, w, h;
1174 clip = evas_object_clip_get(target);
1175 evas_object_geometry_get(target, &x, &y, &w, &h);
1177 evas_object_move(obj, x, y);
1178 evas_object_resize(obj, w, h);
1179 evas_object_clip_set(obj, clip);
1183 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1185 Evas_Coord tx, ty, tw, th;
1186 Evas_Coord w, h, px, py, pw, ph;
1187 Edje_Message_Int_Set *m;
1188 Evas_Object *previous = win->focus_highlight.prev.target;
1189 Evas_Object *target = win->focus_highlight.cur.target;
1191 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1192 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1193 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1194 evas_object_move(obj, 0, 0);
1195 evas_object_resize(obj, tw, th);
1196 evas_object_clip_unset(obj);
1198 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1208 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1212 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1214 Elm_Win *win = data;
1215 _elm_win_focus_highlight_simple_setup(win, obj);
1219 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1221 Evas_Object *target = win->focus_highlight.cur.target;
1222 Evas_Object *previous = win->focus_highlight.prev.target;
1223 Evas_Object *top = win->focus_highlight.top;
1224 Eina_Bool visible_changed;
1225 Eina_Bool common_visible;
1226 const char *sig = NULL;
1228 _elm_win_focus_highlight_reconfigure_job_stop(win);
1230 visible_changed = (win->focus_highlight.cur.visible !=
1231 win->focus_highlight.prev.visible);
1233 if ((target == previous) && (!visible_changed) &&
1234 (!win->focus_highlight.geometry_changed))
1237 if ((previous) && (win->focus_highlight.prev.handled))
1238 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1241 common_visible = EINA_FALSE;
1242 else if (win->focus_highlight.cur.handled)
1244 common_visible = EINA_FALSE;
1245 if (win->focus_highlight.cur.visible)
1246 sig = "elm,action,focus_highlight,show";
1248 sig = "elm,action,focus_highlight,hide";
1251 common_visible = win->focus_highlight.cur.visible;
1253 _elm_win_focus_highlight_visible_set(win, common_visible);
1255 elm_widget_signal_emit(target, sig, "elm");
1257 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1260 if (win->focus_highlight.changed_theme)
1263 if (win->focus_highlight.style)
1264 str = win->focus_highlight.style;
1267 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1269 win->focus_highlight.changed_theme = EINA_FALSE;
1271 if (_elm_config->focus_highlight_animate)
1273 str = edje_object_data_get(win->focus_highlight.top, "animate");
1274 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1278 if ((win->focus_highlight.top_animate) && (previous) &&
1279 (!win->focus_highlight.prev.handled))
1280 _elm_win_focus_highlight_anim_setup(win, top);
1282 _elm_win_focus_highlight_simple_setup(win, top);
1283 evas_object_raise(top);
1286 win->focus_highlight.geometry_changed = EINA_FALSE;
1287 win->focus_highlight.prev = win->focus_highlight.cur;
1292 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1294 Evas_Event_Key_Down *ev = event_info;
1296 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1300 if ((strcmp(ev->keyname, "F12")) ||
1301 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1304 printf("Tree graph generated.\n");
1305 elm_object_tree_dot_dump(obj, "./dump.dot");
1310 _win_img_hide(void *data,
1312 Evas_Object *obj __UNUSED__,
1313 void *event_info __UNUSED__)
1315 Elm_Win *win = data;
1317 elm_widget_focus_hide_handle(win->win_obj);
1321 _win_img_mouse_up(void *data,
1323 Evas_Object *obj __UNUSED__,
1326 Elm_Win *win = data;
1327 Evas_Event_Mouse_Up *ev = event_info;
1328 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1329 elm_widget_focus_mouse_up_handle(win->win_obj);
1333 _win_img_focus_in(void *data,
1335 Evas_Object *obj __UNUSED__,
1336 void *event_info __UNUSED__)
1338 Elm_Win *win = data;
1339 elm_widget_focus_steal(win->win_obj);
1343 _win_img_focus_out(void *data,
1345 Evas_Object *obj __UNUSED__,
1346 void *event_info __UNUSED__)
1348 Elm_Win *win = data;
1349 elm_widget_focused_object_clear(win->win_obj);
1353 _win_inlined_image_set(Elm_Win *win)
1355 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1356 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1357 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1358 _elm_win_obj_callback_img_obj_del, win);
1360 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1361 _win_img_hide, win);
1362 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1363 _win_img_mouse_up, win);
1364 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1365 _win_img_focus_in, win);
1366 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1367 _win_img_focus_out, win);
1371 _subobj_del(Evas_Object *obj, Evas_Object *subobj, void *event_info __UNUSED__)
1373 Elm_Win *win = elm_widget_data_get(obj);
1374 evas_object_event_callback_del_full(subobj,
1375 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1376 _elm_win_subobj_callback_changed_size_hints,
1378 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1379 _elm_win_subobj_callback_del, obj);
1380 win->subobjs = eina_list_remove(win->subobjs, subobj);
1381 evas_object_smart_callback_del(subobj, "win-resize-del-private-dont-use-this. seriously", (Evas_Smart_Cb)_subobj_del);
1382 _elm_win_eval_subobjs(obj);
1386 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1390 const char *fontpath;
1392 win = ELM_NEW(Elm_Win);
1394 #define FALLBACK_TRY(engine) \
1397 CRITICAL(engine " engine creation failed. Trying default."); \
1398 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1400 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1402 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1406 case ELM_WIN_INLINED_IMAGE:
1409 Evas *e = evas_object_evas_get(parent);
1412 ee = ecore_evas_ecore_evas_get(e);
1414 win->img_obj = ecore_evas_object_image_new(ee);
1415 if (!win->img_obj) break;
1416 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1419 _win_inlined_image_set(win);
1422 evas_object_del(win->img_obj);
1423 win->img_obj = NULL;
1427 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1429 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1430 #ifdef HAVE_ELEMENTARY_X
1431 win->client_message_handler = ecore_event_handler_add
1432 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1434 FALLBACK_TRY("Sofware X11");
1436 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1438 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1439 FALLBACK_TRY("Sofware FB");
1441 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1443 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1444 FALLBACK_TRY("Sofware DirectFB");
1446 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1448 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1449 FALLBACK_TRY("Sofware-16");
1450 #ifdef HAVE_ELEMENTARY_X
1451 win->client_message_handler = ecore_event_handler_add
1452 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1455 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1457 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1458 FALLBACK_TRY("Sofware-8");
1459 #ifdef HAVE_ELEMENTARY_X
1460 win->client_message_handler = ecore_event_handler_add
1461 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1465 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1467 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1468 FALLBACK_TRY("XRender");
1469 #ifdef HAVE_ELEMENTARY_X
1470 win->client_message_handler = ecore_event_handler_add
1471 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1475 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1480 if (_elm_config->vsync)
1482 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1488 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1490 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1491 FALLBACK_TRY("OpenGL");
1492 #ifdef HAVE_ELEMENTARY_X
1493 win->client_message_handler = ecore_event_handler_add
1494 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1497 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1499 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1500 FALLBACK_TRY("Sofware Win32");
1502 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1504 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1505 FALLBACK_TRY("Sofware-16-WinCE");
1507 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1509 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1510 FALLBACK_TRY("PSL1GHT");
1512 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1514 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1515 FALLBACK_TRY("Sofware SDL");
1517 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1519 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1520 FALLBACK_TRY("Sofware-16-SDL");
1522 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1524 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1525 FALLBACK_TRY("OpenGL SDL");
1527 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1529 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1530 FALLBACK_TRY("OpenGL Cocoa");
1532 else if (ENGINE_COMPARE(ELM_BUFFER))
1534 win->ee = ecore_evas_buffer_new(1, 1);
1536 else if (ENGINE_COMPARE(ELM_EWS))
1538 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1540 else if (!strncmp(_elm_config->engine, "shot:", 5))
1542 win->ee = ecore_evas_buffer_new(1, 1);
1543 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1544 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1553 ERR("Cannot create window.");
1557 #ifdef HAVE_ELEMENTARY_X
1558 _elm_win_xwindow_get(win);
1560 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1561 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1562 // bg pixmap done by x - has other issues like can be redrawn by x before it
1563 // is filled/ready by app
1564 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1567 win->parent = parent;
1569 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1570 _elm_win_obj_callback_parent_del, win);
1572 win->evas = ecore_evas_get(win->ee);
1573 win->win_obj = elm_widget_add(win->evas);
1574 elm_widget_type_set(win->win_obj, "win");
1575 ELM_SET_WIDTYPE(widtype, "win");
1576 elm_widget_data_set(win->win_obj, win);
1577 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1578 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1579 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1580 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1581 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1582 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1583 evas_object_move(win->win_obj, 0, 0);
1584 evas_object_resize(win->win_obj, 1, 1);
1585 evas_object_layer_set(win->win_obj, 50);
1586 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1588 if (type == ELM_WIN_INLINED_IMAGE)
1589 elm_widget_parent2_set(win->win_obj, parent);
1590 ecore_evas_object_associate(win->ee, win->win_obj,
1591 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1592 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1593 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1594 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1595 _elm_win_obj_callback_show, win);
1596 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1597 _elm_win_obj_callback_hide, win);
1598 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1599 _elm_win_obj_callback_del, win);
1600 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1601 _elm_win_obj_callback_move, win);
1602 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1603 _elm_win_obj_callback_resize, win);
1605 evas_object_intercept_move_callback_add(win->win_obj,
1606 _elm_win_obj_intercept_move, win);
1607 evas_object_intercept_show_callback_add(win->win_obj,
1608 _elm_win_obj_intercept_show, win);
1610 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1611 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1612 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1613 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1614 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1615 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1616 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1617 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1618 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1619 evas_font_path_append(win->evas, fontpath);
1620 if (!_elm_config->font_hinting)
1621 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1622 else if (_elm_config->font_hinting == 1)
1623 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1624 else if (_elm_config->font_hinting == 2)
1625 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1627 #ifdef HAVE_ELEMENTARY_X
1628 _elm_win_xwin_update(win);
1631 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1633 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1635 ecore_evas_fullscreen_set(win->ee, 1);
1637 #undef ENGINE_COMPARE
1639 if (_elm_config->focus_highlight_enable)
1640 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1643 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1644 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1645 _debug_key_down, win);
1647 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1649 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1652 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1654 return win->win_obj;
1658 elm_win_util_standard_add(const char *name, const char *title)
1660 Evas_Object *win, *bg;
1662 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1663 if (!win) return NULL;
1664 elm_win_title_set(win, title);
1665 bg = elm_bg_add(win);
1668 evas_object_del(win);
1671 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1672 elm_win_resize_object_add(win, bg);
1673 evas_object_show(bg);
1678 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1682 ELM_CHECK_WIDTYPE(obj, widtype);
1683 win = elm_widget_data_get(obj);
1685 if (eina_list_data_find(win->subobjs, subobj)) return;
1686 win->subobjs = eina_list_append(win->subobjs, subobj);
1687 elm_widget_sub_object_add(obj, subobj);
1688 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1689 _elm_win_subobj_callback_del, obj);
1690 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1691 _elm_win_subobj_callback_changed_size_hints,
1693 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1694 evas_object_move(subobj, 0, 0);
1695 evas_object_resize(subobj, w, h);
1696 evas_object_smart_callback_add(subobj, "win-resize-del-private-dont-use-this. seriously", (Evas_Smart_Cb)_subobj_del, obj);
1697 _elm_win_eval_subobjs(obj);
1701 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1704 ELM_CHECK_WIDTYPE(obj, widtype);
1705 win = elm_widget_data_get(obj);
1707 evas_object_event_callback_del_full(subobj,
1708 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1709 _elm_win_subobj_callback_changed_size_hints,
1711 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1712 _elm_win_subobj_callback_del, obj);
1713 win->subobjs = eina_list_remove(win->subobjs, subobj);
1714 elm_widget_sub_object_del(obj, subobj);
1715 _elm_win_eval_subobjs(obj);
1719 elm_win_title_set(Evas_Object *obj, const char *title)
1722 ELM_CHECK_WIDTYPE(obj, widtype);
1723 win = elm_widget_data_get(obj);
1725 ecore_evas_title_set(win->ee, title);
1729 elm_win_title_get(const Evas_Object *obj)
1732 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1733 win = elm_widget_data_get(obj);
1734 if (!win) return NULL;
1735 return ecore_evas_title_get(win->ee);
1739 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1742 ELM_CHECK_WIDTYPE(obj, widtype);
1743 win = elm_widget_data_get(obj);
1745 win->autodel = autodel;
1749 elm_win_autodel_get(const Evas_Object *obj)
1752 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1753 win = elm_widget_data_get(obj);
1754 if (!win) return EINA_FALSE;
1755 return win->autodel;
1759 elm_win_activate(Evas_Object *obj)
1762 ELM_CHECK_WIDTYPE(obj, widtype);
1763 win = elm_widget_data_get(obj);
1765 ecore_evas_activate(win->ee);
1769 elm_win_lower(Evas_Object *obj)
1772 ELM_CHECK_WIDTYPE(obj, widtype);
1773 win = elm_widget_data_get(obj);
1775 ecore_evas_lower(win->ee);
1779 elm_win_raise(Evas_Object *obj)
1782 ELM_CHECK_WIDTYPE(obj, widtype);
1783 win = elm_widget_data_get(obj);
1785 ecore_evas_raise(win->ee);
1789 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
1792 int win_w, win_h, screen_w, screen_h, nx, ny;
1793 ELM_CHECK_WIDTYPE(obj, widtype);
1794 win = elm_widget_data_get(obj);
1796 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
1797 if ((!screen_w) || (!screen_h)) return;
1798 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
1799 if ((!win_w) || (!win_h)) return;
1800 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
1801 else nx = win->screen.x;
1802 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
1803 else ny = win->screen.y;
1806 evas_object_move(obj, nx, ny);
1810 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1813 ELM_CHECK_WIDTYPE(obj, widtype);
1814 win = elm_widget_data_get(obj);
1816 ecore_evas_borderless_set(win->ee, borderless);
1817 #ifdef HAVE_ELEMENTARY_X
1818 _elm_win_xwin_update(win);
1823 elm_win_borderless_get(const Evas_Object *obj)
1826 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1827 win = elm_widget_data_get(obj);
1828 if (!win) return EINA_FALSE;
1829 return ecore_evas_borderless_get(win->ee);
1833 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1836 ELM_CHECK_WIDTYPE(obj, widtype);
1837 win = elm_widget_data_get(obj);
1839 ecore_evas_shaped_set(win->ee, shaped);
1840 #ifdef HAVE_ELEMENTARY_X
1841 _elm_win_xwin_update(win);
1846 elm_win_shaped_get(const Evas_Object *obj)
1849 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1850 win = elm_widget_data_get(obj);
1851 if (!win) return EINA_FALSE;
1852 return ecore_evas_shaped_get(win->ee);
1856 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1859 ELM_CHECK_WIDTYPE(obj, widtype);
1860 win = elm_widget_data_get(obj);
1865 else if (win->img_obj)
1867 evas_object_image_alpha_set(win->img_obj, alpha);
1868 ecore_evas_alpha_set(win->ee, alpha);
1872 #ifdef HAVE_ELEMENTARY_X
1877 if (!_elm_config->compositing)
1878 elm_win_shaped_set(obj, alpha);
1880 ecore_evas_alpha_set(win->ee, alpha);
1883 ecore_evas_alpha_set(win->ee, alpha);
1884 _elm_win_xwin_update(win);
1888 ecore_evas_alpha_set(win->ee, alpha);
1893 elm_win_alpha_get(const Evas_Object *obj)
1896 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1897 win = elm_widget_data_get(obj);
1898 if (!win) return EINA_FALSE;
1902 else if (win->img_obj)
1904 return evas_object_image_alpha_get(win->img_obj);
1906 return ecore_evas_alpha_get(win->ee);
1910 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1913 ELM_CHECK_WIDTYPE(obj, widtype);
1914 win = elm_widget_data_get(obj);
1920 else if (win->img_obj)
1922 evas_object_image_alpha_set(win->img_obj, transparent);
1926 #ifdef HAVE_ELEMENTARY_X
1929 ecore_evas_transparent_set(win->ee, transparent);
1930 _elm_win_xwin_update(win);
1934 ecore_evas_transparent_set(win->ee, transparent);
1939 elm_win_transparent_get(const Evas_Object *obj)
1942 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1943 win = elm_widget_data_get(obj);
1944 if (!win) return EINA_FALSE;
1946 return ecore_evas_transparent_get(win->ee);
1950 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1953 ELM_CHECK_WIDTYPE(obj, widtype);
1954 win = elm_widget_data_get(obj);
1956 ecore_evas_override_set(win->ee, override);
1957 #ifdef HAVE_ELEMENTARY_X
1958 _elm_win_xwin_update(win);
1963 elm_win_override_get(const Evas_Object *obj)
1966 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1967 win = elm_widget_data_get(obj);
1968 if (!win) return EINA_FALSE;
1969 return ecore_evas_override_get(win->ee);
1973 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1976 ELM_CHECK_WIDTYPE(obj, widtype);
1977 win = elm_widget_data_get(obj);
1980 // YYY: handle if win->img_obj
1981 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1982 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1983 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1985 // these engines... can ONLY be fullscreen
1990 ecore_evas_fullscreen_set(win->ee, fullscreen);
1991 #ifdef HAVE_ELEMENTARY_X
1992 _elm_win_xwin_update(win);
1995 #undef ENGINE_COMPARE
1999 elm_win_fullscreen_get(const Evas_Object *obj)
2002 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2003 win = elm_widget_data_get(obj);
2004 if (!win) return EINA_FALSE;
2006 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2007 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2008 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2010 // these engines... can ONLY be fullscreen
2015 return ecore_evas_fullscreen_get(win->ee);
2017 #undef ENGINE_COMPARE
2021 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2024 ELM_CHECK_WIDTYPE(obj, widtype);
2025 win = elm_widget_data_get(obj);
2027 // YYY: handle if win->img_obj
2028 ecore_evas_maximized_set(win->ee, maximized);
2029 #ifdef HAVE_ELEMENTARY_X
2030 _elm_win_xwin_update(win);
2035 elm_win_maximized_get(const Evas_Object *obj)
2038 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2039 win = elm_widget_data_get(obj);
2040 if (!win) return EINA_FALSE;
2041 return ecore_evas_maximized_get(win->ee);
2045 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2048 ELM_CHECK_WIDTYPE(obj, widtype);
2049 win = elm_widget_data_get(obj);
2051 ecore_evas_iconified_set(win->ee, iconified);
2052 #ifdef HAVE_ELEMENTARY_X
2053 _elm_win_xwin_update(win);
2058 elm_win_iconified_get(const Evas_Object *obj)
2061 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2062 win = elm_widget_data_get(obj);
2063 if (!win) return EINA_FALSE;
2064 return ecore_evas_iconified_get(win->ee);
2068 elm_win_layer_set(Evas_Object *obj, int layer)
2071 ELM_CHECK_WIDTYPE(obj, widtype);
2072 win = elm_widget_data_get(obj);
2074 ecore_evas_layer_set(win->ee, layer);
2075 #ifdef HAVE_ELEMENTARY_X
2076 _elm_win_xwin_update(win);
2081 elm_win_layer_get(const Evas_Object *obj)
2084 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2085 win = elm_widget_data_get(obj);
2086 if (!win) return -1;
2087 return ecore_evas_layer_get(win->ee);
2091 elm_win_rotation_set(Evas_Object *obj, int rotation)
2094 ELM_CHECK_WIDTYPE(obj, widtype);
2095 win = elm_widget_data_get(obj);
2097 if (win->rot == rotation) return;
2098 win->rot = rotation;
2099 ecore_evas_rotation_set(win->ee, rotation);
2100 evas_object_size_hint_min_set(obj, -1, -1);
2101 evas_object_size_hint_max_set(obj, -1, -1);
2102 _elm_win_eval_subobjs(obj);
2103 #ifdef HAVE_ELEMENTARY_X
2104 _elm_win_xwin_update(win);
2109 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2112 ELM_CHECK_WIDTYPE(obj, widtype);
2113 win = elm_widget_data_get(obj);
2115 if (win->rot == rotation) return;
2116 win->rot = rotation;
2117 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2118 evas_object_size_hint_min_set(obj, -1, -1);
2119 evas_object_size_hint_max_set(obj, -1, -1);
2120 _elm_win_eval_subobjs(obj);
2121 #ifdef HAVE_ELEMENTARY_X
2122 _elm_win_xwin_update(win);
2127 elm_win_rotation_get(const Evas_Object *obj)
2130 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2131 win = elm_widget_data_get(obj);
2132 if (!win) return -1;
2137 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2140 ELM_CHECK_WIDTYPE(obj, widtype);
2141 win = elm_widget_data_get(obj);
2143 ecore_evas_sticky_set(win->ee, sticky);
2144 #ifdef HAVE_ELEMENTARY_X
2145 _elm_win_xwin_update(win);
2150 elm_win_sticky_get(const Evas_Object *obj)
2153 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2154 win = elm_widget_data_get(obj);
2155 if (!win) return EINA_FALSE;
2156 return ecore_evas_sticky_get(win->ee);
2160 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2163 ELM_CHECK_WIDTYPE(obj, widtype);
2164 win = elm_widget_data_get(obj);
2166 if (mode == win->kbdmode) return;
2167 #ifdef HAVE_ELEMENTARY_X
2168 _elm_win_xwindow_get(win);
2170 win->kbdmode = mode;
2171 #ifdef HAVE_ELEMENTARY_X
2173 ecore_x_e_virtual_keyboard_state_set
2174 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2178 EAPI Elm_Win_Keyboard_Mode
2179 elm_win_keyboard_mode_get(const Evas_Object *obj)
2182 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2183 win = elm_widget_data_get(obj);
2184 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2185 return win->kbdmode;
2189 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
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_virtual_keyboard_set(win->xwin, is_keyboard);
2205 elm_win_keyboard_win_get(const Evas_Object *obj)
2208 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2209 win = elm_widget_data_get(obj);
2210 if (!win) return EINA_FALSE;
2211 #ifdef HAVE_ELEMENTARY_X
2212 _elm_win_xwindow_get(win);
2214 return ecore_x_e_virtual_keyboard_get(win->xwin);
2220 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2223 ELM_CHECK_WIDTYPE(obj, widtype);
2224 win = elm_widget_data_get(obj);
2226 if (x) *x = win->screen.x;
2227 if (y) *y = win->screen.y;
2231 elm_win_focus_get(const Evas_Object *obj)
2234 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2235 win = elm_widget_data_get(obj);
2236 if (!win) return EINA_FALSE;
2237 return ecore_evas_focus_get(win->ee);
2241 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2244 ELM_CHECK_WIDTYPE(obj, widtype);
2245 win = elm_widget_data_get(obj);
2247 win->constrain = !!constrain;
2251 elm_win_screen_constrain_get(Evas_Object *obj)
2254 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2255 win = elm_widget_data_get(obj);
2256 if (!win) return EINA_FALSE;
2257 return win->constrain;
2261 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2264 ELM_CHECK_WIDTYPE(obj, widtype);
2265 win = elm_widget_data_get(obj);
2267 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2271 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2274 ELM_CHECK_WIDTYPE(obj, widtype);
2275 win = elm_widget_data_get(obj);
2277 #ifdef HAVE_ELEMENTARY_X
2278 _elm_win_xwindow_get(win);
2280 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2287 elm_win_conformant_get(const Evas_Object *obj)
2290 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2291 win = elm_widget_data_get(obj);
2292 if (!win) return EINA_FALSE;
2293 #ifdef HAVE_ELEMENTARY_X
2294 _elm_win_xwindow_get(win);
2296 return ecore_x_e_illume_conformant_get(win->xwin);
2302 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2305 ELM_CHECK_WIDTYPE(obj, widtype);
2306 win = elm_widget_data_get(obj);
2308 #ifdef HAVE_ELEMENTARY_X
2309 _elm_win_xwindow_get(win);
2312 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2315 Ecore_X_Window_State states[2];
2317 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2318 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2319 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2320 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2329 elm_win_quickpanel_get(const Evas_Object *obj)
2332 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2333 win = elm_widget_data_get(obj);
2334 if (!win) return EINA_FALSE;
2335 #ifdef HAVE_ELEMENTARY_X
2336 _elm_win_xwindow_get(win);
2338 return ecore_x_e_illume_quickpanel_get(win->xwin);
2344 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2347 ELM_CHECK_WIDTYPE(obj, widtype);
2348 win = elm_widget_data_get(obj);
2350 #ifdef HAVE_ELEMENTARY_X
2351 _elm_win_xwindow_get(win);
2353 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2360 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2363 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2364 win = elm_widget_data_get(obj);
2365 if (!win) return -1;
2366 #ifdef HAVE_ELEMENTARY_X
2367 _elm_win_xwindow_get(win);
2369 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2375 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
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_illume_quickpanel_priority_minor_set(win->xwin, priority);
2391 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2394 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2395 win = elm_widget_data_get(obj);
2396 if (!win) return -1;
2397 #ifdef HAVE_ELEMENTARY_X
2398 _elm_win_xwindow_get(win);
2400 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2406 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2409 ELM_CHECK_WIDTYPE(obj, widtype);
2410 win = elm_widget_data_get(obj);
2412 #ifdef HAVE_ELEMENTARY_X
2413 _elm_win_xwindow_get(win);
2415 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2422 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2425 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2426 win = elm_widget_data_get(obj);
2428 #ifdef HAVE_ELEMENTARY_X
2429 _elm_win_xwindow_get(win);
2431 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2437 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2440 ELM_CHECK_WIDTYPE(obj, widtype);
2441 win = elm_widget_data_get(obj);
2443 #ifdef HAVE_ELEMENTARY_X
2444 _elm_win_xwindow_get(win);
2449 Ecore_X_Window_State states[2];
2451 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2452 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2453 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2454 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2463 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2466 ELM_CHECK_WIDTYPE(obj, widtype);
2467 win = elm_widget_data_get(obj);
2469 #ifdef HAVE_ELEMENTARY_X
2470 _elm_win_xwindow_get(win);
2475 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2476 ecore_x_e_illume_focus_back_send(win->xwin);
2478 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2479 ecore_x_e_illume_focus_forward_send(win->xwin);
2481 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2482 ecore_x_e_illume_focus_home_send(win->xwin);
2484 case ELM_ILLUME_COMMAND_CLOSE:
2485 ecore_x_e_illume_close_send(win->xwin);
2497 elm_win_inlined_image_object_get(Evas_Object *obj)
2500 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2501 win = elm_widget_data_get(obj);
2502 if (!win) return NULL;
2503 return win->img_obj;
2507 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2511 ELM_CHECK_WIDTYPE(obj, widtype);
2513 win = elm_widget_data_get(obj);
2514 enabled = !!enabled;
2515 if (win->focus_highlight.enabled == enabled)
2518 win->focus_highlight.enabled = enabled;
2520 if (win->focus_highlight.enabled)
2521 _elm_win_focus_highlight_init(win);
2523 _elm_win_focus_highlight_shutdown(win);
2527 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2531 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2533 win = elm_widget_data_get(obj);
2534 return win->focus_highlight.enabled;
2538 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2542 ELM_CHECK_WIDTYPE(obj, widtype);
2544 win = elm_widget_data_get(obj);
2545 eina_stringshare_replace(&win->focus_highlight.style, style);
2546 win->focus_highlight.changed_theme = EINA_TRUE;
2547 _elm_win_focus_highlight_reconfigure_job_start(win);
2551 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2555 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2557 win = elm_widget_data_get(obj);
2558 return win->focus_highlight.style;
2561 typedef struct _Widget_Data Widget_Data;
2566 Evas_Object *content;
2569 static void _del_hook(Evas_Object *obj);
2570 static void _theme_hook(Evas_Object *obj);
2571 static void _sizing_eval(Evas_Object *obj);
2572 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2573 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2575 static const char *widtype2 = NULL;
2578 _del_hook(Evas_Object *obj)
2580 Widget_Data *wd = elm_widget_data_get(obj);
2586 _theme_hook(Evas_Object *obj)
2588 Widget_Data *wd = elm_widget_data_get(obj);
2589 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2591 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2594 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2598 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2600 Widget_Data *wd = elm_widget_data_get(obj);
2605 /* Try Focus cycle in subitem */
2608 elm_widget_focus_next_get(wd->content, dir, next);
2613 *next = (Evas_Object *)obj;
2618 _sizing_eval(Evas_Object *obj)
2620 Widget_Data *wd = elm_widget_data_get(obj);
2621 Evas_Coord minw = -1, minh = -1;
2623 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2624 edje_object_size_min_calc(wd->frm, &minw, &minh);
2625 evas_object_size_hint_min_set(obj, minw, minh);
2626 evas_object_size_hint_max_set(obj, -1, -1);
2630 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2636 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2638 Widget_Data *wd = elm_widget_data_get(obj);
2639 Evas_Object *sub = event_info;
2640 if (sub == wd->content)
2642 evas_object_event_callback_del_full
2643 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2650 elm_win_inwin_add(Evas_Object *obj)
2656 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2657 win = elm_widget_data_get(obj);
2658 if (!win) return NULL;
2659 wd = ELM_NEW(Widget_Data);
2660 obj2 = elm_widget_add(win->evas);
2661 elm_widget_type_set(obj2, "inwin");
2662 ELM_SET_WIDTYPE(widtype2, "inwin");
2663 elm_widget_sub_object_add(obj, obj2);
2664 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2665 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2666 elm_win_resize_object_add(obj, obj2);
2668 elm_widget_data_set(obj2, wd);
2669 elm_widget_del_hook_set(obj2, _del_hook);
2670 elm_widget_theme_hook_set(obj2, _theme_hook);
2671 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2672 elm_widget_can_focus_set(obj2, EINA_TRUE);
2673 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2675 wd->frm = edje_object_add(win->evas);
2676 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2677 elm_widget_resize_object_set(obj2, wd->frm);
2679 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2686 elm_win_inwin_activate(Evas_Object *obj)
2688 ELM_CHECK_WIDTYPE(obj, widtype2);
2689 Widget_Data *wd = elm_widget_data_get(obj);
2691 evas_object_raise(obj);
2692 evas_object_show(obj);
2693 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2694 elm_object_focus_set(obj, EINA_TRUE);
2698 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2700 ELM_CHECK_WIDTYPE(obj, widtype2);
2701 Widget_Data *wd = elm_widget_data_get(obj);
2703 if (wd->content == content) return;
2704 if (wd->content) evas_object_del(wd->content);
2705 wd->content = content;
2708 elm_widget_sub_object_add(obj, content);
2709 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2710 _changed_size_hints, obj);
2711 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2717 elm_win_inwin_content_get(const Evas_Object *obj)
2719 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2720 Widget_Data *wd = elm_widget_data_get(obj);
2721 if (!wd) return NULL;
2726 elm_win_inwin_content_unset(Evas_Object *obj)
2728 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2729 Widget_Data *wd = elm_widget_data_get(obj);
2730 if (!wd) return NULL;
2731 if (!wd->content) return NULL;
2732 Evas_Object *content = wd->content;
2733 elm_widget_sub_object_del(obj, wd->content);
2734 evas_object_event_callback_del_full(wd->content,
2735 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2736 _changed_size_hints, obj);
2737 edje_object_part_unswallow(wd->frm, wd->content);
2742 /* windowing spcific calls - shall we do this differently? */
2744 static Ecore_X_Window
2745 _elm_ee_win_get(const Evas_Object *obj)
2748 #ifdef HAVE_ELEMENTARY_X
2749 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2750 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2756 elm_win_xwindow_get(const Evas_Object *obj)
2762 type = elm_widget_type_get(obj);
2763 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
2764 win = elm_widget_data_get(obj);
2766 #ifdef HAVE_ELEMENTARY_X
2767 if (win->xwin) return win->xwin;
2768 if (win->parent) return elm_win_xwindow_get(win->parent);