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(win->win_obj);
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;
418 _deferred_ecore_evas_free(void *data)
420 ecore_evas_free(data);
421 _elm_win_deferred_free--;
425 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
429 if (!win->show_count) win->show_count++;
430 if (win->shot.info) _shot_handle(win);
434 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
441 else if (win->img_obj)
443 evas_object_hide(win->img_obj);
448 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
455 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
456 _elm_win_obj_callback_parent_del, win);
459 if (win->autodel_clear) *(win->autodel_clear) = -1;
460 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
461 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
464 ecore_evas_callback_delete_request_set(win->ee, NULL);
465 ecore_evas_callback_resize_set(win->ee, NULL);
467 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
468 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
469 if (win->shot.info) eina_stringshare_del(win->shot.info);
470 if (win->shot.timer) ecore_timer_del(win->shot.timer);
471 while (((child = evas_object_bottom_get(win->evas))) &&
474 evas_object_del(child);
476 while (((child = evas_object_top_get(win->evas))) &&
479 evas_object_del(child);
481 #ifdef HAVE_ELEMENTARY_X
482 if (win->client_message_handler)
483 ecore_event_handler_del(win->client_message_handler);
485 // FIXME: Why are we flushing edje on every window destroy ??
486 // edje_file_cache_flush();
487 // edje_collection_cache_flush();
488 // evas_image_cache_flush(win->evas);
489 // evas_font_cache_flush(win->evas);
490 // FIXME: we are in the del handler for the object and delete the canvas
491 // that lives under it from the handler... nasty. deferring doesn't help either
501 ecore_job_add(_deferred_ecore_evas_free, win->ee);
502 _elm_win_deferred_free++;
506 _elm_win_focus_highlight_shutdown(win);
507 eina_stringshare_del(win->focus_highlight.style);
511 if ((!_elm_win_list) &&
512 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
514 edje_file_cache_flush();
515 edje_collection_cache_flush();
516 evas_image_cache_flush(e);
517 evas_font_cache_flush(e);
523 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
526 if (!win->img_obj) return;
527 evas_object_event_callback_del_full
528 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
529 evas_object_del(win->img_obj);
533 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
536 if (obj == win->parent) win->parent = NULL;
540 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
546 if ((x != win->screen.x) || (y != win->screen.y))
550 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
555 evas_object_move(obj, x, y);
560 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
563 // this is called to make sure all smart containers have calculated their
564 // sizes BEFORE we show the window to make sure it initially appears at
565 // our desired size (ie min size is known first)
566 evas_smart_objects_calculate(evas_object_evas_get(obj));
567 evas_object_show(obj);
571 else if (win->img_obj)
573 evas_object_show(win->img_obj);
578 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
582 if (ecore_evas_override_get(win->ee))
586 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
589 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
594 else if (win->img_obj)
598 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
601 // evas_object_move(win->img_obj, x, y);
606 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
613 else if (win->img_obj)
615 Evas_Coord w = 1, h = 1;
617 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
620 evas_object_image_size_set(win->img_obj, w, h);
625 _elm_win_delete_request(Ecore_Evas *ee)
627 Evas_Object *obj = ecore_evas_object_associate_get(ee);
629 if (strcmp(elm_widget_type_get(obj), "win")) return;
631 win = elm_widget_data_get(obj);
633 int autodel = win->autodel;
634 win->autodel_clear = &autodel;
635 evas_object_ref(win->win_obj);
636 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
637 // FIXME: if above callback deletes - then the below will be invalid
638 if (autodel) evas_object_del(win->win_obj);
639 else win->autodel_clear = NULL;
640 evas_object_unref(win->win_obj);
644 _elm_win_resize_job(void *data)
651 win->deferred_resize_job = NULL;
652 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
653 evas_object_resize(win->win_obj, w, h);
657 else if (win->img_obj)
660 EINA_LIST_FOREACH(win->subobjs, l, obj)
662 evas_object_move(obj, 0, 0);
663 evas_object_resize(obj, w, h);
667 #ifdef HAVE_ELEMENTARY_X
669 _elm_win_xwindow_get(Elm_Win *win)
673 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
674 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
676 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
678 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
679 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
680 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
681 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
682 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
683 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
684 ENGINE_COMPARE(ELM_OPENGL_COCOA))
687 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
689 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
691 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
693 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
696 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
698 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
701 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
703 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
705 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
707 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
709 #undef ENGINE_COMPARE
713 #ifdef HAVE_ELEMENTARY_X
715 _elm_win_xwin_update(Elm_Win *win)
717 _elm_win_xwindow_get(win);
722 win2 = elm_widget_data_get(win->parent);
726 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
730 if (!win->xwin) return; /* nothing more to do */
735 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
737 case ELM_WIN_DIALOG_BASIC:
738 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
740 case ELM_WIN_DESKTOP:
741 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
744 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
746 case ELM_WIN_TOOLBAR:
747 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
750 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
752 case ELM_WIN_UTILITY:
753 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
756 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
758 case ELM_WIN_DROPDOWN_MENU:
759 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
761 case ELM_WIN_POPUP_MENU:
762 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
764 case ELM_WIN_TOOLTIP:
765 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
767 case ELM_WIN_NOTIFICATION:
768 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
771 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
774 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
779 ecore_x_e_virtual_keyboard_state_set
780 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
785 _elm_win_eval_subobjs(Evas_Object *obj)
788 const Evas_Object *child;
790 Elm_Win *win = elm_widget_data_get(obj);
791 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
795 EINA_LIST_FOREACH(win->subobjs, l, child)
797 evas_object_size_hint_weight_get(child, &wx, &wy);
798 if (wx == 0.0) xx = 0;
799 if (wy == 0.0) xy = 0;
801 evas_object_size_hint_min_get(child, &w, &h);
804 if (w > minw) minw = w;
805 if (h > minh) minh = h;
807 evas_object_size_hint_max_get(child, &w, &h);
810 if (maxw == -1) maxw = w;
811 else if ((w > 0) && (w < maxw)) maxw = w;
812 if (maxh == -1) maxh = h;
813 else if ((h > 0) && (h < maxh)) maxh = h;
815 if (!xx) maxw = minw;
817 if (!xy) maxh = minh;
819 evas_object_size_hint_min_set(obj, minw, minh);
820 evas_object_size_hint_max_set(obj, maxw, maxh);
821 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
822 if (w < minw) w = minw;
823 if (h < minh) h = minh;
824 if ((maxw >= 0) && (w > maxw)) w = maxw;
825 if ((maxh >= 0) && (h > maxh)) h = maxh;
826 evas_object_resize(obj, w, h);
830 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
832 Elm_Win *win = elm_widget_data_get(data);
833 win->subobjs = eina_list_remove(win->subobjs, obj);
834 _elm_win_eval_subobjs(win->win_obj);
838 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
840 _elm_win_eval_subobjs(data);
844 _elm_win_shutdown(void)
846 while (_elm_win_list)
847 evas_object_del(_elm_win_list->data);
851 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
858 EINA_LIST_FOREACH(_elm_win_list, l, obj)
859 elm_widget_theme(obj);
863 EINA_LIST_FOREACH(_elm_win_list, l, obj)
864 elm_widget_theme_specific(obj, th, EINA_FALSE);
869 _elm_win_translate(void)
874 EINA_LIST_FOREACH(_elm_win_list, l, obj)
875 elm_widget_translate(obj);
878 #ifdef HAVE_ELEMENTARY_X
880 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
883 Ecore_X_Event_Client_Message *e = event;
885 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
886 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
888 if ((unsigned)e->data.l[0] == win->xwin)
890 Evas *evas = evas_object_evas_get(win->win_obj);
893 edje_file_cache_flush();
894 edje_collection_cache_flush();
895 evas_image_cache_flush(evas);
896 evas_font_cache_flush(evas);
900 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
902 if ((unsigned)e->data.l[0] == win->xwin)
904 Evas *evas = evas_object_evas_get(win->win_obj);
907 edje_file_cache_flush();
908 edje_collection_cache_flush();
909 evas_image_cache_flush(evas);
910 evas_font_cache_flush(evas);
911 evas_render_dump(evas);
915 return ECORE_CALLBACK_PASS_ON;
920 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
924 win->focus_highlight.geometry_changed = EINA_TRUE;
925 _elm_win_focus_highlight_reconfigure_job_start(win);
929 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
933 win->focus_highlight.geometry_changed = EINA_TRUE;
934 _elm_win_focus_highlight_reconfigure_job_start(win);
938 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
942 win->focus_highlight.cur.target = NULL;
944 _elm_win_focus_highlight_reconfigure_job_start(win);
948 _elm_win_focus_target_callbacks_add(Elm_Win *win)
950 Evas_Object *obj = win->focus_highlight.cur.target;
952 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
953 _elm_win_focus_target_move, win);
954 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
955 _elm_win_focus_target_resize, win);
956 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
957 _elm_win_focus_target_del, win);
961 _elm_win_focus_target_callbacks_del(Elm_Win *win)
963 Evas_Object *obj = win->focus_highlight.cur.target;
965 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
966 _elm_win_focus_target_move, win);
967 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
968 _elm_win_focus_target_resize, win);
969 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
970 _elm_win_focus_target_del, win);
974 _elm_win_focus_target_get(Evas_Object *obj)
976 Evas_Object *o = obj;
980 if (elm_widget_is(o))
982 if (!elm_widget_highlight_ignore_get(o))
984 o = elm_widget_parent_get(o);
986 o = evas_object_smart_parent_get(o);
990 o = elm_widget_parent_widget_get(o);
992 o = evas_object_smart_parent_get(o);
1001 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1003 Evas_Object *obj = event_info, *target;
1004 Elm_Win *win = data;
1006 if (win->focus_highlight.cur.target == obj)
1009 target = _elm_win_focus_target_get(obj);
1010 win->focus_highlight.cur.target = target;
1011 if (elm_widget_highlight_in_theme_get(target))
1012 win->focus_highlight.cur.handled = EINA_TRUE;
1014 _elm_win_focus_target_callbacks_add(win);
1016 _elm_win_focus_highlight_reconfigure_job_start(win);
1020 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1022 Elm_Win *win = data;
1024 if (!win->focus_highlight.cur.target)
1027 if (!win->focus_highlight.cur.handled)
1028 _elm_win_focus_target_callbacks_del(win);
1029 win->focus_highlight.cur.target = NULL;
1030 win->focus_highlight.cur.handled = EINA_FALSE;
1032 _elm_win_focus_highlight_reconfigure_job_start(win);
1036 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1038 evas_object_hide(obj);
1042 _elm_win_focus_highlight_init(Elm_Win *win)
1044 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1045 _elm_win_object_focus_in, win);
1046 evas_event_callback_add(win->evas,
1047 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1048 _elm_win_object_focus_out, win);
1050 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1052 win->focus_highlight.top = edje_object_add(win->evas);
1053 win->focus_highlight.changed_theme = EINA_TRUE;
1054 edje_object_signal_callback_add(win->focus_highlight.top,
1055 "elm,action,focus,hide,end", "",
1056 _elm_win_focus_highlight_hide, NULL);
1057 edje_object_signal_callback_add(win->focus_highlight.top,
1058 "elm,action,focus,anim,end", "",
1059 _elm_win_focus_highlight_anim_end, win);
1060 _elm_win_focus_highlight_reconfigure_job_start(win);
1064 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1066 _elm_win_focus_highlight_reconfigure_job_stop(win);
1067 if (win->focus_highlight.cur.target)
1069 _elm_win_focus_target_callbacks_del(win);
1070 win->focus_highlight.cur.target = NULL;
1072 if (win->focus_highlight.top)
1074 evas_object_del(win->focus_highlight.top);
1075 win->focus_highlight.top = NULL;
1078 evas_event_callback_del_full(win->evas,
1079 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1080 _elm_win_object_focus_in, win);
1081 evas_event_callback_del_full(win->evas,
1082 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1083 _elm_win_object_focus_out, win);
1087 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1091 top = win->focus_highlight.top;
1096 evas_object_show(top);
1097 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1103 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1108 _elm_win_focus_highlight_reconfigure_job(void *data)
1110 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1114 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1116 if (win->focus_highlight.reconf_job)
1117 ecore_job_del(win->focus_highlight.reconf_job);
1118 win->focus_highlight.reconf_job = ecore_job_add(
1119 _elm_win_focus_highlight_reconfigure_job, win);
1123 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1125 if (win->focus_highlight.reconf_job)
1126 ecore_job_del(win->focus_highlight.reconf_job);
1127 win->focus_highlight.reconf_job = NULL;
1131 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1133 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1134 Evas_Coord x, y, w, h;
1136 clip = evas_object_clip_get(target);
1137 evas_object_geometry_get(target, &x, &y, &w, &h);
1139 evas_object_move(obj, x, y);
1140 evas_object_resize(obj, w, h);
1141 evas_object_clip_set(obj, clip);
1145 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1147 Evas_Coord tx, ty, tw, th;
1148 Evas_Coord w, h, px, py, pw, ph;
1149 Edje_Message_Int_Set *m;
1150 Evas_Object *previous = win->focus_highlight.prev.target;
1151 Evas_Object *target = win->focus_highlight.cur.target;
1153 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1154 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1155 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1156 evas_object_move(obj, 0, 0);
1157 evas_object_resize(obj, tw, th);
1158 evas_object_clip_unset(obj);
1160 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1170 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1174 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1176 Elm_Win *win = data;
1177 _elm_win_focus_highlight_simple_setup(win, obj);
1181 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1183 Evas_Object *target = win->focus_highlight.cur.target;
1184 Evas_Object *previous = win->focus_highlight.prev.target;
1185 Evas_Object *top = win->focus_highlight.top;
1186 Eina_Bool visible_changed;
1187 Eina_Bool common_visible;
1188 const char *sig = NULL;
1190 _elm_win_focus_highlight_reconfigure_job_stop(win);
1192 visible_changed = (win->focus_highlight.cur.visible !=
1193 win->focus_highlight.prev.visible);
1195 if ((target == previous) && (!visible_changed) &&
1196 (!win->focus_highlight.geometry_changed))
1199 if ((previous) && (win->focus_highlight.prev.handled))
1200 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1203 common_visible = EINA_FALSE;
1204 else if (win->focus_highlight.cur.handled)
1206 common_visible = EINA_FALSE;
1207 if (win->focus_highlight.cur.visible)
1208 sig = "elm,action,focus_highlight,show";
1210 sig = "elm,action,focus_highlight,hide";
1213 common_visible = win->focus_highlight.cur.visible;
1215 _elm_win_focus_highlight_visible_set(win, common_visible);
1217 elm_widget_signal_emit(target, sig, "elm");
1219 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1222 if (win->focus_highlight.changed_theme)
1225 if (win->focus_highlight.style)
1226 str = win->focus_highlight.style;
1229 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1231 win->focus_highlight.changed_theme = EINA_FALSE;
1233 if (_elm_config->focus_highlight_animate)
1235 str = edje_object_data_get(win->focus_highlight.top, "animate");
1236 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1240 if ((win->focus_highlight.top_animate) && (previous) &&
1241 (!win->focus_highlight.prev.handled))
1242 _elm_win_focus_highlight_anim_setup(win, top);
1244 _elm_win_focus_highlight_simple_setup(win, top);
1245 evas_object_raise(top);
1248 win->focus_highlight.geometry_changed = EINA_FALSE;
1249 win->focus_highlight.prev = win->focus_highlight.cur;
1254 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1256 Evas_Event_Key_Down *ev = event_info;
1258 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1262 if ((strcmp(ev->keyname, "F12")) ||
1263 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1266 printf("Tree graph generated.\n");
1267 elm_object_tree_dot_dump(obj, "./dump.dot");
1272 _win_img_hide(void *data,
1274 Evas_Object *obj __UNUSED__,
1275 void *event_info __UNUSED__)
1277 Elm_Win *win = data;
1279 elm_widget_focus_hide_handle(win->win_obj);
1283 _win_img_mouse_up(void *data,
1285 Evas_Object *obj __UNUSED__,
1288 Elm_Win *win = data;
1289 Evas_Event_Mouse_Up *ev = event_info;
1290 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1291 elm_widget_focus_mouse_up_handle(win->win_obj);
1295 _win_img_focus_in(void *data,
1297 Evas_Object *obj __UNUSED__,
1298 void *event_info __UNUSED__)
1300 Elm_Win *win = data;
1301 elm_widget_focus_steal(win->win_obj);
1305 _win_img_focus_out(void *data,
1307 Evas_Object *obj __UNUSED__,
1308 void *event_info __UNUSED__)
1310 Elm_Win *win = data;
1311 elm_widget_focused_object_clear(win->win_obj);
1315 _win_inlined_image_set(Elm_Win *win)
1317 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1318 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1319 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1320 _elm_win_obj_callback_img_obj_del, win);
1322 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1323 _win_img_hide, win);
1324 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1325 _win_img_mouse_up, win);
1326 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1327 _win_img_focus_in, win);
1328 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1329 _win_img_focus_out, win);
1333 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1337 const char *fontpath;
1339 win = ELM_NEW(Elm_Win);
1341 #define FALLBACK_TRY(engine) \
1344 CRITICAL(engine " engine creation failed. Trying software X11."); \
1345 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1346 elm_engine_set(ELM_SOFTWARE_X11); \
1348 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1352 case ELM_WIN_INLINED_IMAGE:
1356 Evas *e = evas_object_evas_get(parent);
1359 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1362 win->img_obj = ecore_evas_object_image_new(ee);
1365 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1368 _win_inlined_image_set(win);
1372 evas_object_del(win->img_obj);
1373 win->img_obj = NULL;
1382 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1384 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1385 #ifdef HAVE_ELEMENTARY_X
1386 win->client_message_handler = ecore_event_handler_add
1387 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1390 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1392 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1393 FALLBACK_TRY("Sofware FB");
1395 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1397 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1398 FALLBACK_TRY("Sofware DirectFB");
1400 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1402 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1403 FALLBACK_TRY("Sofware-16");
1404 #ifdef HAVE_ELEMENTARY_X
1405 win->client_message_handler = ecore_event_handler_add
1406 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1409 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1411 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1412 FALLBACK_TRY("Sofware-8");
1413 #ifdef HAVE_ELEMENTARY_X
1414 win->client_message_handler = ecore_event_handler_add
1415 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1419 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1421 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1422 FALLBACK_TRY("XRender");
1423 #ifdef HAVE_ELEMENTARY_X
1424 win->client_message_handler = ecore_event_handler_add
1425 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1429 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1434 if (_elm_config->vsync)
1436 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1442 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1444 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1445 FALLBACK_TRY("OpenGL");
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);
1451 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1453 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1454 FALLBACK_TRY("Sofware Win32");
1456 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1458 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1459 FALLBACK_TRY("Sofware-16-WinCE");
1461 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1463 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1464 FALLBACK_TRY("Sofware SDL");
1466 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1468 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1469 FALLBACK_TRY("Sofware-16-SDL");
1471 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1473 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1474 FALLBACK_TRY("OpenGL SDL");
1476 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1478 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1479 FALLBACK_TRY("OpenGL Cocoa");
1481 else if (ENGINE_COMPARE(ELM_BUFFER))
1483 win->ee = ecore_evas_buffer_new(1, 1);
1485 else if (ENGINE_COMPARE(ELM_EWS))
1487 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1489 else if (!strncmp(_elm_config->engine, "shot:", 5))
1491 win->ee = ecore_evas_buffer_new(1, 1);
1492 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1493 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1502 ERR("Cannot create window.");
1506 #ifdef HAVE_ELEMENTARY_X
1507 _elm_win_xwindow_get(win);
1509 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1510 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1511 // bg pixmap done by x - has other issues like can be redrawn by x before it
1512 // is filled/ready by app
1513 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1516 win->parent = parent;
1518 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1519 _elm_win_obj_callback_parent_del, win);
1521 win->evas = ecore_evas_get(win->ee);
1522 win->win_obj = elm_widget_add(win->evas);
1523 elm_widget_type_set(win->win_obj, "win");
1524 ELM_SET_WIDTYPE(widtype, "win");
1525 elm_widget_data_set(win->win_obj, win);
1526 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1527 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1528 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1529 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1530 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1531 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1532 evas_object_move(win->win_obj, 0, 0);
1533 evas_object_resize(win->win_obj, 1, 1);
1534 evas_object_layer_set(win->win_obj, 50);
1535 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1537 ecore_evas_object_associate(win->ee, win->win_obj,
1538 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1539 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1540 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1541 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1542 _elm_win_obj_callback_show, win);
1543 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1544 _elm_win_obj_callback_hide, win);
1545 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1546 _elm_win_obj_callback_del, win);
1547 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1548 _elm_win_obj_callback_move, win);
1549 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1550 _elm_win_obj_callback_resize, win);
1552 evas_object_intercept_move_callback_add(win->win_obj,
1553 _elm_win_obj_intercept_move, win);
1554 evas_object_intercept_show_callback_add(win->win_obj,
1555 _elm_win_obj_intercept_show, win);
1557 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1558 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1559 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1560 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1561 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1562 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1563 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1564 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1565 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1566 evas_font_path_append(win->evas, fontpath);
1567 if (!_elm_config->font_hinting)
1568 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1569 else if (_elm_config->font_hinting == 1)
1570 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1571 else if (_elm_config->font_hinting == 2)
1572 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1574 #ifdef HAVE_ELEMENTARY_X
1575 _elm_win_xwin_update(win);
1578 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1580 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1582 ecore_evas_fullscreen_set(win->ee, 1);
1584 #undef ENGINE_COMPARE
1586 if (_elm_config->focus_highlight_enable)
1587 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1590 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1591 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1592 _debug_key_down, win);
1594 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1596 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1599 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1601 return win->win_obj;
1605 elm_win_util_standard_add(const char *name, const char *title)
1607 Evas_Object *win, *bg;
1609 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1610 if (!win) return NULL;
1611 elm_win_title_set(win, title);
1612 bg = elm_bg_add(win);
1615 evas_object_del(win);
1618 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1619 elm_win_resize_object_add(win, bg);
1620 evas_object_show(bg);
1625 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1629 ELM_CHECK_WIDTYPE(obj, widtype);
1630 win = elm_widget_data_get(obj);
1632 if (eina_list_data_find(win->subobjs, subobj)) return;
1633 win->subobjs = eina_list_append(win->subobjs, subobj);
1634 elm_widget_sub_object_add(obj, subobj);
1635 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1636 _elm_win_subobj_callback_del, obj);
1637 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1638 _elm_win_subobj_callback_changed_size_hints,
1640 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1641 evas_object_move(subobj, 0, 0);
1642 evas_object_resize(subobj, w, h);
1643 _elm_win_eval_subobjs(obj);
1647 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1650 ELM_CHECK_WIDTYPE(obj, widtype);
1651 win = elm_widget_data_get(obj);
1653 evas_object_event_callback_del_full(subobj,
1654 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1655 _elm_win_subobj_callback_changed_size_hints,
1657 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1658 _elm_win_subobj_callback_del, obj);
1659 win->subobjs = eina_list_remove(win->subobjs, subobj);
1660 elm_widget_sub_object_del(obj, subobj);
1661 _elm_win_eval_subobjs(obj);
1665 elm_win_title_set(Evas_Object *obj, const char *title)
1668 ELM_CHECK_WIDTYPE(obj, widtype);
1669 win = elm_widget_data_get(obj);
1671 ecore_evas_title_set(win->ee, title);
1675 elm_win_title_get(const Evas_Object *obj)
1678 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1679 win = elm_widget_data_get(obj);
1680 if (!win) return NULL;
1681 return ecore_evas_title_get(win->ee);
1685 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1688 ELM_CHECK_WIDTYPE(obj, widtype);
1689 win = elm_widget_data_get(obj);
1691 win->autodel = autodel;
1695 elm_win_autodel_get(const Evas_Object *obj)
1698 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1699 win = elm_widget_data_get(obj);
1700 if (!win) return EINA_FALSE;
1701 return win->autodel;
1705 elm_win_activate(Evas_Object *obj)
1708 ELM_CHECK_WIDTYPE(obj, widtype);
1709 win = elm_widget_data_get(obj);
1711 ecore_evas_activate(win->ee);
1715 elm_win_lower(Evas_Object *obj)
1718 ELM_CHECK_WIDTYPE(obj, widtype);
1719 win = elm_widget_data_get(obj);
1721 ecore_evas_lower(win->ee);
1725 elm_win_raise(Evas_Object *obj)
1728 ELM_CHECK_WIDTYPE(obj, widtype);
1729 win = elm_widget_data_get(obj);
1731 ecore_evas_raise(win->ee);
1735 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1738 ELM_CHECK_WIDTYPE(obj, widtype);
1739 win = elm_widget_data_get(obj);
1741 ecore_evas_borderless_set(win->ee, borderless);
1742 #ifdef HAVE_ELEMENTARY_X
1743 _elm_win_xwin_update(win);
1748 elm_win_borderless_get(const Evas_Object *obj)
1751 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1752 win = elm_widget_data_get(obj);
1753 if (!win) return EINA_FALSE;
1754 return ecore_evas_borderless_get(win->ee);
1758 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1761 ELM_CHECK_WIDTYPE(obj, widtype);
1762 win = elm_widget_data_get(obj);
1764 ecore_evas_shaped_set(win->ee, shaped);
1765 #ifdef HAVE_ELEMENTARY_X
1766 _elm_win_xwin_update(win);
1771 elm_win_shaped_get(const Evas_Object *obj)
1774 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1775 win = elm_widget_data_get(obj);
1776 if (!win) return EINA_FALSE;
1777 return ecore_evas_shaped_get(win->ee);
1781 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1784 ELM_CHECK_WIDTYPE(obj, widtype);
1785 win = elm_widget_data_get(obj);
1790 else if (win->img_obj)
1792 evas_object_image_alpha_set(win->img_obj, alpha);
1796 #ifdef HAVE_ELEMENTARY_X
1801 if (!_elm_config->compositing)
1802 elm_win_shaped_set(obj, alpha);
1804 ecore_evas_alpha_set(win->ee, alpha);
1807 ecore_evas_alpha_set(win->ee, alpha);
1808 _elm_win_xwin_update(win);
1812 ecore_evas_alpha_set(win->ee, alpha);
1817 elm_win_alpha_get(const Evas_Object *obj)
1820 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1821 win = elm_widget_data_get(obj);
1822 if (!win) return EINA_FALSE;
1823 return ecore_evas_alpha_get(win->ee);
1827 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1830 ELM_CHECK_WIDTYPE(obj, widtype);
1831 win = elm_widget_data_get(obj);
1837 else if (win->img_obj)
1839 evas_object_image_alpha_set(win->img_obj, transparent);
1843 #ifdef HAVE_ELEMENTARY_X
1846 ecore_evas_transparent_set(win->ee, transparent);
1847 _elm_win_xwin_update(win);
1851 ecore_evas_transparent_set(win->ee, transparent);
1856 elm_win_transparent_get(const Evas_Object *obj)
1859 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1860 win = elm_widget_data_get(obj);
1861 if (!win) return EINA_FALSE;
1863 return ecore_evas_transparent_get(win->ee);
1867 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1870 ELM_CHECK_WIDTYPE(obj, widtype);
1871 win = elm_widget_data_get(obj);
1873 ecore_evas_override_set(win->ee, override);
1874 #ifdef HAVE_ELEMENTARY_X
1875 _elm_win_xwin_update(win);
1880 elm_win_override_get(const Evas_Object *obj)
1883 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1884 win = elm_widget_data_get(obj);
1885 if (!win) return EINA_FALSE;
1886 return ecore_evas_override_get(win->ee);
1890 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1893 ELM_CHECK_WIDTYPE(obj, widtype);
1894 win = elm_widget_data_get(obj);
1897 // YYY: handle if win->img_obj
1898 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1899 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1900 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1902 // these engines... can ONLY be fullscreen
1907 ecore_evas_fullscreen_set(win->ee, fullscreen);
1908 #ifdef HAVE_ELEMENTARY_X
1909 _elm_win_xwin_update(win);
1912 #undef ENGINE_COMPARE
1916 elm_win_fullscreen_get(const Evas_Object *obj)
1919 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1920 win = elm_widget_data_get(obj);
1921 if (!win) return EINA_FALSE;
1923 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1924 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1925 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1927 // these engines... can ONLY be fullscreen
1932 return ecore_evas_fullscreen_get(win->ee);
1934 #undef ENGINE_COMPARE
1938 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1941 ELM_CHECK_WIDTYPE(obj, widtype);
1942 win = elm_widget_data_get(obj);
1944 // YYY: handle if win->img_obj
1945 ecore_evas_maximized_set(win->ee, maximized);
1946 #ifdef HAVE_ELEMENTARY_X
1947 _elm_win_xwin_update(win);
1952 elm_win_maximized_get(const Evas_Object *obj)
1955 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1956 win = elm_widget_data_get(obj);
1957 if (!win) return EINA_FALSE;
1958 return ecore_evas_maximized_get(win->ee);
1962 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1965 ELM_CHECK_WIDTYPE(obj, widtype);
1966 win = elm_widget_data_get(obj);
1968 ecore_evas_iconified_set(win->ee, iconified);
1969 #ifdef HAVE_ELEMENTARY_X
1970 _elm_win_xwin_update(win);
1975 elm_win_iconified_get(const Evas_Object *obj)
1978 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1979 win = elm_widget_data_get(obj);
1980 if (!win) return EINA_FALSE;
1981 return ecore_evas_iconified_get(win->ee);
1985 elm_win_layer_set(Evas_Object *obj, int layer)
1988 ELM_CHECK_WIDTYPE(obj, widtype);
1989 win = elm_widget_data_get(obj);
1991 ecore_evas_layer_set(win->ee, layer);
1992 #ifdef HAVE_ELEMENTARY_X
1993 _elm_win_xwin_update(win);
1998 elm_win_layer_get(const Evas_Object *obj)
2001 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2002 win = elm_widget_data_get(obj);
2003 if (!win) return -1;
2004 return ecore_evas_layer_get(win->ee);
2008 elm_win_rotation_set(Evas_Object *obj, int rotation)
2011 ELM_CHECK_WIDTYPE(obj, widtype);
2012 win = elm_widget_data_get(obj);
2014 if (win->rot == rotation) return;
2015 win->rot = rotation;
2016 ecore_evas_rotation_set(win->ee, rotation);
2017 evas_object_size_hint_min_set(obj, -1, -1);
2018 evas_object_size_hint_max_set(obj, -1, -1);
2019 _elm_win_eval_subobjs(obj);
2020 #ifdef HAVE_ELEMENTARY_X
2021 _elm_win_xwin_update(win);
2026 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2029 ELM_CHECK_WIDTYPE(obj, widtype);
2030 win = elm_widget_data_get(obj);
2032 if (win->rot == rotation) return;
2033 win->rot = rotation;
2034 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2035 evas_object_size_hint_min_set(obj, -1, -1);
2036 evas_object_size_hint_max_set(obj, -1, -1);
2037 _elm_win_eval_subobjs(obj);
2038 #ifdef HAVE_ELEMENTARY_X
2039 _elm_win_xwin_update(win);
2044 elm_win_rotation_get(const Evas_Object *obj)
2047 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2048 win = elm_widget_data_get(obj);
2049 if (!win) return -1;
2054 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2057 ELM_CHECK_WIDTYPE(obj, widtype);
2058 win = elm_widget_data_get(obj);
2060 ecore_evas_sticky_set(win->ee, sticky);
2061 #ifdef HAVE_ELEMENTARY_X
2062 _elm_win_xwin_update(win);
2067 elm_win_sticky_get(const Evas_Object *obj)
2070 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2071 win = elm_widget_data_get(obj);
2072 if (!win) return EINA_FALSE;
2073 return ecore_evas_sticky_get(win->ee);
2077 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2080 ELM_CHECK_WIDTYPE(obj, widtype);
2081 win = elm_widget_data_get(obj);
2083 if (mode == win->kbdmode) return;
2084 #ifdef HAVE_ELEMENTARY_X
2085 _elm_win_xwindow_get(win);
2087 win->kbdmode = mode;
2088 #ifdef HAVE_ELEMENTARY_X
2090 ecore_x_e_virtual_keyboard_state_set
2091 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2095 EAPI Elm_Win_Keyboard_Mode
2096 elm_win_keyboard_mode_get(const Evas_Object *obj)
2099 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2100 win = elm_widget_data_get(obj);
2101 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2102 return win->kbdmode;
2106 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2109 ELM_CHECK_WIDTYPE(obj, widtype);
2110 win = elm_widget_data_get(obj);
2112 #ifdef HAVE_ELEMENTARY_X
2113 _elm_win_xwindow_get(win);
2115 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2120 elm_win_keyboard_win_get(const Evas_Object *obj)
2123 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2124 win = elm_widget_data_get(obj);
2125 if (!win) return EINA_FALSE;
2126 #ifdef HAVE_ELEMENTARY_X
2127 _elm_win_xwindow_get(win);
2129 return ecore_x_e_virtual_keyboard_get(win->xwin);
2135 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2138 ELM_CHECK_WIDTYPE(obj, widtype);
2139 win = elm_widget_data_get(obj);
2141 if (x) *x = win->screen.x;
2142 if (y) *y = win->screen.y;
2146 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2149 ELM_CHECK_WIDTYPE(obj, widtype);
2150 win = elm_widget_data_get(obj);
2152 #ifdef HAVE_ELEMENTARY_X
2153 _elm_win_xwindow_get(win);
2155 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2160 elm_win_conformant_get(const Evas_Object *obj)
2163 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2164 win = elm_widget_data_get(obj);
2165 if (!win) return EINA_FALSE;
2166 #ifdef HAVE_ELEMENTARY_X
2167 _elm_win_xwindow_get(win);
2169 return ecore_x_e_illume_conformant_get(win->xwin);
2175 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2178 ELM_CHECK_WIDTYPE(obj, widtype);
2179 win = elm_widget_data_get(obj);
2181 #ifdef HAVE_ELEMENTARY_X
2182 _elm_win_xwindow_get(win);
2185 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2188 Ecore_X_Window_State states[2];
2190 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2191 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2192 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2193 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2200 elm_win_quickpanel_get(const Evas_Object *obj)
2203 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2204 win = elm_widget_data_get(obj);
2205 if (!win) return EINA_FALSE;
2206 #ifdef HAVE_ELEMENTARY_X
2207 _elm_win_xwindow_get(win);
2209 return ecore_x_e_illume_quickpanel_get(win->xwin);
2215 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2218 ELM_CHECK_WIDTYPE(obj, widtype);
2219 win = elm_widget_data_get(obj);
2221 #ifdef HAVE_ELEMENTARY_X
2222 _elm_win_xwindow_get(win);
2224 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2229 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2232 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2233 win = elm_widget_data_get(obj);
2234 if (!win) return -1;
2235 #ifdef HAVE_ELEMENTARY_X
2236 _elm_win_xwindow_get(win);
2238 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2244 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2247 ELM_CHECK_WIDTYPE(obj, widtype);
2248 win = elm_widget_data_get(obj);
2250 #ifdef HAVE_ELEMENTARY_X
2251 _elm_win_xwindow_get(win);
2253 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2258 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2261 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2262 win = elm_widget_data_get(obj);
2263 if (!win) return -1;
2264 #ifdef HAVE_ELEMENTARY_X
2265 _elm_win_xwindow_get(win);
2267 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2273 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2276 ELM_CHECK_WIDTYPE(obj, widtype);
2277 win = elm_widget_data_get(obj);
2279 #ifdef HAVE_ELEMENTARY_X
2280 _elm_win_xwindow_get(win);
2282 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2287 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2290 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2291 win = elm_widget_data_get(obj);
2293 #ifdef HAVE_ELEMENTARY_X
2294 _elm_win_xwindow_get(win);
2296 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2302 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2305 ELM_CHECK_WIDTYPE(obj, widtype);
2306 win = elm_widget_data_get(obj);
2308 #ifdef HAVE_ELEMENTARY_X
2309 _elm_win_xwindow_get(win);
2314 Ecore_X_Window_State states[2];
2316 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2317 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2318 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2319 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2326 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2329 ELM_CHECK_WIDTYPE(obj, widtype);
2330 win = elm_widget_data_get(obj);
2332 #ifdef HAVE_ELEMENTARY_X
2333 _elm_win_xwindow_get(win);
2338 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2339 ecore_x_e_illume_focus_back_send(win->xwin);
2341 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2342 ecore_x_e_illume_focus_forward_send(win->xwin);
2344 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2345 ecore_x_e_illume_focus_home_send(win->xwin);
2347 case ELM_ILLUME_COMMAND_CLOSE:
2348 ecore_x_e_illume_close_send(win->xwin);
2358 elm_win_inlined_image_object_get(Evas_Object *obj)
2361 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2362 win = elm_widget_data_get(obj);
2363 if (!win) return NULL;
2364 return win->img_obj;
2368 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2372 ELM_CHECK_WIDTYPE(obj, widtype);
2374 win = elm_widget_data_get(obj);
2375 enabled = !!enabled;
2376 if (win->focus_highlight.enabled == enabled)
2379 win->focus_highlight.enabled = enabled;
2381 if (win->focus_highlight.enabled)
2382 _elm_win_focus_highlight_init(win);
2384 _elm_win_focus_highlight_shutdown(win);
2388 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2392 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2394 win = elm_widget_data_get(obj);
2395 return win->focus_highlight.enabled;
2399 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2403 ELM_CHECK_WIDTYPE(obj, widtype);
2405 win = elm_widget_data_get(obj);
2406 eina_stringshare_replace(&win->focus_highlight.style, style);
2407 win->focus_highlight.changed_theme = EINA_TRUE;
2408 _elm_win_focus_highlight_reconfigure_job_start(win);
2412 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2416 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2418 win = elm_widget_data_get(obj);
2419 return win->focus_highlight.style;
2423 elm_win_indicator_state_set(Evas_Object *obj, int show_state)
2426 if (strcmp(elm_widget_type_get(obj), "win")) return;
2427 win = elm_widget_data_get(obj);
2429 #ifdef HAVE_ELEMENTARY_X
2430 _elm_win_xwindow_get(win);
2432 return ecore_x_window_prop_property_set (win->xwin,
2433 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
2439 elm_win_indicator_state_get(Evas_Object *obj)
2442 if (strcmp(elm_widget_type_get(obj), "win")) return -1;
2443 win = elm_widget_data_get(obj);
2444 if (!win) return -1;
2445 #ifdef HAVE_ELEMENTARY_X
2446 _elm_win_xwindow_get(win);
2452 unsigned int *prop_data = NULL;
2454 ret = ecore_x_window_prop_property_get (win->xwin,
2455 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, (void *)&prop_data, &count);
2456 if( ret && prop_data )
2457 memcpy (&show, prop_data, sizeof (int));
2459 if (prop_data) free (prop_data);
2468 typedef struct _Widget_Data Widget_Data;
2473 Evas_Object *content;
2476 static void _del_hook(Evas_Object *obj);
2477 static void _theme_hook(Evas_Object *obj);
2478 static void _sizing_eval(Evas_Object *obj);
2479 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2480 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2482 static const char *widtype2 = NULL;
2485 _del_hook(Evas_Object *obj)
2487 Widget_Data *wd = elm_widget_data_get(obj);
2493 _theme_hook(Evas_Object *obj)
2495 Widget_Data *wd = elm_widget_data_get(obj);
2496 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2498 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2503 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2505 Widget_Data *wd = elm_widget_data_get(obj);
2510 /* Try Focus cycle in subitem */
2513 elm_widget_focus_next_get(wd->content, dir, next);
2518 *next = (Evas_Object *)obj;
2523 _sizing_eval(Evas_Object *obj)
2525 Widget_Data *wd = elm_widget_data_get(obj);
2526 Evas_Coord minw = -1, minh = -1;
2528 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2529 edje_object_size_min_calc(wd->frm, &minw, &minh);
2530 evas_object_size_hint_min_set(obj, minw, minh);
2531 evas_object_size_hint_max_set(obj, -1, -1);
2535 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2541 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2543 Widget_Data *wd = elm_widget_data_get(obj);
2544 Evas_Object *sub = event_info;
2545 if (sub == wd->content)
2547 evas_object_event_callback_del_full
2548 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2555 elm_win_inwin_add(Evas_Object *obj)
2561 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2562 win = elm_widget_data_get(obj);
2563 if (!win) return NULL;
2564 wd = ELM_NEW(Widget_Data);
2565 obj2 = elm_widget_add(win->evas);
2566 elm_widget_type_set(obj2, "inwin");
2567 ELM_SET_WIDTYPE(widtype2, "inwin");
2568 elm_widget_sub_object_add(obj, obj2);
2569 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2570 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2571 elm_win_resize_object_add(obj, obj2);
2573 elm_widget_data_set(obj2, wd);
2574 elm_widget_del_hook_set(obj2, _del_hook);
2575 elm_widget_theme_hook_set(obj2, _theme_hook);
2576 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2577 elm_widget_can_focus_set(obj2, EINA_TRUE);
2578 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2580 wd->frm = edje_object_add(win->evas);
2581 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2582 elm_widget_resize_object_set(obj2, wd->frm);
2584 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2591 elm_win_inwin_activate(Evas_Object *obj)
2593 ELM_CHECK_WIDTYPE(obj, widtype2);
2594 Widget_Data *wd = elm_widget_data_get(obj);
2596 evas_object_raise(obj);
2597 evas_object_show(obj);
2598 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2599 elm_object_focus_set(obj, EINA_TRUE);
2603 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2605 ELM_CHECK_WIDTYPE(obj, widtype2);
2606 Widget_Data *wd = elm_widget_data_get(obj);
2608 if (wd->content == content) return;
2609 if (wd->content) evas_object_del(wd->content);
2610 wd->content = content;
2613 elm_widget_sub_object_add(obj, content);
2614 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2615 _changed_size_hints, obj);
2616 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2622 elm_win_inwin_content_get(const Evas_Object *obj)
2624 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2625 Widget_Data *wd = elm_widget_data_get(obj);
2626 if (!wd) return NULL;
2631 elm_win_inwin_content_unset(Evas_Object *obj)
2633 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2634 Widget_Data *wd = elm_widget_data_get(obj);
2635 if (!wd) return NULL;
2636 if (!wd->content) return NULL;
2637 Evas_Object *content = wd->content;
2638 elm_widget_sub_object_del(obj, wd->content);
2639 evas_object_event_callback_del_full(wd->content,
2640 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2641 _changed_size_hints, obj);
2642 edje_object_part_unswallow(wd->frm, wd->content);
2647 /* windowing spcific calls - shall we do this differently? */
2649 static Ecore_X_Window
2650 _elm_ee_win_get(const Evas_Object *obj)
2653 #ifdef HAVE_ELEMENTARY_X
2654 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2655 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2661 elm_win_xwindow_get(const Evas_Object *obj)
2667 type = elm_widget_type_get(obj);
2668 if (!type) return 0;
2669 if (type != widtype) return _elm_ee_win_get(obj);
2670 #ifdef HAVE_ELEMENTARY_X
2671 win = elm_widget_data_get(obj);
2673 if (win->xwin) return win->xwin;
2674 if (win->parent) return elm_win_xwindow_get(win->parent);