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";
81 static const char SIG_THEME_CHANGED[] = "theme,changed";
83 static const Evas_Smart_Cb_Description _signals[] = {
84 {SIG_DELETE_REQUEST, ""},
93 Eina_List *_elm_win_list = NULL;
94 int _elm_win_deferred_free = 0;
96 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
97 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
100 _shot_delay_get(Elm_Win *win)
103 char *d = strdup(win->shot.info);
106 for (p = (char *)win->shot.info; *p; p++)
108 if (!strncmp(p, "delay=", 6))
112 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
127 _shot_file_get(Elm_Win *win)
130 char *tmp = strdup(win->shot.info);
131 char *repname = NULL;
133 if (!tmp) return NULL;
135 for (p = (char *)win->shot.info; *p; p++)
137 if (!strncmp(p, "file=", 5))
140 if (!win->shot.repeat_count) return tmp;
143 char *dotptr = strrchr(tmp, '.');
146 repname = malloc(sizeof(char)*(strlen(tmp) + 16));
147 strncpy(repname, tmp, dotptr - tmp);
148 sprintf(repname + (dotptr - tmp), "%03i",
149 win->shot.shot_counter + 1);
150 strcat(repname, dotptr);
158 if (!win->shot.repeat_count) return strdup("out.png");
161 repname = malloc(sizeof(char) * 24);
162 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
168 _shot_repeat_count_get(Elm_Win *win)
172 char *d = strdup(win->shot.info);
175 for (p = (char *)win->shot.info; *p; p++)
177 if (!strncmp(p, "repeat=", 7))
181 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
188 if (v > 1000) v = 999;
198 _shot_key_get(Elm_Win *win __UNUSED__)
204 _shot_flags_get(Elm_Win *win __UNUSED__)
210 _shot_do(Elm_Win *win)
214 unsigned int *pixels;
216 char *file, *key, *flags;
218 ecore_evas_manual_render(win->ee);
219 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
221 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
222 if ((w < 1) || (h < 1)) return;
223 file = _shot_file_get(win);
225 key = _shot_key_get(win);
226 flags = _shot_flags_get(win);
227 ee = ecore_evas_buffer_new(1, 1);
228 o = evas_object_image_add(ecore_evas_get(ee));
229 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
230 evas_object_image_size_set(o, w, h);
231 evas_object_image_data_set(o, pixels);
232 if (!evas_object_image_save(o, file, key, flags))
234 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
239 if (flags) free(flags);
241 if (win->shot.repeat_count) win->shot.shot_counter++;
245 _shot_delay(void *data)
249 if (win->shot.repeat_count)
251 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
252 if (remainshot > 0) return EINA_TRUE;
254 win->shot.timer = NULL;
260 _shot_init(Elm_Win *win)
262 if (!win->shot.info) return;
263 win->shot.repeat_count = _shot_repeat_count_get(win);
264 win->shot.shot_counter = 0;
268 _shot_handle(Elm_Win *win)
270 if (!win->shot.info) return;
271 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
275 _elm_win_move(Ecore_Evas *ee)
277 Evas_Object *obj = ecore_evas_object_associate_get(ee);
282 win = elm_widget_data_get(obj);
284 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
287 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
291 _elm_win_resize(Ecore_Evas *ee)
293 Evas_Object *obj = ecore_evas_object_associate_get(ee);
297 win = elm_widget_data_get(obj);
299 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
300 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
304 _elm_win_focus_in(Ecore_Evas *ee)
306 Evas_Object *obj = ecore_evas_object_associate_get(ee);
310 win = elm_widget_data_get(obj);
312 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
313 if (win->show_count == 1)
315 elm_object_focus_set(win->win_obj, EINA_TRUE);
319 elm_widget_focus_restore(win->win_obj);
320 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
321 win->focus_highlight.cur.visible = EINA_TRUE;
322 _elm_win_focus_highlight_reconfigure_job_start(win);
326 else if (win->img_obj)
333 _elm_win_focus_out(Ecore_Evas *ee)
335 Evas_Object *obj = ecore_evas_object_associate_get(ee);
339 win = elm_widget_data_get(obj);
341 elm_object_focus_set(win->win_obj, EINA_FALSE);
342 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
343 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
344 win->focus_highlight.cur.visible = EINA_FALSE;
345 _elm_win_focus_highlight_reconfigure_job_start(win);
349 else if (win->img_obj)
356 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
358 Elm_Win *wd = elm_widget_data_get(obj);
359 const Eina_List *items;
360 void *(*list_data_get) (const Eina_List *list);
368 if (!(items = elm_widget_focus_custom_chain_get(obj)))
374 list_data_get = eina_list_data_get;
376 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
382 *next = (Evas_Object *)obj;
387 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
389 Elm_Win *win = elm_widget_data_get(obj);
393 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
395 evas_object_focus_set(obj, elm_widget_focus_get(obj));
399 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
401 if (type == EVAS_CALLBACK_KEY_DOWN)
403 Evas_Event_Key_Down *ev = event_info;
404 if (!strcmp(ev->keyname, "Tab"))
406 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
407 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
409 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
410 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
413 else if ((!strcmp(ev->keyname, "Left")) ||
414 (!strcmp(ev->keyname, "KP_Left")))
416 //TODO : woohyun jung
418 else if ((!strcmp(ev->keyname, "Right")) ||
419 (!strcmp(ev->keyname, "KP_Right")))
421 //TODO : woohyun jung
423 else if ((!strcmp(ev->keyname, "Up")) ||
424 (!strcmp(ev->keyname, "KP_Up")))
426 //TODO : woohyun jung
428 else if ((!strcmp(ev->keyname, "Down")) ||
429 (!strcmp(ev->keyname, "KP_Down")))
431 //TODO : woohyun jung
439 _deferred_ecore_evas_free(void *data)
441 ecore_evas_free(data);
442 _elm_win_deferred_free--;
446 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
450 if (!win->show_count) win->show_count++;
451 if (win->shot.info) _shot_handle(win);
455 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
462 else if (win->img_obj)
464 evas_object_hide(win->img_obj);
469 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
476 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
477 _elm_win_obj_callback_parent_del, win);
480 if (win->autodel_clear) *(win->autodel_clear) = -1;
481 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
482 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
485 ecore_evas_callback_delete_request_set(win->ee, NULL);
486 ecore_evas_callback_resize_set(win->ee, NULL);
488 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
489 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
490 if (win->shot.info) eina_stringshare_del(win->shot.info);
491 if (win->shot.timer) ecore_timer_del(win->shot.timer);
492 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
493 _elm_win_obj_callback_del, win);
494 while (((child = evas_object_bottom_get(win->evas))) &&
497 evas_object_del(child);
499 while (((child = evas_object_top_get(win->evas))) &&
502 evas_object_del(child);
504 #ifdef HAVE_ELEMENTARY_X
505 if (win->client_message_handler)
506 ecore_event_handler_del(win->client_message_handler);
508 // FIXME: Why are we flushing edje on every window destroy ??
509 // edje_file_cache_flush();
510 // edje_collection_cache_flush();
511 // evas_image_cache_flush(win->evas);
512 // evas_font_cache_flush(win->evas);
513 // FIXME: we are in the del handler for the object and delete the canvas
514 // that lives under it from the handler... nasty. deferring doesn't help either
524 ecore_job_add(_deferred_ecore_evas_free, win->ee);
525 _elm_win_deferred_free++;
529 _elm_win_focus_highlight_shutdown(win);
530 eina_stringshare_del(win->focus_highlight.style);
534 if ((!_elm_win_list) &&
535 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
537 edje_file_cache_flush();
538 edje_collection_cache_flush();
539 evas_image_cache_flush(e);
540 evas_font_cache_flush(e);
546 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
549 if (!win->img_obj) return;
550 evas_object_event_callback_del_full
551 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
552 evas_object_del(win->img_obj);
556 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
559 if (obj == win->parent) win->parent = NULL;
563 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
569 if ((x != win->screen.x) || (y != win->screen.y))
573 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
578 evas_object_move(obj, x, y);
583 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
586 // this is called to make sure all smart containers have calculated their
587 // sizes BEFORE we show the window to make sure it initially appears at
588 // our desired size (ie min size is known first)
589 evas_smart_objects_calculate(evas_object_evas_get(obj));
590 evas_object_show(obj);
594 else if (win->img_obj)
596 evas_object_show(win->img_obj);
601 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
605 if (ecore_evas_override_get(win->ee))
609 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
612 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
617 else if (win->img_obj)
621 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
624 // evas_object_move(win->img_obj, x, y);
629 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
636 else if (win->img_obj)
638 Evas_Coord w = 1, h = 1;
640 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
643 evas_object_image_size_set(win->img_obj, w, h);
648 _elm_win_delete_request(Ecore_Evas *ee)
650 Evas_Object *obj = ecore_evas_object_associate_get(ee);
652 if (strcmp(elm_widget_type_get(obj), "win")) return;
654 win = elm_widget_data_get(obj);
656 int autodel = win->autodel;
657 win->autodel_clear = &autodel;
658 evas_object_ref(win->win_obj);
659 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
660 // FIXME: if above callback deletes - then the below will be invalid
661 if (autodel) evas_object_del(win->win_obj);
662 else win->autodel_clear = NULL;
663 evas_object_unref(win->win_obj);
667 _elm_win_resize_job(void *data)
674 win->deferred_resize_job = NULL;
675 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
676 evas_object_resize(win->win_obj, w, h);
680 else if (win->img_obj)
683 EINA_LIST_FOREACH(win->subobjs, l, obj)
685 evas_object_move(obj, 0, 0);
686 evas_object_resize(obj, w, h);
690 #ifdef HAVE_ELEMENTARY_X
692 _elm_win_xwindow_get(Elm_Win *win)
696 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
697 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
699 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
701 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
702 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
703 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
704 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
705 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
706 ENGINE_COMPARE(ELM_OPENGL_SDL))
709 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
711 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
713 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
715 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
718 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
720 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
723 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
725 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
727 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
729 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
731 #undef ENGINE_COMPARE
735 #ifdef HAVE_ELEMENTARY_X
737 _elm_win_xwin_update(Elm_Win *win)
739 _elm_win_xwindow_get(win);
744 win2 = elm_widget_data_get(win->parent);
748 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
752 if (!win->xwin) return; /* nothing more to do */
757 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
759 case ELM_WIN_DIALOG_BASIC:
760 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
762 case ELM_WIN_DESKTOP:
763 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
766 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
768 case ELM_WIN_TOOLBAR:
769 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
772 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
774 case ELM_WIN_UTILITY:
775 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
778 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
780 case ELM_WIN_DROPDOWN_MENU:
781 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
783 case ELM_WIN_POPUP_MENU:
784 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
786 case ELM_WIN_TOOLTIP:
787 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
789 case ELM_WIN_NOTIFICATION:
790 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
793 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
796 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
801 ecore_x_e_virtual_keyboard_state_set
802 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
807 _elm_win_eval_subobjs(Evas_Object *obj)
810 const Evas_Object *child;
812 Elm_Win *win = elm_widget_data_get(obj);
813 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
817 EINA_LIST_FOREACH(win->subobjs, l, child)
819 evas_object_size_hint_weight_get(child, &wx, &wy);
820 if (wx == 0.0) xx = 0;
821 if (wy == 0.0) xy = 0;
823 evas_object_size_hint_min_get(child, &w, &h);
826 if (w > minw) minw = w;
827 if (h > minh) minh = h;
829 evas_object_size_hint_max_get(child, &w, &h);
832 if (maxw == -1) maxw = w;
833 else if ((w > 0) && (w < maxw)) maxw = w;
834 if (maxh == -1) maxh = h;
835 else if ((h > 0) && (h < maxh)) maxh = h;
837 if (!xx) maxw = minw;
839 if (!xy) maxh = minh;
841 evas_object_size_hint_min_set(obj, minw, minh);
842 evas_object_size_hint_max_set(obj, maxw, maxh);
843 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
844 if (w < minw) w = minw;
845 if (h < minh) h = minh;
846 if ((maxw >= 0) && (w > maxw)) w = maxw;
847 if ((maxh >= 0) && (h > maxh)) h = maxh;
848 evas_object_resize(obj, w, h);
852 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
854 Elm_Win *win = elm_widget_data_get(data);
855 win->subobjs = eina_list_remove(win->subobjs, obj);
856 _elm_win_eval_subobjs(win->win_obj);
860 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
862 _elm_win_eval_subobjs(data);
866 _elm_win_shutdown(void)
868 while (_elm_win_list)
869 evas_object_del(_elm_win_list->data);
873 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
880 EINA_LIST_FOREACH(_elm_win_list, l, obj)
881 elm_widget_theme(obj);
885 EINA_LIST_FOREACH(_elm_win_list, l, obj)
886 elm_widget_theme_specific(obj, th, EINA_FALSE);
890 #ifdef HAVE_ELEMENTARY_X
892 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
895 Ecore_X_Event_Client_Message *e = event;
897 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
898 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
900 if ((unsigned)e->data.l[0] == win->xwin)
902 Evas *evas = evas_object_evas_get(win->win_obj);
905 edje_file_cache_flush();
906 edje_collection_cache_flush();
907 evas_image_cache_flush(evas);
908 evas_font_cache_flush(evas);
912 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
914 if ((unsigned)e->data.l[0] == win->xwin)
916 Evas *evas = evas_object_evas_get(win->win_obj);
919 edje_file_cache_flush();
920 edje_collection_cache_flush();
921 evas_image_cache_flush(evas);
922 evas_font_cache_flush(evas);
923 evas_render_dump(evas);
927 return ECORE_CALLBACK_PASS_ON;
932 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
936 win->focus_highlight.geometry_changed = EINA_TRUE;
937 _elm_win_focus_highlight_reconfigure_job_start(win);
941 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
945 win->focus_highlight.geometry_changed = EINA_TRUE;
946 _elm_win_focus_highlight_reconfigure_job_start(win);
950 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
954 win->focus_highlight.cur.target = NULL;
956 _elm_win_focus_highlight_reconfigure_job_start(win);
960 _elm_win_focus_target_callbacks_add(Elm_Win *win)
962 Evas_Object *obj = win->focus_highlight.cur.target;
964 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
965 _elm_win_focus_target_move, win);
966 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
967 _elm_win_focus_target_resize, win);
968 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
969 _elm_win_focus_target_del, win);
973 _elm_win_focus_target_callbacks_del(Elm_Win *win)
975 Evas_Object *obj = win->focus_highlight.cur.target;
977 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
978 _elm_win_focus_target_move, win);
979 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
980 _elm_win_focus_target_resize, win);
981 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
982 _elm_win_focus_target_del, win);
986 _elm_win_focus_target_get(Evas_Object *obj)
988 Evas_Object *o = obj;
992 if (elm_widget_is(o))
994 if (!elm_widget_highlight_ignore_get(o))
996 o = elm_widget_parent_get(o);
998 o = evas_object_smart_parent_get(o);
1002 o = elm_widget_parent_widget_get(o);
1004 o = evas_object_smart_parent_get(o);
1013 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1015 Evas_Object *obj = event_info, *target;
1016 Elm_Win *win = data;
1018 if (win->focus_highlight.cur.target == obj)
1021 target = _elm_win_focus_target_get(obj);
1022 win->focus_highlight.cur.target = target;
1023 if (elm_widget_highlight_in_theme_get(target))
1024 win->focus_highlight.cur.handled = EINA_TRUE;
1026 _elm_win_focus_target_callbacks_add(win);
1028 _elm_win_focus_highlight_reconfigure_job_start(win);
1032 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1034 Elm_Win *win = data;
1036 if (!win->focus_highlight.cur.target)
1039 if (!win->focus_highlight.cur.handled)
1040 _elm_win_focus_target_callbacks_del(win);
1041 win->focus_highlight.cur.target = NULL;
1042 win->focus_highlight.cur.handled = EINA_FALSE;
1044 _elm_win_focus_highlight_reconfigure_job_start(win);
1048 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1050 evas_object_hide(obj);
1054 _elm_win_focus_highlight_init(Elm_Win *win)
1056 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1057 _elm_win_object_focus_in, win);
1058 evas_event_callback_add(win->evas,
1059 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1060 _elm_win_object_focus_out, win);
1062 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1064 win->focus_highlight.top = edje_object_add(win->evas);
1065 win->focus_highlight.changed_theme = EINA_TRUE;
1066 edje_object_signal_callback_add(win->focus_highlight.top,
1067 "elm,action,focus,hide,end", "",
1068 _elm_win_focus_highlight_hide, NULL);
1069 edje_object_signal_callback_add(win->focus_highlight.top,
1070 "elm,action,focus,anim,end", "",
1071 _elm_win_focus_highlight_anim_end, win);
1072 _elm_win_focus_highlight_reconfigure_job_start(win);
1076 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1078 _elm_win_focus_highlight_reconfigure_job_stop(win);
1079 if (win->focus_highlight.cur.target)
1081 _elm_win_focus_target_callbacks_del(win);
1082 win->focus_highlight.cur.target = NULL;
1084 if (win->focus_highlight.top)
1086 evas_object_del(win->focus_highlight.top);
1087 win->focus_highlight.top = NULL;
1090 evas_event_callback_del_full(win->evas,
1091 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1092 _elm_win_object_focus_in, win);
1093 evas_event_callback_del_full(win->evas,
1094 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1095 _elm_win_object_focus_out, win);
1099 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1103 top = win->focus_highlight.top;
1108 evas_object_show(top);
1109 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1115 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1120 _elm_win_focus_highlight_reconfigure_job(void *data)
1122 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1126 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1128 if (win->focus_highlight.reconf_job)
1129 ecore_job_del(win->focus_highlight.reconf_job);
1130 win->focus_highlight.reconf_job = ecore_job_add(
1131 _elm_win_focus_highlight_reconfigure_job, win);
1135 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1137 if (win->focus_highlight.reconf_job)
1138 ecore_job_del(win->focus_highlight.reconf_job);
1139 win->focus_highlight.reconf_job = NULL;
1143 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1145 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1146 Evas_Coord x, y, w, h;
1148 clip = evas_object_clip_get(target);
1149 evas_object_geometry_get(target, &x, &y, &w, &h);
1151 evas_object_move(obj, x, y);
1152 evas_object_resize(obj, w, h);
1153 evas_object_clip_set(obj, clip);
1157 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1159 Evas_Coord tx, ty, tw, th;
1160 Evas_Coord w, h, px, py, pw, ph;
1161 Edje_Message_Int_Set *m;
1162 Evas_Object *previous = win->focus_highlight.prev.target;
1163 Evas_Object *target = win->focus_highlight.cur.target;
1165 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1166 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1167 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1168 evas_object_move(obj, 0, 0);
1169 evas_object_resize(obj, tw, th);
1170 evas_object_clip_unset(obj);
1172 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1182 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1186 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1188 Elm_Win *win = data;
1189 _elm_win_focus_highlight_simple_setup(win, obj);
1193 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1195 Evas_Object *target = win->focus_highlight.cur.target;
1196 Evas_Object *previous = win->focus_highlight.prev.target;
1197 Evas_Object *top = win->focus_highlight.top;
1198 Eina_Bool visible_changed;
1199 Eina_Bool common_visible;
1200 const char *sig = NULL;
1202 _elm_win_focus_highlight_reconfigure_job_stop(win);
1204 visible_changed = (win->focus_highlight.cur.visible !=
1205 win->focus_highlight.prev.visible);
1207 if ((target == previous) && (!visible_changed) &&
1208 (!win->focus_highlight.geometry_changed))
1211 if ((previous) && (win->focus_highlight.prev.handled))
1212 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1215 common_visible = EINA_FALSE;
1216 else if (win->focus_highlight.cur.handled)
1218 common_visible = EINA_FALSE;
1219 if (win->focus_highlight.cur.visible)
1220 sig = "elm,action,focus_highlight,show";
1222 sig = "elm,action,focus_highlight,hide";
1225 common_visible = win->focus_highlight.cur.visible;
1227 _elm_win_focus_highlight_visible_set(win, common_visible);
1229 elm_widget_signal_emit(target, sig, "elm");
1231 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1234 if (win->focus_highlight.changed_theme)
1237 if (win->focus_highlight.style)
1238 str = win->focus_highlight.style;
1241 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1243 win->focus_highlight.changed_theme = EINA_FALSE;
1245 if (_elm_config->focus_highlight_animate)
1247 str = edje_object_data_get(win->focus_highlight.top, "animate");
1248 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1252 if ((win->focus_highlight.top_animate) && (previous) &&
1253 (!win->focus_highlight.prev.handled))
1254 _elm_win_focus_highlight_anim_setup(win, top);
1256 _elm_win_focus_highlight_simple_setup(win, top);
1257 evas_object_raise(top);
1260 win->focus_highlight.geometry_changed = EINA_FALSE;
1261 win->focus_highlight.prev = win->focus_highlight.cur;
1266 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1268 Evas_Event_Key_Down *ev = event_info;
1270 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1274 if ((strcmp(ev->keyname, "F12")) ||
1275 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1278 printf("Tree graph generated.\n");
1279 elm_object_tree_dot_dump(obj, "./dump.dot");
1284 _win_img_hide(void *data,
1286 Evas_Object *obj __UNUSED__,
1287 void *event_info __UNUSED__)
1289 Elm_Win *win = data;
1291 elm_widget_focus_hide_handle(win->win_obj);
1295 _win_img_mouse_up(void *data,
1297 Evas_Object *obj __UNUSED__,
1300 Elm_Win *win = data;
1301 Evas_Event_Mouse_Up *ev = event_info;
1302 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1303 elm_widget_focus_mouse_up_handle(win->win_obj);
1307 _win_img_focus_in(void *data,
1309 Evas_Object *obj __UNUSED__,
1310 void *event_info __UNUSED__)
1312 Elm_Win *win = data;
1313 elm_widget_focus_steal(win->win_obj);
1317 _win_img_focus_out(void *data,
1319 Evas_Object *obj __UNUSED__,
1320 void *event_info __UNUSED__)
1322 Elm_Win *win = data;
1323 elm_widget_focused_object_clear(win->win_obj);
1327 _win_inlined_image_set(Elm_Win *win)
1329 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1330 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1331 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1332 _elm_win_obj_callback_img_obj_del, win);
1334 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1335 _win_img_hide, win);
1336 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1337 _win_img_mouse_up, win);
1338 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1339 _win_img_focus_in, win);
1340 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1341 _win_img_focus_out, win);
1345 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1349 const char *fontpath;
1351 win = ELM_NEW(Elm_Win);
1353 #define FALLBACK_TRY(engine) \
1356 CRITICAL(engine " engine creation failed. Trying default."); \
1357 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1359 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1361 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1365 case ELM_WIN_INLINED_IMAGE:
1368 Evas *e = evas_object_evas_get(parent);
1371 ee = ecore_evas_ecore_evas_get(e);
1373 win->img_obj = ecore_evas_object_image_new(ee);
1374 if (!win->img_obj) break;
1375 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1378 _win_inlined_image_set(win);
1381 evas_object_del(win->img_obj);
1382 win->img_obj = NULL;
1386 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1388 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1389 #ifdef HAVE_ELEMENTARY_X
1390 win->client_message_handler = ecore_event_handler_add
1391 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1393 FALLBACK_TRY("Sofware X11");
1395 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1397 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1398 FALLBACK_TRY("Sofware FB");
1400 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1402 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1403 FALLBACK_TRY("Sofware DirectFB");
1405 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1407 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1408 FALLBACK_TRY("Sofware-16");
1409 #ifdef HAVE_ELEMENTARY_X
1410 win->client_message_handler = ecore_event_handler_add
1411 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1414 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1416 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1417 FALLBACK_TRY("Sofware-8");
1418 #ifdef HAVE_ELEMENTARY_X
1419 win->client_message_handler = ecore_event_handler_add
1420 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1424 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1426 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1427 FALLBACK_TRY("XRender");
1428 #ifdef HAVE_ELEMENTARY_X
1429 win->client_message_handler = ecore_event_handler_add
1430 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1434 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1439 if (_elm_config->vsync)
1441 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1447 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1449 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1450 FALLBACK_TRY("OpenGL");
1451 #ifdef HAVE_ELEMENTARY_X
1452 win->client_message_handler = ecore_event_handler_add
1453 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1456 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1458 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1459 FALLBACK_TRY("Sofware Win32");
1461 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1463 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1464 FALLBACK_TRY("Sofware-16-WinCE");
1466 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1468 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1469 FALLBACK_TRY("Sofware SDL");
1471 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1473 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1474 FALLBACK_TRY("Sofware-16-SDL");
1476 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1478 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1479 FALLBACK_TRY("OpenGL SDL");
1481 else if (ENGINE_COMPARE(ELM_BUFFER))
1483 win->ee = ecore_evas_buffer_new(1, 1);
1485 else if (ENGINE_COMPARE(ELM_EWS))
1487 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1489 else if (!strncmp(_elm_config->engine, "shot:", 5))
1491 win->ee = ecore_evas_buffer_new(1, 1);
1492 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1493 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1502 ERR("Cannot create window.");
1506 #ifdef HAVE_ELEMENTARY_X
1507 _elm_win_xwindow_get(win);
1509 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1510 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1511 // bg pixmap done by x - has other issues like can be redrawn by x before it
1512 // is filled/ready by app
1513 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1516 win->parent = parent;
1518 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1519 _elm_win_obj_callback_parent_del, win);
1521 win->evas = ecore_evas_get(win->ee);
1522 win->win_obj = elm_widget_add(win->evas);
1523 elm_widget_type_set(win->win_obj, "win");
1524 ELM_SET_WIDTYPE(widtype, "win");
1525 elm_widget_data_set(win->win_obj, win);
1526 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1527 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1528 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1529 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1530 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1531 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1532 evas_object_move(win->win_obj, 0, 0);
1533 evas_object_resize(win->win_obj, 1, 1);
1534 evas_object_layer_set(win->win_obj, 50);
1535 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1537 if (type == ELM_WIN_INLINED_IMAGE)
1538 elm_widget_parent2_set(win->win_obj, parent);
1539 ecore_evas_object_associate(win->ee, win->win_obj,
1540 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1541 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1542 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1543 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1544 _elm_win_obj_callback_show, win);
1545 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1546 _elm_win_obj_callback_hide, win);
1547 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1548 _elm_win_obj_callback_del, win);
1549 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1550 _elm_win_obj_callback_move, win);
1551 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1552 _elm_win_obj_callback_resize, win);
1554 evas_object_intercept_move_callback_add(win->win_obj,
1555 _elm_win_obj_intercept_move, win);
1556 evas_object_intercept_show_callback_add(win->win_obj,
1557 _elm_win_obj_intercept_show, win);
1559 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1560 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1561 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1562 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1563 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1564 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1565 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1566 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1567 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1568 evas_font_path_append(win->evas, fontpath);
1569 if (!_elm_config->font_hinting)
1570 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1571 else if (_elm_config->font_hinting == 1)
1572 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1573 else if (_elm_config->font_hinting == 2)
1574 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1576 #ifdef HAVE_ELEMENTARY_X
1577 _elm_win_xwin_update(win);
1580 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1582 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1584 ecore_evas_fullscreen_set(win->ee, 1);
1586 #undef ENGINE_COMPARE
1588 if (_elm_config->focus_highlight_enable)
1589 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1592 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1593 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1594 _debug_key_down, win);
1596 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1598 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1601 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1603 return win->win_obj;
1607 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1611 ELM_CHECK_WIDTYPE(obj, widtype);
1612 win = elm_widget_data_get(obj);
1614 if (eina_list_data_find(win->subobjs, subobj)) return;
1615 win->subobjs = eina_list_append(win->subobjs, subobj);
1616 elm_widget_sub_object_add(obj, subobj);
1617 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1618 _elm_win_subobj_callback_del, obj);
1619 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1620 _elm_win_subobj_callback_changed_size_hints,
1622 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1623 evas_object_move(subobj, 0, 0);
1624 evas_object_resize(subobj, w, h);
1625 _elm_win_eval_subobjs(obj);
1629 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1632 ELM_CHECK_WIDTYPE(obj, widtype);
1633 win = elm_widget_data_get(obj);
1635 evas_object_event_callback_del_full(subobj,
1636 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1637 _elm_win_subobj_callback_changed_size_hints,
1639 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1640 _elm_win_subobj_callback_del, obj);
1641 win->subobjs = eina_list_remove(win->subobjs, subobj);
1642 elm_widget_sub_object_del(obj, subobj);
1643 _elm_win_eval_subobjs(obj);
1647 elm_win_title_set(Evas_Object *obj, const char *title)
1650 ELM_CHECK_WIDTYPE(obj, widtype);
1651 win = elm_widget_data_get(obj);
1653 ecore_evas_title_set(win->ee, title);
1657 elm_win_title_get(const Evas_Object *obj)
1660 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1661 win = elm_widget_data_get(obj);
1662 if (!win) return NULL;
1663 return ecore_evas_title_get(win->ee);
1667 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1670 ELM_CHECK_WIDTYPE(obj, widtype);
1671 win = elm_widget_data_get(obj);
1673 win->autodel = autodel;
1677 elm_win_autodel_get(const Evas_Object *obj)
1680 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1681 win = elm_widget_data_get(obj);
1682 if (!win) return EINA_FALSE;
1683 return win->autodel;
1687 elm_win_activate(Evas_Object *obj)
1690 ELM_CHECK_WIDTYPE(obj, widtype);
1691 win = elm_widget_data_get(obj);
1693 ecore_evas_activate(win->ee);
1697 elm_win_lower(Evas_Object *obj)
1700 ELM_CHECK_WIDTYPE(obj, widtype);
1701 win = elm_widget_data_get(obj);
1703 ecore_evas_lower(win->ee);
1707 elm_win_raise(Evas_Object *obj)
1710 ELM_CHECK_WIDTYPE(obj, widtype);
1711 win = elm_widget_data_get(obj);
1713 ecore_evas_raise(win->ee);
1717 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1720 ELM_CHECK_WIDTYPE(obj, widtype);
1721 win = elm_widget_data_get(obj);
1723 ecore_evas_borderless_set(win->ee, borderless);
1724 #ifdef HAVE_ELEMENTARY_X
1725 _elm_win_xwin_update(win);
1730 elm_win_borderless_get(const Evas_Object *obj)
1733 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1734 win = elm_widget_data_get(obj);
1735 if (!win) return EINA_FALSE;
1736 return ecore_evas_borderless_get(win->ee);
1740 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1743 ELM_CHECK_WIDTYPE(obj, widtype);
1744 win = elm_widget_data_get(obj);
1746 ecore_evas_shaped_set(win->ee, shaped);
1747 #ifdef HAVE_ELEMENTARY_X
1748 _elm_win_xwin_update(win);
1753 elm_win_shaped_get(const Evas_Object *obj)
1756 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1757 win = elm_widget_data_get(obj);
1758 if (!win) return EINA_FALSE;
1759 return ecore_evas_shaped_get(win->ee);
1763 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1766 ELM_CHECK_WIDTYPE(obj, widtype);
1767 win = elm_widget_data_get(obj);
1772 else if (win->img_obj)
1774 evas_object_image_alpha_set(win->img_obj, alpha);
1775 ecore_evas_alpha_set(win->ee, alpha);
1779 #ifdef HAVE_ELEMENTARY_X
1784 if (!_elm_config->compositing)
1785 elm_win_shaped_set(obj, alpha);
1787 ecore_evas_alpha_set(win->ee, alpha);
1790 ecore_evas_alpha_set(win->ee, alpha);
1791 _elm_win_xwin_update(win);
1795 ecore_evas_alpha_set(win->ee, alpha);
1800 elm_win_alpha_get(const Evas_Object *obj)
1803 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1804 win = elm_widget_data_get(obj);
1805 if (!win) return EINA_FALSE;
1809 else if (win->img_obj)
1811 return evas_object_image_alpha_get(win->img_obj);
1813 return ecore_evas_alpha_get(win->ee);
1817 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1820 ELM_CHECK_WIDTYPE(obj, widtype);
1821 win = elm_widget_data_get(obj);
1827 else if (win->img_obj)
1829 evas_object_image_alpha_set(win->img_obj, transparent);
1833 #ifdef HAVE_ELEMENTARY_X
1836 ecore_evas_transparent_set(win->ee, transparent);
1837 _elm_win_xwin_update(win);
1841 ecore_evas_transparent_set(win->ee, transparent);
1846 elm_win_transparent_get(const Evas_Object *obj)
1849 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1850 win = elm_widget_data_get(obj);
1851 if (!win) return EINA_FALSE;
1853 return ecore_evas_transparent_get(win->ee);
1857 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1860 ELM_CHECK_WIDTYPE(obj, widtype);
1861 win = elm_widget_data_get(obj);
1863 ecore_evas_override_set(win->ee, override);
1864 #ifdef HAVE_ELEMENTARY_X
1865 _elm_win_xwin_update(win);
1870 elm_win_override_get(const Evas_Object *obj)
1873 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1874 win = elm_widget_data_get(obj);
1875 if (!win) return EINA_FALSE;
1876 return ecore_evas_override_get(win->ee);
1880 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1883 ELM_CHECK_WIDTYPE(obj, widtype);
1884 win = elm_widget_data_get(obj);
1887 // YYY: handle if win->img_obj
1888 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1889 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1890 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1892 // these engines... can ONLY be fullscreen
1897 ecore_evas_fullscreen_set(win->ee, fullscreen);
1898 #ifdef HAVE_ELEMENTARY_X
1899 _elm_win_xwin_update(win);
1902 #undef ENGINE_COMPARE
1906 elm_win_fullscreen_get(const Evas_Object *obj)
1909 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1910 win = elm_widget_data_get(obj);
1911 if (!win) return EINA_FALSE;
1913 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1914 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1915 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1917 // these engines... can ONLY be fullscreen
1922 return ecore_evas_fullscreen_get(win->ee);
1924 #undef ENGINE_COMPARE
1928 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1931 ELM_CHECK_WIDTYPE(obj, widtype);
1932 win = elm_widget_data_get(obj);
1934 // YYY: handle if win->img_obj
1935 ecore_evas_maximized_set(win->ee, maximized);
1936 #ifdef HAVE_ELEMENTARY_X
1937 _elm_win_xwin_update(win);
1942 elm_win_maximized_get(const Evas_Object *obj)
1945 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1946 win = elm_widget_data_get(obj);
1947 if (!win) return EINA_FALSE;
1948 return ecore_evas_maximized_get(win->ee);
1952 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1955 ELM_CHECK_WIDTYPE(obj, widtype);
1956 win = elm_widget_data_get(obj);
1958 ecore_evas_iconified_set(win->ee, iconified);
1959 #ifdef HAVE_ELEMENTARY_X
1960 _elm_win_xwin_update(win);
1965 elm_win_iconified_get(const Evas_Object *obj)
1968 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1969 win = elm_widget_data_get(obj);
1970 if (!win) return EINA_FALSE;
1971 return ecore_evas_iconified_get(win->ee);
1975 elm_win_layer_set(Evas_Object *obj, int layer)
1978 ELM_CHECK_WIDTYPE(obj, widtype);
1979 win = elm_widget_data_get(obj);
1981 ecore_evas_layer_set(win->ee, layer);
1982 #ifdef HAVE_ELEMENTARY_X
1983 _elm_win_xwin_update(win);
1988 elm_win_layer_get(const Evas_Object *obj)
1991 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1992 win = elm_widget_data_get(obj);
1993 if (!win) return -1;
1994 return ecore_evas_layer_get(win->ee);
1998 elm_win_rotation_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_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_with_resize_set(Evas_Object *obj, int rotation)
2019 ELM_CHECK_WIDTYPE(obj, widtype);
2020 win = elm_widget_data_get(obj);
2022 if (win->rot == rotation) return;
2023 win->rot = rotation;
2024 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2025 evas_object_size_hint_min_set(obj, -1, -1);
2026 evas_object_size_hint_max_set(obj, -1, -1);
2027 _elm_win_eval_subobjs(obj);
2028 #ifdef HAVE_ELEMENTARY_X
2029 _elm_win_xwin_update(win);
2034 elm_win_rotation_get(const Evas_Object *obj)
2037 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2038 win = elm_widget_data_get(obj);
2039 if (!win) return -1;
2044 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2047 ELM_CHECK_WIDTYPE(obj, widtype);
2048 win = elm_widget_data_get(obj);
2050 ecore_evas_sticky_set(win->ee, sticky);
2051 #ifdef HAVE_ELEMENTARY_X
2052 _elm_win_xwin_update(win);
2057 elm_win_sticky_get(const Evas_Object *obj)
2060 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2061 win = elm_widget_data_get(obj);
2062 if (!win) return EINA_FALSE;
2063 return ecore_evas_sticky_get(win->ee);
2067 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2070 ELM_CHECK_WIDTYPE(obj, widtype);
2071 win = elm_widget_data_get(obj);
2073 if (mode == win->kbdmode) return;
2074 #ifdef HAVE_ELEMENTARY_X
2075 _elm_win_xwindow_get(win);
2077 win->kbdmode = mode;
2078 #ifdef HAVE_ELEMENTARY_X
2080 ecore_x_e_virtual_keyboard_state_set
2081 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2085 EAPI Elm_Win_Keyboard_Mode
2086 elm_win_keyboard_mode_get(const Evas_Object *obj)
2089 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2090 win = elm_widget_data_get(obj);
2091 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2092 return win->kbdmode;
2096 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2099 ELM_CHECK_WIDTYPE(obj, widtype);
2100 win = elm_widget_data_get(obj);
2102 #ifdef HAVE_ELEMENTARY_X
2103 _elm_win_xwindow_get(win);
2105 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2110 elm_win_keyboard_win_get(const Evas_Object *obj)
2113 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2114 win = elm_widget_data_get(obj);
2115 if (!win) return EINA_FALSE;
2116 #ifdef HAVE_ELEMENTARY_X
2117 _elm_win_xwindow_get(win);
2119 return ecore_x_e_virtual_keyboard_get(win->xwin);
2125 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2128 ELM_CHECK_WIDTYPE(obj, widtype);
2129 win = elm_widget_data_get(obj);
2131 if (x) *x = win->screen.x;
2132 if (y) *y = win->screen.y;
2136 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2139 ELM_CHECK_WIDTYPE(obj, widtype);
2140 win = elm_widget_data_get(obj);
2142 #ifdef HAVE_ELEMENTARY_X
2143 _elm_win_xwindow_get(win);
2145 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2150 elm_win_conformant_get(const Evas_Object *obj)
2153 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2154 win = elm_widget_data_get(obj);
2155 if (!win) return EINA_FALSE;
2156 #ifdef HAVE_ELEMENTARY_X
2157 _elm_win_xwindow_get(win);
2159 return ecore_x_e_illume_conformant_get(win->xwin);
2165 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2168 ELM_CHECK_WIDTYPE(obj, widtype);
2169 win = elm_widget_data_get(obj);
2171 #ifdef HAVE_ELEMENTARY_X
2172 _elm_win_xwindow_get(win);
2175 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2178 Ecore_X_Window_State states[2];
2180 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2181 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2182 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2183 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2190 elm_win_quickpanel_get(const Evas_Object *obj)
2193 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2194 win = elm_widget_data_get(obj);
2195 if (!win) return EINA_FALSE;
2196 #ifdef HAVE_ELEMENTARY_X
2197 _elm_win_xwindow_get(win);
2199 return ecore_x_e_illume_quickpanel_get(win->xwin);
2205 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2208 ELM_CHECK_WIDTYPE(obj, widtype);
2209 win = elm_widget_data_get(obj);
2211 #ifdef HAVE_ELEMENTARY_X
2212 _elm_win_xwindow_get(win);
2214 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2219 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2222 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2223 win = elm_widget_data_get(obj);
2224 if (!win) return -1;
2225 #ifdef HAVE_ELEMENTARY_X
2226 _elm_win_xwindow_get(win);
2228 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2234 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2237 ELM_CHECK_WIDTYPE(obj, widtype);
2238 win = elm_widget_data_get(obj);
2240 #ifdef HAVE_ELEMENTARY_X
2241 _elm_win_xwindow_get(win);
2243 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2248 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2251 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2252 win = elm_widget_data_get(obj);
2253 if (!win) return -1;
2254 #ifdef HAVE_ELEMENTARY_X
2255 _elm_win_xwindow_get(win);
2257 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2263 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2266 ELM_CHECK_WIDTYPE(obj, widtype);
2267 win = elm_widget_data_get(obj);
2269 #ifdef HAVE_ELEMENTARY_X
2270 _elm_win_xwindow_get(win);
2272 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2277 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2280 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2281 win = elm_widget_data_get(obj);
2283 #ifdef HAVE_ELEMENTARY_X
2284 _elm_win_xwindow_get(win);
2286 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2292 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2295 ELM_CHECK_WIDTYPE(obj, widtype);
2296 win = elm_widget_data_get(obj);
2298 #ifdef HAVE_ELEMENTARY_X
2299 _elm_win_xwindow_get(win);
2304 Ecore_X_Window_State states[2];
2306 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2307 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2308 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2309 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2316 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2319 ELM_CHECK_WIDTYPE(obj, widtype);
2320 win = elm_widget_data_get(obj);
2322 #ifdef HAVE_ELEMENTARY_X
2323 _elm_win_xwindow_get(win);
2328 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2329 ecore_x_e_illume_focus_back_send(win->xwin);
2331 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2332 ecore_x_e_illume_focus_forward_send(win->xwin);
2334 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2335 ecore_x_e_illume_focus_home_send(win->xwin);
2337 case ELM_ILLUME_COMMAND_CLOSE:
2338 ecore_x_e_illume_close_send(win->xwin);
2348 elm_win_inlined_image_object_get(Evas_Object *obj)
2351 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2352 win = elm_widget_data_get(obj);
2353 if (!win) return NULL;
2354 return win->img_obj;
2358 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2362 ELM_CHECK_WIDTYPE(obj, widtype);
2364 win = elm_widget_data_get(obj);
2365 enabled = !!enabled;
2366 if (win->focus_highlight.enabled == enabled)
2369 win->focus_highlight.enabled = enabled;
2371 if (win->focus_highlight.enabled)
2372 _elm_win_focus_highlight_init(win);
2374 _elm_win_focus_highlight_shutdown(win);
2378 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2382 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2384 win = elm_widget_data_get(obj);
2385 return win->focus_highlight.enabled;
2389 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2393 ELM_CHECK_WIDTYPE(obj, widtype);
2395 win = elm_widget_data_get(obj);
2396 eina_stringshare_replace(&win->focus_highlight.style, style);
2397 win->focus_highlight.changed_theme = EINA_TRUE;
2398 _elm_win_focus_highlight_reconfigure_job_start(win);
2402 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2406 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2408 win = elm_widget_data_get(obj);
2409 return win->focus_highlight.style;
2412 typedef struct _Widget_Data Widget_Data;
2417 Evas_Object *content;
2420 static void _del_hook(Evas_Object *obj);
2421 static void _theme_hook(Evas_Object *obj);
2422 static void _sizing_eval(Evas_Object *obj);
2423 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2424 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2426 static const char *widtype2 = NULL;
2429 _del_hook(Evas_Object *obj)
2431 Widget_Data *wd = elm_widget_data_get(obj);
2437 _theme_hook(Evas_Object *obj)
2439 Widget_Data *wd = elm_widget_data_get(obj);
2440 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2442 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2445 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2449 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2451 Widget_Data *wd = elm_widget_data_get(obj);
2456 /* Try Focus cycle in subitem */
2459 elm_widget_focus_next_get(wd->content, dir, next);
2464 *next = (Evas_Object *)obj;
2469 _sizing_eval(Evas_Object *obj)
2471 Widget_Data *wd = elm_widget_data_get(obj);
2472 Evas_Coord minw = -1, minh = -1;
2474 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2475 edje_object_size_min_calc(wd->frm, &minw, &minh);
2476 evas_object_size_hint_min_set(obj, minw, minh);
2477 evas_object_size_hint_max_set(obj, -1, -1);
2481 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2487 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2489 Widget_Data *wd = elm_widget_data_get(obj);
2490 Evas_Object *sub = event_info;
2491 if (sub == wd->content)
2493 evas_object_event_callback_del_full
2494 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2501 elm_win_inwin_add(Evas_Object *obj)
2507 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2508 win = elm_widget_data_get(obj);
2509 if (!win) return NULL;
2510 wd = ELM_NEW(Widget_Data);
2511 obj2 = elm_widget_add(win->evas);
2512 elm_widget_type_set(obj2, "inwin");
2513 ELM_SET_WIDTYPE(widtype2, "inwin");
2514 elm_widget_sub_object_add(obj, obj2);
2515 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2516 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2517 elm_win_resize_object_add(obj, obj2);
2519 elm_widget_data_set(obj2, wd);
2520 elm_widget_del_hook_set(obj2, _del_hook);
2521 elm_widget_theme_hook_set(obj2, _theme_hook);
2522 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2523 elm_widget_can_focus_set(obj2, EINA_TRUE);
2524 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2526 wd->frm = edje_object_add(win->evas);
2527 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2528 elm_widget_resize_object_set(obj2, wd->frm);
2530 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2537 elm_win_inwin_activate(Evas_Object *obj)
2539 ELM_CHECK_WIDTYPE(obj, widtype2);
2540 Widget_Data *wd = elm_widget_data_get(obj);
2542 evas_object_raise(obj);
2543 evas_object_show(obj);
2544 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2545 elm_object_focus_set(obj, EINA_TRUE);
2549 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2551 ELM_CHECK_WIDTYPE(obj, widtype2);
2552 Widget_Data *wd = elm_widget_data_get(obj);
2554 if (wd->content == content) return;
2555 if (wd->content) evas_object_del(wd->content);
2556 wd->content = content;
2559 elm_widget_sub_object_add(obj, content);
2560 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2561 _changed_size_hints, obj);
2562 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2568 elm_win_inwin_content_get(const Evas_Object *obj)
2570 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2571 Widget_Data *wd = elm_widget_data_get(obj);
2572 if (!wd) return NULL;
2577 elm_win_inwin_content_unset(Evas_Object *obj)
2579 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2580 Widget_Data *wd = elm_widget_data_get(obj);
2581 if (!wd) return NULL;
2582 if (!wd->content) return NULL;
2583 Evas_Object *content = wd->content;
2584 elm_widget_sub_object_del(obj, wd->content);
2585 edje_object_part_unswallow(wd->frm, wd->content);
2590 /* windowing spcific calls - shall we do this differently? */
2592 static Ecore_X_Window
2593 _elm_ee_win_get(const Evas_Object *obj)
2596 #ifdef HAVE_ELEMENTARY_X
2597 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2598 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2604 elm_win_xwindow_get(const Evas_Object *obj)
2610 type = elm_widget_type_get(obj);
2611 if (!type) return 0;
2612 if (type != widtype) return _elm_ee_win_get(obj);
2613 #ifdef HAVE_ELEMENTARY_X
2614 win = elm_widget_data_get(obj);
2616 if (win->xwin) return win->xwin;
2617 if (win->parent) return elm_win_xwindow_get(win->parent);