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 if (!elm_widget_focus_get(win->win_obj))
310 elm_widget_focus_restore(win->win_obj);
311 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
312 win->focus_highlight.cur.visible = EINA_TRUE;
313 _elm_win_focus_highlight_reconfigure_job_start(win);
317 else if (win->img_obj)
324 _elm_win_focus_out(Ecore_Evas *ee)
326 Evas_Object *obj = ecore_evas_object_associate_get(ee);
330 win = elm_widget_data_get(obj);
332 elm_object_focus_set(win->win_obj, EINA_FALSE);
333 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
334 win->focus_highlight.cur.visible = EINA_FALSE;
335 _elm_win_focus_highlight_reconfigure_job_start(win);
339 else if (win->img_obj)
346 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
348 Elm_Win *wd = elm_widget_data_get(obj);
349 const Eina_List *items;
350 void *(*list_data_get) (const Eina_List *list);
358 if (!(items = elm_widget_focus_custom_chain_get(obj)))
364 list_data_get = eina_list_data_get;
366 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
372 *next = (Evas_Object *)obj;
377 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
379 Elm_Win *win = elm_widget_data_get(obj);
383 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
385 evas_object_focus_set(obj, elm_widget_focus_get(obj));
389 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
391 if (type == EVAS_CALLBACK_KEY_DOWN)
393 Evas_Event_Key_Down *ev = event_info;
394 if (!strcmp(ev->keyname, "Tab"))
396 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
397 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
399 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
400 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
403 else if ((!strcmp(ev->keyname, "Left")) ||
404 (!strcmp(ev->keyname, "KP_Left")))
406 //TODO : woohyun jung
408 else if ((!strcmp(ev->keyname, "Right")) ||
409 (!strcmp(ev->keyname, "KP_Right")))
411 //TODO : woohyun jung
413 else if ((!strcmp(ev->keyname, "Up")) ||
414 (!strcmp(ev->keyname, "KP_Up")))
416 //TODO : woohyun jung
418 else if ((!strcmp(ev->keyname, "Down")) ||
419 (!strcmp(ev->keyname, "KP_Down")))
421 //TODO : woohyun jung
429 _deferred_ecore_evas_free(void *data)
431 ecore_evas_free(data);
432 _elm_win_deferred_free--;
436 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
440 elm_object_focus_set(obj, EINA_TRUE);
441 if (win->shot.info) _shot_handle(win);
445 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
452 else if (win->img_obj)
454 evas_object_hide(win->img_obj);
459 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
466 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
467 _elm_win_obj_callback_parent_del, win);
470 if (win->autodel_clear) *(win->autodel_clear) = -1;
471 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
472 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
475 ecore_evas_callback_delete_request_set(win->ee, NULL);
476 ecore_evas_callback_resize_set(win->ee, NULL);
478 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
479 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
480 if (win->shot.info) eina_stringshare_del(win->shot.info);
481 if (win->shot.timer) ecore_timer_del(win->shot.timer);
482 while (((child = evas_object_bottom_get(win->evas))) &&
485 evas_object_del(child);
487 while (((child = evas_object_top_get(win->evas))) &&
490 evas_object_del(child);
492 #ifdef HAVE_ELEMENTARY_X
493 if (win->client_message_handler)
494 ecore_event_handler_del(win->client_message_handler);
496 // FIXME: Why are we flushing edje on every window destroy ??
497 // edje_file_cache_flush();
498 // edje_collection_cache_flush();
499 // evas_image_cache_flush(win->evas);
500 // evas_font_cache_flush(win->evas);
501 // FIXME: we are in the del handler for the object and delete the canvas
502 // that lives under it from the handler... nasty. deferring doesn't help either
512 ecore_job_add(_deferred_ecore_evas_free, win->ee);
513 _elm_win_deferred_free++;
517 _elm_win_focus_highlight_shutdown(win);
518 eina_stringshare_del(win->focus_highlight.style);
522 if ((!_elm_win_list) &&
523 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
525 edje_file_cache_flush();
526 edje_collection_cache_flush();
527 evas_image_cache_flush(e);
528 evas_font_cache_flush(e);
534 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
537 if (!win->img_obj) return;
538 evas_object_event_callback_del_full
539 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
540 evas_object_del(win->img_obj);
544 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
547 if (obj == win->parent) win->parent = NULL;
551 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
557 if ((x != win->screen.x) || (y != win->screen.y))
561 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
566 evas_object_move(obj, x, y);
571 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
574 // this is called to make sure all smart containers have calculated their
575 // sizes BEFORE we show the window to make sure it initially appears at
576 // our desired size (ie min size is known first)
577 evas_smart_objects_calculate(evas_object_evas_get(obj));
578 evas_object_show(obj);
582 else if (win->img_obj)
584 evas_object_show(win->img_obj);
589 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
593 if (ecore_evas_override_get(win->ee))
597 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
600 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
605 else if (win->img_obj)
609 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
612 // evas_object_move(win->img_obj, x, y);
617 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
624 else if (win->img_obj)
626 Evas_Coord w = 1, h = 1;
628 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
631 evas_object_image_size_set(win->img_obj, w, h);
636 _elm_win_delete_request(Ecore_Evas *ee)
638 Evas_Object *obj = ecore_evas_object_associate_get(ee);
640 if (strcmp(elm_widget_type_get(obj), "win")) return;
642 win = elm_widget_data_get(obj);
644 int autodel = win->autodel;
645 win->autodel_clear = &autodel;
646 evas_object_ref(win->win_obj);
647 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
648 // FIXME: if above callback deletes - then the below will be invalid
649 if (autodel) evas_object_del(win->win_obj);
650 else win->autodel_clear = NULL;
651 evas_object_unref(win->win_obj);
655 _elm_win_resize_job(void *data)
662 win->deferred_resize_job = NULL;
663 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
664 evas_object_resize(win->win_obj, w, h);
668 else if (win->img_obj)
671 EINA_LIST_FOREACH(win->subobjs, l, obj)
673 evas_object_move(obj, 0, 0);
674 evas_object_resize(obj, w, h);
678 #ifdef HAVE_ELEMENTARY_X
680 _elm_win_xwindow_get(Elm_Win *win)
684 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
685 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
687 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
689 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
690 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
691 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
692 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
693 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
694 ENGINE_COMPARE(ELM_OPENGL_SDL))
697 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
699 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
701 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
703 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
706 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
708 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
711 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
713 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
715 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
717 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
719 #undef ENGINE_COMPARE
723 #ifdef HAVE_ELEMENTARY_X
725 _elm_win_xwin_update(Elm_Win *win)
727 _elm_win_xwindow_get(win);
732 win2 = elm_widget_data_get(win->parent);
736 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
740 if (!win->xwin) return; /* nothing more to do */
745 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
747 case ELM_WIN_DIALOG_BASIC:
748 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
750 case ELM_WIN_DESKTOP:
751 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
754 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
756 case ELM_WIN_TOOLBAR:
757 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
760 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
762 case ELM_WIN_UTILITY:
763 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
766 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
768 case ELM_WIN_DROPDOWN_MENU:
769 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
771 case ELM_WIN_POPUP_MENU:
772 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
774 case ELM_WIN_TOOLTIP:
775 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
777 case ELM_WIN_NOTIFICATION:
778 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
781 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
784 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
789 ecore_x_e_virtual_keyboard_state_set
790 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
795 _elm_win_eval_subobjs(Evas_Object *obj)
798 const Evas_Object *child;
800 Elm_Win *win = elm_widget_data_get(obj);
801 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
805 EINA_LIST_FOREACH(win->subobjs, l, child)
807 evas_object_size_hint_weight_get(child, &wx, &wy);
808 if (wx == 0.0) xx = 0;
809 if (wy == 0.0) xy = 0;
811 evas_object_size_hint_min_get(child, &w, &h);
814 if (w > minw) minw = w;
815 if (h > minh) minh = h;
817 evas_object_size_hint_max_get(child, &w, &h);
820 if (maxw == -1) maxw = w;
821 else if ((w > 0) && (w < maxw)) maxw = w;
822 if (maxh == -1) maxh = h;
823 else if ((h > 0) && (h < maxh)) maxh = h;
825 if (!xx) maxw = minw;
827 if (!xy) maxh = minh;
829 evas_object_size_hint_min_set(obj, minw, minh);
830 evas_object_size_hint_max_set(obj, maxw, maxh);
831 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
832 if (w < minw) w = minw;
833 if (h < minh) h = minh;
834 if ((maxw >= 0) && (w > maxw)) w = maxw;
835 if ((maxh >= 0) && (h > maxh)) h = maxh;
836 evas_object_resize(obj, w, h);
840 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
842 Elm_Win *win = elm_widget_data_get(data);
843 win->subobjs = eina_list_remove(win->subobjs, obj);
844 _elm_win_eval_subobjs(win->win_obj);
848 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
850 _elm_win_eval_subobjs(data);
854 _elm_win_shutdown(void)
856 while (_elm_win_list)
857 evas_object_del(_elm_win_list->data);
861 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
868 EINA_LIST_FOREACH(_elm_win_list, l, obj)
869 elm_widget_theme(obj);
873 EINA_LIST_FOREACH(_elm_win_list, l, obj)
874 elm_widget_theme_specific(obj, th, EINA_FALSE);
878 #ifdef HAVE_ELEMENTARY_X
880 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
883 Ecore_X_Event_Client_Message *e = event;
885 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
886 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
888 if ((unsigned)e->data.l[0] == win->xwin)
890 Evas *evas = evas_object_evas_get(win->win_obj);
893 edje_file_cache_flush();
894 edje_collection_cache_flush();
895 evas_image_cache_flush(evas);
896 evas_font_cache_flush(evas);
900 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
902 if ((unsigned)e->data.l[0] == win->xwin)
904 Evas *evas = evas_object_evas_get(win->win_obj);
907 edje_file_cache_flush();
908 edje_collection_cache_flush();
909 evas_image_cache_flush(evas);
910 evas_font_cache_flush(evas);
911 evas_render_dump(evas);
915 return ECORE_CALLBACK_PASS_ON;
920 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
924 win->focus_highlight.geometry_changed = EINA_TRUE;
925 _elm_win_focus_highlight_reconfigure_job_start(win);
929 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
933 win->focus_highlight.geometry_changed = EINA_TRUE;
934 _elm_win_focus_highlight_reconfigure_job_start(win);
938 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
942 win->focus_highlight.cur.target = NULL;
944 _elm_win_focus_highlight_reconfigure_job_start(win);
948 _elm_win_focus_target_callbacks_add(Elm_Win *win)
950 Evas_Object *obj = win->focus_highlight.cur.target;
952 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
953 _elm_win_focus_target_move, win);
954 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
955 _elm_win_focus_target_resize, win);
956 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
957 _elm_win_focus_target_del, win);
961 _elm_win_focus_target_callbacks_del(Elm_Win *win)
963 Evas_Object *obj = win->focus_highlight.cur.target;
965 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
966 _elm_win_focus_target_move, win);
967 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
968 _elm_win_focus_target_resize, win);
969 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
970 _elm_win_focus_target_del, win);
974 _elm_win_focus_target_get(Evas_Object *obj)
976 Evas_Object *o = obj;
980 if (elm_widget_is(o))
982 if (!elm_widget_highlight_ignore_get(o))
984 o = elm_widget_parent_get(o);
986 o = evas_object_smart_parent_get(o);
990 o = elm_widget_parent_widget_get(o);
992 o = evas_object_smart_parent_get(o);
1001 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1003 Evas_Object *obj = event_info, *target;
1004 Elm_Win *win = data;
1006 if (win->focus_highlight.cur.target == obj)
1009 target = _elm_win_focus_target_get(obj);
1010 win->focus_highlight.cur.target = target;
1011 if (elm_widget_highlight_in_theme_get(target))
1012 win->focus_highlight.cur.handled = EINA_TRUE;
1014 _elm_win_focus_target_callbacks_add(win);
1016 _elm_win_focus_highlight_reconfigure_job_start(win);
1020 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1022 Elm_Win *win = data;
1024 if (!win->focus_highlight.cur.target)
1027 if (!win->focus_highlight.cur.handled)
1028 _elm_win_focus_target_callbacks_del(win);
1029 win->focus_highlight.cur.target = NULL;
1030 win->focus_highlight.cur.handled = EINA_FALSE;
1032 _elm_win_focus_highlight_reconfigure_job_start(win);
1036 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1038 evas_object_hide(obj);
1042 _elm_win_focus_highlight_init(Elm_Win *win)
1044 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1045 _elm_win_object_focus_in, win);
1046 evas_event_callback_add(win->evas,
1047 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1048 _elm_win_object_focus_out, win);
1050 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1052 win->focus_highlight.top = edje_object_add(win->evas);
1053 win->focus_highlight.changed_theme = EINA_TRUE;
1054 edje_object_signal_callback_add(win->focus_highlight.top,
1055 "elm,action,focus,hide,end", "",
1056 _elm_win_focus_highlight_hide, NULL);
1057 edje_object_signal_callback_add(win->focus_highlight.top,
1058 "elm,action,focus,anim,end", "",
1059 _elm_win_focus_highlight_anim_end, win);
1060 _elm_win_focus_highlight_reconfigure_job_start(win);
1064 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1066 _elm_win_focus_highlight_reconfigure_job_stop(win);
1067 if (win->focus_highlight.cur.target)
1069 _elm_win_focus_target_callbacks_del(win);
1070 win->focus_highlight.cur.target = NULL;
1072 if (win->focus_highlight.top)
1074 evas_object_del(win->focus_highlight.top);
1075 win->focus_highlight.top = NULL;
1078 evas_event_callback_del_full(win->evas,
1079 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1080 _elm_win_object_focus_in, win);
1081 evas_event_callback_del_full(win->evas,
1082 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1083 _elm_win_object_focus_out, win);
1087 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1091 top = win->focus_highlight.top;
1096 evas_object_show(top);
1097 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1103 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1108 _elm_win_focus_highlight_reconfigure_job(void *data)
1110 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1114 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1116 if (win->focus_highlight.reconf_job)
1117 ecore_job_del(win->focus_highlight.reconf_job);
1118 win->focus_highlight.reconf_job = ecore_job_add(
1119 _elm_win_focus_highlight_reconfigure_job, win);
1123 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1125 if (win->focus_highlight.reconf_job)
1126 ecore_job_del(win->focus_highlight.reconf_job);
1127 win->focus_highlight.reconf_job = NULL;
1131 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1133 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1134 Evas_Coord x, y, w, h;
1136 clip = evas_object_clip_get(target);
1137 evas_object_geometry_get(target, &x, &y, &w, &h);
1139 evas_object_move(obj, x, y);
1140 evas_object_resize(obj, w, h);
1141 evas_object_clip_set(obj, clip);
1145 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1147 Evas_Coord tx, ty, tw, th;
1148 Evas_Coord w, h, px, py, pw, ph;
1149 Edje_Message_Int_Set *m;
1150 Evas_Object *previous = win->focus_highlight.prev.target;
1151 Evas_Object *target = win->focus_highlight.cur.target;
1153 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1154 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1155 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1156 evas_object_move(obj, 0, 0);
1157 evas_object_resize(obj, tw, th);
1158 evas_object_clip_unset(obj);
1160 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1170 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1174 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1176 Elm_Win *win = data;
1177 _elm_win_focus_highlight_simple_setup(win, obj);
1181 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1183 Evas_Object *target = win->focus_highlight.cur.target;
1184 Evas_Object *previous = win->focus_highlight.prev.target;
1185 Evas_Object *top = win->focus_highlight.top;
1186 Eina_Bool visible_changed;
1187 Eina_Bool common_visible;
1188 const char *sig = NULL;
1190 _elm_win_focus_highlight_reconfigure_job_stop(win);
1192 visible_changed = (win->focus_highlight.cur.visible !=
1193 win->focus_highlight.prev.visible);
1195 if ((target == previous) && (!visible_changed) &&
1196 (!win->focus_highlight.geometry_changed))
1199 if ((previous) && (win->focus_highlight.prev.handled))
1200 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1203 common_visible = EINA_FALSE;
1204 else if (win->focus_highlight.cur.handled)
1206 common_visible = EINA_FALSE;
1207 if (win->focus_highlight.cur.visible)
1208 sig = "elm,action,focus_highlight,show";
1210 sig = "elm,action,focus_highlight,hide";
1213 common_visible = win->focus_highlight.cur.visible;
1215 _elm_win_focus_highlight_visible_set(win, common_visible);
1217 elm_widget_signal_emit(target, sig, "elm");
1219 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1222 if (win->focus_highlight.changed_theme)
1225 if (win->focus_highlight.style)
1226 str = win->focus_highlight.style;
1229 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1231 win->focus_highlight.changed_theme = EINA_FALSE;
1233 if (_elm_config->focus_highlight_animate)
1235 str = edje_object_data_get(win->focus_highlight.top, "animate");
1236 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1240 if ((win->focus_highlight.top_animate) && (previous) &&
1241 (!win->focus_highlight.prev.handled))
1242 _elm_win_focus_highlight_anim_setup(win, top);
1244 _elm_win_focus_highlight_simple_setup(win, top);
1245 evas_object_raise(top);
1248 win->focus_highlight.geometry_changed = EINA_FALSE;
1249 win->focus_highlight.prev = win->focus_highlight.cur;
1254 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1256 Evas_Event_Key_Down *ev = event_info;
1258 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1262 if ((strcmp(ev->keyname, "F12")) ||
1263 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1266 printf("Tree graph generated.\n");
1267 elm_object_tree_dot_dump(obj, "./dump.dot");
1272 _win_img_hide(void *data,
1274 Evas_Object *obj __UNUSED__,
1275 void *event_info __UNUSED__)
1277 Elm_Win *win = data;
1279 elm_widget_focus_hide_handle(win->win_obj);
1283 _win_img_mouse_up(void *data,
1285 Evas_Object *obj __UNUSED__,
1288 Elm_Win *win = data;
1289 Evas_Event_Mouse_Up *ev = event_info;
1290 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1291 elm_widget_focus_mouse_up_handle(win->win_obj);
1295 _win_img_focus_in(void *data,
1297 Evas_Object *obj __UNUSED__,
1298 void *event_info __UNUSED__)
1300 Elm_Win *win = data;
1301 elm_widget_focus_steal(win->win_obj);
1305 _win_img_focus_out(void *data,
1307 Evas_Object *obj __UNUSED__,
1308 void *event_info __UNUSED__)
1310 Elm_Win *win = data;
1311 elm_widget_focused_object_clear(win->win_obj);
1315 _win_inlined_image_set(Elm_Win *win)
1317 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1318 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1319 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1320 _elm_win_obj_callback_img_obj_del, win);
1322 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1323 _win_img_hide, win);
1324 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1325 _win_img_mouse_up, win);
1326 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1327 _win_img_focus_in, win);
1328 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1329 _win_img_focus_out, win);
1333 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1337 const char *fontpath;
1339 win = ELM_NEW(Elm_Win);
1341 #define FALLBACK_TRY(engine) \
1344 CRITICAL(engine " engine creation failed. Trying software X11."); \
1345 elm_engine_set(ELM_SOFTWARE_X11); \
1346 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1348 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1352 case ELM_WIN_INLINED_IMAGE:
1355 Evas *e = evas_object_evas_get(parent);
1358 ee = ecore_evas_ecore_evas_get(e);
1360 win->img_obj = ecore_evas_object_image_new(ee);
1361 if (!win->img_obj) break;
1362 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1365 _win_inlined_image_set(win);
1368 evas_object_del(win->img_obj);
1369 win->img_obj = NULL;
1373 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1375 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1376 #ifdef HAVE_ELEMENTARY_X
1377 win->client_message_handler = ecore_event_handler_add
1378 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1381 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1383 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1384 FALLBACK_TRY("Sofware FB");
1386 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1388 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1389 FALLBACK_TRY("Sofware DirectFB");
1391 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1393 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1394 FALLBACK_TRY("Sofware-16");
1395 #ifdef HAVE_ELEMENTARY_X
1396 win->client_message_handler = ecore_event_handler_add
1397 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1400 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1402 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1403 FALLBACK_TRY("Sofware-8");
1404 #ifdef HAVE_ELEMENTARY_X
1405 win->client_message_handler = ecore_event_handler_add
1406 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1410 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1412 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1413 FALLBACK_TRY("XRender");
1414 #ifdef HAVE_ELEMENTARY_X
1415 win->client_message_handler = ecore_event_handler_add
1416 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1420 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1425 if (_elm_config->vsync)
1427 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1433 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1435 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1436 FALLBACK_TRY("OpenGL");
1437 #ifdef HAVE_ELEMENTARY_X
1438 win->client_message_handler = ecore_event_handler_add
1439 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1442 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1444 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1445 FALLBACK_TRY("Sofware Win32");
1447 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1449 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1450 FALLBACK_TRY("Sofware-16-WinCE");
1452 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1454 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1455 FALLBACK_TRY("Sofware SDL");
1457 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1459 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1460 FALLBACK_TRY("Sofware-16-SDL");
1462 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1464 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1465 FALLBACK_TRY("OpenGL SDL");
1467 else if (ENGINE_COMPARE(ELM_BUFFER))
1469 win->ee = ecore_evas_buffer_new(1, 1);
1471 else if (!strncmp(_elm_config->engine, "shot:", 5))
1473 win->ee = ecore_evas_buffer_new(1, 1);
1474 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1475 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1484 ERR("Cannot create window.");
1488 #ifdef HAVE_ELEMENTARY_X
1489 _elm_win_xwindow_get(win);
1491 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1492 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1493 // bg pixmap done by x - has other issues like can be redrawn by x before it
1494 // is filled/ready by app
1495 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1498 win->parent = parent;
1500 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1501 _elm_win_obj_callback_parent_del, win);
1503 win->evas = ecore_evas_get(win->ee);
1504 win->win_obj = elm_widget_add(win->evas);
1505 elm_widget_type_set(win->win_obj, "win");
1506 ELM_SET_WIDTYPE(widtype, "win");
1507 elm_widget_data_set(win->win_obj, win);
1508 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1509 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1510 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1511 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1512 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1513 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1514 evas_object_move(win->win_obj, 0, 0);
1515 evas_object_resize(win->win_obj, 1, 1);
1516 evas_object_layer_set(win->win_obj, 50);
1517 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1519 if (type == ELM_WIN_INLINED_IMAGE)
1520 elm_widget_parent2_set(win->win_obj, parent);
1521 ecore_evas_object_associate(win->ee, win->win_obj,
1522 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1523 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1524 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1525 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1526 _elm_win_obj_callback_show, win);
1527 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1528 _elm_win_obj_callback_hide, win);
1529 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1530 _elm_win_obj_callback_del, win);
1531 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1532 _elm_win_obj_callback_move, win);
1533 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1534 _elm_win_obj_callback_resize, win);
1536 evas_object_intercept_move_callback_add(win->win_obj,
1537 _elm_win_obj_intercept_move, win);
1538 evas_object_intercept_show_callback_add(win->win_obj,
1539 _elm_win_obj_intercept_show, win);
1541 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1542 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1543 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1544 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1545 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1546 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1547 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1548 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1549 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1550 evas_font_path_append(win->evas, fontpath);
1551 if (!_elm_config->font_hinting)
1552 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1553 else if (_elm_config->font_hinting == 1)
1554 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1555 else if (_elm_config->font_hinting == 2)
1556 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1558 #ifdef HAVE_ELEMENTARY_X
1559 _elm_win_xwin_update(win);
1562 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1564 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1566 ecore_evas_fullscreen_set(win->ee, 1);
1568 #undef ENGINE_COMPARE
1570 if (_elm_config->focus_highlight_enable)
1571 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1574 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1575 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1576 _debug_key_down, win);
1578 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1580 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1583 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1585 return win->win_obj;
1589 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1593 ELM_CHECK_WIDTYPE(obj, widtype);
1594 win = elm_widget_data_get(obj);
1596 if (eina_list_data_find(win->subobjs, subobj)) return;
1597 win->subobjs = eina_list_append(win->subobjs, subobj);
1598 elm_widget_sub_object_add(obj, subobj);
1599 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1600 _elm_win_subobj_callback_del, obj);
1601 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1602 _elm_win_subobj_callback_changed_size_hints,
1604 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1605 evas_object_move(subobj, 0, 0);
1606 evas_object_resize(subobj, w, h);
1607 _elm_win_eval_subobjs(obj);
1611 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1614 ELM_CHECK_WIDTYPE(obj, widtype);
1615 win = elm_widget_data_get(obj);
1617 evas_object_event_callback_del_full(subobj,
1618 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1619 _elm_win_subobj_callback_changed_size_hints,
1621 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1622 _elm_win_subobj_callback_del, obj);
1623 win->subobjs = eina_list_remove(win->subobjs, subobj);
1624 elm_widget_sub_object_del(obj, subobj);
1625 _elm_win_eval_subobjs(obj);
1629 elm_win_title_set(Evas_Object *obj, const char *title)
1632 ELM_CHECK_WIDTYPE(obj, widtype);
1633 win = elm_widget_data_get(obj);
1635 ecore_evas_title_set(win->ee, title);
1639 elm_win_title_get(const Evas_Object *obj)
1642 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1643 win = elm_widget_data_get(obj);
1644 if (!win) return NULL;
1645 return ecore_evas_title_get(win->ee);
1649 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1652 ELM_CHECK_WIDTYPE(obj, widtype);
1653 win = elm_widget_data_get(obj);
1655 win->autodel = autodel;
1659 elm_win_autodel_get(const Evas_Object *obj)
1662 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1663 win = elm_widget_data_get(obj);
1664 if (!win) return EINA_FALSE;
1665 return win->autodel;
1669 elm_win_activate(Evas_Object *obj)
1672 ELM_CHECK_WIDTYPE(obj, widtype);
1673 win = elm_widget_data_get(obj);
1675 ecore_evas_activate(win->ee);
1679 elm_win_lower(Evas_Object *obj)
1682 ELM_CHECK_WIDTYPE(obj, widtype);
1683 win = elm_widget_data_get(obj);
1685 ecore_evas_lower(win->ee);
1689 elm_win_raise(Evas_Object *obj)
1692 ELM_CHECK_WIDTYPE(obj, widtype);
1693 win = elm_widget_data_get(obj);
1695 ecore_evas_raise(win->ee);
1699 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1702 ELM_CHECK_WIDTYPE(obj, widtype);
1703 win = elm_widget_data_get(obj);
1705 ecore_evas_borderless_set(win->ee, borderless);
1706 #ifdef HAVE_ELEMENTARY_X
1707 _elm_win_xwin_update(win);
1712 elm_win_borderless_get(const Evas_Object *obj)
1715 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1716 win = elm_widget_data_get(obj);
1717 if (!win) return EINA_FALSE;
1718 return ecore_evas_borderless_get(win->ee);
1722 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1725 ELM_CHECK_WIDTYPE(obj, widtype);
1726 win = elm_widget_data_get(obj);
1728 ecore_evas_shaped_set(win->ee, shaped);
1729 #ifdef HAVE_ELEMENTARY_X
1730 _elm_win_xwin_update(win);
1735 elm_win_shaped_get(const Evas_Object *obj)
1738 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1739 win = elm_widget_data_get(obj);
1740 if (!win) return EINA_FALSE;
1741 return ecore_evas_shaped_get(win->ee);
1745 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1748 ELM_CHECK_WIDTYPE(obj, widtype);
1749 win = elm_widget_data_get(obj);
1754 else if (win->img_obj)
1756 evas_object_image_alpha_set(win->img_obj, alpha);
1760 #ifdef HAVE_ELEMENTARY_X
1765 if (!_elm_config->compositing)
1766 elm_win_shaped_set(obj, alpha);
1768 ecore_evas_alpha_set(win->ee, alpha);
1771 ecore_evas_alpha_set(win->ee, alpha);
1772 _elm_win_xwin_update(win);
1776 ecore_evas_alpha_set(win->ee, alpha);
1781 elm_win_alpha_get(const Evas_Object *obj)
1784 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1785 win = elm_widget_data_get(obj);
1786 if (!win) return EINA_FALSE;
1787 return ecore_evas_alpha_get(win->ee);
1791 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1794 ELM_CHECK_WIDTYPE(obj, widtype);
1795 win = elm_widget_data_get(obj);
1801 else if (win->img_obj)
1803 evas_object_image_alpha_set(win->img_obj, transparent);
1807 #ifdef HAVE_ELEMENTARY_X
1810 ecore_evas_transparent_set(win->ee, transparent);
1811 _elm_win_xwin_update(win);
1815 ecore_evas_transparent_set(win->ee, transparent);
1820 elm_win_transparent_get(const Evas_Object *obj)
1823 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1824 win = elm_widget_data_get(obj);
1825 if (!win) return EINA_FALSE;
1827 return ecore_evas_transparent_get(win->ee);
1831 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1834 ELM_CHECK_WIDTYPE(obj, widtype);
1835 win = elm_widget_data_get(obj);
1837 ecore_evas_override_set(win->ee, override);
1838 #ifdef HAVE_ELEMENTARY_X
1839 _elm_win_xwin_update(win);
1844 elm_win_override_get(const Evas_Object *obj)
1847 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1848 win = elm_widget_data_get(obj);
1849 if (!win) return EINA_FALSE;
1850 return ecore_evas_override_get(win->ee);
1854 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1857 ELM_CHECK_WIDTYPE(obj, widtype);
1858 win = elm_widget_data_get(obj);
1861 // YYY: handle if win->img_obj
1862 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1863 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1864 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1866 // these engines... can ONLY be fullscreen
1871 ecore_evas_fullscreen_set(win->ee, fullscreen);
1872 #ifdef HAVE_ELEMENTARY_X
1873 _elm_win_xwin_update(win);
1876 #undef ENGINE_COMPARE
1880 elm_win_fullscreen_get(const Evas_Object *obj)
1883 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1884 win = elm_widget_data_get(obj);
1885 if (!win) return EINA_FALSE;
1887 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1888 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1889 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1891 // these engines... can ONLY be fullscreen
1896 return ecore_evas_fullscreen_get(win->ee);
1898 #undef ENGINE_COMPARE
1902 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1905 ELM_CHECK_WIDTYPE(obj, widtype);
1906 win = elm_widget_data_get(obj);
1908 // YYY: handle if win->img_obj
1909 ecore_evas_maximized_set(win->ee, maximized);
1910 #ifdef HAVE_ELEMENTARY_X
1911 _elm_win_xwin_update(win);
1916 elm_win_maximized_get(const Evas_Object *obj)
1919 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1920 win = elm_widget_data_get(obj);
1921 if (!win) return EINA_FALSE;
1922 return ecore_evas_maximized_get(win->ee);
1926 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1929 ELM_CHECK_WIDTYPE(obj, widtype);
1930 win = elm_widget_data_get(obj);
1932 ecore_evas_iconified_set(win->ee, iconified);
1933 #ifdef HAVE_ELEMENTARY_X
1934 _elm_win_xwin_update(win);
1939 elm_win_iconified_get(const Evas_Object *obj)
1942 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1943 win = elm_widget_data_get(obj);
1944 if (!win) return EINA_FALSE;
1945 return ecore_evas_iconified_get(win->ee);
1949 elm_win_layer_set(Evas_Object *obj, int layer)
1952 ELM_CHECK_WIDTYPE(obj, widtype);
1953 win = elm_widget_data_get(obj);
1955 ecore_evas_layer_set(win->ee, layer);
1956 #ifdef HAVE_ELEMENTARY_X
1957 _elm_win_xwin_update(win);
1962 elm_win_layer_get(const Evas_Object *obj)
1965 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1966 win = elm_widget_data_get(obj);
1967 if (!win) return -1;
1968 return ecore_evas_layer_get(win->ee);
1972 elm_win_rotation_set(Evas_Object *obj, int rotation)
1975 ELM_CHECK_WIDTYPE(obj, widtype);
1976 win = elm_widget_data_get(obj);
1978 if (win->rot == rotation) return;
1979 win->rot = rotation;
1980 ecore_evas_rotation_set(win->ee, rotation);
1981 evas_object_size_hint_min_set(obj, -1, -1);
1982 evas_object_size_hint_max_set(obj, -1, -1);
1983 _elm_win_eval_subobjs(obj);
1984 #ifdef HAVE_ELEMENTARY_X
1985 _elm_win_xwin_update(win);
1990 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1993 ELM_CHECK_WIDTYPE(obj, widtype);
1994 win = elm_widget_data_get(obj);
1996 if (win->rot == rotation) return;
1997 win->rot = rotation;
1998 ecore_evas_rotation_with_resize_set(win->ee, rotation);
1999 evas_object_size_hint_min_set(obj, -1, -1);
2000 evas_object_size_hint_max_set(obj, -1, -1);
2001 _elm_win_eval_subobjs(obj);
2002 #ifdef HAVE_ELEMENTARY_X
2003 _elm_win_xwin_update(win);
2008 elm_win_rotation_get(const Evas_Object *obj)
2011 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2012 win = elm_widget_data_get(obj);
2013 if (!win) return -1;
2018 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2021 ELM_CHECK_WIDTYPE(obj, widtype);
2022 win = elm_widget_data_get(obj);
2024 ecore_evas_sticky_set(win->ee, sticky);
2025 #ifdef HAVE_ELEMENTARY_X
2026 _elm_win_xwin_update(win);
2031 elm_win_sticky_get(const Evas_Object *obj)
2034 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2035 win = elm_widget_data_get(obj);
2036 if (!win) return EINA_FALSE;
2037 return ecore_evas_sticky_get(win->ee);
2041 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2044 ELM_CHECK_WIDTYPE(obj, widtype);
2045 win = elm_widget_data_get(obj);
2047 if (mode == win->kbdmode) return;
2048 #ifdef HAVE_ELEMENTARY_X
2049 _elm_win_xwindow_get(win);
2051 win->kbdmode = mode;
2052 #ifdef HAVE_ELEMENTARY_X
2054 ecore_x_e_virtual_keyboard_state_set
2055 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2059 EAPI Elm_Win_Keyboard_Mode
2060 elm_win_keyboard_mode_get(const Evas_Object *obj)
2063 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2064 win = elm_widget_data_get(obj);
2065 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2066 return win->kbdmode;
2070 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2073 ELM_CHECK_WIDTYPE(obj, widtype);
2074 win = elm_widget_data_get(obj);
2076 #ifdef HAVE_ELEMENTARY_X
2077 _elm_win_xwindow_get(win);
2079 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2084 elm_win_keyboard_win_get(const Evas_Object *obj)
2087 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2088 win = elm_widget_data_get(obj);
2089 if (!win) return EINA_FALSE;
2090 #ifdef HAVE_ELEMENTARY_X
2091 _elm_win_xwindow_get(win);
2093 return ecore_x_e_virtual_keyboard_get(win->xwin);
2099 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2102 ELM_CHECK_WIDTYPE(obj, widtype);
2103 win = elm_widget_data_get(obj);
2105 if (x) *x = win->screen.x;
2106 if (y) *y = win->screen.y;
2110 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2113 ELM_CHECK_WIDTYPE(obj, widtype);
2114 win = elm_widget_data_get(obj);
2116 #ifdef HAVE_ELEMENTARY_X
2117 _elm_win_xwindow_get(win);
2119 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2124 elm_win_conformant_get(const Evas_Object *obj)
2127 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2128 win = elm_widget_data_get(obj);
2129 if (!win) return EINA_FALSE;
2130 #ifdef HAVE_ELEMENTARY_X
2131 _elm_win_xwindow_get(win);
2133 return ecore_x_e_illume_conformant_get(win->xwin);
2139 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2142 ELM_CHECK_WIDTYPE(obj, widtype);
2143 win = elm_widget_data_get(obj);
2145 #ifdef HAVE_ELEMENTARY_X
2146 _elm_win_xwindow_get(win);
2149 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2152 Ecore_X_Window_State states[2];
2154 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2155 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2156 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2157 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2164 elm_win_quickpanel_get(const Evas_Object *obj)
2167 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2168 win = elm_widget_data_get(obj);
2169 if (!win) return EINA_FALSE;
2170 #ifdef HAVE_ELEMENTARY_X
2171 _elm_win_xwindow_get(win);
2173 return ecore_x_e_illume_quickpanel_get(win->xwin);
2179 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2182 ELM_CHECK_WIDTYPE(obj, widtype);
2183 win = elm_widget_data_get(obj);
2185 #ifdef HAVE_ELEMENTARY_X
2186 _elm_win_xwindow_get(win);
2188 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2193 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2196 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2197 win = elm_widget_data_get(obj);
2198 if (!win) return -1;
2199 #ifdef HAVE_ELEMENTARY_X
2200 _elm_win_xwindow_get(win);
2202 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2208 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2211 ELM_CHECK_WIDTYPE(obj, widtype);
2212 win = elm_widget_data_get(obj);
2214 #ifdef HAVE_ELEMENTARY_X
2215 _elm_win_xwindow_get(win);
2217 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2222 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2225 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2226 win = elm_widget_data_get(obj);
2227 if (!win) return -1;
2228 #ifdef HAVE_ELEMENTARY_X
2229 _elm_win_xwindow_get(win);
2231 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2237 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2240 ELM_CHECK_WIDTYPE(obj, widtype);
2241 win = elm_widget_data_get(obj);
2243 #ifdef HAVE_ELEMENTARY_X
2244 _elm_win_xwindow_get(win);
2246 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2251 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2254 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2255 win = elm_widget_data_get(obj);
2257 #ifdef HAVE_ELEMENTARY_X
2258 _elm_win_xwindow_get(win);
2260 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2266 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2269 ELM_CHECK_WIDTYPE(obj, widtype);
2270 win = elm_widget_data_get(obj);
2272 #ifdef HAVE_ELEMENTARY_X
2273 _elm_win_xwindow_get(win);
2278 Ecore_X_Window_State states[2];
2280 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2281 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2282 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2283 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2290 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2293 ELM_CHECK_WIDTYPE(obj, widtype);
2294 win = elm_widget_data_get(obj);
2296 #ifdef HAVE_ELEMENTARY_X
2297 _elm_win_xwindow_get(win);
2302 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2303 ecore_x_e_illume_focus_back_send(win->xwin);
2305 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2306 ecore_x_e_illume_focus_forward_send(win->xwin);
2308 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2309 ecore_x_e_illume_focus_home_send(win->xwin);
2311 case ELM_ILLUME_COMMAND_CLOSE:
2312 ecore_x_e_illume_close_send(win->xwin);
2322 elm_win_inlined_image_object_get(Evas_Object *obj)
2325 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2326 win = elm_widget_data_get(obj);
2327 if (!win) return NULL;
2328 return win->img_obj;
2332 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2336 ELM_CHECK_WIDTYPE(obj, widtype);
2338 win = elm_widget_data_get(obj);
2339 enabled = !!enabled;
2340 if (win->focus_highlight.enabled == enabled)
2343 win->focus_highlight.enabled = enabled;
2345 if (win->focus_highlight.enabled)
2346 _elm_win_focus_highlight_init(win);
2348 _elm_win_focus_highlight_shutdown(win);
2352 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2356 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2358 win = elm_widget_data_get(obj);
2359 return win->focus_highlight.enabled;
2363 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2367 ELM_CHECK_WIDTYPE(obj, widtype);
2369 win = elm_widget_data_get(obj);
2370 eina_stringshare_replace(&win->focus_highlight.style, style);
2371 win->focus_highlight.changed_theme = EINA_TRUE;
2372 _elm_win_focus_highlight_reconfigure_job_start(win);
2376 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2380 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2382 win = elm_widget_data_get(obj);
2383 return win->focus_highlight.style;
2386 typedef struct _Widget_Data Widget_Data;
2391 Evas_Object *content;
2394 static void _del_hook(Evas_Object *obj);
2395 static void _theme_hook(Evas_Object *obj);
2396 static void _sizing_eval(Evas_Object *obj);
2397 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2398 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2400 static const char *widtype2 = NULL;
2403 _del_hook(Evas_Object *obj)
2405 Widget_Data *wd = elm_widget_data_get(obj);
2411 _theme_hook(Evas_Object *obj)
2413 Widget_Data *wd = elm_widget_data_get(obj);
2414 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2416 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2421 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2423 Widget_Data *wd = elm_widget_data_get(obj);
2428 /* Try Focus cycle in subitem */
2431 elm_widget_focus_next_get(wd->content, dir, next);
2436 *next = (Evas_Object *)obj;
2441 _sizing_eval(Evas_Object *obj)
2443 Widget_Data *wd = elm_widget_data_get(obj);
2444 Evas_Coord minw = -1, minh = -1;
2446 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2447 edje_object_size_min_calc(wd->frm, &minw, &minh);
2448 evas_object_size_hint_min_set(obj, minw, minh);
2449 evas_object_size_hint_max_set(obj, -1, -1);
2453 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2459 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2461 Widget_Data *wd = elm_widget_data_get(obj);
2462 Evas_Object *sub = event_info;
2463 if (sub == wd->content)
2465 evas_object_event_callback_del_full
2466 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2473 elm_win_inwin_add(Evas_Object *obj)
2479 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2480 win = elm_widget_data_get(obj);
2481 if (!win) return NULL;
2482 wd = ELM_NEW(Widget_Data);
2483 obj2 = elm_widget_add(win->evas);
2484 elm_widget_type_set(obj2, "inwin");
2485 ELM_SET_WIDTYPE(widtype2, "inwin");
2486 elm_widget_sub_object_add(obj, obj2);
2487 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2488 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2489 elm_win_resize_object_add(obj, obj2);
2491 elm_widget_data_set(obj2, wd);
2492 elm_widget_del_hook_set(obj2, _del_hook);
2493 elm_widget_theme_hook_set(obj2, _theme_hook);
2494 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2495 elm_widget_can_focus_set(obj2, EINA_TRUE);
2496 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2498 wd->frm = edje_object_add(win->evas);
2499 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2500 elm_widget_resize_object_set(obj2, wd->frm);
2502 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2509 elm_win_inwin_activate(Evas_Object *obj)
2511 ELM_CHECK_WIDTYPE(obj, widtype2);
2512 Widget_Data *wd = elm_widget_data_get(obj);
2514 evas_object_raise(obj);
2515 evas_object_show(obj);
2516 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2517 elm_object_focus_set(obj, EINA_TRUE);
2521 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2523 ELM_CHECK_WIDTYPE(obj, widtype2);
2524 Widget_Data *wd = elm_widget_data_get(obj);
2526 if (wd->content == content) return;
2527 if (wd->content) evas_object_del(wd->content);
2528 wd->content = content;
2531 elm_widget_sub_object_add(obj, content);
2532 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2533 _changed_size_hints, obj);
2534 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2540 elm_win_inwin_content_get(const Evas_Object *obj)
2542 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2543 Widget_Data *wd = elm_widget_data_get(obj);
2544 if (!wd) return NULL;
2549 elm_win_inwin_content_unset(Evas_Object *obj)
2551 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2552 Widget_Data *wd = elm_widget_data_get(obj);
2553 if (!wd) return NULL;
2554 if (!wd->content) return NULL;
2555 Evas_Object *content = wd->content;
2556 elm_widget_sub_object_del(obj, wd->content);
2557 edje_object_part_unswallow(wd->frm, wd->content);
2562 /* windowing spcific calls - shall we do this differently? */
2564 static Ecore_X_Window
2565 _elm_ee_win_get(const Evas_Object *obj)
2568 #ifdef HAVE_ELEMENTARY_X
2569 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2570 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2576 elm_win_xwindow_get(const Evas_Object *obj)
2582 type = elm_widget_type_get(obj);
2583 if (!type) return 0;
2584 if (type != widtype) return _elm_ee_win_get(obj);
2585 #ifdef HAVE_ELEMENTARY_X
2586 win = elm_widget_data_get(obj);
2588 if (win->xwin) return win->xwin;
2589 if (win->parent) return elm_win_xwindow_get(win->parent);