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 int *autodel_clear, rot;
39 Eina_Bool visible : 1;
40 Eina_Bool handled : 1;
44 Ecore_Job *reconf_job;
46 Eina_Bool enabled : 1;
47 Eina_Bool changed_theme : 1;
48 Eina_Bool top_animate : 1;
49 Eina_Bool geometry_changed : 1;
53 static const char *widtype = NULL;
54 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
55 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
56 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
57 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
58 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
59 static void _elm_win_move(Ecore_Evas *ee);
60 static void _elm_win_resize(Ecore_Evas *ee);
61 static void _elm_win_delete_request(Ecore_Evas *ee);
62 static void _elm_win_resize_job(void *data);
63 #ifdef HAVE_ELEMENTARY_X
64 static void _elm_win_xwin_update(Elm_Win *win);
66 static void _elm_win_eval_subobjs(Evas_Object *obj);
67 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
68 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
69 static void _elm_win_focus_highlight_init(Elm_Win *win);
70 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
71 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
72 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
73 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
74 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
75 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
77 static const char SIG_DELETE_REQUEST[] = "delete,request";
78 static const char SIG_FOCUS_OUT[] = "focus,out";
79 static const char SIG_FOCUS_IN[] = "focus,in";
80 static const char SIG_MOVED[] = "moved";
82 static const Evas_Smart_Cb_Description _signals[] = {
83 {SIG_DELETE_REQUEST, ""},
92 Eina_List *_elm_win_list = NULL;
93 int _elm_win_deferred_free = 0;
95 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
96 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
99 _shot_delay_get(Elm_Win *win)
102 char *d = strdup(win->shot.info);
105 for (p = (char *)win->shot.info; *p; p++)
107 if (!strncmp(p, "delay=", 6))
111 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
126 _shot_file_get(Elm_Win *win)
129 char *tmp = strdup(win->shot.info);
130 char *repname = NULL;
132 if (!tmp) return NULL;
134 for (p = (char *)win->shot.info; *p; p++)
136 if (!strncmp(p, "file=", 5))
139 if (!win->shot.repeat_count) return tmp;
142 char *dotptr = strrchr(tmp, '.');
145 repname = malloc(sizeof(char)*(strlen(tmp) + 16));
146 strncpy(repname, tmp, dotptr - tmp);
147 sprintf(repname + (dotptr - tmp), "%03i",
148 win->shot.shot_counter + 1);
149 strcat(repname, dotptr);
157 if (!win->shot.repeat_count) return strdup("out.png");
160 repname = malloc(sizeof(char) * 24);
161 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
167 _shot_repeat_count_get(Elm_Win *win)
171 char *d = strdup(win->shot.info);
174 for (p = (char *)win->shot.info; *p; p++)
176 if (!strncmp(p, "repeat=", 7))
180 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
187 if (v > 1000) v = 999;
197 _shot_key_get(Elm_Win *win __UNUSED__)
203 _shot_flags_get(Elm_Win *win __UNUSED__)
209 _shot_do(Elm_Win *win)
213 unsigned int *pixels;
215 char *file, *key, *flags;
217 ecore_evas_manual_render(win->ee);
218 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
220 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
221 if ((w < 1) || (h < 1)) return;
222 file = _shot_file_get(win);
224 key = _shot_key_get(win);
225 flags = _shot_flags_get(win);
226 ee = ecore_evas_buffer_new(1, 1);
227 o = evas_object_image_add(ecore_evas_get(ee));
228 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
229 evas_object_image_size_set(o, w, h);
230 evas_object_image_data_set(o, pixels);
231 if (!evas_object_image_save(o, file, key, flags))
233 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
238 if (flags) free(flags);
240 if (win->shot.repeat_count) win->shot.shot_counter++;
244 _shot_delay(void *data)
248 if (win->shot.repeat_count)
250 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
251 if (remainshot > 0) return EINA_TRUE;
253 win->shot.timer = NULL;
259 _shot_init(Elm_Win *win)
261 if (!win->shot.info) return;
262 win->shot.repeat_count = _shot_repeat_count_get(win);
263 win->shot.shot_counter = 0;
267 _shot_handle(Elm_Win *win)
269 if (!win->shot.info) return;
270 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
274 _elm_win_move(Ecore_Evas *ee)
276 Evas_Object *obj = ecore_evas_object_associate_get(ee);
281 win = elm_widget_data_get(obj);
283 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
286 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
290 _elm_win_resize(Ecore_Evas *ee)
292 Evas_Object *obj = ecore_evas_object_associate_get(ee);
296 win = elm_widget_data_get(obj);
298 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
299 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
303 _elm_win_focus_in(Ecore_Evas *ee)
305 Evas_Object *obj = ecore_evas_object_associate_get(ee);
309 win = elm_widget_data_get(obj);
311 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
312 if (win->show_count == 1)
314 elm_object_focus_set(win->win_obj, EINA_TRUE);
318 elm_widget_focus_restore(win->win_obj);
319 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
320 win->focus_highlight.cur.visible = EINA_TRUE;
321 _elm_win_focus_highlight_reconfigure_job_start(win);
325 else if (win->img_obj)
332 _elm_win_focus_out(Ecore_Evas *ee)
334 Evas_Object *obj = ecore_evas_object_associate_get(ee);
338 win = elm_widget_data_get(obj);
340 elm_object_focus_set(win->win_obj, EINA_FALSE);
341 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
342 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
343 win->focus_highlight.cur.visible = EINA_FALSE;
344 _elm_win_focus_highlight_reconfigure_job_start(win);
348 else if (win->img_obj)
355 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
357 Elm_Win *wd = elm_widget_data_get(obj);
358 const Eina_List *items;
359 void *(*list_data_get) (const Eina_List *list);
367 if (!(items = elm_widget_focus_custom_chain_get(obj)))
373 list_data_get = eina_list_data_get;
375 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
381 *next = (Evas_Object *)obj;
386 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
388 Elm_Win *win = elm_widget_data_get(obj);
392 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
394 evas_object_focus_set(obj, elm_widget_focus_get(obj));
398 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
400 if (type == EVAS_CALLBACK_KEY_DOWN)
402 Evas_Event_Key_Down *ev = event_info;
403 if (!strcmp(ev->keyname, "Tab"))
405 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
406 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
408 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
409 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
412 else if ((!strcmp(ev->keyname, "Left")) ||
413 (!strcmp(ev->keyname, "KP_Left")))
415 //TODO : woohyun jung
417 else if ((!strcmp(ev->keyname, "Right")) ||
418 (!strcmp(ev->keyname, "KP_Right")))
420 //TODO : woohyun jung
422 else if ((!strcmp(ev->keyname, "Up")) ||
423 (!strcmp(ev->keyname, "KP_Up")))
425 //TODO : woohyun jung
427 else if ((!strcmp(ev->keyname, "Down")) ||
428 (!strcmp(ev->keyname, "KP_Down")))
430 //TODO : woohyun jung
438 _deferred_ecore_evas_free(void *data)
440 ecore_evas_free(data);
441 _elm_win_deferred_free--;
445 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
449 if (!win->show_count) win->show_count++;
450 if (win->shot.info) _shot_handle(win);
454 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
461 else if (win->img_obj)
463 evas_object_hide(win->img_obj);
468 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
475 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
476 _elm_win_obj_callback_parent_del, win);
479 if (win->autodel_clear) *(win->autodel_clear) = -1;
480 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
481 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
484 ecore_evas_callback_delete_request_set(win->ee, NULL);
485 ecore_evas_callback_resize_set(win->ee, NULL);
487 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
488 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
489 if (win->shot.info) eina_stringshare_del(win->shot.info);
490 if (win->shot.timer) ecore_timer_del(win->shot.timer);
491 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
492 _elm_win_obj_callback_del, win);
493 while (((child = evas_object_bottom_get(win->evas))) &&
496 evas_object_del(child);
498 while (((child = evas_object_top_get(win->evas))) &&
501 evas_object_del(child);
503 #ifdef HAVE_ELEMENTARY_X
504 if (win->client_message_handler)
505 ecore_event_handler_del(win->client_message_handler);
507 // FIXME: Why are we flushing edje on every window destroy ??
508 // edje_file_cache_flush();
509 // edje_collection_cache_flush();
510 // evas_image_cache_flush(win->evas);
511 // evas_font_cache_flush(win->evas);
512 // FIXME: we are in the del handler for the object and delete the canvas
513 // that lives under it from the handler... nasty. deferring doesn't help either
523 ecore_job_add(_deferred_ecore_evas_free, win->ee);
524 _elm_win_deferred_free++;
528 _elm_win_focus_highlight_shutdown(win);
529 eina_stringshare_del(win->focus_highlight.style);
533 if ((!_elm_win_list) &&
534 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
536 edje_file_cache_flush();
537 edje_collection_cache_flush();
538 evas_image_cache_flush(e);
539 evas_font_cache_flush(e);
545 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
548 if (!win->img_obj) return;
549 evas_object_event_callback_del_full
550 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
551 evas_object_del(win->img_obj);
555 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
558 if (obj == win->parent) win->parent = NULL;
562 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
568 if ((x != win->screen.x) || (y != win->screen.y))
572 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
577 evas_object_move(obj, x, y);
582 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
585 // this is called to make sure all smart containers have calculated their
586 // sizes BEFORE we show the window to make sure it initially appears at
587 // our desired size (ie min size is known first)
588 evas_smart_objects_calculate(evas_object_evas_get(obj));
589 evas_object_show(obj);
593 else if (win->img_obj)
595 evas_object_show(win->img_obj);
600 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
604 if (ecore_evas_override_get(win->ee))
608 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
611 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
616 else if (win->img_obj)
620 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
623 // evas_object_move(win->img_obj, x, y);
628 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
635 else if (win->img_obj)
637 Evas_Coord w = 1, h = 1;
639 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
642 evas_object_image_size_set(win->img_obj, w, h);
647 _elm_win_delete_request(Ecore_Evas *ee)
649 Evas_Object *obj = ecore_evas_object_associate_get(ee);
651 if (strcmp(elm_widget_type_get(obj), "win")) return;
653 win = elm_widget_data_get(obj);
655 int autodel = win->autodel;
656 win->autodel_clear = &autodel;
657 evas_object_ref(win->win_obj);
658 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
659 // FIXME: if above callback deletes - then the below will be invalid
660 if (autodel) evas_object_del(win->win_obj);
661 else win->autodel_clear = NULL;
662 evas_object_unref(win->win_obj);
666 _elm_win_resize_job(void *data)
673 win->deferred_resize_job = NULL;
674 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
675 evas_object_resize(win->win_obj, w, h);
679 else if (win->img_obj)
682 EINA_LIST_FOREACH(win->subobjs, l, obj)
684 evas_object_move(obj, 0, 0);
685 evas_object_resize(obj, w, h);
689 #ifdef HAVE_ELEMENTARY_X
691 _elm_win_xwindow_get(Elm_Win *win)
695 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
696 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
698 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
700 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
701 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
702 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
703 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
704 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
705 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
706 ENGINE_COMPARE(ELM_OPENGL_COCOA))
709 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
711 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
713 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
715 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
718 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
720 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
723 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
725 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
727 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
729 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
731 #undef ENGINE_COMPARE
735 #ifdef HAVE_ELEMENTARY_X
737 _elm_win_xwin_update(Elm_Win *win)
739 _elm_win_xwindow_get(win);
744 win2 = elm_widget_data_get(win->parent);
748 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
752 if (!win->xwin) return; /* nothing more to do */
757 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
759 case ELM_WIN_DIALOG_BASIC:
760 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
762 case ELM_WIN_DESKTOP:
763 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
766 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
768 case ELM_WIN_TOOLBAR:
769 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
772 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
774 case ELM_WIN_UTILITY:
775 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
778 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
780 case ELM_WIN_DROPDOWN_MENU:
781 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
783 case ELM_WIN_POPUP_MENU:
784 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
786 case ELM_WIN_TOOLTIP:
787 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
789 case ELM_WIN_NOTIFICATION:
790 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
793 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
796 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
801 ecore_x_e_virtual_keyboard_state_set
802 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
807 _elm_win_eval_subobjs(Evas_Object *obj)
810 const Evas_Object *child;
812 Elm_Win *win = elm_widget_data_get(obj);
813 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
817 EINA_LIST_FOREACH(win->subobjs, l, child)
819 evas_object_size_hint_weight_get(child, &wx, &wy);
820 if (wx == 0.0) xx = 0;
821 if (wy == 0.0) xy = 0;
823 evas_object_size_hint_min_get(child, &w, &h);
826 if (w > minw) minw = w;
827 if (h > minh) minh = h;
829 evas_object_size_hint_max_get(child, &w, &h);
832 if (maxw == -1) maxw = w;
833 else if ((w > 0) && (w < maxw)) maxw = w;
834 if (maxh == -1) maxh = h;
835 else if ((h > 0) && (h < maxh)) maxh = h;
837 if (!xx) maxw = minw;
839 if (!xy) maxh = minh;
841 evas_object_size_hint_min_set(obj, minw, minh);
842 evas_object_size_hint_max_set(obj, maxw, maxh);
843 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
844 if (w < minw) w = minw;
845 if (h < minh) h = minh;
846 if ((maxw >= 0) && (w > maxw)) w = maxw;
847 if ((maxh >= 0) && (h > maxh)) h = maxh;
848 evas_object_resize(obj, w, h);
852 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
854 Elm_Win *win = elm_widget_data_get(data);
855 win->subobjs = eina_list_remove(win->subobjs, obj);
856 _elm_win_eval_subobjs(win->win_obj);
860 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
862 _elm_win_eval_subobjs(data);
866 _elm_win_shutdown(void)
868 while (_elm_win_list)
869 evas_object_del(_elm_win_list->data);
873 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
880 EINA_LIST_FOREACH(_elm_win_list, l, obj)
881 elm_widget_theme(obj);
885 EINA_LIST_FOREACH(_elm_win_list, l, obj)
886 elm_widget_theme_specific(obj, th, EINA_FALSE);
891 _elm_win_translate(void)
896 EINA_LIST_FOREACH(_elm_win_list, l, obj)
897 elm_widget_translate(obj);
900 #ifdef HAVE_ELEMENTARY_X
902 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
905 Ecore_X_Event_Client_Message *e = event;
907 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
908 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
910 if ((unsigned)e->data.l[0] == win->xwin)
912 Evas *evas = evas_object_evas_get(win->win_obj);
915 edje_file_cache_flush();
916 edje_collection_cache_flush();
917 evas_image_cache_flush(evas);
918 evas_font_cache_flush(evas);
922 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
924 if ((unsigned)e->data.l[0] == win->xwin)
926 Evas *evas = evas_object_evas_get(win->win_obj);
929 edje_file_cache_flush();
930 edje_collection_cache_flush();
931 evas_image_cache_flush(evas);
932 evas_font_cache_flush(evas);
933 evas_render_dump(evas);
937 return ECORE_CALLBACK_PASS_ON;
942 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
946 win->focus_highlight.geometry_changed = EINA_TRUE;
947 _elm_win_focus_highlight_reconfigure_job_start(win);
951 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
955 win->focus_highlight.geometry_changed = EINA_TRUE;
956 _elm_win_focus_highlight_reconfigure_job_start(win);
960 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
964 win->focus_highlight.cur.target = NULL;
966 _elm_win_focus_highlight_reconfigure_job_start(win);
970 _elm_win_focus_target_callbacks_add(Elm_Win *win)
972 Evas_Object *obj = win->focus_highlight.cur.target;
974 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
975 _elm_win_focus_target_move, win);
976 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
977 _elm_win_focus_target_resize, win);
978 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
979 _elm_win_focus_target_del, win);
983 _elm_win_focus_target_callbacks_del(Elm_Win *win)
985 Evas_Object *obj = win->focus_highlight.cur.target;
987 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
988 _elm_win_focus_target_move, win);
989 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
990 _elm_win_focus_target_resize, win);
991 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
992 _elm_win_focus_target_del, win);
996 _elm_win_focus_target_get(Evas_Object *obj)
998 Evas_Object *o = obj;
1002 if (elm_widget_is(o))
1004 if (!elm_widget_highlight_ignore_get(o))
1006 o = elm_widget_parent_get(o);
1008 o = evas_object_smart_parent_get(o);
1012 o = elm_widget_parent_widget_get(o);
1014 o = evas_object_smart_parent_get(o);
1023 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1025 Evas_Object *obj = event_info, *target;
1026 Elm_Win *win = data;
1028 if (win->focus_highlight.cur.target == obj)
1031 target = _elm_win_focus_target_get(obj);
1032 win->focus_highlight.cur.target = target;
1033 if (elm_widget_highlight_in_theme_get(target))
1034 win->focus_highlight.cur.handled = EINA_TRUE;
1036 _elm_win_focus_target_callbacks_add(win);
1038 _elm_win_focus_highlight_reconfigure_job_start(win);
1042 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1044 Elm_Win *win = data;
1046 if (!win->focus_highlight.cur.target)
1049 if (!win->focus_highlight.cur.handled)
1050 _elm_win_focus_target_callbacks_del(win);
1051 win->focus_highlight.cur.target = NULL;
1052 win->focus_highlight.cur.handled = EINA_FALSE;
1054 _elm_win_focus_highlight_reconfigure_job_start(win);
1058 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1060 evas_object_hide(obj);
1064 _elm_win_focus_highlight_init(Elm_Win *win)
1066 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1067 _elm_win_object_focus_in, win);
1068 evas_event_callback_add(win->evas,
1069 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1070 _elm_win_object_focus_out, win);
1072 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1074 win->focus_highlight.top = edje_object_add(win->evas);
1075 win->focus_highlight.changed_theme = EINA_TRUE;
1076 edje_object_signal_callback_add(win->focus_highlight.top,
1077 "elm,action,focus,hide,end", "",
1078 _elm_win_focus_highlight_hide, NULL);
1079 edje_object_signal_callback_add(win->focus_highlight.top,
1080 "elm,action,focus,anim,end", "",
1081 _elm_win_focus_highlight_anim_end, win);
1082 _elm_win_focus_highlight_reconfigure_job_start(win);
1086 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1088 _elm_win_focus_highlight_reconfigure_job_stop(win);
1089 if (win->focus_highlight.cur.target)
1091 _elm_win_focus_target_callbacks_del(win);
1092 win->focus_highlight.cur.target = NULL;
1094 if (win->focus_highlight.top)
1096 evas_object_del(win->focus_highlight.top);
1097 win->focus_highlight.top = NULL;
1100 evas_event_callback_del_full(win->evas,
1101 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1102 _elm_win_object_focus_in, win);
1103 evas_event_callback_del_full(win->evas,
1104 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1105 _elm_win_object_focus_out, win);
1109 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1113 top = win->focus_highlight.top;
1118 evas_object_show(top);
1119 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1125 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1130 _elm_win_focus_highlight_reconfigure_job(void *data)
1132 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1136 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1138 if (win->focus_highlight.reconf_job)
1139 ecore_job_del(win->focus_highlight.reconf_job);
1140 win->focus_highlight.reconf_job = ecore_job_add(
1141 _elm_win_focus_highlight_reconfigure_job, win);
1145 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1147 if (win->focus_highlight.reconf_job)
1148 ecore_job_del(win->focus_highlight.reconf_job);
1149 win->focus_highlight.reconf_job = NULL;
1153 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1155 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1156 Evas_Coord x, y, w, h;
1158 clip = evas_object_clip_get(target);
1159 evas_object_geometry_get(target, &x, &y, &w, &h);
1161 evas_object_move(obj, x, y);
1162 evas_object_resize(obj, w, h);
1163 evas_object_clip_set(obj, clip);
1167 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1169 Evas_Coord tx, ty, tw, th;
1170 Evas_Coord w, h, px, py, pw, ph;
1171 Edje_Message_Int_Set *m;
1172 Evas_Object *previous = win->focus_highlight.prev.target;
1173 Evas_Object *target = win->focus_highlight.cur.target;
1175 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1176 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1177 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1178 evas_object_move(obj, 0, 0);
1179 evas_object_resize(obj, tw, th);
1180 evas_object_clip_unset(obj);
1182 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1192 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1196 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1198 Elm_Win *win = data;
1199 _elm_win_focus_highlight_simple_setup(win, obj);
1203 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1205 Evas_Object *target = win->focus_highlight.cur.target;
1206 Evas_Object *previous = win->focus_highlight.prev.target;
1207 Evas_Object *top = win->focus_highlight.top;
1208 Eina_Bool visible_changed;
1209 Eina_Bool common_visible;
1210 const char *sig = NULL;
1212 _elm_win_focus_highlight_reconfigure_job_stop(win);
1214 visible_changed = (win->focus_highlight.cur.visible !=
1215 win->focus_highlight.prev.visible);
1217 if ((target == previous) && (!visible_changed) &&
1218 (!win->focus_highlight.geometry_changed))
1221 if ((previous) && (win->focus_highlight.prev.handled))
1222 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1225 common_visible = EINA_FALSE;
1226 else if (win->focus_highlight.cur.handled)
1228 common_visible = EINA_FALSE;
1229 if (win->focus_highlight.cur.visible)
1230 sig = "elm,action,focus_highlight,show";
1232 sig = "elm,action,focus_highlight,hide";
1235 common_visible = win->focus_highlight.cur.visible;
1237 _elm_win_focus_highlight_visible_set(win, common_visible);
1239 elm_widget_signal_emit(target, sig, "elm");
1241 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1244 if (win->focus_highlight.changed_theme)
1247 if (win->focus_highlight.style)
1248 str = win->focus_highlight.style;
1251 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1253 win->focus_highlight.changed_theme = EINA_FALSE;
1255 if (_elm_config->focus_highlight_animate)
1257 str = edje_object_data_get(win->focus_highlight.top, "animate");
1258 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1262 if ((win->focus_highlight.top_animate) && (previous) &&
1263 (!win->focus_highlight.prev.handled))
1264 _elm_win_focus_highlight_anim_setup(win, top);
1266 _elm_win_focus_highlight_simple_setup(win, top);
1267 evas_object_raise(top);
1270 win->focus_highlight.geometry_changed = EINA_FALSE;
1271 win->focus_highlight.prev = win->focus_highlight.cur;
1276 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1278 Evas_Event_Key_Down *ev = event_info;
1280 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1284 if ((strcmp(ev->keyname, "F12")) ||
1285 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1288 printf("Tree graph generated.\n");
1289 elm_object_tree_dot_dump(obj, "./dump.dot");
1294 _win_img_hide(void *data,
1296 Evas_Object *obj __UNUSED__,
1297 void *event_info __UNUSED__)
1299 Elm_Win *win = data;
1301 elm_widget_focus_hide_handle(win->win_obj);
1305 _win_img_mouse_up(void *data,
1307 Evas_Object *obj __UNUSED__,
1310 Elm_Win *win = data;
1311 Evas_Event_Mouse_Up *ev = event_info;
1312 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1313 elm_widget_focus_mouse_up_handle(win->win_obj);
1317 _win_img_focus_in(void *data,
1319 Evas_Object *obj __UNUSED__,
1320 void *event_info __UNUSED__)
1322 Elm_Win *win = data;
1323 elm_widget_focus_steal(win->win_obj);
1327 _win_img_focus_out(void *data,
1329 Evas_Object *obj __UNUSED__,
1330 void *event_info __UNUSED__)
1332 Elm_Win *win = data;
1333 elm_widget_focused_object_clear(win->win_obj);
1337 _win_inlined_image_set(Elm_Win *win)
1339 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1340 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1341 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1342 _elm_win_obj_callback_img_obj_del, win);
1344 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1345 _win_img_hide, win);
1346 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1347 _win_img_mouse_up, win);
1348 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1349 _win_img_focus_in, win);
1350 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1351 _win_img_focus_out, win);
1355 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1359 const char *fontpath;
1361 win = ELM_NEW(Elm_Win);
1363 #define FALLBACK_TRY(engine) \
1366 CRITICAL(engine " engine creation failed. Trying default."); \
1367 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1369 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1371 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1375 case ELM_WIN_INLINED_IMAGE:
1378 Evas *e = evas_object_evas_get(parent);
1381 ee = ecore_evas_ecore_evas_get(e);
1383 win->img_obj = ecore_evas_object_image_new(ee);
1384 if (!win->img_obj) break;
1385 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1388 _win_inlined_image_set(win);
1391 evas_object_del(win->img_obj);
1392 win->img_obj = NULL;
1396 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1398 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1399 #ifdef HAVE_ELEMENTARY_X
1400 win->client_message_handler = ecore_event_handler_add
1401 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1403 FALLBACK_TRY("Sofware X11");
1405 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1407 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1408 FALLBACK_TRY("Sofware FB");
1410 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1412 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1413 FALLBACK_TRY("Sofware DirectFB");
1415 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1417 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1418 FALLBACK_TRY("Sofware-16");
1419 #ifdef HAVE_ELEMENTARY_X
1420 win->client_message_handler = ecore_event_handler_add
1421 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1424 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1426 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1427 FALLBACK_TRY("Sofware-8");
1428 #ifdef HAVE_ELEMENTARY_X
1429 win->client_message_handler = ecore_event_handler_add
1430 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1434 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1436 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1437 FALLBACK_TRY("XRender");
1438 #ifdef HAVE_ELEMENTARY_X
1439 win->client_message_handler = ecore_event_handler_add
1440 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1444 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1449 if (_elm_config->vsync)
1451 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1457 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1459 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1460 FALLBACK_TRY("OpenGL");
1461 #ifdef HAVE_ELEMENTARY_X
1462 win->client_message_handler = ecore_event_handler_add
1463 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1466 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1468 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1469 FALLBACK_TRY("Sofware Win32");
1471 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1473 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1474 FALLBACK_TRY("Sofware-16-WinCE");
1476 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1478 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1479 FALLBACK_TRY("PSL1GHT");
1481 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1483 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1484 FALLBACK_TRY("Sofware SDL");
1486 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1488 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1489 FALLBACK_TRY("Sofware-16-SDL");
1491 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1493 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1494 FALLBACK_TRY("OpenGL SDL");
1496 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1498 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1499 FALLBACK_TRY("OpenGL Cocoa");
1501 else if (ENGINE_COMPARE(ELM_BUFFER))
1503 win->ee = ecore_evas_buffer_new(1, 1);
1505 else if (ENGINE_COMPARE(ELM_EWS))
1507 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1509 else if (!strncmp(_elm_config->engine, "shot:", 5))
1511 win->ee = ecore_evas_buffer_new(1, 1);
1512 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1513 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1522 ERR("Cannot create window.");
1526 #ifdef HAVE_ELEMENTARY_X
1527 _elm_win_xwindow_get(win);
1529 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1530 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1531 // bg pixmap done by x - has other issues like can be redrawn by x before it
1532 // is filled/ready by app
1533 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1536 win->parent = parent;
1538 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1539 _elm_win_obj_callback_parent_del, win);
1541 win->evas = ecore_evas_get(win->ee);
1542 win->win_obj = elm_widget_add(win->evas);
1543 elm_widget_type_set(win->win_obj, "win");
1544 ELM_SET_WIDTYPE(widtype, "win");
1545 elm_widget_data_set(win->win_obj, win);
1546 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1547 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1548 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1549 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1550 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1551 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1552 evas_object_move(win->win_obj, 0, 0);
1553 evas_object_resize(win->win_obj, 1, 1);
1554 evas_object_layer_set(win->win_obj, 50);
1555 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1557 ecore_evas_object_associate(win->ee, win->win_obj,
1558 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1559 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1560 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1561 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1562 _elm_win_obj_callback_show, win);
1563 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1564 _elm_win_obj_callback_hide, win);
1565 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1566 _elm_win_obj_callback_del, win);
1567 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1568 _elm_win_obj_callback_move, win);
1569 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1570 _elm_win_obj_callback_resize, win);
1572 evas_object_intercept_move_callback_add(win->win_obj,
1573 _elm_win_obj_intercept_move, win);
1574 evas_object_intercept_show_callback_add(win->win_obj,
1575 _elm_win_obj_intercept_show, win);
1577 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1578 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1579 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1580 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1581 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1582 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1583 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1584 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1585 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1586 evas_font_path_append(win->evas, fontpath);
1587 if (!_elm_config->font_hinting)
1588 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1589 else if (_elm_config->font_hinting == 1)
1590 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1591 else if (_elm_config->font_hinting == 2)
1592 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1594 #ifdef HAVE_ELEMENTARY_X
1595 _elm_win_xwin_update(win);
1598 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1600 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1602 ecore_evas_fullscreen_set(win->ee, 1);
1604 #undef ENGINE_COMPARE
1606 if (_elm_config->focus_highlight_enable)
1607 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1610 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1611 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1612 _debug_key_down, win);
1614 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1616 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1619 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1621 return win->win_obj;
1625 elm_win_util_standard_add(const char *name, const char *title)
1627 Evas_Object *win, *bg;
1629 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1630 if (!win) return NULL;
1631 elm_win_title_set(win, title);
1632 bg = elm_bg_add(win);
1635 evas_object_del(win);
1638 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1639 elm_win_resize_object_add(win, bg);
1640 evas_object_show(bg);
1645 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1649 ELM_CHECK_WIDTYPE(obj, widtype);
1650 win = elm_widget_data_get(obj);
1652 if (eina_list_data_find(win->subobjs, subobj)) return;
1653 win->subobjs = eina_list_append(win->subobjs, subobj);
1654 elm_widget_sub_object_add(obj, subobj);
1655 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1656 _elm_win_subobj_callback_del, obj);
1657 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1658 _elm_win_subobj_callback_changed_size_hints,
1660 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1661 evas_object_move(subobj, 0, 0);
1662 evas_object_resize(subobj, w, h);
1663 _elm_win_eval_subobjs(obj);
1667 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1670 ELM_CHECK_WIDTYPE(obj, widtype);
1671 win = elm_widget_data_get(obj);
1673 evas_object_event_callback_del_full(subobj,
1674 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1675 _elm_win_subobj_callback_changed_size_hints,
1677 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1678 _elm_win_subobj_callback_del, obj);
1679 win->subobjs = eina_list_remove(win->subobjs, subobj);
1680 elm_widget_sub_object_del(obj, subobj);
1681 _elm_win_eval_subobjs(obj);
1685 elm_win_title_set(Evas_Object *obj, const char *title)
1688 ELM_CHECK_WIDTYPE(obj, widtype);
1689 win = elm_widget_data_get(obj);
1691 ecore_evas_title_set(win->ee, title);
1695 elm_win_title_get(const Evas_Object *obj)
1698 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1699 win = elm_widget_data_get(obj);
1700 if (!win) return NULL;
1701 return ecore_evas_title_get(win->ee);
1705 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1708 ELM_CHECK_WIDTYPE(obj, widtype);
1709 win = elm_widget_data_get(obj);
1711 win->autodel = autodel;
1715 elm_win_autodel_get(const Evas_Object *obj)
1718 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1719 win = elm_widget_data_get(obj);
1720 if (!win) return EINA_FALSE;
1721 return win->autodel;
1725 elm_win_activate(Evas_Object *obj)
1728 ELM_CHECK_WIDTYPE(obj, widtype);
1729 win = elm_widget_data_get(obj);
1731 ecore_evas_activate(win->ee);
1735 elm_win_lower(Evas_Object *obj)
1738 ELM_CHECK_WIDTYPE(obj, widtype);
1739 win = elm_widget_data_get(obj);
1741 ecore_evas_lower(win->ee);
1745 elm_win_raise(Evas_Object *obj)
1748 ELM_CHECK_WIDTYPE(obj, widtype);
1749 win = elm_widget_data_get(obj);
1751 ecore_evas_raise(win->ee);
1755 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1758 ELM_CHECK_WIDTYPE(obj, widtype);
1759 win = elm_widget_data_get(obj);
1761 ecore_evas_borderless_set(win->ee, borderless);
1762 #ifdef HAVE_ELEMENTARY_X
1763 _elm_win_xwin_update(win);
1768 elm_win_borderless_get(const Evas_Object *obj)
1771 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1772 win = elm_widget_data_get(obj);
1773 if (!win) return EINA_FALSE;
1774 return ecore_evas_borderless_get(win->ee);
1778 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1781 ELM_CHECK_WIDTYPE(obj, widtype);
1782 win = elm_widget_data_get(obj);
1784 ecore_evas_shaped_set(win->ee, shaped);
1785 #ifdef HAVE_ELEMENTARY_X
1786 _elm_win_xwin_update(win);
1791 elm_win_shaped_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;
1797 return ecore_evas_shaped_get(win->ee);
1801 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1804 ELM_CHECK_WIDTYPE(obj, widtype);
1805 win = elm_widget_data_get(obj);
1810 else if (win->img_obj)
1812 evas_object_image_alpha_set(win->img_obj, alpha);
1816 #ifdef HAVE_ELEMENTARY_X
1821 if (!_elm_config->compositing)
1822 elm_win_shaped_set(obj, alpha);
1824 ecore_evas_alpha_set(win->ee, alpha);
1827 ecore_evas_alpha_set(win->ee, alpha);
1828 _elm_win_xwin_update(win);
1832 ecore_evas_alpha_set(win->ee, alpha);
1837 elm_win_alpha_get(const Evas_Object *obj)
1840 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1841 win = elm_widget_data_get(obj);
1842 if (!win) return EINA_FALSE;
1843 return ecore_evas_alpha_get(win->ee);
1847 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1850 ELM_CHECK_WIDTYPE(obj, widtype);
1851 win = elm_widget_data_get(obj);
1857 else if (win->img_obj)
1859 evas_object_image_alpha_set(win->img_obj, transparent);
1863 #ifdef HAVE_ELEMENTARY_X
1866 ecore_evas_transparent_set(win->ee, transparent);
1867 _elm_win_xwin_update(win);
1871 ecore_evas_transparent_set(win->ee, transparent);
1876 elm_win_transparent_get(const Evas_Object *obj)
1879 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1880 win = elm_widget_data_get(obj);
1881 if (!win) return EINA_FALSE;
1883 return ecore_evas_transparent_get(win->ee);
1887 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1890 ELM_CHECK_WIDTYPE(obj, widtype);
1891 win = elm_widget_data_get(obj);
1893 ecore_evas_override_set(win->ee, override);
1894 #ifdef HAVE_ELEMENTARY_X
1895 _elm_win_xwin_update(win);
1900 elm_win_override_get(const Evas_Object *obj)
1903 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1904 win = elm_widget_data_get(obj);
1905 if (!win) return EINA_FALSE;
1906 return ecore_evas_override_get(win->ee);
1910 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1913 ELM_CHECK_WIDTYPE(obj, widtype);
1914 win = elm_widget_data_get(obj);
1917 // YYY: handle if win->img_obj
1918 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1919 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1920 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1922 // these engines... can ONLY be fullscreen
1927 ecore_evas_fullscreen_set(win->ee, fullscreen);
1928 #ifdef HAVE_ELEMENTARY_X
1929 _elm_win_xwin_update(win);
1932 #undef ENGINE_COMPARE
1936 elm_win_fullscreen_get(const Evas_Object *obj)
1939 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1940 win = elm_widget_data_get(obj);
1941 if (!win) return EINA_FALSE;
1943 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1944 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1945 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1947 // these engines... can ONLY be fullscreen
1952 return ecore_evas_fullscreen_get(win->ee);
1954 #undef ENGINE_COMPARE
1958 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1961 ELM_CHECK_WIDTYPE(obj, widtype);
1962 win = elm_widget_data_get(obj);
1964 // YYY: handle if win->img_obj
1965 ecore_evas_maximized_set(win->ee, maximized);
1966 #ifdef HAVE_ELEMENTARY_X
1967 _elm_win_xwin_update(win);
1972 elm_win_maximized_get(const Evas_Object *obj)
1975 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1976 win = elm_widget_data_get(obj);
1977 if (!win) return EINA_FALSE;
1978 return ecore_evas_maximized_get(win->ee);
1982 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1985 ELM_CHECK_WIDTYPE(obj, widtype);
1986 win = elm_widget_data_get(obj);
1988 ecore_evas_iconified_set(win->ee, iconified);
1989 #ifdef HAVE_ELEMENTARY_X
1990 _elm_win_xwin_update(win);
1995 elm_win_iconified_get(const Evas_Object *obj)
1998 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1999 win = elm_widget_data_get(obj);
2000 if (!win) return EINA_FALSE;
2001 return ecore_evas_iconified_get(win->ee);
2005 elm_win_layer_set(Evas_Object *obj, int layer)
2008 ELM_CHECK_WIDTYPE(obj, widtype);
2009 win = elm_widget_data_get(obj);
2011 ecore_evas_layer_set(win->ee, layer);
2012 #ifdef HAVE_ELEMENTARY_X
2013 _elm_win_xwin_update(win);
2018 elm_win_layer_get(const Evas_Object *obj)
2021 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2022 win = elm_widget_data_get(obj);
2023 if (!win) return -1;
2024 return ecore_evas_layer_get(win->ee);
2028 elm_win_rotation_set(Evas_Object *obj, int rotation)
2031 ELM_CHECK_WIDTYPE(obj, widtype);
2032 win = elm_widget_data_get(obj);
2034 if (win->rot == rotation) return;
2035 win->rot = rotation;
2036 ecore_evas_rotation_set(win->ee, rotation);
2037 evas_object_size_hint_min_set(obj, -1, -1);
2038 evas_object_size_hint_max_set(obj, -1, -1);
2039 _elm_win_eval_subobjs(obj);
2040 #ifdef HAVE_ELEMENTARY_X
2041 _elm_win_xwin_update(win);
2046 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2049 ELM_CHECK_WIDTYPE(obj, widtype);
2050 win = elm_widget_data_get(obj);
2052 if (win->rot == rotation) return;
2053 win->rot = rotation;
2054 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2055 evas_object_size_hint_min_set(obj, -1, -1);
2056 evas_object_size_hint_max_set(obj, -1, -1);
2057 _elm_win_eval_subobjs(obj);
2058 #ifdef HAVE_ELEMENTARY_X
2059 _elm_win_xwin_update(win);
2064 elm_win_rotation_get(const Evas_Object *obj)
2067 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2068 win = elm_widget_data_get(obj);
2069 if (!win) return -1;
2074 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2077 ELM_CHECK_WIDTYPE(obj, widtype);
2078 win = elm_widget_data_get(obj);
2080 ecore_evas_sticky_set(win->ee, sticky);
2081 #ifdef HAVE_ELEMENTARY_X
2082 _elm_win_xwin_update(win);
2087 elm_win_sticky_get(const Evas_Object *obj)
2090 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2091 win = elm_widget_data_get(obj);
2092 if (!win) return EINA_FALSE;
2093 return ecore_evas_sticky_get(win->ee);
2097 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2100 ELM_CHECK_WIDTYPE(obj, widtype);
2101 win = elm_widget_data_get(obj);
2103 if (mode == win->kbdmode) return;
2104 #ifdef HAVE_ELEMENTARY_X
2105 _elm_win_xwindow_get(win);
2107 win->kbdmode = mode;
2108 #ifdef HAVE_ELEMENTARY_X
2110 ecore_x_e_virtual_keyboard_state_set
2111 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2115 EAPI Elm_Win_Keyboard_Mode
2116 elm_win_keyboard_mode_get(const Evas_Object *obj)
2119 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2120 win = elm_widget_data_get(obj);
2121 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2122 return win->kbdmode;
2126 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2129 ELM_CHECK_WIDTYPE(obj, widtype);
2130 win = elm_widget_data_get(obj);
2132 #ifdef HAVE_ELEMENTARY_X
2133 _elm_win_xwindow_get(win);
2135 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2142 elm_win_keyboard_win_get(const Evas_Object *obj)
2145 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2146 win = elm_widget_data_get(obj);
2147 if (!win) return EINA_FALSE;
2148 #ifdef HAVE_ELEMENTARY_X
2149 _elm_win_xwindow_get(win);
2151 return ecore_x_e_virtual_keyboard_get(win->xwin);
2157 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2160 ELM_CHECK_WIDTYPE(obj, widtype);
2161 win = elm_widget_data_get(obj);
2163 if (x) *x = win->screen.x;
2164 if (y) *y = win->screen.y;
2168 elm_win_focus_get(const Evas_Object *obj)
2171 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2172 win = elm_widget_data_get(obj);
2173 if (!win) return EINA_FALSE;
2174 return ecore_evas_focus_get(win->ee);
2178 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2181 ELM_CHECK_WIDTYPE(obj, widtype);
2182 win = elm_widget_data_get(obj);
2184 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2188 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2191 ELM_CHECK_WIDTYPE(obj, widtype);
2192 win = elm_widget_data_get(obj);
2194 #ifdef HAVE_ELEMENTARY_X
2195 _elm_win_xwindow_get(win);
2197 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2204 elm_win_conformant_get(const Evas_Object *obj)
2207 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2208 win = elm_widget_data_get(obj);
2209 if (!win) return EINA_FALSE;
2210 #ifdef HAVE_ELEMENTARY_X
2211 _elm_win_xwindow_get(win);
2213 return ecore_x_e_illume_conformant_get(win->xwin);
2219 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2222 ELM_CHECK_WIDTYPE(obj, widtype);
2223 win = elm_widget_data_get(obj);
2225 #ifdef HAVE_ELEMENTARY_X
2226 _elm_win_xwindow_get(win);
2229 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2232 Ecore_X_Window_State states[2];
2234 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2235 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2236 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2237 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2246 elm_win_quickpanel_get(const Evas_Object *obj)
2249 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2250 win = elm_widget_data_get(obj);
2251 if (!win) return EINA_FALSE;
2252 #ifdef HAVE_ELEMENTARY_X
2253 _elm_win_xwindow_get(win);
2255 return ecore_x_e_illume_quickpanel_get(win->xwin);
2261 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2264 ELM_CHECK_WIDTYPE(obj, widtype);
2265 win = elm_widget_data_get(obj);
2267 #ifdef HAVE_ELEMENTARY_X
2268 _elm_win_xwindow_get(win);
2270 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2277 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2280 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2281 win = elm_widget_data_get(obj);
2282 if (!win) return -1;
2283 #ifdef HAVE_ELEMENTARY_X
2284 _elm_win_xwindow_get(win);
2286 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2292 elm_win_quickpanel_priority_minor_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_minor_set(win->xwin, priority);
2308 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2311 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2312 win = elm_widget_data_get(obj);
2313 if (!win) return -1;
2314 #ifdef HAVE_ELEMENTARY_X
2315 _elm_win_xwindow_get(win);
2317 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2323 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2326 ELM_CHECK_WIDTYPE(obj, widtype);
2327 win = elm_widget_data_get(obj);
2329 #ifdef HAVE_ELEMENTARY_X
2330 _elm_win_xwindow_get(win);
2332 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2339 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2342 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2343 win = elm_widget_data_get(obj);
2345 #ifdef HAVE_ELEMENTARY_X
2346 _elm_win_xwindow_get(win);
2348 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2354 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2357 ELM_CHECK_WIDTYPE(obj, widtype);
2358 win = elm_widget_data_get(obj);
2360 #ifdef HAVE_ELEMENTARY_X
2361 _elm_win_xwindow_get(win);
2366 Ecore_X_Window_State states[2];
2368 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2369 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2370 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2371 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2380 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2383 ELM_CHECK_WIDTYPE(obj, widtype);
2384 win = elm_widget_data_get(obj);
2386 #ifdef HAVE_ELEMENTARY_X
2387 _elm_win_xwindow_get(win);
2392 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2393 ecore_x_e_illume_focus_back_send(win->xwin);
2395 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2396 ecore_x_e_illume_focus_forward_send(win->xwin);
2398 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2399 ecore_x_e_illume_focus_home_send(win->xwin);
2401 case ELM_ILLUME_COMMAND_CLOSE:
2402 ecore_x_e_illume_close_send(win->xwin);
2414 elm_win_inlined_image_object_get(Evas_Object *obj)
2417 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2418 win = elm_widget_data_get(obj);
2419 if (!win) return NULL;
2420 return win->img_obj;
2424 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2428 ELM_CHECK_WIDTYPE(obj, widtype);
2430 win = elm_widget_data_get(obj);
2431 enabled = !!enabled;
2432 if (win->focus_highlight.enabled == enabled)
2435 win->focus_highlight.enabled = enabled;
2437 if (win->focus_highlight.enabled)
2438 _elm_win_focus_highlight_init(win);
2440 _elm_win_focus_highlight_shutdown(win);
2444 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2448 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2450 win = elm_widget_data_get(obj);
2451 return win->focus_highlight.enabled;
2455 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2459 ELM_CHECK_WIDTYPE(obj, widtype);
2461 win = elm_widget_data_get(obj);
2462 eina_stringshare_replace(&win->focus_highlight.style, style);
2463 win->focus_highlight.changed_theme = EINA_TRUE;
2464 _elm_win_focus_highlight_reconfigure_job_start(win);
2468 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2472 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2474 win = elm_widget_data_get(obj);
2475 return win->focus_highlight.style;
2479 elm_win_indicator_state_set(Evas_Object *obj, int show_state)
2482 if (strcmp(elm_widget_type_get(obj), "win")) return;
2483 win = elm_widget_data_get(obj);
2485 #ifdef HAVE_ELEMENTARY_X
2486 _elm_win_xwindow_get(win);
2488 return ecore_x_window_prop_property_set (win->xwin,
2489 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
2495 elm_win_indicator_state_get(Evas_Object *obj)
2498 if (strcmp(elm_widget_type_get(obj), "win")) return -1;
2499 win = elm_widget_data_get(obj);
2500 if (!win) return -1;
2501 #ifdef HAVE_ELEMENTARY_X
2502 _elm_win_xwindow_get(win);
2508 unsigned int *prop_data = NULL;
2510 ret = ecore_x_window_prop_property_get (win->xwin,
2511 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, (void *)&prop_data, &count);
2512 if( ret && prop_data )
2513 memcpy (&show, prop_data, sizeof (int));
2515 if (prop_data) free (prop_data);
2524 typedef struct _Widget_Data Widget_Data;
2529 Evas_Object *content;
2532 static void _del_hook(Evas_Object *obj);
2533 static void _theme_hook(Evas_Object *obj);
2534 static void _sizing_eval(Evas_Object *obj);
2535 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2536 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2538 static const char *widtype2 = NULL;
2541 _del_hook(Evas_Object *obj)
2543 Widget_Data *wd = elm_widget_data_get(obj);
2549 _theme_hook(Evas_Object *obj)
2551 Widget_Data *wd = elm_widget_data_get(obj);
2552 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2554 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2559 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2561 Widget_Data *wd = elm_widget_data_get(obj);
2566 /* Try Focus cycle in subitem */
2569 elm_widget_focus_next_get(wd->content, dir, next);
2574 *next = (Evas_Object *)obj;
2579 _sizing_eval(Evas_Object *obj)
2581 Widget_Data *wd = elm_widget_data_get(obj);
2582 Evas_Coord minw = -1, minh = -1;
2584 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2585 edje_object_size_min_calc(wd->frm, &minw, &minh);
2586 evas_object_size_hint_min_set(obj, minw, minh);
2587 evas_object_size_hint_max_set(obj, -1, -1);
2591 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2597 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2599 Widget_Data *wd = elm_widget_data_get(obj);
2600 Evas_Object *sub = event_info;
2601 if (sub == wd->content)
2603 evas_object_event_callback_del_full
2604 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2611 elm_win_inwin_add(Evas_Object *obj)
2617 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2618 win = elm_widget_data_get(obj);
2619 if (!win) return NULL;
2620 wd = ELM_NEW(Widget_Data);
2621 obj2 = elm_widget_add(win->evas);
2622 elm_widget_type_set(obj2, "inwin");
2623 ELM_SET_WIDTYPE(widtype2, "inwin");
2624 elm_widget_sub_object_add(obj, obj2);
2625 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2626 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2627 elm_win_resize_object_add(obj, obj2);
2629 elm_widget_data_set(obj2, wd);
2630 elm_widget_del_hook_set(obj2, _del_hook);
2631 elm_widget_theme_hook_set(obj2, _theme_hook);
2632 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2633 elm_widget_can_focus_set(obj2, EINA_TRUE);
2634 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2636 wd->frm = edje_object_add(win->evas);
2637 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2638 elm_widget_resize_object_set(obj2, wd->frm);
2640 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2647 elm_win_inwin_activate(Evas_Object *obj)
2649 ELM_CHECK_WIDTYPE(obj, widtype2);
2650 Widget_Data *wd = elm_widget_data_get(obj);
2652 evas_object_raise(obj);
2653 evas_object_show(obj);
2654 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2655 elm_object_focus_set(obj, EINA_TRUE);
2659 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2661 ELM_CHECK_WIDTYPE(obj, widtype2);
2662 Widget_Data *wd = elm_widget_data_get(obj);
2664 if (wd->content == content) return;
2665 if (wd->content) evas_object_del(wd->content);
2666 wd->content = content;
2669 elm_widget_sub_object_add(obj, content);
2670 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2671 _changed_size_hints, obj);
2672 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2678 elm_win_inwin_content_get(const Evas_Object *obj)
2680 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2681 Widget_Data *wd = elm_widget_data_get(obj);
2682 if (!wd) return NULL;
2687 elm_win_inwin_content_unset(Evas_Object *obj)
2689 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2690 Widget_Data *wd = elm_widget_data_get(obj);
2691 if (!wd) return NULL;
2692 if (!wd->content) return NULL;
2693 Evas_Object *content = wd->content;
2694 elm_widget_sub_object_del(obj, wd->content);
2695 evas_object_event_callback_del_full(wd->content,
2696 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2697 _changed_size_hints, obj);
2698 edje_object_part_unswallow(wd->frm, wd->content);
2703 /* windowing spcific calls - shall we do this differently? */
2705 static Ecore_X_Window
2706 _elm_ee_win_get(const Evas_Object *obj)
2709 #ifdef HAVE_ELEMENTARY_X
2710 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2711 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2717 elm_win_xwindow_get(const Evas_Object *obj)
2723 type = elm_widget_type_get(obj);
2724 if (!type) return 0;
2725 if (type != widtype) return _elm_ee_win_get(obj);
2726 #ifdef HAVE_ELEMENTARY_X
2727 win = elm_widget_data_get(obj);
2729 if (win->xwin) return win->xwin;
2730 if (win->parent) return elm_win_xwindow_get(win->parent);