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_PSL1GHT))
1463 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1464 FALLBACK_TRY("PSL1GHT");
1466 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1468 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1469 FALLBACK_TRY("Sofware SDL");
1471 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1473 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1474 FALLBACK_TRY("Sofware-16-SDL");
1476 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1478 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1479 FALLBACK_TRY("OpenGL SDL");
1481 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1483 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1484 FALLBACK_TRY("OpenGL Cocoa");
1486 else if (ENGINE_COMPARE(ELM_BUFFER))
1488 win->ee = ecore_evas_buffer_new(1, 1);
1490 else if (ENGINE_COMPARE(ELM_EWS))
1492 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1494 else if (!strncmp(_elm_config->engine, "shot:", 5))
1496 win->ee = ecore_evas_buffer_new(1, 1);
1497 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1498 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1507 ERR("Cannot create window.");
1511 #ifdef HAVE_ELEMENTARY_X
1512 _elm_win_xwindow_get(win);
1514 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1515 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1516 // bg pixmap done by x - has other issues like can be redrawn by x before it
1517 // is filled/ready by app
1518 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1521 win->parent = parent;
1523 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1524 _elm_win_obj_callback_parent_del, win);
1526 win->evas = ecore_evas_get(win->ee);
1527 win->win_obj = elm_widget_add(win->evas);
1528 elm_widget_type_set(win->win_obj, "win");
1529 ELM_SET_WIDTYPE(widtype, "win");
1530 elm_widget_data_set(win->win_obj, win);
1531 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1532 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1533 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1534 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1535 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1536 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1537 evas_object_move(win->win_obj, 0, 0);
1538 evas_object_resize(win->win_obj, 1, 1);
1539 evas_object_layer_set(win->win_obj, 50);
1540 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1542 ecore_evas_object_associate(win->ee, win->win_obj,
1543 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1544 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1545 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1546 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1547 _elm_win_obj_callback_show, win);
1548 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1549 _elm_win_obj_callback_hide, win);
1550 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1551 _elm_win_obj_callback_del, win);
1552 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1553 _elm_win_obj_callback_move, win);
1554 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1555 _elm_win_obj_callback_resize, win);
1557 evas_object_intercept_move_callback_add(win->win_obj,
1558 _elm_win_obj_intercept_move, win);
1559 evas_object_intercept_show_callback_add(win->win_obj,
1560 _elm_win_obj_intercept_show, win);
1562 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1563 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1564 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1565 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1566 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1567 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1568 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1569 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1570 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1571 evas_font_path_append(win->evas, fontpath);
1572 if (!_elm_config->font_hinting)
1573 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1574 else if (_elm_config->font_hinting == 1)
1575 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1576 else if (_elm_config->font_hinting == 2)
1577 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1579 #ifdef HAVE_ELEMENTARY_X
1580 _elm_win_xwin_update(win);
1583 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1585 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1587 ecore_evas_fullscreen_set(win->ee, 1);
1589 #undef ENGINE_COMPARE
1591 if (_elm_config->focus_highlight_enable)
1592 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1595 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1596 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1597 _debug_key_down, win);
1599 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1601 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1604 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1606 return win->win_obj;
1610 elm_win_util_standard_add(const char *name, const char *title)
1612 Evas_Object *win, *bg;
1614 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1615 if (!win) return NULL;
1616 elm_win_title_set(win, title);
1617 bg = elm_bg_add(win);
1620 evas_object_del(win);
1623 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1624 elm_win_resize_object_add(win, bg);
1625 evas_object_show(bg);
1630 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1634 ELM_CHECK_WIDTYPE(obj, widtype);
1635 win = elm_widget_data_get(obj);
1637 if (eina_list_data_find(win->subobjs, subobj)) return;
1638 win->subobjs = eina_list_append(win->subobjs, subobj);
1639 elm_widget_sub_object_add(obj, subobj);
1640 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1641 _elm_win_subobj_callback_del, obj);
1642 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1643 _elm_win_subobj_callback_changed_size_hints,
1645 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1646 evas_object_move(subobj, 0, 0);
1647 evas_object_resize(subobj, w, h);
1648 _elm_win_eval_subobjs(obj);
1652 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1655 ELM_CHECK_WIDTYPE(obj, widtype);
1656 win = elm_widget_data_get(obj);
1658 evas_object_event_callback_del_full(subobj,
1659 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1660 _elm_win_subobj_callback_changed_size_hints,
1662 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1663 _elm_win_subobj_callback_del, obj);
1664 win->subobjs = eina_list_remove(win->subobjs, subobj);
1665 elm_widget_sub_object_del(obj, subobj);
1666 _elm_win_eval_subobjs(obj);
1670 elm_win_title_set(Evas_Object *obj, const char *title)
1673 ELM_CHECK_WIDTYPE(obj, widtype);
1674 win = elm_widget_data_get(obj);
1676 ecore_evas_title_set(win->ee, title);
1680 elm_win_title_get(const Evas_Object *obj)
1683 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1684 win = elm_widget_data_get(obj);
1685 if (!win) return NULL;
1686 return ecore_evas_title_get(win->ee);
1690 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1693 ELM_CHECK_WIDTYPE(obj, widtype);
1694 win = elm_widget_data_get(obj);
1696 win->autodel = autodel;
1700 elm_win_autodel_get(const Evas_Object *obj)
1703 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1704 win = elm_widget_data_get(obj);
1705 if (!win) return EINA_FALSE;
1706 return win->autodel;
1710 elm_win_activate(Evas_Object *obj)
1713 ELM_CHECK_WIDTYPE(obj, widtype);
1714 win = elm_widget_data_get(obj);
1716 ecore_evas_activate(win->ee);
1720 elm_win_lower(Evas_Object *obj)
1723 ELM_CHECK_WIDTYPE(obj, widtype);
1724 win = elm_widget_data_get(obj);
1726 ecore_evas_lower(win->ee);
1730 elm_win_raise(Evas_Object *obj)
1733 ELM_CHECK_WIDTYPE(obj, widtype);
1734 win = elm_widget_data_get(obj);
1736 ecore_evas_raise(win->ee);
1740 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1743 ELM_CHECK_WIDTYPE(obj, widtype);
1744 win = elm_widget_data_get(obj);
1746 ecore_evas_borderless_set(win->ee, borderless);
1747 #ifdef HAVE_ELEMENTARY_X
1748 _elm_win_xwin_update(win);
1753 elm_win_borderless_get(const Evas_Object *obj)
1756 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1757 win = elm_widget_data_get(obj);
1758 if (!win) return EINA_FALSE;
1759 return ecore_evas_borderless_get(win->ee);
1763 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1766 ELM_CHECK_WIDTYPE(obj, widtype);
1767 win = elm_widget_data_get(obj);
1769 ecore_evas_shaped_set(win->ee, shaped);
1770 #ifdef HAVE_ELEMENTARY_X
1771 _elm_win_xwin_update(win);
1776 elm_win_shaped_get(const Evas_Object *obj)
1779 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1780 win = elm_widget_data_get(obj);
1781 if (!win) return EINA_FALSE;
1782 return ecore_evas_shaped_get(win->ee);
1786 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1789 ELM_CHECK_WIDTYPE(obj, widtype);
1790 win = elm_widget_data_get(obj);
1795 else if (win->img_obj)
1797 evas_object_image_alpha_set(win->img_obj, alpha);
1801 #ifdef HAVE_ELEMENTARY_X
1806 if (!_elm_config->compositing)
1807 elm_win_shaped_set(obj, alpha);
1809 ecore_evas_alpha_set(win->ee, alpha);
1812 ecore_evas_alpha_set(win->ee, alpha);
1813 _elm_win_xwin_update(win);
1817 ecore_evas_alpha_set(win->ee, alpha);
1822 elm_win_alpha_get(const Evas_Object *obj)
1825 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1826 win = elm_widget_data_get(obj);
1827 if (!win) return EINA_FALSE;
1828 return ecore_evas_alpha_get(win->ee);
1832 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1835 ELM_CHECK_WIDTYPE(obj, widtype);
1836 win = elm_widget_data_get(obj);
1842 else if (win->img_obj)
1844 evas_object_image_alpha_set(win->img_obj, transparent);
1848 #ifdef HAVE_ELEMENTARY_X
1851 ecore_evas_transparent_set(win->ee, transparent);
1852 _elm_win_xwin_update(win);
1856 ecore_evas_transparent_set(win->ee, transparent);
1861 elm_win_transparent_get(const Evas_Object *obj)
1864 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1865 win = elm_widget_data_get(obj);
1866 if (!win) return EINA_FALSE;
1868 return ecore_evas_transparent_get(win->ee);
1872 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1875 ELM_CHECK_WIDTYPE(obj, widtype);
1876 win = elm_widget_data_get(obj);
1878 ecore_evas_override_set(win->ee, override);
1879 #ifdef HAVE_ELEMENTARY_X
1880 _elm_win_xwin_update(win);
1885 elm_win_override_get(const Evas_Object *obj)
1888 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1889 win = elm_widget_data_get(obj);
1890 if (!win) return EINA_FALSE;
1891 return ecore_evas_override_get(win->ee);
1895 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1898 ELM_CHECK_WIDTYPE(obj, widtype);
1899 win = elm_widget_data_get(obj);
1902 // YYY: handle if win->img_obj
1903 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1904 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1905 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1907 // these engines... can ONLY be fullscreen
1912 ecore_evas_fullscreen_set(win->ee, fullscreen);
1913 #ifdef HAVE_ELEMENTARY_X
1914 _elm_win_xwin_update(win);
1917 #undef ENGINE_COMPARE
1921 elm_win_fullscreen_get(const Evas_Object *obj)
1924 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1925 win = elm_widget_data_get(obj);
1926 if (!win) return EINA_FALSE;
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 return ecore_evas_fullscreen_get(win->ee);
1939 #undef ENGINE_COMPARE
1943 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1946 ELM_CHECK_WIDTYPE(obj, widtype);
1947 win = elm_widget_data_get(obj);
1949 // YYY: handle if win->img_obj
1950 ecore_evas_maximized_set(win->ee, maximized);
1951 #ifdef HAVE_ELEMENTARY_X
1952 _elm_win_xwin_update(win);
1957 elm_win_maximized_get(const Evas_Object *obj)
1960 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1961 win = elm_widget_data_get(obj);
1962 if (!win) return EINA_FALSE;
1963 return ecore_evas_maximized_get(win->ee);
1967 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1970 ELM_CHECK_WIDTYPE(obj, widtype);
1971 win = elm_widget_data_get(obj);
1973 ecore_evas_iconified_set(win->ee, iconified);
1974 #ifdef HAVE_ELEMENTARY_X
1975 _elm_win_xwin_update(win);
1980 elm_win_iconified_get(const Evas_Object *obj)
1983 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1984 win = elm_widget_data_get(obj);
1985 if (!win) return EINA_FALSE;
1986 return ecore_evas_iconified_get(win->ee);
1990 elm_win_layer_set(Evas_Object *obj, int layer)
1993 ELM_CHECK_WIDTYPE(obj, widtype);
1994 win = elm_widget_data_get(obj);
1996 ecore_evas_layer_set(win->ee, layer);
1997 #ifdef HAVE_ELEMENTARY_X
1998 _elm_win_xwin_update(win);
2003 elm_win_layer_get(const Evas_Object *obj)
2006 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2007 win = elm_widget_data_get(obj);
2008 if (!win) return -1;
2009 return ecore_evas_layer_get(win->ee);
2013 elm_win_rotation_set(Evas_Object *obj, int rotation)
2016 ELM_CHECK_WIDTYPE(obj, widtype);
2017 win = elm_widget_data_get(obj);
2019 if (win->rot == rotation) return;
2020 win->rot = rotation;
2021 ecore_evas_rotation_set(win->ee, rotation);
2022 evas_object_size_hint_min_set(obj, -1, -1);
2023 evas_object_size_hint_max_set(obj, -1, -1);
2024 _elm_win_eval_subobjs(obj);
2025 #ifdef HAVE_ELEMENTARY_X
2026 _elm_win_xwin_update(win);
2031 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2034 ELM_CHECK_WIDTYPE(obj, widtype);
2035 win = elm_widget_data_get(obj);
2037 if (win->rot == rotation) return;
2038 win->rot = rotation;
2039 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2040 evas_object_size_hint_min_set(obj, -1, -1);
2041 evas_object_size_hint_max_set(obj, -1, -1);
2042 _elm_win_eval_subobjs(obj);
2043 #ifdef HAVE_ELEMENTARY_X
2044 _elm_win_xwin_update(win);
2049 elm_win_rotation_get(const Evas_Object *obj)
2052 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2053 win = elm_widget_data_get(obj);
2054 if (!win) return -1;
2059 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2062 ELM_CHECK_WIDTYPE(obj, widtype);
2063 win = elm_widget_data_get(obj);
2065 ecore_evas_sticky_set(win->ee, sticky);
2066 #ifdef HAVE_ELEMENTARY_X
2067 _elm_win_xwin_update(win);
2072 elm_win_sticky_get(const Evas_Object *obj)
2075 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2076 win = elm_widget_data_get(obj);
2077 if (!win) return EINA_FALSE;
2078 return ecore_evas_sticky_get(win->ee);
2082 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2085 ELM_CHECK_WIDTYPE(obj, widtype);
2086 win = elm_widget_data_get(obj);
2088 if (mode == win->kbdmode) return;
2089 #ifdef HAVE_ELEMENTARY_X
2090 _elm_win_xwindow_get(win);
2092 win->kbdmode = mode;
2093 #ifdef HAVE_ELEMENTARY_X
2095 ecore_x_e_virtual_keyboard_state_set
2096 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2100 EAPI Elm_Win_Keyboard_Mode
2101 elm_win_keyboard_mode_get(const Evas_Object *obj)
2104 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2105 win = elm_widget_data_get(obj);
2106 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2107 return win->kbdmode;
2111 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2114 ELM_CHECK_WIDTYPE(obj, widtype);
2115 win = elm_widget_data_get(obj);
2117 #ifdef HAVE_ELEMENTARY_X
2118 _elm_win_xwindow_get(win);
2120 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2125 elm_win_keyboard_win_get(const Evas_Object *obj)
2128 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2129 win = elm_widget_data_get(obj);
2130 if (!win) return EINA_FALSE;
2131 #ifdef HAVE_ELEMENTARY_X
2132 _elm_win_xwindow_get(win);
2134 return ecore_x_e_virtual_keyboard_get(win->xwin);
2140 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2143 ELM_CHECK_WIDTYPE(obj, widtype);
2144 win = elm_widget_data_get(obj);
2146 if (x) *x = win->screen.x;
2147 if (y) *y = win->screen.y;
2151 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2154 ELM_CHECK_WIDTYPE(obj, widtype);
2155 win = elm_widget_data_get(obj);
2157 #ifdef HAVE_ELEMENTARY_X
2158 _elm_win_xwindow_get(win);
2160 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2165 elm_win_conformant_get(const Evas_Object *obj)
2168 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2169 win = elm_widget_data_get(obj);
2170 if (!win) return EINA_FALSE;
2171 #ifdef HAVE_ELEMENTARY_X
2172 _elm_win_xwindow_get(win);
2174 return ecore_x_e_illume_conformant_get(win->xwin);
2180 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2183 ELM_CHECK_WIDTYPE(obj, widtype);
2184 win = elm_widget_data_get(obj);
2186 #ifdef HAVE_ELEMENTARY_X
2187 _elm_win_xwindow_get(win);
2190 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2193 Ecore_X_Window_State states[2];
2195 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2196 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2197 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2198 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2205 elm_win_quickpanel_get(const Evas_Object *obj)
2208 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2209 win = elm_widget_data_get(obj);
2210 if (!win) return EINA_FALSE;
2211 #ifdef HAVE_ELEMENTARY_X
2212 _elm_win_xwindow_get(win);
2214 return ecore_x_e_illume_quickpanel_get(win->xwin);
2220 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2223 ELM_CHECK_WIDTYPE(obj, widtype);
2224 win = elm_widget_data_get(obj);
2226 #ifdef HAVE_ELEMENTARY_X
2227 _elm_win_xwindow_get(win);
2229 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2234 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2237 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2238 win = elm_widget_data_get(obj);
2239 if (!win) return -1;
2240 #ifdef HAVE_ELEMENTARY_X
2241 _elm_win_xwindow_get(win);
2243 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2249 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2252 ELM_CHECK_WIDTYPE(obj, widtype);
2253 win = elm_widget_data_get(obj);
2255 #ifdef HAVE_ELEMENTARY_X
2256 _elm_win_xwindow_get(win);
2258 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2263 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2266 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2267 win = elm_widget_data_get(obj);
2268 if (!win) return -1;
2269 #ifdef HAVE_ELEMENTARY_X
2270 _elm_win_xwindow_get(win);
2272 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2278 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2281 ELM_CHECK_WIDTYPE(obj, widtype);
2282 win = elm_widget_data_get(obj);
2284 #ifdef HAVE_ELEMENTARY_X
2285 _elm_win_xwindow_get(win);
2287 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2292 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2295 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2296 win = elm_widget_data_get(obj);
2298 #ifdef HAVE_ELEMENTARY_X
2299 _elm_win_xwindow_get(win);
2301 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2307 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2310 ELM_CHECK_WIDTYPE(obj, widtype);
2311 win = elm_widget_data_get(obj);
2313 #ifdef HAVE_ELEMENTARY_X
2314 _elm_win_xwindow_get(win);
2319 Ecore_X_Window_State states[2];
2321 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2322 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2323 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2324 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2331 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2334 ELM_CHECK_WIDTYPE(obj, widtype);
2335 win = elm_widget_data_get(obj);
2337 #ifdef HAVE_ELEMENTARY_X
2338 _elm_win_xwindow_get(win);
2343 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2344 ecore_x_e_illume_focus_back_send(win->xwin);
2346 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2347 ecore_x_e_illume_focus_forward_send(win->xwin);
2349 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2350 ecore_x_e_illume_focus_home_send(win->xwin);
2352 case ELM_ILLUME_COMMAND_CLOSE:
2353 ecore_x_e_illume_close_send(win->xwin);
2363 elm_win_inlined_image_object_get(Evas_Object *obj)
2366 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2367 win = elm_widget_data_get(obj);
2368 if (!win) return NULL;
2369 return win->img_obj;
2373 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2377 ELM_CHECK_WIDTYPE(obj, widtype);
2379 win = elm_widget_data_get(obj);
2380 enabled = !!enabled;
2381 if (win->focus_highlight.enabled == enabled)
2384 win->focus_highlight.enabled = enabled;
2386 if (win->focus_highlight.enabled)
2387 _elm_win_focus_highlight_init(win);
2389 _elm_win_focus_highlight_shutdown(win);
2393 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2397 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2399 win = elm_widget_data_get(obj);
2400 return win->focus_highlight.enabled;
2404 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2408 ELM_CHECK_WIDTYPE(obj, widtype);
2410 win = elm_widget_data_get(obj);
2411 eina_stringshare_replace(&win->focus_highlight.style, style);
2412 win->focus_highlight.changed_theme = EINA_TRUE;
2413 _elm_win_focus_highlight_reconfigure_job_start(win);
2417 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2421 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2423 win = elm_widget_data_get(obj);
2424 return win->focus_highlight.style;
2428 elm_win_indicator_state_set(Evas_Object *obj, int show_state)
2431 if (strcmp(elm_widget_type_get(obj), "win")) return;
2432 win = elm_widget_data_get(obj);
2434 #ifdef HAVE_ELEMENTARY_X
2435 _elm_win_xwindow_get(win);
2437 return ecore_x_window_prop_property_set (win->xwin,
2438 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
2444 elm_win_indicator_state_get(Evas_Object *obj)
2447 if (strcmp(elm_widget_type_get(obj), "win")) return -1;
2448 win = elm_widget_data_get(obj);
2449 if (!win) return -1;
2450 #ifdef HAVE_ELEMENTARY_X
2451 _elm_win_xwindow_get(win);
2457 unsigned int *prop_data = NULL;
2459 ret = ecore_x_window_prop_property_get (win->xwin,
2460 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, (void *)&prop_data, &count);
2461 if( ret && prop_data )
2462 memcpy (&show, prop_data, sizeof (int));
2464 if (prop_data) free (prop_data);
2473 typedef struct _Widget_Data Widget_Data;
2478 Evas_Object *content;
2481 static void _del_hook(Evas_Object *obj);
2482 static void _theme_hook(Evas_Object *obj);
2483 static void _sizing_eval(Evas_Object *obj);
2484 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2485 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2487 static const char *widtype2 = NULL;
2490 _del_hook(Evas_Object *obj)
2492 Widget_Data *wd = elm_widget_data_get(obj);
2498 _theme_hook(Evas_Object *obj)
2500 Widget_Data *wd = elm_widget_data_get(obj);
2501 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2503 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2508 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2510 Widget_Data *wd = elm_widget_data_get(obj);
2515 /* Try Focus cycle in subitem */
2518 elm_widget_focus_next_get(wd->content, dir, next);
2523 *next = (Evas_Object *)obj;
2528 _sizing_eval(Evas_Object *obj)
2530 Widget_Data *wd = elm_widget_data_get(obj);
2531 Evas_Coord minw = -1, minh = -1;
2533 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2534 edje_object_size_min_calc(wd->frm, &minw, &minh);
2535 evas_object_size_hint_min_set(obj, minw, minh);
2536 evas_object_size_hint_max_set(obj, -1, -1);
2540 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2546 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2548 Widget_Data *wd = elm_widget_data_get(obj);
2549 Evas_Object *sub = event_info;
2550 if (sub == wd->content)
2552 evas_object_event_callback_del_full
2553 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2560 elm_win_inwin_add(Evas_Object *obj)
2566 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2567 win = elm_widget_data_get(obj);
2568 if (!win) return NULL;
2569 wd = ELM_NEW(Widget_Data);
2570 obj2 = elm_widget_add(win->evas);
2571 elm_widget_type_set(obj2, "inwin");
2572 ELM_SET_WIDTYPE(widtype2, "inwin");
2573 elm_widget_sub_object_add(obj, obj2);
2574 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2575 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2576 elm_win_resize_object_add(obj, obj2);
2578 elm_widget_data_set(obj2, wd);
2579 elm_widget_del_hook_set(obj2, _del_hook);
2580 elm_widget_theme_hook_set(obj2, _theme_hook);
2581 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2582 elm_widget_can_focus_set(obj2, EINA_TRUE);
2583 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2585 wd->frm = edje_object_add(win->evas);
2586 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2587 elm_widget_resize_object_set(obj2, wd->frm);
2589 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2596 elm_win_inwin_activate(Evas_Object *obj)
2598 ELM_CHECK_WIDTYPE(obj, widtype2);
2599 Widget_Data *wd = elm_widget_data_get(obj);
2601 evas_object_raise(obj);
2602 evas_object_show(obj);
2603 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2604 elm_object_focus_set(obj, EINA_TRUE);
2608 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2610 ELM_CHECK_WIDTYPE(obj, widtype2);
2611 Widget_Data *wd = elm_widget_data_get(obj);
2613 if (wd->content == content) return;
2614 if (wd->content) evas_object_del(wd->content);
2615 wd->content = content;
2618 elm_widget_sub_object_add(obj, content);
2619 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2620 _changed_size_hints, obj);
2621 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2627 elm_win_inwin_content_get(const Evas_Object *obj)
2629 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2630 Widget_Data *wd = elm_widget_data_get(obj);
2631 if (!wd) return NULL;
2636 elm_win_inwin_content_unset(Evas_Object *obj)
2638 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2639 Widget_Data *wd = elm_widget_data_get(obj);
2640 if (!wd) return NULL;
2641 if (!wd->content) return NULL;
2642 Evas_Object *content = wd->content;
2643 elm_widget_sub_object_del(obj, wd->content);
2644 evas_object_event_callback_del_full(wd->content,
2645 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2646 _changed_size_hints, obj);
2647 edje_object_part_unswallow(wd->frm, wd->content);
2652 /* windowing spcific calls - shall we do this differently? */
2654 static Ecore_X_Window
2655 _elm_ee_win_get(const Evas_Object *obj)
2658 #ifdef HAVE_ELEMENTARY_X
2659 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2660 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2666 elm_win_xwindow_get(const Evas_Object *obj)
2672 type = elm_widget_type_get(obj);
2673 if (!type) return 0;
2674 if (type != widtype) return _elm_ee_win_get(obj);
2675 #ifdef HAVE_ELEMENTARY_X
2676 win = elm_widget_data_get(obj);
2678 if (win->xwin) return win->xwin;
2679 if (win->parent) return elm_win_xwindow_get(win->parent);