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 repname = malloc(sizeof(char)*(strlen(tmp) + 16));
148 strncpy(repname, tmp, dotptr - tmp);
149 sprintf(repname + (dotptr - tmp), "%03i",
150 win->shot.shot_counter + 1);
151 strcat(repname, dotptr);
159 if (!win->shot.repeat_count) return strdup("out.png");
162 repname = malloc(sizeof(char) * 24);
163 sprintf(repname, "out%03i.png", win->shot.shot_counter + 1);
169 _shot_repeat_count_get(Elm_Win *win)
173 char *d = strdup(win->shot.info);
176 for (p = (char *)win->shot.info; *p; p++)
178 if (!strncmp(p, "repeat=", 7))
182 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
189 if (v > 1000) v = 999;
199 _shot_key_get(Elm_Win *win __UNUSED__)
205 _shot_flags_get(Elm_Win *win __UNUSED__)
211 _shot_do(Elm_Win *win)
215 unsigned int *pixels;
217 char *file, *key, *flags;
219 ecore_evas_manual_render(win->ee);
220 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
222 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
223 if ((w < 1) || (h < 1)) return;
224 file = _shot_file_get(win);
226 key = _shot_key_get(win);
227 flags = _shot_flags_get(win);
228 ee = ecore_evas_buffer_new(1, 1);
229 o = evas_object_image_add(ecore_evas_get(ee));
230 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
231 evas_object_image_size_set(o, w, h);
232 evas_object_image_data_set(o, pixels);
233 if (!evas_object_image_save(o, file, key, flags))
235 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
240 if (flags) free(flags);
242 if (win->shot.repeat_count) win->shot.shot_counter++;
246 _shot_delay(void *data)
250 if (win->shot.repeat_count)
252 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
253 if (remainshot > 0) return EINA_TRUE;
255 win->shot.timer = NULL;
261 _shot_init(Elm_Win *win)
263 if (!win->shot.info) return;
264 win->shot.repeat_count = _shot_repeat_count_get(win);
265 win->shot.shot_counter = 0;
269 _shot_handle(Elm_Win *win)
271 if (!win->shot.info) return;
272 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
276 _elm_win_move(Ecore_Evas *ee)
278 Evas_Object *obj = ecore_evas_object_associate_get(ee);
283 win = elm_widget_data_get(obj);
285 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
288 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
292 _elm_win_resize(Ecore_Evas *ee)
294 Evas_Object *obj = ecore_evas_object_associate_get(ee);
298 win = elm_widget_data_get(obj);
300 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
301 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
305 _elm_win_focus_in(Ecore_Evas *ee)
307 Evas_Object *obj = ecore_evas_object_associate_get(ee);
311 win = elm_widget_data_get(obj);
313 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
314 if (win->show_count == 1)
316 elm_widget_focus_steal(win->win_obj);
320 elm_widget_focus_restore(win->win_obj);
321 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
322 win->focus_highlight.cur.visible = EINA_TRUE;
323 _elm_win_focus_highlight_reconfigure_job_start(win);
326 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
328 else if (win->img_obj)
335 _elm_win_focus_out(Ecore_Evas *ee)
337 Evas_Object *obj = ecore_evas_object_associate_get(ee);
341 win = elm_widget_data_get(obj);
343 elm_object_focus_set(win->win_obj, EINA_FALSE);
344 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
345 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
346 win->focus_highlight.cur.visible = EINA_FALSE;
347 _elm_win_focus_highlight_reconfigure_job_start(win);
350 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
352 else if (win->img_obj)
359 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
361 Elm_Win *wd = elm_widget_data_get(obj);
362 const Eina_List *items;
363 void *(*list_data_get) (const Eina_List *list);
371 if (!(items = elm_widget_focus_custom_chain_get(obj)))
377 list_data_get = eina_list_data_get;
379 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
385 *next = (Evas_Object *)obj;
390 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
392 Elm_Win *win = elm_widget_data_get(obj);
396 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
398 evas_object_focus_set(obj, elm_widget_focus_get(obj));
402 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
404 if (type == EVAS_CALLBACK_KEY_DOWN)
406 Evas_Event_Key_Down *ev = event_info;
407 if (!strcmp(ev->keyname, "Tab"))
409 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
410 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
412 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
413 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
416 else if ((!strcmp(ev->keyname, "Left")) ||
417 (!strcmp(ev->keyname, "KP_Left")))
419 //TODO : woohyun jung
421 else if ((!strcmp(ev->keyname, "Right")) ||
422 (!strcmp(ev->keyname, "KP_Right")))
424 //TODO : woohyun jung
426 else if ((!strcmp(ev->keyname, "Up")) ||
427 (!strcmp(ev->keyname, "KP_Up")))
429 //TODO : woohyun jung
431 else if ((!strcmp(ev->keyname, "Down")) ||
432 (!strcmp(ev->keyname, "KP_Down")))
434 //TODO : woohyun jung
442 _deferred_ecore_evas_free(void *data)
444 ecore_evas_free(data);
445 _elm_win_deferred_free--;
449 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
453 if (!win->show_count) win->show_count++;
454 if (win->shot.info) _shot_handle(win);
458 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
464 evas_object_hide(win->frame_obj);
466 else if (win->img_obj)
468 evas_object_hide(win->img_obj);
473 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
480 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
481 _elm_win_obj_callback_parent_del, win);
484 if (win->autodel_clear) *(win->autodel_clear) = -1;
485 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
486 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
489 ecore_evas_callback_delete_request_set(win->ee, NULL);
490 ecore_evas_callback_resize_set(win->ee, NULL);
492 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
493 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
494 if (win->shot.info) eina_stringshare_del(win->shot.info);
495 if (win->shot.timer) ecore_timer_del(win->shot.timer);
496 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
497 _elm_win_obj_callback_del, win);
498 while (((child = evas_object_bottom_get(win->evas))) &&
501 evas_object_del(child);
503 while (((child = evas_object_top_get(win->evas))) &&
506 evas_object_del(child);
508 #ifdef HAVE_ELEMENTARY_X
509 if (win->client_message_handler)
510 ecore_event_handler_del(win->client_message_handler);
512 // FIXME: Why are we flushing edje on every window destroy ??
513 // edje_file_cache_flush();
514 // edje_collection_cache_flush();
515 // evas_image_cache_flush(win->evas);
516 // evas_font_cache_flush(win->evas);
517 // FIXME: we are in the del handler for the object and delete the canvas
518 // that lives under it from the handler... nasty. deferring doesn't help either
528 ecore_job_add(_deferred_ecore_evas_free, win->ee);
529 _elm_win_deferred_free++;
533 _elm_win_focus_highlight_shutdown(win);
534 eina_stringshare_del(win->focus_highlight.style);
538 if ((!_elm_win_list) &&
539 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
541 edje_file_cache_flush();
542 edje_collection_cache_flush();
543 evas_image_cache_flush(e);
544 evas_font_cache_flush(e);
550 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
553 if (!win->img_obj) return;
554 evas_object_event_callback_del_full
555 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
556 evas_object_del(win->img_obj);
560 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
563 if (obj == win->parent) win->parent = NULL;
567 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
573 if ((x != win->screen.x) || (y != win->screen.y))
577 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
582 evas_object_move(obj, x, y);
587 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
590 // this is called to make sure all smart containers have calculated their
591 // sizes BEFORE we show the window to make sure it initially appears at
592 // our desired size (ie min size is known first)
593 evas_smart_objects_calculate(evas_object_evas_get(obj));
596 evas_object_show(win->frame_obj);
598 else if (win->img_obj)
600 evas_object_show(win->img_obj);
602 evas_object_show(obj);
606 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
610 if (ecore_evas_override_get(win->ee))
614 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
617 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
623 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
627 else if (win->img_obj)
631 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
634 // evas_object_move(win->img_obj, x, y);
639 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
646 else if (win->img_obj)
648 Evas_Coord w = 1, h = 1;
650 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
654 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
660 evas_object_image_size_set(win->img_obj, w, h);
665 _elm_win_delete_request(Ecore_Evas *ee)
667 Evas_Object *obj = ecore_evas_object_associate_get(ee);
669 if (strcmp(elm_widget_type_get(obj), "win")) return;
671 win = elm_widget_data_get(obj);
673 int autodel = win->autodel;
674 win->autodel_clear = &autodel;
675 evas_object_ref(win->win_obj);
676 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
677 // FIXME: if above callback deletes - then the below will be invalid
678 if (autodel) evas_object_del(win->win_obj);
679 else win->autodel_clear = NULL;
680 evas_object_unref(win->win_obj);
684 _elm_win_resize_job(void *data)
691 win->deferred_resize_job = NULL;
692 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
696 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
702 evas_object_resize(win->frame_obj, w, h);
704 else if (win->img_obj)
707 evas_object_resize(win->win_obj, w, h);
708 EINA_LIST_FOREACH(win->subobjs, l, obj)
710 evas_object_move(obj, 0, 0);
711 evas_object_resize(obj, w, h);
715 #ifdef HAVE_ELEMENTARY_X
717 _elm_win_xwindow_get(Elm_Win *win)
721 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
722 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
724 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
726 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
727 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
728 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
729 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
730 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
731 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
732 ENGINE_COMPARE(ELM_OPENGL_COCOA))
735 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
737 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
739 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
741 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
744 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
746 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
749 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
751 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
753 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
755 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
757 #undef ENGINE_COMPARE
761 #ifdef HAVE_ELEMENTARY_X
763 _elm_win_xwin_update(Elm_Win *win)
765 _elm_win_xwindow_get(win);
770 win2 = elm_widget_data_get(win->parent);
774 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
778 if (!win->xwin) return; /* nothing more to do */
783 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
785 case ELM_WIN_DIALOG_BASIC:
786 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
788 case ELM_WIN_DESKTOP:
789 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
792 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
794 case ELM_WIN_TOOLBAR:
795 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
798 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
800 case ELM_WIN_UTILITY:
801 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
804 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
806 case ELM_WIN_DROPDOWN_MENU:
807 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
809 case ELM_WIN_POPUP_MENU:
810 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
812 case ELM_WIN_TOOLTIP:
813 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
815 case ELM_WIN_NOTIFICATION:
816 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
819 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
822 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
827 ecore_x_e_virtual_keyboard_state_set
828 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
833 _elm_win_eval_subobjs(Evas_Object *obj)
836 const Evas_Object *child;
838 Elm_Win *win = elm_widget_data_get(obj);
839 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
843 EINA_LIST_FOREACH(win->subobjs, l, child)
845 evas_object_size_hint_weight_get(child, &wx, &wy);
846 if (wx == 0.0) xx = 0;
847 if (wy == 0.0) xy = 0;
849 evas_object_size_hint_min_get(child, &w, &h);
852 if (w > minw) minw = w;
853 if (h > minh) minh = h;
855 evas_object_size_hint_max_get(child, &w, &h);
858 if (maxw == -1) maxw = w;
859 else if ((w > 0) && (w < maxw)) maxw = w;
860 if (maxh == -1) maxh = h;
861 else if ((h > 0) && (h < maxh)) maxh = h;
863 if (!xx) maxw = minw;
865 if (!xy) maxh = minh;
867 evas_object_size_hint_min_set(obj, minw, minh);
868 evas_object_size_hint_max_set(obj, maxw, maxh);
869 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
870 if (w < minw) w = minw;
871 if (h < minh) h = minh;
872 if ((maxw >= 0) && (w > maxw)) w = maxw;
873 if ((maxh >= 0) && (h > maxh)) h = maxh;
874 evas_object_resize(obj, w, h);
878 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
880 Elm_Win *win = elm_widget_data_get(data);
881 win->subobjs = eina_list_remove(win->subobjs, obj);
882 _elm_win_eval_subobjs(win->win_obj);
886 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
888 _elm_win_eval_subobjs(data);
892 _elm_win_shutdown(void)
894 while (_elm_win_list)
895 evas_object_del(_elm_win_list->data);
899 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
906 EINA_LIST_FOREACH(_elm_win_list, l, obj)
907 elm_widget_theme(obj);
911 EINA_LIST_FOREACH(_elm_win_list, l, obj)
912 elm_widget_theme_specific(obj, th, EINA_FALSE);
917 _elm_win_translate(void)
922 EINA_LIST_FOREACH(_elm_win_list, l, obj)
923 elm_widget_translate(obj);
926 #ifdef HAVE_ELEMENTARY_X
928 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
931 Ecore_X_Event_Client_Message *e = event;
933 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
934 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
936 if ((unsigned)e->data.l[0] == win->xwin)
938 Evas *evas = evas_object_evas_get(win->win_obj);
941 edje_file_cache_flush();
942 edje_collection_cache_flush();
943 evas_image_cache_flush(evas);
944 evas_font_cache_flush(evas);
948 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
950 if ((unsigned)e->data.l[0] == win->xwin)
952 Evas *evas = evas_object_evas_get(win->win_obj);
955 edje_file_cache_flush();
956 edje_collection_cache_flush();
957 evas_image_cache_flush(evas);
958 evas_font_cache_flush(evas);
959 evas_render_dump(evas);
963 return ECORE_CALLBACK_PASS_ON;
968 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
972 win->focus_highlight.geometry_changed = EINA_TRUE;
973 _elm_win_focus_highlight_reconfigure_job_start(win);
977 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
981 win->focus_highlight.geometry_changed = EINA_TRUE;
982 _elm_win_focus_highlight_reconfigure_job_start(win);
986 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
990 win->focus_highlight.cur.target = NULL;
992 _elm_win_focus_highlight_reconfigure_job_start(win);
996 _elm_win_focus_target_callbacks_add(Elm_Win *win)
998 Evas_Object *obj = win->focus_highlight.cur.target;
1000 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1001 _elm_win_focus_target_move, win);
1002 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1003 _elm_win_focus_target_resize, win);
1004 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1005 _elm_win_focus_target_del, win);
1009 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1011 Evas_Object *obj = win->focus_highlight.cur.target;
1013 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1014 _elm_win_focus_target_move, win);
1015 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1016 _elm_win_focus_target_resize, win);
1017 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1018 _elm_win_focus_target_del, win);
1021 static Evas_Object *
1022 _elm_win_focus_target_get(Evas_Object *obj)
1024 Evas_Object *o = obj;
1028 if (elm_widget_is(o))
1030 if (!elm_widget_highlight_ignore_get(o))
1032 o = elm_widget_parent_get(o);
1034 o = evas_object_smart_parent_get(o);
1038 o = elm_widget_parent_widget_get(o);
1040 o = evas_object_smart_parent_get(o);
1049 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1051 Evas_Object *obj = event_info, *target;
1052 Elm_Win *win = data;
1054 if (win->focus_highlight.cur.target == obj)
1057 target = _elm_win_focus_target_get(obj);
1058 win->focus_highlight.cur.target = target;
1059 if (elm_widget_highlight_in_theme_get(target))
1060 win->focus_highlight.cur.handled = EINA_TRUE;
1062 _elm_win_focus_target_callbacks_add(win);
1064 _elm_win_focus_highlight_reconfigure_job_start(win);
1068 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1070 Elm_Win *win = data;
1072 if (!win->focus_highlight.cur.target)
1075 if (!win->focus_highlight.cur.handled)
1076 _elm_win_focus_target_callbacks_del(win);
1077 win->focus_highlight.cur.target = NULL;
1078 win->focus_highlight.cur.handled = EINA_FALSE;
1080 _elm_win_focus_highlight_reconfigure_job_start(win);
1084 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1086 evas_object_hide(obj);
1090 _elm_win_focus_highlight_init(Elm_Win *win)
1092 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1093 _elm_win_object_focus_in, win);
1094 evas_event_callback_add(win->evas,
1095 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1096 _elm_win_object_focus_out, win);
1098 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1100 win->focus_highlight.top = edje_object_add(win->evas);
1101 win->focus_highlight.changed_theme = EINA_TRUE;
1102 edje_object_signal_callback_add(win->focus_highlight.top,
1103 "elm,action,focus,hide,end", "",
1104 _elm_win_focus_highlight_hide, NULL);
1105 edje_object_signal_callback_add(win->focus_highlight.top,
1106 "elm,action,focus,anim,end", "",
1107 _elm_win_focus_highlight_anim_end, win);
1108 _elm_win_focus_highlight_reconfigure_job_start(win);
1112 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1114 _elm_win_focus_highlight_reconfigure_job_stop(win);
1115 if (win->focus_highlight.cur.target)
1117 _elm_win_focus_target_callbacks_del(win);
1118 win->focus_highlight.cur.target = NULL;
1120 if (win->focus_highlight.top)
1122 evas_object_del(win->focus_highlight.top);
1123 win->focus_highlight.top = NULL;
1126 evas_event_callback_del_full(win->evas,
1127 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1128 _elm_win_object_focus_in, win);
1129 evas_event_callback_del_full(win->evas,
1130 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1131 _elm_win_object_focus_out, win);
1135 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1139 top = win->focus_highlight.top;
1144 evas_object_show(top);
1145 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1151 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1156 _elm_win_focus_highlight_reconfigure_job(void *data)
1158 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1162 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1164 if (win->focus_highlight.reconf_job)
1165 ecore_job_del(win->focus_highlight.reconf_job);
1166 win->focus_highlight.reconf_job = ecore_job_add(
1167 _elm_win_focus_highlight_reconfigure_job, win);
1171 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1173 if (win->focus_highlight.reconf_job)
1174 ecore_job_del(win->focus_highlight.reconf_job);
1175 win->focus_highlight.reconf_job = NULL;
1179 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1181 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1182 Evas_Coord x, y, w, h;
1184 clip = evas_object_clip_get(target);
1185 evas_object_geometry_get(target, &x, &y, &w, &h);
1187 evas_object_move(obj, x, y);
1188 evas_object_resize(obj, w, h);
1189 evas_object_clip_set(obj, clip);
1193 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1195 Evas_Coord tx, ty, tw, th;
1196 Evas_Coord w, h, px, py, pw, ph;
1197 Edje_Message_Int_Set *m;
1198 Evas_Object *previous = win->focus_highlight.prev.target;
1199 Evas_Object *target = win->focus_highlight.cur.target;
1201 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1202 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1203 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1204 evas_object_move(obj, 0, 0);
1205 evas_object_resize(obj, tw, th);
1206 evas_object_clip_unset(obj);
1208 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1218 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1222 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1224 Elm_Win *win = data;
1225 _elm_win_focus_highlight_simple_setup(win, obj);
1229 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1231 Evas_Object *target = win->focus_highlight.cur.target;
1232 Evas_Object *previous = win->focus_highlight.prev.target;
1233 Evas_Object *top = win->focus_highlight.top;
1234 Eina_Bool visible_changed;
1235 Eina_Bool common_visible;
1236 const char *sig = NULL;
1238 _elm_win_focus_highlight_reconfigure_job_stop(win);
1240 visible_changed = (win->focus_highlight.cur.visible !=
1241 win->focus_highlight.prev.visible);
1243 if ((target == previous) && (!visible_changed) &&
1244 (!win->focus_highlight.geometry_changed))
1247 if ((previous) && (win->focus_highlight.prev.handled))
1248 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1251 common_visible = EINA_FALSE;
1252 else if (win->focus_highlight.cur.handled)
1254 common_visible = EINA_FALSE;
1255 if (win->focus_highlight.cur.visible)
1256 sig = "elm,action,focus_highlight,show";
1258 sig = "elm,action,focus_highlight,hide";
1261 common_visible = win->focus_highlight.cur.visible;
1263 _elm_win_focus_highlight_visible_set(win, common_visible);
1265 elm_widget_signal_emit(target, sig, "elm");
1267 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1270 if (win->focus_highlight.changed_theme)
1273 if (win->focus_highlight.style)
1274 str = win->focus_highlight.style;
1277 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1279 win->focus_highlight.changed_theme = EINA_FALSE;
1281 if (_elm_config->focus_highlight_animate)
1283 str = edje_object_data_get(win->focus_highlight.top, "animate");
1284 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1288 if ((win->focus_highlight.top_animate) && (previous) &&
1289 (!win->focus_highlight.prev.handled))
1290 _elm_win_focus_highlight_anim_setup(win, top);
1292 _elm_win_focus_highlight_simple_setup(win, top);
1293 evas_object_raise(top);
1296 win->focus_highlight.geometry_changed = EINA_FALSE;
1297 win->focus_highlight.prev = win->focus_highlight.cur;
1302 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1304 Evas_Event_Key_Down *ev = event_info;
1306 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1310 if ((strcmp(ev->keyname, "F12")) ||
1311 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1314 printf("Tree graph generated.\n");
1315 elm_object_tree_dot_dump(obj, "./dump.dot");
1320 _win_img_hide(void *data,
1322 Evas_Object *obj __UNUSED__,
1323 void *event_info __UNUSED__)
1325 Elm_Win *win = data;
1327 elm_widget_focus_hide_handle(win->win_obj);
1331 _win_img_mouse_up(void *data,
1333 Evas_Object *obj __UNUSED__,
1336 Elm_Win *win = data;
1337 Evas_Event_Mouse_Up *ev = event_info;
1338 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1339 elm_widget_focus_mouse_up_handle(win->win_obj);
1343 _win_img_focus_in(void *data,
1345 Evas_Object *obj __UNUSED__,
1346 void *event_info __UNUSED__)
1348 Elm_Win *win = data;
1349 elm_widget_focus_steal(win->win_obj);
1353 _win_img_focus_out(void *data,
1355 Evas_Object *obj __UNUSED__,
1356 void *event_info __UNUSED__)
1358 Elm_Win *win = data;
1359 elm_widget_focused_object_clear(win->win_obj);
1363 _win_inlined_image_set(Elm_Win *win)
1365 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1366 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1367 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1368 _elm_win_obj_callback_img_obj_del, win);
1370 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1371 _win_img_hide, win);
1372 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1373 _win_img_mouse_up, win);
1374 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1375 _win_img_focus_in, win);
1376 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1377 _win_img_focus_out, win);
1381 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1383 evas_object_event_callback_del_full(subobj,
1384 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1385 _elm_win_subobj_callback_changed_size_hints,
1387 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1388 _elm_win_subobj_callback_del, obj);
1389 win->subobjs = eina_list_remove(win->subobjs, subobj);
1390 _elm_win_eval_subobjs(obj);
1394 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1398 const char *fontpath;
1400 win = ELM_NEW(Elm_Win);
1402 #define FALLBACK_TRY(engine) \
1405 CRITICAL(engine " engine creation failed. Trying default."); \
1406 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1408 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1410 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1414 case ELM_WIN_INLINED_IMAGE:
1417 Evas *e = evas_object_evas_get(parent);
1420 ee = ecore_evas_ecore_evas_get(e);
1422 win->img_obj = ecore_evas_object_image_new(ee);
1423 if (!win->img_obj) break;
1424 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1427 _win_inlined_image_set(win);
1430 evas_object_del(win->img_obj);
1431 win->img_obj = NULL;
1435 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1437 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1438 #ifdef HAVE_ELEMENTARY_X
1439 win->client_message_handler = ecore_event_handler_add
1440 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1442 FALLBACK_TRY("Sofware X11");
1444 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1446 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1447 FALLBACK_TRY("Sofware FB");
1449 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1451 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1452 FALLBACK_TRY("Sofware DirectFB");
1454 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1456 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1457 FALLBACK_TRY("Sofware-16");
1458 #ifdef HAVE_ELEMENTARY_X
1459 win->client_message_handler = ecore_event_handler_add
1460 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1463 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1465 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1466 FALLBACK_TRY("Sofware-8");
1467 #ifdef HAVE_ELEMENTARY_X
1468 win->client_message_handler = ecore_event_handler_add
1469 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1473 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1475 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1476 FALLBACK_TRY("XRender");
1477 #ifdef HAVE_ELEMENTARY_X
1478 win->client_message_handler = ecore_event_handler_add
1479 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1483 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1488 if (_elm_config->vsync)
1490 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1496 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1498 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1499 FALLBACK_TRY("OpenGL");
1500 #ifdef HAVE_ELEMENTARY_X
1501 win->client_message_handler = ecore_event_handler_add
1502 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1505 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1507 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1508 FALLBACK_TRY("Sofware Win32");
1510 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1512 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1513 FALLBACK_TRY("Sofware-16-WinCE");
1515 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1517 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1518 FALLBACK_TRY("PSL1GHT");
1520 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1522 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1523 FALLBACK_TRY("Sofware SDL");
1525 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1527 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1528 FALLBACK_TRY("Sofware-16-SDL");
1530 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1532 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1533 FALLBACK_TRY("OpenGL SDL");
1535 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1537 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1538 FALLBACK_TRY("OpenGL Cocoa");
1540 else if (ENGINE_COMPARE(ELM_BUFFER))
1542 win->ee = ecore_evas_buffer_new(1, 1);
1544 else if (ENGINE_COMPARE(ELM_EWS))
1546 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1548 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1550 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 1, 1, 0);
1551 win->evas = ecore_evas_get(win->ee);
1552 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1554 win->frame_obj = edje_object_add(win->evas);
1555 _elm_theme_set(NULL, win->frame_obj, "border", "base", "default");
1556 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1557 evas_object_move(win->frame_obj, 0, 0);
1558 evas_object_resize(win->frame_obj, 1, 1);
1560 else if (!strncmp(_elm_config->engine, "shot:", 5))
1562 win->ee = ecore_evas_buffer_new(1, 1);
1563 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1564 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1573 ERR("Cannot create window.");
1577 #ifdef HAVE_ELEMENTARY_X
1578 _elm_win_xwindow_get(win);
1580 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1581 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1582 // bg pixmap done by x - has other issues like can be redrawn by x before it
1583 // is filled/ready by app
1584 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1587 win->parent = parent;
1589 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1590 _elm_win_obj_callback_parent_del, win);
1592 win->evas = ecore_evas_get(win->ee);
1593 win->win_obj = elm_widget_add(win->evas);
1594 elm_widget_type_set(win->win_obj, "win");
1595 ELM_SET_WIDTYPE(widtype, "win");
1596 elm_widget_data_set(win->win_obj, win);
1597 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1598 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1599 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1600 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1601 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1602 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1603 evas_object_move(win->win_obj, 0, 0);
1604 evas_object_resize(win->win_obj, 1, 1);
1605 evas_object_layer_set(win->win_obj, 50);
1606 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1610 // evas_object_clip_set(win->win_obj, win->frame_obj);
1611 evas_object_stack_below(win->frame_obj, win->win_obj);
1614 if (type == ELM_WIN_INLINED_IMAGE)
1615 elm_widget_parent2_set(win->win_obj, parent);
1616 ecore_evas_object_associate(win->ee, win->win_obj,
1617 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1618 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1619 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1620 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1621 _elm_win_obj_callback_show, win);
1622 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1623 _elm_win_obj_callback_hide, win);
1624 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1625 _elm_win_obj_callback_del, win);
1626 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1627 _elm_win_obj_callback_move, win);
1628 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1629 _elm_win_obj_callback_resize, win);
1631 evas_object_intercept_move_callback_add(win->win_obj,
1632 _elm_win_obj_intercept_move, win);
1633 evas_object_intercept_show_callback_add(win->win_obj,
1634 _elm_win_obj_intercept_show, win);
1636 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
1637 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1638 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1639 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1640 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1641 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1642 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1643 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1644 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1645 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1646 evas_font_path_append(win->evas, fontpath);
1647 if (!_elm_config->font_hinting)
1648 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1649 else if (_elm_config->font_hinting == 1)
1650 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1651 else if (_elm_config->font_hinting == 2)
1652 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1654 #ifdef HAVE_ELEMENTARY_X
1655 _elm_win_xwin_update(win);
1658 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1660 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1662 ecore_evas_fullscreen_set(win->ee, 1);
1664 #undef ENGINE_COMPARE
1666 if (_elm_config->focus_highlight_enable)
1667 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1670 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1671 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1672 _debug_key_down, win);
1674 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1676 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1679 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1681 return win->win_obj;
1685 elm_win_util_standard_add(const char *name, const char *title)
1687 Evas_Object *win, *bg;
1689 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1690 if (!win) return NULL;
1691 elm_win_title_set(win, title);
1692 bg = elm_bg_add(win);
1695 evas_object_del(win);
1698 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1699 elm_win_resize_object_add(win, bg);
1700 evas_object_show(bg);
1705 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1709 ELM_CHECK_WIDTYPE(obj, widtype);
1710 win = elm_widget_data_get(obj);
1712 if (eina_list_data_find(win->subobjs, subobj)) return;
1713 win->subobjs = eina_list_append(win->subobjs, subobj);
1714 elm_widget_sub_object_add(obj, subobj);
1715 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1716 _elm_win_subobj_callback_del, obj);
1717 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1718 _elm_win_subobj_callback_changed_size_hints,
1720 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1721 evas_object_move(subobj, 0, 0);
1722 evas_object_resize(subobj, w, h);
1723 _elm_win_eval_subobjs(obj);
1727 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1730 ELM_CHECK_WIDTYPE(obj, widtype);
1731 win = elm_widget_data_get(obj);
1733 evas_object_event_callback_del_full(subobj,
1734 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1735 _elm_win_subobj_callback_changed_size_hints,
1737 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1738 _elm_win_subobj_callback_del, obj);
1739 win->subobjs = eina_list_remove(win->subobjs, subobj);
1740 elm_widget_sub_object_del(obj, subobj);
1741 _elm_win_eval_subobjs(obj);
1745 elm_win_title_set(Evas_Object *obj, const char *title)
1748 ELM_CHECK_WIDTYPE(obj, widtype);
1749 win = elm_widget_data_get(obj);
1751 ecore_evas_title_set(win->ee, title);
1753 edje_object_part_text_set(win->frame_obj, "elm.text.title", title);
1757 elm_win_title_get(const Evas_Object *obj)
1760 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1761 win = elm_widget_data_get(obj);
1762 if (!win) return NULL;
1763 return ecore_evas_title_get(win->ee);
1767 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1770 ELM_CHECK_WIDTYPE(obj, widtype);
1771 win = elm_widget_data_get(obj);
1773 win->autodel = autodel;
1777 elm_win_autodel_get(const Evas_Object *obj)
1780 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1781 win = elm_widget_data_get(obj);
1782 if (!win) return EINA_FALSE;
1783 return win->autodel;
1787 elm_win_activate(Evas_Object *obj)
1790 ELM_CHECK_WIDTYPE(obj, widtype);
1791 win = elm_widget_data_get(obj);
1793 ecore_evas_activate(win->ee);
1797 elm_win_lower(Evas_Object *obj)
1800 ELM_CHECK_WIDTYPE(obj, widtype);
1801 win = elm_widget_data_get(obj);
1803 ecore_evas_lower(win->ee);
1807 elm_win_raise(Evas_Object *obj)
1810 ELM_CHECK_WIDTYPE(obj, widtype);
1811 win = elm_widget_data_get(obj);
1813 ecore_evas_raise(win->ee);
1817 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
1820 int win_w, win_h, screen_w, screen_h, nx, ny;
1821 ELM_CHECK_WIDTYPE(obj, widtype);
1822 win = elm_widget_data_get(obj);
1824 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
1825 if ((!screen_w) || (!screen_h)) return;
1826 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
1827 if ((!win_w) || (!win_h)) return;
1828 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
1829 else nx = win->screen.x;
1830 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
1831 else ny = win->screen.y;
1834 evas_object_move(obj, nx, ny);
1838 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1841 ELM_CHECK_WIDTYPE(obj, widtype);
1842 win = elm_widget_data_get(obj);
1844 ecore_evas_borderless_set(win->ee, borderless);
1845 #ifdef HAVE_ELEMENTARY_X
1846 _elm_win_xwin_update(win);
1851 elm_win_borderless_get(const Evas_Object *obj)
1854 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1855 win = elm_widget_data_get(obj);
1856 if (!win) return EINA_FALSE;
1857 return ecore_evas_borderless_get(win->ee);
1861 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1864 ELM_CHECK_WIDTYPE(obj, widtype);
1865 win = elm_widget_data_get(obj);
1867 ecore_evas_shaped_set(win->ee, shaped);
1868 #ifdef HAVE_ELEMENTARY_X
1869 _elm_win_xwin_update(win);
1874 elm_win_shaped_get(const Evas_Object *obj)
1877 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1878 win = elm_widget_data_get(obj);
1879 if (!win) return EINA_FALSE;
1880 return ecore_evas_shaped_get(win->ee);
1884 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1887 ELM_CHECK_WIDTYPE(obj, widtype);
1888 win = elm_widget_data_get(obj);
1893 else if (win->img_obj)
1895 evas_object_image_alpha_set(win->img_obj, alpha);
1896 ecore_evas_alpha_set(win->ee, alpha);
1900 #ifdef HAVE_ELEMENTARY_X
1905 if (!_elm_config->compositing)
1906 elm_win_shaped_set(obj, alpha);
1908 ecore_evas_alpha_set(win->ee, alpha);
1911 ecore_evas_alpha_set(win->ee, alpha);
1912 _elm_win_xwin_update(win);
1916 ecore_evas_alpha_set(win->ee, alpha);
1921 elm_win_alpha_get(const Evas_Object *obj)
1924 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1925 win = elm_widget_data_get(obj);
1926 if (!win) return EINA_FALSE;
1930 else if (win->img_obj)
1932 return evas_object_image_alpha_get(win->img_obj);
1934 return ecore_evas_alpha_get(win->ee);
1938 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1941 ELM_CHECK_WIDTYPE(obj, widtype);
1942 win = elm_widget_data_get(obj);
1948 else if (win->img_obj)
1950 evas_object_image_alpha_set(win->img_obj, transparent);
1954 #ifdef HAVE_ELEMENTARY_X
1957 ecore_evas_transparent_set(win->ee, transparent);
1958 _elm_win_xwin_update(win);
1962 ecore_evas_transparent_set(win->ee, transparent);
1967 elm_win_transparent_get(const Evas_Object *obj)
1970 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1971 win = elm_widget_data_get(obj);
1972 if (!win) return EINA_FALSE;
1974 return ecore_evas_transparent_get(win->ee);
1978 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1981 ELM_CHECK_WIDTYPE(obj, widtype);
1982 win = elm_widget_data_get(obj);
1984 ecore_evas_override_set(win->ee, override);
1985 #ifdef HAVE_ELEMENTARY_X
1986 _elm_win_xwin_update(win);
1991 elm_win_override_get(const Evas_Object *obj)
1994 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1995 win = elm_widget_data_get(obj);
1996 if (!win) return EINA_FALSE;
1997 return ecore_evas_override_get(win->ee);
2001 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2004 ELM_CHECK_WIDTYPE(obj, widtype);
2005 win = elm_widget_data_get(obj);
2008 // YYY: handle if win->img_obj
2009 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2010 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2011 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2013 // these engines... can ONLY be fullscreen
2018 ecore_evas_fullscreen_set(win->ee, fullscreen);
2019 #ifdef HAVE_ELEMENTARY_X
2020 _elm_win_xwin_update(win);
2023 #undef ENGINE_COMPARE
2027 elm_win_fullscreen_get(const Evas_Object *obj)
2030 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2031 win = elm_widget_data_get(obj);
2032 if (!win) return EINA_FALSE;
2034 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2035 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2036 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2038 // these engines... can ONLY be fullscreen
2043 return ecore_evas_fullscreen_get(win->ee);
2045 #undef ENGINE_COMPARE
2049 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2052 ELM_CHECK_WIDTYPE(obj, widtype);
2053 win = elm_widget_data_get(obj);
2055 // YYY: handle if win->img_obj
2056 ecore_evas_maximized_set(win->ee, maximized);
2057 #ifdef HAVE_ELEMENTARY_X
2058 _elm_win_xwin_update(win);
2063 elm_win_maximized_get(const Evas_Object *obj)
2066 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2067 win = elm_widget_data_get(obj);
2068 if (!win) return EINA_FALSE;
2069 return ecore_evas_maximized_get(win->ee);
2073 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2076 ELM_CHECK_WIDTYPE(obj, widtype);
2077 win = elm_widget_data_get(obj);
2079 ecore_evas_iconified_set(win->ee, iconified);
2080 #ifdef HAVE_ELEMENTARY_X
2081 _elm_win_xwin_update(win);
2086 elm_win_iconified_get(const Evas_Object *obj)
2089 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2090 win = elm_widget_data_get(obj);
2091 if (!win) return EINA_FALSE;
2092 return ecore_evas_iconified_get(win->ee);
2096 elm_win_layer_set(Evas_Object *obj, int layer)
2099 ELM_CHECK_WIDTYPE(obj, widtype);
2100 win = elm_widget_data_get(obj);
2102 ecore_evas_layer_set(win->ee, layer);
2103 #ifdef HAVE_ELEMENTARY_X
2104 _elm_win_xwin_update(win);
2109 elm_win_layer_get(const Evas_Object *obj)
2112 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2113 win = elm_widget_data_get(obj);
2114 if (!win) return -1;
2115 return ecore_evas_layer_get(win->ee);
2119 elm_win_rotation_set(Evas_Object *obj, int rotation)
2122 ELM_CHECK_WIDTYPE(obj, widtype);
2123 win = elm_widget_data_get(obj);
2125 if (win->rot == rotation) return;
2126 win->rot = rotation;
2127 ecore_evas_rotation_set(win->ee, rotation);
2128 evas_object_size_hint_min_set(obj, -1, -1);
2129 evas_object_size_hint_max_set(obj, -1, -1);
2130 _elm_win_eval_subobjs(obj);
2131 #ifdef HAVE_ELEMENTARY_X
2132 _elm_win_xwin_update(win);
2137 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2140 ELM_CHECK_WIDTYPE(obj, widtype);
2141 win = elm_widget_data_get(obj);
2143 if (win->rot == rotation) return;
2144 win->rot = rotation;
2145 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2146 evas_object_size_hint_min_set(obj, -1, -1);
2147 evas_object_size_hint_max_set(obj, -1, -1);
2148 _elm_win_eval_subobjs(obj);
2149 #ifdef HAVE_ELEMENTARY_X
2150 _elm_win_xwin_update(win);
2155 elm_win_rotation_get(const Evas_Object *obj)
2158 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2159 win = elm_widget_data_get(obj);
2160 if (!win) return -1;
2165 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2168 ELM_CHECK_WIDTYPE(obj, widtype);
2169 win = elm_widget_data_get(obj);
2171 ecore_evas_sticky_set(win->ee, sticky);
2172 #ifdef HAVE_ELEMENTARY_X
2173 _elm_win_xwin_update(win);
2178 elm_win_sticky_get(const Evas_Object *obj)
2181 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2182 win = elm_widget_data_get(obj);
2183 if (!win) return EINA_FALSE;
2184 return ecore_evas_sticky_get(win->ee);
2188 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2191 ELM_CHECK_WIDTYPE(obj, widtype);
2192 win = elm_widget_data_get(obj);
2194 if (mode == win->kbdmode) return;
2195 #ifdef HAVE_ELEMENTARY_X
2196 _elm_win_xwindow_get(win);
2198 win->kbdmode = mode;
2199 #ifdef HAVE_ELEMENTARY_X
2201 ecore_x_e_virtual_keyboard_state_set
2202 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2206 EAPI Elm_Win_Keyboard_Mode
2207 elm_win_keyboard_mode_get(const Evas_Object *obj)
2210 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2211 win = elm_widget_data_get(obj);
2212 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2213 return win->kbdmode;
2217 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2220 ELM_CHECK_WIDTYPE(obj, widtype);
2221 win = elm_widget_data_get(obj);
2223 #ifdef HAVE_ELEMENTARY_X
2224 _elm_win_xwindow_get(win);
2226 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2233 elm_win_keyboard_win_get(const Evas_Object *obj)
2236 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2237 win = elm_widget_data_get(obj);
2238 if (!win) return EINA_FALSE;
2239 #ifdef HAVE_ELEMENTARY_X
2240 _elm_win_xwindow_get(win);
2242 return ecore_x_e_virtual_keyboard_get(win->xwin);
2248 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2251 ELM_CHECK_WIDTYPE(obj, widtype);
2252 win = elm_widget_data_get(obj);
2254 if (x) *x = win->screen.x;
2255 if (y) *y = win->screen.y;
2259 elm_win_focus_get(const Evas_Object *obj)
2262 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2263 win = elm_widget_data_get(obj);
2264 if (!win) return EINA_FALSE;
2265 return ecore_evas_focus_get(win->ee);
2269 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2272 ELM_CHECK_WIDTYPE(obj, widtype);
2273 win = elm_widget_data_get(obj);
2275 win->constrain = !!constrain;
2279 elm_win_screen_constrain_get(Evas_Object *obj)
2282 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2283 win = elm_widget_data_get(obj);
2284 if (!win) return EINA_FALSE;
2285 return win->constrain;
2289 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2292 ELM_CHECK_WIDTYPE(obj, widtype);
2293 win = elm_widget_data_get(obj);
2295 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2299 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2302 ELM_CHECK_WIDTYPE(obj, widtype);
2303 win = elm_widget_data_get(obj);
2305 #ifdef HAVE_ELEMENTARY_X
2306 _elm_win_xwindow_get(win);
2308 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2315 elm_win_conformant_get(const Evas_Object *obj)
2318 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2319 win = elm_widget_data_get(obj);
2320 if (!win) return EINA_FALSE;
2321 #ifdef HAVE_ELEMENTARY_X
2322 _elm_win_xwindow_get(win);
2324 return ecore_x_e_illume_conformant_get(win->xwin);
2330 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2333 ELM_CHECK_WIDTYPE(obj, widtype);
2334 win = elm_widget_data_get(obj);
2336 #ifdef HAVE_ELEMENTARY_X
2337 _elm_win_xwindow_get(win);
2340 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2343 Ecore_X_Window_State states[2];
2345 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2346 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2347 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2348 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2357 elm_win_quickpanel_get(const Evas_Object *obj)
2360 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2361 win = elm_widget_data_get(obj);
2362 if (!win) return EINA_FALSE;
2363 #ifdef HAVE_ELEMENTARY_X
2364 _elm_win_xwindow_get(win);
2366 return ecore_x_e_illume_quickpanel_get(win->xwin);
2372 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2375 ELM_CHECK_WIDTYPE(obj, widtype);
2376 win = elm_widget_data_get(obj);
2378 #ifdef HAVE_ELEMENTARY_X
2379 _elm_win_xwindow_get(win);
2381 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2388 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2391 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2392 win = elm_widget_data_get(obj);
2393 if (!win) return -1;
2394 #ifdef HAVE_ELEMENTARY_X
2395 _elm_win_xwindow_get(win);
2397 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2403 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2406 ELM_CHECK_WIDTYPE(obj, widtype);
2407 win = elm_widget_data_get(obj);
2409 #ifdef HAVE_ELEMENTARY_X
2410 _elm_win_xwindow_get(win);
2412 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2419 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2422 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2423 win = elm_widget_data_get(obj);
2424 if (!win) return -1;
2425 #ifdef HAVE_ELEMENTARY_X
2426 _elm_win_xwindow_get(win);
2428 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2434 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2437 ELM_CHECK_WIDTYPE(obj, widtype);
2438 win = elm_widget_data_get(obj);
2440 #ifdef HAVE_ELEMENTARY_X
2441 _elm_win_xwindow_get(win);
2443 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2450 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2453 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2454 win = elm_widget_data_get(obj);
2456 #ifdef HAVE_ELEMENTARY_X
2457 _elm_win_xwindow_get(win);
2459 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2465 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2468 ELM_CHECK_WIDTYPE(obj, widtype);
2469 win = elm_widget_data_get(obj);
2471 #ifdef HAVE_ELEMENTARY_X
2472 _elm_win_xwindow_get(win);
2477 Ecore_X_Window_State states[2];
2479 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2480 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2481 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2482 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2491 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2494 ELM_CHECK_WIDTYPE(obj, widtype);
2495 win = elm_widget_data_get(obj);
2497 #ifdef HAVE_ELEMENTARY_X
2498 _elm_win_xwindow_get(win);
2503 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2504 ecore_x_e_illume_focus_back_send(win->xwin);
2506 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2507 ecore_x_e_illume_focus_forward_send(win->xwin);
2509 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2510 ecore_x_e_illume_focus_home_send(win->xwin);
2512 case ELM_ILLUME_COMMAND_CLOSE:
2513 ecore_x_e_illume_close_send(win->xwin);
2525 elm_win_inlined_image_object_get(Evas_Object *obj)
2528 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2529 win = elm_widget_data_get(obj);
2530 if (!win) return NULL;
2531 return win->img_obj;
2535 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2539 ELM_CHECK_WIDTYPE(obj, widtype);
2541 win = elm_widget_data_get(obj);
2542 enabled = !!enabled;
2543 if (win->focus_highlight.enabled == enabled)
2546 win->focus_highlight.enabled = enabled;
2548 if (win->focus_highlight.enabled)
2549 _elm_win_focus_highlight_init(win);
2551 _elm_win_focus_highlight_shutdown(win);
2555 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2559 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2561 win = elm_widget_data_get(obj);
2562 return win->focus_highlight.enabled;
2566 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2570 ELM_CHECK_WIDTYPE(obj, widtype);
2572 win = elm_widget_data_get(obj);
2573 eina_stringshare_replace(&win->focus_highlight.style, style);
2574 win->focus_highlight.changed_theme = EINA_TRUE;
2575 _elm_win_focus_highlight_reconfigure_job_start(win);
2579 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2583 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2585 win = elm_widget_data_get(obj);
2586 return win->focus_highlight.style;
2589 typedef struct _Widget_Data Widget_Data;
2594 Evas_Object *content;
2597 static void _del_hook(Evas_Object *obj);
2598 static void _theme_hook(Evas_Object *obj);
2599 static void _sizing_eval(Evas_Object *obj);
2600 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2601 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2603 static const char *widtype2 = NULL;
2606 _del_hook(Evas_Object *obj)
2608 Widget_Data *wd = elm_widget_data_get(obj);
2614 _theme_hook(Evas_Object *obj)
2616 Widget_Data *wd = elm_widget_data_get(obj);
2617 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2619 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2622 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2626 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2628 Widget_Data *wd = elm_widget_data_get(obj);
2633 /* Try Focus cycle in subitem */
2636 elm_widget_focus_next_get(wd->content, dir, next);
2641 *next = (Evas_Object *)obj;
2646 _sizing_eval(Evas_Object *obj)
2648 Widget_Data *wd = elm_widget_data_get(obj);
2649 Evas_Coord minw = -1, minh = -1;
2651 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2652 edje_object_size_min_calc(wd->frm, &minw, &minh);
2653 evas_object_size_hint_min_set(obj, minw, minh);
2654 evas_object_size_hint_max_set(obj, -1, -1);
2658 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2664 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2666 Widget_Data *wd = elm_widget_data_get(obj);
2667 Evas_Object *sub = event_info;
2668 if (sub == wd->content)
2670 evas_object_event_callback_del_full
2671 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2678 elm_win_inwin_add(Evas_Object *obj)
2684 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2685 win = elm_widget_data_get(obj);
2686 if (!win) return NULL;
2687 wd = ELM_NEW(Widget_Data);
2688 obj2 = elm_widget_add(win->evas);
2689 elm_widget_type_set(obj2, "inwin");
2690 ELM_SET_WIDTYPE(widtype2, "inwin");
2691 elm_widget_sub_object_add(obj, obj2);
2692 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2693 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2694 elm_win_resize_object_add(obj, obj2);
2696 elm_widget_data_set(obj2, wd);
2697 elm_widget_del_hook_set(obj2, _del_hook);
2698 elm_widget_theme_hook_set(obj2, _theme_hook);
2699 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2700 elm_widget_can_focus_set(obj2, EINA_TRUE);
2701 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2703 wd->frm = edje_object_add(win->evas);
2704 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2705 elm_widget_resize_object_set(obj2, wd->frm);
2707 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2714 elm_win_inwin_activate(Evas_Object *obj)
2716 ELM_CHECK_WIDTYPE(obj, widtype2);
2717 Widget_Data *wd = elm_widget_data_get(obj);
2719 evas_object_raise(obj);
2720 evas_object_show(obj);
2721 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2722 elm_object_focus_set(obj, EINA_TRUE);
2726 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2728 ELM_CHECK_WIDTYPE(obj, widtype2);
2729 Widget_Data *wd = elm_widget_data_get(obj);
2731 if (wd->content == content) return;
2732 if (wd->content) evas_object_del(wd->content);
2733 wd->content = content;
2736 elm_widget_sub_object_add(obj, content);
2737 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2738 _changed_size_hints, obj);
2739 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2745 elm_win_inwin_content_get(const Evas_Object *obj)
2747 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2748 Widget_Data *wd = elm_widget_data_get(obj);
2749 if (!wd) return NULL;
2754 elm_win_inwin_content_unset(Evas_Object *obj)
2756 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2757 Widget_Data *wd = elm_widget_data_get(obj);
2758 if (!wd) return NULL;
2759 if (!wd->content) return NULL;
2760 Evas_Object *content = wd->content;
2761 elm_widget_sub_object_del(obj, wd->content);
2762 evas_object_event_callback_del_full(wd->content,
2763 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2764 _changed_size_hints, obj);
2765 edje_object_part_unswallow(wd->frm, wd->content);
2770 /* windowing spcific calls - shall we do this differently? */
2772 static Ecore_X_Window
2773 _elm_ee_win_get(const Evas_Object *obj)
2776 #ifdef HAVE_ELEMENTARY_X
2777 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2778 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2784 elm_win_xwindow_get(const Evas_Object *obj)
2790 type = elm_widget_type_get(obj);
2791 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
2792 win = elm_widget_data_get(obj);
2794 #ifdef HAVE_ELEMENTARY_X
2795 if (win->xwin) return win->xwin;
2796 if (win->parent) return elm_win_xwindow_get(win->parent);