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 if (win->show_count == 1)
312 elm_object_focus_set(win->win_obj, EINA_TRUE);
316 elm_widget_focus_restore(win->win_obj);
317 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
318 win->focus_highlight.cur.visible = EINA_TRUE;
319 _elm_win_focus_highlight_reconfigure_job_start(win);
323 else if (win->img_obj)
330 _elm_win_focus_out(Ecore_Evas *ee)
332 Evas_Object *obj = ecore_evas_object_associate_get(ee);
336 win = elm_widget_data_get(obj);
338 elm_object_focus_set(win->win_obj, EINA_FALSE);
339 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
340 win->focus_highlight.cur.visible = EINA_FALSE;
341 _elm_win_focus_highlight_reconfigure_job_start(win);
345 else if (win->img_obj)
352 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
354 Elm_Win *wd = elm_widget_data_get(obj);
355 const Eina_List *items;
356 void *(*list_data_get) (const Eina_List *list);
364 if (!(items = elm_widget_focus_custom_chain_get(obj)))
370 list_data_get = eina_list_data_get;
372 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
378 *next = (Evas_Object *)obj;
383 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
385 Elm_Win *win = elm_widget_data_get(obj);
389 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
391 evas_object_focus_set(obj, elm_widget_focus_get(obj));
395 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
397 if (type == EVAS_CALLBACK_KEY_DOWN)
399 Evas_Event_Key_Down *ev = event_info;
400 if (!strcmp(ev->keyname, "Tab"))
402 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
403 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
405 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
406 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
409 else if ((!strcmp(ev->keyname, "Left")) ||
410 (!strcmp(ev->keyname, "KP_Left")))
412 //TODO : woohyun jung
414 else if ((!strcmp(ev->keyname, "Right")) ||
415 (!strcmp(ev->keyname, "KP_Right")))
417 //TODO : woohyun jung
419 else if ((!strcmp(ev->keyname, "Up")) ||
420 (!strcmp(ev->keyname, "KP_Up")))
422 //TODO : woohyun jung
424 else if ((!strcmp(ev->keyname, "Down")) ||
425 (!strcmp(ev->keyname, "KP_Down")))
427 //TODO : woohyun jung
435 _deferred_ecore_evas_free(void *data)
437 ecore_evas_free(data);
438 _elm_win_deferred_free--;
442 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
446 if (!win->show_count) win->show_count++;
447 if (win->shot.info) _shot_handle(win);
451 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
458 else if (win->img_obj)
460 evas_object_hide(win->img_obj);
465 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
472 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
473 _elm_win_obj_callback_parent_del, win);
476 if (win->autodel_clear) *(win->autodel_clear) = -1;
477 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
478 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
481 ecore_evas_callback_delete_request_set(win->ee, NULL);
482 ecore_evas_callback_resize_set(win->ee, NULL);
484 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
485 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
486 if (win->shot.info) eina_stringshare_del(win->shot.info);
487 if (win->shot.timer) ecore_timer_del(win->shot.timer);
488 while (((child = evas_object_bottom_get(win->evas))) &&
491 evas_object_del(child);
493 while (((child = evas_object_top_get(win->evas))) &&
496 evas_object_del(child);
498 #ifdef HAVE_ELEMENTARY_X
499 if (win->client_message_handler)
500 ecore_event_handler_del(win->client_message_handler);
502 // FIXME: Why are we flushing edje on every window destroy ??
503 // edje_file_cache_flush();
504 // edje_collection_cache_flush();
505 // evas_image_cache_flush(win->evas);
506 // evas_font_cache_flush(win->evas);
507 // FIXME: we are in the del handler for the object and delete the canvas
508 // that lives under it from the handler... nasty. deferring doesn't help either
518 ecore_job_add(_deferred_ecore_evas_free, win->ee);
519 _elm_win_deferred_free++;
523 _elm_win_focus_highlight_shutdown(win);
524 eina_stringshare_del(win->focus_highlight.style);
528 if ((!_elm_win_list) &&
529 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
531 edje_file_cache_flush();
532 edje_collection_cache_flush();
533 evas_image_cache_flush(e);
534 evas_font_cache_flush(e);
540 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
543 if (!win->img_obj) return;
544 evas_object_event_callback_del_full
545 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
546 evas_object_del(win->img_obj);
550 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
553 if (obj == win->parent) win->parent = NULL;
557 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
563 if ((x != win->screen.x) || (y != win->screen.y))
567 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
572 evas_object_move(obj, x, y);
577 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
580 // this is called to make sure all smart containers have calculated their
581 // sizes BEFORE we show the window to make sure it initially appears at
582 // our desired size (ie min size is known first)
583 evas_smart_objects_calculate(evas_object_evas_get(obj));
584 evas_object_show(obj);
588 else if (win->img_obj)
590 evas_object_show(win->img_obj);
595 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
599 if (ecore_evas_override_get(win->ee))
603 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
606 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
611 else if (win->img_obj)
615 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
618 // evas_object_move(win->img_obj, x, y);
623 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
630 else if (win->img_obj)
632 Evas_Coord w = 1, h = 1;
634 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
637 evas_object_image_size_set(win->img_obj, w, h);
642 _elm_win_delete_request(Ecore_Evas *ee)
644 Evas_Object *obj = ecore_evas_object_associate_get(ee);
646 if (strcmp(elm_widget_type_get(obj), "win")) return;
648 win = elm_widget_data_get(obj);
650 int autodel = win->autodel;
651 win->autodel_clear = &autodel;
652 evas_object_ref(win->win_obj);
653 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
654 // FIXME: if above callback deletes - then the below will be invalid
655 if (autodel) evas_object_del(win->win_obj);
656 else win->autodel_clear = NULL;
657 evas_object_unref(win->win_obj);
661 _elm_win_resize_job(void *data)
668 win->deferred_resize_job = NULL;
669 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
670 evas_object_resize(win->win_obj, w, h);
674 else if (win->img_obj)
677 EINA_LIST_FOREACH(win->subobjs, l, obj)
679 evas_object_move(obj, 0, 0);
680 evas_object_resize(obj, w, h);
684 #ifdef HAVE_ELEMENTARY_X
686 _elm_win_xwindow_get(Elm_Win *win)
690 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
691 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
693 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
695 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
696 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
697 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
698 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
699 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
700 ENGINE_COMPARE(ELM_OPENGL_SDL))
703 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
705 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
707 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
709 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
712 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
714 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
717 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
719 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
721 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
723 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
725 #undef ENGINE_COMPARE
729 #ifdef HAVE_ELEMENTARY_X
731 _elm_win_xwin_update(Elm_Win *win)
733 _elm_win_xwindow_get(win);
738 win2 = elm_widget_data_get(win->parent);
742 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
746 if (!win->xwin) return; /* nothing more to do */
751 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
753 case ELM_WIN_DIALOG_BASIC:
754 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
756 case ELM_WIN_DESKTOP:
757 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
760 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
762 case ELM_WIN_TOOLBAR:
763 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
766 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
768 case ELM_WIN_UTILITY:
769 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
772 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
774 case ELM_WIN_DROPDOWN_MENU:
775 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
777 case ELM_WIN_POPUP_MENU:
778 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
780 case ELM_WIN_TOOLTIP:
781 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
783 case ELM_WIN_NOTIFICATION:
784 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
787 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
790 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
795 ecore_x_e_virtual_keyboard_state_set
796 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
801 _elm_win_eval_subobjs(Evas_Object *obj)
804 const Evas_Object *child;
806 Elm_Win *win = elm_widget_data_get(obj);
807 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
811 EINA_LIST_FOREACH(win->subobjs, l, child)
813 evas_object_size_hint_weight_get(child, &wx, &wy);
814 if (wx == 0.0) xx = 0;
815 if (wy == 0.0) xy = 0;
817 evas_object_size_hint_min_get(child, &w, &h);
820 if (w > minw) minw = w;
821 if (h > minh) minh = h;
823 evas_object_size_hint_max_get(child, &w, &h);
826 if (maxw == -1) maxw = w;
827 else if ((w > 0) && (w < maxw)) maxw = w;
828 if (maxh == -1) maxh = h;
829 else if ((h > 0) && (h < maxh)) maxh = h;
831 if (!xx) maxw = minw;
833 if (!xy) maxh = minh;
835 evas_object_size_hint_min_set(obj, minw, minh);
836 evas_object_size_hint_max_set(obj, maxw, maxh);
837 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
838 if (w < minw) w = minw;
839 if (h < minh) h = minh;
840 if ((maxw >= 0) && (w > maxw)) w = maxw;
841 if ((maxh >= 0) && (h > maxh)) h = maxh;
842 evas_object_resize(obj, w, h);
846 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
848 Elm_Win *win = elm_widget_data_get(data);
849 win->subobjs = eina_list_remove(win->subobjs, obj);
850 _elm_win_eval_subobjs(win->win_obj);
854 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
856 _elm_win_eval_subobjs(data);
860 _elm_win_shutdown(void)
862 while (_elm_win_list)
863 evas_object_del(_elm_win_list->data);
867 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
874 EINA_LIST_FOREACH(_elm_win_list, l, obj)
875 elm_widget_theme(obj);
879 EINA_LIST_FOREACH(_elm_win_list, l, obj)
880 elm_widget_theme_specific(obj, th, EINA_FALSE);
884 #ifdef HAVE_ELEMENTARY_X
886 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
889 Ecore_X_Event_Client_Message *e = event;
891 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
892 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
894 if ((unsigned)e->data.l[0] == win->xwin)
896 Evas *evas = evas_object_evas_get(win->win_obj);
899 edje_file_cache_flush();
900 edje_collection_cache_flush();
901 evas_image_cache_flush(evas);
902 evas_font_cache_flush(evas);
906 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
908 if ((unsigned)e->data.l[0] == win->xwin)
910 Evas *evas = evas_object_evas_get(win->win_obj);
913 edje_file_cache_flush();
914 edje_collection_cache_flush();
915 evas_image_cache_flush(evas);
916 evas_font_cache_flush(evas);
917 evas_render_dump(evas);
921 return ECORE_CALLBACK_PASS_ON;
926 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
930 win->focus_highlight.geometry_changed = EINA_TRUE;
931 _elm_win_focus_highlight_reconfigure_job_start(win);
935 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
939 win->focus_highlight.geometry_changed = EINA_TRUE;
940 _elm_win_focus_highlight_reconfigure_job_start(win);
944 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
948 win->focus_highlight.cur.target = NULL;
950 _elm_win_focus_highlight_reconfigure_job_start(win);
954 _elm_win_focus_target_callbacks_add(Elm_Win *win)
956 Evas_Object *obj = win->focus_highlight.cur.target;
958 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
959 _elm_win_focus_target_move, win);
960 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
961 _elm_win_focus_target_resize, win);
962 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
963 _elm_win_focus_target_del, win);
967 _elm_win_focus_target_callbacks_del(Elm_Win *win)
969 Evas_Object *obj = win->focus_highlight.cur.target;
971 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
972 _elm_win_focus_target_move, win);
973 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
974 _elm_win_focus_target_resize, win);
975 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
976 _elm_win_focus_target_del, win);
980 _elm_win_focus_target_get(Evas_Object *obj)
982 Evas_Object *o = obj;
986 if (elm_widget_is(o))
988 if (!elm_widget_highlight_ignore_get(o))
990 o = elm_widget_parent_get(o);
992 o = evas_object_smart_parent_get(o);
996 o = elm_widget_parent_widget_get(o);
998 o = evas_object_smart_parent_get(o);
1007 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1009 Evas_Object *obj = event_info, *target;
1010 Elm_Win *win = data;
1012 if (win->focus_highlight.cur.target == obj)
1015 target = _elm_win_focus_target_get(obj);
1016 win->focus_highlight.cur.target = target;
1017 if (elm_widget_highlight_in_theme_get(target))
1018 win->focus_highlight.cur.handled = EINA_TRUE;
1020 _elm_win_focus_target_callbacks_add(win);
1022 _elm_win_focus_highlight_reconfigure_job_start(win);
1026 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1028 Elm_Win *win = data;
1030 if (!win->focus_highlight.cur.target)
1033 if (!win->focus_highlight.cur.handled)
1034 _elm_win_focus_target_callbacks_del(win);
1035 win->focus_highlight.cur.target = NULL;
1036 win->focus_highlight.cur.handled = EINA_FALSE;
1038 _elm_win_focus_highlight_reconfigure_job_start(win);
1042 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1044 evas_object_hide(obj);
1048 _elm_win_focus_highlight_init(Elm_Win *win)
1050 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1051 _elm_win_object_focus_in, win);
1052 evas_event_callback_add(win->evas,
1053 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1054 _elm_win_object_focus_out, win);
1056 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1058 win->focus_highlight.top = edje_object_add(win->evas);
1059 win->focus_highlight.changed_theme = EINA_TRUE;
1060 edje_object_signal_callback_add(win->focus_highlight.top,
1061 "elm,action,focus,hide,end", "",
1062 _elm_win_focus_highlight_hide, NULL);
1063 edje_object_signal_callback_add(win->focus_highlight.top,
1064 "elm,action,focus,anim,end", "",
1065 _elm_win_focus_highlight_anim_end, win);
1066 _elm_win_focus_highlight_reconfigure_job_start(win);
1070 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1072 _elm_win_focus_highlight_reconfigure_job_stop(win);
1073 if (win->focus_highlight.cur.target)
1075 _elm_win_focus_target_callbacks_del(win);
1076 win->focus_highlight.cur.target = NULL;
1078 if (win->focus_highlight.top)
1080 evas_object_del(win->focus_highlight.top);
1081 win->focus_highlight.top = NULL;
1084 evas_event_callback_del_full(win->evas,
1085 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1086 _elm_win_object_focus_in, win);
1087 evas_event_callback_del_full(win->evas,
1088 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1089 _elm_win_object_focus_out, win);
1093 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1097 top = win->focus_highlight.top;
1102 evas_object_show(top);
1103 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1109 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1114 _elm_win_focus_highlight_reconfigure_job(void *data)
1116 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1120 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1122 if (win->focus_highlight.reconf_job)
1123 ecore_job_del(win->focus_highlight.reconf_job);
1124 win->focus_highlight.reconf_job = ecore_job_add(
1125 _elm_win_focus_highlight_reconfigure_job, win);
1129 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1131 if (win->focus_highlight.reconf_job)
1132 ecore_job_del(win->focus_highlight.reconf_job);
1133 win->focus_highlight.reconf_job = NULL;
1137 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1139 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1140 Evas_Coord x, y, w, h;
1142 clip = evas_object_clip_get(target);
1143 evas_object_geometry_get(target, &x, &y, &w, &h);
1145 evas_object_move(obj, x, y);
1146 evas_object_resize(obj, w, h);
1147 evas_object_clip_set(obj, clip);
1151 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1153 Evas_Coord tx, ty, tw, th;
1154 Evas_Coord w, h, px, py, pw, ph;
1155 Edje_Message_Int_Set *m;
1156 Evas_Object *previous = win->focus_highlight.prev.target;
1157 Evas_Object *target = win->focus_highlight.cur.target;
1159 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1160 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1161 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1162 evas_object_move(obj, 0, 0);
1163 evas_object_resize(obj, tw, th);
1164 evas_object_clip_unset(obj);
1166 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1176 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1180 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1182 Elm_Win *win = data;
1183 _elm_win_focus_highlight_simple_setup(win, obj);
1187 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1189 Evas_Object *target = win->focus_highlight.cur.target;
1190 Evas_Object *previous = win->focus_highlight.prev.target;
1191 Evas_Object *top = win->focus_highlight.top;
1192 Eina_Bool visible_changed;
1193 Eina_Bool common_visible;
1194 const char *sig = NULL;
1196 _elm_win_focus_highlight_reconfigure_job_stop(win);
1198 visible_changed = (win->focus_highlight.cur.visible !=
1199 win->focus_highlight.prev.visible);
1201 if ((target == previous) && (!visible_changed) &&
1202 (!win->focus_highlight.geometry_changed))
1205 if ((previous) && (win->focus_highlight.prev.handled))
1206 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1209 common_visible = EINA_FALSE;
1210 else if (win->focus_highlight.cur.handled)
1212 common_visible = EINA_FALSE;
1213 if (win->focus_highlight.cur.visible)
1214 sig = "elm,action,focus_highlight,show";
1216 sig = "elm,action,focus_highlight,hide";
1219 common_visible = win->focus_highlight.cur.visible;
1221 _elm_win_focus_highlight_visible_set(win, common_visible);
1223 elm_widget_signal_emit(target, sig, "elm");
1225 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1228 if (win->focus_highlight.changed_theme)
1231 if (win->focus_highlight.style)
1232 str = win->focus_highlight.style;
1235 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1237 win->focus_highlight.changed_theme = EINA_FALSE;
1239 if (_elm_config->focus_highlight_animate)
1241 str = edje_object_data_get(win->focus_highlight.top, "animate");
1242 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1246 if ((win->focus_highlight.top_animate) && (previous) &&
1247 (!win->focus_highlight.prev.handled))
1248 _elm_win_focus_highlight_anim_setup(win, top);
1250 _elm_win_focus_highlight_simple_setup(win, top);
1251 evas_object_raise(top);
1254 win->focus_highlight.geometry_changed = EINA_FALSE;
1255 win->focus_highlight.prev = win->focus_highlight.cur;
1260 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1262 Evas_Event_Key_Down *ev = event_info;
1264 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1268 if ((strcmp(ev->keyname, "F12")) ||
1269 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1272 printf("Tree graph generated.\n");
1273 elm_object_tree_dot_dump(obj, "./dump.dot");
1278 _win_img_hide(void *data,
1280 Evas_Object *obj __UNUSED__,
1281 void *event_info __UNUSED__)
1283 Elm_Win *win = data;
1285 elm_widget_focus_hide_handle(win->win_obj);
1289 _win_img_mouse_up(void *data,
1291 Evas_Object *obj __UNUSED__,
1294 Elm_Win *win = data;
1295 Evas_Event_Mouse_Up *ev = event_info;
1296 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1297 elm_widget_focus_mouse_up_handle(win->win_obj);
1301 _win_img_focus_in(void *data,
1303 Evas_Object *obj __UNUSED__,
1304 void *event_info __UNUSED__)
1306 Elm_Win *win = data;
1307 elm_widget_focus_steal(win->win_obj);
1311 _win_img_focus_out(void *data,
1313 Evas_Object *obj __UNUSED__,
1314 void *event_info __UNUSED__)
1316 Elm_Win *win = data;
1317 elm_widget_focused_object_clear(win->win_obj);
1321 _win_inlined_image_set(Elm_Win *win)
1323 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1324 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1325 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1326 _elm_win_obj_callback_img_obj_del, win);
1328 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1329 _win_img_hide, win);
1330 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1331 _win_img_mouse_up, win);
1332 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1333 _win_img_focus_in, win);
1334 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1335 _win_img_focus_out, win);
1339 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1343 const char *fontpath;
1345 win = ELM_NEW(Elm_Win);
1347 #define FALLBACK_TRY(engine) \
1350 CRITICAL(engine " engine creation failed. Trying software X11."); \
1351 elm_engine_set(ELM_SOFTWARE_X11); \
1352 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1354 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1358 case ELM_WIN_INLINED_IMAGE:
1361 Evas *e = evas_object_evas_get(parent);
1364 ee = ecore_evas_ecore_evas_get(e);
1366 win->img_obj = ecore_evas_object_image_new(ee);
1367 if (!win->img_obj) break;
1368 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1371 _win_inlined_image_set(win);
1374 evas_object_del(win->img_obj);
1375 win->img_obj = NULL;
1379 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1381 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1382 #ifdef HAVE_ELEMENTARY_X
1383 win->client_message_handler = ecore_event_handler_add
1384 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1387 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1389 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1390 FALLBACK_TRY("Sofware FB");
1392 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1394 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1395 FALLBACK_TRY("Sofware DirectFB");
1397 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1399 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1400 FALLBACK_TRY("Sofware-16");
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);
1406 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1408 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1409 FALLBACK_TRY("Sofware-8");
1410 #ifdef HAVE_ELEMENTARY_X
1411 win->client_message_handler = ecore_event_handler_add
1412 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1416 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1418 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1419 FALLBACK_TRY("XRender");
1420 #ifdef HAVE_ELEMENTARY_X
1421 win->client_message_handler = ecore_event_handler_add
1422 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1426 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1431 if (_elm_config->vsync)
1433 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1439 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1441 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1442 FALLBACK_TRY("OpenGL");
1443 #ifdef HAVE_ELEMENTARY_X
1444 win->client_message_handler = ecore_event_handler_add
1445 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1448 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1450 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1451 FALLBACK_TRY("Sofware Win32");
1453 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1455 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1456 FALLBACK_TRY("Sofware-16-WinCE");
1458 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1460 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1461 FALLBACK_TRY("Sofware SDL");
1463 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1465 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1466 FALLBACK_TRY("Sofware-16-SDL");
1468 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1470 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1471 FALLBACK_TRY("OpenGL SDL");
1473 else if (ENGINE_COMPARE(ELM_BUFFER))
1475 win->ee = ecore_evas_buffer_new(1, 1);
1477 else if (!strncmp(_elm_config->engine, "shot:", 5))
1479 win->ee = ecore_evas_buffer_new(1, 1);
1480 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1481 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1490 ERR("Cannot create window.");
1494 #ifdef HAVE_ELEMENTARY_X
1495 _elm_win_xwindow_get(win);
1497 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1498 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1499 // bg pixmap done by x - has other issues like can be redrawn by x before it
1500 // is filled/ready by app
1501 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1504 win->parent = parent;
1506 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1507 _elm_win_obj_callback_parent_del, win);
1509 win->evas = ecore_evas_get(win->ee);
1510 win->win_obj = elm_widget_add(win->evas);
1511 elm_widget_type_set(win->win_obj, "win");
1512 ELM_SET_WIDTYPE(widtype, "win");
1513 elm_widget_data_set(win->win_obj, win);
1514 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1515 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1516 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1517 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1518 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1519 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1520 evas_object_move(win->win_obj, 0, 0);
1521 evas_object_resize(win->win_obj, 1, 1);
1522 evas_object_layer_set(win->win_obj, 50);
1523 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1525 if (type == ELM_WIN_INLINED_IMAGE)
1526 elm_widget_parent2_set(win->win_obj, parent);
1527 ecore_evas_object_associate(win->ee, win->win_obj,
1528 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1529 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1530 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1531 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1532 _elm_win_obj_callback_show, win);
1533 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1534 _elm_win_obj_callback_hide, win);
1535 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1536 _elm_win_obj_callback_del, win);
1537 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1538 _elm_win_obj_callback_move, win);
1539 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1540 _elm_win_obj_callback_resize, win);
1542 evas_object_intercept_move_callback_add(win->win_obj,
1543 _elm_win_obj_intercept_move, win);
1544 evas_object_intercept_show_callback_add(win->win_obj,
1545 _elm_win_obj_intercept_show, win);
1547 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1548 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1549 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1550 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1551 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1552 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1553 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1554 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1555 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1556 evas_font_path_append(win->evas, fontpath);
1557 if (!_elm_config->font_hinting)
1558 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1559 else if (_elm_config->font_hinting == 1)
1560 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1561 else if (_elm_config->font_hinting == 2)
1562 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1564 #ifdef HAVE_ELEMENTARY_X
1565 _elm_win_xwin_update(win);
1568 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1570 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1572 ecore_evas_fullscreen_set(win->ee, 1);
1574 #undef ENGINE_COMPARE
1576 if (_elm_config->focus_highlight_enable)
1577 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1580 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1581 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1582 _debug_key_down, win);
1584 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1586 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1589 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1591 return win->win_obj;
1595 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1599 ELM_CHECK_WIDTYPE(obj, widtype);
1600 win = elm_widget_data_get(obj);
1602 if (eina_list_data_find(win->subobjs, subobj)) return;
1603 win->subobjs = eina_list_append(win->subobjs, subobj);
1604 elm_widget_sub_object_add(obj, subobj);
1605 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1606 _elm_win_subobj_callback_del, obj);
1607 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1608 _elm_win_subobj_callback_changed_size_hints,
1610 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1611 evas_object_move(subobj, 0, 0);
1612 evas_object_resize(subobj, w, h);
1613 _elm_win_eval_subobjs(obj);
1617 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1620 ELM_CHECK_WIDTYPE(obj, widtype);
1621 win = elm_widget_data_get(obj);
1623 evas_object_event_callback_del_full(subobj,
1624 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1625 _elm_win_subobj_callback_changed_size_hints,
1627 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1628 _elm_win_subobj_callback_del, obj);
1629 win->subobjs = eina_list_remove(win->subobjs, subobj);
1630 elm_widget_sub_object_del(obj, subobj);
1631 _elm_win_eval_subobjs(obj);
1635 elm_win_title_set(Evas_Object *obj, const char *title)
1638 ELM_CHECK_WIDTYPE(obj, widtype);
1639 win = elm_widget_data_get(obj);
1641 ecore_evas_title_set(win->ee, title);
1645 elm_win_title_get(const Evas_Object *obj)
1648 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1649 win = elm_widget_data_get(obj);
1650 if (!win) return NULL;
1651 return ecore_evas_title_get(win->ee);
1655 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1658 ELM_CHECK_WIDTYPE(obj, widtype);
1659 win = elm_widget_data_get(obj);
1661 win->autodel = autodel;
1665 elm_win_autodel_get(const Evas_Object *obj)
1668 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1669 win = elm_widget_data_get(obj);
1670 if (!win) return EINA_FALSE;
1671 return win->autodel;
1675 elm_win_activate(Evas_Object *obj)
1678 ELM_CHECK_WIDTYPE(obj, widtype);
1679 win = elm_widget_data_get(obj);
1681 ecore_evas_activate(win->ee);
1685 elm_win_lower(Evas_Object *obj)
1688 ELM_CHECK_WIDTYPE(obj, widtype);
1689 win = elm_widget_data_get(obj);
1691 ecore_evas_lower(win->ee);
1695 elm_win_raise(Evas_Object *obj)
1698 ELM_CHECK_WIDTYPE(obj, widtype);
1699 win = elm_widget_data_get(obj);
1701 ecore_evas_raise(win->ee);
1705 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1708 ELM_CHECK_WIDTYPE(obj, widtype);
1709 win = elm_widget_data_get(obj);
1711 ecore_evas_borderless_set(win->ee, borderless);
1712 #ifdef HAVE_ELEMENTARY_X
1713 _elm_win_xwin_update(win);
1718 elm_win_borderless_get(const Evas_Object *obj)
1721 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1722 win = elm_widget_data_get(obj);
1723 if (!win) return EINA_FALSE;
1724 return ecore_evas_borderless_get(win->ee);
1728 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1731 ELM_CHECK_WIDTYPE(obj, widtype);
1732 win = elm_widget_data_get(obj);
1734 ecore_evas_shaped_set(win->ee, shaped);
1735 #ifdef HAVE_ELEMENTARY_X
1736 _elm_win_xwin_update(win);
1741 elm_win_shaped_get(const Evas_Object *obj)
1744 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1745 win = elm_widget_data_get(obj);
1746 if (!win) return EINA_FALSE;
1747 return ecore_evas_shaped_get(win->ee);
1751 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1754 ELM_CHECK_WIDTYPE(obj, widtype);
1755 win = elm_widget_data_get(obj);
1760 else if (win->img_obj)
1762 evas_object_image_alpha_set(win->img_obj, alpha);
1766 #ifdef HAVE_ELEMENTARY_X
1771 if (!_elm_config->compositing)
1772 elm_win_shaped_set(obj, alpha);
1774 ecore_evas_alpha_set(win->ee, alpha);
1777 ecore_evas_alpha_set(win->ee, alpha);
1778 _elm_win_xwin_update(win);
1782 ecore_evas_alpha_set(win->ee, alpha);
1787 elm_win_alpha_get(const Evas_Object *obj)
1790 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1791 win = elm_widget_data_get(obj);
1792 if (!win) return EINA_FALSE;
1793 return ecore_evas_alpha_get(win->ee);
1797 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1800 ELM_CHECK_WIDTYPE(obj, widtype);
1801 win = elm_widget_data_get(obj);
1807 else if (win->img_obj)
1809 evas_object_image_alpha_set(win->img_obj, transparent);
1813 #ifdef HAVE_ELEMENTARY_X
1816 ecore_evas_transparent_set(win->ee, transparent);
1817 _elm_win_xwin_update(win);
1821 ecore_evas_transparent_set(win->ee, transparent);
1826 elm_win_transparent_get(const Evas_Object *obj)
1829 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1830 win = elm_widget_data_get(obj);
1831 if (!win) return EINA_FALSE;
1833 return ecore_evas_transparent_get(win->ee);
1837 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1840 ELM_CHECK_WIDTYPE(obj, widtype);
1841 win = elm_widget_data_get(obj);
1843 ecore_evas_override_set(win->ee, override);
1844 #ifdef HAVE_ELEMENTARY_X
1845 _elm_win_xwin_update(win);
1850 elm_win_override_get(const Evas_Object *obj)
1853 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1854 win = elm_widget_data_get(obj);
1855 if (!win) return EINA_FALSE;
1856 return ecore_evas_override_get(win->ee);
1860 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1863 ELM_CHECK_WIDTYPE(obj, widtype);
1864 win = elm_widget_data_get(obj);
1867 // YYY: handle if win->img_obj
1868 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1869 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1870 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1872 // these engines... can ONLY be fullscreen
1877 ecore_evas_fullscreen_set(win->ee, fullscreen);
1878 #ifdef HAVE_ELEMENTARY_X
1879 _elm_win_xwin_update(win);
1882 #undef ENGINE_COMPARE
1886 elm_win_fullscreen_get(const Evas_Object *obj)
1889 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1890 win = elm_widget_data_get(obj);
1891 if (!win) return EINA_FALSE;
1893 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1894 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1895 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1897 // these engines... can ONLY be fullscreen
1902 return ecore_evas_fullscreen_get(win->ee);
1904 #undef ENGINE_COMPARE
1908 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1911 ELM_CHECK_WIDTYPE(obj, widtype);
1912 win = elm_widget_data_get(obj);
1914 // YYY: handle if win->img_obj
1915 ecore_evas_maximized_set(win->ee, maximized);
1916 #ifdef HAVE_ELEMENTARY_X
1917 _elm_win_xwin_update(win);
1922 elm_win_maximized_get(const Evas_Object *obj)
1925 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1926 win = elm_widget_data_get(obj);
1927 if (!win) return EINA_FALSE;
1928 return ecore_evas_maximized_get(win->ee);
1932 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1935 ELM_CHECK_WIDTYPE(obj, widtype);
1936 win = elm_widget_data_get(obj);
1938 ecore_evas_iconified_set(win->ee, iconified);
1939 #ifdef HAVE_ELEMENTARY_X
1940 _elm_win_xwin_update(win);
1945 elm_win_iconified_get(const Evas_Object *obj)
1948 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1949 win = elm_widget_data_get(obj);
1950 if (!win) return EINA_FALSE;
1951 return ecore_evas_iconified_get(win->ee);
1955 elm_win_layer_set(Evas_Object *obj, int layer)
1958 ELM_CHECK_WIDTYPE(obj, widtype);
1959 win = elm_widget_data_get(obj);
1961 ecore_evas_layer_set(win->ee, layer);
1962 #ifdef HAVE_ELEMENTARY_X
1963 _elm_win_xwin_update(win);
1968 elm_win_layer_get(const Evas_Object *obj)
1971 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1972 win = elm_widget_data_get(obj);
1973 if (!win) return -1;
1974 return ecore_evas_layer_get(win->ee);
1978 elm_win_rotation_set(Evas_Object *obj, int rotation)
1981 ELM_CHECK_WIDTYPE(obj, widtype);
1982 win = elm_widget_data_get(obj);
1984 if (win->rot == rotation) return;
1985 win->rot = rotation;
1986 ecore_evas_rotation_set(win->ee, rotation);
1987 evas_object_size_hint_min_set(obj, -1, -1);
1988 evas_object_size_hint_max_set(obj, -1, -1);
1989 _elm_win_eval_subobjs(obj);
1990 #ifdef HAVE_ELEMENTARY_X
1991 _elm_win_xwin_update(win);
1996 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1999 ELM_CHECK_WIDTYPE(obj, widtype);
2000 win = elm_widget_data_get(obj);
2002 if (win->rot == rotation) return;
2003 win->rot = rotation;
2004 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2005 evas_object_size_hint_min_set(obj, -1, -1);
2006 evas_object_size_hint_max_set(obj, -1, -1);
2007 _elm_win_eval_subobjs(obj);
2008 #ifdef HAVE_ELEMENTARY_X
2009 _elm_win_xwin_update(win);
2014 elm_win_rotation_get(const Evas_Object *obj)
2017 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2018 win = elm_widget_data_get(obj);
2019 if (!win) return -1;
2024 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2027 ELM_CHECK_WIDTYPE(obj, widtype);
2028 win = elm_widget_data_get(obj);
2030 ecore_evas_sticky_set(win->ee, sticky);
2031 #ifdef HAVE_ELEMENTARY_X
2032 _elm_win_xwin_update(win);
2037 elm_win_sticky_get(const Evas_Object *obj)
2040 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2041 win = elm_widget_data_get(obj);
2042 if (!win) return EINA_FALSE;
2043 return ecore_evas_sticky_get(win->ee);
2047 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2050 ELM_CHECK_WIDTYPE(obj, widtype);
2051 win = elm_widget_data_get(obj);
2053 if (mode == win->kbdmode) return;
2054 #ifdef HAVE_ELEMENTARY_X
2055 _elm_win_xwindow_get(win);
2057 win->kbdmode = mode;
2058 #ifdef HAVE_ELEMENTARY_X
2060 ecore_x_e_virtual_keyboard_state_set
2061 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2065 EAPI Elm_Win_Keyboard_Mode
2066 elm_win_keyboard_mode_get(const Evas_Object *obj)
2069 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2070 win = elm_widget_data_get(obj);
2071 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2072 return win->kbdmode;
2076 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2079 ELM_CHECK_WIDTYPE(obj, widtype);
2080 win = elm_widget_data_get(obj);
2082 #ifdef HAVE_ELEMENTARY_X
2083 _elm_win_xwindow_get(win);
2085 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2090 elm_win_keyboard_win_get(const Evas_Object *obj)
2093 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2094 win = elm_widget_data_get(obj);
2095 if (!win) return EINA_FALSE;
2096 #ifdef HAVE_ELEMENTARY_X
2097 _elm_win_xwindow_get(win);
2099 return ecore_x_e_virtual_keyboard_get(win->xwin);
2105 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2108 ELM_CHECK_WIDTYPE(obj, widtype);
2109 win = elm_widget_data_get(obj);
2111 if (x) *x = win->screen.x;
2112 if (y) *y = win->screen.y;
2116 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2119 ELM_CHECK_WIDTYPE(obj, widtype);
2120 win = elm_widget_data_get(obj);
2122 #ifdef HAVE_ELEMENTARY_X
2123 _elm_win_xwindow_get(win);
2125 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2130 elm_win_conformant_get(const Evas_Object *obj)
2133 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2134 win = elm_widget_data_get(obj);
2135 if (!win) return EINA_FALSE;
2136 #ifdef HAVE_ELEMENTARY_X
2137 _elm_win_xwindow_get(win);
2139 return ecore_x_e_illume_conformant_get(win->xwin);
2145 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2148 ELM_CHECK_WIDTYPE(obj, widtype);
2149 win = elm_widget_data_get(obj);
2151 #ifdef HAVE_ELEMENTARY_X
2152 _elm_win_xwindow_get(win);
2155 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2158 Ecore_X_Window_State states[2];
2160 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2161 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2162 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2163 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2170 elm_win_quickpanel_get(const Evas_Object *obj)
2173 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2174 win = elm_widget_data_get(obj);
2175 if (!win) return EINA_FALSE;
2176 #ifdef HAVE_ELEMENTARY_X
2177 _elm_win_xwindow_get(win);
2179 return ecore_x_e_illume_quickpanel_get(win->xwin);
2185 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2188 ELM_CHECK_WIDTYPE(obj, widtype);
2189 win = elm_widget_data_get(obj);
2191 #ifdef HAVE_ELEMENTARY_X
2192 _elm_win_xwindow_get(win);
2194 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2199 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2202 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2203 win = elm_widget_data_get(obj);
2204 if (!win) return -1;
2205 #ifdef HAVE_ELEMENTARY_X
2206 _elm_win_xwindow_get(win);
2208 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2214 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2217 ELM_CHECK_WIDTYPE(obj, widtype);
2218 win = elm_widget_data_get(obj);
2220 #ifdef HAVE_ELEMENTARY_X
2221 _elm_win_xwindow_get(win);
2223 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2228 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2231 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2232 win = elm_widget_data_get(obj);
2233 if (!win) return -1;
2234 #ifdef HAVE_ELEMENTARY_X
2235 _elm_win_xwindow_get(win);
2237 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2243 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2246 ELM_CHECK_WIDTYPE(obj, widtype);
2247 win = elm_widget_data_get(obj);
2249 #ifdef HAVE_ELEMENTARY_X
2250 _elm_win_xwindow_get(win);
2252 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2257 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2260 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2261 win = elm_widget_data_get(obj);
2263 #ifdef HAVE_ELEMENTARY_X
2264 _elm_win_xwindow_get(win);
2266 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2272 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2275 ELM_CHECK_WIDTYPE(obj, widtype);
2276 win = elm_widget_data_get(obj);
2278 #ifdef HAVE_ELEMENTARY_X
2279 _elm_win_xwindow_get(win);
2284 Ecore_X_Window_State states[2];
2286 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2287 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2288 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2289 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2296 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2299 ELM_CHECK_WIDTYPE(obj, widtype);
2300 win = elm_widget_data_get(obj);
2302 #ifdef HAVE_ELEMENTARY_X
2303 _elm_win_xwindow_get(win);
2308 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2309 ecore_x_e_illume_focus_back_send(win->xwin);
2311 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2312 ecore_x_e_illume_focus_forward_send(win->xwin);
2314 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2315 ecore_x_e_illume_focus_home_send(win->xwin);
2317 case ELM_ILLUME_COMMAND_CLOSE:
2318 ecore_x_e_illume_close_send(win->xwin);
2328 elm_win_inlined_image_object_get(Evas_Object *obj)
2331 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2332 win = elm_widget_data_get(obj);
2333 if (!win) return NULL;
2334 return win->img_obj;
2338 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2342 ELM_CHECK_WIDTYPE(obj, widtype);
2344 win = elm_widget_data_get(obj);
2345 enabled = !!enabled;
2346 if (win->focus_highlight.enabled == enabled)
2349 win->focus_highlight.enabled = enabled;
2351 if (win->focus_highlight.enabled)
2352 _elm_win_focus_highlight_init(win);
2354 _elm_win_focus_highlight_shutdown(win);
2358 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2362 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2364 win = elm_widget_data_get(obj);
2365 return win->focus_highlight.enabled;
2369 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2373 ELM_CHECK_WIDTYPE(obj, widtype);
2375 win = elm_widget_data_get(obj);
2376 eina_stringshare_replace(&win->focus_highlight.style, style);
2377 win->focus_highlight.changed_theme = EINA_TRUE;
2378 _elm_win_focus_highlight_reconfigure_job_start(win);
2382 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2386 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2388 win = elm_widget_data_get(obj);
2389 return win->focus_highlight.style;
2392 typedef struct _Widget_Data Widget_Data;
2397 Evas_Object *content;
2400 static void _del_hook(Evas_Object *obj);
2401 static void _theme_hook(Evas_Object *obj);
2402 static void _sizing_eval(Evas_Object *obj);
2403 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2404 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2406 static const char *widtype2 = NULL;
2409 _del_hook(Evas_Object *obj)
2411 Widget_Data *wd = elm_widget_data_get(obj);
2417 _theme_hook(Evas_Object *obj)
2419 Widget_Data *wd = elm_widget_data_get(obj);
2420 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2422 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2427 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2429 Widget_Data *wd = elm_widget_data_get(obj);
2434 /* Try Focus cycle in subitem */
2437 elm_widget_focus_next_get(wd->content, dir, next);
2442 *next = (Evas_Object *)obj;
2447 _sizing_eval(Evas_Object *obj)
2449 Widget_Data *wd = elm_widget_data_get(obj);
2450 Evas_Coord minw = -1, minh = -1;
2452 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2453 edje_object_size_min_calc(wd->frm, &minw, &minh);
2454 evas_object_size_hint_min_set(obj, minw, minh);
2455 evas_object_size_hint_max_set(obj, -1, -1);
2459 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2465 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2467 Widget_Data *wd = elm_widget_data_get(obj);
2468 Evas_Object *sub = event_info;
2469 if (sub == wd->content)
2471 evas_object_event_callback_del_full
2472 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2479 elm_win_inwin_add(Evas_Object *obj)
2485 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2486 win = elm_widget_data_get(obj);
2487 if (!win) return NULL;
2488 wd = ELM_NEW(Widget_Data);
2489 obj2 = elm_widget_add(win->evas);
2490 elm_widget_type_set(obj2, "inwin");
2491 ELM_SET_WIDTYPE(widtype2, "inwin");
2492 elm_widget_sub_object_add(obj, obj2);
2493 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2494 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2495 elm_win_resize_object_add(obj, obj2);
2497 elm_widget_data_set(obj2, wd);
2498 elm_widget_del_hook_set(obj2, _del_hook);
2499 elm_widget_theme_hook_set(obj2, _theme_hook);
2500 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2501 elm_widget_can_focus_set(obj2, EINA_TRUE);
2502 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2504 wd->frm = edje_object_add(win->evas);
2505 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2506 elm_widget_resize_object_set(obj2, wd->frm);
2508 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2515 elm_win_inwin_activate(Evas_Object *obj)
2517 ELM_CHECK_WIDTYPE(obj, widtype2);
2518 Widget_Data *wd = elm_widget_data_get(obj);
2520 evas_object_raise(obj);
2521 evas_object_show(obj);
2522 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2523 elm_object_focus_set(obj, EINA_TRUE);
2527 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2529 ELM_CHECK_WIDTYPE(obj, widtype2);
2530 Widget_Data *wd = elm_widget_data_get(obj);
2532 if (wd->content == content) return;
2533 if (wd->content) evas_object_del(wd->content);
2534 wd->content = content;
2537 elm_widget_sub_object_add(obj, content);
2538 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2539 _changed_size_hints, obj);
2540 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2546 elm_win_inwin_content_get(const Evas_Object *obj)
2548 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2549 Widget_Data *wd = elm_widget_data_get(obj);
2550 if (!wd) return NULL;
2555 elm_win_inwin_content_unset(Evas_Object *obj)
2557 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2558 Widget_Data *wd = elm_widget_data_get(obj);
2559 if (!wd) return NULL;
2560 if (!wd->content) return NULL;
2561 Evas_Object *content = wd->content;
2562 elm_widget_sub_object_del(obj, wd->content);
2563 edje_object_part_unswallow(wd->frm, wd->content);
2568 /* windowing spcific calls - shall we do this differently? */
2570 static Ecore_X_Window
2571 _elm_ee_win_get(const Evas_Object *obj)
2574 #ifdef HAVE_ELEMENTARY_X
2575 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2576 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2582 elm_win_xwindow_get(const Evas_Object *obj)
2588 type = elm_widget_type_get(obj);
2589 if (!type) return 0;
2590 if (type != widtype) return _elm_ee_win_get(obj);
2591 #ifdef HAVE_ELEMENTARY_X
2592 win = elm_widget_data_get(obj);
2594 if (win->xwin) return win->xwin;
2595 if (win->parent) return elm_win_xwindow_get(win->parent);