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;
38 Eina_Bool visible : 1;
39 Eina_Bool handled : 1;
43 Ecore_Job *reconf_job;
45 Eina_Bool enabled : 1;
46 Eina_Bool changed_theme : 1;
47 Eina_Bool top_animate : 1;
48 Eina_Bool geometry_changed : 1;
52 static const char *widtype = NULL;
53 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
54 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
55 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
56 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
57 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
58 static void _elm_win_move(Ecore_Evas *ee);
59 static void _elm_win_resize(Ecore_Evas *ee);
60 static void _elm_win_delete_request(Ecore_Evas *ee);
61 static void _elm_win_resize_job(void *data);
62 #ifdef HAVE_ELEMENTARY_X
63 static void _elm_win_xwin_update(Elm_Win *win);
65 static void _elm_win_eval_subobjs(Evas_Object *obj);
66 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
67 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
68 static void _elm_win_focus_highlight_init(Elm_Win *win);
69 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
70 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
71 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
72 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
73 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
74 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
76 static const char SIG_DELETE_REQUEST[] = "delete,request";
77 static const char SIG_FOCUS_OUT[] = "focus,out";
78 static const char SIG_FOCUS_IN[] = "focus,in";
79 static const char SIG_MOVED[] = "moved";
81 static const Evas_Smart_Cb_Description _signals[] = {
82 {SIG_DELETE_REQUEST, ""},
91 Eina_List *_elm_win_list = NULL;
92 int _elm_win_deferred_free = 0;
94 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
95 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
98 _shot_delay_get(Elm_Win *win)
101 char *d = strdup(win->shot.info);
104 for (p = (char *)win->shot.info; *p; p++)
106 if (!strncmp(p, "delay=", 6))
110 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
125 _shot_file_get(Elm_Win *win)
128 char *tmp = strdup(win->shot.info);
129 char *repname = NULL;
131 if (!tmp) return NULL;
133 for (p = (char *)win->shot.info; *p; p++)
135 if (!strncmp(p, "file=", 5))
138 if (!win->shot.repeat_count) return tmp;
141 char *dotptr = strrchr(tmp, '.');
144 repname = malloc(sizeof(char)*(strlen(tmp) + 16));
145 strncpy(repname, tmp, dotptr - tmp);
146 sprintf(repname + (dotptr - tmp), "%03i",
147 win->shot.shot_counter + 1);
148 strcat(repname, dotptr);
155 if (!win->shot.repeat_count) return strdup("out.png");
158 repname = malloc(sizeof(char) * 24);
159 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
165 _shot_repeat_count_get(Elm_Win *win)
169 char *d = strdup(win->shot.info);
172 for (p = (char *)win->shot.info; *p; p++)
174 if (!strncmp(p, "repeat=", 7))
178 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
185 if (v > 1000) v = 999;
195 _shot_key_get(Elm_Win *win __UNUSED__)
201 _shot_flags_get(Elm_Win *win __UNUSED__)
207 _shot_do(Elm_Win *win)
211 unsigned int *pixels;
213 char *file, *key, *flags;
215 ecore_evas_manual_render(win->ee);
216 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
218 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
219 if ((w < 1) || (h < 1)) return;
220 file = _shot_file_get(win);
222 key = _shot_key_get(win);
223 flags = _shot_flags_get(win);
224 ee = ecore_evas_buffer_new(1, 1);
225 o = evas_object_image_add(ecore_evas_get(ee));
226 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
227 evas_object_image_size_set(o, w, h);
228 evas_object_image_data_set(o, pixels);
229 if (!evas_object_image_save(o, file, key, flags))
231 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
236 if (flags) free(flags);
238 if (win->shot.repeat_count) win->shot.shot_counter++;
242 _shot_delay(void *data)
246 if (win->shot.repeat_count)
248 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
249 if (remainshot > 0) return EINA_TRUE;
251 win->shot.timer = NULL;
257 _shot_init(Elm_Win *win)
259 if (!win->shot.info) return;
260 win->shot.repeat_count = _shot_repeat_count_get(win);
261 win->shot.shot_counter = 0;
265 _shot_handle(Elm_Win *win)
267 if (!win->shot.info) return;
268 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
272 _elm_win_move(Ecore_Evas *ee)
274 Evas_Object *obj = ecore_evas_object_associate_get(ee);
279 win = elm_widget_data_get(obj);
281 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
284 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
288 _elm_win_resize(Ecore_Evas *ee)
290 Evas_Object *obj = ecore_evas_object_associate_get(ee);
294 win = elm_widget_data_get(obj);
296 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
297 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
301 _elm_win_focus_in(Ecore_Evas *ee)
303 Evas_Object *obj = ecore_evas_object_associate_get(ee);
307 win = elm_widget_data_get(obj);
309 elm_widget_focus_restore(win->win_obj);
310 if (!elm_object_focus_get(win->win_obj))
311 elm_object_focus_set(win->win_obj, EINA_TRUE);
312 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
313 win->focus_highlight.cur.visible = EINA_TRUE;
314 _elm_win_focus_highlight_reconfigure_job_start(win);
318 else if (win->img_obj)
325 _elm_win_focus_out(Ecore_Evas *ee)
327 Evas_Object *obj = ecore_evas_object_associate_get(ee);
331 win = elm_widget_data_get(obj);
333 elm_object_focus_set(win->win_obj, EINA_FALSE);
334 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
335 win->focus_highlight.cur.visible = EINA_FALSE;
336 _elm_win_focus_highlight_reconfigure_job_start(win);
340 else if (win->img_obj)
347 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
349 Elm_Win *wd = elm_widget_data_get(obj);
350 const Eina_List *items;
351 void *(*list_data_get) (const Eina_List *list);
359 if (!(items = elm_widget_focus_custom_chain_get(obj)))
365 list_data_get = eina_list_data_get;
367 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
373 *next = (Evas_Object *)obj;
378 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
380 Elm_Win *win = elm_widget_data_get(obj);
384 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
386 evas_object_focus_set(obj, elm_widget_focus_get(obj));
390 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
392 if (type == EVAS_CALLBACK_KEY_DOWN)
394 Evas_Event_Key_Down *ev = event_info;
395 if (!strcmp(ev->keyname, "Tab"))
397 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
398 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
400 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
401 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
404 else if ((!strcmp(ev->keyname, "Left")) ||
405 (!strcmp(ev->keyname, "KP_Left")))
407 //TODO : woohyun jung
409 else if ((!strcmp(ev->keyname, "Right")) ||
410 (!strcmp(ev->keyname, "KP_Right")))
412 //TODO : woohyun jung
414 else if ((!strcmp(ev->keyname, "Up")) ||
415 (!strcmp(ev->keyname, "KP_Up")))
417 //TODO : woohyun jung
419 else if ((!strcmp(ev->keyname, "Down")) ||
420 (!strcmp(ev->keyname, "KP_Down")))
422 //TODO : woohyun jung
430 _deferred_ecore_evas_free(void *data)
432 ecore_evas_free(data);
433 _elm_win_deferred_free--;
437 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
441 elm_object_focus_set(obj, EINA_TRUE);
442 if (win->shot.info) _shot_handle(win);
446 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
453 else if (win->img_obj)
455 evas_object_hide(win->img_obj);
460 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
467 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
468 _elm_win_obj_callback_parent_del, win);
471 if (win->autodel_clear) *(win->autodel_clear) = -1;
472 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
473 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
476 ecore_evas_callback_delete_request_set(win->ee, NULL);
477 ecore_evas_callback_resize_set(win->ee, NULL);
479 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
480 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
481 if (win->shot.info) eina_stringshare_del(win->shot.info);
482 if (win->shot.timer) ecore_timer_del(win->shot.timer);
483 while (((child = evas_object_bottom_get(win->evas))) &&
486 evas_object_del(child);
488 while (((child = evas_object_top_get(win->evas))) &&
491 evas_object_del(child);
493 #ifdef HAVE_ELEMENTARY_X
494 if (win->client_message_handler)
495 ecore_event_handler_del(win->client_message_handler);
497 // FIXME: Why are we flushing edje on every window destroy ??
498 // edje_file_cache_flush();
499 // edje_collection_cache_flush();
500 // evas_image_cache_flush(win->evas);
501 // evas_font_cache_flush(win->evas);
502 // FIXME: we are in the del handler for the object and delete the canvas
503 // that lives under it from the handler... nasty. deferring doesn't help either
513 ecore_job_add(_deferred_ecore_evas_free, win->ee);
514 _elm_win_deferred_free++;
518 _elm_win_focus_highlight_shutdown(win);
519 eina_stringshare_del(win->focus_highlight.style);
523 if ((!_elm_win_list) &&
524 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
526 edje_file_cache_flush();
527 edje_collection_cache_flush();
528 evas_image_cache_flush(e);
529 evas_font_cache_flush(e);
535 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
538 if (!win->img_obj) return;
539 evas_object_event_callback_del_full
540 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
541 evas_object_del(win->img_obj);
545 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
548 if (obj == win->parent) win->parent = NULL;
552 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
558 if ((x != win->screen.x) || (y != win->screen.y))
562 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
567 evas_object_move(obj, x, y);
572 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
575 // this is called to make sure all smart containers have calculated their
576 // sizes BEFORE we show the window to make sure it initially appears at
577 // our desired size (ie min size is known first)
578 evas_smart_objects_calculate(evas_object_evas_get(obj));
579 evas_object_show(obj);
583 else if (win->img_obj)
585 evas_object_show(win->img_obj);
590 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
594 if (ecore_evas_override_get(win->ee))
598 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
601 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
606 else if (win->img_obj)
610 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
613 // evas_object_move(win->img_obj, x, y);
618 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
625 else if (win->img_obj)
627 Evas_Coord w = 1, h = 1;
629 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
632 evas_object_image_size_set(win->img_obj, w, h);
637 _elm_win_delete_request(Ecore_Evas *ee)
639 Evas_Object *obj = ecore_evas_object_associate_get(ee);
641 if (strcmp(elm_widget_type_get(obj), "win")) return;
643 win = elm_widget_data_get(obj);
645 int autodel = win->autodel;
646 win->autodel_clear = &autodel;
647 evas_object_ref(win->win_obj);
648 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
649 // FIXME: if above callback deletes - then the below will be invalid
650 if (autodel) evas_object_del(win->win_obj);
651 else win->autodel_clear = NULL;
652 evas_object_unref(win->win_obj);
656 _elm_win_resize_job(void *data)
663 win->deferred_resize_job = NULL;
664 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
665 evas_object_resize(win->win_obj, w, h);
669 else if (win->img_obj)
672 EINA_LIST_FOREACH(win->subobjs, l, obj)
674 evas_object_move(obj, 0, 0);
675 evas_object_resize(obj, w, h);
679 #ifdef HAVE_ELEMENTARY_X
681 _elm_win_xwindow_get(Elm_Win *win)
685 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
686 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
688 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
690 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
691 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
692 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
693 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
694 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
695 ENGINE_COMPARE(ELM_OPENGL_SDL))
698 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
700 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
702 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
704 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
707 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
709 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
712 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
714 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
716 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
718 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
720 #undef ENGINE_COMPARE
724 #ifdef HAVE_ELEMENTARY_X
726 _elm_win_xwin_update(Elm_Win *win)
728 _elm_win_xwindow_get(win);
733 win2 = elm_widget_data_get(win->parent);
737 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
741 if (!win->xwin) return; /* nothing more to do */
746 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
748 case ELM_WIN_DIALOG_BASIC:
749 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
751 case ELM_WIN_DESKTOP:
752 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
755 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
757 case ELM_WIN_TOOLBAR:
758 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
761 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
763 case ELM_WIN_UTILITY:
764 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
767 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
769 case ELM_WIN_DROPDOWN_MENU:
770 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
772 case ELM_WIN_POPUP_MENU:
773 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
775 case ELM_WIN_TOOLTIP:
776 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
778 case ELM_WIN_NOTIFICATION:
779 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
782 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
785 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
790 ecore_x_e_virtual_keyboard_state_set
791 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
796 _elm_win_eval_subobjs(Evas_Object *obj)
799 const Evas_Object *child;
801 Elm_Win *win = elm_widget_data_get(obj);
802 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
806 EINA_LIST_FOREACH(win->subobjs, l, child)
808 evas_object_size_hint_weight_get(child, &wx, &wy);
809 if (wx == 0.0) xx = 0;
810 if (wy == 0.0) xy = 0;
812 evas_object_size_hint_min_get(child, &w, &h);
815 if (w > minw) minw = w;
816 if (h > minh) minh = h;
818 evas_object_size_hint_max_get(child, &w, &h);
821 if (maxw == -1) maxw = w;
822 else if ((w > 0) && (w < maxw)) maxw = w;
823 if (maxh == -1) maxh = h;
824 else if ((h > 0) && (h < maxh)) maxh = h;
826 if (!xx) maxw = minw;
828 if (!xy) maxh = minh;
830 evas_object_size_hint_min_set(obj, minw, minh);
831 evas_object_size_hint_max_set(obj, maxw, maxh);
832 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
833 if (w < minw) w = minw;
834 if (h < minh) h = minh;
835 if ((maxw >= 0) && (w > maxw)) w = maxw;
836 if ((maxh >= 0) && (h > maxh)) h = maxh;
837 evas_object_resize(obj, w, h);
841 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
843 Elm_Win *win = elm_widget_data_get(data);
844 win->subobjs = eina_list_remove(win->subobjs, obj);
845 _elm_win_eval_subobjs(win->win_obj);
849 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
851 _elm_win_eval_subobjs(data);
855 _elm_win_shutdown(void)
857 while (_elm_win_list)
858 evas_object_del(_elm_win_list->data);
862 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
869 EINA_LIST_FOREACH(_elm_win_list, l, obj)
870 elm_widget_theme(obj);
874 EINA_LIST_FOREACH(_elm_win_list, l, obj)
875 elm_widget_theme_specific(obj, th, EINA_FALSE);
879 #ifdef HAVE_ELEMENTARY_X
881 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
884 Ecore_X_Event_Client_Message *e = event;
886 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
887 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
889 if ((unsigned)e->data.l[0] == win->xwin)
891 Evas *evas = evas_object_evas_get(win->win_obj);
894 edje_file_cache_flush();
895 edje_collection_cache_flush();
896 evas_image_cache_flush(evas);
897 evas_font_cache_flush(evas);
901 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
903 if ((unsigned)e->data.l[0] == win->xwin)
905 Evas *evas = evas_object_evas_get(win->win_obj);
908 edje_file_cache_flush();
909 edje_collection_cache_flush();
910 evas_image_cache_flush(evas);
911 evas_font_cache_flush(evas);
912 evas_render_dump(evas);
916 return ECORE_CALLBACK_PASS_ON;
921 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
925 win->focus_highlight.geometry_changed = EINA_TRUE;
926 _elm_win_focus_highlight_reconfigure_job_start(win);
930 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
934 win->focus_highlight.geometry_changed = EINA_TRUE;
935 _elm_win_focus_highlight_reconfigure_job_start(win);
939 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
943 win->focus_highlight.cur.target = NULL;
945 _elm_win_focus_highlight_reconfigure_job_start(win);
949 _elm_win_focus_target_callbacks_add(Elm_Win *win)
951 Evas_Object *obj = win->focus_highlight.cur.target;
953 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
954 _elm_win_focus_target_move, win);
955 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
956 _elm_win_focus_target_resize, win);
957 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
958 _elm_win_focus_target_del, win);
962 _elm_win_focus_target_callbacks_del(Elm_Win *win)
964 Evas_Object *obj = win->focus_highlight.cur.target;
966 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
967 _elm_win_focus_target_move, win);
968 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
969 _elm_win_focus_target_resize, win);
970 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
971 _elm_win_focus_target_del, win);
975 _elm_win_focus_target_get(Evas_Object *obj)
977 Evas_Object *o = obj;
981 if (elm_widget_is(o))
983 if (!elm_widget_highlight_ignore_get(o))
985 o = elm_widget_parent_get(o);
987 o = evas_object_smart_parent_get(o);
991 o = elm_widget_parent_widget_get(o);
993 o = evas_object_smart_parent_get(o);
1002 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1004 Evas_Object *obj = event_info, *target;
1005 Elm_Win *win = data;
1007 if (win->focus_highlight.cur.target == obj)
1010 target = _elm_win_focus_target_get(obj);
1011 win->focus_highlight.cur.target = target;
1012 if (elm_widget_highlight_in_theme_get(target))
1013 win->focus_highlight.cur.handled = EINA_TRUE;
1015 _elm_win_focus_target_callbacks_add(win);
1017 _elm_win_focus_highlight_reconfigure_job_start(win);
1021 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1023 Elm_Win *win = data;
1025 if (!win->focus_highlight.cur.target)
1028 if (!win->focus_highlight.cur.handled)
1029 _elm_win_focus_target_callbacks_del(win);
1030 win->focus_highlight.cur.target = NULL;
1031 win->focus_highlight.cur.handled = EINA_FALSE;
1033 _elm_win_focus_highlight_reconfigure_job_start(win);
1037 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1039 evas_object_hide(obj);
1043 _elm_win_focus_highlight_init(Elm_Win *win)
1045 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1046 _elm_win_object_focus_in, win);
1047 evas_event_callback_add(win->evas,
1048 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1049 _elm_win_object_focus_out, win);
1051 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1053 win->focus_highlight.top = edje_object_add(win->evas);
1054 win->focus_highlight.changed_theme = EINA_TRUE;
1055 edje_object_signal_callback_add(win->focus_highlight.top,
1056 "elm,action,focus,hide,end", "",
1057 _elm_win_focus_highlight_hide, NULL);
1058 edje_object_signal_callback_add(win->focus_highlight.top,
1059 "elm,action,focus,anim,end", "",
1060 _elm_win_focus_highlight_anim_end, win);
1061 _elm_win_focus_highlight_reconfigure_job_start(win);
1065 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1067 _elm_win_focus_highlight_reconfigure_job_stop(win);
1068 if (win->focus_highlight.cur.target)
1070 _elm_win_focus_target_callbacks_del(win);
1071 win->focus_highlight.cur.target = NULL;
1073 if (win->focus_highlight.top)
1075 evas_object_del(win->focus_highlight.top);
1076 win->focus_highlight.top = NULL;
1079 evas_event_callback_del_full(win->evas,
1080 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1081 _elm_win_object_focus_in, win);
1082 evas_event_callback_del_full(win->evas,
1083 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1084 _elm_win_object_focus_out, win);
1088 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1092 top = win->focus_highlight.top;
1097 evas_object_show(top);
1098 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1104 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1109 _elm_win_focus_highlight_reconfigure_job(void *data)
1111 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1115 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1117 if (win->focus_highlight.reconf_job)
1118 ecore_job_del(win->focus_highlight.reconf_job);
1119 win->focus_highlight.reconf_job = ecore_job_add(
1120 _elm_win_focus_highlight_reconfigure_job, win);
1124 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1126 if (win->focus_highlight.reconf_job)
1127 ecore_job_del(win->focus_highlight.reconf_job);
1128 win->focus_highlight.reconf_job = NULL;
1132 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1134 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1135 Evas_Coord x, y, w, h;
1137 clip = evas_object_clip_get(target);
1138 evas_object_geometry_get(target, &x, &y, &w, &h);
1140 evas_object_move(obj, x, y);
1141 evas_object_resize(obj, w, h);
1142 evas_object_clip_set(obj, clip);
1146 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1148 Evas_Coord tx, ty, tw, th;
1149 Evas_Coord w, h, px, py, pw, ph;
1150 Edje_Message_Int_Set *m;
1151 Evas_Object *previous = win->focus_highlight.prev.target;
1152 Evas_Object *target = win->focus_highlight.cur.target;
1154 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1155 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1156 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1157 evas_object_move(obj, 0, 0);
1158 evas_object_resize(obj, tw, th);
1159 evas_object_clip_unset(obj);
1161 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1171 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1175 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1177 Elm_Win *win = data;
1178 _elm_win_focus_highlight_simple_setup(win, obj);
1182 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1184 Evas_Object *target = win->focus_highlight.cur.target;
1185 Evas_Object *previous = win->focus_highlight.prev.target;
1186 Evas_Object *top = win->focus_highlight.top;
1187 Eina_Bool visible_changed;
1188 Eina_Bool common_visible;
1189 const char *sig = NULL;
1191 _elm_win_focus_highlight_reconfigure_job_stop(win);
1193 visible_changed = (win->focus_highlight.cur.visible !=
1194 win->focus_highlight.prev.visible);
1196 if ((target == previous) && (!visible_changed) &&
1197 (!win->focus_highlight.geometry_changed))
1200 if ((previous) && (win->focus_highlight.prev.handled))
1201 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1204 common_visible = EINA_FALSE;
1205 else if (win->focus_highlight.cur.handled)
1207 common_visible = EINA_FALSE;
1208 if (win->focus_highlight.cur.visible)
1209 sig = "elm,action,focus_highlight,show";
1211 sig = "elm,action,focus_highlight,hide";
1214 common_visible = win->focus_highlight.cur.visible;
1216 _elm_win_focus_highlight_visible_set(win, common_visible);
1218 elm_widget_signal_emit(target, sig, "elm");
1220 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1223 if (win->focus_highlight.changed_theme)
1226 if (win->focus_highlight.style)
1227 str = win->focus_highlight.style;
1230 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1232 win->focus_highlight.changed_theme = EINA_FALSE;
1234 if (_elm_config->focus_highlight_animate)
1236 str = edje_object_data_get(win->focus_highlight.top, "animate");
1237 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1241 if ((win->focus_highlight.top_animate) && (previous) &&
1242 (!win->focus_highlight.prev.handled))
1243 _elm_win_focus_highlight_anim_setup(win, top);
1245 _elm_win_focus_highlight_simple_setup(win, top);
1246 evas_object_raise(top);
1249 win->focus_highlight.geometry_changed = EINA_FALSE;
1250 win->focus_highlight.prev = win->focus_highlight.cur;
1255 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1257 Evas_Event_Key_Down *ev = event_info;
1259 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1263 if ((strcmp(ev->keyname, "F12")) ||
1264 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1267 printf("Tree graph generated.\n");
1268 elm_object_tree_dot_dump(obj, "./dump.dot");
1273 _win_img_hide(void *data,
1275 Evas_Object *obj __UNUSED__,
1276 void *event_info __UNUSED__)
1278 Elm_Win *win = data;
1280 elm_widget_focus_hide_handle(win->win_obj);
1284 _win_img_mouse_up(void *data,
1286 Evas_Object *obj __UNUSED__,
1289 Elm_Win *win = data;
1290 Evas_Event_Mouse_Up *ev = event_info;
1291 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1292 elm_widget_focus_mouse_up_handle(win->win_obj);
1296 _win_img_focus_in(void *data,
1298 Evas_Object *obj __UNUSED__,
1299 void *event_info __UNUSED__)
1301 Elm_Win *win = data;
1302 elm_widget_focus_steal(win->win_obj);
1306 _win_img_focus_out(void *data,
1308 Evas_Object *obj __UNUSED__,
1309 void *event_info __UNUSED__)
1311 Elm_Win *win = data;
1312 elm_widget_focused_object_clear(win->win_obj);
1316 _win_inlined_image_set(Elm_Win *win)
1318 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1319 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1320 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1321 _elm_win_obj_callback_img_obj_del, win);
1323 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1324 _win_img_hide, win);
1325 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1326 _win_img_mouse_up, win);
1327 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1328 _win_img_focus_in, win);
1329 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1330 _win_img_focus_out, win);
1334 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1338 const char *fontpath;
1340 win = ELM_NEW(Elm_Win);
1342 #define FALLBACK_TRY(engine) \
1345 CRITICAL(engine " engine creation failed. Trying software X11."); \
1346 elm_engine_set(ELM_SOFTWARE_X11); \
1347 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1349 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1353 case ELM_WIN_INLINED_IMAGE:
1356 Evas *e = evas_object_evas_get(parent);
1359 ee = ecore_evas_ecore_evas_get(e);
1361 win->img_obj = ecore_evas_object_image_new(ee);
1362 if (!win->img_obj) break;
1363 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1366 _win_inlined_image_set(win);
1369 evas_object_del(win->img_obj);
1370 win->img_obj = NULL;
1374 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1376 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1377 #ifdef HAVE_ELEMENTARY_X
1378 win->client_message_handler = ecore_event_handler_add
1379 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1382 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1384 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1385 FALLBACK_TRY("Sofware FB");
1387 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1389 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1390 FALLBACK_TRY("Sofware DirectFB");
1392 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1394 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1395 FALLBACK_TRY("Sofware-16");
1396 #ifdef HAVE_ELEMENTARY_X
1397 win->client_message_handler = ecore_event_handler_add
1398 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1401 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1403 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1404 FALLBACK_TRY("Sofware-8");
1405 #ifdef HAVE_ELEMENTARY_X
1406 win->client_message_handler = ecore_event_handler_add
1407 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1411 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1413 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1414 FALLBACK_TRY("XRender");
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_OPENGL_X11))
1426 if (_elm_config->vsync)
1428 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1434 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1436 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1437 FALLBACK_TRY("OpenGL");
1438 #ifdef HAVE_ELEMENTARY_X
1439 win->client_message_handler = ecore_event_handler_add
1440 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1443 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1445 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1446 FALLBACK_TRY("Sofware Win32");
1448 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1450 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1451 FALLBACK_TRY("Sofware-16-WinCE");
1453 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1455 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1456 FALLBACK_TRY("Sofware SDL");
1458 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1460 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1461 FALLBACK_TRY("Sofware-16-SDL");
1463 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1465 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1466 FALLBACK_TRY("OpenGL SDL");
1468 else if (ENGINE_COMPARE(ELM_BUFFER))
1470 win->ee = ecore_evas_buffer_new(1, 1);
1472 else if (!strncmp(_elm_config->engine, "shot:", 5))
1474 win->ee = ecore_evas_buffer_new(1, 1);
1475 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1476 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1485 ERR("Cannot create window.");
1489 #ifdef HAVE_ELEMENTARY_X
1490 _elm_win_xwindow_get(win);
1492 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1493 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1494 // bg pixmap done by x - has other issues like can be redrawn by x before it
1495 // is filled/ready by app
1496 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1499 win->parent = parent;
1501 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1502 _elm_win_obj_callback_parent_del, win);
1504 win->evas = ecore_evas_get(win->ee);
1505 win->win_obj = elm_widget_add(win->evas);
1506 elm_widget_type_set(win->win_obj, "win");
1507 ELM_SET_WIDTYPE(widtype, "win");
1508 elm_widget_data_set(win->win_obj, win);
1509 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1510 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1511 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1512 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1513 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1514 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1515 evas_object_move(win->win_obj, 0, 0);
1516 evas_object_resize(win->win_obj, 1, 1);
1517 evas_object_layer_set(win->win_obj, 50);
1518 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1520 if (type == ELM_WIN_INLINED_IMAGE)
1521 elm_widget_parent2_set(win->win_obj, parent);
1522 ecore_evas_object_associate(win->ee, win->win_obj,
1523 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1524 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1525 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1526 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1527 _elm_win_obj_callback_show, win);
1528 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1529 _elm_win_obj_callback_hide, win);
1530 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1531 _elm_win_obj_callback_del, win);
1532 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1533 _elm_win_obj_callback_move, win);
1534 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1535 _elm_win_obj_callback_resize, win);
1537 evas_object_intercept_move_callback_add(win->win_obj,
1538 _elm_win_obj_intercept_move, win);
1539 evas_object_intercept_show_callback_add(win->win_obj,
1540 _elm_win_obj_intercept_show, win);
1542 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1543 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1544 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1545 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1546 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1547 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1548 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1549 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1550 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1551 evas_font_path_append(win->evas, fontpath);
1552 if (!_elm_config->font_hinting)
1553 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1554 else if (_elm_config->font_hinting == 1)
1555 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1556 else if (_elm_config->font_hinting == 2)
1557 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1559 #ifdef HAVE_ELEMENTARY_X
1560 _elm_win_xwin_update(win);
1563 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1565 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1567 ecore_evas_fullscreen_set(win->ee, 1);
1569 #undef ENGINE_COMPARE
1571 if (_elm_config->focus_highlight_enable)
1572 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1575 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1576 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1577 _debug_key_down, win);
1579 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1581 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1584 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1586 return win->win_obj;
1590 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1594 ELM_CHECK_WIDTYPE(obj, widtype);
1595 win = elm_widget_data_get(obj);
1597 if (eina_list_data_find(win->subobjs, subobj)) return;
1598 win->subobjs = eina_list_append(win->subobjs, subobj);
1599 elm_widget_sub_object_add(obj, subobj);
1600 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1601 _elm_win_subobj_callback_del, obj);
1602 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1603 _elm_win_subobj_callback_changed_size_hints,
1605 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1606 evas_object_move(subobj, 0, 0);
1607 evas_object_resize(subobj, w, h);
1608 _elm_win_eval_subobjs(obj);
1612 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1615 ELM_CHECK_WIDTYPE(obj, widtype);
1616 win = elm_widget_data_get(obj);
1618 evas_object_event_callback_del_full(subobj,
1619 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1620 _elm_win_subobj_callback_changed_size_hints,
1622 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1623 _elm_win_subobj_callback_del, obj);
1624 win->subobjs = eina_list_remove(win->subobjs, subobj);
1625 elm_widget_sub_object_del(obj, subobj);
1626 _elm_win_eval_subobjs(obj);
1630 elm_win_title_set(Evas_Object *obj, const char *title)
1633 ELM_CHECK_WIDTYPE(obj, widtype);
1634 win = elm_widget_data_get(obj);
1636 ecore_evas_title_set(win->ee, title);
1640 elm_win_title_get(const Evas_Object *obj)
1643 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1644 win = elm_widget_data_get(obj);
1645 if (!win) return NULL;
1646 return ecore_evas_title_get(win->ee);
1650 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1653 ELM_CHECK_WIDTYPE(obj, widtype);
1654 win = elm_widget_data_get(obj);
1656 win->autodel = autodel;
1660 elm_win_autodel_get(const Evas_Object *obj)
1663 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1664 win = elm_widget_data_get(obj);
1665 if (!win) return EINA_FALSE;
1666 return win->autodel;
1670 elm_win_activate(Evas_Object *obj)
1673 ELM_CHECK_WIDTYPE(obj, widtype);
1674 win = elm_widget_data_get(obj);
1676 ecore_evas_activate(win->ee);
1680 elm_win_lower(Evas_Object *obj)
1683 ELM_CHECK_WIDTYPE(obj, widtype);
1684 win = elm_widget_data_get(obj);
1686 ecore_evas_lower(win->ee);
1690 elm_win_raise(Evas_Object *obj)
1693 ELM_CHECK_WIDTYPE(obj, widtype);
1694 win = elm_widget_data_get(obj);
1696 ecore_evas_raise(win->ee);
1700 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1703 ELM_CHECK_WIDTYPE(obj, widtype);
1704 win = elm_widget_data_get(obj);
1706 ecore_evas_borderless_set(win->ee, borderless);
1707 #ifdef HAVE_ELEMENTARY_X
1708 _elm_win_xwin_update(win);
1713 elm_win_borderless_get(const Evas_Object *obj)
1716 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1717 win = elm_widget_data_get(obj);
1718 if (!win) return EINA_FALSE;
1719 return ecore_evas_borderless_get(win->ee);
1723 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1726 ELM_CHECK_WIDTYPE(obj, widtype);
1727 win = elm_widget_data_get(obj);
1729 ecore_evas_shaped_set(win->ee, shaped);
1730 #ifdef HAVE_ELEMENTARY_X
1731 _elm_win_xwin_update(win);
1736 elm_win_shaped_get(const Evas_Object *obj)
1739 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1740 win = elm_widget_data_get(obj);
1741 if (!win) return EINA_FALSE;
1742 return ecore_evas_shaped_get(win->ee);
1746 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1749 ELM_CHECK_WIDTYPE(obj, widtype);
1750 win = elm_widget_data_get(obj);
1755 else if (win->img_obj)
1757 evas_object_image_alpha_set(win->img_obj, alpha);
1761 #ifdef HAVE_ELEMENTARY_X
1766 if (!_elm_config->compositing)
1767 elm_win_shaped_set(obj, alpha);
1769 ecore_evas_alpha_set(win->ee, alpha);
1772 ecore_evas_alpha_set(win->ee, alpha);
1773 _elm_win_xwin_update(win);
1777 ecore_evas_alpha_set(win->ee, alpha);
1782 elm_win_alpha_get(const Evas_Object *obj)
1785 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1786 win = elm_widget_data_get(obj);
1787 if (!win) return EINA_FALSE;
1788 return ecore_evas_alpha_get(win->ee);
1792 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1795 ELM_CHECK_WIDTYPE(obj, widtype);
1796 win = elm_widget_data_get(obj);
1802 else if (win->img_obj)
1804 evas_object_image_alpha_set(win->img_obj, transparent);
1808 #ifdef HAVE_ELEMENTARY_X
1811 ecore_evas_transparent_set(win->ee, transparent);
1812 _elm_win_xwin_update(win);
1816 ecore_evas_transparent_set(win->ee, transparent);
1821 elm_win_transparent_get(const Evas_Object *obj)
1824 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1825 win = elm_widget_data_get(obj);
1826 if (!win) return EINA_FALSE;
1828 return ecore_evas_transparent_get(win->ee);
1832 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1835 ELM_CHECK_WIDTYPE(obj, widtype);
1836 win = elm_widget_data_get(obj);
1838 ecore_evas_override_set(win->ee, override);
1839 #ifdef HAVE_ELEMENTARY_X
1840 _elm_win_xwin_update(win);
1845 elm_win_override_get(const Evas_Object *obj)
1848 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1849 win = elm_widget_data_get(obj);
1850 if (!win) return EINA_FALSE;
1851 return ecore_evas_override_get(win->ee);
1855 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1858 ELM_CHECK_WIDTYPE(obj, widtype);
1859 win = elm_widget_data_get(obj);
1862 // YYY: handle if win->img_obj
1863 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1864 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1865 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1867 // these engines... can ONLY be fullscreen
1872 ecore_evas_fullscreen_set(win->ee, fullscreen);
1873 #ifdef HAVE_ELEMENTARY_X
1874 _elm_win_xwin_update(win);
1877 #undef ENGINE_COMPARE
1881 elm_win_fullscreen_get(const Evas_Object *obj)
1884 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1885 win = elm_widget_data_get(obj);
1886 if (!win) return EINA_FALSE;
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 return ecore_evas_fullscreen_get(win->ee);
1899 #undef ENGINE_COMPARE
1903 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1906 ELM_CHECK_WIDTYPE(obj, widtype);
1907 win = elm_widget_data_get(obj);
1909 // YYY: handle if win->img_obj
1910 ecore_evas_maximized_set(win->ee, maximized);
1911 #ifdef HAVE_ELEMENTARY_X
1912 _elm_win_xwin_update(win);
1917 elm_win_maximized_get(const Evas_Object *obj)
1920 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1921 win = elm_widget_data_get(obj);
1922 if (!win) return EINA_FALSE;
1923 return ecore_evas_maximized_get(win->ee);
1927 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1930 ELM_CHECK_WIDTYPE(obj, widtype);
1931 win = elm_widget_data_get(obj);
1933 ecore_evas_iconified_set(win->ee, iconified);
1934 #ifdef HAVE_ELEMENTARY_X
1935 _elm_win_xwin_update(win);
1940 elm_win_iconified_get(const Evas_Object *obj)
1943 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1944 win = elm_widget_data_get(obj);
1945 if (!win) return EINA_FALSE;
1946 return ecore_evas_iconified_get(win->ee);
1950 elm_win_layer_set(Evas_Object *obj, int layer)
1953 ELM_CHECK_WIDTYPE(obj, widtype);
1954 win = elm_widget_data_get(obj);
1956 ecore_evas_layer_set(win->ee, layer);
1957 #ifdef HAVE_ELEMENTARY_X
1958 _elm_win_xwin_update(win);
1963 elm_win_layer_get(const Evas_Object *obj)
1966 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1967 win = elm_widget_data_get(obj);
1968 if (!win) return -1;
1969 return ecore_evas_layer_get(win->ee);
1973 elm_win_rotation_set(Evas_Object *obj, int rotation)
1976 ELM_CHECK_WIDTYPE(obj, widtype);
1977 win = elm_widget_data_get(obj);
1979 if (win->rot == rotation) return;
1980 win->rot = rotation;
1981 ecore_evas_rotation_set(win->ee, rotation);
1982 evas_object_size_hint_min_set(obj, -1, -1);
1983 evas_object_size_hint_max_set(obj, -1, -1);
1984 _elm_win_eval_subobjs(obj);
1985 #ifdef HAVE_ELEMENTARY_X
1986 _elm_win_xwin_update(win);
1991 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1994 ELM_CHECK_WIDTYPE(obj, widtype);
1995 win = elm_widget_data_get(obj);
1997 if (win->rot == rotation) return;
1998 win->rot = rotation;
1999 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2000 evas_object_size_hint_min_set(obj, -1, -1);
2001 evas_object_size_hint_max_set(obj, -1, -1);
2002 _elm_win_eval_subobjs(obj);
2003 #ifdef HAVE_ELEMENTARY_X
2004 _elm_win_xwin_update(win);
2009 elm_win_rotation_get(const Evas_Object *obj)
2012 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2013 win = elm_widget_data_get(obj);
2014 if (!win) return -1;
2019 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2022 ELM_CHECK_WIDTYPE(obj, widtype);
2023 win = elm_widget_data_get(obj);
2025 ecore_evas_sticky_set(win->ee, sticky);
2026 #ifdef HAVE_ELEMENTARY_X
2027 _elm_win_xwin_update(win);
2032 elm_win_sticky_get(const Evas_Object *obj)
2035 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2036 win = elm_widget_data_get(obj);
2037 if (!win) return EINA_FALSE;
2038 return ecore_evas_sticky_get(win->ee);
2042 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2045 ELM_CHECK_WIDTYPE(obj, widtype);
2046 win = elm_widget_data_get(obj);
2048 if (mode == win->kbdmode) return;
2049 #ifdef HAVE_ELEMENTARY_X
2050 _elm_win_xwindow_get(win);
2052 win->kbdmode = mode;
2053 #ifdef HAVE_ELEMENTARY_X
2055 ecore_x_e_virtual_keyboard_state_set
2056 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2060 EAPI Elm_Win_Keyboard_Mode
2061 elm_win_keyboard_mode_get(const Evas_Object *obj)
2064 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2065 win = elm_widget_data_get(obj);
2066 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2067 return win->kbdmode;
2071 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2074 ELM_CHECK_WIDTYPE(obj, widtype);
2075 win = elm_widget_data_get(obj);
2077 #ifdef HAVE_ELEMENTARY_X
2078 _elm_win_xwindow_get(win);
2080 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2085 elm_win_keyboard_win_get(const Evas_Object *obj)
2088 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2089 win = elm_widget_data_get(obj);
2090 if (!win) return EINA_FALSE;
2091 #ifdef HAVE_ELEMENTARY_X
2092 _elm_win_xwindow_get(win);
2094 return ecore_x_e_virtual_keyboard_get(win->xwin);
2100 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2103 ELM_CHECK_WIDTYPE(obj, widtype);
2104 win = elm_widget_data_get(obj);
2106 if (x) *x = win->screen.x;
2107 if (y) *y = win->screen.y;
2111 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2114 ELM_CHECK_WIDTYPE(obj, widtype);
2115 win = elm_widget_data_get(obj);
2117 #ifdef HAVE_ELEMENTARY_X
2118 _elm_win_xwindow_get(win);
2120 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2125 elm_win_conformant_get(const Evas_Object *obj)
2128 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2129 win = elm_widget_data_get(obj);
2130 if (!win) return EINA_FALSE;
2131 #ifdef HAVE_ELEMENTARY_X
2132 _elm_win_xwindow_get(win);
2134 return ecore_x_e_illume_conformant_get(win->xwin);
2140 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2143 ELM_CHECK_WIDTYPE(obj, widtype);
2144 win = elm_widget_data_get(obj);
2146 #ifdef HAVE_ELEMENTARY_X
2147 _elm_win_xwindow_get(win);
2150 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2153 Ecore_X_Window_State states[2];
2155 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2156 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2157 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2158 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2165 elm_win_quickpanel_get(const Evas_Object *obj)
2168 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2169 win = elm_widget_data_get(obj);
2170 if (!win) return EINA_FALSE;
2171 #ifdef HAVE_ELEMENTARY_X
2172 _elm_win_xwindow_get(win);
2174 return ecore_x_e_illume_quickpanel_get(win->xwin);
2180 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2183 ELM_CHECK_WIDTYPE(obj, widtype);
2184 win = elm_widget_data_get(obj);
2186 #ifdef HAVE_ELEMENTARY_X
2187 _elm_win_xwindow_get(win);
2189 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2194 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2197 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2198 win = elm_widget_data_get(obj);
2199 if (!win) return -1;
2200 #ifdef HAVE_ELEMENTARY_X
2201 _elm_win_xwindow_get(win);
2203 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2209 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2212 ELM_CHECK_WIDTYPE(obj, widtype);
2213 win = elm_widget_data_get(obj);
2215 #ifdef HAVE_ELEMENTARY_X
2216 _elm_win_xwindow_get(win);
2218 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2223 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2226 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2227 win = elm_widget_data_get(obj);
2228 if (!win) return -1;
2229 #ifdef HAVE_ELEMENTARY_X
2230 _elm_win_xwindow_get(win);
2232 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2238 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2241 ELM_CHECK_WIDTYPE(obj, widtype);
2242 win = elm_widget_data_get(obj);
2244 #ifdef HAVE_ELEMENTARY_X
2245 _elm_win_xwindow_get(win);
2247 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2252 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2255 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2256 win = elm_widget_data_get(obj);
2258 #ifdef HAVE_ELEMENTARY_X
2259 _elm_win_xwindow_get(win);
2261 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2267 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2270 ELM_CHECK_WIDTYPE(obj, widtype);
2271 win = elm_widget_data_get(obj);
2273 #ifdef HAVE_ELEMENTARY_X
2274 _elm_win_xwindow_get(win);
2279 Ecore_X_Window_State states[2];
2281 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2282 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2283 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2284 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2291 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2294 ELM_CHECK_WIDTYPE(obj, widtype);
2295 win = elm_widget_data_get(obj);
2297 #ifdef HAVE_ELEMENTARY_X
2298 _elm_win_xwindow_get(win);
2303 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2304 ecore_x_e_illume_focus_back_send(win->xwin);
2306 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2307 ecore_x_e_illume_focus_forward_send(win->xwin);
2309 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2310 ecore_x_e_illume_focus_home_send(win->xwin);
2312 case ELM_ILLUME_COMMAND_CLOSE:
2313 ecore_x_e_illume_close_send(win->xwin);
2323 elm_win_inlined_image_object_get(Evas_Object *obj)
2326 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2327 win = elm_widget_data_get(obj);
2328 if (!win) return NULL;
2329 return win->img_obj;
2333 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2337 ELM_CHECK_WIDTYPE(obj, widtype);
2339 win = elm_widget_data_get(obj);
2340 enabled = !!enabled;
2341 if (win->focus_highlight.enabled == enabled)
2344 win->focus_highlight.enabled = enabled;
2346 if (win->focus_highlight.enabled)
2347 _elm_win_focus_highlight_init(win);
2349 _elm_win_focus_highlight_shutdown(win);
2353 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2357 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2359 win = elm_widget_data_get(obj);
2360 return win->focus_highlight.enabled;
2364 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2368 ELM_CHECK_WIDTYPE(obj, widtype);
2370 win = elm_widget_data_get(obj);
2371 eina_stringshare_replace(&win->focus_highlight.style, style);
2372 win->focus_highlight.changed_theme = EINA_TRUE;
2373 _elm_win_focus_highlight_reconfigure_job_start(win);
2377 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2381 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2383 win = elm_widget_data_get(obj);
2384 return win->focus_highlight.style;
2387 typedef struct _Widget_Data Widget_Data;
2392 Evas_Object *content;
2395 static void _del_hook(Evas_Object *obj);
2396 static void _theme_hook(Evas_Object *obj);
2397 static void _sizing_eval(Evas_Object *obj);
2398 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2399 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2401 static const char *widtype2 = NULL;
2404 _del_hook(Evas_Object *obj)
2406 Widget_Data *wd = elm_widget_data_get(obj);
2412 _theme_hook(Evas_Object *obj)
2414 Widget_Data *wd = elm_widget_data_get(obj);
2415 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2417 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2422 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2424 Widget_Data *wd = elm_widget_data_get(obj);
2429 /* Try Focus cycle in subitem */
2432 elm_widget_focus_next_get(wd->content, dir, next);
2437 *next = (Evas_Object *)obj;
2442 _sizing_eval(Evas_Object *obj)
2444 Widget_Data *wd = elm_widget_data_get(obj);
2445 Evas_Coord minw = -1, minh = -1;
2447 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2448 edje_object_size_min_calc(wd->frm, &minw, &minh);
2449 evas_object_size_hint_min_set(obj, minw, minh);
2450 evas_object_size_hint_max_set(obj, -1, -1);
2454 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2460 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2462 Widget_Data *wd = elm_widget_data_get(obj);
2463 Evas_Object *sub = event_info;
2464 if (sub == wd->content)
2466 evas_object_event_callback_del_full
2467 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2474 elm_win_inwin_add(Evas_Object *obj)
2480 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2481 win = elm_widget_data_get(obj);
2482 if (!win) return NULL;
2483 wd = ELM_NEW(Widget_Data);
2484 obj2 = elm_widget_add(win->evas);
2485 elm_widget_type_set(obj2, "inwin");
2486 ELM_SET_WIDTYPE(widtype2, "inwin");
2487 elm_widget_sub_object_add(obj, obj2);
2488 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2489 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2490 elm_win_resize_object_add(obj, obj2);
2492 elm_widget_data_set(obj2, wd);
2493 elm_widget_del_hook_set(obj2, _del_hook);
2494 elm_widget_theme_hook_set(obj2, _theme_hook);
2495 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2496 elm_widget_can_focus_set(obj2, EINA_TRUE);
2497 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2499 wd->frm = edje_object_add(win->evas);
2500 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2501 elm_widget_resize_object_set(obj2, wd->frm);
2503 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2510 elm_win_inwin_activate(Evas_Object *obj)
2512 ELM_CHECK_WIDTYPE(obj, widtype2);
2513 Widget_Data *wd = elm_widget_data_get(obj);
2515 evas_object_raise(obj);
2516 evas_object_show(obj);
2517 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2518 elm_object_focus_set(obj, EINA_TRUE);
2522 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2524 ELM_CHECK_WIDTYPE(obj, widtype2);
2525 Widget_Data *wd = elm_widget_data_get(obj);
2527 if (wd->content == content) return;
2528 if (wd->content) evas_object_del(wd->content);
2529 wd->content = content;
2532 elm_widget_sub_object_add(obj, content);
2533 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2534 _changed_size_hints, obj);
2535 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2541 elm_win_inwin_content_get(const Evas_Object *obj)
2543 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2544 Widget_Data *wd = elm_widget_data_get(obj);
2545 if (!wd) return NULL;
2550 elm_win_inwin_content_unset(Evas_Object *obj)
2552 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2553 Widget_Data *wd = elm_widget_data_get(obj);
2554 if (!wd) return NULL;
2555 if (!wd->content) return NULL;
2556 Evas_Object *content = wd->content;
2557 elm_widget_sub_object_del(obj, wd->content);
2558 edje_object_part_unswallow(wd->frm, wd->content);
2563 /* windowing spcific calls - shall we do this differently? */
2565 static Ecore_X_Window
2566 _elm_ee_win_get(const Evas_Object *obj)
2569 #ifdef HAVE_ELEMENTARY_X
2570 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2571 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2577 * Get the Ecore_X_Window of an Evas_Object
2579 * @param obj The object
2581 * @return The Ecore_X_Window of @p obj
2586 elm_win_xwindow_get(const Evas_Object *obj)
2592 type = elm_widget_type_get(obj);
2593 if (!type) return 0;
2594 if (type != widtype) return _elm_ee_win_get(obj);
2595 #ifdef HAVE_ELEMENTARY_X
2596 win = elm_widget_data_get(obj);
2598 if (win->xwin) return win->xwin;
2599 if (win->parent) return elm_win_xwindow_get(win->parent);