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 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
310 win->focus_highlight.cur.visible = EINA_TRUE;
311 _elm_win_focus_highlight_reconfigure_job_start(win);
315 else if (win->img_obj)
322 _elm_win_focus_out(Ecore_Evas *ee)
324 Evas_Object *obj = ecore_evas_object_associate_get(ee);
328 win = elm_widget_data_get(obj);
330 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
331 win->focus_highlight.cur.visible = EINA_FALSE;
332 _elm_win_focus_highlight_reconfigure_job_start(win);
336 else if (win->img_obj)
343 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
345 Elm_Win *wd = elm_widget_data_get(obj);
346 const Eina_List *items;
347 void *(*list_data_get) (const Eina_List *list);
355 if (!(items = elm_widget_focus_custom_chain_get(obj)))
361 list_data_get = eina_list_data_get;
363 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
369 *next = (Evas_Object *)obj;
374 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
376 Elm_Win *win = elm_widget_data_get(obj);
380 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
382 evas_object_focus_set(obj, elm_widget_focus_get(obj));
386 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
388 if (type == EVAS_CALLBACK_KEY_DOWN)
390 Evas_Event_Key_Down *ev = event_info;
391 if (!strcmp(ev->keyname, "Tab"))
393 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
394 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
396 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
397 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
400 else if ((!strcmp(ev->keyname, "Left")) ||
401 (!strcmp(ev->keyname, "KP_Left")))
403 elm_widget_focus_cycle(obj, ELM_FOCUS_LEFT);
404 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
407 else if ((!strcmp(ev->keyname, "Right")) ||
408 (!strcmp(ev->keyname, "KP_Right")))
410 elm_widget_focus_cycle(obj, ELM_FOCUS_RIGHT);
411 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
414 else if ((!strcmp(ev->keyname, "Up")) ||
415 (!strcmp(ev->keyname, "KP_Up")))
417 elm_widget_focus_cycle(obj, ELM_FOCUS_UP);
418 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
421 else if ((!strcmp(ev->keyname, "Down")) ||
422 (!strcmp(ev->keyname, "KP_Down")))
424 elm_widget_focus_cycle(obj, ELM_FOCUS_DOWN);
425 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
434 _deferred_ecore_evas_free(void *data)
436 ecore_evas_free(data);
437 _elm_win_deferred_free--;
441 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
445 elm_object_focus_set(obj, EINA_TRUE);
446 if (win->shot.info) _shot_handle(win);
450 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
457 else if (win->img_obj)
459 evas_object_hide(win->img_obj);
464 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
471 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
472 _elm_win_obj_callback_parent_del, win);
475 if (win->autodel_clear) *(win->autodel_clear) = -1;
476 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
477 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
480 ecore_evas_callback_delete_request_set(win->ee, NULL);
481 ecore_evas_callback_resize_set(win->ee, NULL);
483 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
484 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
485 if (win->shot.info) eina_stringshare_del(win->shot.info);
486 if (win->shot.timer) ecore_timer_del(win->shot.timer);
487 while (((child = evas_object_bottom_get(win->evas))) &&
490 evas_object_del(child);
492 while (((child = evas_object_top_get(win->evas))) &&
495 evas_object_del(child);
497 #ifdef HAVE_ELEMENTARY_X
498 if (win->client_message_handler)
499 ecore_event_handler_del(win->client_message_handler);
501 // FIXME: Why are we flushing edje on every window destroy ??
502 // edje_file_cache_flush();
503 // edje_collection_cache_flush();
504 // evas_image_cache_flush(win->evas);
505 // evas_font_cache_flush(win->evas);
506 // FIXME: we are in the del handler for the object and delete the canvas
507 // that lives under it from the handler... nasty. deferring doesn't help either
517 ecore_job_add(_deferred_ecore_evas_free, win->ee);
518 _elm_win_deferred_free++;
522 _elm_win_focus_highlight_shutdown(win);
523 eina_stringshare_del(win->focus_highlight.style);
527 if ((!_elm_win_list) &&
528 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
530 edje_file_cache_flush();
531 edje_collection_cache_flush();
532 evas_image_cache_flush(e);
533 evas_font_cache_flush(e);
539 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
542 if (!win->img_obj) return;
543 evas_object_event_callback_del_full
544 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
545 evas_object_del(win->img_obj);
549 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
552 if (obj == win->parent) win->parent = NULL;
556 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
562 if ((x != win->screen.x) || (y != win->screen.y))
566 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
571 evas_object_move(obj, x, y);
576 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
579 // this is called to make sure all smart containers have calculated their
580 // sizes BEFORE we show the window to make sure it initially appears at
581 // our desired size (ie min size is known first)
582 evas_smart_objects_calculate(evas_object_evas_get(obj));
583 evas_object_show(obj);
587 else if (win->img_obj)
589 evas_object_show(win->img_obj);
594 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
598 if (ecore_evas_override_get(win->ee))
602 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
605 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
610 else if (win->img_obj)
614 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
617 // evas_object_move(win->img_obj, x, y);
622 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
629 else if (win->img_obj)
631 Evas_Coord w = 1, h = 1;
633 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
636 evas_object_image_size_set(win->img_obj, w, h);
641 _elm_win_delete_request(Ecore_Evas *ee)
643 Evas_Object *obj = ecore_evas_object_associate_get(ee);
645 if (strcmp(elm_widget_type_get(obj), "win")) return;
647 win = elm_widget_data_get(obj);
649 int autodel = win->autodel;
650 win->autodel_clear = &autodel;
651 evas_object_ref(win->win_obj);
652 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
653 // FIXME: if above callback deletes - then the below will be invalid
654 if (autodel) evas_object_del(win->win_obj);
655 else win->autodel_clear = NULL;
656 evas_object_unref(win->win_obj);
660 _elm_win_resize_job(void *data)
667 win->deferred_resize_job = NULL;
668 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
669 evas_object_resize(win->win_obj, w, h);
673 else if (win->img_obj)
676 EINA_LIST_FOREACH(win->subobjs, l, obj)
678 evas_object_move(obj, 0, 0);
679 evas_object_resize(obj, w, h);
683 #ifdef HAVE_ELEMENTARY_X
685 _elm_win_xwindow_get(Elm_Win *win)
689 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
690 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
692 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
694 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
695 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
696 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
697 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
698 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
699 ENGINE_COMPARE(ELM_OPENGL_SDL))
702 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
704 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
706 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
708 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
711 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
713 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
716 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
718 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
720 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
722 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
724 #undef ENGINE_COMPARE
728 #ifdef HAVE_ELEMENTARY_X
730 _elm_win_xwin_update(Elm_Win *win)
732 _elm_win_xwindow_get(win);
737 win2 = elm_widget_data_get(win->parent);
741 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
745 if (!win->xwin) return; /* nothing more to do */
750 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
752 case ELM_WIN_DIALOG_BASIC:
753 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
755 case ELM_WIN_DESKTOP:
756 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
759 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
761 case ELM_WIN_TOOLBAR:
762 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
765 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
767 case ELM_WIN_UTILITY:
768 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
771 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
773 case ELM_WIN_DROPDOWN_MENU:
774 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
776 case ELM_WIN_POPUP_MENU:
777 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
779 case ELM_WIN_TOOLTIP:
780 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
782 case ELM_WIN_NOTIFICATION:
783 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
786 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
789 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
794 ecore_x_e_virtual_keyboard_state_set
795 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
800 _elm_win_eval_subobjs(Evas_Object *obj)
803 const Evas_Object *child;
805 Elm_Win *win = elm_widget_data_get(obj);
806 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
810 EINA_LIST_FOREACH(win->subobjs, l, child)
812 evas_object_size_hint_weight_get(child, &wx, &wy);
813 if (wx == 0.0) xx = 0;
814 if (wy == 0.0) xy = 0;
816 evas_object_size_hint_min_get(child, &w, &h);
819 if (w > minw) minw = w;
820 if (h > minh) minh = h;
822 evas_object_size_hint_max_get(child, &w, &h);
825 if (maxw == -1) maxw = w;
826 else if ((w > 0) && (w < maxw)) maxw = w;
827 if (maxh == -1) maxh = h;
828 else if ((h > 0) && (h < maxh)) maxh = h;
830 if (!xx) maxw = minw;
832 if (!xy) maxh = minh;
834 evas_object_size_hint_min_set(obj, minw, minh);
835 evas_object_size_hint_max_set(obj, maxw, maxh);
836 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
837 if (w < minw) w = minw;
838 if (h < minh) h = minh;
839 if ((maxw >= 0) && (w > maxw)) w = maxw;
840 if ((maxh >= 0) && (h > maxh)) h = maxh;
841 evas_object_resize(obj, w, h);
845 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
847 Elm_Win *win = elm_widget_data_get(data);
848 win->subobjs = eina_list_remove(win->subobjs, obj);
849 _elm_win_eval_subobjs(win->win_obj);
853 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
855 _elm_win_eval_subobjs(data);
859 _elm_win_shutdown(void)
861 while (_elm_win_list)
862 evas_object_del(_elm_win_list->data);
866 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
873 EINA_LIST_FOREACH(_elm_win_list, l, obj)
874 elm_widget_theme(obj);
878 EINA_LIST_FOREACH(_elm_win_list, l, obj)
879 elm_widget_theme_specific(obj, th, EINA_FALSE);
883 #ifdef HAVE_ELEMENTARY_X
885 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
888 Ecore_X_Event_Client_Message *e = event;
890 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
891 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
893 if ((unsigned)e->data.l[0] == win->xwin)
895 Evas *evas = evas_object_evas_get(win->win_obj);
898 edje_file_cache_flush();
899 edje_collection_cache_flush();
900 evas_image_cache_flush(evas);
901 evas_font_cache_flush(evas);
905 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
907 if ((unsigned)e->data.l[0] == win->xwin)
909 Evas *evas = evas_object_evas_get(win->win_obj);
912 edje_file_cache_flush();
913 edje_collection_cache_flush();
914 evas_image_cache_flush(evas);
915 evas_font_cache_flush(evas);
916 evas_render_dump(evas);
920 return ECORE_CALLBACK_PASS_ON;
925 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
929 win->focus_highlight.geometry_changed = EINA_TRUE;
930 _elm_win_focus_highlight_reconfigure_job_start(win);
934 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
938 win->focus_highlight.geometry_changed = EINA_TRUE;
939 _elm_win_focus_highlight_reconfigure_job_start(win);
943 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
947 win->focus_highlight.cur.target = NULL;
949 _elm_win_focus_highlight_reconfigure_job_start(win);
953 _elm_win_focus_target_callbacks_add(Elm_Win *win)
955 Evas_Object *obj = win->focus_highlight.cur.target;
957 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
958 _elm_win_focus_target_move, win);
959 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
960 _elm_win_focus_target_resize, win);
961 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
962 _elm_win_focus_target_del, win);
966 _elm_win_focus_target_callbacks_del(Elm_Win *win)
968 Evas_Object *obj = win->focus_highlight.cur.target;
970 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
971 _elm_win_focus_target_move, win);
972 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
973 _elm_win_focus_target_resize, win);
974 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
975 _elm_win_focus_target_del, win);
979 _elm_win_focus_target_get(Evas_Object *obj)
981 Evas_Object *o = obj;
985 if (elm_widget_is(o))
987 if (!elm_widget_highlight_ignore_get(o))
989 o = elm_widget_parent_get(o);
991 o = evas_object_smart_parent_get(o);
995 o = elm_widget_parent_widget_get(o);
997 o = evas_object_smart_parent_get(o);
1006 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1008 Evas_Object *obj = event_info, *target;
1009 Elm_Win *win = data;
1011 if (win->focus_highlight.cur.target == obj)
1014 target = _elm_win_focus_target_get(obj);
1015 win->focus_highlight.cur.target = target;
1016 if (elm_widget_highlight_in_theme_get(target))
1017 win->focus_highlight.cur.handled = EINA_TRUE;
1019 _elm_win_focus_target_callbacks_add(win);
1021 _elm_win_focus_highlight_reconfigure_job_start(win);
1025 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1027 Elm_Win *win = data;
1029 if (!win->focus_highlight.cur.target)
1032 if (!win->focus_highlight.cur.handled)
1033 _elm_win_focus_target_callbacks_del(win);
1034 win->focus_highlight.cur.target = NULL;
1035 win->focus_highlight.cur.handled = EINA_FALSE;
1037 _elm_win_focus_highlight_reconfigure_job_start(win);
1041 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1043 evas_object_hide(obj);
1047 _elm_win_focus_highlight_init(Elm_Win *win)
1049 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1050 _elm_win_object_focus_in, win);
1051 evas_event_callback_add(win->evas,
1052 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1053 _elm_win_object_focus_out, win);
1055 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1057 win->focus_highlight.top = edje_object_add(win->evas);
1058 win->focus_highlight.changed_theme = EINA_TRUE;
1059 edje_object_signal_callback_add(win->focus_highlight.top,
1060 "elm,action,focus,hide,end", "",
1061 _elm_win_focus_highlight_hide, NULL);
1062 edje_object_signal_callback_add(win->focus_highlight.top,
1063 "elm,action,focus,anim,end", "",
1064 _elm_win_focus_highlight_anim_end, win);
1065 _elm_win_focus_highlight_reconfigure_job_start(win);
1069 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1071 _elm_win_focus_highlight_reconfigure_job_stop(win);
1072 if (win->focus_highlight.cur.target)
1074 _elm_win_focus_target_callbacks_del(win);
1075 win->focus_highlight.cur.target = NULL;
1077 if (win->focus_highlight.top)
1079 evas_object_del(win->focus_highlight.top);
1080 win->focus_highlight.top = NULL;
1083 evas_event_callback_del_full(win->evas,
1084 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1085 _elm_win_object_focus_in, win);
1086 evas_event_callback_del_full(win->evas,
1087 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1088 _elm_win_object_focus_out, win);
1092 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1096 top = win->focus_highlight.top;
1101 evas_object_show(top);
1102 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1108 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1113 _elm_win_focus_highlight_reconfigure_job(void *data)
1115 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1119 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1121 if (win->focus_highlight.reconf_job)
1122 ecore_job_del(win->focus_highlight.reconf_job);
1123 win->focus_highlight.reconf_job = ecore_job_add(
1124 _elm_win_focus_highlight_reconfigure_job, win);
1128 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1130 if (win->focus_highlight.reconf_job)
1131 ecore_job_del(win->focus_highlight.reconf_job);
1132 win->focus_highlight.reconf_job = NULL;
1136 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1138 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1139 Evas_Coord x, y, w, h;
1141 clip = evas_object_clip_get(target);
1142 evas_object_geometry_get(target, &x, &y, &w, &h);
1144 evas_object_move(obj, x, y);
1145 evas_object_resize(obj, w, h);
1146 evas_object_clip_set(obj, clip);
1150 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1152 Evas_Coord tx, ty, tw, th;
1153 Evas_Coord w, h, px, py, pw, ph;
1154 Edje_Message_Int_Set *m;
1155 Evas_Object *previous = win->focus_highlight.prev.target;
1156 Evas_Object *target = win->focus_highlight.cur.target;
1158 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1159 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1160 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1161 evas_object_move(obj, 0, 0);
1162 evas_object_resize(obj, tw, th);
1163 evas_object_clip_unset(obj);
1165 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1175 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1179 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1181 Elm_Win *win = data;
1182 _elm_win_focus_highlight_simple_setup(win, obj);
1186 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1188 Evas_Object *target = win->focus_highlight.cur.target;
1189 Evas_Object *previous = win->focus_highlight.prev.target;
1190 Evas_Object *top = win->focus_highlight.top;
1191 Eina_Bool visible_changed;
1192 Eina_Bool common_visible;
1193 const char *sig = NULL;
1195 _elm_win_focus_highlight_reconfigure_job_stop(win);
1197 visible_changed = (win->focus_highlight.cur.visible !=
1198 win->focus_highlight.prev.visible);
1200 if ((target == previous) && (!visible_changed) &&
1201 (!win->focus_highlight.geometry_changed))
1204 if ((previous) && (win->focus_highlight.prev.handled))
1205 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1208 common_visible = EINA_FALSE;
1209 else if (win->focus_highlight.cur.handled)
1211 common_visible = EINA_FALSE;
1212 if (win->focus_highlight.cur.visible)
1213 sig = "elm,action,focus_highlight,show";
1215 sig = "elm,action,focus_highlight,hide";
1218 common_visible = win->focus_highlight.cur.visible;
1220 _elm_win_focus_highlight_visible_set(win, common_visible);
1222 elm_widget_signal_emit(target, sig, "elm");
1224 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1227 if (win->focus_highlight.changed_theme)
1230 if (win->focus_highlight.style)
1231 str = win->focus_highlight.style;
1234 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1236 win->focus_highlight.changed_theme = EINA_FALSE;
1238 if (_elm_config->focus_highlight_animate)
1240 str = edje_object_data_get(win->focus_highlight.top, "animate");
1241 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1245 if ((win->focus_highlight.top_animate) && (previous) &&
1246 (!win->focus_highlight.prev.handled))
1247 _elm_win_focus_highlight_anim_setup(win, top);
1249 _elm_win_focus_highlight_simple_setup(win, top);
1250 evas_object_raise(top);
1253 win->focus_highlight.geometry_changed = EINA_FALSE;
1254 win->focus_highlight.prev = win->focus_highlight.cur;
1259 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1261 Evas_Event_Key_Down *ev = event_info;
1263 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1267 if ((strcmp(ev->keyname, "F12")) ||
1268 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1271 printf("Tree graph generated.\n");
1272 elm_object_tree_dot_dump(obj, "./dump.dot");
1277 _win_img_hide(void *data,
1279 Evas_Object *obj __UNUSED__,
1280 void *event_info __UNUSED__)
1282 Elm_Win *win = data;
1284 elm_widget_focus_hide_handle(win->win_obj);
1288 _win_img_mouse_down(void *data,
1290 Evas_Object *obj __UNUSED__,
1291 void *event_info __UNUSED__)
1293 Elm_Win *win = data;
1294 elm_widget_focus_mouse_down_handle(win->win_obj);
1298 _win_img_focus_in(void *data,
1300 Evas_Object *obj __UNUSED__,
1301 void *event_info __UNUSED__)
1303 Elm_Win *win = data;
1304 elm_widget_focus_steal(win->win_obj);
1308 _win_img_focus_out(void *data,
1310 Evas_Object *obj __UNUSED__,
1311 void *event_info __UNUSED__)
1313 Elm_Win *win = data;
1314 elm_widget_focused_object_clear(win->win_obj);
1318 _win_inlined_image_set(Elm_Win *win)
1320 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1321 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1322 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1323 _elm_win_obj_callback_img_obj_del, win);
1325 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1326 _win_img_hide, win);
1327 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1328 _win_img_mouse_down, win);
1329 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1330 _win_img_focus_in, win);
1331 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1332 _win_img_focus_out, win);
1336 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1340 const char *fontpath;
1342 win = ELM_NEW(Elm_Win);
1344 #define FALLBACK_TRY(engine) \
1347 CRITICAL(engine " engine creation failed. Trying software X11."); \
1348 elm_engine_set(ELM_SOFTWARE_X11); \
1349 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1351 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1355 case ELM_WIN_INLINED_IMAGE:
1358 Evas *e = evas_object_evas_get(parent);
1361 ee = ecore_evas_ecore_evas_get(e);
1363 win->img_obj = ecore_evas_object_image_new(ee);
1364 if (!win->img_obj) break;
1365 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1368 _win_inlined_image_set(win);
1371 evas_object_del(win->img_obj);
1372 win->img_obj = NULL;
1376 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1378 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1379 #ifdef HAVE_ELEMENTARY_X
1380 win->client_message_handler = ecore_event_handler_add
1381 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1384 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1386 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1387 FALLBACK_TRY("Sofware FB");
1389 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1391 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1392 FALLBACK_TRY("Sofware DirectFB");
1394 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1396 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1397 FALLBACK_TRY("Sofware-16");
1398 #ifdef HAVE_ELEMENTARY_X
1399 win->client_message_handler = ecore_event_handler_add
1400 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1403 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1405 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1406 FALLBACK_TRY("Sofware-8");
1407 #ifdef HAVE_ELEMENTARY_X
1408 win->client_message_handler = ecore_event_handler_add
1409 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1413 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1415 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1416 FALLBACK_TRY("XRender");
1417 #ifdef HAVE_ELEMENTARY_X
1418 win->client_message_handler = ecore_event_handler_add
1419 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1423 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1428 if (_elm_config->vsync)
1430 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1436 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1438 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1439 FALLBACK_TRY("OpenGL");
1440 #ifdef HAVE_ELEMENTARY_X
1441 win->client_message_handler = ecore_event_handler_add
1442 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1445 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1447 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1448 FALLBACK_TRY("Sofware Win32");
1450 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1452 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1453 FALLBACK_TRY("Sofware-16-WinCE");
1455 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1457 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1458 FALLBACK_TRY("Sofware SDL");
1460 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1462 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1463 FALLBACK_TRY("Sofware-16-SDL");
1465 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1467 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1468 FALLBACK_TRY("OpenGL SDL");
1470 else if (ENGINE_COMPARE(ELM_BUFFER))
1472 win->ee = ecore_evas_buffer_new(1, 1);
1474 else if (!strncmp(_elm_config->engine, "shot:", 5))
1476 win->ee = ecore_evas_buffer_new(1, 1);
1477 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1478 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1487 ERR("Cannot create window.");
1491 #ifdef HAVE_ELEMENTARY_X
1492 _elm_win_xwindow_get(win);
1494 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1495 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1496 // bg pixmap done by x - has other issues like can be redrawn by x before it
1497 // is filled/ready by app
1498 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1501 win->parent = parent;
1503 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1504 _elm_win_obj_callback_parent_del, win);
1506 win->evas = ecore_evas_get(win->ee);
1507 win->win_obj = elm_widget_add(win->evas);
1508 elm_widget_type_set(win->win_obj, "win");
1509 ELM_SET_WIDTYPE(widtype, "win");
1510 elm_widget_data_set(win->win_obj, win);
1511 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1512 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1513 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1514 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1515 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1516 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1517 evas_object_move(win->win_obj, 0, 0);
1518 evas_object_resize(win->win_obj, 1, 1);
1519 evas_object_layer_set(win->win_obj, 50);
1520 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1522 if (type == ELM_WIN_INLINED_IMAGE)
1523 elm_widget_parent2_set(win->win_obj, parent);
1524 ecore_evas_object_associate(win->ee, win->win_obj,
1525 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1526 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1527 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1528 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1529 _elm_win_obj_callback_show, win);
1530 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1531 _elm_win_obj_callback_hide, win);
1532 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1533 _elm_win_obj_callback_del, win);
1534 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1535 _elm_win_obj_callback_move, win);
1536 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1537 _elm_win_obj_callback_resize, win);
1539 evas_object_intercept_move_callback_add(win->win_obj,
1540 _elm_win_obj_intercept_move, win);
1541 evas_object_intercept_show_callback_add(win->win_obj,
1542 _elm_win_obj_intercept_show, win);
1544 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1545 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1546 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1547 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1548 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1549 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1550 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1551 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1552 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1553 evas_font_path_append(win->evas, fontpath);
1554 if (!_elm_config->font_hinting)
1555 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1556 else if (_elm_config->font_hinting == 1)
1557 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1558 else if (_elm_config->font_hinting == 2)
1559 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1561 #ifdef HAVE_ELEMENTARY_X
1562 _elm_win_xwin_update(win);
1565 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1567 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1569 ecore_evas_fullscreen_set(win->ee, 1);
1571 #undef ENGINE_COMPARE
1573 if (_elm_config->focus_highlight_enable)
1574 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1577 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1578 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1579 _debug_key_down, win);
1581 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1583 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1586 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1588 return win->win_obj;
1592 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1596 ELM_CHECK_WIDTYPE(obj, widtype);
1597 win = elm_widget_data_get(obj);
1599 if (eina_list_data_find(win->subobjs, subobj)) return;
1600 win->subobjs = eina_list_append(win->subobjs, subobj);
1601 elm_widget_sub_object_add(obj, subobj);
1602 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1603 _elm_win_subobj_callback_del, obj);
1604 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1605 _elm_win_subobj_callback_changed_size_hints,
1607 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1608 evas_object_move(subobj, 0, 0);
1609 evas_object_resize(subobj, w, h);
1610 _elm_win_eval_subobjs(obj);
1614 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1617 ELM_CHECK_WIDTYPE(obj, widtype);
1618 win = elm_widget_data_get(obj);
1620 evas_object_event_callback_del_full(subobj,
1621 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1622 _elm_win_subobj_callback_changed_size_hints,
1624 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1625 _elm_win_subobj_callback_del, obj);
1626 win->subobjs = eina_list_remove(win->subobjs, subobj);
1627 elm_widget_sub_object_del(obj, subobj);
1628 _elm_win_eval_subobjs(obj);
1632 elm_win_title_set(Evas_Object *obj, const char *title)
1635 ELM_CHECK_WIDTYPE(obj, widtype);
1636 win = elm_widget_data_get(obj);
1638 ecore_evas_title_set(win->ee, title);
1642 elm_win_title_get(const Evas_Object *obj)
1645 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1646 win = elm_widget_data_get(obj);
1647 if (!win) return NULL;
1648 return ecore_evas_title_get(win->ee);
1652 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1655 ELM_CHECK_WIDTYPE(obj, widtype);
1656 win = elm_widget_data_get(obj);
1658 win->autodel = autodel;
1662 elm_win_autodel_get(const Evas_Object *obj)
1665 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1666 win = elm_widget_data_get(obj);
1667 if (!win) return EINA_FALSE;
1668 return win->autodel;
1672 elm_win_activate(Evas_Object *obj)
1675 ELM_CHECK_WIDTYPE(obj, widtype);
1676 win = elm_widget_data_get(obj);
1678 ecore_evas_activate(win->ee);
1682 elm_win_lower(Evas_Object *obj)
1685 ELM_CHECK_WIDTYPE(obj, widtype);
1686 win = elm_widget_data_get(obj);
1688 ecore_evas_lower(win->ee);
1692 elm_win_raise(Evas_Object *obj)
1695 ELM_CHECK_WIDTYPE(obj, widtype);
1696 win = elm_widget_data_get(obj);
1698 ecore_evas_raise(win->ee);
1702 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1705 ELM_CHECK_WIDTYPE(obj, widtype);
1706 win = elm_widget_data_get(obj);
1708 ecore_evas_borderless_set(win->ee, borderless);
1709 #ifdef HAVE_ELEMENTARY_X
1710 _elm_win_xwin_update(win);
1715 elm_win_borderless_get(const Evas_Object *obj)
1718 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1719 win = elm_widget_data_get(obj);
1720 if (!win) return EINA_FALSE;
1721 return ecore_evas_borderless_get(win->ee);
1725 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1728 ELM_CHECK_WIDTYPE(obj, widtype);
1729 win = elm_widget_data_get(obj);
1731 ecore_evas_shaped_set(win->ee, shaped);
1732 #ifdef HAVE_ELEMENTARY_X
1733 _elm_win_xwin_update(win);
1738 elm_win_shaped_get(const Evas_Object *obj)
1741 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1742 win = elm_widget_data_get(obj);
1743 if (!win) return EINA_FALSE;
1744 return ecore_evas_shaped_get(win->ee);
1748 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1751 ELM_CHECK_WIDTYPE(obj, widtype);
1752 win = elm_widget_data_get(obj);
1757 else if (win->img_obj)
1759 evas_object_image_alpha_set(win->img_obj, alpha);
1763 #ifdef HAVE_ELEMENTARY_X
1768 if (!_elm_config->compositing)
1769 elm_win_shaped_set(obj, alpha);
1771 ecore_evas_alpha_set(win->ee, alpha);
1774 ecore_evas_alpha_set(win->ee, alpha);
1775 _elm_win_xwin_update(win);
1779 ecore_evas_alpha_set(win->ee, alpha);
1784 elm_win_alpha_get(const Evas_Object *obj)
1787 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1788 win = elm_widget_data_get(obj);
1789 if (!win) return EINA_FALSE;
1790 return ecore_evas_alpha_get(win->ee);
1794 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1797 ELM_CHECK_WIDTYPE(obj, widtype);
1798 win = elm_widget_data_get(obj);
1804 else if (win->img_obj)
1806 evas_object_image_alpha_set(win->img_obj, transparent);
1810 #ifdef HAVE_ELEMENTARY_X
1813 ecore_evas_transparent_set(win->ee, transparent);
1814 _elm_win_xwin_update(win);
1818 ecore_evas_transparent_set(win->ee, transparent);
1823 elm_win_transparent_get(const Evas_Object *obj)
1826 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1827 win = elm_widget_data_get(obj);
1828 if (!win) return EINA_FALSE;
1830 return ecore_evas_transparent_get(win->ee);
1834 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1837 ELM_CHECK_WIDTYPE(obj, widtype);
1838 win = elm_widget_data_get(obj);
1840 ecore_evas_override_set(win->ee, override);
1841 #ifdef HAVE_ELEMENTARY_X
1842 _elm_win_xwin_update(win);
1847 elm_win_override_get(const Evas_Object *obj)
1850 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1851 win = elm_widget_data_get(obj);
1852 if (!win) return EINA_FALSE;
1853 return ecore_evas_override_get(win->ee);
1857 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1860 ELM_CHECK_WIDTYPE(obj, widtype);
1861 win = elm_widget_data_get(obj);
1864 // YYY: handle if win->img_obj
1865 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1866 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1867 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1869 // these engines... can ONLY be fullscreen
1874 ecore_evas_fullscreen_set(win->ee, fullscreen);
1875 #ifdef HAVE_ELEMENTARY_X
1876 _elm_win_xwin_update(win);
1879 #undef ENGINE_COMPARE
1883 elm_win_fullscreen_get(const Evas_Object *obj)
1886 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1887 win = elm_widget_data_get(obj);
1888 if (!win) return EINA_FALSE;
1890 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1891 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1892 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1894 // these engines... can ONLY be fullscreen
1899 return ecore_evas_fullscreen_get(win->ee);
1901 #undef ENGINE_COMPARE
1905 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1908 ELM_CHECK_WIDTYPE(obj, widtype);
1909 win = elm_widget_data_get(obj);
1911 // YYY: handle if win->img_obj
1912 ecore_evas_maximized_set(win->ee, maximized);
1913 #ifdef HAVE_ELEMENTARY_X
1914 _elm_win_xwin_update(win);
1919 elm_win_maximized_get(const Evas_Object *obj)
1922 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1923 win = elm_widget_data_get(obj);
1924 if (!win) return EINA_FALSE;
1925 return ecore_evas_maximized_get(win->ee);
1929 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1932 ELM_CHECK_WIDTYPE(obj, widtype);
1933 win = elm_widget_data_get(obj);
1935 ecore_evas_iconified_set(win->ee, iconified);
1936 #ifdef HAVE_ELEMENTARY_X
1937 _elm_win_xwin_update(win);
1942 elm_win_iconified_get(const Evas_Object *obj)
1945 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1946 win = elm_widget_data_get(obj);
1947 if (!win) return EINA_FALSE;
1948 return ecore_evas_iconified_get(win->ee);
1952 elm_win_layer_set(Evas_Object *obj, int layer)
1955 ELM_CHECK_WIDTYPE(obj, widtype);
1956 win = elm_widget_data_get(obj);
1958 ecore_evas_layer_set(win->ee, layer);
1959 #ifdef HAVE_ELEMENTARY_X
1960 _elm_win_xwin_update(win);
1965 elm_win_layer_get(const Evas_Object *obj)
1968 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1969 win = elm_widget_data_get(obj);
1970 if (!win) return -1;
1971 return ecore_evas_layer_get(win->ee);
1975 elm_win_rotation_set(Evas_Object *obj, int rotation)
1978 ELM_CHECK_WIDTYPE(obj, widtype);
1979 win = elm_widget_data_get(obj);
1981 if (win->rot == rotation) return;
1982 win->rot = rotation;
1983 ecore_evas_rotation_set(win->ee, rotation);
1984 evas_object_size_hint_min_set(obj, -1, -1);
1985 evas_object_size_hint_max_set(obj, -1, -1);
1986 _elm_win_eval_subobjs(obj);
1987 #ifdef HAVE_ELEMENTARY_X
1988 _elm_win_xwin_update(win);
1993 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1996 ELM_CHECK_WIDTYPE(obj, widtype);
1997 win = elm_widget_data_get(obj);
1999 if (win->rot == rotation) return;
2000 win->rot = rotation;
2001 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2002 evas_object_size_hint_min_set(obj, -1, -1);
2003 evas_object_size_hint_max_set(obj, -1, -1);
2004 _elm_win_eval_subobjs(obj);
2005 #ifdef HAVE_ELEMENTARY_X
2006 _elm_win_xwin_update(win);
2011 elm_win_rotation_get(const Evas_Object *obj)
2014 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2015 win = elm_widget_data_get(obj);
2016 if (!win) return -1;
2021 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2024 ELM_CHECK_WIDTYPE(obj, widtype);
2025 win = elm_widget_data_get(obj);
2027 ecore_evas_sticky_set(win->ee, sticky);
2028 #ifdef HAVE_ELEMENTARY_X
2029 _elm_win_xwin_update(win);
2034 elm_win_sticky_get(const Evas_Object *obj)
2037 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2038 win = elm_widget_data_get(obj);
2039 if (!win) return EINA_FALSE;
2040 return ecore_evas_sticky_get(win->ee);
2044 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2047 ELM_CHECK_WIDTYPE(obj, widtype);
2048 win = elm_widget_data_get(obj);
2050 if (mode == win->kbdmode) return;
2051 #ifdef HAVE_ELEMENTARY_X
2052 _elm_win_xwindow_get(win);
2054 win->kbdmode = mode;
2055 #ifdef HAVE_ELEMENTARY_X
2057 ecore_x_e_virtual_keyboard_state_set
2058 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2062 EAPI Elm_Win_Keyboard_Mode
2063 elm_win_keyboard_mode_get(const Evas_Object *obj)
2066 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2067 win = elm_widget_data_get(obj);
2068 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2069 return win->kbdmode;
2073 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2076 ELM_CHECK_WIDTYPE(obj, widtype);
2077 win = elm_widget_data_get(obj);
2079 #ifdef HAVE_ELEMENTARY_X
2080 _elm_win_xwindow_get(win);
2082 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2087 elm_win_keyboard_win_get(const Evas_Object *obj)
2090 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2091 win = elm_widget_data_get(obj);
2092 if (!win) return EINA_FALSE;
2093 #ifdef HAVE_ELEMENTARY_X
2094 _elm_win_xwindow_get(win);
2096 return ecore_x_e_virtual_keyboard_get(win->xwin);
2102 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2105 ELM_CHECK_WIDTYPE(obj, widtype);
2106 win = elm_widget_data_get(obj);
2108 if (x) *x = win->screen.x;
2109 if (y) *y = win->screen.y;
2113 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2116 ELM_CHECK_WIDTYPE(obj, widtype);
2117 win = elm_widget_data_get(obj);
2119 #ifdef HAVE_ELEMENTARY_X
2120 _elm_win_xwindow_get(win);
2122 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2127 elm_win_conformant_get(const Evas_Object *obj)
2130 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2131 win = elm_widget_data_get(obj);
2132 if (!win) return EINA_FALSE;
2133 #ifdef HAVE_ELEMENTARY_X
2134 _elm_win_xwindow_get(win);
2136 return ecore_x_e_illume_conformant_get(win->xwin);
2142 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2145 ELM_CHECK_WIDTYPE(obj, widtype);
2146 win = elm_widget_data_get(obj);
2148 #ifdef HAVE_ELEMENTARY_X
2149 _elm_win_xwindow_get(win);
2152 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2155 Ecore_X_Window_State states[2];
2157 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2158 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2159 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2160 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2167 elm_win_quickpanel_get(const Evas_Object *obj)
2170 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2171 win = elm_widget_data_get(obj);
2172 if (!win) return EINA_FALSE;
2173 #ifdef HAVE_ELEMENTARY_X
2174 _elm_win_xwindow_get(win);
2176 return ecore_x_e_illume_quickpanel_get(win->xwin);
2182 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2185 ELM_CHECK_WIDTYPE(obj, widtype);
2186 win = elm_widget_data_get(obj);
2188 #ifdef HAVE_ELEMENTARY_X
2189 _elm_win_xwindow_get(win);
2191 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2196 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2199 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2200 win = elm_widget_data_get(obj);
2201 if (!win) return -1;
2202 #ifdef HAVE_ELEMENTARY_X
2203 _elm_win_xwindow_get(win);
2205 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2211 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2214 ELM_CHECK_WIDTYPE(obj, widtype);
2215 win = elm_widget_data_get(obj);
2217 #ifdef HAVE_ELEMENTARY_X
2218 _elm_win_xwindow_get(win);
2220 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2225 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2228 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2229 win = elm_widget_data_get(obj);
2230 if (!win) return -1;
2231 #ifdef HAVE_ELEMENTARY_X
2232 _elm_win_xwindow_get(win);
2234 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2240 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2243 ELM_CHECK_WIDTYPE(obj, widtype);
2244 win = elm_widget_data_get(obj);
2246 #ifdef HAVE_ELEMENTARY_X
2247 _elm_win_xwindow_get(win);
2249 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2254 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2257 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2258 win = elm_widget_data_get(obj);
2260 #ifdef HAVE_ELEMENTARY_X
2261 _elm_win_xwindow_get(win);
2263 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2269 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2272 ELM_CHECK_WIDTYPE(obj, widtype);
2273 win = elm_widget_data_get(obj);
2275 #ifdef HAVE_ELEMENTARY_X
2276 _elm_win_xwindow_get(win);
2281 Ecore_X_Window_State states[2];
2283 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2284 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2285 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2286 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2293 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2296 ELM_CHECK_WIDTYPE(obj, widtype);
2297 win = elm_widget_data_get(obj);
2299 #ifdef HAVE_ELEMENTARY_X
2300 _elm_win_xwindow_get(win);
2305 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2306 ecore_x_e_illume_focus_back_send(win->xwin);
2308 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2309 ecore_x_e_illume_focus_forward_send(win->xwin);
2311 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2312 ecore_x_e_illume_focus_home_send(win->xwin);
2314 case ELM_ILLUME_COMMAND_CLOSE:
2315 ecore_x_e_illume_close_send(win->xwin);
2325 elm_win_inlined_image_object_get(Evas_Object *obj)
2328 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2329 win = elm_widget_data_get(obj);
2330 if (!win) return NULL;
2331 return win->img_obj;
2335 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2339 ELM_CHECK_WIDTYPE(obj, widtype);
2341 win = elm_widget_data_get(obj);
2342 enabled = !!enabled;
2343 if (win->focus_highlight.enabled == enabled)
2346 win->focus_highlight.enabled = enabled;
2348 if (win->focus_highlight.enabled)
2349 _elm_win_focus_highlight_init(win);
2351 _elm_win_focus_highlight_shutdown(win);
2355 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2359 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2361 win = elm_widget_data_get(obj);
2362 return win->focus_highlight.enabled;
2366 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2370 ELM_CHECK_WIDTYPE(obj, widtype);
2372 win = elm_widget_data_get(obj);
2373 eina_stringshare_replace(&win->focus_highlight.style, style);
2374 win->focus_highlight.changed_theme = EINA_TRUE;
2375 _elm_win_focus_highlight_reconfigure_job_start(win);
2379 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2383 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2385 win = elm_widget_data_get(obj);
2386 return win->focus_highlight.style;
2389 typedef struct _Widget_Data Widget_Data;
2394 Evas_Object *content;
2397 static void _del_hook(Evas_Object *obj);
2398 static void _theme_hook(Evas_Object *obj);
2399 static void _sizing_eval(Evas_Object *obj);
2400 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2401 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2403 static const char *widtype2 = NULL;
2406 _del_hook(Evas_Object *obj)
2408 Widget_Data *wd = elm_widget_data_get(obj);
2414 _theme_hook(Evas_Object *obj)
2416 Widget_Data *wd = elm_widget_data_get(obj);
2417 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2419 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2424 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2426 Widget_Data *wd = elm_widget_data_get(obj);
2431 /* Try Focus cycle in subitem */
2434 elm_widget_focus_next_get(wd->content, dir, next);
2439 *next = (Evas_Object *)obj;
2444 _sizing_eval(Evas_Object *obj)
2446 Widget_Data *wd = elm_widget_data_get(obj);
2447 Evas_Coord minw = -1, minh = -1;
2449 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2450 edje_object_size_min_calc(wd->frm, &minw, &minh);
2451 evas_object_size_hint_min_set(obj, minw, minh);
2452 evas_object_size_hint_max_set(obj, -1, -1);
2456 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2462 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2464 Widget_Data *wd = elm_widget_data_get(obj);
2465 Evas_Object *sub = event_info;
2466 if (sub == wd->content)
2468 evas_object_event_callback_del_full
2469 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2476 elm_win_inwin_add(Evas_Object *obj)
2482 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2483 win = elm_widget_data_get(obj);
2484 if (!win) return NULL;
2485 wd = ELM_NEW(Widget_Data);
2486 obj2 = elm_widget_add(win->evas);
2487 elm_widget_type_set(obj2, "inwin");
2488 ELM_SET_WIDTYPE(widtype2, "inwin");
2489 elm_widget_sub_object_add(obj, obj2);
2490 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2491 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2492 elm_win_resize_object_add(obj, obj2);
2494 elm_widget_data_set(obj2, wd);
2495 elm_widget_del_hook_set(obj2, _del_hook);
2496 elm_widget_theme_hook_set(obj2, _theme_hook);
2497 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2498 elm_widget_can_focus_set(obj2, EINA_TRUE);
2499 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2501 wd->frm = edje_object_add(win->evas);
2502 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2503 elm_widget_resize_object_set(obj2, wd->frm);
2505 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2512 elm_win_inwin_activate(Evas_Object *obj)
2514 ELM_CHECK_WIDTYPE(obj, widtype2);
2515 Widget_Data *wd = elm_widget_data_get(obj);
2517 evas_object_raise(obj);
2518 evas_object_show(obj);
2519 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2520 elm_object_focus_set(obj, EINA_TRUE);
2524 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2526 ELM_CHECK_WIDTYPE(obj, widtype2);
2527 Widget_Data *wd = elm_widget_data_get(obj);
2529 if (wd->content == content) return;
2530 if (wd->content) evas_object_del(wd->content);
2531 wd->content = content;
2534 elm_widget_sub_object_add(obj, content);
2535 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2536 _changed_size_hints, obj);
2537 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2543 elm_win_inwin_content_get(const Evas_Object *obj)
2545 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2546 Widget_Data *wd = elm_widget_data_get(obj);
2547 if (!wd) return NULL;
2552 elm_win_inwin_content_unset(Evas_Object *obj)
2554 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2555 Widget_Data *wd = elm_widget_data_get(obj);
2556 if (!wd) return NULL;
2557 if (!wd->content) return NULL;
2558 Evas_Object *content = wd->content;
2559 elm_widget_sub_object_del(obj, wd->content);
2560 edje_object_part_unswallow(wd->frm, wd->content);
2565 /* windowing spcific calls - shall we do this differently? */
2567 static Ecore_X_Window
2568 _elm_ee_win_get(const Evas_Object *obj)
2571 #ifdef HAVE_ELEMENTARY_X
2572 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2573 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2579 * Get the Ecore_X_Window of an Evas_Object
2581 * @param obj The object
2583 * @return The Ecore_X_Window of @p obj
2588 elm_win_xwindow_get(const Evas_Object *obj)
2594 type = elm_widget_type_get(obj);
2595 if (!type) return 0;
2596 if (type != widtype) return _elm_ee_win_get(obj);
2597 #ifdef HAVE_ELEMENTARY_X
2598 win = elm_widget_data_get(obj);
2600 if (win->xwin) return win->xwin;
2601 if (win->parent) return elm_win_xwindow_get(win->parent);