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 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
472 _elm_win_obj_callback_del, win);
473 while (((child = evas_object_bottom_get(win->evas))) &&
476 evas_object_del(child);
478 while (((child = evas_object_top_get(win->evas))) &&
481 evas_object_del(child);
483 #ifdef HAVE_ELEMENTARY_X
484 if (win->client_message_handler)
485 ecore_event_handler_del(win->client_message_handler);
487 // FIXME: Why are we flushing edje on every window destroy ??
488 // edje_file_cache_flush();
489 // edje_collection_cache_flush();
490 // evas_image_cache_flush(win->evas);
491 // evas_font_cache_flush(win->evas);
492 // FIXME: we are in the del handler for the object and delete the canvas
493 // that lives under it from the handler... nasty. deferring doesn't help either
503 ecore_job_add(_deferred_ecore_evas_free, win->ee);
504 _elm_win_deferred_free++;
508 _elm_win_focus_highlight_shutdown(win);
509 eina_stringshare_del(win->focus_highlight.style);
513 if ((!_elm_win_list) &&
514 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
516 edje_file_cache_flush();
517 edje_collection_cache_flush();
518 evas_image_cache_flush(e);
519 evas_font_cache_flush(e);
525 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
528 if (!win->img_obj) return;
529 evas_object_event_callback_del_full
530 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
531 evas_object_del(win->img_obj);
535 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
538 if (obj == win->parent) win->parent = NULL;
542 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
548 if ((x != win->screen.x) || (y != win->screen.y))
552 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
557 evas_object_move(obj, x, y);
562 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
565 // this is called to make sure all smart containers have calculated their
566 // sizes BEFORE we show the window to make sure it initially appears at
567 // our desired size (ie min size is known first)
568 evas_smart_objects_calculate(evas_object_evas_get(obj));
569 evas_object_show(obj);
573 else if (win->img_obj)
575 evas_object_show(win->img_obj);
580 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
584 if (ecore_evas_override_get(win->ee))
588 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
591 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
596 else if (win->img_obj)
600 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
603 // evas_object_move(win->img_obj, x, y);
608 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
615 else if (win->img_obj)
617 Evas_Coord w = 1, h = 1;
619 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
622 evas_object_image_size_set(win->img_obj, w, h);
627 _elm_win_delete_request(Ecore_Evas *ee)
629 Evas_Object *obj = ecore_evas_object_associate_get(ee);
631 if (strcmp(elm_widget_type_get(obj), "win")) return;
633 win = elm_widget_data_get(obj);
635 int autodel = win->autodel;
636 win->autodel_clear = &autodel;
637 evas_object_ref(win->win_obj);
638 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
639 // FIXME: if above callback deletes - then the below will be invalid
640 if (autodel) evas_object_del(win->win_obj);
641 else win->autodel_clear = NULL;
642 evas_object_unref(win->win_obj);
646 _elm_win_resize_job(void *data)
653 win->deferred_resize_job = NULL;
654 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
655 evas_object_resize(win->win_obj, w, h);
659 else if (win->img_obj)
662 EINA_LIST_FOREACH(win->subobjs, l, obj)
664 evas_object_move(obj, 0, 0);
665 evas_object_resize(obj, w, h);
669 #ifdef HAVE_ELEMENTARY_X
671 _elm_win_xwindow_get(Elm_Win *win)
675 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
676 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
678 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
680 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
681 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
682 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
683 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
684 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
685 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
686 ENGINE_COMPARE(ELM_OPENGL_COCOA))
689 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
691 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
693 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
695 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
698 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
700 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
703 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
705 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
707 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
709 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
711 #undef ENGINE_COMPARE
715 #ifdef HAVE_ELEMENTARY_X
717 _elm_win_xwin_update(Elm_Win *win)
719 _elm_win_xwindow_get(win);
724 win2 = elm_widget_data_get(win->parent);
728 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
732 if (!win->xwin) return; /* nothing more to do */
737 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
739 case ELM_WIN_DIALOG_BASIC:
740 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
742 case ELM_WIN_DESKTOP:
743 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
746 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
748 case ELM_WIN_TOOLBAR:
749 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
752 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
754 case ELM_WIN_UTILITY:
755 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
758 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
760 case ELM_WIN_DROPDOWN_MENU:
761 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
763 case ELM_WIN_POPUP_MENU:
764 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
766 case ELM_WIN_TOOLTIP:
767 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
769 case ELM_WIN_NOTIFICATION:
770 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
773 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
776 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
781 ecore_x_e_virtual_keyboard_state_set
782 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
787 _elm_win_eval_subobjs(Evas_Object *obj)
790 const Evas_Object *child;
792 Elm_Win *win = elm_widget_data_get(obj);
793 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
797 EINA_LIST_FOREACH(win->subobjs, l, child)
799 evas_object_size_hint_weight_get(child, &wx, &wy);
800 if (wx == 0.0) xx = 0;
801 if (wy == 0.0) xy = 0;
803 evas_object_size_hint_min_get(child, &w, &h);
806 if (w > minw) minw = w;
807 if (h > minh) minh = h;
809 evas_object_size_hint_max_get(child, &w, &h);
812 if (maxw == -1) maxw = w;
813 else if ((w > 0) && (w < maxw)) maxw = w;
814 if (maxh == -1) maxh = h;
815 else if ((h > 0) && (h < maxh)) maxh = h;
817 if (!xx) maxw = minw;
819 if (!xy) maxh = minh;
821 evas_object_size_hint_min_set(obj, minw, minh);
822 evas_object_size_hint_max_set(obj, maxw, maxh);
823 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
824 if (w < minw) w = minw;
825 if (h < minh) h = minh;
826 if ((maxw >= 0) && (w > maxw)) w = maxw;
827 if ((maxh >= 0) && (h > maxh)) h = maxh;
828 evas_object_resize(obj, w, h);
832 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
834 Elm_Win *win = elm_widget_data_get(data);
835 win->subobjs = eina_list_remove(win->subobjs, obj);
836 _elm_win_eval_subobjs(win->win_obj);
840 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
842 _elm_win_eval_subobjs(data);
846 _elm_win_shutdown(void)
848 while (_elm_win_list)
849 evas_object_del(_elm_win_list->data);
853 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
860 EINA_LIST_FOREACH(_elm_win_list, l, obj)
861 elm_widget_theme(obj);
865 EINA_LIST_FOREACH(_elm_win_list, l, obj)
866 elm_widget_theme_specific(obj, th, EINA_FALSE);
871 _elm_win_translate(void)
876 EINA_LIST_FOREACH(_elm_win_list, l, obj)
877 elm_widget_translate(obj);
880 #ifdef HAVE_ELEMENTARY_X
882 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
885 Ecore_X_Event_Client_Message *e = event;
887 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
888 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
890 if ((unsigned)e->data.l[0] == win->xwin)
892 Evas *evas = evas_object_evas_get(win->win_obj);
895 edje_file_cache_flush();
896 edje_collection_cache_flush();
897 evas_image_cache_flush(evas);
898 evas_font_cache_flush(evas);
902 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
904 if ((unsigned)e->data.l[0] == win->xwin)
906 Evas *evas = evas_object_evas_get(win->win_obj);
909 edje_file_cache_flush();
910 edje_collection_cache_flush();
911 evas_image_cache_flush(evas);
912 evas_font_cache_flush(evas);
913 evas_render_dump(evas);
917 return ECORE_CALLBACK_PASS_ON;
922 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
926 win->focus_highlight.geometry_changed = EINA_TRUE;
927 _elm_win_focus_highlight_reconfigure_job_start(win);
931 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
935 win->focus_highlight.geometry_changed = EINA_TRUE;
936 _elm_win_focus_highlight_reconfigure_job_start(win);
940 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
944 win->focus_highlight.cur.target = NULL;
946 _elm_win_focus_highlight_reconfigure_job_start(win);
950 _elm_win_focus_target_callbacks_add(Elm_Win *win)
952 Evas_Object *obj = win->focus_highlight.cur.target;
954 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
955 _elm_win_focus_target_move, win);
956 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
957 _elm_win_focus_target_resize, win);
958 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
959 _elm_win_focus_target_del, win);
963 _elm_win_focus_target_callbacks_del(Elm_Win *win)
965 Evas_Object *obj = win->focus_highlight.cur.target;
967 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
968 _elm_win_focus_target_move, win);
969 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
970 _elm_win_focus_target_resize, win);
971 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
972 _elm_win_focus_target_del, win);
976 _elm_win_focus_target_get(Evas_Object *obj)
978 Evas_Object *o = obj;
982 if (elm_widget_is(o))
984 if (!elm_widget_highlight_ignore_get(o))
986 o = elm_widget_parent_get(o);
988 o = evas_object_smart_parent_get(o);
992 o = elm_widget_parent_widget_get(o);
994 o = evas_object_smart_parent_get(o);
1003 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1005 Evas_Object *obj = event_info, *target;
1006 Elm_Win *win = data;
1008 if (win->focus_highlight.cur.target == obj)
1011 target = _elm_win_focus_target_get(obj);
1012 win->focus_highlight.cur.target = target;
1013 if (elm_widget_highlight_in_theme_get(target))
1014 win->focus_highlight.cur.handled = EINA_TRUE;
1016 _elm_win_focus_target_callbacks_add(win);
1018 _elm_win_focus_highlight_reconfigure_job_start(win);
1022 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1024 Elm_Win *win = data;
1026 if (!win->focus_highlight.cur.target)
1029 if (!win->focus_highlight.cur.handled)
1030 _elm_win_focus_target_callbacks_del(win);
1031 win->focus_highlight.cur.target = NULL;
1032 win->focus_highlight.cur.handled = EINA_FALSE;
1034 _elm_win_focus_highlight_reconfigure_job_start(win);
1038 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1040 evas_object_hide(obj);
1044 _elm_win_focus_highlight_init(Elm_Win *win)
1046 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1047 _elm_win_object_focus_in, win);
1048 evas_event_callback_add(win->evas,
1049 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1050 _elm_win_object_focus_out, win);
1052 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1054 win->focus_highlight.top = edje_object_add(win->evas);
1055 win->focus_highlight.changed_theme = EINA_TRUE;
1056 edje_object_signal_callback_add(win->focus_highlight.top,
1057 "elm,action,focus,hide,end", "",
1058 _elm_win_focus_highlight_hide, NULL);
1059 edje_object_signal_callback_add(win->focus_highlight.top,
1060 "elm,action,focus,anim,end", "",
1061 _elm_win_focus_highlight_anim_end, win);
1062 _elm_win_focus_highlight_reconfigure_job_start(win);
1066 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1068 _elm_win_focus_highlight_reconfigure_job_stop(win);
1069 if (win->focus_highlight.cur.target)
1071 _elm_win_focus_target_callbacks_del(win);
1072 win->focus_highlight.cur.target = NULL;
1074 if (win->focus_highlight.top)
1076 evas_object_del(win->focus_highlight.top);
1077 win->focus_highlight.top = NULL;
1080 evas_event_callback_del_full(win->evas,
1081 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1082 _elm_win_object_focus_in, win);
1083 evas_event_callback_del_full(win->evas,
1084 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1085 _elm_win_object_focus_out, win);
1089 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1093 top = win->focus_highlight.top;
1098 evas_object_show(top);
1099 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1105 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1110 _elm_win_focus_highlight_reconfigure_job(void *data)
1112 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1116 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1118 if (win->focus_highlight.reconf_job)
1119 ecore_job_del(win->focus_highlight.reconf_job);
1120 win->focus_highlight.reconf_job = ecore_job_add(
1121 _elm_win_focus_highlight_reconfigure_job, win);
1125 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1127 if (win->focus_highlight.reconf_job)
1128 ecore_job_del(win->focus_highlight.reconf_job);
1129 win->focus_highlight.reconf_job = NULL;
1133 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1135 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1136 Evas_Coord x, y, w, h;
1138 clip = evas_object_clip_get(target);
1139 evas_object_geometry_get(target, &x, &y, &w, &h);
1141 evas_object_move(obj, x, y);
1142 evas_object_resize(obj, w, h);
1143 evas_object_clip_set(obj, clip);
1147 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1149 Evas_Coord tx, ty, tw, th;
1150 Evas_Coord w, h, px, py, pw, ph;
1151 Edje_Message_Int_Set *m;
1152 Evas_Object *previous = win->focus_highlight.prev.target;
1153 Evas_Object *target = win->focus_highlight.cur.target;
1155 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1156 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1157 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1158 evas_object_move(obj, 0, 0);
1159 evas_object_resize(obj, tw, th);
1160 evas_object_clip_unset(obj);
1162 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1172 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1176 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1178 Elm_Win *win = data;
1179 _elm_win_focus_highlight_simple_setup(win, obj);
1183 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1185 Evas_Object *target = win->focus_highlight.cur.target;
1186 Evas_Object *previous = win->focus_highlight.prev.target;
1187 Evas_Object *top = win->focus_highlight.top;
1188 Eina_Bool visible_changed;
1189 Eina_Bool common_visible;
1190 const char *sig = NULL;
1192 _elm_win_focus_highlight_reconfigure_job_stop(win);
1194 visible_changed = (win->focus_highlight.cur.visible !=
1195 win->focus_highlight.prev.visible);
1197 if ((target == previous) && (!visible_changed) &&
1198 (!win->focus_highlight.geometry_changed))
1201 if ((previous) && (win->focus_highlight.prev.handled))
1202 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1205 common_visible = EINA_FALSE;
1206 else if (win->focus_highlight.cur.handled)
1208 common_visible = EINA_FALSE;
1209 if (win->focus_highlight.cur.visible)
1210 sig = "elm,action,focus_highlight,show";
1212 sig = "elm,action,focus_highlight,hide";
1215 common_visible = win->focus_highlight.cur.visible;
1217 _elm_win_focus_highlight_visible_set(win, common_visible);
1219 elm_widget_signal_emit(target, sig, "elm");
1221 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1224 if (win->focus_highlight.changed_theme)
1227 if (win->focus_highlight.style)
1228 str = win->focus_highlight.style;
1231 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1233 win->focus_highlight.changed_theme = EINA_FALSE;
1235 if (_elm_config->focus_highlight_animate)
1237 str = edje_object_data_get(win->focus_highlight.top, "animate");
1238 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1242 if ((win->focus_highlight.top_animate) && (previous) &&
1243 (!win->focus_highlight.prev.handled))
1244 _elm_win_focus_highlight_anim_setup(win, top);
1246 _elm_win_focus_highlight_simple_setup(win, top);
1247 evas_object_raise(top);
1250 win->focus_highlight.geometry_changed = EINA_FALSE;
1251 win->focus_highlight.prev = win->focus_highlight.cur;
1256 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1258 Evas_Event_Key_Down *ev = event_info;
1260 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1264 if ((strcmp(ev->keyname, "F12")) ||
1265 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1268 printf("Tree graph generated.\n");
1269 elm_object_tree_dot_dump(obj, "./dump.dot");
1274 _win_img_hide(void *data,
1276 Evas_Object *obj __UNUSED__,
1277 void *event_info __UNUSED__)
1279 Elm_Win *win = data;
1281 elm_widget_focus_hide_handle(win->win_obj);
1285 _win_img_mouse_up(void *data,
1287 Evas_Object *obj __UNUSED__,
1290 Elm_Win *win = data;
1291 Evas_Event_Mouse_Up *ev = event_info;
1292 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1293 elm_widget_focus_mouse_up_handle(win->win_obj);
1297 _win_img_focus_in(void *data,
1299 Evas_Object *obj __UNUSED__,
1300 void *event_info __UNUSED__)
1302 Elm_Win *win = data;
1303 elm_widget_focus_steal(win->win_obj);
1307 _win_img_focus_out(void *data,
1309 Evas_Object *obj __UNUSED__,
1310 void *event_info __UNUSED__)
1312 Elm_Win *win = data;
1313 elm_widget_focused_object_clear(win->win_obj);
1317 _win_inlined_image_set(Elm_Win *win)
1319 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1320 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1321 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1322 _elm_win_obj_callback_img_obj_del, win);
1324 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1325 _win_img_hide, win);
1326 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1327 _win_img_mouse_up, win);
1328 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1329 _win_img_focus_in, win);
1330 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1331 _win_img_focus_out, win);
1335 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1339 const char *fontpath;
1341 win = ELM_NEW(Elm_Win);
1343 #define FALLBACK_TRY(engine) \
1346 CRITICAL(engine " engine creation failed. Trying software X11."); \
1347 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1348 elm_engine_set(ELM_SOFTWARE_X11); \
1350 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1354 case ELM_WIN_INLINED_IMAGE:
1358 Evas *e = evas_object_evas_get(parent);
1361 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1364 win->img_obj = ecore_evas_object_image_new(ee);
1367 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1370 _win_inlined_image_set(win);
1374 evas_object_del(win->img_obj);
1375 win->img_obj = NULL;
1384 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1386 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1387 #ifdef HAVE_ELEMENTARY_X
1388 win->client_message_handler = ecore_event_handler_add
1389 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1392 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1394 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1395 FALLBACK_TRY("Sofware FB");
1397 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1399 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1400 FALLBACK_TRY("Sofware DirectFB");
1402 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1404 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1405 FALLBACK_TRY("Sofware-16");
1406 #ifdef HAVE_ELEMENTARY_X
1407 win->client_message_handler = ecore_event_handler_add
1408 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1411 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1413 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1414 FALLBACK_TRY("Sofware-8");
1415 #ifdef HAVE_ELEMENTARY_X
1416 win->client_message_handler = ecore_event_handler_add
1417 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1421 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1423 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1424 FALLBACK_TRY("XRender");
1425 #ifdef HAVE_ELEMENTARY_X
1426 win->client_message_handler = ecore_event_handler_add
1427 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1431 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1436 if (_elm_config->vsync)
1438 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1444 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1446 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1447 FALLBACK_TRY("OpenGL");
1448 #ifdef HAVE_ELEMENTARY_X
1449 win->client_message_handler = ecore_event_handler_add
1450 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1453 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1455 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1456 FALLBACK_TRY("Sofware Win32");
1458 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1460 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1461 FALLBACK_TRY("Sofware-16-WinCE");
1463 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1465 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1466 FALLBACK_TRY("PSL1GHT");
1468 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1470 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1471 FALLBACK_TRY("Sofware SDL");
1473 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1475 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1476 FALLBACK_TRY("Sofware-16-SDL");
1478 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1480 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1481 FALLBACK_TRY("OpenGL SDL");
1483 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1485 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1486 FALLBACK_TRY("OpenGL Cocoa");
1488 else if (ENGINE_COMPARE(ELM_BUFFER))
1490 win->ee = ecore_evas_buffer_new(1, 1);
1492 else if (ENGINE_COMPARE(ELM_EWS))
1494 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1496 else if (!strncmp(_elm_config->engine, "shot:", 5))
1498 win->ee = ecore_evas_buffer_new(1, 1);
1499 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1500 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1509 ERR("Cannot create window.");
1513 #ifdef HAVE_ELEMENTARY_X
1514 _elm_win_xwindow_get(win);
1516 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1517 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1518 // bg pixmap done by x - has other issues like can be redrawn by x before it
1519 // is filled/ready by app
1520 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1523 win->parent = parent;
1525 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1526 _elm_win_obj_callback_parent_del, win);
1528 win->evas = ecore_evas_get(win->ee);
1529 win->win_obj = elm_widget_add(win->evas);
1530 elm_widget_type_set(win->win_obj, "win");
1531 ELM_SET_WIDTYPE(widtype, "win");
1532 elm_widget_data_set(win->win_obj, win);
1533 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1534 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1535 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1536 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1537 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1538 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1539 evas_object_move(win->win_obj, 0, 0);
1540 evas_object_resize(win->win_obj, 1, 1);
1541 evas_object_layer_set(win->win_obj, 50);
1542 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1544 ecore_evas_object_associate(win->ee, win->win_obj,
1545 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1546 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1547 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1548 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1549 _elm_win_obj_callback_show, win);
1550 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1551 _elm_win_obj_callback_hide, win);
1552 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1553 _elm_win_obj_callback_del, win);
1554 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1555 _elm_win_obj_callback_move, win);
1556 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1557 _elm_win_obj_callback_resize, win);
1559 evas_object_intercept_move_callback_add(win->win_obj,
1560 _elm_win_obj_intercept_move, win);
1561 evas_object_intercept_show_callback_add(win->win_obj,
1562 _elm_win_obj_intercept_show, win);
1564 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1565 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1566 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1567 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1568 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1569 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1570 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1571 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1572 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1573 evas_font_path_append(win->evas, fontpath);
1574 if (!_elm_config->font_hinting)
1575 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1576 else if (_elm_config->font_hinting == 1)
1577 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1578 else if (_elm_config->font_hinting == 2)
1579 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1581 #ifdef HAVE_ELEMENTARY_X
1582 _elm_win_xwin_update(win);
1585 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1587 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1589 ecore_evas_fullscreen_set(win->ee, 1);
1591 #undef ENGINE_COMPARE
1593 if (_elm_config->focus_highlight_enable)
1594 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1597 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1598 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1599 _debug_key_down, win);
1601 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1603 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1606 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1608 return win->win_obj;
1612 elm_win_util_standard_add(const char *name, const char *title)
1614 Evas_Object *win, *bg;
1616 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1617 if (!win) return NULL;
1618 elm_win_title_set(win, title);
1619 bg = elm_bg_add(win);
1622 evas_object_del(win);
1625 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1626 elm_win_resize_object_add(win, bg);
1627 evas_object_show(bg);
1632 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1636 ELM_CHECK_WIDTYPE(obj, widtype);
1637 win = elm_widget_data_get(obj);
1639 if (eina_list_data_find(win->subobjs, subobj)) return;
1640 win->subobjs = eina_list_append(win->subobjs, subobj);
1641 elm_widget_sub_object_add(obj, subobj);
1642 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1643 _elm_win_subobj_callback_del, obj);
1644 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1645 _elm_win_subobj_callback_changed_size_hints,
1647 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1648 evas_object_move(subobj, 0, 0);
1649 evas_object_resize(subobj, w, h);
1650 _elm_win_eval_subobjs(obj);
1654 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1657 ELM_CHECK_WIDTYPE(obj, widtype);
1658 win = elm_widget_data_get(obj);
1660 evas_object_event_callback_del_full(subobj,
1661 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1662 _elm_win_subobj_callback_changed_size_hints,
1664 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1665 _elm_win_subobj_callback_del, obj);
1666 win->subobjs = eina_list_remove(win->subobjs, subobj);
1667 elm_widget_sub_object_del(obj, subobj);
1668 _elm_win_eval_subobjs(obj);
1672 elm_win_title_set(Evas_Object *obj, const char *title)
1675 ELM_CHECK_WIDTYPE(obj, widtype);
1676 win = elm_widget_data_get(obj);
1678 ecore_evas_title_set(win->ee, title);
1682 elm_win_title_get(const Evas_Object *obj)
1685 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1686 win = elm_widget_data_get(obj);
1687 if (!win) return NULL;
1688 return ecore_evas_title_get(win->ee);
1692 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1695 ELM_CHECK_WIDTYPE(obj, widtype);
1696 win = elm_widget_data_get(obj);
1698 win->autodel = autodel;
1702 elm_win_autodel_get(const Evas_Object *obj)
1705 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1706 win = elm_widget_data_get(obj);
1707 if (!win) return EINA_FALSE;
1708 return win->autodel;
1712 elm_win_activate(Evas_Object *obj)
1715 ELM_CHECK_WIDTYPE(obj, widtype);
1716 win = elm_widget_data_get(obj);
1718 ecore_evas_activate(win->ee);
1722 elm_win_lower(Evas_Object *obj)
1725 ELM_CHECK_WIDTYPE(obj, widtype);
1726 win = elm_widget_data_get(obj);
1728 ecore_evas_lower(win->ee);
1732 elm_win_raise(Evas_Object *obj)
1735 ELM_CHECK_WIDTYPE(obj, widtype);
1736 win = elm_widget_data_get(obj);
1738 ecore_evas_raise(win->ee);
1742 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1745 ELM_CHECK_WIDTYPE(obj, widtype);
1746 win = elm_widget_data_get(obj);
1748 ecore_evas_borderless_set(win->ee, borderless);
1749 #ifdef HAVE_ELEMENTARY_X
1750 _elm_win_xwin_update(win);
1755 elm_win_borderless_get(const Evas_Object *obj)
1758 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1759 win = elm_widget_data_get(obj);
1760 if (!win) return EINA_FALSE;
1761 return ecore_evas_borderless_get(win->ee);
1765 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1768 ELM_CHECK_WIDTYPE(obj, widtype);
1769 win = elm_widget_data_get(obj);
1771 ecore_evas_shaped_set(win->ee, shaped);
1772 #ifdef HAVE_ELEMENTARY_X
1773 _elm_win_xwin_update(win);
1778 elm_win_shaped_get(const Evas_Object *obj)
1781 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1782 win = elm_widget_data_get(obj);
1783 if (!win) return EINA_FALSE;
1784 return ecore_evas_shaped_get(win->ee);
1788 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1791 ELM_CHECK_WIDTYPE(obj, widtype);
1792 win = elm_widget_data_get(obj);
1797 else if (win->img_obj)
1799 evas_object_image_alpha_set(win->img_obj, alpha);
1803 #ifdef HAVE_ELEMENTARY_X
1808 if (!_elm_config->compositing)
1809 elm_win_shaped_set(obj, alpha);
1811 ecore_evas_alpha_set(win->ee, alpha);
1814 ecore_evas_alpha_set(win->ee, alpha);
1815 _elm_win_xwin_update(win);
1819 ecore_evas_alpha_set(win->ee, alpha);
1824 elm_win_alpha_get(const Evas_Object *obj)
1827 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1828 win = elm_widget_data_get(obj);
1829 if (!win) return EINA_FALSE;
1830 return ecore_evas_alpha_get(win->ee);
1834 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1837 ELM_CHECK_WIDTYPE(obj, widtype);
1838 win = elm_widget_data_get(obj);
1844 else if (win->img_obj)
1846 evas_object_image_alpha_set(win->img_obj, transparent);
1850 #ifdef HAVE_ELEMENTARY_X
1853 ecore_evas_transparent_set(win->ee, transparent);
1854 _elm_win_xwin_update(win);
1858 ecore_evas_transparent_set(win->ee, transparent);
1863 elm_win_transparent_get(const Evas_Object *obj)
1866 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1867 win = elm_widget_data_get(obj);
1868 if (!win) return EINA_FALSE;
1870 return ecore_evas_transparent_get(win->ee);
1874 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1877 ELM_CHECK_WIDTYPE(obj, widtype);
1878 win = elm_widget_data_get(obj);
1880 ecore_evas_override_set(win->ee, override);
1881 #ifdef HAVE_ELEMENTARY_X
1882 _elm_win_xwin_update(win);
1887 elm_win_override_get(const Evas_Object *obj)
1890 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1891 win = elm_widget_data_get(obj);
1892 if (!win) return EINA_FALSE;
1893 return ecore_evas_override_get(win->ee);
1897 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1900 ELM_CHECK_WIDTYPE(obj, widtype);
1901 win = elm_widget_data_get(obj);
1904 // YYY: handle if win->img_obj
1905 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1906 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1907 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1909 // these engines... can ONLY be fullscreen
1914 ecore_evas_fullscreen_set(win->ee, fullscreen);
1915 #ifdef HAVE_ELEMENTARY_X
1916 _elm_win_xwin_update(win);
1919 #undef ENGINE_COMPARE
1923 elm_win_fullscreen_get(const Evas_Object *obj)
1926 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1927 win = elm_widget_data_get(obj);
1928 if (!win) return EINA_FALSE;
1930 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1931 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1932 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1934 // these engines... can ONLY be fullscreen
1939 return ecore_evas_fullscreen_get(win->ee);
1941 #undef ENGINE_COMPARE
1945 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1948 ELM_CHECK_WIDTYPE(obj, widtype);
1949 win = elm_widget_data_get(obj);
1951 // YYY: handle if win->img_obj
1952 ecore_evas_maximized_set(win->ee, maximized);
1953 #ifdef HAVE_ELEMENTARY_X
1954 _elm_win_xwin_update(win);
1959 elm_win_maximized_get(const Evas_Object *obj)
1962 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1963 win = elm_widget_data_get(obj);
1964 if (!win) return EINA_FALSE;
1965 return ecore_evas_maximized_get(win->ee);
1969 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1972 ELM_CHECK_WIDTYPE(obj, widtype);
1973 win = elm_widget_data_get(obj);
1975 ecore_evas_iconified_set(win->ee, iconified);
1976 #ifdef HAVE_ELEMENTARY_X
1977 _elm_win_xwin_update(win);
1982 elm_win_iconified_get(const Evas_Object *obj)
1985 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1986 win = elm_widget_data_get(obj);
1987 if (!win) return EINA_FALSE;
1988 return ecore_evas_iconified_get(win->ee);
1992 elm_win_layer_set(Evas_Object *obj, int layer)
1995 ELM_CHECK_WIDTYPE(obj, widtype);
1996 win = elm_widget_data_get(obj);
1998 ecore_evas_layer_set(win->ee, layer);
1999 #ifdef HAVE_ELEMENTARY_X
2000 _elm_win_xwin_update(win);
2005 elm_win_layer_get(const Evas_Object *obj)
2008 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2009 win = elm_widget_data_get(obj);
2010 if (!win) return -1;
2011 return ecore_evas_layer_get(win->ee);
2015 elm_win_rotation_set(Evas_Object *obj, int rotation)
2018 ELM_CHECK_WIDTYPE(obj, widtype);
2019 win = elm_widget_data_get(obj);
2021 if (win->rot == rotation) return;
2022 win->rot = rotation;
2023 ecore_evas_rotation_set(win->ee, rotation);
2024 evas_object_size_hint_min_set(obj, -1, -1);
2025 evas_object_size_hint_max_set(obj, -1, -1);
2026 _elm_win_eval_subobjs(obj);
2027 #ifdef HAVE_ELEMENTARY_X
2028 _elm_win_xwin_update(win);
2033 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2036 ELM_CHECK_WIDTYPE(obj, widtype);
2037 win = elm_widget_data_get(obj);
2039 if (win->rot == rotation) return;
2040 win->rot = rotation;
2041 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2042 evas_object_size_hint_min_set(obj, -1, -1);
2043 evas_object_size_hint_max_set(obj, -1, -1);
2044 _elm_win_eval_subobjs(obj);
2045 #ifdef HAVE_ELEMENTARY_X
2046 _elm_win_xwin_update(win);
2051 elm_win_rotation_get(const Evas_Object *obj)
2054 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2055 win = elm_widget_data_get(obj);
2056 if (!win) return -1;
2061 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2064 ELM_CHECK_WIDTYPE(obj, widtype);
2065 win = elm_widget_data_get(obj);
2067 ecore_evas_sticky_set(win->ee, sticky);
2068 #ifdef HAVE_ELEMENTARY_X
2069 _elm_win_xwin_update(win);
2074 elm_win_sticky_get(const Evas_Object *obj)
2077 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2078 win = elm_widget_data_get(obj);
2079 if (!win) return EINA_FALSE;
2080 return ecore_evas_sticky_get(win->ee);
2084 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2087 ELM_CHECK_WIDTYPE(obj, widtype);
2088 win = elm_widget_data_get(obj);
2090 if (mode == win->kbdmode) return;
2091 #ifdef HAVE_ELEMENTARY_X
2092 _elm_win_xwindow_get(win);
2094 win->kbdmode = mode;
2095 #ifdef HAVE_ELEMENTARY_X
2097 ecore_x_e_virtual_keyboard_state_set
2098 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2102 EAPI Elm_Win_Keyboard_Mode
2103 elm_win_keyboard_mode_get(const Evas_Object *obj)
2106 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2107 win = elm_widget_data_get(obj);
2108 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2109 return win->kbdmode;
2113 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2116 ELM_CHECK_WIDTYPE(obj, widtype);
2117 win = elm_widget_data_get(obj);
2119 #ifdef HAVE_ELEMENTARY_X
2120 _elm_win_xwindow_get(win);
2122 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2129 elm_win_keyboard_win_get(const Evas_Object *obj)
2132 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2133 win = elm_widget_data_get(obj);
2134 if (!win) return EINA_FALSE;
2135 #ifdef HAVE_ELEMENTARY_X
2136 _elm_win_xwindow_get(win);
2138 return ecore_x_e_virtual_keyboard_get(win->xwin);
2144 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2147 ELM_CHECK_WIDTYPE(obj, widtype);
2148 win = elm_widget_data_get(obj);
2150 if (x) *x = win->screen.x;
2151 if (y) *y = win->screen.y;
2155 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2158 ELM_CHECK_WIDTYPE(obj, widtype);
2159 win = elm_widget_data_get(obj);
2161 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2165 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2168 ELM_CHECK_WIDTYPE(obj, widtype);
2169 win = elm_widget_data_get(obj);
2171 #ifdef HAVE_ELEMENTARY_X
2172 _elm_win_xwindow_get(win);
2174 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2181 elm_win_conformant_get(const Evas_Object *obj)
2184 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2185 win = elm_widget_data_get(obj);
2186 if (!win) return EINA_FALSE;
2187 #ifdef HAVE_ELEMENTARY_X
2188 _elm_win_xwindow_get(win);
2190 return ecore_x_e_illume_conformant_get(win->xwin);
2196 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2199 ELM_CHECK_WIDTYPE(obj, widtype);
2200 win = elm_widget_data_get(obj);
2202 #ifdef HAVE_ELEMENTARY_X
2203 _elm_win_xwindow_get(win);
2206 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2209 Ecore_X_Window_State states[2];
2211 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2212 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2213 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2214 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2223 elm_win_quickpanel_get(const Evas_Object *obj)
2226 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2227 win = elm_widget_data_get(obj);
2228 if (!win) return EINA_FALSE;
2229 #ifdef HAVE_ELEMENTARY_X
2230 _elm_win_xwindow_get(win);
2232 return ecore_x_e_illume_quickpanel_get(win->xwin);
2238 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2241 ELM_CHECK_WIDTYPE(obj, widtype);
2242 win = elm_widget_data_get(obj);
2244 #ifdef HAVE_ELEMENTARY_X
2245 _elm_win_xwindow_get(win);
2247 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2254 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2257 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2258 win = elm_widget_data_get(obj);
2259 if (!win) return -1;
2260 #ifdef HAVE_ELEMENTARY_X
2261 _elm_win_xwindow_get(win);
2263 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2269 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2272 ELM_CHECK_WIDTYPE(obj, widtype);
2273 win = elm_widget_data_get(obj);
2275 #ifdef HAVE_ELEMENTARY_X
2276 _elm_win_xwindow_get(win);
2278 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2285 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2288 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2289 win = elm_widget_data_get(obj);
2290 if (!win) return -1;
2291 #ifdef HAVE_ELEMENTARY_X
2292 _elm_win_xwindow_get(win);
2294 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2300 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2303 ELM_CHECK_WIDTYPE(obj, widtype);
2304 win = elm_widget_data_get(obj);
2306 #ifdef HAVE_ELEMENTARY_X
2307 _elm_win_xwindow_get(win);
2309 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2316 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2319 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2320 win = elm_widget_data_get(obj);
2322 #ifdef HAVE_ELEMENTARY_X
2323 _elm_win_xwindow_get(win);
2325 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2331 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
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 Ecore_X_Window_State states[2];
2345 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2346 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2347 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2348 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2357 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2360 ELM_CHECK_WIDTYPE(obj, widtype);
2361 win = elm_widget_data_get(obj);
2363 #ifdef HAVE_ELEMENTARY_X
2364 _elm_win_xwindow_get(win);
2369 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2370 ecore_x_e_illume_focus_back_send(win->xwin);
2372 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2373 ecore_x_e_illume_focus_forward_send(win->xwin);
2375 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2376 ecore_x_e_illume_focus_home_send(win->xwin);
2378 case ELM_ILLUME_COMMAND_CLOSE:
2379 ecore_x_e_illume_close_send(win->xwin);
2391 elm_win_inlined_image_object_get(Evas_Object *obj)
2394 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2395 win = elm_widget_data_get(obj);
2396 if (!win) return NULL;
2397 return win->img_obj;
2401 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2405 ELM_CHECK_WIDTYPE(obj, widtype);
2407 win = elm_widget_data_get(obj);
2408 enabled = !!enabled;
2409 if (win->focus_highlight.enabled == enabled)
2412 win->focus_highlight.enabled = enabled;
2414 if (win->focus_highlight.enabled)
2415 _elm_win_focus_highlight_init(win);
2417 _elm_win_focus_highlight_shutdown(win);
2421 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2425 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2427 win = elm_widget_data_get(obj);
2428 return win->focus_highlight.enabled;
2432 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2436 ELM_CHECK_WIDTYPE(obj, widtype);
2438 win = elm_widget_data_get(obj);
2439 eina_stringshare_replace(&win->focus_highlight.style, style);
2440 win->focus_highlight.changed_theme = EINA_TRUE;
2441 _elm_win_focus_highlight_reconfigure_job_start(win);
2445 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2449 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2451 win = elm_widget_data_get(obj);
2452 return win->focus_highlight.style;
2456 elm_win_indicator_state_set(Evas_Object *obj, int show_state)
2459 if (strcmp(elm_widget_type_get(obj), "win")) return;
2460 win = elm_widget_data_get(obj);
2462 #ifdef HAVE_ELEMENTARY_X
2463 _elm_win_xwindow_get(win);
2465 return ecore_x_window_prop_property_set (win->xwin,
2466 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
2472 elm_win_indicator_state_get(Evas_Object *obj)
2475 if (strcmp(elm_widget_type_get(obj), "win")) return -1;
2476 win = elm_widget_data_get(obj);
2477 if (!win) return -1;
2478 #ifdef HAVE_ELEMENTARY_X
2479 _elm_win_xwindow_get(win);
2485 unsigned int *prop_data = NULL;
2487 ret = ecore_x_window_prop_property_get (win->xwin,
2488 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, (void *)&prop_data, &count);
2489 if( ret && prop_data )
2490 memcpy (&show, prop_data, sizeof (int));
2492 if (prop_data) free (prop_data);
2501 typedef struct _Widget_Data Widget_Data;
2506 Evas_Object *content;
2509 static void _del_hook(Evas_Object *obj);
2510 static void _theme_hook(Evas_Object *obj);
2511 static void _sizing_eval(Evas_Object *obj);
2512 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2513 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2515 static const char *widtype2 = NULL;
2518 _del_hook(Evas_Object *obj)
2520 Widget_Data *wd = elm_widget_data_get(obj);
2526 _theme_hook(Evas_Object *obj)
2528 Widget_Data *wd = elm_widget_data_get(obj);
2529 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2531 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2536 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2538 Widget_Data *wd = elm_widget_data_get(obj);
2543 /* Try Focus cycle in subitem */
2546 elm_widget_focus_next_get(wd->content, dir, next);
2551 *next = (Evas_Object *)obj;
2556 _sizing_eval(Evas_Object *obj)
2558 Widget_Data *wd = elm_widget_data_get(obj);
2559 Evas_Coord minw = -1, minh = -1;
2561 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2562 edje_object_size_min_calc(wd->frm, &minw, &minh);
2563 evas_object_size_hint_min_set(obj, minw, minh);
2564 evas_object_size_hint_max_set(obj, -1, -1);
2568 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2574 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2576 Widget_Data *wd = elm_widget_data_get(obj);
2577 Evas_Object *sub = event_info;
2578 if (sub == wd->content)
2580 evas_object_event_callback_del_full
2581 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2588 elm_win_inwin_add(Evas_Object *obj)
2594 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2595 win = elm_widget_data_get(obj);
2596 if (!win) return NULL;
2597 wd = ELM_NEW(Widget_Data);
2598 obj2 = elm_widget_add(win->evas);
2599 elm_widget_type_set(obj2, "inwin");
2600 ELM_SET_WIDTYPE(widtype2, "inwin");
2601 elm_widget_sub_object_add(obj, obj2);
2602 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2603 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2604 elm_win_resize_object_add(obj, obj2);
2606 elm_widget_data_set(obj2, wd);
2607 elm_widget_del_hook_set(obj2, _del_hook);
2608 elm_widget_theme_hook_set(obj2, _theme_hook);
2609 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2610 elm_widget_can_focus_set(obj2, EINA_TRUE);
2611 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2613 wd->frm = edje_object_add(win->evas);
2614 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2615 elm_widget_resize_object_set(obj2, wd->frm);
2617 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2624 elm_win_inwin_activate(Evas_Object *obj)
2626 ELM_CHECK_WIDTYPE(obj, widtype2);
2627 Widget_Data *wd = elm_widget_data_get(obj);
2629 evas_object_raise(obj);
2630 evas_object_show(obj);
2631 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2632 elm_object_focus_set(obj, EINA_TRUE);
2636 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2638 ELM_CHECK_WIDTYPE(obj, widtype2);
2639 Widget_Data *wd = elm_widget_data_get(obj);
2641 if (wd->content == content) return;
2642 if (wd->content) evas_object_del(wd->content);
2643 wd->content = content;
2646 elm_widget_sub_object_add(obj, content);
2647 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2648 _changed_size_hints, obj);
2649 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2655 elm_win_inwin_content_get(const Evas_Object *obj)
2657 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2658 Widget_Data *wd = elm_widget_data_get(obj);
2659 if (!wd) return NULL;
2664 elm_win_inwin_content_unset(Evas_Object *obj)
2666 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2667 Widget_Data *wd = elm_widget_data_get(obj);
2668 if (!wd) return NULL;
2669 if (!wd->content) return NULL;
2670 Evas_Object *content = wd->content;
2671 elm_widget_sub_object_del(obj, wd->content);
2672 evas_object_event_callback_del_full(wd->content,
2673 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2674 _changed_size_hints, obj);
2675 edje_object_part_unswallow(wd->frm, wd->content);
2680 /* windowing spcific calls - shall we do this differently? */
2682 static Ecore_X_Window
2683 _elm_ee_win_get(const Evas_Object *obj)
2686 #ifdef HAVE_ELEMENTARY_X
2687 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2688 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2694 elm_win_xwindow_get(const Evas_Object *obj)
2700 type = elm_widget_type_get(obj);
2701 if (!type) return 0;
2702 if (type != widtype) return _elm_ee_win_get(obj);
2703 #ifdef HAVE_ELEMENTARY_X
2704 win = elm_widget_data_get(obj);
2706 if (win->xwin) return win->xwin;
2707 if (win->parent) return elm_win_xwindow_get(win->parent);