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);
157 if (!win->shot.repeat_count) return strdup("out.png");
160 repname = malloc(sizeof(char) * 24);
161 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
167 _shot_repeat_count_get(Elm_Win *win)
171 char *d = strdup(win->shot.info);
174 for (p = (char *)win->shot.info; *p; p++)
176 if (!strncmp(p, "repeat=", 7))
180 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
187 if (v > 1000) v = 999;
197 _shot_key_get(Elm_Win *win __UNUSED__)
203 _shot_flags_get(Elm_Win *win __UNUSED__)
209 _shot_do(Elm_Win *win)
213 unsigned int *pixels;
215 char *file, *key, *flags;
217 ecore_evas_manual_render(win->ee);
218 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
220 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
221 if ((w < 1) || (h < 1)) return;
222 file = _shot_file_get(win);
224 key = _shot_key_get(win);
225 flags = _shot_flags_get(win);
226 ee = ecore_evas_buffer_new(1, 1);
227 o = evas_object_image_add(ecore_evas_get(ee));
228 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
229 evas_object_image_size_set(o, w, h);
230 evas_object_image_data_set(o, pixels);
231 if (!evas_object_image_save(o, file, key, flags))
233 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
238 if (flags) free(flags);
240 if (win->shot.repeat_count) win->shot.shot_counter++;
244 _shot_delay(void *data)
248 if (win->shot.repeat_count)
250 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
251 if (remainshot > 0) return EINA_TRUE;
253 win->shot.timer = NULL;
259 _shot_init(Elm_Win *win)
261 if (!win->shot.info) return;
262 win->shot.repeat_count = _shot_repeat_count_get(win);
263 win->shot.shot_counter = 0;
267 _shot_handle(Elm_Win *win)
269 if (!win->shot.info) return;
270 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
274 _elm_win_move(Ecore_Evas *ee)
276 Evas_Object *obj = ecore_evas_object_associate_get(ee);
281 win = elm_widget_data_get(obj);
283 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
286 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
290 _elm_win_resize(Ecore_Evas *ee)
292 Evas_Object *obj = ecore_evas_object_associate_get(ee);
296 win = elm_widget_data_get(obj);
298 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
299 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
303 _elm_win_focus_in(Ecore_Evas *ee)
305 Evas_Object *obj = ecore_evas_object_associate_get(ee);
309 win = elm_widget_data_get(obj);
311 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
312 if (win->show_count == 1)
314 elm_object_focus_set(win->win_obj, EINA_TRUE);
318 elm_widget_focus_restore(win->win_obj);
319 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
320 win->focus_highlight.cur.visible = EINA_TRUE;
321 _elm_win_focus_highlight_reconfigure_job_start(win);
325 else if (win->img_obj)
332 _elm_win_focus_out(Ecore_Evas *ee)
334 Evas_Object *obj = ecore_evas_object_associate_get(ee);
338 win = elm_widget_data_get(obj);
340 elm_object_focus_set(win->win_obj, EINA_FALSE);
341 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
342 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
343 win->focus_highlight.cur.visible = EINA_FALSE;
344 _elm_win_focus_highlight_reconfigure_job_start(win);
348 else if (win->img_obj)
355 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
357 Elm_Win *wd = elm_widget_data_get(obj);
358 const Eina_List *items;
359 void *(*list_data_get) (const Eina_List *list);
367 if (!(items = elm_widget_focus_custom_chain_get(obj)))
373 list_data_get = eina_list_data_get;
375 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
381 *next = (Evas_Object *)obj;
386 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
388 Elm_Win *win = elm_widget_data_get(obj);
392 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
394 evas_object_focus_set(obj, elm_widget_focus_get(obj));
398 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
400 if (type == EVAS_CALLBACK_KEY_DOWN)
402 Evas_Event_Key_Down *ev = event_info;
403 if (!strcmp(ev->keyname, "Tab"))
405 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
406 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
408 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
409 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
412 else if ((!strcmp(ev->keyname, "Left")) ||
413 (!strcmp(ev->keyname, "KP_Left")))
415 //TODO : woohyun jung
417 else if ((!strcmp(ev->keyname, "Right")) ||
418 (!strcmp(ev->keyname, "KP_Right")))
420 //TODO : woohyun jung
422 else if ((!strcmp(ev->keyname, "Up")) ||
423 (!strcmp(ev->keyname, "KP_Up")))
425 //TODO : woohyun jung
427 else if ((!strcmp(ev->keyname, "Down")) ||
428 (!strcmp(ev->keyname, "KP_Down")))
430 //TODO : woohyun jung
438 _deferred_ecore_evas_free(void *data)
440 ecore_evas_free(data);
441 _elm_win_deferred_free--;
445 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
449 if (!win->show_count) win->show_count++;
450 if (win->shot.info) _shot_handle(win);
454 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
461 else if (win->img_obj)
463 evas_object_hide(win->img_obj);
468 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
475 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
476 _elm_win_obj_callback_parent_del, win);
479 if (win->autodel_clear) *(win->autodel_clear) = -1;
480 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
481 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
484 ecore_evas_callback_delete_request_set(win->ee, NULL);
485 ecore_evas_callback_resize_set(win->ee, NULL);
487 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
488 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
489 if (win->shot.info) eina_stringshare_del(win->shot.info);
490 if (win->shot.timer) ecore_timer_del(win->shot.timer);
491 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
492 _elm_win_obj_callback_del, win);
493 while (((child = evas_object_bottom_get(win->evas))) &&
496 evas_object_del(child);
498 while (((child = evas_object_top_get(win->evas))) &&
501 evas_object_del(child);
503 #ifdef HAVE_ELEMENTARY_X
504 if (win->client_message_handler)
505 ecore_event_handler_del(win->client_message_handler);
507 // FIXME: Why are we flushing edje on every window destroy ??
508 // edje_file_cache_flush();
509 // edje_collection_cache_flush();
510 // evas_image_cache_flush(win->evas);
511 // evas_font_cache_flush(win->evas);
512 // FIXME: we are in the del handler for the object and delete the canvas
513 // that lives under it from the handler... nasty. deferring doesn't help either
523 ecore_job_add(_deferred_ecore_evas_free, win->ee);
524 _elm_win_deferred_free++;
528 _elm_win_focus_highlight_shutdown(win);
529 eina_stringshare_del(win->focus_highlight.style);
533 if ((!_elm_win_list) &&
534 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
536 edje_file_cache_flush();
537 edje_collection_cache_flush();
538 evas_image_cache_flush(e);
539 evas_font_cache_flush(e);
545 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
548 if (!win->img_obj) return;
549 evas_object_event_callback_del_full
550 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
551 evas_object_del(win->img_obj);
555 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
558 if (obj == win->parent) win->parent = NULL;
562 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
568 if ((x != win->screen.x) || (y != win->screen.y))
572 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
577 evas_object_move(obj, x, y);
582 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
585 // this is called to make sure all smart containers have calculated their
586 // sizes BEFORE we show the window to make sure it initially appears at
587 // our desired size (ie min size is known first)
588 evas_smart_objects_calculate(evas_object_evas_get(obj));
589 evas_object_show(obj);
593 else if (win->img_obj)
595 evas_object_show(win->img_obj);
600 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
604 if (ecore_evas_override_get(win->ee))
608 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
611 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
616 else if (win->img_obj)
620 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
623 // evas_object_move(win->img_obj, x, y);
628 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
635 else if (win->img_obj)
637 Evas_Coord w = 1, h = 1;
639 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
642 evas_object_image_size_set(win->img_obj, w, h);
647 _elm_win_delete_request(Ecore_Evas *ee)
649 Evas_Object *obj = ecore_evas_object_associate_get(ee);
651 if (strcmp(elm_widget_type_get(obj), "win")) return;
653 win = elm_widget_data_get(obj);
655 int autodel = win->autodel;
656 win->autodel_clear = &autodel;
657 evas_object_ref(win->win_obj);
658 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
659 // FIXME: if above callback deletes - then the below will be invalid
660 if (autodel) evas_object_del(win->win_obj);
661 else win->autodel_clear = NULL;
662 evas_object_unref(win->win_obj);
666 _elm_win_resize_job(void *data)
673 win->deferred_resize_job = NULL;
674 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
675 evas_object_resize(win->win_obj, w, h);
679 else if (win->img_obj)
682 EINA_LIST_FOREACH(win->subobjs, l, obj)
684 evas_object_move(obj, 0, 0);
685 evas_object_resize(obj, w, h);
689 #ifdef HAVE_ELEMENTARY_X
691 _elm_win_xwindow_get(Elm_Win *win)
695 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
696 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
698 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
700 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
701 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
702 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
703 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
704 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
705 ENGINE_COMPARE(ELM_OPENGL_SDL))
708 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
710 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
712 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
714 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
717 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
719 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
722 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
724 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
726 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
728 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
730 #undef ENGINE_COMPARE
734 #ifdef HAVE_ELEMENTARY_X
736 _elm_win_xwin_update(Elm_Win *win)
738 _elm_win_xwindow_get(win);
743 win2 = elm_widget_data_get(win->parent);
747 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
751 if (!win->xwin) return; /* nothing more to do */
756 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
758 case ELM_WIN_DIALOG_BASIC:
759 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
761 case ELM_WIN_DESKTOP:
762 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
765 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
767 case ELM_WIN_TOOLBAR:
768 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
771 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
773 case ELM_WIN_UTILITY:
774 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
777 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
779 case ELM_WIN_DROPDOWN_MENU:
780 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
782 case ELM_WIN_POPUP_MENU:
783 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
785 case ELM_WIN_TOOLTIP:
786 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
788 case ELM_WIN_NOTIFICATION:
789 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
792 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
795 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
800 ecore_x_e_virtual_keyboard_state_set
801 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
806 _elm_win_eval_subobjs(Evas_Object *obj)
809 const Evas_Object *child;
811 Elm_Win *win = elm_widget_data_get(obj);
812 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
816 EINA_LIST_FOREACH(win->subobjs, l, child)
818 evas_object_size_hint_weight_get(child, &wx, &wy);
819 if (wx == 0.0) xx = 0;
820 if (wy == 0.0) xy = 0;
822 evas_object_size_hint_min_get(child, &w, &h);
825 if (w > minw) minw = w;
826 if (h > minh) minh = h;
828 evas_object_size_hint_max_get(child, &w, &h);
831 if (maxw == -1) maxw = w;
832 else if ((w > 0) && (w < maxw)) maxw = w;
833 if (maxh == -1) maxh = h;
834 else if ((h > 0) && (h < maxh)) maxh = h;
836 if (!xx) maxw = minw;
838 if (!xy) maxh = minh;
840 evas_object_size_hint_min_set(obj, minw, minh);
841 evas_object_size_hint_max_set(obj, maxw, maxh);
842 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
843 if (w < minw) w = minw;
844 if (h < minh) h = minh;
845 if ((maxw >= 0) && (w > maxw)) w = maxw;
846 if ((maxh >= 0) && (h > maxh)) h = maxh;
847 evas_object_resize(obj, w, h);
851 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
853 Elm_Win *win = elm_widget_data_get(data);
854 win->subobjs = eina_list_remove(win->subobjs, obj);
855 _elm_win_eval_subobjs(win->win_obj);
859 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
861 _elm_win_eval_subobjs(data);
865 _elm_win_shutdown(void)
867 while (_elm_win_list)
868 evas_object_del(_elm_win_list->data);
872 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
879 EINA_LIST_FOREACH(_elm_win_list, l, obj)
880 elm_widget_theme(obj);
884 EINA_LIST_FOREACH(_elm_win_list, l, obj)
885 elm_widget_theme_specific(obj, th, EINA_FALSE);
889 #ifdef HAVE_ELEMENTARY_X
891 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
894 Ecore_X_Event_Client_Message *e = event;
896 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
897 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
899 if ((unsigned)e->data.l[0] == win->xwin)
901 Evas *evas = evas_object_evas_get(win->win_obj);
904 edje_file_cache_flush();
905 edje_collection_cache_flush();
906 evas_image_cache_flush(evas);
907 evas_font_cache_flush(evas);
911 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
913 if ((unsigned)e->data.l[0] == win->xwin)
915 Evas *evas = evas_object_evas_get(win->win_obj);
918 edje_file_cache_flush();
919 edje_collection_cache_flush();
920 evas_image_cache_flush(evas);
921 evas_font_cache_flush(evas);
922 evas_render_dump(evas);
926 return ECORE_CALLBACK_PASS_ON;
931 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
935 win->focus_highlight.geometry_changed = EINA_TRUE;
936 _elm_win_focus_highlight_reconfigure_job_start(win);
940 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
944 win->focus_highlight.geometry_changed = EINA_TRUE;
945 _elm_win_focus_highlight_reconfigure_job_start(win);
949 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
953 win->focus_highlight.cur.target = NULL;
955 _elm_win_focus_highlight_reconfigure_job_start(win);
959 _elm_win_focus_target_callbacks_add(Elm_Win *win)
961 Evas_Object *obj = win->focus_highlight.cur.target;
963 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
964 _elm_win_focus_target_move, win);
965 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
966 _elm_win_focus_target_resize, win);
967 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
968 _elm_win_focus_target_del, win);
972 _elm_win_focus_target_callbacks_del(Elm_Win *win)
974 Evas_Object *obj = win->focus_highlight.cur.target;
976 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
977 _elm_win_focus_target_move, win);
978 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
979 _elm_win_focus_target_resize, win);
980 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
981 _elm_win_focus_target_del, win);
985 _elm_win_focus_target_get(Evas_Object *obj)
987 Evas_Object *o = obj;
991 if (elm_widget_is(o))
993 if (!elm_widget_highlight_ignore_get(o))
995 o = elm_widget_parent_get(o);
997 o = evas_object_smart_parent_get(o);
1001 o = elm_widget_parent_widget_get(o);
1003 o = evas_object_smart_parent_get(o);
1012 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1014 Evas_Object *obj = event_info, *target;
1015 Elm_Win *win = data;
1017 if (win->focus_highlight.cur.target == obj)
1020 target = _elm_win_focus_target_get(obj);
1021 win->focus_highlight.cur.target = target;
1022 if (elm_widget_highlight_in_theme_get(target))
1023 win->focus_highlight.cur.handled = EINA_TRUE;
1025 _elm_win_focus_target_callbacks_add(win);
1027 _elm_win_focus_highlight_reconfigure_job_start(win);
1031 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1033 Elm_Win *win = data;
1035 if (!win->focus_highlight.cur.target)
1038 if (!win->focus_highlight.cur.handled)
1039 _elm_win_focus_target_callbacks_del(win);
1040 win->focus_highlight.cur.target = NULL;
1041 win->focus_highlight.cur.handled = EINA_FALSE;
1043 _elm_win_focus_highlight_reconfigure_job_start(win);
1047 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1049 evas_object_hide(obj);
1053 _elm_win_focus_highlight_init(Elm_Win *win)
1055 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1056 _elm_win_object_focus_in, win);
1057 evas_event_callback_add(win->evas,
1058 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1059 _elm_win_object_focus_out, win);
1061 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1063 win->focus_highlight.top = edje_object_add(win->evas);
1064 win->focus_highlight.changed_theme = EINA_TRUE;
1065 edje_object_signal_callback_add(win->focus_highlight.top,
1066 "elm,action,focus,hide,end", "",
1067 _elm_win_focus_highlight_hide, NULL);
1068 edje_object_signal_callback_add(win->focus_highlight.top,
1069 "elm,action,focus,anim,end", "",
1070 _elm_win_focus_highlight_anim_end, win);
1071 _elm_win_focus_highlight_reconfigure_job_start(win);
1075 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1077 _elm_win_focus_highlight_reconfigure_job_stop(win);
1078 if (win->focus_highlight.cur.target)
1080 _elm_win_focus_target_callbacks_del(win);
1081 win->focus_highlight.cur.target = NULL;
1083 if (win->focus_highlight.top)
1085 evas_object_del(win->focus_highlight.top);
1086 win->focus_highlight.top = NULL;
1089 evas_event_callback_del_full(win->evas,
1090 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1091 _elm_win_object_focus_in, win);
1092 evas_event_callback_del_full(win->evas,
1093 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1094 _elm_win_object_focus_out, win);
1098 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1102 top = win->focus_highlight.top;
1107 evas_object_show(top);
1108 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1114 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1119 _elm_win_focus_highlight_reconfigure_job(void *data)
1121 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1125 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1127 if (win->focus_highlight.reconf_job)
1128 ecore_job_del(win->focus_highlight.reconf_job);
1129 win->focus_highlight.reconf_job = ecore_job_add(
1130 _elm_win_focus_highlight_reconfigure_job, win);
1134 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1136 if (win->focus_highlight.reconf_job)
1137 ecore_job_del(win->focus_highlight.reconf_job);
1138 win->focus_highlight.reconf_job = NULL;
1142 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1144 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1145 Evas_Coord x, y, w, h;
1147 clip = evas_object_clip_get(target);
1148 evas_object_geometry_get(target, &x, &y, &w, &h);
1150 evas_object_move(obj, x, y);
1151 evas_object_resize(obj, w, h);
1152 evas_object_clip_set(obj, clip);
1156 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1158 Evas_Coord tx, ty, tw, th;
1159 Evas_Coord w, h, px, py, pw, ph;
1160 Edje_Message_Int_Set *m;
1161 Evas_Object *previous = win->focus_highlight.prev.target;
1162 Evas_Object *target = win->focus_highlight.cur.target;
1164 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1165 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1166 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1167 evas_object_move(obj, 0, 0);
1168 evas_object_resize(obj, tw, th);
1169 evas_object_clip_unset(obj);
1171 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1181 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1185 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1187 Elm_Win *win = data;
1188 _elm_win_focus_highlight_simple_setup(win, obj);
1192 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1194 Evas_Object *target = win->focus_highlight.cur.target;
1195 Evas_Object *previous = win->focus_highlight.prev.target;
1196 Evas_Object *top = win->focus_highlight.top;
1197 Eina_Bool visible_changed;
1198 Eina_Bool common_visible;
1199 const char *sig = NULL;
1201 _elm_win_focus_highlight_reconfigure_job_stop(win);
1203 visible_changed = (win->focus_highlight.cur.visible !=
1204 win->focus_highlight.prev.visible);
1206 if ((target == previous) && (!visible_changed) &&
1207 (!win->focus_highlight.geometry_changed))
1210 if ((previous) && (win->focus_highlight.prev.handled))
1211 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1214 common_visible = EINA_FALSE;
1215 else if (win->focus_highlight.cur.handled)
1217 common_visible = EINA_FALSE;
1218 if (win->focus_highlight.cur.visible)
1219 sig = "elm,action,focus_highlight,show";
1221 sig = "elm,action,focus_highlight,hide";
1224 common_visible = win->focus_highlight.cur.visible;
1226 _elm_win_focus_highlight_visible_set(win, common_visible);
1228 elm_widget_signal_emit(target, sig, "elm");
1230 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1233 if (win->focus_highlight.changed_theme)
1236 if (win->focus_highlight.style)
1237 str = win->focus_highlight.style;
1240 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1242 win->focus_highlight.changed_theme = EINA_FALSE;
1244 if (_elm_config->focus_highlight_animate)
1246 str = edje_object_data_get(win->focus_highlight.top, "animate");
1247 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1251 if ((win->focus_highlight.top_animate) && (previous) &&
1252 (!win->focus_highlight.prev.handled))
1253 _elm_win_focus_highlight_anim_setup(win, top);
1255 _elm_win_focus_highlight_simple_setup(win, top);
1256 evas_object_raise(top);
1259 win->focus_highlight.geometry_changed = EINA_FALSE;
1260 win->focus_highlight.prev = win->focus_highlight.cur;
1265 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1267 Evas_Event_Key_Down *ev = event_info;
1269 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1273 if ((strcmp(ev->keyname, "F12")) ||
1274 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1277 printf("Tree graph generated.\n");
1278 elm_object_tree_dot_dump(obj, "./dump.dot");
1283 _win_img_hide(void *data,
1285 Evas_Object *obj __UNUSED__,
1286 void *event_info __UNUSED__)
1288 Elm_Win *win = data;
1290 elm_widget_focus_hide_handle(win->win_obj);
1294 _win_img_mouse_up(void *data,
1296 Evas_Object *obj __UNUSED__,
1299 Elm_Win *win = data;
1300 Evas_Event_Mouse_Up *ev = event_info;
1301 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1302 elm_widget_focus_mouse_up_handle(win->win_obj);
1306 _win_img_focus_in(void *data,
1308 Evas_Object *obj __UNUSED__,
1309 void *event_info __UNUSED__)
1311 Elm_Win *win = data;
1312 elm_widget_focus_steal(win->win_obj);
1316 _win_img_focus_out(void *data,
1318 Evas_Object *obj __UNUSED__,
1319 void *event_info __UNUSED__)
1321 Elm_Win *win = data;
1322 elm_widget_focused_object_clear(win->win_obj);
1326 _win_inlined_image_set(Elm_Win *win)
1328 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1329 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1330 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1331 _elm_win_obj_callback_img_obj_del, win);
1333 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1334 _win_img_hide, win);
1335 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1336 _win_img_mouse_up, win);
1337 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1338 _win_img_focus_in, win);
1339 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1340 _win_img_focus_out, win);
1344 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1348 const char *fontpath;
1350 win = ELM_NEW(Elm_Win);
1352 #define FALLBACK_TRY(engine) \
1355 CRITICAL(engine " engine creation failed. Trying software X11."); \
1356 elm_engine_set(ELM_SOFTWARE_X11); \
1357 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1359 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1363 case ELM_WIN_INLINED_IMAGE:
1366 Evas *e = evas_object_evas_get(parent);
1369 ee = ecore_evas_ecore_evas_get(e);
1371 win->img_obj = ecore_evas_object_image_new(ee);
1372 if (!win->img_obj) break;
1373 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1376 _win_inlined_image_set(win);
1379 evas_object_del(win->img_obj);
1380 win->img_obj = NULL;
1384 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1386 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1387 #ifdef HAVE_ELEMENTARY_X
1388 win->client_message_handler = ecore_event_handler_add
1389 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1392 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1394 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1395 FALLBACK_TRY("Sofware FB");
1397 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1399 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1400 FALLBACK_TRY("Sofware DirectFB");
1402 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1404 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1405 FALLBACK_TRY("Sofware-16");
1406 #ifdef HAVE_ELEMENTARY_X
1407 win->client_message_handler = ecore_event_handler_add
1408 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1411 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1413 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1414 FALLBACK_TRY("Sofware-8");
1415 #ifdef HAVE_ELEMENTARY_X
1416 win->client_message_handler = ecore_event_handler_add
1417 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1421 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1423 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1424 FALLBACK_TRY("XRender");
1425 #ifdef HAVE_ELEMENTARY_X
1426 win->client_message_handler = ecore_event_handler_add
1427 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1431 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1436 if (_elm_config->vsync)
1438 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1444 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1446 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1447 FALLBACK_TRY("OpenGL");
1448 #ifdef HAVE_ELEMENTARY_X
1449 win->client_message_handler = ecore_event_handler_add
1450 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1453 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1455 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1456 FALLBACK_TRY("Sofware Win32");
1458 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1460 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1461 FALLBACK_TRY("Sofware-16-WinCE");
1463 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1465 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1466 FALLBACK_TRY("Sofware SDL");
1468 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1470 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1471 FALLBACK_TRY("Sofware-16-SDL");
1473 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1475 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1476 FALLBACK_TRY("OpenGL SDL");
1478 else if (ENGINE_COMPARE(ELM_BUFFER))
1480 win->ee = ecore_evas_buffer_new(1, 1);
1482 else if (!strncmp(_elm_config->engine, "shot:", 5))
1484 win->ee = ecore_evas_buffer_new(1, 1);
1485 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1486 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1495 ERR("Cannot create window.");
1499 #ifdef HAVE_ELEMENTARY_X
1500 _elm_win_xwindow_get(win);
1502 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1503 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1504 // bg pixmap done by x - has other issues like can be redrawn by x before it
1505 // is filled/ready by app
1506 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1509 win->parent = parent;
1511 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1512 _elm_win_obj_callback_parent_del, win);
1514 win->evas = ecore_evas_get(win->ee);
1515 win->win_obj = elm_widget_add(win->evas);
1516 elm_widget_type_set(win->win_obj, "win");
1517 ELM_SET_WIDTYPE(widtype, "win");
1518 elm_widget_data_set(win->win_obj, win);
1519 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1520 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1521 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1522 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1523 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1524 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1525 evas_object_move(win->win_obj, 0, 0);
1526 evas_object_resize(win->win_obj, 1, 1);
1527 evas_object_layer_set(win->win_obj, 50);
1528 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1530 if (type == ELM_WIN_INLINED_IMAGE)
1531 elm_widget_parent2_set(win->win_obj, parent);
1532 ecore_evas_object_associate(win->ee, win->win_obj,
1533 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1534 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1535 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1536 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1537 _elm_win_obj_callback_show, win);
1538 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1539 _elm_win_obj_callback_hide, win);
1540 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1541 _elm_win_obj_callback_del, win);
1542 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1543 _elm_win_obj_callback_move, win);
1544 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1545 _elm_win_obj_callback_resize, win);
1547 evas_object_intercept_move_callback_add(win->win_obj,
1548 _elm_win_obj_intercept_move, win);
1549 evas_object_intercept_show_callback_add(win->win_obj,
1550 _elm_win_obj_intercept_show, win);
1552 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1553 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1554 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1555 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1556 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1557 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1558 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1559 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1560 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1561 evas_font_path_append(win->evas, fontpath);
1562 if (!_elm_config->font_hinting)
1563 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1564 else if (_elm_config->font_hinting == 1)
1565 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1566 else if (_elm_config->font_hinting == 2)
1567 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1569 #ifdef HAVE_ELEMENTARY_X
1570 _elm_win_xwin_update(win);
1573 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1575 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1577 ecore_evas_fullscreen_set(win->ee, 1);
1579 #undef ENGINE_COMPARE
1581 if (_elm_config->focus_highlight_enable)
1582 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1585 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1586 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1587 _debug_key_down, win);
1589 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1591 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1594 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1596 return win->win_obj;
1600 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1604 ELM_CHECK_WIDTYPE(obj, widtype);
1605 win = elm_widget_data_get(obj);
1607 if (eina_list_data_find(win->subobjs, subobj)) return;
1608 win->subobjs = eina_list_append(win->subobjs, subobj);
1609 elm_widget_sub_object_add(obj, subobj);
1610 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1611 _elm_win_subobj_callback_del, obj);
1612 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1613 _elm_win_subobj_callback_changed_size_hints,
1615 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1616 evas_object_move(subobj, 0, 0);
1617 evas_object_resize(subobj, w, h);
1618 _elm_win_eval_subobjs(obj);
1622 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1625 ELM_CHECK_WIDTYPE(obj, widtype);
1626 win = elm_widget_data_get(obj);
1628 evas_object_event_callback_del_full(subobj,
1629 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1630 _elm_win_subobj_callback_changed_size_hints,
1632 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1633 _elm_win_subobj_callback_del, obj);
1634 win->subobjs = eina_list_remove(win->subobjs, subobj);
1635 elm_widget_sub_object_del(obj, subobj);
1636 _elm_win_eval_subobjs(obj);
1640 elm_win_title_set(Evas_Object *obj, const char *title)
1643 ELM_CHECK_WIDTYPE(obj, widtype);
1644 win = elm_widget_data_get(obj);
1646 ecore_evas_title_set(win->ee, title);
1650 elm_win_title_get(const Evas_Object *obj)
1653 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1654 win = elm_widget_data_get(obj);
1655 if (!win) return NULL;
1656 return ecore_evas_title_get(win->ee);
1660 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1663 ELM_CHECK_WIDTYPE(obj, widtype);
1664 win = elm_widget_data_get(obj);
1666 win->autodel = autodel;
1670 elm_win_autodel_get(const Evas_Object *obj)
1673 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1674 win = elm_widget_data_get(obj);
1675 if (!win) return EINA_FALSE;
1676 return win->autodel;
1680 elm_win_activate(Evas_Object *obj)
1683 ELM_CHECK_WIDTYPE(obj, widtype);
1684 win = elm_widget_data_get(obj);
1686 ecore_evas_activate(win->ee);
1690 elm_win_lower(Evas_Object *obj)
1693 ELM_CHECK_WIDTYPE(obj, widtype);
1694 win = elm_widget_data_get(obj);
1696 ecore_evas_lower(win->ee);
1700 elm_win_raise(Evas_Object *obj)
1703 ELM_CHECK_WIDTYPE(obj, widtype);
1704 win = elm_widget_data_get(obj);
1706 ecore_evas_raise(win->ee);
1710 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1713 ELM_CHECK_WIDTYPE(obj, widtype);
1714 win = elm_widget_data_get(obj);
1716 ecore_evas_borderless_set(win->ee, borderless);
1717 #ifdef HAVE_ELEMENTARY_X
1718 _elm_win_xwin_update(win);
1723 elm_win_borderless_get(const Evas_Object *obj)
1726 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1727 win = elm_widget_data_get(obj);
1728 if (!win) return EINA_FALSE;
1729 return ecore_evas_borderless_get(win->ee);
1733 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1736 ELM_CHECK_WIDTYPE(obj, widtype);
1737 win = elm_widget_data_get(obj);
1739 ecore_evas_shaped_set(win->ee, shaped);
1740 #ifdef HAVE_ELEMENTARY_X
1741 _elm_win_xwin_update(win);
1746 elm_win_shaped_get(const Evas_Object *obj)
1749 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1750 win = elm_widget_data_get(obj);
1751 if (!win) return EINA_FALSE;
1752 return ecore_evas_shaped_get(win->ee);
1756 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1759 ELM_CHECK_WIDTYPE(obj, widtype);
1760 win = elm_widget_data_get(obj);
1765 else if (win->img_obj)
1767 evas_object_image_alpha_set(win->img_obj, alpha);
1771 #ifdef HAVE_ELEMENTARY_X
1776 if (!_elm_config->compositing)
1777 elm_win_shaped_set(obj, alpha);
1779 ecore_evas_alpha_set(win->ee, alpha);
1782 ecore_evas_alpha_set(win->ee, alpha);
1783 _elm_win_xwin_update(win);
1787 ecore_evas_alpha_set(win->ee, alpha);
1792 elm_win_alpha_get(const Evas_Object *obj)
1795 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1796 win = elm_widget_data_get(obj);
1797 if (!win) return EINA_FALSE;
1798 return ecore_evas_alpha_get(win->ee);
1802 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1805 ELM_CHECK_WIDTYPE(obj, widtype);
1806 win = elm_widget_data_get(obj);
1812 else if (win->img_obj)
1814 evas_object_image_alpha_set(win->img_obj, transparent);
1818 #ifdef HAVE_ELEMENTARY_X
1821 ecore_evas_transparent_set(win->ee, transparent);
1822 _elm_win_xwin_update(win);
1826 ecore_evas_transparent_set(win->ee, transparent);
1831 elm_win_transparent_get(const Evas_Object *obj)
1834 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1835 win = elm_widget_data_get(obj);
1836 if (!win) return EINA_FALSE;
1838 return ecore_evas_transparent_get(win->ee);
1842 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1845 ELM_CHECK_WIDTYPE(obj, widtype);
1846 win = elm_widget_data_get(obj);
1848 ecore_evas_override_set(win->ee, override);
1849 #ifdef HAVE_ELEMENTARY_X
1850 _elm_win_xwin_update(win);
1855 elm_win_override_get(const Evas_Object *obj)
1858 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1859 win = elm_widget_data_get(obj);
1860 if (!win) return EINA_FALSE;
1861 return ecore_evas_override_get(win->ee);
1865 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1868 ELM_CHECK_WIDTYPE(obj, widtype);
1869 win = elm_widget_data_get(obj);
1872 // YYY: handle if win->img_obj
1873 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1874 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1875 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1877 // these engines... can ONLY be fullscreen
1882 ecore_evas_fullscreen_set(win->ee, fullscreen);
1883 #ifdef HAVE_ELEMENTARY_X
1884 _elm_win_xwin_update(win);
1887 #undef ENGINE_COMPARE
1891 elm_win_fullscreen_get(const Evas_Object *obj)
1894 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1895 win = elm_widget_data_get(obj);
1896 if (!win) return EINA_FALSE;
1898 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1899 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1900 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1902 // these engines... can ONLY be fullscreen
1907 return ecore_evas_fullscreen_get(win->ee);
1909 #undef ENGINE_COMPARE
1913 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1916 ELM_CHECK_WIDTYPE(obj, widtype);
1917 win = elm_widget_data_get(obj);
1919 // YYY: handle if win->img_obj
1920 ecore_evas_maximized_set(win->ee, maximized);
1921 #ifdef HAVE_ELEMENTARY_X
1922 _elm_win_xwin_update(win);
1927 elm_win_maximized_get(const Evas_Object *obj)
1930 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1931 win = elm_widget_data_get(obj);
1932 if (!win) return EINA_FALSE;
1933 return ecore_evas_maximized_get(win->ee);
1937 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1940 ELM_CHECK_WIDTYPE(obj, widtype);
1941 win = elm_widget_data_get(obj);
1943 ecore_evas_iconified_set(win->ee, iconified);
1944 #ifdef HAVE_ELEMENTARY_X
1945 _elm_win_xwin_update(win);
1950 elm_win_iconified_get(const Evas_Object *obj)
1953 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1954 win = elm_widget_data_get(obj);
1955 if (!win) return EINA_FALSE;
1956 return ecore_evas_iconified_get(win->ee);
1960 elm_win_layer_set(Evas_Object *obj, int layer)
1963 ELM_CHECK_WIDTYPE(obj, widtype);
1964 win = elm_widget_data_get(obj);
1966 ecore_evas_layer_set(win->ee, layer);
1967 #ifdef HAVE_ELEMENTARY_X
1968 _elm_win_xwin_update(win);
1973 elm_win_layer_get(const Evas_Object *obj)
1976 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1977 win = elm_widget_data_get(obj);
1978 if (!win) return -1;
1979 return ecore_evas_layer_get(win->ee);
1983 elm_win_rotation_set(Evas_Object *obj, int rotation)
1986 ELM_CHECK_WIDTYPE(obj, widtype);
1987 win = elm_widget_data_get(obj);
1989 if (win->rot == rotation) return;
1990 win->rot = rotation;
1991 ecore_evas_rotation_set(win->ee, rotation);
1992 evas_object_size_hint_min_set(obj, -1, -1);
1993 evas_object_size_hint_max_set(obj, -1, -1);
1994 _elm_win_eval_subobjs(obj);
1995 #ifdef HAVE_ELEMENTARY_X
1996 _elm_win_xwin_update(win);
2001 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2004 ELM_CHECK_WIDTYPE(obj, widtype);
2005 win = elm_widget_data_get(obj);
2007 if (win->rot == rotation) return;
2008 win->rot = rotation;
2009 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2010 evas_object_size_hint_min_set(obj, -1, -1);
2011 evas_object_size_hint_max_set(obj, -1, -1);
2012 _elm_win_eval_subobjs(obj);
2013 #ifdef HAVE_ELEMENTARY_X
2014 _elm_win_xwin_update(win);
2019 elm_win_rotation_get(const Evas_Object *obj)
2022 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2023 win = elm_widget_data_get(obj);
2024 if (!win) return -1;
2029 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2032 ELM_CHECK_WIDTYPE(obj, widtype);
2033 win = elm_widget_data_get(obj);
2035 ecore_evas_sticky_set(win->ee, sticky);
2036 #ifdef HAVE_ELEMENTARY_X
2037 _elm_win_xwin_update(win);
2042 elm_win_sticky_get(const Evas_Object *obj)
2045 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2046 win = elm_widget_data_get(obj);
2047 if (!win) return EINA_FALSE;
2048 return ecore_evas_sticky_get(win->ee);
2052 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2055 ELM_CHECK_WIDTYPE(obj, widtype);
2056 win = elm_widget_data_get(obj);
2058 if (mode == win->kbdmode) return;
2059 #ifdef HAVE_ELEMENTARY_X
2060 _elm_win_xwindow_get(win);
2062 win->kbdmode = mode;
2063 #ifdef HAVE_ELEMENTARY_X
2065 ecore_x_e_virtual_keyboard_state_set
2066 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2070 EAPI Elm_Win_Keyboard_Mode
2071 elm_win_keyboard_mode_get(const Evas_Object *obj)
2074 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2075 win = elm_widget_data_get(obj);
2076 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2077 return win->kbdmode;
2081 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2084 ELM_CHECK_WIDTYPE(obj, widtype);
2085 win = elm_widget_data_get(obj);
2087 #ifdef HAVE_ELEMENTARY_X
2088 _elm_win_xwindow_get(win);
2090 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2095 elm_win_keyboard_win_get(const Evas_Object *obj)
2098 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2099 win = elm_widget_data_get(obj);
2100 if (!win) return EINA_FALSE;
2101 #ifdef HAVE_ELEMENTARY_X
2102 _elm_win_xwindow_get(win);
2104 return ecore_x_e_virtual_keyboard_get(win->xwin);
2110 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2113 ELM_CHECK_WIDTYPE(obj, widtype);
2114 win = elm_widget_data_get(obj);
2116 if (x) *x = win->screen.x;
2117 if (y) *y = win->screen.y;
2121 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2124 ELM_CHECK_WIDTYPE(obj, widtype);
2125 win = elm_widget_data_get(obj);
2127 #ifdef HAVE_ELEMENTARY_X
2128 _elm_win_xwindow_get(win);
2130 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2135 elm_win_conformant_get(const Evas_Object *obj)
2138 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2139 win = elm_widget_data_get(obj);
2140 if (!win) return EINA_FALSE;
2141 #ifdef HAVE_ELEMENTARY_X
2142 _elm_win_xwindow_get(win);
2144 return ecore_x_e_illume_conformant_get(win->xwin);
2150 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2153 ELM_CHECK_WIDTYPE(obj, widtype);
2154 win = elm_widget_data_get(obj);
2156 #ifdef HAVE_ELEMENTARY_X
2157 _elm_win_xwindow_get(win);
2160 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2163 Ecore_X_Window_State states[2];
2165 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2166 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2167 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2168 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2175 elm_win_quickpanel_get(const Evas_Object *obj)
2178 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2179 win = elm_widget_data_get(obj);
2180 if (!win) return EINA_FALSE;
2181 #ifdef HAVE_ELEMENTARY_X
2182 _elm_win_xwindow_get(win);
2184 return ecore_x_e_illume_quickpanel_get(win->xwin);
2190 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2193 ELM_CHECK_WIDTYPE(obj, widtype);
2194 win = elm_widget_data_get(obj);
2196 #ifdef HAVE_ELEMENTARY_X
2197 _elm_win_xwindow_get(win);
2199 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2204 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2207 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2208 win = elm_widget_data_get(obj);
2209 if (!win) return -1;
2210 #ifdef HAVE_ELEMENTARY_X
2211 _elm_win_xwindow_get(win);
2213 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2219 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2222 ELM_CHECK_WIDTYPE(obj, widtype);
2223 win = elm_widget_data_get(obj);
2225 #ifdef HAVE_ELEMENTARY_X
2226 _elm_win_xwindow_get(win);
2228 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2233 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2236 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2237 win = elm_widget_data_get(obj);
2238 if (!win) return -1;
2239 #ifdef HAVE_ELEMENTARY_X
2240 _elm_win_xwindow_get(win);
2242 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2248 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2251 ELM_CHECK_WIDTYPE(obj, widtype);
2252 win = elm_widget_data_get(obj);
2254 #ifdef HAVE_ELEMENTARY_X
2255 _elm_win_xwindow_get(win);
2257 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2262 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2265 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2266 win = elm_widget_data_get(obj);
2268 #ifdef HAVE_ELEMENTARY_X
2269 _elm_win_xwindow_get(win);
2271 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2277 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2280 ELM_CHECK_WIDTYPE(obj, widtype);
2281 win = elm_widget_data_get(obj);
2283 #ifdef HAVE_ELEMENTARY_X
2284 _elm_win_xwindow_get(win);
2289 Ecore_X_Window_State states[2];
2291 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2292 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2293 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2294 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2301 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2304 ELM_CHECK_WIDTYPE(obj, widtype);
2305 win = elm_widget_data_get(obj);
2307 #ifdef HAVE_ELEMENTARY_X
2308 _elm_win_xwindow_get(win);
2313 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2314 ecore_x_e_illume_focus_back_send(win->xwin);
2316 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2317 ecore_x_e_illume_focus_forward_send(win->xwin);
2319 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2320 ecore_x_e_illume_focus_home_send(win->xwin);
2322 case ELM_ILLUME_COMMAND_CLOSE:
2323 ecore_x_e_illume_close_send(win->xwin);
2333 elm_win_inlined_image_object_get(Evas_Object *obj)
2336 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2337 win = elm_widget_data_get(obj);
2338 if (!win) return NULL;
2339 return win->img_obj;
2343 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2347 ELM_CHECK_WIDTYPE(obj, widtype);
2349 win = elm_widget_data_get(obj);
2350 enabled = !!enabled;
2351 if (win->focus_highlight.enabled == enabled)
2354 win->focus_highlight.enabled = enabled;
2356 if (win->focus_highlight.enabled)
2357 _elm_win_focus_highlight_init(win);
2359 _elm_win_focus_highlight_shutdown(win);
2363 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2367 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2369 win = elm_widget_data_get(obj);
2370 return win->focus_highlight.enabled;
2374 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2378 ELM_CHECK_WIDTYPE(obj, widtype);
2380 win = elm_widget_data_get(obj);
2381 eina_stringshare_replace(&win->focus_highlight.style, style);
2382 win->focus_highlight.changed_theme = EINA_TRUE;
2383 _elm_win_focus_highlight_reconfigure_job_start(win);
2387 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2391 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2393 win = elm_widget_data_get(obj);
2394 return win->focus_highlight.style;
2397 typedef struct _Widget_Data Widget_Data;
2402 Evas_Object *content;
2405 static void _del_hook(Evas_Object *obj);
2406 static void _theme_hook(Evas_Object *obj);
2407 static void _sizing_eval(Evas_Object *obj);
2408 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2409 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2411 static const char *widtype2 = NULL;
2414 _del_hook(Evas_Object *obj)
2416 Widget_Data *wd = elm_widget_data_get(obj);
2422 _theme_hook(Evas_Object *obj)
2424 Widget_Data *wd = elm_widget_data_get(obj);
2425 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2427 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2430 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2434 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2436 Widget_Data *wd = elm_widget_data_get(obj);
2441 /* Try Focus cycle in subitem */
2444 elm_widget_focus_next_get(wd->content, dir, next);
2449 *next = (Evas_Object *)obj;
2454 _sizing_eval(Evas_Object *obj)
2456 Widget_Data *wd = elm_widget_data_get(obj);
2457 Evas_Coord minw = -1, minh = -1;
2459 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2460 edje_object_size_min_calc(wd->frm, &minw, &minh);
2461 evas_object_size_hint_min_set(obj, minw, minh);
2462 evas_object_size_hint_max_set(obj, -1, -1);
2466 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2472 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2474 Widget_Data *wd = elm_widget_data_get(obj);
2475 Evas_Object *sub = event_info;
2476 if (sub == wd->content)
2478 evas_object_event_callback_del_full
2479 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2486 elm_win_inwin_add(Evas_Object *obj)
2492 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2493 win = elm_widget_data_get(obj);
2494 if (!win) return NULL;
2495 wd = ELM_NEW(Widget_Data);
2496 obj2 = elm_widget_add(win->evas);
2497 elm_widget_type_set(obj2, "inwin");
2498 ELM_SET_WIDTYPE(widtype2, "inwin");
2499 elm_widget_sub_object_add(obj, obj2);
2500 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2501 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2502 elm_win_resize_object_add(obj, obj2);
2504 elm_widget_data_set(obj2, wd);
2505 elm_widget_del_hook_set(obj2, _del_hook);
2506 elm_widget_theme_hook_set(obj2, _theme_hook);
2507 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2508 elm_widget_can_focus_set(obj2, EINA_TRUE);
2509 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2511 wd->frm = edje_object_add(win->evas);
2512 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2513 elm_widget_resize_object_set(obj2, wd->frm);
2515 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2522 elm_win_inwin_activate(Evas_Object *obj)
2524 ELM_CHECK_WIDTYPE(obj, widtype2);
2525 Widget_Data *wd = elm_widget_data_get(obj);
2527 evas_object_raise(obj);
2528 evas_object_show(obj);
2529 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2530 elm_object_focus_set(obj, EINA_TRUE);
2534 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2536 ELM_CHECK_WIDTYPE(obj, widtype2);
2537 Widget_Data *wd = elm_widget_data_get(obj);
2539 if (wd->content == content) return;
2540 if (wd->content) evas_object_del(wd->content);
2541 wd->content = content;
2544 elm_widget_sub_object_add(obj, content);
2545 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2546 _changed_size_hints, obj);
2547 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2553 elm_win_inwin_content_get(const Evas_Object *obj)
2555 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2556 Widget_Data *wd = elm_widget_data_get(obj);
2557 if (!wd) return NULL;
2562 elm_win_inwin_content_unset(Evas_Object *obj)
2564 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2565 Widget_Data *wd = elm_widget_data_get(obj);
2566 if (!wd) return NULL;
2567 if (!wd->content) return NULL;
2568 Evas_Object *content = wd->content;
2569 elm_widget_sub_object_del(obj, wd->content);
2570 edje_object_part_unswallow(wd->frm, wd->content);
2575 /* windowing spcific calls - shall we do this differently? */
2577 static Ecore_X_Window
2578 _elm_ee_win_get(const Evas_Object *obj)
2581 #ifdef HAVE_ELEMENTARY_X
2582 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2583 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2589 elm_win_xwindow_get(const Evas_Object *obj)
2595 type = elm_widget_type_get(obj);
2596 if (!type) return 0;
2597 if (type != widtype) return _elm_ee_win_get(obj);
2598 #ifdef HAVE_ELEMENTARY_X
2599 win = elm_widget_data_get(obj);
2601 if (win->xwin) return win->xwin;
2602 if (win->parent) return elm_win_xwindow_get(win->parent);