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);
156 if (!win->shot.repeat_count) return strdup("out.png");
159 repname = malloc(sizeof(char) * 24);
160 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
166 _shot_repeat_count_get(Elm_Win *win)
170 char *d = strdup(win->shot.info);
173 for (p = (char *)win->shot.info; *p; p++)
175 if (!strncmp(p, "repeat=", 7))
179 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
186 if (v > 1000) v = 999;
196 _shot_key_get(Elm_Win *win __UNUSED__)
202 _shot_flags_get(Elm_Win *win __UNUSED__)
208 _shot_do(Elm_Win *win)
212 unsigned int *pixels;
214 char *file, *key, *flags;
216 ecore_evas_manual_render(win->ee);
217 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
219 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
220 if ((w < 1) || (h < 1)) return;
221 file = _shot_file_get(win);
223 key = _shot_key_get(win);
224 flags = _shot_flags_get(win);
225 ee = ecore_evas_buffer_new(1, 1);
226 o = evas_object_image_add(ecore_evas_get(ee));
227 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
228 evas_object_image_size_set(o, w, h);
229 evas_object_image_data_set(o, pixels);
230 if (!evas_object_image_save(o, file, key, flags))
232 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
237 if (flags) free(flags);
239 if (win->shot.repeat_count) win->shot.shot_counter++;
243 _shot_delay(void *data)
247 if (win->shot.repeat_count)
249 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
250 if (remainshot > 0) return EINA_TRUE;
252 win->shot.timer = NULL;
258 _shot_init(Elm_Win *win)
260 if (!win->shot.info) return;
261 win->shot.repeat_count = _shot_repeat_count_get(win);
262 win->shot.shot_counter = 0;
266 _shot_handle(Elm_Win *win)
268 if (!win->shot.info) return;
269 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
273 _elm_win_move(Ecore_Evas *ee)
275 Evas_Object *obj = ecore_evas_object_associate_get(ee);
280 win = elm_widget_data_get(obj);
282 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
285 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
289 _elm_win_resize(Ecore_Evas *ee)
291 Evas_Object *obj = ecore_evas_object_associate_get(ee);
295 win = elm_widget_data_get(obj);
297 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
298 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
302 _elm_win_focus_in(Ecore_Evas *ee)
304 Evas_Object *obj = ecore_evas_object_associate_get(ee);
308 win = elm_widget_data_get(obj);
310 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
311 if (win->show_count == 1)
313 elm_object_focus_set(win->win_obj, EINA_TRUE);
317 elm_widget_focus_restore(win->win_obj);
318 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
319 win->focus_highlight.cur.visible = EINA_TRUE;
320 _elm_win_focus_highlight_reconfigure_job_start(win);
324 else if (win->img_obj)
331 _elm_win_focus_out(Ecore_Evas *ee)
333 Evas_Object *obj = ecore_evas_object_associate_get(ee);
337 win = elm_widget_data_get(obj);
339 elm_object_focus_set(win->win_obj, EINA_FALSE);
340 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
341 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
342 win->focus_highlight.cur.visible = EINA_FALSE;
343 _elm_win_focus_highlight_reconfigure_job_start(win);
347 else if (win->img_obj)
354 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
356 Elm_Win *wd = elm_widget_data_get(obj);
357 const Eina_List *items;
358 void *(*list_data_get) (const Eina_List *list);
366 if (!(items = elm_widget_focus_custom_chain_get(obj)))
372 list_data_get = eina_list_data_get;
374 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
380 *next = (Evas_Object *)obj;
385 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
387 Elm_Win *win = elm_widget_data_get(obj);
391 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
393 evas_object_focus_set(obj, elm_widget_focus_get(obj));
397 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
399 if (type == EVAS_CALLBACK_KEY_DOWN)
401 Evas_Event_Key_Down *ev = event_info;
402 if (!strcmp(ev->keyname, "Tab"))
404 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
405 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
407 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
408 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
411 else if ((!strcmp(ev->keyname, "Left")) ||
412 (!strcmp(ev->keyname, "KP_Left")))
414 //TODO : woohyun jung
416 else if ((!strcmp(ev->keyname, "Right")) ||
417 (!strcmp(ev->keyname, "KP_Right")))
419 //TODO : woohyun jung
421 else if ((!strcmp(ev->keyname, "Up")) ||
422 (!strcmp(ev->keyname, "KP_Up")))
424 //TODO : woohyun jung
426 else if ((!strcmp(ev->keyname, "Down")) ||
427 (!strcmp(ev->keyname, "KP_Down")))
429 //TODO : woohyun jung
437 _deferred_ecore_evas_free(void *data)
439 ecore_evas_free(data);
440 _elm_win_deferred_free--;
444 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
448 if (!win->show_count) win->show_count++;
449 if (win->shot.info) _shot_handle(win);
453 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
460 else if (win->img_obj)
462 evas_object_hide(win->img_obj);
467 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
474 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
475 _elm_win_obj_callback_parent_del, win);
478 if (win->autodel_clear) *(win->autodel_clear) = -1;
479 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
480 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
483 ecore_evas_callback_delete_request_set(win->ee, NULL);
484 ecore_evas_callback_resize_set(win->ee, NULL);
486 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
487 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
488 if (win->shot.info) eina_stringshare_del(win->shot.info);
489 if (win->shot.timer) ecore_timer_del(win->shot.timer);
490 while (((child = evas_object_bottom_get(win->evas))) &&
493 evas_object_del(child);
495 while (((child = evas_object_top_get(win->evas))) &&
498 evas_object_del(child);
500 #ifdef HAVE_ELEMENTARY_X
501 if (win->client_message_handler)
502 ecore_event_handler_del(win->client_message_handler);
504 // FIXME: Why are we flushing edje on every window destroy ??
505 // edje_file_cache_flush();
506 // edje_collection_cache_flush();
507 // evas_image_cache_flush(win->evas);
508 // evas_font_cache_flush(win->evas);
509 // FIXME: we are in the del handler for the object and delete the canvas
510 // that lives under it from the handler... nasty. deferring doesn't help either
520 ecore_job_add(_deferred_ecore_evas_free, win->ee);
521 _elm_win_deferred_free++;
525 _elm_win_focus_highlight_shutdown(win);
526 eina_stringshare_del(win->focus_highlight.style);
530 if ((!_elm_win_list) &&
531 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
533 edje_file_cache_flush();
534 edje_collection_cache_flush();
535 evas_image_cache_flush(e);
536 evas_font_cache_flush(e);
542 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
545 if (!win->img_obj) return;
546 evas_object_event_callback_del_full
547 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
548 evas_object_del(win->img_obj);
552 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
555 if (obj == win->parent) win->parent = NULL;
559 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
565 if ((x != win->screen.x) || (y != win->screen.y))
569 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
574 evas_object_move(obj, x, y);
579 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
582 // this is called to make sure all smart containers have calculated their
583 // sizes BEFORE we show the window to make sure it initially appears at
584 // our desired size (ie min size is known first)
585 evas_smart_objects_calculate(evas_object_evas_get(obj));
586 evas_object_show(obj);
590 else if (win->img_obj)
592 evas_object_show(win->img_obj);
597 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
601 if (ecore_evas_override_get(win->ee))
605 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
608 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
613 else if (win->img_obj)
617 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
620 // evas_object_move(win->img_obj, x, y);
625 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
632 else if (win->img_obj)
634 Evas_Coord w = 1, h = 1;
636 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
639 evas_object_image_size_set(win->img_obj, w, h);
644 _elm_win_delete_request(Ecore_Evas *ee)
646 Evas_Object *obj = ecore_evas_object_associate_get(ee);
648 if (strcmp(elm_widget_type_get(obj), "win")) return;
650 win = elm_widget_data_get(obj);
652 int autodel = win->autodel;
653 win->autodel_clear = &autodel;
654 evas_object_ref(win->win_obj);
655 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
656 // FIXME: if above callback deletes - then the below will be invalid
657 if (autodel) evas_object_del(win->win_obj);
658 else win->autodel_clear = NULL;
659 evas_object_unref(win->win_obj);
663 _elm_win_resize_job(void *data)
670 win->deferred_resize_job = NULL;
671 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
672 evas_object_resize(win->win_obj, w, h);
676 else if (win->img_obj)
679 EINA_LIST_FOREACH(win->subobjs, l, obj)
681 evas_object_move(obj, 0, 0);
682 evas_object_resize(obj, w, h);
686 #ifdef HAVE_ELEMENTARY_X
688 _elm_win_xwindow_get(Elm_Win *win)
692 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
693 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
695 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
697 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
698 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
699 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
700 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
701 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
702 ENGINE_COMPARE(ELM_OPENGL_SDL))
705 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
707 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
709 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
711 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
714 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
716 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
719 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
721 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
723 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
725 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
727 #undef ENGINE_COMPARE
731 #ifdef HAVE_ELEMENTARY_X
733 _elm_win_xwin_update(Elm_Win *win)
735 _elm_win_xwindow_get(win);
740 win2 = elm_widget_data_get(win->parent);
744 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
748 if (!win->xwin) return; /* nothing more to do */
753 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
755 case ELM_WIN_DIALOG_BASIC:
756 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
758 case ELM_WIN_DESKTOP:
759 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
762 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
764 case ELM_WIN_TOOLBAR:
765 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
768 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
770 case ELM_WIN_UTILITY:
771 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
774 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
776 case ELM_WIN_DROPDOWN_MENU:
777 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
779 case ELM_WIN_POPUP_MENU:
780 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
782 case ELM_WIN_TOOLTIP:
783 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
785 case ELM_WIN_NOTIFICATION:
786 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
789 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
792 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
797 ecore_x_e_virtual_keyboard_state_set
798 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
803 _elm_win_eval_subobjs(Evas_Object *obj)
806 const Evas_Object *child;
808 Elm_Win *win = elm_widget_data_get(obj);
809 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
813 EINA_LIST_FOREACH(win->subobjs, l, child)
815 evas_object_size_hint_weight_get(child, &wx, &wy);
816 if (wx == 0.0) xx = 0;
817 if (wy == 0.0) xy = 0;
819 evas_object_size_hint_min_get(child, &w, &h);
822 if (w > minw) minw = w;
823 if (h > minh) minh = h;
825 evas_object_size_hint_max_get(child, &w, &h);
828 if (maxw == -1) maxw = w;
829 else if ((w > 0) && (w < maxw)) maxw = w;
830 if (maxh == -1) maxh = h;
831 else if ((h > 0) && (h < maxh)) maxh = h;
833 if (!xx) maxw = minw;
835 if (!xy) maxh = minh;
837 evas_object_size_hint_min_set(obj, minw, minh);
838 evas_object_size_hint_max_set(obj, maxw, maxh);
839 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
840 if (w < minw) w = minw;
841 if (h < minh) h = minh;
842 if ((maxw >= 0) && (w > maxw)) w = maxw;
843 if ((maxh >= 0) && (h > maxh)) h = maxh;
844 evas_object_resize(obj, w, h);
848 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
850 Elm_Win *win = elm_widget_data_get(data);
851 win->subobjs = eina_list_remove(win->subobjs, obj);
852 _elm_win_eval_subobjs(win->win_obj);
856 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
858 _elm_win_eval_subobjs(data);
862 _elm_win_shutdown(void)
864 while (_elm_win_list)
865 evas_object_del(_elm_win_list->data);
869 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
876 EINA_LIST_FOREACH(_elm_win_list, l, obj)
877 elm_widget_theme(obj);
881 EINA_LIST_FOREACH(_elm_win_list, l, obj)
882 elm_widget_theme_specific(obj, th, EINA_FALSE);
886 #ifdef HAVE_ELEMENTARY_X
888 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
891 Ecore_X_Event_Client_Message *e = event;
893 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
894 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
896 if ((unsigned)e->data.l[0] == win->xwin)
898 Evas *evas = evas_object_evas_get(win->win_obj);
901 edje_file_cache_flush();
902 edje_collection_cache_flush();
903 evas_image_cache_flush(evas);
904 evas_font_cache_flush(evas);
908 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
910 if ((unsigned)e->data.l[0] == win->xwin)
912 Evas *evas = evas_object_evas_get(win->win_obj);
915 edje_file_cache_flush();
916 edje_collection_cache_flush();
917 evas_image_cache_flush(evas);
918 evas_font_cache_flush(evas);
919 evas_render_dump(evas);
923 return ECORE_CALLBACK_PASS_ON;
928 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
932 win->focus_highlight.geometry_changed = EINA_TRUE;
933 _elm_win_focus_highlight_reconfigure_job_start(win);
937 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
941 win->focus_highlight.geometry_changed = EINA_TRUE;
942 _elm_win_focus_highlight_reconfigure_job_start(win);
946 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
950 win->focus_highlight.cur.target = NULL;
952 _elm_win_focus_highlight_reconfigure_job_start(win);
956 _elm_win_focus_target_callbacks_add(Elm_Win *win)
958 Evas_Object *obj = win->focus_highlight.cur.target;
960 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
961 _elm_win_focus_target_move, win);
962 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
963 _elm_win_focus_target_resize, win);
964 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
965 _elm_win_focus_target_del, win);
969 _elm_win_focus_target_callbacks_del(Elm_Win *win)
971 Evas_Object *obj = win->focus_highlight.cur.target;
973 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
974 _elm_win_focus_target_move, win);
975 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
976 _elm_win_focus_target_resize, win);
977 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
978 _elm_win_focus_target_del, win);
982 _elm_win_focus_target_get(Evas_Object *obj)
984 Evas_Object *o = obj;
988 if (elm_widget_is(o))
990 if (!elm_widget_highlight_ignore_get(o))
992 o = elm_widget_parent_get(o);
994 o = evas_object_smart_parent_get(o);
998 o = elm_widget_parent_widget_get(o);
1000 o = evas_object_smart_parent_get(o);
1009 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1011 Evas_Object *obj = event_info, *target;
1012 Elm_Win *win = data;
1014 if (win->focus_highlight.cur.target == obj)
1017 target = _elm_win_focus_target_get(obj);
1018 win->focus_highlight.cur.target = target;
1019 if (elm_widget_highlight_in_theme_get(target))
1020 win->focus_highlight.cur.handled = EINA_TRUE;
1022 _elm_win_focus_target_callbacks_add(win);
1024 _elm_win_focus_highlight_reconfigure_job_start(win);
1028 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1030 Elm_Win *win = data;
1032 if (!win->focus_highlight.cur.target)
1035 if (!win->focus_highlight.cur.handled)
1036 _elm_win_focus_target_callbacks_del(win);
1037 win->focus_highlight.cur.target = NULL;
1038 win->focus_highlight.cur.handled = EINA_FALSE;
1040 _elm_win_focus_highlight_reconfigure_job_start(win);
1044 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1046 evas_object_hide(obj);
1050 _elm_win_focus_highlight_init(Elm_Win *win)
1052 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1053 _elm_win_object_focus_in, win);
1054 evas_event_callback_add(win->evas,
1055 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1056 _elm_win_object_focus_out, win);
1058 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1060 win->focus_highlight.top = edje_object_add(win->evas);
1061 win->focus_highlight.changed_theme = EINA_TRUE;
1062 edje_object_signal_callback_add(win->focus_highlight.top,
1063 "elm,action,focus,hide,end", "",
1064 _elm_win_focus_highlight_hide, NULL);
1065 edje_object_signal_callback_add(win->focus_highlight.top,
1066 "elm,action,focus,anim,end", "",
1067 _elm_win_focus_highlight_anim_end, win);
1068 _elm_win_focus_highlight_reconfigure_job_start(win);
1072 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1074 _elm_win_focus_highlight_reconfigure_job_stop(win);
1075 if (win->focus_highlight.cur.target)
1077 _elm_win_focus_target_callbacks_del(win);
1078 win->focus_highlight.cur.target = NULL;
1080 if (win->focus_highlight.top)
1082 evas_object_del(win->focus_highlight.top);
1083 win->focus_highlight.top = NULL;
1086 evas_event_callback_del_full(win->evas,
1087 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1088 _elm_win_object_focus_in, win);
1089 evas_event_callback_del_full(win->evas,
1090 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1091 _elm_win_object_focus_out, win);
1095 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1099 top = win->focus_highlight.top;
1104 evas_object_show(top);
1105 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1111 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1116 _elm_win_focus_highlight_reconfigure_job(void *data)
1118 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1122 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1124 if (win->focus_highlight.reconf_job)
1125 ecore_job_del(win->focus_highlight.reconf_job);
1126 win->focus_highlight.reconf_job = ecore_job_add(
1127 _elm_win_focus_highlight_reconfigure_job, win);
1131 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1133 if (win->focus_highlight.reconf_job)
1134 ecore_job_del(win->focus_highlight.reconf_job);
1135 win->focus_highlight.reconf_job = NULL;
1139 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1141 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1142 Evas_Coord x, y, w, h;
1144 clip = evas_object_clip_get(target);
1145 evas_object_geometry_get(target, &x, &y, &w, &h);
1147 evas_object_move(obj, x, y);
1148 evas_object_resize(obj, w, h);
1149 evas_object_clip_set(obj, clip);
1153 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1155 Evas_Coord tx, ty, tw, th;
1156 Evas_Coord w, h, px, py, pw, ph;
1157 Edje_Message_Int_Set *m;
1158 Evas_Object *previous = win->focus_highlight.prev.target;
1159 Evas_Object *target = win->focus_highlight.cur.target;
1161 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1162 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1163 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1164 evas_object_move(obj, 0, 0);
1165 evas_object_resize(obj, tw, th);
1166 evas_object_clip_unset(obj);
1168 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1178 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1182 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1184 Elm_Win *win = data;
1185 _elm_win_focus_highlight_simple_setup(win, obj);
1189 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1191 Evas_Object *target = win->focus_highlight.cur.target;
1192 Evas_Object *previous = win->focus_highlight.prev.target;
1193 Evas_Object *top = win->focus_highlight.top;
1194 Eina_Bool visible_changed;
1195 Eina_Bool common_visible;
1196 const char *sig = NULL;
1198 _elm_win_focus_highlight_reconfigure_job_stop(win);
1200 visible_changed = (win->focus_highlight.cur.visible !=
1201 win->focus_highlight.prev.visible);
1203 if ((target == previous) && (!visible_changed) &&
1204 (!win->focus_highlight.geometry_changed))
1207 if ((previous) && (win->focus_highlight.prev.handled))
1208 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1211 common_visible = EINA_FALSE;
1212 else if (win->focus_highlight.cur.handled)
1214 common_visible = EINA_FALSE;
1215 if (win->focus_highlight.cur.visible)
1216 sig = "elm,action,focus_highlight,show";
1218 sig = "elm,action,focus_highlight,hide";
1221 common_visible = win->focus_highlight.cur.visible;
1223 _elm_win_focus_highlight_visible_set(win, common_visible);
1225 elm_widget_signal_emit(target, sig, "elm");
1227 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1230 if (win->focus_highlight.changed_theme)
1233 if (win->focus_highlight.style)
1234 str = win->focus_highlight.style;
1237 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1239 win->focus_highlight.changed_theme = EINA_FALSE;
1241 if (_elm_config->focus_highlight_animate)
1243 str = edje_object_data_get(win->focus_highlight.top, "animate");
1244 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1248 if ((win->focus_highlight.top_animate) && (previous) &&
1249 (!win->focus_highlight.prev.handled))
1250 _elm_win_focus_highlight_anim_setup(win, top);
1252 _elm_win_focus_highlight_simple_setup(win, top);
1253 evas_object_raise(top);
1256 win->focus_highlight.geometry_changed = EINA_FALSE;
1257 win->focus_highlight.prev = win->focus_highlight.cur;
1262 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1264 Evas_Event_Key_Down *ev = event_info;
1266 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1270 if ((strcmp(ev->keyname, "F12")) ||
1271 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1274 printf("Tree graph generated.\n");
1275 elm_object_tree_dot_dump(obj, "./dump.dot");
1280 _win_img_hide(void *data,
1282 Evas_Object *obj __UNUSED__,
1283 void *event_info __UNUSED__)
1285 Elm_Win *win = data;
1287 elm_widget_focus_hide_handle(win->win_obj);
1291 _win_img_mouse_up(void *data,
1293 Evas_Object *obj __UNUSED__,
1296 Elm_Win *win = data;
1297 Evas_Event_Mouse_Up *ev = event_info;
1298 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1299 elm_widget_focus_mouse_up_handle(win->win_obj);
1303 _win_img_focus_in(void *data,
1305 Evas_Object *obj __UNUSED__,
1306 void *event_info __UNUSED__)
1308 Elm_Win *win = data;
1309 elm_widget_focus_steal(win->win_obj);
1313 _win_img_focus_out(void *data,
1315 Evas_Object *obj __UNUSED__,
1316 void *event_info __UNUSED__)
1318 Elm_Win *win = data;
1319 elm_widget_focused_object_clear(win->win_obj);
1323 _win_inlined_image_set(Elm_Win *win)
1325 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1326 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1327 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1328 _elm_win_obj_callback_img_obj_del, win);
1330 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1331 _win_img_hide, win);
1332 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1333 _win_img_mouse_up, win);
1334 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1335 _win_img_focus_in, win);
1336 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1337 _win_img_focus_out, win);
1341 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1345 const char *fontpath;
1347 win = ELM_NEW(Elm_Win);
1349 #define FALLBACK_TRY(engine) \
1352 CRITICAL(engine " engine creation failed. Trying software X11."); \
1353 elm_engine_set(ELM_SOFTWARE_X11); \
1354 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1356 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1360 case ELM_WIN_INLINED_IMAGE:
1363 Evas *e = evas_object_evas_get(parent);
1366 ee = ecore_evas_ecore_evas_get(e);
1368 win->img_obj = ecore_evas_object_image_new(ee);
1369 if (!win->img_obj) break;
1370 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1373 _win_inlined_image_set(win);
1376 evas_object_del(win->img_obj);
1377 win->img_obj = NULL;
1381 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1383 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1384 #ifdef HAVE_ELEMENTARY_X
1385 win->client_message_handler = ecore_event_handler_add
1386 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1389 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1391 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1392 FALLBACK_TRY("Sofware FB");
1394 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1396 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1397 FALLBACK_TRY("Sofware DirectFB");
1399 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1401 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1402 FALLBACK_TRY("Sofware-16");
1403 #ifdef HAVE_ELEMENTARY_X
1404 win->client_message_handler = ecore_event_handler_add
1405 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1408 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1410 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1411 FALLBACK_TRY("Sofware-8");
1412 #ifdef HAVE_ELEMENTARY_X
1413 win->client_message_handler = ecore_event_handler_add
1414 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1418 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1420 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1421 FALLBACK_TRY("XRender");
1422 #ifdef HAVE_ELEMENTARY_X
1423 win->client_message_handler = ecore_event_handler_add
1424 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1428 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1433 if (_elm_config->vsync)
1435 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1441 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1443 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1444 FALLBACK_TRY("OpenGL");
1445 #ifdef HAVE_ELEMENTARY_X
1446 win->client_message_handler = ecore_event_handler_add
1447 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1450 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1452 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1453 FALLBACK_TRY("Sofware Win32");
1455 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1457 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1458 FALLBACK_TRY("Sofware-16-WinCE");
1460 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1462 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1463 FALLBACK_TRY("Sofware SDL");
1465 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1467 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1468 FALLBACK_TRY("Sofware-16-SDL");
1470 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1472 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1473 FALLBACK_TRY("OpenGL SDL");
1475 else if (ENGINE_COMPARE(ELM_BUFFER))
1477 win->ee = ecore_evas_buffer_new(1, 1);
1479 else if (!strncmp(_elm_config->engine, "shot:", 5))
1481 win->ee = ecore_evas_buffer_new(1, 1);
1482 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1483 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1492 ERR("Cannot create window.");
1496 #ifdef HAVE_ELEMENTARY_X
1497 _elm_win_xwindow_get(win);
1499 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1500 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1501 // bg pixmap done by x - has other issues like can be redrawn by x before it
1502 // is filled/ready by app
1503 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1506 win->parent = parent;
1508 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1509 _elm_win_obj_callback_parent_del, win);
1511 win->evas = ecore_evas_get(win->ee);
1512 win->win_obj = elm_widget_add(win->evas);
1513 elm_widget_type_set(win->win_obj, "win");
1514 ELM_SET_WIDTYPE(widtype, "win");
1515 elm_widget_data_set(win->win_obj, win);
1516 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1517 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1518 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1519 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1520 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1521 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1522 evas_object_move(win->win_obj, 0, 0);
1523 evas_object_resize(win->win_obj, 1, 1);
1524 evas_object_layer_set(win->win_obj, 50);
1525 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1527 if (type == ELM_WIN_INLINED_IMAGE)
1528 elm_widget_parent2_set(win->win_obj, parent);
1529 ecore_evas_object_associate(win->ee, win->win_obj,
1530 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1531 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1532 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1533 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1534 _elm_win_obj_callback_show, win);
1535 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1536 _elm_win_obj_callback_hide, win);
1537 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1538 _elm_win_obj_callback_del, win);
1539 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1540 _elm_win_obj_callback_move, win);
1541 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1542 _elm_win_obj_callback_resize, win);
1544 evas_object_intercept_move_callback_add(win->win_obj,
1545 _elm_win_obj_intercept_move, win);
1546 evas_object_intercept_show_callback_add(win->win_obj,
1547 _elm_win_obj_intercept_show, win);
1549 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1550 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1551 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1552 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1553 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1554 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1555 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1556 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1557 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1558 evas_font_path_append(win->evas, fontpath);
1559 if (!_elm_config->font_hinting)
1560 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1561 else if (_elm_config->font_hinting == 1)
1562 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1563 else if (_elm_config->font_hinting == 2)
1564 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1566 #ifdef HAVE_ELEMENTARY_X
1567 _elm_win_xwin_update(win);
1570 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1572 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1574 ecore_evas_fullscreen_set(win->ee, 1);
1576 #undef ENGINE_COMPARE
1578 if (_elm_config->focus_highlight_enable)
1579 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1582 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1583 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1584 _debug_key_down, win);
1586 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1588 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1591 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1593 return win->win_obj;
1597 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1601 ELM_CHECK_WIDTYPE(obj, widtype);
1602 win = elm_widget_data_get(obj);
1604 if (eina_list_data_find(win->subobjs, subobj)) return;
1605 win->subobjs = eina_list_append(win->subobjs, subobj);
1606 elm_widget_sub_object_add(obj, subobj);
1607 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1608 _elm_win_subobj_callback_del, obj);
1609 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1610 _elm_win_subobj_callback_changed_size_hints,
1612 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1613 evas_object_move(subobj, 0, 0);
1614 evas_object_resize(subobj, w, h);
1615 _elm_win_eval_subobjs(obj);
1619 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1622 ELM_CHECK_WIDTYPE(obj, widtype);
1623 win = elm_widget_data_get(obj);
1625 evas_object_event_callback_del_full(subobj,
1626 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1627 _elm_win_subobj_callback_changed_size_hints,
1629 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1630 _elm_win_subobj_callback_del, obj);
1631 win->subobjs = eina_list_remove(win->subobjs, subobj);
1632 elm_widget_sub_object_del(obj, subobj);
1633 _elm_win_eval_subobjs(obj);
1637 elm_win_title_set(Evas_Object *obj, const char *title)
1640 ELM_CHECK_WIDTYPE(obj, widtype);
1641 win = elm_widget_data_get(obj);
1643 ecore_evas_title_set(win->ee, title);
1647 elm_win_title_get(const Evas_Object *obj)
1650 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1651 win = elm_widget_data_get(obj);
1652 if (!win) return NULL;
1653 return ecore_evas_title_get(win->ee);
1657 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1660 ELM_CHECK_WIDTYPE(obj, widtype);
1661 win = elm_widget_data_get(obj);
1663 win->autodel = autodel;
1667 elm_win_autodel_get(const Evas_Object *obj)
1670 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1671 win = elm_widget_data_get(obj);
1672 if (!win) return EINA_FALSE;
1673 return win->autodel;
1677 elm_win_activate(Evas_Object *obj)
1680 ELM_CHECK_WIDTYPE(obj, widtype);
1681 win = elm_widget_data_get(obj);
1683 ecore_evas_activate(win->ee);
1687 elm_win_lower(Evas_Object *obj)
1690 ELM_CHECK_WIDTYPE(obj, widtype);
1691 win = elm_widget_data_get(obj);
1693 ecore_evas_lower(win->ee);
1697 elm_win_raise(Evas_Object *obj)
1700 ELM_CHECK_WIDTYPE(obj, widtype);
1701 win = elm_widget_data_get(obj);
1703 ecore_evas_raise(win->ee);
1707 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1710 ELM_CHECK_WIDTYPE(obj, widtype);
1711 win = elm_widget_data_get(obj);
1713 ecore_evas_borderless_set(win->ee, borderless);
1714 #ifdef HAVE_ELEMENTARY_X
1715 _elm_win_xwin_update(win);
1720 elm_win_borderless_get(const Evas_Object *obj)
1723 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1724 win = elm_widget_data_get(obj);
1725 if (!win) return EINA_FALSE;
1726 return ecore_evas_borderless_get(win->ee);
1730 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1733 ELM_CHECK_WIDTYPE(obj, widtype);
1734 win = elm_widget_data_get(obj);
1736 ecore_evas_shaped_set(win->ee, shaped);
1737 #ifdef HAVE_ELEMENTARY_X
1738 _elm_win_xwin_update(win);
1743 elm_win_shaped_get(const Evas_Object *obj)
1746 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1747 win = elm_widget_data_get(obj);
1748 if (!win) return EINA_FALSE;
1749 return ecore_evas_shaped_get(win->ee);
1753 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1756 ELM_CHECK_WIDTYPE(obj, widtype);
1757 win = elm_widget_data_get(obj);
1762 else if (win->img_obj)
1764 evas_object_image_alpha_set(win->img_obj, alpha);
1768 #ifdef HAVE_ELEMENTARY_X
1773 if (!_elm_config->compositing)
1774 elm_win_shaped_set(obj, alpha);
1776 ecore_evas_alpha_set(win->ee, alpha);
1779 ecore_evas_alpha_set(win->ee, alpha);
1780 _elm_win_xwin_update(win);
1784 ecore_evas_alpha_set(win->ee, alpha);
1789 elm_win_alpha_get(const Evas_Object *obj)
1792 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1793 win = elm_widget_data_get(obj);
1794 if (!win) return EINA_FALSE;
1795 return ecore_evas_alpha_get(win->ee);
1799 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1802 ELM_CHECK_WIDTYPE(obj, widtype);
1803 win = elm_widget_data_get(obj);
1809 else if (win->img_obj)
1811 evas_object_image_alpha_set(win->img_obj, transparent);
1815 #ifdef HAVE_ELEMENTARY_X
1818 ecore_evas_transparent_set(win->ee, transparent);
1819 _elm_win_xwin_update(win);
1823 ecore_evas_transparent_set(win->ee, transparent);
1828 elm_win_transparent_get(const Evas_Object *obj)
1831 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1832 win = elm_widget_data_get(obj);
1833 if (!win) return EINA_FALSE;
1835 return ecore_evas_transparent_get(win->ee);
1839 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1842 ELM_CHECK_WIDTYPE(obj, widtype);
1843 win = elm_widget_data_get(obj);
1845 ecore_evas_override_set(win->ee, override);
1846 #ifdef HAVE_ELEMENTARY_X
1847 _elm_win_xwin_update(win);
1852 elm_win_override_get(const Evas_Object *obj)
1855 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1856 win = elm_widget_data_get(obj);
1857 if (!win) return EINA_FALSE;
1858 return ecore_evas_override_get(win->ee);
1862 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1865 ELM_CHECK_WIDTYPE(obj, widtype);
1866 win = elm_widget_data_get(obj);
1869 // YYY: handle if win->img_obj
1870 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1871 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1872 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1874 // these engines... can ONLY be fullscreen
1879 ecore_evas_fullscreen_set(win->ee, fullscreen);
1880 #ifdef HAVE_ELEMENTARY_X
1881 _elm_win_xwin_update(win);
1884 #undef ENGINE_COMPARE
1888 elm_win_fullscreen_get(const Evas_Object *obj)
1891 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1892 win = elm_widget_data_get(obj);
1893 if (!win) return EINA_FALSE;
1895 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1896 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1897 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1899 // these engines... can ONLY be fullscreen
1904 return ecore_evas_fullscreen_get(win->ee);
1906 #undef ENGINE_COMPARE
1910 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1913 ELM_CHECK_WIDTYPE(obj, widtype);
1914 win = elm_widget_data_get(obj);
1916 // YYY: handle if win->img_obj
1917 ecore_evas_maximized_set(win->ee, maximized);
1918 #ifdef HAVE_ELEMENTARY_X
1919 _elm_win_xwin_update(win);
1924 elm_win_maximized_get(const Evas_Object *obj)
1927 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1928 win = elm_widget_data_get(obj);
1929 if (!win) return EINA_FALSE;
1930 return ecore_evas_maximized_get(win->ee);
1934 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1937 ELM_CHECK_WIDTYPE(obj, widtype);
1938 win = elm_widget_data_get(obj);
1940 ecore_evas_iconified_set(win->ee, iconified);
1941 #ifdef HAVE_ELEMENTARY_X
1942 _elm_win_xwin_update(win);
1947 elm_win_iconified_get(const Evas_Object *obj)
1950 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1951 win = elm_widget_data_get(obj);
1952 if (!win) return EINA_FALSE;
1953 return ecore_evas_iconified_get(win->ee);
1957 elm_win_layer_set(Evas_Object *obj, int layer)
1960 ELM_CHECK_WIDTYPE(obj, widtype);
1961 win = elm_widget_data_get(obj);
1963 ecore_evas_layer_set(win->ee, layer);
1964 #ifdef HAVE_ELEMENTARY_X
1965 _elm_win_xwin_update(win);
1970 elm_win_layer_get(const Evas_Object *obj)
1973 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1974 win = elm_widget_data_get(obj);
1975 if (!win) return -1;
1976 return ecore_evas_layer_get(win->ee);
1980 elm_win_rotation_set(Evas_Object *obj, int rotation)
1983 ELM_CHECK_WIDTYPE(obj, widtype);
1984 win = elm_widget_data_get(obj);
1986 if (win->rot == rotation) return;
1987 win->rot = rotation;
1988 ecore_evas_rotation_set(win->ee, rotation);
1989 evas_object_size_hint_min_set(obj, -1, -1);
1990 evas_object_size_hint_max_set(obj, -1, -1);
1991 _elm_win_eval_subobjs(obj);
1992 #ifdef HAVE_ELEMENTARY_X
1993 _elm_win_xwin_update(win);
1998 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2001 ELM_CHECK_WIDTYPE(obj, widtype);
2002 win = elm_widget_data_get(obj);
2004 if (win->rot == rotation) return;
2005 win->rot = rotation;
2006 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2007 evas_object_size_hint_min_set(obj, -1, -1);
2008 evas_object_size_hint_max_set(obj, -1, -1);
2009 _elm_win_eval_subobjs(obj);
2010 #ifdef HAVE_ELEMENTARY_X
2011 _elm_win_xwin_update(win);
2016 elm_win_rotation_get(const Evas_Object *obj)
2019 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2020 win = elm_widget_data_get(obj);
2021 if (!win) return -1;
2026 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2029 ELM_CHECK_WIDTYPE(obj, widtype);
2030 win = elm_widget_data_get(obj);
2032 ecore_evas_sticky_set(win->ee, sticky);
2033 #ifdef HAVE_ELEMENTARY_X
2034 _elm_win_xwin_update(win);
2039 elm_win_sticky_get(const Evas_Object *obj)
2042 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2043 win = elm_widget_data_get(obj);
2044 if (!win) return EINA_FALSE;
2045 return ecore_evas_sticky_get(win->ee);
2049 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2052 ELM_CHECK_WIDTYPE(obj, widtype);
2053 win = elm_widget_data_get(obj);
2055 if (mode == win->kbdmode) return;
2056 #ifdef HAVE_ELEMENTARY_X
2057 _elm_win_xwindow_get(win);
2059 win->kbdmode = mode;
2060 #ifdef HAVE_ELEMENTARY_X
2062 ecore_x_e_virtual_keyboard_state_set
2063 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2067 EAPI Elm_Win_Keyboard_Mode
2068 elm_win_keyboard_mode_get(const Evas_Object *obj)
2071 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2072 win = elm_widget_data_get(obj);
2073 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2074 return win->kbdmode;
2078 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2081 ELM_CHECK_WIDTYPE(obj, widtype);
2082 win = elm_widget_data_get(obj);
2084 #ifdef HAVE_ELEMENTARY_X
2085 _elm_win_xwindow_get(win);
2087 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2092 elm_win_keyboard_win_get(const Evas_Object *obj)
2095 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2096 win = elm_widget_data_get(obj);
2097 if (!win) return EINA_FALSE;
2098 #ifdef HAVE_ELEMENTARY_X
2099 _elm_win_xwindow_get(win);
2101 return ecore_x_e_virtual_keyboard_get(win->xwin);
2107 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2110 ELM_CHECK_WIDTYPE(obj, widtype);
2111 win = elm_widget_data_get(obj);
2113 if (x) *x = win->screen.x;
2114 if (y) *y = win->screen.y;
2118 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2121 ELM_CHECK_WIDTYPE(obj, widtype);
2122 win = elm_widget_data_get(obj);
2124 #ifdef HAVE_ELEMENTARY_X
2125 _elm_win_xwindow_get(win);
2127 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2132 elm_win_conformant_get(const Evas_Object *obj)
2135 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2136 win = elm_widget_data_get(obj);
2137 if (!win) return EINA_FALSE;
2138 #ifdef HAVE_ELEMENTARY_X
2139 _elm_win_xwindow_get(win);
2141 return ecore_x_e_illume_conformant_get(win->xwin);
2147 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2150 ELM_CHECK_WIDTYPE(obj, widtype);
2151 win = elm_widget_data_get(obj);
2153 #ifdef HAVE_ELEMENTARY_X
2154 _elm_win_xwindow_get(win);
2157 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2160 Ecore_X_Window_State states[2];
2162 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2163 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2164 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2165 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2172 elm_win_quickpanel_get(const Evas_Object *obj)
2175 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2176 win = elm_widget_data_get(obj);
2177 if (!win) return EINA_FALSE;
2178 #ifdef HAVE_ELEMENTARY_X
2179 _elm_win_xwindow_get(win);
2181 return ecore_x_e_illume_quickpanel_get(win->xwin);
2187 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2190 ELM_CHECK_WIDTYPE(obj, widtype);
2191 win = elm_widget_data_get(obj);
2193 #ifdef HAVE_ELEMENTARY_X
2194 _elm_win_xwindow_get(win);
2196 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2201 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2204 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2205 win = elm_widget_data_get(obj);
2206 if (!win) return -1;
2207 #ifdef HAVE_ELEMENTARY_X
2208 _elm_win_xwindow_get(win);
2210 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2216 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2219 ELM_CHECK_WIDTYPE(obj, widtype);
2220 win = elm_widget_data_get(obj);
2222 #ifdef HAVE_ELEMENTARY_X
2223 _elm_win_xwindow_get(win);
2225 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2230 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2233 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2234 win = elm_widget_data_get(obj);
2235 if (!win) return -1;
2236 #ifdef HAVE_ELEMENTARY_X
2237 _elm_win_xwindow_get(win);
2239 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2245 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2248 ELM_CHECK_WIDTYPE(obj, widtype);
2249 win = elm_widget_data_get(obj);
2251 #ifdef HAVE_ELEMENTARY_X
2252 _elm_win_xwindow_get(win);
2254 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2259 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2262 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2263 win = elm_widget_data_get(obj);
2265 #ifdef HAVE_ELEMENTARY_X
2266 _elm_win_xwindow_get(win);
2268 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2274 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2277 ELM_CHECK_WIDTYPE(obj, widtype);
2278 win = elm_widget_data_get(obj);
2280 #ifdef HAVE_ELEMENTARY_X
2281 _elm_win_xwindow_get(win);
2286 Ecore_X_Window_State states[2];
2288 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2289 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2290 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2291 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2298 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2301 ELM_CHECK_WIDTYPE(obj, widtype);
2302 win = elm_widget_data_get(obj);
2304 #ifdef HAVE_ELEMENTARY_X
2305 _elm_win_xwindow_get(win);
2310 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2311 ecore_x_e_illume_focus_back_send(win->xwin);
2313 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2314 ecore_x_e_illume_focus_forward_send(win->xwin);
2316 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2317 ecore_x_e_illume_focus_home_send(win->xwin);
2319 case ELM_ILLUME_COMMAND_CLOSE:
2320 ecore_x_e_illume_close_send(win->xwin);
2330 elm_win_inlined_image_object_get(Evas_Object *obj)
2333 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2334 win = elm_widget_data_get(obj);
2335 if (!win) return NULL;
2336 return win->img_obj;
2340 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2344 ELM_CHECK_WIDTYPE(obj, widtype);
2346 win = elm_widget_data_get(obj);
2347 enabled = !!enabled;
2348 if (win->focus_highlight.enabled == enabled)
2351 win->focus_highlight.enabled = enabled;
2353 if (win->focus_highlight.enabled)
2354 _elm_win_focus_highlight_init(win);
2356 _elm_win_focus_highlight_shutdown(win);
2360 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2364 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2366 win = elm_widget_data_get(obj);
2367 return win->focus_highlight.enabled;
2371 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2375 ELM_CHECK_WIDTYPE(obj, widtype);
2377 win = elm_widget_data_get(obj);
2378 eina_stringshare_replace(&win->focus_highlight.style, style);
2379 win->focus_highlight.changed_theme = EINA_TRUE;
2380 _elm_win_focus_highlight_reconfigure_job_start(win);
2384 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2388 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2390 win = elm_widget_data_get(obj);
2391 return win->focus_highlight.style;
2394 typedef struct _Widget_Data Widget_Data;
2399 Evas_Object *content;
2402 static void _del_hook(Evas_Object *obj);
2403 static void _theme_hook(Evas_Object *obj);
2404 static void _sizing_eval(Evas_Object *obj);
2405 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2406 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2408 static const char *widtype2 = NULL;
2411 _del_hook(Evas_Object *obj)
2413 Widget_Data *wd = elm_widget_data_get(obj);
2419 _theme_hook(Evas_Object *obj)
2421 Widget_Data *wd = elm_widget_data_get(obj);
2422 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2424 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2429 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2431 Widget_Data *wd = elm_widget_data_get(obj);
2436 /* Try Focus cycle in subitem */
2439 elm_widget_focus_next_get(wd->content, dir, next);
2444 *next = (Evas_Object *)obj;
2449 _sizing_eval(Evas_Object *obj)
2451 Widget_Data *wd = elm_widget_data_get(obj);
2452 Evas_Coord minw = -1, minh = -1;
2454 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2455 edje_object_size_min_calc(wd->frm, &minw, &minh);
2456 evas_object_size_hint_min_set(obj, minw, minh);
2457 evas_object_size_hint_max_set(obj, -1, -1);
2461 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2467 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2469 Widget_Data *wd = elm_widget_data_get(obj);
2470 Evas_Object *sub = event_info;
2471 if (sub == wd->content)
2473 evas_object_event_callback_del_full
2474 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2481 elm_win_inwin_add(Evas_Object *obj)
2487 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2488 win = elm_widget_data_get(obj);
2489 if (!win) return NULL;
2490 wd = ELM_NEW(Widget_Data);
2491 obj2 = elm_widget_add(win->evas);
2492 elm_widget_type_set(obj2, "inwin");
2493 ELM_SET_WIDTYPE(widtype2, "inwin");
2494 elm_widget_sub_object_add(obj, obj2);
2495 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2496 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2497 elm_win_resize_object_add(obj, obj2);
2499 elm_widget_data_set(obj2, wd);
2500 elm_widget_del_hook_set(obj2, _del_hook);
2501 elm_widget_theme_hook_set(obj2, _theme_hook);
2502 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2503 elm_widget_can_focus_set(obj2, EINA_TRUE);
2504 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2506 wd->frm = edje_object_add(win->evas);
2507 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2508 elm_widget_resize_object_set(obj2, wd->frm);
2510 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2517 elm_win_inwin_activate(Evas_Object *obj)
2519 ELM_CHECK_WIDTYPE(obj, widtype2);
2520 Widget_Data *wd = elm_widget_data_get(obj);
2522 evas_object_raise(obj);
2523 evas_object_show(obj);
2524 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2525 elm_object_focus_set(obj, EINA_TRUE);
2529 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2531 ELM_CHECK_WIDTYPE(obj, widtype2);
2532 Widget_Data *wd = elm_widget_data_get(obj);
2534 if (wd->content == content) return;
2535 if (wd->content) evas_object_del(wd->content);
2536 wd->content = content;
2539 elm_widget_sub_object_add(obj, content);
2540 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2541 _changed_size_hints, obj);
2542 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2548 elm_win_inwin_content_get(const Evas_Object *obj)
2550 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2551 Widget_Data *wd = elm_widget_data_get(obj);
2552 if (!wd) return NULL;
2557 elm_win_inwin_content_unset(Evas_Object *obj)
2559 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2560 Widget_Data *wd = elm_widget_data_get(obj);
2561 if (!wd) return NULL;
2562 if (!wd->content) return NULL;
2563 Evas_Object *content = wd->content;
2564 elm_widget_sub_object_del(obj, wd->content);
2565 edje_object_part_unswallow(wd->frm, wd->content);
2570 /* windowing spcific calls - shall we do this differently? */
2572 static Ecore_X_Window
2573 _elm_ee_win_get(const Evas_Object *obj)
2576 #ifdef HAVE_ELEMENTARY_X
2577 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2578 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2584 elm_win_xwindow_get(const Evas_Object *obj)
2590 type = elm_widget_type_get(obj);
2591 if (!type) return 0;
2592 if (type != widtype) return _elm_ee_win_get(obj);
2593 #ifdef HAVE_ELEMENTARY_X
2594 win = elm_widget_data_get(obj);
2596 if (win->xwin) return win->xwin;
2597 if (win->parent) return elm_win_xwindow_get(win->parent);