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 Eina_Bool constrain : 1;
29 int *autodel_clear, rot;
40 Eina_Bool visible : 1;
41 Eina_Bool handled : 1;
45 Ecore_Job *reconf_job;
47 Eina_Bool enabled : 1;
48 Eina_Bool changed_theme : 1;
49 Eina_Bool top_animate : 1;
50 Eina_Bool geometry_changed : 1;
54 static const char *widtype = NULL;
55 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
56 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
57 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
58 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
59 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
60 static void _elm_win_move(Ecore_Evas *ee);
61 static void _elm_win_resize(Ecore_Evas *ee);
62 static void _elm_win_delete_request(Ecore_Evas *ee);
63 static void _elm_win_resize_job(void *data);
64 #ifdef HAVE_ELEMENTARY_X
65 static void _elm_win_xwin_update(Elm_Win *win);
67 static void _elm_win_eval_subobjs(Evas_Object *obj);
68 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
69 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
70 static void _elm_win_focus_highlight_init(Elm_Win *win);
71 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
72 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
73 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
74 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
75 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
76 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
78 static const char SIG_DELETE_REQUEST[] = "delete,request";
79 static const char SIG_FOCUS_OUT[] = "focus,out";
80 static const char SIG_FOCUS_IN[] = "focus,in";
81 static const char SIG_MOVED[] = "moved";
82 static const char SIG_THEME_CHANGED[] = "theme,changed";
84 static const Evas_Smart_Cb_Description _signals[] = {
85 {SIG_DELETE_REQUEST, ""},
94 Eina_List *_elm_win_list = NULL;
95 int _elm_win_deferred_free = 0;
97 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
98 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
101 _shot_delay_get(Elm_Win *win)
104 char *d = strdup(win->shot.info);
107 for (p = (char *)win->shot.info; *p; p++)
109 if (!strncmp(p, "delay=", 6))
113 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
128 _shot_file_get(Elm_Win *win)
131 char *tmp = strdup(win->shot.info);
132 char *repname = NULL;
134 if (!tmp) return NULL;
136 for (p = (char *)win->shot.info; *p; p++)
138 if (!strncmp(p, "file=", 5))
141 if (!win->shot.repeat_count) return tmp;
144 char *dotptr = strrchr(tmp, '.');
147 size_t size = sizeof(char)*(strlen(tmp) + 16);
148 repname = malloc(size);
149 strncpy(repname, tmp, dotptr - tmp);
150 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
151 win->shot.shot_counter + 1);
152 strcat(repname, dotptr);
160 if (!win->shot.repeat_count) return strdup("out.png");
162 repname = malloc(sizeof(char) * 24);
163 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
168 _shot_repeat_count_get(Elm_Win *win)
172 char *d = strdup(win->shot.info);
175 for (p = (char *)win->shot.info; *p; p++)
177 if (!strncmp(p, "repeat=", 7))
181 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
188 if (v > 1000) v = 999;
198 _shot_key_get(Elm_Win *win __UNUSED__)
204 _shot_flags_get(Elm_Win *win __UNUSED__)
210 _shot_do(Elm_Win *win)
214 unsigned int *pixels;
216 char *file, *key, *flags;
218 ecore_evas_manual_render(win->ee);
219 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
221 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
222 if ((w < 1) || (h < 1)) return;
223 file = _shot_file_get(win);
225 key = _shot_key_get(win);
226 flags = _shot_flags_get(win);
227 ee = ecore_evas_buffer_new(1, 1);
228 o = evas_object_image_add(ecore_evas_get(ee));
229 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
230 evas_object_image_size_set(o, w, h);
231 evas_object_image_data_set(o, pixels);
232 if (!evas_object_image_save(o, file, key, flags))
234 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
239 if (flags) free(flags);
241 if (win->shot.repeat_count) win->shot.shot_counter++;
245 _shot_delay(void *data)
249 if (win->shot.repeat_count)
251 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
252 if (remainshot > 0) return EINA_TRUE;
254 win->shot.timer = NULL;
260 _shot_init(Elm_Win *win)
262 if (!win->shot.info) return;
263 win->shot.repeat_count = _shot_repeat_count_get(win);
264 win->shot.shot_counter = 0;
268 _shot_handle(Elm_Win *win)
270 if (!win->shot.info) return;
271 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
275 _elm_win_move(Ecore_Evas *ee)
277 Evas_Object *obj = ecore_evas_object_associate_get(ee);
282 win = elm_widget_data_get(obj);
284 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
287 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
291 _elm_win_resize(Ecore_Evas *ee)
293 Evas_Object *obj = ecore_evas_object_associate_get(ee);
297 win = elm_widget_data_get(obj);
299 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
300 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
304 _elm_win_focus_in(Ecore_Evas *ee)
306 Evas_Object *obj = ecore_evas_object_associate_get(ee);
310 win = elm_widget_data_get(obj);
312 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
313 if (win->show_count == 1)
315 elm_widget_focus_steal(win->win_obj);
319 elm_widget_focus_restore(win->win_obj);
320 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
321 win->focus_highlight.cur.visible = EINA_TRUE;
322 _elm_win_focus_highlight_reconfigure_job_start(win);
325 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
327 else if (win->img_obj)
334 _elm_win_focus_out(Ecore_Evas *ee)
336 Evas_Object *obj = ecore_evas_object_associate_get(ee);
340 win = elm_widget_data_get(obj);
342 elm_object_focus_set(win->win_obj, EINA_FALSE);
343 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
344 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
345 win->focus_highlight.cur.visible = EINA_FALSE;
346 _elm_win_focus_highlight_reconfigure_job_start(win);
349 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
351 else if (win->img_obj)
358 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
360 Elm_Win *wd = elm_widget_data_get(obj);
361 const Eina_List *items;
362 void *(*list_data_get) (const Eina_List *list);
370 if (!(items = elm_widget_focus_custom_chain_get(obj)))
376 list_data_get = eina_list_data_get;
378 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
384 *next = (Evas_Object *)obj;
389 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
391 Elm_Win *win = elm_widget_data_get(obj);
395 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
397 evas_object_focus_set(obj, elm_widget_focus_get(obj));
401 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
403 if (type == EVAS_CALLBACK_KEY_DOWN)
405 Evas_Event_Key_Down *ev = event_info;
406 if (!strcmp(ev->keyname, "Tab"))
408 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
409 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
411 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
412 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
415 else if ((!strcmp(ev->keyname, "Left")) ||
416 (!strcmp(ev->keyname, "KP_Left")))
418 //TODO : woohyun jung
420 else if ((!strcmp(ev->keyname, "Right")) ||
421 (!strcmp(ev->keyname, "KP_Right")))
423 //TODO : woohyun jung
425 else if ((!strcmp(ev->keyname, "Up")) ||
426 (!strcmp(ev->keyname, "KP_Up")))
428 //TODO : woohyun jung
430 else if ((!strcmp(ev->keyname, "Down")) ||
431 (!strcmp(ev->keyname, "KP_Down")))
433 //TODO : woohyun jung
441 _deferred_ecore_evas_free(void *data)
443 ecore_evas_free(data);
444 _elm_win_deferred_free--;
448 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
452 if (!win->show_count) win->show_count++;
453 if (win->shot.info) _shot_handle(win);
457 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
463 evas_object_hide(win->frame_obj);
465 else if (win->img_obj)
467 evas_object_hide(win->img_obj);
472 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
479 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
480 _elm_win_obj_callback_parent_del, win);
483 if (win->autodel_clear) *(win->autodel_clear) = -1;
484 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
485 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
488 ecore_evas_callback_delete_request_set(win->ee, NULL);
489 ecore_evas_callback_resize_set(win->ee, NULL);
491 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
492 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
493 if (win->shot.info) eina_stringshare_del(win->shot.info);
494 if (win->shot.timer) ecore_timer_del(win->shot.timer);
495 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
496 _elm_win_obj_callback_del, win);
497 while (((child = evas_object_bottom_get(win->evas))) &&
500 evas_object_del(child);
502 while (((child = evas_object_top_get(win->evas))) &&
505 evas_object_del(child);
507 #ifdef HAVE_ELEMENTARY_X
508 if (win->client_message_handler)
509 ecore_event_handler_del(win->client_message_handler);
511 // FIXME: Why are we flushing edje on every window destroy ??
512 // edje_file_cache_flush();
513 // edje_collection_cache_flush();
514 // evas_image_cache_flush(win->evas);
515 // evas_font_cache_flush(win->evas);
516 // FIXME: we are in the del handler for the object and delete the canvas
517 // that lives under it from the handler... nasty. deferring doesn't help either
527 ecore_job_add(_deferred_ecore_evas_free, win->ee);
528 _elm_win_deferred_free++;
532 _elm_win_focus_highlight_shutdown(win);
533 eina_stringshare_del(win->focus_highlight.style);
537 if ((!_elm_win_list) &&
538 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
540 edje_file_cache_flush();
541 edje_collection_cache_flush();
542 evas_image_cache_flush(e);
543 evas_font_cache_flush(e);
549 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
552 if (!win->img_obj) return;
553 evas_object_event_callback_del_full
554 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
555 evas_object_del(win->img_obj);
559 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
562 if (obj == win->parent) win->parent = NULL;
566 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
572 if ((x != win->screen.x) || (y != win->screen.y))
576 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
581 evas_object_move(obj, x, y);
586 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
589 // this is called to make sure all smart containers have calculated their
590 // sizes BEFORE we show the window to make sure it initially appears at
591 // our desired size (ie min size is known first)
592 evas_smart_objects_calculate(evas_object_evas_get(obj));
595 evas_object_show(win->frame_obj);
597 else if (win->img_obj)
599 evas_object_show(win->img_obj);
601 evas_object_show(obj);
605 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
609 if (ecore_evas_override_get(win->ee))
613 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
616 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
622 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
626 else if (win->img_obj)
630 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
633 // evas_object_move(win->img_obj, x, y);
638 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
645 else if (win->img_obj)
647 Evas_Coord w = 1, h = 1;
649 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
653 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
659 evas_object_image_size_set(win->img_obj, w, h);
664 _elm_win_delete_request(Ecore_Evas *ee)
666 Evas_Object *obj = ecore_evas_object_associate_get(ee);
668 if (strcmp(elm_widget_type_get(obj), "win")) return;
670 win = elm_widget_data_get(obj);
672 int autodel = win->autodel;
673 win->autodel_clear = &autodel;
674 evas_object_ref(win->win_obj);
675 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
676 // FIXME: if above callback deletes - then the below will be invalid
677 if (autodel) evas_object_del(win->win_obj);
678 else win->autodel_clear = NULL;
679 evas_object_unref(win->win_obj);
683 _elm_win_resize_job(void *data)
690 win->deferred_resize_job = NULL;
691 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
695 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
701 evas_object_resize(win->frame_obj, w, h);
703 else if (win->img_obj)
706 evas_object_resize(win->win_obj, w, h);
707 EINA_LIST_FOREACH(win->subobjs, l, obj)
709 evas_object_move(obj, 0, 0);
710 evas_object_resize(obj, w, h);
714 #ifdef HAVE_ELEMENTARY_X
716 _elm_win_xwindow_get(Elm_Win *win)
720 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
721 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
723 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
725 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
726 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
727 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
728 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
729 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
730 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
731 ENGINE_COMPARE(ELM_OPENGL_COCOA))
734 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
736 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
738 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
740 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
743 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
745 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
748 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
750 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
752 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
754 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
756 #undef ENGINE_COMPARE
760 #ifdef HAVE_ELEMENTARY_X
762 _elm_win_xwin_update(Elm_Win *win)
764 _elm_win_xwindow_get(win);
769 win2 = elm_widget_data_get(win->parent);
773 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
777 if (!win->xwin) return; /* nothing more to do */
782 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
784 case ELM_WIN_DIALOG_BASIC:
785 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
787 case ELM_WIN_DESKTOP:
788 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
791 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
793 case ELM_WIN_TOOLBAR:
794 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
797 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
799 case ELM_WIN_UTILITY:
800 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
803 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
805 case ELM_WIN_DROPDOWN_MENU:
806 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
808 case ELM_WIN_POPUP_MENU:
809 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
811 case ELM_WIN_TOOLTIP:
812 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
814 case ELM_WIN_NOTIFICATION:
815 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
818 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
821 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
826 ecore_x_e_virtual_keyboard_state_set
827 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
832 _elm_win_eval_subobjs(Evas_Object *obj)
835 const Evas_Object *child;
837 Elm_Win *win = elm_widget_data_get(obj);
838 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
842 EINA_LIST_FOREACH(win->subobjs, l, child)
844 evas_object_size_hint_weight_get(child, &wx, &wy);
845 if (wx == 0.0) xx = 0;
846 if (wy == 0.0) xy = 0;
848 evas_object_size_hint_min_get(child, &w, &h);
851 if (w > minw) minw = w;
852 if (h > minh) minh = h;
854 evas_object_size_hint_max_get(child, &w, &h);
857 if (maxw == -1) maxw = w;
858 else if ((w > 0) && (w < maxw)) maxw = w;
859 if (maxh == -1) maxh = h;
860 else if ((h > 0) && (h < maxh)) maxh = h;
862 if (!xx) maxw = minw;
864 if (!xy) maxh = minh;
866 evas_object_size_hint_min_set(obj, minw, minh);
867 evas_object_size_hint_max_set(obj, maxw, maxh);
868 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
869 if (w < minw) w = minw;
870 if (h < minh) h = minh;
871 if ((maxw >= 0) && (w > maxw)) w = maxw;
872 if ((maxh >= 0) && (h > maxh)) h = maxh;
873 evas_object_resize(obj, w, h);
877 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
879 Elm_Win *win = elm_widget_data_get(data);
880 win->subobjs = eina_list_remove(win->subobjs, obj);
881 _elm_win_eval_subobjs(win->win_obj);
885 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
887 _elm_win_eval_subobjs(data);
891 _elm_win_shutdown(void)
893 while (_elm_win_list)
894 evas_object_del(_elm_win_list->data);
898 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
905 EINA_LIST_FOREACH(_elm_win_list, l, obj)
906 elm_widget_theme(obj);
910 EINA_LIST_FOREACH(_elm_win_list, l, obj)
911 elm_widget_theme_specific(obj, th, EINA_FALSE);
916 _elm_win_translate(void)
921 EINA_LIST_FOREACH(_elm_win_list, l, obj)
922 elm_widget_translate(obj);
925 #ifdef HAVE_ELEMENTARY_X
927 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
930 Ecore_X_Event_Client_Message *e = event;
932 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
933 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
935 if ((unsigned)e->data.l[0] == win->xwin)
937 Evas *evas = evas_object_evas_get(win->win_obj);
940 edje_file_cache_flush();
941 edje_collection_cache_flush();
942 evas_image_cache_flush(evas);
943 evas_font_cache_flush(evas);
947 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
949 if ((unsigned)e->data.l[0] == win->xwin)
951 Evas *evas = evas_object_evas_get(win->win_obj);
954 edje_file_cache_flush();
955 edje_collection_cache_flush();
956 evas_image_cache_flush(evas);
957 evas_font_cache_flush(evas);
958 evas_render_dump(evas);
962 return ECORE_CALLBACK_PASS_ON;
967 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
971 win->focus_highlight.geometry_changed = EINA_TRUE;
972 _elm_win_focus_highlight_reconfigure_job_start(win);
976 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
980 win->focus_highlight.geometry_changed = EINA_TRUE;
981 _elm_win_focus_highlight_reconfigure_job_start(win);
985 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
989 win->focus_highlight.cur.target = NULL;
991 _elm_win_focus_highlight_reconfigure_job_start(win);
995 _elm_win_focus_target_callbacks_add(Elm_Win *win)
997 Evas_Object *obj = win->focus_highlight.cur.target;
999 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1000 _elm_win_focus_target_move, win);
1001 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1002 _elm_win_focus_target_resize, win);
1003 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1004 _elm_win_focus_target_del, win);
1008 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1010 Evas_Object *obj = win->focus_highlight.cur.target;
1012 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1013 _elm_win_focus_target_move, win);
1014 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1015 _elm_win_focus_target_resize, win);
1016 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1017 _elm_win_focus_target_del, win);
1020 static Evas_Object *
1021 _elm_win_focus_target_get(Evas_Object *obj)
1023 Evas_Object *o = obj;
1027 if (elm_widget_is(o))
1029 if (!elm_widget_highlight_ignore_get(o))
1031 o = elm_widget_parent_get(o);
1033 o = evas_object_smart_parent_get(o);
1037 o = elm_widget_parent_widget_get(o);
1039 o = evas_object_smart_parent_get(o);
1048 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1050 Evas_Object *obj = event_info, *target;
1051 Elm_Win *win = data;
1053 if (win->focus_highlight.cur.target == obj)
1056 target = _elm_win_focus_target_get(obj);
1057 win->focus_highlight.cur.target = target;
1058 if (elm_widget_highlight_in_theme_get(target))
1059 win->focus_highlight.cur.handled = EINA_TRUE;
1061 _elm_win_focus_target_callbacks_add(win);
1063 _elm_win_focus_highlight_reconfigure_job_start(win);
1067 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1069 Elm_Win *win = data;
1071 if (!win->focus_highlight.cur.target)
1074 if (!win->focus_highlight.cur.handled)
1075 _elm_win_focus_target_callbacks_del(win);
1076 win->focus_highlight.cur.target = NULL;
1077 win->focus_highlight.cur.handled = EINA_FALSE;
1079 _elm_win_focus_highlight_reconfigure_job_start(win);
1083 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1085 evas_object_hide(obj);
1089 _elm_win_focus_highlight_init(Elm_Win *win)
1091 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1092 _elm_win_object_focus_in, win);
1093 evas_event_callback_add(win->evas,
1094 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1095 _elm_win_object_focus_out, win);
1097 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1099 win->focus_highlight.top = edje_object_add(win->evas);
1100 win->focus_highlight.changed_theme = EINA_TRUE;
1101 edje_object_signal_callback_add(win->focus_highlight.top,
1102 "elm,action,focus,hide,end", "",
1103 _elm_win_focus_highlight_hide, NULL);
1104 edje_object_signal_callback_add(win->focus_highlight.top,
1105 "elm,action,focus,anim,end", "",
1106 _elm_win_focus_highlight_anim_end, win);
1107 _elm_win_focus_highlight_reconfigure_job_start(win);
1111 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1113 _elm_win_focus_highlight_reconfigure_job_stop(win);
1114 if (win->focus_highlight.cur.target)
1116 _elm_win_focus_target_callbacks_del(win);
1117 win->focus_highlight.cur.target = NULL;
1119 if (win->focus_highlight.top)
1121 evas_object_del(win->focus_highlight.top);
1122 win->focus_highlight.top = NULL;
1125 evas_event_callback_del_full(win->evas,
1126 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1127 _elm_win_object_focus_in, win);
1128 evas_event_callback_del_full(win->evas,
1129 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1130 _elm_win_object_focus_out, win);
1134 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1138 top = win->focus_highlight.top;
1143 evas_object_show(top);
1144 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1150 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1155 _elm_win_focus_highlight_reconfigure_job(void *data)
1157 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1161 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1163 if (win->focus_highlight.reconf_job)
1164 ecore_job_del(win->focus_highlight.reconf_job);
1165 win->focus_highlight.reconf_job = ecore_job_add(
1166 _elm_win_focus_highlight_reconfigure_job, win);
1170 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1172 if (win->focus_highlight.reconf_job)
1173 ecore_job_del(win->focus_highlight.reconf_job);
1174 win->focus_highlight.reconf_job = NULL;
1178 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1180 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1181 Evas_Coord x, y, w, h;
1183 clip = evas_object_clip_get(target);
1184 evas_object_geometry_get(target, &x, &y, &w, &h);
1186 evas_object_move(obj, x, y);
1187 evas_object_resize(obj, w, h);
1188 evas_object_clip_set(obj, clip);
1192 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1194 Evas_Coord tx, ty, tw, th;
1195 Evas_Coord w, h, px, py, pw, ph;
1196 Edje_Message_Int_Set *m;
1197 Evas_Object *previous = win->focus_highlight.prev.target;
1198 Evas_Object *target = win->focus_highlight.cur.target;
1200 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1201 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1202 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1203 evas_object_move(obj, 0, 0);
1204 evas_object_resize(obj, tw, th);
1205 evas_object_clip_unset(obj);
1207 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1217 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1221 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1223 Elm_Win *win = data;
1224 _elm_win_focus_highlight_simple_setup(win, obj);
1228 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1230 Evas_Object *target = win->focus_highlight.cur.target;
1231 Evas_Object *previous = win->focus_highlight.prev.target;
1232 Evas_Object *top = win->focus_highlight.top;
1233 Eina_Bool visible_changed;
1234 Eina_Bool common_visible;
1235 const char *sig = NULL;
1237 _elm_win_focus_highlight_reconfigure_job_stop(win);
1239 visible_changed = (win->focus_highlight.cur.visible !=
1240 win->focus_highlight.prev.visible);
1242 if ((target == previous) && (!visible_changed) &&
1243 (!win->focus_highlight.geometry_changed))
1246 if ((previous) && (win->focus_highlight.prev.handled))
1247 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1250 common_visible = EINA_FALSE;
1251 else if (win->focus_highlight.cur.handled)
1253 common_visible = EINA_FALSE;
1254 if (win->focus_highlight.cur.visible)
1255 sig = "elm,action,focus_highlight,show";
1257 sig = "elm,action,focus_highlight,hide";
1260 common_visible = win->focus_highlight.cur.visible;
1262 _elm_win_focus_highlight_visible_set(win, common_visible);
1264 elm_widget_signal_emit(target, sig, "elm");
1266 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1269 if (win->focus_highlight.changed_theme)
1272 if (win->focus_highlight.style)
1273 str = win->focus_highlight.style;
1276 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1278 win->focus_highlight.changed_theme = EINA_FALSE;
1280 if (_elm_config->focus_highlight_animate)
1282 str = edje_object_data_get(win->focus_highlight.top, "animate");
1283 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1287 if ((win->focus_highlight.top_animate) && (previous) &&
1288 (!win->focus_highlight.prev.handled))
1289 _elm_win_focus_highlight_anim_setup(win, top);
1291 _elm_win_focus_highlight_simple_setup(win, top);
1292 evas_object_raise(top);
1295 win->focus_highlight.geometry_changed = EINA_FALSE;
1296 win->focus_highlight.prev = win->focus_highlight.cur;
1301 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1303 Evas_Event_Key_Down *ev = event_info;
1305 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1309 if ((strcmp(ev->keyname, "F12")) ||
1310 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1313 printf("Tree graph generated.\n");
1314 elm_object_tree_dot_dump(obj, "./dump.dot");
1319 _win_img_hide(void *data,
1321 Evas_Object *obj __UNUSED__,
1322 void *event_info __UNUSED__)
1324 Elm_Win *win = data;
1326 elm_widget_focus_hide_handle(win->win_obj);
1330 _win_img_mouse_up(void *data,
1332 Evas_Object *obj __UNUSED__,
1335 Elm_Win *win = data;
1336 Evas_Event_Mouse_Up *ev = event_info;
1337 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1338 elm_widget_focus_mouse_up_handle(win->win_obj);
1342 _win_img_focus_in(void *data,
1344 Evas_Object *obj __UNUSED__,
1345 void *event_info __UNUSED__)
1347 Elm_Win *win = data;
1348 elm_widget_focus_steal(win->win_obj);
1352 _win_img_focus_out(void *data,
1354 Evas_Object *obj __UNUSED__,
1355 void *event_info __UNUSED__)
1357 Elm_Win *win = data;
1358 elm_widget_focused_object_clear(win->win_obj);
1362 _win_inlined_image_set(Elm_Win *win)
1364 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1365 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1366 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1367 _elm_win_obj_callback_img_obj_del, win);
1369 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1370 _win_img_hide, win);
1371 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1372 _win_img_mouse_up, win);
1373 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1374 _win_img_focus_in, win);
1375 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1376 _win_img_focus_out, win);
1380 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1382 evas_object_event_callback_del_full(subobj,
1383 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1384 _elm_win_subobj_callback_changed_size_hints,
1386 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1387 _elm_win_subobj_callback_del, obj);
1388 win->subobjs = eina_list_remove(win->subobjs, subobj);
1389 _elm_win_eval_subobjs(obj);
1393 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1397 const char *fontpath;
1399 win = ELM_NEW(Elm_Win);
1401 #define FALLBACK_TRY(engine) \
1404 CRITICAL(engine " engine creation failed. Trying default."); \
1405 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1407 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1409 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1413 case ELM_WIN_INLINED_IMAGE:
1416 Evas *e = evas_object_evas_get(parent);
1419 ee = ecore_evas_ecore_evas_get(e);
1421 win->img_obj = ecore_evas_object_image_new(ee);
1422 if (!win->img_obj) break;
1423 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1426 _win_inlined_image_set(win);
1429 evas_object_del(win->img_obj);
1430 win->img_obj = NULL;
1434 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1436 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1437 #ifdef HAVE_ELEMENTARY_X
1438 win->client_message_handler = ecore_event_handler_add
1439 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1441 FALLBACK_TRY("Sofware X11");
1443 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1445 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1446 FALLBACK_TRY("Sofware FB");
1448 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1450 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1451 FALLBACK_TRY("Sofware DirectFB");
1453 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1455 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1456 FALLBACK_TRY("Sofware-16");
1457 #ifdef HAVE_ELEMENTARY_X
1458 win->client_message_handler = ecore_event_handler_add
1459 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1462 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1464 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1465 FALLBACK_TRY("Sofware-8");
1466 #ifdef HAVE_ELEMENTARY_X
1467 win->client_message_handler = ecore_event_handler_add
1468 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1472 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1474 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1475 FALLBACK_TRY("XRender");
1476 #ifdef HAVE_ELEMENTARY_X
1477 win->client_message_handler = ecore_event_handler_add
1478 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1482 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1487 if (_elm_config->vsync)
1489 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1495 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1497 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1498 FALLBACK_TRY("OpenGL");
1499 #ifdef HAVE_ELEMENTARY_X
1500 win->client_message_handler = ecore_event_handler_add
1501 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1504 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1506 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1507 FALLBACK_TRY("Sofware Win32");
1509 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1511 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1512 FALLBACK_TRY("Sofware-16-WinCE");
1514 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1516 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1517 FALLBACK_TRY("PSL1GHT");
1519 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1521 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1522 FALLBACK_TRY("Sofware SDL");
1524 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1526 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1527 FALLBACK_TRY("Sofware-16-SDL");
1529 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1531 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1532 FALLBACK_TRY("OpenGL SDL");
1534 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1536 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1537 FALLBACK_TRY("OpenGL Cocoa");
1539 else if (ENGINE_COMPARE(ELM_BUFFER))
1541 win->ee = ecore_evas_buffer_new(1, 1);
1543 else if (ENGINE_COMPARE(ELM_EWS))
1545 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1547 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1549 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 1, 1, 0);
1550 win->evas = ecore_evas_get(win->ee);
1551 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1553 win->frame_obj = edje_object_add(win->evas);
1554 _elm_theme_set(NULL, win->frame_obj, "border", "base", "default");
1555 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1556 evas_object_move(win->frame_obj, 0, 0);
1557 evas_object_resize(win->frame_obj, 1, 1);
1559 else if (!strncmp(_elm_config->engine, "shot:", 5))
1561 win->ee = ecore_evas_buffer_new(1, 1);
1562 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1563 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1572 ERR("Cannot create window.");
1576 #ifdef HAVE_ELEMENTARY_X
1577 _elm_win_xwindow_get(win);
1579 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1580 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1581 // bg pixmap done by x - has other issues like can be redrawn by x before it
1582 // is filled/ready by app
1583 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1586 win->parent = parent;
1588 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1589 _elm_win_obj_callback_parent_del, win);
1591 win->evas = ecore_evas_get(win->ee);
1592 win->win_obj = elm_widget_add(win->evas);
1593 elm_widget_type_set(win->win_obj, "win");
1594 ELM_SET_WIDTYPE(widtype, "win");
1595 elm_widget_data_set(win->win_obj, win);
1596 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1597 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1598 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1599 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1600 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1601 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1602 evas_object_move(win->win_obj, 0, 0);
1603 evas_object_resize(win->win_obj, 1, 1);
1604 evas_object_layer_set(win->win_obj, 50);
1605 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1609 // evas_object_clip_set(win->win_obj, win->frame_obj);
1610 evas_object_stack_below(win->frame_obj, win->win_obj);
1613 if (type == ELM_WIN_INLINED_IMAGE)
1614 elm_widget_parent2_set(win->win_obj, parent);
1615 ecore_evas_object_associate(win->ee, win->win_obj,
1616 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1617 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1618 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1619 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1620 _elm_win_obj_callback_show, win);
1621 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1622 _elm_win_obj_callback_hide, win);
1623 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1624 _elm_win_obj_callback_del, win);
1625 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1626 _elm_win_obj_callback_move, win);
1627 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1628 _elm_win_obj_callback_resize, win);
1630 evas_object_intercept_move_callback_add(win->win_obj,
1631 _elm_win_obj_intercept_move, win);
1632 evas_object_intercept_show_callback_add(win->win_obj,
1633 _elm_win_obj_intercept_show, win);
1635 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
1636 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1637 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1638 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1639 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1640 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1641 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1642 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1643 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1644 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1645 evas_font_path_append(win->evas, fontpath);
1646 if (!_elm_config->font_hinting)
1647 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1648 else if (_elm_config->font_hinting == 1)
1649 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1650 else if (_elm_config->font_hinting == 2)
1651 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1653 #ifdef HAVE_ELEMENTARY_X
1654 _elm_win_xwin_update(win);
1657 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1659 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1661 ecore_evas_fullscreen_set(win->ee, 1);
1663 #undef ENGINE_COMPARE
1665 if (_elm_config->focus_highlight_enable)
1666 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1669 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1670 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1671 _debug_key_down, win);
1673 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1675 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1678 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1680 return win->win_obj;
1684 elm_win_util_standard_add(const char *name, const char *title)
1686 Evas_Object *win, *bg;
1688 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1689 if (!win) return NULL;
1690 elm_win_title_set(win, title);
1691 bg = elm_bg_add(win);
1694 evas_object_del(win);
1697 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1698 elm_win_resize_object_add(win, bg);
1699 evas_object_show(bg);
1704 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1708 ELM_CHECK_WIDTYPE(obj, widtype);
1709 win = elm_widget_data_get(obj);
1711 if (eina_list_data_find(win->subobjs, subobj)) return;
1712 win->subobjs = eina_list_append(win->subobjs, subobj);
1713 elm_widget_sub_object_add(obj, subobj);
1714 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1715 _elm_win_subobj_callback_del, obj);
1716 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1717 _elm_win_subobj_callback_changed_size_hints,
1719 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1720 evas_object_move(subobj, 0, 0);
1721 evas_object_resize(subobj, w, h);
1722 _elm_win_eval_subobjs(obj);
1726 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1729 ELM_CHECK_WIDTYPE(obj, widtype);
1730 win = elm_widget_data_get(obj);
1732 evas_object_event_callback_del_full(subobj,
1733 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1734 _elm_win_subobj_callback_changed_size_hints,
1736 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1737 _elm_win_subobj_callback_del, obj);
1738 win->subobjs = eina_list_remove(win->subobjs, subobj);
1739 elm_widget_sub_object_del(obj, subobj);
1740 _elm_win_eval_subobjs(obj);
1744 elm_win_title_set(Evas_Object *obj, const char *title)
1747 ELM_CHECK_WIDTYPE(obj, widtype);
1748 win = elm_widget_data_get(obj);
1750 ecore_evas_title_set(win->ee, title);
1752 edje_object_part_text_set(win->frame_obj, "elm.text.title", title);
1756 elm_win_title_get(const Evas_Object *obj)
1759 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1760 win = elm_widget_data_get(obj);
1761 if (!win) return NULL;
1762 return ecore_evas_title_get(win->ee);
1766 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1769 ELM_CHECK_WIDTYPE(obj, widtype);
1770 win = elm_widget_data_get(obj);
1772 win->autodel = autodel;
1776 elm_win_autodel_get(const Evas_Object *obj)
1779 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1780 win = elm_widget_data_get(obj);
1781 if (!win) return EINA_FALSE;
1782 return win->autodel;
1786 elm_win_activate(Evas_Object *obj)
1789 ELM_CHECK_WIDTYPE(obj, widtype);
1790 win = elm_widget_data_get(obj);
1792 ecore_evas_activate(win->ee);
1796 elm_win_lower(Evas_Object *obj)
1799 ELM_CHECK_WIDTYPE(obj, widtype);
1800 win = elm_widget_data_get(obj);
1802 ecore_evas_lower(win->ee);
1806 elm_win_raise(Evas_Object *obj)
1809 ELM_CHECK_WIDTYPE(obj, widtype);
1810 win = elm_widget_data_get(obj);
1812 ecore_evas_raise(win->ee);
1816 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
1819 int win_w, win_h, screen_w, screen_h, nx, ny;
1820 ELM_CHECK_WIDTYPE(obj, widtype);
1821 win = elm_widget_data_get(obj);
1823 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
1824 if ((!screen_w) || (!screen_h)) return;
1825 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
1826 if ((!win_w) || (!win_h)) return;
1827 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
1828 else nx = win->screen.x;
1829 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
1830 else ny = win->screen.y;
1833 evas_object_move(obj, nx, ny);
1837 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1840 ELM_CHECK_WIDTYPE(obj, widtype);
1841 win = elm_widget_data_get(obj);
1843 ecore_evas_borderless_set(win->ee, borderless);
1844 #ifdef HAVE_ELEMENTARY_X
1845 _elm_win_xwin_update(win);
1850 elm_win_borderless_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_borderless_get(win->ee);
1860 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1863 ELM_CHECK_WIDTYPE(obj, widtype);
1864 win = elm_widget_data_get(obj);
1866 ecore_evas_shaped_set(win->ee, shaped);
1867 #ifdef HAVE_ELEMENTARY_X
1868 _elm_win_xwin_update(win);
1873 elm_win_shaped_get(const Evas_Object *obj)
1876 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1877 win = elm_widget_data_get(obj);
1878 if (!win) return EINA_FALSE;
1879 return ecore_evas_shaped_get(win->ee);
1883 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1886 ELM_CHECK_WIDTYPE(obj, widtype);
1887 win = elm_widget_data_get(obj);
1892 else if (win->img_obj)
1894 evas_object_image_alpha_set(win->img_obj, alpha);
1895 ecore_evas_alpha_set(win->ee, alpha);
1899 #ifdef HAVE_ELEMENTARY_X
1904 if (!_elm_config->compositing)
1905 elm_win_shaped_set(obj, alpha);
1907 ecore_evas_alpha_set(win->ee, alpha);
1910 ecore_evas_alpha_set(win->ee, alpha);
1911 _elm_win_xwin_update(win);
1915 ecore_evas_alpha_set(win->ee, alpha);
1920 elm_win_alpha_get(const Evas_Object *obj)
1923 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1924 win = elm_widget_data_get(obj);
1925 if (!win) return EINA_FALSE;
1929 else if (win->img_obj)
1931 return evas_object_image_alpha_get(win->img_obj);
1933 return ecore_evas_alpha_get(win->ee);
1937 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1940 ELM_CHECK_WIDTYPE(obj, widtype);
1941 win = elm_widget_data_get(obj);
1947 else if (win->img_obj)
1949 evas_object_image_alpha_set(win->img_obj, transparent);
1953 #ifdef HAVE_ELEMENTARY_X
1956 ecore_evas_transparent_set(win->ee, transparent);
1957 _elm_win_xwin_update(win);
1961 ecore_evas_transparent_set(win->ee, transparent);
1966 elm_win_transparent_get(const Evas_Object *obj)
1969 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1970 win = elm_widget_data_get(obj);
1971 if (!win) return EINA_FALSE;
1973 return ecore_evas_transparent_get(win->ee);
1977 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1980 ELM_CHECK_WIDTYPE(obj, widtype);
1981 win = elm_widget_data_get(obj);
1983 ecore_evas_override_set(win->ee, override);
1984 #ifdef HAVE_ELEMENTARY_X
1985 _elm_win_xwin_update(win);
1990 elm_win_override_get(const Evas_Object *obj)
1993 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1994 win = elm_widget_data_get(obj);
1995 if (!win) return EINA_FALSE;
1996 return ecore_evas_override_get(win->ee);
2000 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2003 ELM_CHECK_WIDTYPE(obj, widtype);
2004 win = elm_widget_data_get(obj);
2007 // YYY: handle if win->img_obj
2008 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2009 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2010 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2012 // these engines... can ONLY be fullscreen
2017 ecore_evas_fullscreen_set(win->ee, fullscreen);
2018 #ifdef HAVE_ELEMENTARY_X
2019 _elm_win_xwin_update(win);
2022 #undef ENGINE_COMPARE
2026 elm_win_fullscreen_get(const Evas_Object *obj)
2029 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2030 win = elm_widget_data_get(obj);
2031 if (!win) return EINA_FALSE;
2033 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2034 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2035 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2037 // these engines... can ONLY be fullscreen
2042 return ecore_evas_fullscreen_get(win->ee);
2044 #undef ENGINE_COMPARE
2048 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2051 ELM_CHECK_WIDTYPE(obj, widtype);
2052 win = elm_widget_data_get(obj);
2054 // YYY: handle if win->img_obj
2055 ecore_evas_maximized_set(win->ee, maximized);
2056 #ifdef HAVE_ELEMENTARY_X
2057 _elm_win_xwin_update(win);
2062 elm_win_maximized_get(const Evas_Object *obj)
2065 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2066 win = elm_widget_data_get(obj);
2067 if (!win) return EINA_FALSE;
2068 return ecore_evas_maximized_get(win->ee);
2072 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2075 ELM_CHECK_WIDTYPE(obj, widtype);
2076 win = elm_widget_data_get(obj);
2078 ecore_evas_iconified_set(win->ee, iconified);
2079 #ifdef HAVE_ELEMENTARY_X
2080 _elm_win_xwin_update(win);
2085 elm_win_iconified_get(const Evas_Object *obj)
2088 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2089 win = elm_widget_data_get(obj);
2090 if (!win) return EINA_FALSE;
2091 return ecore_evas_iconified_get(win->ee);
2095 elm_win_layer_set(Evas_Object *obj, int layer)
2098 ELM_CHECK_WIDTYPE(obj, widtype);
2099 win = elm_widget_data_get(obj);
2101 ecore_evas_layer_set(win->ee, layer);
2102 #ifdef HAVE_ELEMENTARY_X
2103 _elm_win_xwin_update(win);
2108 elm_win_layer_get(const Evas_Object *obj)
2111 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2112 win = elm_widget_data_get(obj);
2113 if (!win) return -1;
2114 return ecore_evas_layer_get(win->ee);
2118 elm_win_rotation_set(Evas_Object *obj, int rotation)
2121 ELM_CHECK_WIDTYPE(obj, widtype);
2122 win = elm_widget_data_get(obj);
2124 if (win->rot == rotation) return;
2125 win->rot = rotation;
2126 ecore_evas_rotation_set(win->ee, rotation);
2127 evas_object_size_hint_min_set(obj, -1, -1);
2128 evas_object_size_hint_max_set(obj, -1, -1);
2129 _elm_win_eval_subobjs(obj);
2130 #ifdef HAVE_ELEMENTARY_X
2131 _elm_win_xwin_update(win);
2136 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2139 ELM_CHECK_WIDTYPE(obj, widtype);
2140 win = elm_widget_data_get(obj);
2142 if (win->rot == rotation) return;
2143 win->rot = rotation;
2144 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2145 evas_object_size_hint_min_set(obj, -1, -1);
2146 evas_object_size_hint_max_set(obj, -1, -1);
2147 _elm_win_eval_subobjs(obj);
2148 #ifdef HAVE_ELEMENTARY_X
2149 _elm_win_xwin_update(win);
2154 elm_win_rotation_get(const Evas_Object *obj)
2157 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2158 win = elm_widget_data_get(obj);
2159 if (!win) return -1;
2164 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2167 ELM_CHECK_WIDTYPE(obj, widtype);
2168 win = elm_widget_data_get(obj);
2170 ecore_evas_sticky_set(win->ee, sticky);
2171 #ifdef HAVE_ELEMENTARY_X
2172 _elm_win_xwin_update(win);
2177 elm_win_sticky_get(const Evas_Object *obj)
2180 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2181 win = elm_widget_data_get(obj);
2182 if (!win) return EINA_FALSE;
2183 return ecore_evas_sticky_get(win->ee);
2187 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2190 ELM_CHECK_WIDTYPE(obj, widtype);
2191 win = elm_widget_data_get(obj);
2193 if (mode == win->kbdmode) return;
2194 #ifdef HAVE_ELEMENTARY_X
2195 _elm_win_xwindow_get(win);
2197 win->kbdmode = mode;
2198 #ifdef HAVE_ELEMENTARY_X
2200 ecore_x_e_virtual_keyboard_state_set
2201 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2205 EAPI Elm_Win_Keyboard_Mode
2206 elm_win_keyboard_mode_get(const Evas_Object *obj)
2209 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2210 win = elm_widget_data_get(obj);
2211 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2212 return win->kbdmode;
2216 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2219 ELM_CHECK_WIDTYPE(obj, widtype);
2220 win = elm_widget_data_get(obj);
2222 #ifdef HAVE_ELEMENTARY_X
2223 _elm_win_xwindow_get(win);
2225 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2232 elm_win_keyboard_win_get(const Evas_Object *obj)
2235 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2236 win = elm_widget_data_get(obj);
2237 if (!win) return EINA_FALSE;
2238 #ifdef HAVE_ELEMENTARY_X
2239 _elm_win_xwindow_get(win);
2241 return ecore_x_e_virtual_keyboard_get(win->xwin);
2247 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2250 ELM_CHECK_WIDTYPE(obj, widtype);
2251 win = elm_widget_data_get(obj);
2253 if (x) *x = win->screen.x;
2254 if (y) *y = win->screen.y;
2258 elm_win_focus_get(const Evas_Object *obj)
2261 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2262 win = elm_widget_data_get(obj);
2263 if (!win) return EINA_FALSE;
2264 return ecore_evas_focus_get(win->ee);
2268 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2271 ELM_CHECK_WIDTYPE(obj, widtype);
2272 win = elm_widget_data_get(obj);
2274 win->constrain = !!constrain;
2278 elm_win_screen_constrain_get(Evas_Object *obj)
2281 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2282 win = elm_widget_data_get(obj);
2283 if (!win) return EINA_FALSE;
2284 return win->constrain;
2288 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2291 ELM_CHECK_WIDTYPE(obj, widtype);
2292 win = elm_widget_data_get(obj);
2294 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2298 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2301 ELM_CHECK_WIDTYPE(obj, widtype);
2302 win = elm_widget_data_get(obj);
2304 #ifdef HAVE_ELEMENTARY_X
2305 _elm_win_xwindow_get(win);
2307 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2314 elm_win_conformant_get(const Evas_Object *obj)
2317 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2318 win = elm_widget_data_get(obj);
2319 if (!win) return EINA_FALSE;
2320 #ifdef HAVE_ELEMENTARY_X
2321 _elm_win_xwindow_get(win);
2323 return ecore_x_e_illume_conformant_get(win->xwin);
2329 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2332 ELM_CHECK_WIDTYPE(obj, widtype);
2333 win = elm_widget_data_get(obj);
2335 #ifdef HAVE_ELEMENTARY_X
2336 _elm_win_xwindow_get(win);
2339 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2342 Ecore_X_Window_State states[2];
2344 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2345 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2346 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2347 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2356 elm_win_quickpanel_get(const Evas_Object *obj)
2359 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2360 win = elm_widget_data_get(obj);
2361 if (!win) return EINA_FALSE;
2362 #ifdef HAVE_ELEMENTARY_X
2363 _elm_win_xwindow_get(win);
2365 return ecore_x_e_illume_quickpanel_get(win->xwin);
2371 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2374 ELM_CHECK_WIDTYPE(obj, widtype);
2375 win = elm_widget_data_get(obj);
2377 #ifdef HAVE_ELEMENTARY_X
2378 _elm_win_xwindow_get(win);
2380 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2387 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2390 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2391 win = elm_widget_data_get(obj);
2392 if (!win) return -1;
2393 #ifdef HAVE_ELEMENTARY_X
2394 _elm_win_xwindow_get(win);
2396 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2402 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2405 ELM_CHECK_WIDTYPE(obj, widtype);
2406 win = elm_widget_data_get(obj);
2408 #ifdef HAVE_ELEMENTARY_X
2409 _elm_win_xwindow_get(win);
2411 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2418 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2421 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2422 win = elm_widget_data_get(obj);
2423 if (!win) return -1;
2424 #ifdef HAVE_ELEMENTARY_X
2425 _elm_win_xwindow_get(win);
2427 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2433 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2436 ELM_CHECK_WIDTYPE(obj, widtype);
2437 win = elm_widget_data_get(obj);
2439 #ifdef HAVE_ELEMENTARY_X
2440 _elm_win_xwindow_get(win);
2442 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2449 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2452 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2453 win = elm_widget_data_get(obj);
2455 #ifdef HAVE_ELEMENTARY_X
2456 _elm_win_xwindow_get(win);
2458 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2464 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2467 ELM_CHECK_WIDTYPE(obj, widtype);
2468 win = elm_widget_data_get(obj);
2470 #ifdef HAVE_ELEMENTARY_X
2471 _elm_win_xwindow_get(win);
2476 Ecore_X_Window_State states[2];
2478 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2479 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2480 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2481 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2490 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2493 ELM_CHECK_WIDTYPE(obj, widtype);
2494 win = elm_widget_data_get(obj);
2496 #ifdef HAVE_ELEMENTARY_X
2497 _elm_win_xwindow_get(win);
2502 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2503 ecore_x_e_illume_focus_back_send(win->xwin);
2505 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2506 ecore_x_e_illume_focus_forward_send(win->xwin);
2508 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2509 ecore_x_e_illume_focus_home_send(win->xwin);
2511 case ELM_ILLUME_COMMAND_CLOSE:
2512 ecore_x_e_illume_close_send(win->xwin);
2524 elm_win_inlined_image_object_get(Evas_Object *obj)
2527 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2528 win = elm_widget_data_get(obj);
2529 if (!win) return NULL;
2530 return win->img_obj;
2534 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2538 ELM_CHECK_WIDTYPE(obj, widtype);
2540 win = elm_widget_data_get(obj);
2541 enabled = !!enabled;
2542 if (win->focus_highlight.enabled == enabled)
2545 win->focus_highlight.enabled = enabled;
2547 if (win->focus_highlight.enabled)
2548 _elm_win_focus_highlight_init(win);
2550 _elm_win_focus_highlight_shutdown(win);
2554 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2558 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2560 win = elm_widget_data_get(obj);
2561 return win->focus_highlight.enabled;
2565 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2569 ELM_CHECK_WIDTYPE(obj, widtype);
2571 win = elm_widget_data_get(obj);
2572 eina_stringshare_replace(&win->focus_highlight.style, style);
2573 win->focus_highlight.changed_theme = EINA_TRUE;
2574 _elm_win_focus_highlight_reconfigure_job_start(win);
2578 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2582 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2584 win = elm_widget_data_get(obj);
2585 return win->focus_highlight.style;
2588 typedef struct _Widget_Data Widget_Data;
2593 Evas_Object *content;
2596 static void _del_hook(Evas_Object *obj);
2597 static void _theme_hook(Evas_Object *obj);
2598 static void _sizing_eval(Evas_Object *obj);
2599 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2600 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2602 static const char *widtype2 = NULL;
2605 _del_hook(Evas_Object *obj)
2607 Widget_Data *wd = elm_widget_data_get(obj);
2613 _theme_hook(Evas_Object *obj)
2615 Widget_Data *wd = elm_widget_data_get(obj);
2616 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2618 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2621 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2625 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2627 Widget_Data *wd = elm_widget_data_get(obj);
2632 /* Try Focus cycle in subitem */
2635 elm_widget_focus_next_get(wd->content, dir, next);
2640 *next = (Evas_Object *)obj;
2645 _sizing_eval(Evas_Object *obj)
2647 Widget_Data *wd = elm_widget_data_get(obj);
2648 Evas_Coord minw = -1, minh = -1;
2650 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2651 edje_object_size_min_calc(wd->frm, &minw, &minh);
2652 evas_object_size_hint_min_set(obj, minw, minh);
2653 evas_object_size_hint_max_set(obj, -1, -1);
2657 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2663 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2665 Widget_Data *wd = elm_widget_data_get(obj);
2666 Evas_Object *sub = event_info;
2667 if (sub == wd->content)
2669 evas_object_event_callback_del_full
2670 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2677 elm_win_inwin_add(Evas_Object *obj)
2683 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2684 win = elm_widget_data_get(obj);
2685 if (!win) return NULL;
2686 wd = ELM_NEW(Widget_Data);
2687 obj2 = elm_widget_add(win->evas);
2688 elm_widget_type_set(obj2, "inwin");
2689 ELM_SET_WIDTYPE(widtype2, "inwin");
2690 elm_widget_sub_object_add(obj, obj2);
2691 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2692 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2693 elm_win_resize_object_add(obj, obj2);
2695 elm_widget_data_set(obj2, wd);
2696 elm_widget_del_hook_set(obj2, _del_hook);
2697 elm_widget_theme_hook_set(obj2, _theme_hook);
2698 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2699 elm_widget_can_focus_set(obj2, EINA_TRUE);
2700 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2702 wd->frm = edje_object_add(win->evas);
2703 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2704 elm_widget_resize_object_set(obj2, wd->frm);
2706 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2713 elm_win_inwin_activate(Evas_Object *obj)
2715 ELM_CHECK_WIDTYPE(obj, widtype2);
2716 Widget_Data *wd = elm_widget_data_get(obj);
2718 evas_object_raise(obj);
2719 evas_object_show(obj);
2720 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2721 elm_object_focus_set(obj, EINA_TRUE);
2725 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2727 ELM_CHECK_WIDTYPE(obj, widtype2);
2728 Widget_Data *wd = elm_widget_data_get(obj);
2730 if (wd->content == content) return;
2731 if (wd->content) evas_object_del(wd->content);
2732 wd->content = content;
2735 elm_widget_sub_object_add(obj, content);
2736 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2737 _changed_size_hints, obj);
2738 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2744 elm_win_inwin_content_get(const Evas_Object *obj)
2746 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2747 Widget_Data *wd = elm_widget_data_get(obj);
2748 if (!wd) return NULL;
2753 elm_win_inwin_content_unset(Evas_Object *obj)
2755 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2756 Widget_Data *wd = elm_widget_data_get(obj);
2757 if (!wd) return NULL;
2758 if (!wd->content) return NULL;
2759 Evas_Object *content = wd->content;
2760 elm_widget_sub_object_del(obj, wd->content);
2761 evas_object_event_callback_del_full(wd->content,
2762 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2763 _changed_size_hints, obj);
2764 edje_object_part_unswallow(wd->frm, wd->content);
2769 /* windowing spcific calls - shall we do this differently? */
2771 static Ecore_X_Window
2772 _elm_ee_win_get(const Evas_Object *obj)
2775 #ifdef HAVE_ELEMENTARY_X
2776 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2777 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2783 elm_win_xwindow_get(const Evas_Object *obj)
2789 type = elm_widget_type_get(obj);
2790 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
2791 win = elm_widget_data_get(obj);
2793 #ifdef HAVE_ELEMENTARY_X
2794 if (win->xwin) return win->xwin;
2795 if (win->parent) return elm_win_xwindow_get(win->parent);