1 #include <Elementary.h>
4 typedef struct _Elm_Win Elm_Win;
10 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
12 #ifdef HAVE_ELEMENTARY_X
14 Ecore_Event_Handler *client_message_handler;
16 Ecore_Job *deferred_resize_job;
17 Ecore_Job *deferred_child_eval_job;
20 Elm_Win_Keyboard_Mode kbdmode;
27 Eina_Bool autodel : 1;
28 int *autodel_clear, rot;
39 Eina_Bool visible : 1;
40 Eina_Bool handled : 1;
44 Ecore_Job *reconf_job;
46 Eina_Bool enabled : 1;
47 Eina_Bool changed_theme : 1;
48 Eina_Bool top_animate : 1;
49 Eina_Bool geometry_changed : 1;
53 static const char *widtype = NULL;
54 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
55 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
56 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
57 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
58 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
59 static void _elm_win_move(Ecore_Evas *ee);
60 static void _elm_win_resize(Ecore_Evas *ee);
61 static void _elm_win_delete_request(Ecore_Evas *ee);
62 static void _elm_win_resize_job(void *data);
63 #ifdef HAVE_ELEMENTARY_X
64 static void _elm_win_xwin_update(Elm_Win *win);
66 static void _elm_win_eval_subobjs(Evas_Object *obj);
67 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
68 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
69 static void _elm_win_focus_highlight_init(Elm_Win *win);
70 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
71 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
72 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
73 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
74 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
75 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
77 static const char SIG_DELETE_REQUEST[] = "delete,request";
78 static const char SIG_FOCUS_OUT[] = "focus,out";
79 static const char SIG_FOCUS_IN[] = "focus,in";
80 static const char SIG_MOVED[] = "moved";
82 static const Evas_Smart_Cb_Description _signals[] = {
83 {SIG_DELETE_REQUEST, ""},
92 Eina_List *_elm_win_list = NULL;
93 int _elm_win_deferred_free = 0;
95 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
96 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
99 _shot_delay_get(Elm_Win *win)
102 char *d = strdup(win->shot.info);
105 for (p = (char *)win->shot.info; *p; p++)
107 if (!strncmp(p, "delay=", 6))
111 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
126 _shot_file_get(Elm_Win *win)
129 char *tmp = strdup(win->shot.info);
130 char *repname = NULL;
132 if (!tmp) return NULL;
134 for (p = (char *)win->shot.info; *p; p++)
136 if (!strncmp(p, "file=", 5))
139 if (!win->shot.repeat_count) return tmp;
142 char *dotptr = strrchr(tmp, '.');
145 repname = malloc(sizeof(char)*(strlen(tmp) + 16));
146 strncpy(repname, tmp, dotptr - tmp);
147 sprintf(repname + (dotptr - tmp), "%03i",
148 win->shot.shot_counter + 1);
149 strcat(repname, dotptr);
156 if (!win->shot.repeat_count) return strdup("out.png");
159 repname = malloc(sizeof(char) * 24);
160 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
166 _shot_repeat_count_get(Elm_Win *win)
170 char *d = strdup(win->shot.info);
173 for (p = (char *)win->shot.info; *p; p++)
175 if (!strncmp(p, "repeat=", 7))
179 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
186 if (v > 1000) v = 999;
196 _shot_key_get(Elm_Win *win __UNUSED__)
202 _shot_flags_get(Elm_Win *win __UNUSED__)
208 _shot_do(Elm_Win *win)
212 unsigned int *pixels;
214 char *file, *key, *flags;
216 ecore_evas_manual_render(win->ee);
217 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
219 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
220 if ((w < 1) || (h < 1)) return;
221 file = _shot_file_get(win);
223 key = _shot_key_get(win);
224 flags = _shot_flags_get(win);
225 ee = ecore_evas_buffer_new(1, 1);
226 o = evas_object_image_add(ecore_evas_get(ee));
227 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
228 evas_object_image_size_set(o, w, h);
229 evas_object_image_data_set(o, pixels);
230 if (!evas_object_image_save(o, file, key, flags))
232 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
237 if (flags) free(flags);
239 if (win->shot.repeat_count) win->shot.shot_counter++;
243 _shot_delay(void *data)
247 if (win->shot.repeat_count)
249 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
250 if (remainshot > 0) return EINA_TRUE;
252 win->shot.timer = NULL;
258 _shot_init(Elm_Win *win)
260 if (!win->shot.info) return;
261 win->shot.repeat_count = _shot_repeat_count_get(win);
262 win->shot.shot_counter = 0;
266 _shot_handle(Elm_Win *win)
268 if (!win->shot.info) return;
269 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
273 _elm_win_move(Ecore_Evas *ee)
275 Evas_Object *obj = ecore_evas_object_associate_get(ee);
280 win = elm_widget_data_get(obj);
282 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
285 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
289 _elm_win_resize(Ecore_Evas *ee)
291 Evas_Object *obj = ecore_evas_object_associate_get(ee);
295 win = elm_widget_data_get(obj);
297 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
298 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
302 _elm_win_focus_in(Ecore_Evas *ee)
304 Evas_Object *obj = ecore_evas_object_associate_get(ee);
308 win = elm_widget_data_get(obj);
310 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
311 if (win->show_count == 1)
313 elm_object_focus(win->win_obj);
317 elm_widget_focus_restore(win->win_obj);
318 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
319 win->focus_highlight.cur.visible = EINA_TRUE;
320 _elm_win_focus_highlight_reconfigure_job_start(win);
324 else if (win->img_obj)
331 _elm_win_focus_out(Ecore_Evas *ee)
333 Evas_Object *obj = ecore_evas_object_associate_get(ee);
337 win = elm_widget_data_get(obj);
339 elm_object_unfocus(win->win_obj);
340 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
341 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
342 win->focus_highlight.cur.visible = EINA_FALSE;
343 _elm_win_focus_highlight_reconfigure_job_start(win);
347 else if (win->img_obj)
354 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
356 Elm_Win *wd = elm_widget_data_get(obj);
357 const Eina_List *items;
358 void *(*list_data_get) (const Eina_List *list);
366 if (!(items = elm_widget_focus_custom_chain_get(obj)))
372 list_data_get = eina_list_data_get;
374 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
380 *next = (Evas_Object *)obj;
385 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
387 Elm_Win *win = elm_widget_data_get(obj);
391 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
393 evas_object_focus_set(obj, elm_widget_focus_get(obj));
397 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
399 if (type == EVAS_CALLBACK_KEY_DOWN)
401 Evas_Event_Key_Down *ev = event_info;
402 if (!strcmp(ev->keyname, "Tab"))
404 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
405 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
407 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
408 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
417 _deferred_ecore_evas_free(void *data)
419 ecore_evas_free(data);
420 _elm_win_deferred_free--;
424 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
428 if (!win->show_count) win->show_count++;
429 if (win->shot.info) _shot_handle(win);
433 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
440 else if (win->img_obj)
442 evas_object_hide(win->img_obj);
447 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
454 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
455 _elm_win_obj_callback_parent_del, win);
458 if (win->autodel_clear) *(win->autodel_clear) = -1;
459 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
460 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
463 ecore_evas_callback_delete_request_set(win->ee, NULL);
464 ecore_evas_callback_resize_set(win->ee, NULL);
466 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
467 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
468 if (win->shot.info) eina_stringshare_del(win->shot.info);
469 if (win->shot.timer) ecore_timer_del(win->shot.timer);
470 while (((child = evas_object_bottom_get(win->evas))) &&
473 evas_object_del(child);
475 while (((child = evas_object_top_get(win->evas))) &&
478 evas_object_del(child);
480 #ifdef HAVE_ELEMENTARY_X
481 if (win->client_message_handler)
482 ecore_event_handler_del(win->client_message_handler);
484 // FIXME: Why are we flushing edje on every window destroy ??
485 // edje_file_cache_flush();
486 // edje_collection_cache_flush();
487 // evas_image_cache_flush(win->evas);
488 // evas_font_cache_flush(win->evas);
489 // FIXME: we are in the del handler for the object and delete the canvas
490 // that lives under it from the handler... nasty. deferring doesn't help either
500 ecore_job_add(_deferred_ecore_evas_free, win->ee);
501 _elm_win_deferred_free++;
505 _elm_win_focus_highlight_shutdown(win);
506 eina_stringshare_del(win->focus_highlight.style);
510 if ((!_elm_win_list) &&
511 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
513 edje_file_cache_flush();
514 edje_collection_cache_flush();
515 evas_image_cache_flush(e);
516 evas_font_cache_flush(e);
522 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
525 if (!win->img_obj) return;
526 evas_object_event_callback_del_full
527 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
528 evas_object_del(win->img_obj);
532 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
535 if (obj == win->parent) win->parent = NULL;
539 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
545 if ((x != win->screen.x) || (y != win->screen.y))
549 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
554 evas_object_move(obj, x, y);
559 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
562 // this is called to make sure all smart containers have calculated their
563 // sizes BEFORE we show the window to make sure it initially appears at
564 // our desired size (ie min size is known first)
565 evas_smart_objects_calculate(evas_object_evas_get(obj));
566 evas_object_show(obj);
570 else if (win->img_obj)
572 evas_object_show(win->img_obj);
577 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
581 if (ecore_evas_override_get(win->ee))
585 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
588 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
593 else if (win->img_obj)
597 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
600 // evas_object_move(win->img_obj, x, y);
605 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
612 else if (win->img_obj)
614 Evas_Coord w = 1, h = 1;
616 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
619 evas_object_image_size_set(win->img_obj, w, h);
624 _elm_win_delete_request(Ecore_Evas *ee)
626 Evas_Object *obj = ecore_evas_object_associate_get(ee);
628 if (strcmp(elm_widget_type_get(obj), "win")) return;
630 win = elm_widget_data_get(obj);
632 int autodel = win->autodel;
633 win->autodel_clear = &autodel;
634 evas_object_ref(win->win_obj);
635 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
636 // FIXME: if above callback deletes - then the below will be invalid
637 if (autodel) evas_object_del(win->win_obj);
638 else win->autodel_clear = NULL;
639 evas_object_unref(win->win_obj);
643 _elm_win_resize_job(void *data)
650 win->deferred_resize_job = NULL;
651 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
652 evas_object_resize(win->win_obj, w, h);
656 else if (win->img_obj)
659 EINA_LIST_FOREACH(win->subobjs, l, obj)
661 evas_object_move(obj, 0, 0);
662 evas_object_resize(obj, w, h);
666 #ifdef HAVE_ELEMENTARY_X
668 _elm_win_xwindow_get(Elm_Win *win)
672 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
673 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
675 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
677 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
678 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
679 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
680 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
681 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
682 ENGINE_COMPARE(ELM_OPENGL_SDL))
685 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
687 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
689 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
691 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
694 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
696 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
699 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
701 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
703 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
705 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
707 #undef ENGINE_COMPARE
711 #ifdef HAVE_ELEMENTARY_X
713 _elm_win_xwin_update(Elm_Win *win)
715 _elm_win_xwindow_get(win);
720 win2 = elm_widget_data_get(win->parent);
724 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
728 if (!win->xwin) return; /* nothing more to do */
733 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
735 case ELM_WIN_DIALOG_BASIC:
736 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
738 case ELM_WIN_DESKTOP:
739 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
742 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
744 case ELM_WIN_TOOLBAR:
745 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
748 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
750 case ELM_WIN_UTILITY:
751 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
754 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
756 case ELM_WIN_DROPDOWN_MENU:
757 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
759 case ELM_WIN_POPUP_MENU:
760 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
762 case ELM_WIN_TOOLTIP:
763 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
765 case ELM_WIN_NOTIFICATION:
766 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
769 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
772 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
777 ecore_x_e_virtual_keyboard_state_set
778 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
783 _elm_win_eval_subobjs(Evas_Object *obj)
786 const Evas_Object *child;
788 Elm_Win *win = elm_widget_data_get(obj);
789 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
793 EINA_LIST_FOREACH(win->subobjs, l, child)
795 evas_object_size_hint_weight_get(child, &wx, &wy);
796 if (wx == 0.0) xx = 0;
797 if (wy == 0.0) xy = 0;
799 evas_object_size_hint_min_get(child, &w, &h);
802 if (w > minw) minw = w;
803 if (h > minh) minh = h;
805 evas_object_size_hint_max_get(child, &w, &h);
808 if (maxw == -1) maxw = w;
809 else if ((w > 0) && (w < maxw)) maxw = w;
810 if (maxh == -1) maxh = h;
811 else if ((h > 0) && (h < maxh)) maxh = h;
813 if (!xx) maxw = minw;
815 if (!xy) maxh = minh;
817 evas_object_size_hint_min_set(obj, minw, minh);
818 evas_object_size_hint_max_set(obj, maxw, maxh);
819 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
820 if (w < minw) w = minw;
821 if (h < minh) h = minh;
822 if ((maxw >= 0) && (w > maxw)) w = maxw;
823 if ((maxh >= 0) && (h > maxh)) h = maxh;
824 evas_object_resize(obj, w, h);
828 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
830 Elm_Win *win = elm_widget_data_get(data);
831 win->subobjs = eina_list_remove(win->subobjs, obj);
832 _elm_win_eval_subobjs(win->win_obj);
836 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
838 _elm_win_eval_subobjs(data);
842 _elm_win_shutdown(void)
844 while (_elm_win_list)
845 evas_object_del(_elm_win_list->data);
849 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
856 EINA_LIST_FOREACH(_elm_win_list, l, obj)
857 elm_widget_theme(obj);
861 EINA_LIST_FOREACH(_elm_win_list, l, obj)
862 elm_widget_theme_specific(obj, th, EINA_FALSE);
866 #ifdef HAVE_ELEMENTARY_X
868 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
871 Ecore_X_Event_Client_Message *e = event;
873 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
874 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
876 if ((unsigned)e->data.l[0] == win->xwin)
878 Evas *evas = evas_object_evas_get(win->win_obj);
881 edje_file_cache_flush();
882 edje_collection_cache_flush();
883 evas_image_cache_flush(evas);
884 evas_font_cache_flush(evas);
888 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
890 if ((unsigned)e->data.l[0] == win->xwin)
892 Evas *evas = evas_object_evas_get(win->win_obj);
895 edje_file_cache_flush();
896 edje_collection_cache_flush();
897 evas_image_cache_flush(evas);
898 evas_font_cache_flush(evas);
899 evas_render_dump(evas);
903 return ECORE_CALLBACK_PASS_ON;
908 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
912 win->focus_highlight.geometry_changed = EINA_TRUE;
913 _elm_win_focus_highlight_reconfigure_job_start(win);
917 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
921 win->focus_highlight.geometry_changed = EINA_TRUE;
922 _elm_win_focus_highlight_reconfigure_job_start(win);
926 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
930 win->focus_highlight.cur.target = NULL;
932 _elm_win_focus_highlight_reconfigure_job_start(win);
936 _elm_win_focus_target_callbacks_add(Elm_Win *win)
938 Evas_Object *obj = win->focus_highlight.cur.target;
940 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
941 _elm_win_focus_target_move, win);
942 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
943 _elm_win_focus_target_resize, win);
944 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
945 _elm_win_focus_target_del, win);
949 _elm_win_focus_target_callbacks_del(Elm_Win *win)
951 Evas_Object *obj = win->focus_highlight.cur.target;
953 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
954 _elm_win_focus_target_move, win);
955 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
956 _elm_win_focus_target_resize, win);
957 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
958 _elm_win_focus_target_del, win);
962 _elm_win_focus_target_get(Evas_Object *obj)
964 Evas_Object *o = obj;
968 if (elm_widget_is(o))
970 if (!elm_widget_highlight_ignore_get(o))
972 o = elm_widget_parent_get(o);
974 o = evas_object_smart_parent_get(o);
978 o = elm_widget_parent_widget_get(o);
980 o = evas_object_smart_parent_get(o);
989 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
991 Evas_Object *obj = event_info, *target;
994 if (win->focus_highlight.cur.target == obj)
997 target = _elm_win_focus_target_get(obj);
998 win->focus_highlight.cur.target = target;
999 if (elm_widget_highlight_in_theme_get(target))
1000 win->focus_highlight.cur.handled = EINA_TRUE;
1002 _elm_win_focus_target_callbacks_add(win);
1004 _elm_win_focus_highlight_reconfigure_job_start(win);
1008 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1010 Elm_Win *win = data;
1012 if (!win->focus_highlight.cur.target)
1015 if (!win->focus_highlight.cur.handled)
1016 _elm_win_focus_target_callbacks_del(win);
1017 win->focus_highlight.cur.target = NULL;
1018 win->focus_highlight.cur.handled = EINA_FALSE;
1020 _elm_win_focus_highlight_reconfigure_job_start(win);
1024 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1026 evas_object_hide(obj);
1030 _elm_win_focus_highlight_init(Elm_Win *win)
1032 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1033 _elm_win_object_focus_in, win);
1034 evas_event_callback_add(win->evas,
1035 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1036 _elm_win_object_focus_out, win);
1038 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1040 win->focus_highlight.top = edje_object_add(win->evas);
1041 win->focus_highlight.changed_theme = EINA_TRUE;
1042 edje_object_signal_callback_add(win->focus_highlight.top,
1043 "elm,action,focus,hide,end", "",
1044 _elm_win_focus_highlight_hide, NULL);
1045 edje_object_signal_callback_add(win->focus_highlight.top,
1046 "elm,action,focus,anim,end", "",
1047 _elm_win_focus_highlight_anim_end, win);
1048 _elm_win_focus_highlight_reconfigure_job_start(win);
1052 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1054 _elm_win_focus_highlight_reconfigure_job_stop(win);
1055 if (win->focus_highlight.cur.target)
1057 _elm_win_focus_target_callbacks_del(win);
1058 win->focus_highlight.cur.target = NULL;
1060 if (win->focus_highlight.top)
1062 evas_object_del(win->focus_highlight.top);
1063 win->focus_highlight.top = NULL;
1066 evas_event_callback_del_full(win->evas,
1067 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1068 _elm_win_object_focus_in, win);
1069 evas_event_callback_del_full(win->evas,
1070 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1071 _elm_win_object_focus_out, win);
1075 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1079 top = win->focus_highlight.top;
1084 evas_object_show(top);
1085 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1091 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1096 _elm_win_focus_highlight_reconfigure_job(void *data)
1098 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1102 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1104 if (win->focus_highlight.reconf_job)
1105 ecore_job_del(win->focus_highlight.reconf_job);
1106 win->focus_highlight.reconf_job = ecore_job_add(
1107 _elm_win_focus_highlight_reconfigure_job, win);
1111 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1113 if (win->focus_highlight.reconf_job)
1114 ecore_job_del(win->focus_highlight.reconf_job);
1115 win->focus_highlight.reconf_job = NULL;
1119 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1121 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1122 Evas_Coord x, y, w, h;
1124 clip = evas_object_clip_get(target);
1125 evas_object_geometry_get(target, &x, &y, &w, &h);
1127 evas_object_move(obj, x, y);
1128 evas_object_resize(obj, w, h);
1129 evas_object_clip_set(obj, clip);
1133 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1135 Evas_Coord tx, ty, tw, th;
1136 Evas_Coord w, h, px, py, pw, ph;
1137 Edje_Message_Int_Set *m;
1138 Evas_Object *previous = win->focus_highlight.prev.target;
1139 Evas_Object *target = win->focus_highlight.cur.target;
1141 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1142 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1143 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1144 evas_object_move(obj, 0, 0);
1145 evas_object_resize(obj, tw, th);
1146 evas_object_clip_unset(obj);
1148 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1158 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1162 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1164 Elm_Win *win = data;
1165 _elm_win_focus_highlight_simple_setup(win, obj);
1169 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1171 Evas_Object *target = win->focus_highlight.cur.target;
1172 Evas_Object *previous = win->focus_highlight.prev.target;
1173 Evas_Object *top = win->focus_highlight.top;
1174 Eina_Bool visible_changed;
1175 Eina_Bool common_visible;
1176 const char *sig = NULL;
1178 _elm_win_focus_highlight_reconfigure_job_stop(win);
1180 visible_changed = (win->focus_highlight.cur.visible !=
1181 win->focus_highlight.prev.visible);
1183 if ((target == previous) && (!visible_changed) &&
1184 (!win->focus_highlight.geometry_changed))
1187 if ((previous) && (win->focus_highlight.prev.handled))
1188 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1191 common_visible = EINA_FALSE;
1192 else if (win->focus_highlight.cur.handled)
1194 common_visible = EINA_FALSE;
1195 if (win->focus_highlight.cur.visible)
1196 sig = "elm,action,focus_highlight,show";
1198 sig = "elm,action,focus_highlight,hide";
1201 common_visible = win->focus_highlight.cur.visible;
1203 _elm_win_focus_highlight_visible_set(win, common_visible);
1205 elm_widget_signal_emit(target, sig, "elm");
1207 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1210 if (win->focus_highlight.changed_theme)
1213 if (win->focus_highlight.style)
1214 str = win->focus_highlight.style;
1217 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1219 win->focus_highlight.changed_theme = EINA_FALSE;
1221 if (_elm_config->focus_highlight_animate)
1223 str = edje_object_data_get(win->focus_highlight.top, "animate");
1224 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1228 if ((win->focus_highlight.top_animate) && (previous) &&
1229 (!win->focus_highlight.prev.handled))
1230 _elm_win_focus_highlight_anim_setup(win, top);
1232 _elm_win_focus_highlight_simple_setup(win, top);
1233 evas_object_raise(top);
1236 win->focus_highlight.geometry_changed = EINA_FALSE;
1237 win->focus_highlight.prev = win->focus_highlight.cur;
1242 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1244 Evas_Event_Key_Down *ev = event_info;
1246 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1250 if ((strcmp(ev->keyname, "F12")) ||
1251 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1254 printf("Tree graph generated.\n");
1255 elm_object_tree_dot_dump(obj, "./dump.dot");
1260 _win_img_hide(void *data,
1262 Evas_Object *obj __UNUSED__,
1263 void *event_info __UNUSED__)
1265 Elm_Win *win = data;
1267 elm_widget_focus_hide_handle(win->win_obj);
1271 _win_img_mouse_up(void *data,
1273 Evas_Object *obj __UNUSED__,
1276 Elm_Win *win = data;
1277 Evas_Event_Mouse_Up *ev = event_info;
1278 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1279 elm_widget_focus_mouse_up_handle(win->win_obj);
1283 _win_img_focus_in(void *data,
1285 Evas_Object *obj __UNUSED__,
1286 void *event_info __UNUSED__)
1288 Elm_Win *win = data;
1289 elm_widget_focus_steal(win->win_obj);
1293 _win_img_focus_out(void *data,
1295 Evas_Object *obj __UNUSED__,
1296 void *event_info __UNUSED__)
1298 Elm_Win *win = data;
1299 elm_widget_focused_object_clear(win->win_obj);
1303 _win_inlined_image_set(Elm_Win *win)
1305 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1306 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1307 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1308 _elm_win_obj_callback_img_obj_del, win);
1310 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1311 _win_img_hide, win);
1312 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1313 _win_img_mouse_up, win);
1314 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1315 _win_img_focus_in, win);
1316 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1317 _win_img_focus_out, win);
1321 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1325 const char *fontpath;
1327 win = ELM_NEW(Elm_Win);
1329 #define FALLBACK_TRY(engine) \
1332 CRITICAL(engine " engine creation failed. Trying software X11."); \
1333 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1334 elm_engine_set(ELM_SOFTWARE_X11); \
1336 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1340 case ELM_WIN_INLINED_IMAGE:
1344 Evas *e = evas_object_evas_get(parent);
1347 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1350 win->img_obj = ecore_evas_object_image_new(ee);
1353 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1356 _win_inlined_image_set(win);
1360 evas_object_del(win->img_obj);
1361 win->img_obj = NULL;
1370 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1372 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1373 #ifdef HAVE_ELEMENTARY_X
1374 win->client_message_handler = ecore_event_handler_add
1375 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1378 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1380 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1381 FALLBACK_TRY("Sofware FB");
1383 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1385 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1386 FALLBACK_TRY("Sofware DirectFB");
1388 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1390 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1391 FALLBACK_TRY("Sofware-16");
1392 #ifdef HAVE_ELEMENTARY_X
1393 win->client_message_handler = ecore_event_handler_add
1394 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1397 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1399 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1400 FALLBACK_TRY("Sofware-8");
1401 #ifdef HAVE_ELEMENTARY_X
1402 win->client_message_handler = ecore_event_handler_add
1403 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1407 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1409 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1410 FALLBACK_TRY("XRender");
1411 #ifdef HAVE_ELEMENTARY_X
1412 win->client_message_handler = ecore_event_handler_add
1413 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1417 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1422 if (_elm_config->vsync)
1424 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1430 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1432 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1433 FALLBACK_TRY("OpenGL");
1434 #ifdef HAVE_ELEMENTARY_X
1435 win->client_message_handler = ecore_event_handler_add
1436 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1439 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1441 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1442 FALLBACK_TRY("Sofware Win32");
1444 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1446 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1447 FALLBACK_TRY("Sofware-16-WinCE");
1449 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1451 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1452 FALLBACK_TRY("Sofware SDL");
1454 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1456 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1457 FALLBACK_TRY("Sofware-16-SDL");
1459 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1461 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1462 FALLBACK_TRY("OpenGL SDL");
1464 else if (!strncmp(_elm_config->engine, "shot:", 5))
1466 win->ee = ecore_evas_buffer_new(1, 1);
1467 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1468 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1477 ERR("Cannot create window.");
1481 #ifdef HAVE_ELEMENTARY_X
1482 _elm_win_xwindow_get(win);
1484 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1485 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1486 // bg pixmap done by x - has other issues like can be redrawn by x before it
1487 // is filled/ready by app
1488 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1491 win->parent = parent;
1493 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1494 _elm_win_obj_callback_parent_del, win);
1496 win->evas = ecore_evas_get(win->ee);
1497 win->win_obj = elm_widget_add(win->evas);
1498 elm_widget_type_set(win->win_obj, "win");
1499 ELM_SET_WIDTYPE(widtype, "win");
1500 elm_widget_data_set(win->win_obj, win);
1501 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1502 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1503 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1504 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1505 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1506 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1507 evas_object_move(win->win_obj, 0, 0);
1508 evas_object_resize(win->win_obj, 1, 1);
1509 evas_object_layer_set(win->win_obj, 50);
1510 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1512 ecore_evas_object_associate(win->ee, win->win_obj,
1513 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1514 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1515 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1516 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1517 _elm_win_obj_callback_show, win);
1518 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1519 _elm_win_obj_callback_hide, win);
1520 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1521 _elm_win_obj_callback_del, win);
1522 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1523 _elm_win_obj_callback_move, win);
1524 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1525 _elm_win_obj_callback_resize, win);
1527 evas_object_intercept_move_callback_add(win->win_obj,
1528 _elm_win_obj_intercept_move, win);
1529 evas_object_intercept_show_callback_add(win->win_obj,
1530 _elm_win_obj_intercept_show, win);
1532 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1533 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1534 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1535 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1536 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1537 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1538 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1539 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1540 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1541 evas_font_path_append(win->evas, fontpath);
1542 if (!_elm_config->font_hinting)
1543 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1544 else if (_elm_config->font_hinting == 1)
1545 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1546 else if (_elm_config->font_hinting == 2)
1547 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1549 #ifdef HAVE_ELEMENTARY_X
1550 _elm_win_xwin_update(win);
1553 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1555 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1557 ecore_evas_fullscreen_set(win->ee, 1);
1559 #undef ENGINE_COMPARE
1561 if (_elm_config->focus_highlight_enable)
1562 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1565 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1566 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1567 _debug_key_down, win);
1569 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1571 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1574 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1576 return win->win_obj;
1580 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1584 ELM_CHECK_WIDTYPE(obj, widtype);
1585 win = elm_widget_data_get(obj);
1587 if (eina_list_data_find(win->subobjs, subobj)) return;
1588 win->subobjs = eina_list_append(win->subobjs, subobj);
1589 elm_widget_sub_object_add(obj, subobj);
1590 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1591 _elm_win_subobj_callback_del, obj);
1592 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1593 _elm_win_subobj_callback_changed_size_hints,
1595 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1596 evas_object_move(subobj, 0, 0);
1597 evas_object_resize(subobj, w, h);
1598 _elm_win_eval_subobjs(obj);
1602 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1605 ELM_CHECK_WIDTYPE(obj, widtype);
1606 win = elm_widget_data_get(obj);
1608 evas_object_event_callback_del_full(subobj,
1609 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1610 _elm_win_subobj_callback_changed_size_hints,
1612 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1613 _elm_win_subobj_callback_del, obj);
1614 win->subobjs = eina_list_remove(win->subobjs, subobj);
1615 elm_widget_sub_object_del(obj, subobj);
1616 _elm_win_eval_subobjs(obj);
1620 elm_win_title_set(Evas_Object *obj, const char *title)
1623 ELM_CHECK_WIDTYPE(obj, widtype);
1624 win = elm_widget_data_get(obj);
1626 ecore_evas_title_set(win->ee, title);
1630 elm_win_title_get(const Evas_Object *obj)
1633 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1634 win = elm_widget_data_get(obj);
1635 if (!win) return NULL;
1636 return ecore_evas_title_get(win->ee);
1640 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1643 ELM_CHECK_WIDTYPE(obj, widtype);
1644 win = elm_widget_data_get(obj);
1646 win->autodel = autodel;
1650 elm_win_autodel_get(const Evas_Object *obj)
1653 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1654 win = elm_widget_data_get(obj);
1655 if (!win) return EINA_FALSE;
1656 return win->autodel;
1660 elm_win_activate(Evas_Object *obj)
1663 ELM_CHECK_WIDTYPE(obj, widtype);
1664 win = elm_widget_data_get(obj);
1666 ecore_evas_activate(win->ee);
1670 elm_win_lower(Evas_Object *obj)
1673 ELM_CHECK_WIDTYPE(obj, widtype);
1674 win = elm_widget_data_get(obj);
1676 ecore_evas_lower(win->ee);
1680 elm_win_raise(Evas_Object *obj)
1683 ELM_CHECK_WIDTYPE(obj, widtype);
1684 win = elm_widget_data_get(obj);
1686 ecore_evas_raise(win->ee);
1690 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1693 ELM_CHECK_WIDTYPE(obj, widtype);
1694 win = elm_widget_data_get(obj);
1696 ecore_evas_borderless_set(win->ee, borderless);
1697 #ifdef HAVE_ELEMENTARY_X
1698 _elm_win_xwin_update(win);
1703 elm_win_borderless_get(const Evas_Object *obj)
1706 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1707 win = elm_widget_data_get(obj);
1708 if (!win) return EINA_FALSE;
1709 return ecore_evas_borderless_get(win->ee);
1713 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1716 ELM_CHECK_WIDTYPE(obj, widtype);
1717 win = elm_widget_data_get(obj);
1719 ecore_evas_shaped_set(win->ee, shaped);
1720 #ifdef HAVE_ELEMENTARY_X
1721 _elm_win_xwin_update(win);
1726 elm_win_shaped_get(const Evas_Object *obj)
1729 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1730 win = elm_widget_data_get(obj);
1731 if (!win) return EINA_FALSE;
1732 return ecore_evas_shaped_get(win->ee);
1736 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1739 ELM_CHECK_WIDTYPE(obj, widtype);
1740 win = elm_widget_data_get(obj);
1745 else if (win->img_obj)
1747 evas_object_image_alpha_set(win->img_obj, alpha);
1751 #ifdef HAVE_ELEMENTARY_X
1756 if (!_elm_config->compositing)
1757 elm_win_shaped_set(obj, alpha);
1759 ecore_evas_alpha_set(win->ee, alpha);
1762 ecore_evas_alpha_set(win->ee, alpha);
1763 _elm_win_xwin_update(win);
1767 ecore_evas_alpha_set(win->ee, alpha);
1772 elm_win_alpha_get(const Evas_Object *obj)
1775 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1776 win = elm_widget_data_get(obj);
1777 if (!win) return EINA_FALSE;
1778 return ecore_evas_alpha_get(win->ee);
1782 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1785 ELM_CHECK_WIDTYPE(obj, widtype);
1786 win = elm_widget_data_get(obj);
1792 else if (win->img_obj)
1794 evas_object_image_alpha_set(win->img_obj, transparent);
1798 #ifdef HAVE_ELEMENTARY_X
1801 ecore_evas_transparent_set(win->ee, transparent);
1802 _elm_win_xwin_update(win);
1806 ecore_evas_transparent_set(win->ee, transparent);
1811 elm_win_transparent_get(const Evas_Object *obj)
1814 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1815 win = elm_widget_data_get(obj);
1816 if (!win) return EINA_FALSE;
1818 return ecore_evas_transparent_get(win->ee);
1822 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1825 ELM_CHECK_WIDTYPE(obj, widtype);
1826 win = elm_widget_data_get(obj);
1828 ecore_evas_override_set(win->ee, override);
1829 #ifdef HAVE_ELEMENTARY_X
1830 _elm_win_xwin_update(win);
1835 elm_win_override_get(const Evas_Object *obj)
1838 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1839 win = elm_widget_data_get(obj);
1840 if (!win) return EINA_FALSE;
1841 return ecore_evas_override_get(win->ee);
1845 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1848 ELM_CHECK_WIDTYPE(obj, widtype);
1849 win = elm_widget_data_get(obj);
1852 // YYY: handle if win->img_obj
1853 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1854 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1855 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1857 // these engines... can ONLY be fullscreen
1862 ecore_evas_fullscreen_set(win->ee, fullscreen);
1863 #ifdef HAVE_ELEMENTARY_X
1864 _elm_win_xwin_update(win);
1867 #undef ENGINE_COMPARE
1871 elm_win_fullscreen_get(const Evas_Object *obj)
1874 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1875 win = elm_widget_data_get(obj);
1876 if (!win) return EINA_FALSE;
1878 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1879 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1880 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1882 // these engines... can ONLY be fullscreen
1887 return ecore_evas_fullscreen_get(win->ee);
1889 #undef ENGINE_COMPARE
1893 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1896 ELM_CHECK_WIDTYPE(obj, widtype);
1897 win = elm_widget_data_get(obj);
1899 // YYY: handle if win->img_obj
1900 ecore_evas_maximized_set(win->ee, maximized);
1901 #ifdef HAVE_ELEMENTARY_X
1902 _elm_win_xwin_update(win);
1907 elm_win_maximized_get(const Evas_Object *obj)
1910 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1911 win = elm_widget_data_get(obj);
1912 if (!win) return EINA_FALSE;
1913 return ecore_evas_maximized_get(win->ee);
1917 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1920 ELM_CHECK_WIDTYPE(obj, widtype);
1921 win = elm_widget_data_get(obj);
1923 ecore_evas_iconified_set(win->ee, iconified);
1924 #ifdef HAVE_ELEMENTARY_X
1925 _elm_win_xwin_update(win);
1930 elm_win_iconified_get(const Evas_Object *obj)
1933 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1934 win = elm_widget_data_get(obj);
1935 if (!win) return EINA_FALSE;
1936 return ecore_evas_iconified_get(win->ee);
1940 elm_win_layer_set(Evas_Object *obj, int layer)
1943 ELM_CHECK_WIDTYPE(obj, widtype);
1944 win = elm_widget_data_get(obj);
1946 ecore_evas_layer_set(win->ee, layer);
1947 #ifdef HAVE_ELEMENTARY_X
1948 _elm_win_xwin_update(win);
1953 elm_win_layer_get(const Evas_Object *obj)
1956 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1957 win = elm_widget_data_get(obj);
1958 if (!win) return -1;
1959 return ecore_evas_layer_get(win->ee);
1963 elm_win_rotation_set(Evas_Object *obj, int rotation)
1966 ELM_CHECK_WIDTYPE(obj, widtype);
1967 win = elm_widget_data_get(obj);
1969 if (win->rot == rotation) return;
1970 win->rot = rotation;
1971 ecore_evas_rotation_set(win->ee, rotation);
1972 evas_object_size_hint_min_set(obj, -1, -1);
1973 evas_object_size_hint_max_set(obj, -1, -1);
1974 _elm_win_eval_subobjs(obj);
1975 #ifdef HAVE_ELEMENTARY_X
1976 _elm_win_xwin_update(win);
1981 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1984 ELM_CHECK_WIDTYPE(obj, widtype);
1985 win = elm_widget_data_get(obj);
1987 if (win->rot == rotation) return;
1988 win->rot = rotation;
1989 ecore_evas_rotation_with_resize_set(win->ee, rotation);
1990 evas_object_size_hint_min_set(obj, -1, -1);
1991 evas_object_size_hint_max_set(obj, -1, -1);
1992 _elm_win_eval_subobjs(obj);
1993 #ifdef HAVE_ELEMENTARY_X
1994 _elm_win_xwin_update(win);
1999 elm_win_rotation_get(const Evas_Object *obj)
2002 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2003 win = elm_widget_data_get(obj);
2004 if (!win) return -1;
2009 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2012 ELM_CHECK_WIDTYPE(obj, widtype);
2013 win = elm_widget_data_get(obj);
2015 ecore_evas_sticky_set(win->ee, sticky);
2016 #ifdef HAVE_ELEMENTARY_X
2017 _elm_win_xwin_update(win);
2022 elm_win_sticky_get(const Evas_Object *obj)
2025 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2026 win = elm_widget_data_get(obj);
2027 if (!win) return EINA_FALSE;
2028 return ecore_evas_sticky_get(win->ee);
2032 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2035 ELM_CHECK_WIDTYPE(obj, widtype);
2036 win = elm_widget_data_get(obj);
2038 if (mode == win->kbdmode) return;
2039 #ifdef HAVE_ELEMENTARY_X
2040 _elm_win_xwindow_get(win);
2042 win->kbdmode = mode;
2043 #ifdef HAVE_ELEMENTARY_X
2045 ecore_x_e_virtual_keyboard_state_set
2046 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2050 EAPI Elm_Win_Keyboard_Mode
2051 elm_win_keyboard_mode_get(const Evas_Object *obj)
2054 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2055 win = elm_widget_data_get(obj);
2056 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2057 return win->kbdmode;
2061 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2064 ELM_CHECK_WIDTYPE(obj, widtype);
2065 win = elm_widget_data_get(obj);
2067 #ifdef HAVE_ELEMENTARY_X
2068 _elm_win_xwindow_get(win);
2070 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2075 elm_win_keyboard_win_get(const Evas_Object *obj)
2078 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2079 win = elm_widget_data_get(obj);
2080 if (!win) return EINA_FALSE;
2081 #ifdef HAVE_ELEMENTARY_X
2082 _elm_win_xwindow_get(win);
2084 return ecore_x_e_virtual_keyboard_get(win->xwin);
2090 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2093 ELM_CHECK_WIDTYPE(obj, widtype);
2094 win = elm_widget_data_get(obj);
2096 if (x) *x = win->screen.x;
2097 if (y) *y = win->screen.y;
2101 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2104 ELM_CHECK_WIDTYPE(obj, widtype);
2105 win = elm_widget_data_get(obj);
2107 #ifdef HAVE_ELEMENTARY_X
2108 _elm_win_xwindow_get(win);
2110 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2115 elm_win_conformant_get(const Evas_Object *obj)
2118 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2119 win = elm_widget_data_get(obj);
2120 if (!win) return EINA_FALSE;
2121 #ifdef HAVE_ELEMENTARY_X
2122 _elm_win_xwindow_get(win);
2124 return ecore_x_e_illume_conformant_get(win->xwin);
2130 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2133 ELM_CHECK_WIDTYPE(obj, widtype);
2134 win = elm_widget_data_get(obj);
2136 #ifdef HAVE_ELEMENTARY_X
2137 _elm_win_xwindow_get(win);
2140 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2143 Ecore_X_Window_State states[2];
2145 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2146 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2147 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2148 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2155 elm_win_quickpanel_get(const Evas_Object *obj)
2158 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2159 win = elm_widget_data_get(obj);
2160 if (!win) return EINA_FALSE;
2161 #ifdef HAVE_ELEMENTARY_X
2162 _elm_win_xwindow_get(win);
2164 return ecore_x_e_illume_quickpanel_get(win->xwin);
2170 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2173 ELM_CHECK_WIDTYPE(obj, widtype);
2174 win = elm_widget_data_get(obj);
2176 #ifdef HAVE_ELEMENTARY_X
2177 _elm_win_xwindow_get(win);
2179 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2184 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2187 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2188 win = elm_widget_data_get(obj);
2189 if (!win) return -1;
2190 #ifdef HAVE_ELEMENTARY_X
2191 _elm_win_xwindow_get(win);
2193 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2199 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2202 ELM_CHECK_WIDTYPE(obj, widtype);
2203 win = elm_widget_data_get(obj);
2205 #ifdef HAVE_ELEMENTARY_X
2206 _elm_win_xwindow_get(win);
2208 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2213 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2216 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2217 win = elm_widget_data_get(obj);
2218 if (!win) return -1;
2219 #ifdef HAVE_ELEMENTARY_X
2220 _elm_win_xwindow_get(win);
2222 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2228 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2231 ELM_CHECK_WIDTYPE(obj, widtype);
2232 win = elm_widget_data_get(obj);
2234 #ifdef HAVE_ELEMENTARY_X
2235 _elm_win_xwindow_get(win);
2237 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2242 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2245 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2246 win = elm_widget_data_get(obj);
2248 #ifdef HAVE_ELEMENTARY_X
2249 _elm_win_xwindow_get(win);
2251 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2257 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2260 ELM_CHECK_WIDTYPE(obj, widtype);
2261 win = elm_widget_data_get(obj);
2263 #ifdef HAVE_ELEMENTARY_X
2264 _elm_win_xwindow_get(win);
2269 Ecore_X_Window_State states[2];
2271 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2272 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2273 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2274 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2281 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2284 ELM_CHECK_WIDTYPE(obj, widtype);
2285 win = elm_widget_data_get(obj);
2287 #ifdef HAVE_ELEMENTARY_X
2288 _elm_win_xwindow_get(win);
2293 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2294 ecore_x_e_illume_focus_back_send(win->xwin);
2296 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2297 ecore_x_e_illume_focus_forward_send(win->xwin);
2299 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2300 ecore_x_e_illume_focus_home_send(win->xwin);
2302 case ELM_ILLUME_COMMAND_CLOSE:
2303 ecore_x_e_illume_close_send(win->xwin);
2313 elm_win_inlined_image_object_get(Evas_Object *obj)
2316 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2317 win = elm_widget_data_get(obj);
2318 if (!win) return NULL;
2319 return win->img_obj;
2323 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2327 ELM_CHECK_WIDTYPE(obj, widtype);
2329 win = elm_widget_data_get(obj);
2330 enabled = !!enabled;
2331 if (win->focus_highlight.enabled == enabled)
2334 win->focus_highlight.enabled = enabled;
2336 if (win->focus_highlight.enabled)
2337 _elm_win_focus_highlight_init(win);
2339 _elm_win_focus_highlight_shutdown(win);
2343 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2347 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2349 win = elm_widget_data_get(obj);
2350 return win->focus_highlight.enabled;
2354 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2358 ELM_CHECK_WIDTYPE(obj, widtype);
2360 win = elm_widget_data_get(obj);
2361 eina_stringshare_replace(&win->focus_highlight.style, style);
2362 win->focus_highlight.changed_theme = EINA_TRUE;
2363 _elm_win_focus_highlight_reconfigure_job_start(win);
2367 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2371 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2373 win = elm_widget_data_get(obj);
2374 return win->focus_highlight.style;
2378 elm_win_indicator_state_set(Evas_Object *obj, int show_state)
2381 if (strcmp(elm_widget_type_get(obj), "win")) return;
2382 win = elm_widget_data_get(obj);
2384 #ifdef HAVE_ELEMENTARY_X
2385 _elm_win_xwindow_get(win);
2387 return ecore_x_window_prop_property_set (win->xwin,
2388 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, &show_state, 1);
2394 elm_win_indicator_state_get(Evas_Object *obj)
2397 if (strcmp(elm_widget_type_get(obj), "win")) return -1;
2398 win = elm_widget_data_get(obj);
2399 if (!win) return -1;
2400 #ifdef HAVE_ELEMENTARY_X
2401 _elm_win_xwindow_get(win);
2407 unsigned int *prop_data = NULL;
2409 ret = ecore_x_window_prop_property_get (win->xwin,
2410 ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE, ECORE_X_ATOM_CARDINAL, 32, (void *)&prop_data, &count);
2411 if( ret && prop_data )
2412 memcpy (&show, prop_data, sizeof (int));
2414 if (prop_data) free (prop_data);
2423 typedef struct _Widget_Data Widget_Data;
2428 Evas_Object *content;
2431 static void _del_hook(Evas_Object *obj);
2432 static void _theme_hook(Evas_Object *obj);
2433 static void _sizing_eval(Evas_Object *obj);
2434 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2435 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2437 static const char *widtype2 = NULL;
2440 _del_hook(Evas_Object *obj)
2442 Widget_Data *wd = elm_widget_data_get(obj);
2448 _theme_hook(Evas_Object *obj)
2450 Widget_Data *wd = elm_widget_data_get(obj);
2451 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2453 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2458 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2460 Widget_Data *wd = elm_widget_data_get(obj);
2465 /* Try Focus cycle in subitem */
2468 elm_widget_focus_next_get(wd->content, dir, next);
2473 *next = (Evas_Object *)obj;
2478 _sizing_eval(Evas_Object *obj)
2480 Widget_Data *wd = elm_widget_data_get(obj);
2481 Evas_Coord minw = -1, minh = -1;
2483 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2484 edje_object_size_min_calc(wd->frm, &minw, &minh);
2485 evas_object_size_hint_min_set(obj, minw, minh);
2486 evas_object_size_hint_max_set(obj, -1, -1);
2490 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2496 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2498 Widget_Data *wd = elm_widget_data_get(obj);
2499 Evas_Object *sub = event_info;
2500 if (sub == wd->content)
2502 evas_object_event_callback_del_full
2503 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2510 elm_win_inwin_add(Evas_Object *obj)
2516 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2517 win = elm_widget_data_get(obj);
2518 if (!win) return NULL;
2519 wd = ELM_NEW(Widget_Data);
2520 obj2 = elm_widget_add(win->evas);
2521 elm_widget_type_set(obj2, "inwin");
2522 ELM_SET_WIDTYPE(widtype2, "inwin");
2523 elm_widget_sub_object_add(obj, obj2);
2524 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2525 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2526 elm_win_resize_object_add(obj, obj2);
2528 elm_widget_data_set(obj2, wd);
2529 elm_widget_del_hook_set(obj2, _del_hook);
2530 elm_widget_theme_hook_set(obj2, _theme_hook);
2531 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2532 elm_widget_can_focus_set(obj2, EINA_TRUE);
2533 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2535 wd->frm = edje_object_add(win->evas);
2536 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2537 elm_widget_resize_object_set(obj2, wd->frm);
2539 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2546 elm_win_inwin_activate(Evas_Object *obj)
2548 ELM_CHECK_WIDTYPE(obj, widtype2);
2549 Widget_Data *wd = elm_widget_data_get(obj);
2551 evas_object_raise(obj);
2552 evas_object_show(obj);
2553 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2554 elm_object_focus(obj);
2558 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2560 ELM_CHECK_WIDTYPE(obj, widtype2);
2561 Widget_Data *wd = elm_widget_data_get(obj);
2563 if (wd->content == content) return;
2564 if (wd->content) evas_object_del(wd->content);
2565 wd->content = content;
2568 elm_widget_sub_object_add(obj, content);
2569 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2570 _changed_size_hints, obj);
2571 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2577 elm_win_inwin_content_get(const Evas_Object *obj)
2579 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2580 Widget_Data *wd = elm_widget_data_get(obj);
2581 if (!wd) return NULL;
2586 elm_win_inwin_content_unset(Evas_Object *obj)
2588 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2589 Widget_Data *wd = elm_widget_data_get(obj);
2590 if (!wd) return NULL;
2591 if (!wd->content) return NULL;
2592 Evas_Object *content = wd->content;
2593 elm_widget_sub_object_del(obj, wd->content);
2594 edje_object_part_unswallow(wd->frm, wd->content);
2599 /* windowing spcific calls - shall we do this differently? */
2601 static Ecore_X_Window
2602 _elm_ee_win_get(const Evas_Object *obj)
2605 #ifdef HAVE_ELEMENTARY_X
2606 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2607 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2613 elm_win_xwindow_get(const Evas_Object *obj)
2615 Ecore_X_Window xwin = 0;
2620 type = elm_widget_type_get(obj);
2621 if (!type) return 0;
2622 if (type != widtype) return _elm_ee_win_get(obj);
2623 #ifdef HAVE_ELEMENTARY_X
2624 win = elm_widget_data_get(obj);
2625 if (!win) return xwin;
2626 if (win->xwin) return win->xwin;
2627 if (win->parent) return elm_win_xwindow_get(win->parent);