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 elm_widget_focus_cycle(obj, ELM_FOCUS_LEFT);
416 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
419 else if ((!strcmp(ev->keyname, "Right")) ||
420 (!strcmp(ev->keyname, "KP_Right")))
422 elm_widget_focus_cycle(obj, ELM_FOCUS_RIGHT);
423 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
426 else if ((!strcmp(ev->keyname, "Up")) ||
427 (!strcmp(ev->keyname, "KP_Up")))
429 elm_widget_focus_cycle(obj, ELM_FOCUS_UP);
430 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
433 else if ((!strcmp(ev->keyname, "Down")) ||
434 (!strcmp(ev->keyname, "KP_Down")))
436 elm_widget_focus_cycle(obj, ELM_FOCUS_DOWN);
437 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
446 _deferred_ecore_evas_free(void *data)
448 ecore_evas_free(data);
449 _elm_win_deferred_free--;
453 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
457 if (!win->show_count) win->show_count++;
458 if (win->shot.info) _shot_handle(win);
462 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
469 else if (win->img_obj)
471 evas_object_hide(win->img_obj);
476 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
483 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
484 _elm_win_obj_callback_parent_del, win);
487 if (win->autodel_clear) *(win->autodel_clear) = -1;
488 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
489 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
492 ecore_evas_callback_delete_request_set(win->ee, NULL);
493 ecore_evas_callback_resize_set(win->ee, NULL);
495 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
496 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
497 if (win->shot.info) eina_stringshare_del(win->shot.info);
498 if (win->shot.timer) ecore_timer_del(win->shot.timer);
499 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
500 _elm_win_obj_callback_del, win);
501 while (((child = evas_object_bottom_get(win->evas))) &&
504 evas_object_del(child);
506 while (((child = evas_object_top_get(win->evas))) &&
509 evas_object_del(child);
511 #ifdef HAVE_ELEMENTARY_X
512 if (win->client_message_handler)
513 ecore_event_handler_del(win->client_message_handler);
515 // FIXME: Why are we flushing edje on every window destroy ??
516 // edje_file_cache_flush();
517 // edje_collection_cache_flush();
518 // evas_image_cache_flush(win->evas);
519 // evas_font_cache_flush(win->evas);
520 // FIXME: we are in the del handler for the object and delete the canvas
521 // that lives under it from the handler... nasty. deferring doesn't help either
531 ecore_job_add(_deferred_ecore_evas_free, win->ee);
532 _elm_win_deferred_free++;
536 _elm_win_focus_highlight_shutdown(win);
537 eina_stringshare_del(win->focus_highlight.style);
541 if ((!_elm_win_list) &&
542 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
544 edje_file_cache_flush();
545 edje_collection_cache_flush();
546 evas_image_cache_flush(e);
547 evas_font_cache_flush(e);
553 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
556 if (!win->img_obj) return;
557 evas_object_event_callback_del_full
558 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
559 evas_object_del(win->img_obj);
563 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
566 if (obj == win->parent) win->parent = NULL;
570 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
576 if ((x != win->screen.x) || (y != win->screen.y))
580 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
585 evas_object_move(obj, x, y);
590 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
593 // this is called to make sure all smart containers have calculated their
594 // sizes BEFORE we show the window to make sure it initially appears at
595 // our desired size (ie min size is known first)
596 evas_smart_objects_calculate(evas_object_evas_get(obj));
597 evas_object_show(obj);
601 else if (win->img_obj)
603 evas_object_show(win->img_obj);
608 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
612 if (ecore_evas_override_get(win->ee))
616 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
619 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
624 else if (win->img_obj)
628 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
631 // evas_object_move(win->img_obj, x, y);
636 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
643 else if (win->img_obj)
645 Evas_Coord w = 1, h = 1;
647 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
650 evas_object_image_size_set(win->img_obj, w, h);
655 _elm_win_delete_request(Ecore_Evas *ee)
657 Evas_Object *obj = ecore_evas_object_associate_get(ee);
659 if (strcmp(elm_widget_type_get(obj), "win")) return;
661 win = elm_widget_data_get(obj);
663 int autodel = win->autodel;
664 win->autodel_clear = &autodel;
665 evas_object_ref(win->win_obj);
666 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
667 // FIXME: if above callback deletes - then the below will be invalid
668 if (autodel) evas_object_del(win->win_obj);
669 else win->autodel_clear = NULL;
670 evas_object_unref(win->win_obj);
674 _elm_win_resize_job(void *data)
681 win->deferred_resize_job = NULL;
682 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
683 evas_object_resize(win->win_obj, w, h);
687 else if (win->img_obj)
690 EINA_LIST_FOREACH(win->subobjs, l, obj)
692 evas_object_move(obj, 0, 0);
693 evas_object_resize(obj, w, h);
697 #ifdef HAVE_ELEMENTARY_X
699 _elm_win_xwindow_get(Elm_Win *win)
703 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
704 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
706 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
708 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
709 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
710 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
711 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
712 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
713 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
714 ENGINE_COMPARE(ELM_OPENGL_COCOA))
717 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
719 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
721 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
723 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
726 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
728 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
731 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
733 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
735 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
737 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
739 #undef ENGINE_COMPARE
743 #ifdef HAVE_ELEMENTARY_X
745 _elm_win_xwin_update(Elm_Win *win)
747 _elm_win_xwindow_get(win);
752 win2 = elm_widget_data_get(win->parent);
756 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
760 if (!win->xwin) return; /* nothing more to do */
765 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
767 case ELM_WIN_DIALOG_BASIC:
768 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
770 case ELM_WIN_DESKTOP:
771 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
774 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
776 case ELM_WIN_TOOLBAR:
777 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
780 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
782 case ELM_WIN_UTILITY:
783 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
786 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
788 case ELM_WIN_DROPDOWN_MENU:
789 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
791 case ELM_WIN_POPUP_MENU:
792 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
794 case ELM_WIN_TOOLTIP:
795 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
797 case ELM_WIN_NOTIFICATION:
798 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
801 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
804 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
809 ecore_x_e_virtual_keyboard_state_set
810 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
815 _elm_win_eval_subobjs(Evas_Object *obj)
818 const Evas_Object *child;
820 Elm_Win *win = elm_widget_data_get(obj);
821 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
825 EINA_LIST_FOREACH(win->subobjs, l, child)
827 evas_object_size_hint_weight_get(child, &wx, &wy);
828 if (wx == 0.0) xx = 0;
829 if (wy == 0.0) xy = 0;
831 evas_object_size_hint_min_get(child, &w, &h);
834 if (w > minw) minw = w;
835 if (h > minh) minh = h;
837 evas_object_size_hint_max_get(child, &w, &h);
840 if (maxw == -1) maxw = w;
841 else if ((w > 0) && (w < maxw)) maxw = w;
842 if (maxh == -1) maxh = h;
843 else if ((h > 0) && (h < maxh)) maxh = h;
845 if (!xx) maxw = minw;
847 if (!xy) maxh = minh;
849 evas_object_size_hint_min_set(obj, minw, minh);
850 evas_object_size_hint_max_set(obj, maxw, maxh);
851 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
852 if (w < minw) w = minw;
853 if (h < minh) h = minh;
854 if ((maxw >= 0) && (w > maxw)) w = maxw;
855 if ((maxh >= 0) && (h > maxh)) h = maxh;
856 evas_object_resize(obj, w, h);
860 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
862 Elm_Win *win = elm_widget_data_get(data);
863 win->subobjs = eina_list_remove(win->subobjs, obj);
864 _elm_win_eval_subobjs(win->win_obj);
868 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
870 _elm_win_eval_subobjs(data);
874 _elm_win_shutdown(void)
876 while (_elm_win_list)
877 evas_object_del(_elm_win_list->data);
881 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
888 EINA_LIST_FOREACH(_elm_win_list, l, obj)
889 elm_widget_theme(obj);
893 EINA_LIST_FOREACH(_elm_win_list, l, obj)
894 elm_widget_theme_specific(obj, th, EINA_FALSE);
899 _elm_win_translate(void)
904 EINA_LIST_FOREACH(_elm_win_list, l, obj)
905 elm_widget_translate(obj);
908 #ifdef HAVE_ELEMENTARY_X
910 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
913 Ecore_X_Event_Client_Message *e = event;
915 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
916 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
918 if ((unsigned)e->data.l[0] == win->xwin)
920 Evas *evas = evas_object_evas_get(win->win_obj);
923 edje_file_cache_flush();
924 edje_collection_cache_flush();
925 evas_image_cache_flush(evas);
926 evas_font_cache_flush(evas);
930 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
932 if ((unsigned)e->data.l[0] == win->xwin)
934 Evas *evas = evas_object_evas_get(win->win_obj);
937 edje_file_cache_flush();
938 edje_collection_cache_flush();
939 evas_image_cache_flush(evas);
940 evas_font_cache_flush(evas);
941 evas_render_dump(evas);
945 return ECORE_CALLBACK_PASS_ON;
950 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
954 win->focus_highlight.geometry_changed = EINA_TRUE;
955 _elm_win_focus_highlight_reconfigure_job_start(win);
959 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
963 win->focus_highlight.geometry_changed = EINA_TRUE;
964 _elm_win_focus_highlight_reconfigure_job_start(win);
968 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
972 win->focus_highlight.cur.target = NULL;
974 _elm_win_focus_highlight_reconfigure_job_start(win);
978 _elm_win_focus_target_callbacks_add(Elm_Win *win)
980 Evas_Object *obj = win->focus_highlight.cur.target;
982 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
983 _elm_win_focus_target_move, win);
984 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
985 _elm_win_focus_target_resize, win);
986 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
987 _elm_win_focus_target_del, win);
991 _elm_win_focus_target_callbacks_del(Elm_Win *win)
993 Evas_Object *obj = win->focus_highlight.cur.target;
995 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
996 _elm_win_focus_target_move, win);
997 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
998 _elm_win_focus_target_resize, win);
999 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1000 _elm_win_focus_target_del, win);
1003 static Evas_Object *
1004 _elm_win_focus_target_get(Evas_Object *obj)
1006 Evas_Object *o = obj;
1010 if (elm_widget_is(o))
1012 if (!elm_widget_highlight_ignore_get(o))
1014 o = elm_widget_parent_get(o);
1016 o = evas_object_smart_parent_get(o);
1020 o = elm_widget_parent_widget_get(o);
1022 o = evas_object_smart_parent_get(o);
1031 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1033 Evas_Object *obj = event_info, *target;
1034 Elm_Win *win = data;
1036 if (win->focus_highlight.cur.target == obj)
1039 target = _elm_win_focus_target_get(obj);
1040 win->focus_highlight.cur.target = target;
1041 if (elm_widget_highlight_in_theme_get(target))
1042 win->focus_highlight.cur.handled = EINA_TRUE;
1044 _elm_win_focus_target_callbacks_add(win);
1046 _elm_win_focus_highlight_reconfigure_job_start(win);
1050 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1052 Elm_Win *win = data;
1054 if (!win->focus_highlight.cur.target)
1057 if (!win->focus_highlight.cur.handled)
1058 _elm_win_focus_target_callbacks_del(win);
1059 win->focus_highlight.cur.target = NULL;
1060 win->focus_highlight.cur.handled = EINA_FALSE;
1062 _elm_win_focus_highlight_reconfigure_job_start(win);
1066 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1068 evas_object_hide(obj);
1072 _elm_win_focus_highlight_init(Elm_Win *win)
1074 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1075 _elm_win_object_focus_in, win);
1076 evas_event_callback_add(win->evas,
1077 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1078 _elm_win_object_focus_out, win);
1080 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1082 win->focus_highlight.top = edje_object_add(win->evas);
1083 win->focus_highlight.changed_theme = EINA_TRUE;
1084 edje_object_signal_callback_add(win->focus_highlight.top,
1085 "elm,action,focus,hide,end", "",
1086 _elm_win_focus_highlight_hide, NULL);
1087 edje_object_signal_callback_add(win->focus_highlight.top,
1088 "elm,action,focus,anim,end", "",
1089 _elm_win_focus_highlight_anim_end, win);
1090 _elm_win_focus_highlight_reconfigure_job_start(win);
1094 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1096 _elm_win_focus_highlight_reconfigure_job_stop(win);
1097 if (win->focus_highlight.cur.target)
1099 _elm_win_focus_target_callbacks_del(win);
1100 win->focus_highlight.cur.target = NULL;
1102 if (win->focus_highlight.top)
1104 evas_object_del(win->focus_highlight.top);
1105 win->focus_highlight.top = NULL;
1108 evas_event_callback_del_full(win->evas,
1109 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1110 _elm_win_object_focus_in, win);
1111 evas_event_callback_del_full(win->evas,
1112 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1113 _elm_win_object_focus_out, win);
1117 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1121 top = win->focus_highlight.top;
1126 evas_object_show(top);
1127 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1133 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1138 _elm_win_focus_highlight_reconfigure_job(void *data)
1140 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1144 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1146 if (win->focus_highlight.reconf_job)
1147 ecore_job_del(win->focus_highlight.reconf_job);
1148 win->focus_highlight.reconf_job = ecore_job_add(
1149 _elm_win_focus_highlight_reconfigure_job, win);
1153 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1155 if (win->focus_highlight.reconf_job)
1156 ecore_job_del(win->focus_highlight.reconf_job);
1157 win->focus_highlight.reconf_job = NULL;
1161 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1163 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1164 Evas_Coord x, y, w, h;
1166 clip = evas_object_clip_get(target);
1167 evas_object_geometry_get(target, &x, &y, &w, &h);
1169 evas_object_move(obj, x, y);
1170 evas_object_resize(obj, w, h);
1171 evas_object_clip_set(obj, clip);
1175 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1177 Evas_Coord tx, ty, tw, th;
1178 Evas_Coord w, h, px, py, pw, ph;
1179 Edje_Message_Int_Set *m;
1180 Evas_Object *previous = win->focus_highlight.prev.target;
1181 Evas_Object *target = win->focus_highlight.cur.target;
1183 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1184 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1185 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1186 evas_object_move(obj, 0, 0);
1187 evas_object_resize(obj, tw, th);
1188 evas_object_clip_unset(obj);
1190 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1200 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1204 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1206 Elm_Win *win = data;
1207 _elm_win_focus_highlight_simple_setup(win, obj);
1211 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1213 Evas_Object *target = win->focus_highlight.cur.target;
1214 Evas_Object *previous = win->focus_highlight.prev.target;
1215 Evas_Object *top = win->focus_highlight.top;
1216 Eina_Bool visible_changed;
1217 Eina_Bool common_visible;
1218 const char *sig = NULL;
1220 _elm_win_focus_highlight_reconfigure_job_stop(win);
1222 visible_changed = (win->focus_highlight.cur.visible !=
1223 win->focus_highlight.prev.visible);
1225 if ((target == previous) && (!visible_changed) &&
1226 (!win->focus_highlight.geometry_changed))
1229 if ((previous) && (win->focus_highlight.prev.handled))
1230 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1233 common_visible = EINA_FALSE;
1234 else if (win->focus_highlight.cur.handled)
1236 common_visible = EINA_FALSE;
1237 if (win->focus_highlight.cur.visible)
1238 sig = "elm,action,focus_highlight,show";
1240 sig = "elm,action,focus_highlight,hide";
1243 common_visible = win->focus_highlight.cur.visible;
1245 _elm_win_focus_highlight_visible_set(win, common_visible);
1247 elm_widget_signal_emit(target, sig, "elm");
1249 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1252 if (win->focus_highlight.changed_theme)
1255 if (win->focus_highlight.style)
1256 str = win->focus_highlight.style;
1259 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1261 win->focus_highlight.changed_theme = EINA_FALSE;
1263 if (_elm_config->focus_highlight_animate)
1265 str = edje_object_data_get(win->focus_highlight.top, "animate");
1266 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1270 if ((win->focus_highlight.top_animate) && (previous) &&
1271 (!win->focus_highlight.prev.handled))
1272 _elm_win_focus_highlight_anim_setup(win, top);
1274 _elm_win_focus_highlight_simple_setup(win, top);
1275 evas_object_raise(top);
1278 win->focus_highlight.geometry_changed = EINA_FALSE;
1279 win->focus_highlight.prev = win->focus_highlight.cur;
1284 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1286 Evas_Event_Key_Down *ev = event_info;
1288 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1292 if ((strcmp(ev->keyname, "F12")) ||
1293 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1296 printf("Tree graph generated.\n");
1297 elm_object_tree_dot_dump(obj, "./dump.dot");
1302 _win_img_hide(void *data,
1304 Evas_Object *obj __UNUSED__,
1305 void *event_info __UNUSED__)
1307 Elm_Win *win = data;
1309 elm_widget_focus_hide_handle(win->win_obj);
1313 _win_img_mouse_up(void *data,
1315 Evas_Object *obj __UNUSED__,
1318 Elm_Win *win = data;
1319 Evas_Event_Mouse_Up *ev = event_info;
1320 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1321 elm_widget_focus_mouse_up_handle(win->win_obj);
1325 _win_img_focus_in(void *data,
1327 Evas_Object *obj __UNUSED__,
1328 void *event_info __UNUSED__)
1330 Elm_Win *win = data;
1331 elm_widget_focus_steal(win->win_obj);
1335 _win_img_focus_out(void *data,
1337 Evas_Object *obj __UNUSED__,
1338 void *event_info __UNUSED__)
1340 Elm_Win *win = data;
1341 elm_widget_focused_object_clear(win->win_obj);
1345 _win_inlined_image_set(Elm_Win *win)
1347 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1348 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1349 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1350 _elm_win_obj_callback_img_obj_del, win);
1352 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1353 _win_img_hide, win);
1354 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1355 _win_img_mouse_up, win);
1356 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1357 _win_img_focus_in, win);
1358 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1359 _win_img_focus_out, win);
1363 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1367 const char *fontpath;
1369 win = ELM_NEW(Elm_Win);
1371 #define FALLBACK_TRY(engine) \
1374 CRITICAL(engine " engine creation failed. Trying default."); \
1375 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1377 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1379 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1383 case ELM_WIN_INLINED_IMAGE:
1386 Evas *e = evas_object_evas_get(parent);
1389 ee = ecore_evas_ecore_evas_get(e);
1391 win->img_obj = ecore_evas_object_image_new(ee);
1392 if (!win->img_obj) break;
1393 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1396 _win_inlined_image_set(win);
1399 evas_object_del(win->img_obj);
1400 win->img_obj = NULL;
1404 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1406 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1407 #ifdef HAVE_ELEMENTARY_X
1408 win->client_message_handler = ecore_event_handler_add
1409 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1411 FALLBACK_TRY("Sofware X11");
1413 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1415 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1416 FALLBACK_TRY("Sofware FB");
1418 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1420 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1421 FALLBACK_TRY("Sofware DirectFB");
1423 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1425 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1426 FALLBACK_TRY("Sofware-16");
1427 #ifdef HAVE_ELEMENTARY_X
1428 win->client_message_handler = ecore_event_handler_add
1429 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1432 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1434 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1435 FALLBACK_TRY("Sofware-8");
1436 #ifdef HAVE_ELEMENTARY_X
1437 win->client_message_handler = ecore_event_handler_add
1438 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1442 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1444 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1445 FALLBACK_TRY("XRender");
1446 #ifdef HAVE_ELEMENTARY_X
1447 win->client_message_handler = ecore_event_handler_add
1448 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1452 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1457 if (_elm_config->vsync)
1459 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1465 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1467 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1468 FALLBACK_TRY("OpenGL");
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);
1474 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1476 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1477 FALLBACK_TRY("Sofware Win32");
1479 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1481 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1482 FALLBACK_TRY("Sofware-16-WinCE");
1484 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1486 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1487 FALLBACK_TRY("PSL1GHT");
1489 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1491 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1492 FALLBACK_TRY("Sofware SDL");
1494 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1496 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1497 FALLBACK_TRY("Sofware-16-SDL");
1499 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1501 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1502 FALLBACK_TRY("OpenGL SDL");
1504 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1506 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1507 FALLBACK_TRY("OpenGL Cocoa");
1509 else if (ENGINE_COMPARE(ELM_BUFFER))
1511 win->ee = ecore_evas_buffer_new(1, 1);
1513 else if (ENGINE_COMPARE(ELM_EWS))
1515 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1517 else if (!strncmp(_elm_config->engine, "shot:", 5))
1519 win->ee = ecore_evas_buffer_new(1, 1);
1520 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1521 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1530 ERR("Cannot create window.");
1534 #ifdef HAVE_ELEMENTARY_X
1535 _elm_win_xwindow_get(win);
1537 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1538 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1539 // bg pixmap done by x - has other issues like can be redrawn by x before it
1540 // is filled/ready by app
1541 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1544 win->parent = parent;
1546 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1547 _elm_win_obj_callback_parent_del, win);
1549 win->evas = ecore_evas_get(win->ee);
1550 win->win_obj = elm_widget_add(win->evas);
1551 elm_widget_type_set(win->win_obj, "win");
1552 ELM_SET_WIDTYPE(widtype, "win");
1553 elm_widget_data_set(win->win_obj, win);
1554 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1555 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1556 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1557 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1558 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1559 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1560 evas_object_move(win->win_obj, 0, 0);
1561 evas_object_resize(win->win_obj, 1, 1);
1562 evas_object_layer_set(win->win_obj, 50);
1563 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1565 if (type == ELM_WIN_INLINED_IMAGE)
1566 elm_widget_parent2_set(win->win_obj, parent);
1567 ecore_evas_object_associate(win->ee, win->win_obj,
1568 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1569 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1570 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1571 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1572 _elm_win_obj_callback_show, win);
1573 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1574 _elm_win_obj_callback_hide, win);
1575 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1576 _elm_win_obj_callback_del, win);
1577 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1578 _elm_win_obj_callback_move, win);
1579 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1580 _elm_win_obj_callback_resize, win);
1582 evas_object_intercept_move_callback_add(win->win_obj,
1583 _elm_win_obj_intercept_move, win);
1584 evas_object_intercept_show_callback_add(win->win_obj,
1585 _elm_win_obj_intercept_show, win);
1587 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1588 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1589 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1590 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1591 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1592 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1593 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1594 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1595 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1596 evas_font_path_append(win->evas, fontpath);
1597 if (!_elm_config->font_hinting)
1598 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1599 else if (_elm_config->font_hinting == 1)
1600 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1601 else if (_elm_config->font_hinting == 2)
1602 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1604 #ifdef HAVE_ELEMENTARY_X
1605 _elm_win_xwin_update(win);
1608 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1610 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1612 ecore_evas_fullscreen_set(win->ee, 1);
1614 #undef ENGINE_COMPARE
1616 if (_elm_config->focus_highlight_enable)
1617 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1620 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1621 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1622 _debug_key_down, win);
1624 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1626 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1629 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1631 return win->win_obj;
1635 elm_win_util_standard_add(const char *name, const char *title)
1637 Evas_Object *win, *bg;
1639 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1640 if (!win) return NULL;
1641 elm_win_title_set(win, title);
1642 bg = elm_bg_add(win);
1645 evas_object_del(win);
1648 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1649 elm_win_resize_object_add(win, bg);
1650 evas_object_show(bg);
1655 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1659 ELM_CHECK_WIDTYPE(obj, widtype);
1660 win = elm_widget_data_get(obj);
1662 if (eina_list_data_find(win->subobjs, subobj)) return;
1663 win->subobjs = eina_list_append(win->subobjs, subobj);
1664 elm_widget_sub_object_add(obj, subobj);
1665 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1666 _elm_win_subobj_callback_del, obj);
1667 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1668 _elm_win_subobj_callback_changed_size_hints,
1670 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1671 evas_object_move(subobj, 0, 0);
1672 evas_object_resize(subobj, w, h);
1673 _elm_win_eval_subobjs(obj);
1677 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1680 ELM_CHECK_WIDTYPE(obj, widtype);
1681 win = elm_widget_data_get(obj);
1683 evas_object_event_callback_del_full(subobj,
1684 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1685 _elm_win_subobj_callback_changed_size_hints,
1687 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1688 _elm_win_subobj_callback_del, obj);
1689 win->subobjs = eina_list_remove(win->subobjs, subobj);
1690 elm_widget_sub_object_del(obj, subobj);
1691 _elm_win_eval_subobjs(obj);
1695 elm_win_title_set(Evas_Object *obj, const char *title)
1698 ELM_CHECK_WIDTYPE(obj, widtype);
1699 win = elm_widget_data_get(obj);
1701 ecore_evas_title_set(win->ee, title);
1705 elm_win_title_get(const Evas_Object *obj)
1708 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1709 win = elm_widget_data_get(obj);
1710 if (!win) return NULL;
1711 return ecore_evas_title_get(win->ee);
1715 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1718 ELM_CHECK_WIDTYPE(obj, widtype);
1719 win = elm_widget_data_get(obj);
1721 win->autodel = autodel;
1725 elm_win_autodel_get(const Evas_Object *obj)
1728 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1729 win = elm_widget_data_get(obj);
1730 if (!win) return EINA_FALSE;
1731 return win->autodel;
1735 elm_win_activate(Evas_Object *obj)
1738 ELM_CHECK_WIDTYPE(obj, widtype);
1739 win = elm_widget_data_get(obj);
1741 ecore_evas_activate(win->ee);
1745 elm_win_lower(Evas_Object *obj)
1748 ELM_CHECK_WIDTYPE(obj, widtype);
1749 win = elm_widget_data_get(obj);
1751 ecore_evas_lower(win->ee);
1755 elm_win_raise(Evas_Object *obj)
1758 ELM_CHECK_WIDTYPE(obj, widtype);
1759 win = elm_widget_data_get(obj);
1761 ecore_evas_raise(win->ee);
1765 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1768 ELM_CHECK_WIDTYPE(obj, widtype);
1769 win = elm_widget_data_get(obj);
1771 ecore_evas_borderless_set(win->ee, borderless);
1772 #ifdef HAVE_ELEMENTARY_X
1773 _elm_win_xwin_update(win);
1778 elm_win_borderless_get(const Evas_Object *obj)
1781 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1782 win = elm_widget_data_get(obj);
1783 if (!win) return EINA_FALSE;
1784 return ecore_evas_borderless_get(win->ee);
1788 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1791 ELM_CHECK_WIDTYPE(obj, widtype);
1792 win = elm_widget_data_get(obj);
1794 ecore_evas_shaped_set(win->ee, shaped);
1795 #ifdef HAVE_ELEMENTARY_X
1796 _elm_win_xwin_update(win);
1801 elm_win_shaped_get(const Evas_Object *obj)
1804 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1805 win = elm_widget_data_get(obj);
1806 if (!win) return EINA_FALSE;
1807 return ecore_evas_shaped_get(win->ee);
1811 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1814 ELM_CHECK_WIDTYPE(obj, widtype);
1815 win = elm_widget_data_get(obj);
1820 else if (win->img_obj)
1822 evas_object_image_alpha_set(win->img_obj, alpha);
1826 #ifdef HAVE_ELEMENTARY_X
1831 if (!_elm_config->compositing)
1832 elm_win_shaped_set(obj, alpha);
1834 ecore_evas_alpha_set(win->ee, alpha);
1837 ecore_evas_alpha_set(win->ee, alpha);
1838 _elm_win_xwin_update(win);
1842 ecore_evas_alpha_set(win->ee, alpha);
1847 elm_win_alpha_get(const Evas_Object *obj)
1850 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1851 win = elm_widget_data_get(obj);
1852 if (!win) return EINA_FALSE;
1853 return ecore_evas_alpha_get(win->ee);
1857 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1860 ELM_CHECK_WIDTYPE(obj, widtype);
1861 win = elm_widget_data_get(obj);
1867 else if (win->img_obj)
1869 evas_object_image_alpha_set(win->img_obj, transparent);
1873 #ifdef HAVE_ELEMENTARY_X
1876 ecore_evas_transparent_set(win->ee, transparent);
1877 _elm_win_xwin_update(win);
1881 ecore_evas_transparent_set(win->ee, transparent);
1886 elm_win_transparent_get(const Evas_Object *obj)
1889 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1890 win = elm_widget_data_get(obj);
1891 if (!win) return EINA_FALSE;
1893 return ecore_evas_transparent_get(win->ee);
1897 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1900 ELM_CHECK_WIDTYPE(obj, widtype);
1901 win = elm_widget_data_get(obj);
1903 ecore_evas_override_set(win->ee, override);
1904 #ifdef HAVE_ELEMENTARY_X
1905 _elm_win_xwin_update(win);
1910 elm_win_override_get(const Evas_Object *obj)
1913 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1914 win = elm_widget_data_get(obj);
1915 if (!win) return EINA_FALSE;
1916 return ecore_evas_override_get(win->ee);
1920 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1923 ELM_CHECK_WIDTYPE(obj, widtype);
1924 win = elm_widget_data_get(obj);
1927 // YYY: handle if win->img_obj
1928 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1929 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1930 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1932 // these engines... can ONLY be fullscreen
1937 ecore_evas_fullscreen_set(win->ee, fullscreen);
1938 #ifdef HAVE_ELEMENTARY_X
1939 _elm_win_xwin_update(win);
1942 #undef ENGINE_COMPARE
1946 elm_win_fullscreen_get(const Evas_Object *obj)
1949 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1950 win = elm_widget_data_get(obj);
1951 if (!win) return EINA_FALSE;
1953 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1954 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1955 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1957 // these engines... can ONLY be fullscreen
1962 return ecore_evas_fullscreen_get(win->ee);
1964 #undef ENGINE_COMPARE
1968 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1971 ELM_CHECK_WIDTYPE(obj, widtype);
1972 win = elm_widget_data_get(obj);
1974 // YYY: handle if win->img_obj
1975 ecore_evas_maximized_set(win->ee, maximized);
1976 #ifdef HAVE_ELEMENTARY_X
1977 _elm_win_xwin_update(win);
1982 elm_win_maximized_get(const Evas_Object *obj)
1985 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1986 win = elm_widget_data_get(obj);
1987 if (!win) return EINA_FALSE;
1988 return ecore_evas_maximized_get(win->ee);
1992 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1995 ELM_CHECK_WIDTYPE(obj, widtype);
1996 win = elm_widget_data_get(obj);
1998 ecore_evas_iconified_set(win->ee, iconified);
1999 #ifdef HAVE_ELEMENTARY_X
2000 _elm_win_xwin_update(win);
2005 elm_win_iconified_get(const Evas_Object *obj)
2008 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2009 win = elm_widget_data_get(obj);
2010 if (!win) return EINA_FALSE;
2011 return ecore_evas_iconified_get(win->ee);
2015 elm_win_layer_set(Evas_Object *obj, int layer)
2018 ELM_CHECK_WIDTYPE(obj, widtype);
2019 win = elm_widget_data_get(obj);
2021 ecore_evas_layer_set(win->ee, layer);
2022 #ifdef HAVE_ELEMENTARY_X
2023 _elm_win_xwin_update(win);
2028 elm_win_layer_get(const Evas_Object *obj)
2031 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2032 win = elm_widget_data_get(obj);
2033 if (!win) return -1;
2034 return ecore_evas_layer_get(win->ee);
2038 elm_win_rotation_set(Evas_Object *obj, int rotation)
2041 ELM_CHECK_WIDTYPE(obj, widtype);
2042 win = elm_widget_data_get(obj);
2044 if (win->rot == rotation) return;
2045 win->rot = rotation;
2046 ecore_evas_rotation_set(win->ee, rotation);
2047 evas_object_size_hint_min_set(obj, -1, -1);
2048 evas_object_size_hint_max_set(obj, -1, -1);
2049 _elm_win_eval_subobjs(obj);
2050 #ifdef HAVE_ELEMENTARY_X
2051 _elm_win_xwin_update(win);
2056 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2059 ELM_CHECK_WIDTYPE(obj, widtype);
2060 win = elm_widget_data_get(obj);
2062 if (win->rot == rotation) return;
2063 win->rot = rotation;
2064 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2065 evas_object_size_hint_min_set(obj, -1, -1);
2066 evas_object_size_hint_max_set(obj, -1, -1);
2067 _elm_win_eval_subobjs(obj);
2068 #ifdef HAVE_ELEMENTARY_X
2069 _elm_win_xwin_update(win);
2074 elm_win_rotation_get(const Evas_Object *obj)
2077 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2078 win = elm_widget_data_get(obj);
2079 if (!win) return -1;
2084 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2087 ELM_CHECK_WIDTYPE(obj, widtype);
2088 win = elm_widget_data_get(obj);
2090 ecore_evas_sticky_set(win->ee, sticky);
2091 #ifdef HAVE_ELEMENTARY_X
2092 _elm_win_xwin_update(win);
2097 elm_win_sticky_get(const Evas_Object *obj)
2100 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2101 win = elm_widget_data_get(obj);
2102 if (!win) return EINA_FALSE;
2103 return ecore_evas_sticky_get(win->ee);
2107 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2110 ELM_CHECK_WIDTYPE(obj, widtype);
2111 win = elm_widget_data_get(obj);
2113 if (mode == win->kbdmode) return;
2114 #ifdef HAVE_ELEMENTARY_X
2115 _elm_win_xwindow_get(win);
2117 win->kbdmode = mode;
2118 #ifdef HAVE_ELEMENTARY_X
2120 ecore_x_e_virtual_keyboard_state_set
2121 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2125 EAPI Elm_Win_Keyboard_Mode
2126 elm_win_keyboard_mode_get(const Evas_Object *obj)
2129 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2130 win = elm_widget_data_get(obj);
2131 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2132 return win->kbdmode;
2136 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2139 ELM_CHECK_WIDTYPE(obj, widtype);
2140 win = elm_widget_data_get(obj);
2142 #ifdef HAVE_ELEMENTARY_X
2143 _elm_win_xwindow_get(win);
2145 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2152 elm_win_keyboard_win_get(const Evas_Object *obj)
2155 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2156 win = elm_widget_data_get(obj);
2157 if (!win) return EINA_FALSE;
2158 #ifdef HAVE_ELEMENTARY_X
2159 _elm_win_xwindow_get(win);
2161 return ecore_x_e_virtual_keyboard_get(win->xwin);
2167 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2170 ELM_CHECK_WIDTYPE(obj, widtype);
2171 win = elm_widget_data_get(obj);
2173 if (x) *x = win->screen.x;
2174 if (y) *y = win->screen.y;
2178 elm_win_focus_get(const Evas_Object *obj)
2181 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2182 win = elm_widget_data_get(obj);
2183 if (!win) return EINA_FALSE;
2184 return ecore_evas_focus_get(win->ee);
2188 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2191 ELM_CHECK_WIDTYPE(obj, widtype);
2192 win = elm_widget_data_get(obj);
2194 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2198 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2201 ELM_CHECK_WIDTYPE(obj, widtype);
2202 win = elm_widget_data_get(obj);
2204 #ifdef HAVE_ELEMENTARY_X
2205 _elm_win_xwindow_get(win);
2207 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2214 elm_win_conformant_get(const Evas_Object *obj)
2217 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2218 win = elm_widget_data_get(obj);
2219 if (!win) return EINA_FALSE;
2220 #ifdef HAVE_ELEMENTARY_X
2221 _elm_win_xwindow_get(win);
2223 return ecore_x_e_illume_conformant_get(win->xwin);
2229 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2232 ELM_CHECK_WIDTYPE(obj, widtype);
2233 win = elm_widget_data_get(obj);
2235 #ifdef HAVE_ELEMENTARY_X
2236 _elm_win_xwindow_get(win);
2239 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2242 Ecore_X_Window_State states[2];
2244 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2245 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2246 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2247 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2256 elm_win_quickpanel_get(const Evas_Object *obj)
2259 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2260 win = elm_widget_data_get(obj);
2261 if (!win) return EINA_FALSE;
2262 #ifdef HAVE_ELEMENTARY_X
2263 _elm_win_xwindow_get(win);
2265 return ecore_x_e_illume_quickpanel_get(win->xwin);
2271 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
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_quickpanel_priority_major_set(win->xwin, priority);
2287 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2290 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2291 win = elm_widget_data_get(obj);
2292 if (!win) return -1;
2293 #ifdef HAVE_ELEMENTARY_X
2294 _elm_win_xwindow_get(win);
2296 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2302 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2305 ELM_CHECK_WIDTYPE(obj, widtype);
2306 win = elm_widget_data_get(obj);
2308 #ifdef HAVE_ELEMENTARY_X
2309 _elm_win_xwindow_get(win);
2311 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2318 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2321 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2322 win = elm_widget_data_get(obj);
2323 if (!win) return -1;
2324 #ifdef HAVE_ELEMENTARY_X
2325 _elm_win_xwindow_get(win);
2327 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2333 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2336 ELM_CHECK_WIDTYPE(obj, widtype);
2337 win = elm_widget_data_get(obj);
2339 #ifdef HAVE_ELEMENTARY_X
2340 _elm_win_xwindow_get(win);
2342 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2349 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2352 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2353 win = elm_widget_data_get(obj);
2355 #ifdef HAVE_ELEMENTARY_X
2356 _elm_win_xwindow_get(win);
2358 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2364 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2367 ELM_CHECK_WIDTYPE(obj, widtype);
2368 win = elm_widget_data_get(obj);
2370 #ifdef HAVE_ELEMENTARY_X
2371 _elm_win_xwindow_get(win);
2376 Ecore_X_Window_State states[2];
2378 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2379 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2380 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2381 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2390 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2393 ELM_CHECK_WIDTYPE(obj, widtype);
2394 win = elm_widget_data_get(obj);
2396 #ifdef HAVE_ELEMENTARY_X
2397 _elm_win_xwindow_get(win);
2402 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2403 ecore_x_e_illume_focus_back_send(win->xwin);
2405 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2406 ecore_x_e_illume_focus_forward_send(win->xwin);
2408 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2409 ecore_x_e_illume_focus_home_send(win->xwin);
2411 case ELM_ILLUME_COMMAND_CLOSE:
2412 ecore_x_e_illume_close_send(win->xwin);
2424 elm_win_inlined_image_object_get(Evas_Object *obj)
2427 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2428 win = elm_widget_data_get(obj);
2429 if (!win) return NULL;
2430 return win->img_obj;
2434 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2438 ELM_CHECK_WIDTYPE(obj, widtype);
2440 win = elm_widget_data_get(obj);
2441 enabled = !!enabled;
2442 if (win->focus_highlight.enabled == enabled)
2445 win->focus_highlight.enabled = enabled;
2447 if (win->focus_highlight.enabled)
2448 _elm_win_focus_highlight_init(win);
2450 _elm_win_focus_highlight_shutdown(win);
2454 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2458 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2460 win = elm_widget_data_get(obj);
2461 return win->focus_highlight.enabled;
2465 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2469 ELM_CHECK_WIDTYPE(obj, widtype);
2471 win = elm_widget_data_get(obj);
2472 eina_stringshare_replace(&win->focus_highlight.style, style);
2473 win->focus_highlight.changed_theme = EINA_TRUE;
2474 _elm_win_focus_highlight_reconfigure_job_start(win);
2478 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2482 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2484 win = elm_widget_data_get(obj);
2485 return win->focus_highlight.style;
2489 elm_win_indicator_state_set(Evas_Object *obj, int show_state)
2492 if (strcmp(elm_widget_type_get(obj), "win")) return;
2493 win = elm_widget_data_get(obj);
2495 #ifdef HAVE_ELEMENTARY_X
2496 _elm_win_xwindow_get(win);
2498 return ecore_x_window_prop_property_set (win->xwin,
2499 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
2505 elm_win_indicator_state_get(Evas_Object *obj)
2508 if (strcmp(elm_widget_type_get(obj), "win")) return -1;
2509 win = elm_widget_data_get(obj);
2510 if (!win) return -1;
2511 #ifdef HAVE_ELEMENTARY_X
2512 _elm_win_xwindow_get(win);
2518 unsigned int *prop_data = NULL;
2520 ret = ecore_x_window_prop_property_get (win->xwin,
2521 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, (void *)&prop_data, &count);
2522 if( ret && prop_data )
2523 memcpy (&show, prop_data, sizeof (int));
2525 if (prop_data) free (prop_data);
2534 typedef struct _Widget_Data Widget_Data;
2539 Evas_Object *content;
2542 static void _del_hook(Evas_Object *obj);
2543 static void _theme_hook(Evas_Object *obj);
2544 static void _sizing_eval(Evas_Object *obj);
2545 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2546 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2548 static const char *widtype2 = NULL;
2551 _del_hook(Evas_Object *obj)
2553 Widget_Data *wd = elm_widget_data_get(obj);
2559 _theme_hook(Evas_Object *obj)
2561 Widget_Data *wd = elm_widget_data_get(obj);
2562 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2564 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2569 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2571 Widget_Data *wd = elm_widget_data_get(obj);
2576 /* Try Focus cycle in subitem */
2579 elm_widget_focus_next_get(wd->content, dir, next);
2584 *next = (Evas_Object *)obj;
2589 _sizing_eval(Evas_Object *obj)
2591 Widget_Data *wd = elm_widget_data_get(obj);
2592 Evas_Coord minw = -1, minh = -1;
2594 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2595 edje_object_size_min_calc(wd->frm, &minw, &minh);
2596 evas_object_size_hint_min_set(obj, minw, minh);
2597 evas_object_size_hint_max_set(obj, -1, -1);
2601 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2607 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2609 Widget_Data *wd = elm_widget_data_get(obj);
2610 Evas_Object *sub = event_info;
2611 if (sub == wd->content)
2613 evas_object_event_callback_del_full
2614 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2621 elm_win_inwin_add(Evas_Object *obj)
2627 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2628 win = elm_widget_data_get(obj);
2629 if (!win) return NULL;
2630 wd = ELM_NEW(Widget_Data);
2631 obj2 = elm_widget_add(win->evas);
2632 elm_widget_type_set(obj2, "inwin");
2633 ELM_SET_WIDTYPE(widtype2, "inwin");
2634 elm_widget_sub_object_add(obj, obj2);
2635 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2636 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2637 elm_win_resize_object_add(obj, obj2);
2639 elm_widget_data_set(obj2, wd);
2640 elm_widget_del_hook_set(obj2, _del_hook);
2641 elm_widget_theme_hook_set(obj2, _theme_hook);
2642 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2643 elm_widget_can_focus_set(obj2, EINA_TRUE);
2644 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2646 wd->frm = edje_object_add(win->evas);
2647 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2648 elm_widget_resize_object_set(obj2, wd->frm);
2650 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2657 elm_win_inwin_activate(Evas_Object *obj)
2659 ELM_CHECK_WIDTYPE(obj, widtype2);
2660 Widget_Data *wd = elm_widget_data_get(obj);
2662 evas_object_raise(obj);
2663 evas_object_show(obj);
2664 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2665 elm_object_focus_set(obj, EINA_TRUE);
2669 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2671 ELM_CHECK_WIDTYPE(obj, widtype2);
2672 Widget_Data *wd = elm_widget_data_get(obj);
2674 if (wd->content == content) return;
2675 if (wd->content) evas_object_del(wd->content);
2676 wd->content = content;
2679 elm_widget_sub_object_add(obj, content);
2680 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2681 _changed_size_hints, obj);
2682 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2688 elm_win_inwin_content_get(const Evas_Object *obj)
2690 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2691 Widget_Data *wd = elm_widget_data_get(obj);
2692 if (!wd) return NULL;
2697 elm_win_inwin_content_unset(Evas_Object *obj)
2699 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2700 Widget_Data *wd = elm_widget_data_get(obj);
2701 if (!wd) return NULL;
2702 if (!wd->content) return NULL;
2703 Evas_Object *content = wd->content;
2704 elm_widget_sub_object_del(obj, wd->content);
2705 evas_object_event_callback_del_full(wd->content,
2706 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2707 _changed_size_hints, obj);
2708 edje_object_part_unswallow(wd->frm, wd->content);
2713 /* windowing spcific calls - shall we do this differently? */
2715 static Ecore_X_Window
2716 _elm_ee_win_get(const Evas_Object *obj)
2719 #ifdef HAVE_ELEMENTARY_X
2720 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2721 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2727 elm_win_xwindow_get(const Evas_Object *obj)
2733 type = elm_widget_type_get(obj);
2734 if (!type) return 0;
2735 if (type != widtype) return _elm_ee_win_get(obj);
2736 #ifdef HAVE_ELEMENTARY_X
2737 win = elm_widget_data_get(obj);
2739 if (win->xwin) return win->xwin;
2740 if (win->parent) return elm_win_xwindow_get(win->parent);