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;
30 int *autodel_clear, rot;
41 Eina_Bool visible : 1;
42 Eina_Bool handled : 1;
46 Ecore_Job *reconf_job;
48 Eina_Bool enabled : 1;
49 Eina_Bool changed_theme : 1;
50 Eina_Bool top_animate : 1;
51 Eina_Bool geometry_changed : 1;
55 static const char *widtype = NULL;
56 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
57 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
58 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
59 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
60 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
61 static void _elm_win_move(Ecore_Evas *ee);
62 static void _elm_win_resize(Ecore_Evas *ee);
63 static void _elm_win_delete_request(Ecore_Evas *ee);
64 static void _elm_win_resize_job(void *data);
65 #ifdef HAVE_ELEMENTARY_X
66 static void _elm_win_xwin_update(Elm_Win *win);
68 static void _elm_win_eval_subobjs(Evas_Object *obj);
69 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
70 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
71 static void _elm_win_focus_highlight_init(Elm_Win *win);
72 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
73 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
74 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
75 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
76 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
77 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
79 static void _elm_win_frame_callback_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
80 static void _elm_win_frame_callback_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
81 static void _elm_win_frame_callback_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
83 static const char SIG_DELETE_REQUEST[] = "delete,request";
84 static const char SIG_FOCUS_OUT[] = "focus,out";
85 static const char SIG_FOCUS_IN[] = "focus,in";
86 static const char SIG_MOVED[] = "moved";
87 static const char SIG_THEME_CHANGED[] = "theme,changed";
89 static const Evas_Smart_Cb_Description _signals[] = {
90 {SIG_DELETE_REQUEST, ""},
99 Eina_List *_elm_win_list = NULL;
100 int _elm_win_deferred_free = 0;
102 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
103 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
106 _shot_delay_get(Elm_Win *win)
109 char *d = strdup(win->shot.info);
112 for (p = (char *)win->shot.info; *p; p++)
114 if (!strncmp(p, "delay=", 6))
118 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
133 _shot_file_get(Elm_Win *win)
136 char *tmp = strdup(win->shot.info);
137 char *repname = NULL;
139 if (!tmp) return NULL;
141 for (p = (char *)win->shot.info; *p; p++)
143 if (!strncmp(p, "file=", 5))
146 if (!win->shot.repeat_count) return tmp;
149 char *dotptr = strrchr(tmp, '.');
152 size_t size = sizeof(char)*(strlen(tmp) + 16);
153 repname = malloc(size);
154 strncpy(repname, tmp, dotptr - tmp);
155 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
156 win->shot.shot_counter + 1);
157 strcat(repname, dotptr);
165 if (!win->shot.repeat_count) return strdup("out.png");
167 repname = malloc(sizeof(char) * 24);
168 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
173 _shot_repeat_count_get(Elm_Win *win)
177 char *d = strdup(win->shot.info);
180 for (p = (char *)win->shot.info; *p; p++)
182 if (!strncmp(p, "repeat=", 7))
186 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
193 if (v > 1000) v = 999;
203 _shot_key_get(Elm_Win *win __UNUSED__)
209 _shot_flags_get(Elm_Win *win __UNUSED__)
215 _shot_do(Elm_Win *win)
219 unsigned int *pixels;
221 char *file, *key, *flags;
223 ecore_evas_manual_render(win->ee);
224 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
226 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
227 if ((w < 1) || (h < 1)) return;
228 file = _shot_file_get(win);
230 key = _shot_key_get(win);
231 flags = _shot_flags_get(win);
232 ee = ecore_evas_buffer_new(1, 1);
233 o = evas_object_image_add(ecore_evas_get(ee));
234 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
235 evas_object_image_size_set(o, w, h);
236 evas_object_image_data_set(o, pixels);
237 if (!evas_object_image_save(o, file, key, flags))
239 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
244 if (flags) free(flags);
246 if (win->shot.repeat_count) win->shot.shot_counter++;
250 _shot_delay(void *data)
254 if (win->shot.repeat_count)
256 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
257 if (remainshot > 0) return EINA_TRUE;
259 win->shot.timer = NULL;
265 _shot_init(Elm_Win *win)
267 if (!win->shot.info) return;
268 win->shot.repeat_count = _shot_repeat_count_get(win);
269 win->shot.shot_counter = 0;
273 _shot_handle(Elm_Win *win)
275 if (!win->shot.info) return;
276 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
280 _elm_win_move(Ecore_Evas *ee)
282 Evas_Object *obj = ecore_evas_object_associate_get(ee);
287 win = elm_widget_data_get(obj);
289 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
292 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
296 _elm_win_resize(Ecore_Evas *ee)
298 Evas_Object *obj = ecore_evas_object_associate_get(ee);
302 win = elm_widget_data_get(obj);
304 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
305 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
309 _elm_win_focus_in(Ecore_Evas *ee)
311 Evas_Object *obj = ecore_evas_object_associate_get(ee);
315 win = elm_widget_data_get(obj);
317 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
318 if (win->show_count == 1)
320 elm_widget_focus_steal(win->win_obj);
324 elm_widget_focus_restore(win->win_obj);
325 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
326 win->focus_highlight.cur.visible = EINA_TRUE;
327 _elm_win_focus_highlight_reconfigure_job_start(win);
330 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
332 else if (win->img_obj)
339 _elm_win_focus_out(Ecore_Evas *ee)
341 Evas_Object *obj = ecore_evas_object_associate_get(ee);
345 win = elm_widget_data_get(obj);
347 elm_object_focus_set(win->win_obj, EINA_FALSE);
348 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
349 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
350 win->focus_highlight.cur.visible = EINA_FALSE;
351 _elm_win_focus_highlight_reconfigure_job_start(win);
354 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
356 else if (win->img_obj)
363 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
365 Elm_Win *wd = elm_widget_data_get(obj);
366 const Eina_List *items;
367 void *(*list_data_get) (const Eina_List *list);
375 if (!(items = elm_widget_focus_custom_chain_get(obj)))
381 list_data_get = eina_list_data_get;
383 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
389 *next = (Evas_Object *)obj;
394 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
396 Elm_Win *win = elm_widget_data_get(obj);
400 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
402 evas_object_focus_set(obj, elm_widget_focus_get(obj));
406 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
408 if (type == EVAS_CALLBACK_KEY_DOWN)
410 Evas_Event_Key_Down *ev = event_info;
411 if (!strcmp(ev->keyname, "Tab"))
413 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
414 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
416 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
417 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
420 else if ((!strcmp(ev->keyname, "Left")) ||
421 (!strcmp(ev->keyname, "KP_Left")))
423 //TODO : woohyun jung
425 else if ((!strcmp(ev->keyname, "Right")) ||
426 (!strcmp(ev->keyname, "KP_Right")))
428 //TODO : woohyun jung
430 else if ((!strcmp(ev->keyname, "Up")) ||
431 (!strcmp(ev->keyname, "KP_Up")))
433 //TODO : woohyun jung
435 else if ((!strcmp(ev->keyname, "Down")) ||
436 (!strcmp(ev->keyname, "KP_Down")))
438 //TODO : woohyun jung
446 _deferred_ecore_evas_free(void *data)
448 ecore_evas_free(data);
449 _elm_win_deferred_free--;
453 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
457 if (!win->show_count) win->show_count++;
458 if (win->shot.info) _shot_handle(win);
462 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
468 evas_object_hide(win->frame_obj);
470 else if (win->img_obj)
472 evas_object_hide(win->img_obj);
477 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
484 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
485 _elm_win_obj_callback_parent_del, win);
488 if (win->autodel_clear) *(win->autodel_clear) = -1;
489 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
490 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
493 ecore_evas_callback_delete_request_set(win->ee, NULL);
494 ecore_evas_callback_resize_set(win->ee, NULL);
496 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
497 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
498 if (win->shot.info) eina_stringshare_del(win->shot.info);
499 if (win->shot.timer) ecore_timer_del(win->shot.timer);
500 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
501 _elm_win_obj_callback_del, win);
502 while (((child = evas_object_bottom_get(win->evas))) &&
505 evas_object_del(child);
507 while (((child = evas_object_top_get(win->evas))) &&
510 evas_object_del(child);
512 #ifdef HAVE_ELEMENTARY_X
513 if (win->client_message_handler)
514 ecore_event_handler_del(win->client_message_handler);
516 // FIXME: Why are we flushing edje on every window destroy ??
517 // edje_file_cache_flush();
518 // edje_collection_cache_flush();
519 // evas_image_cache_flush(win->evas);
520 // evas_font_cache_flush(win->evas);
521 // FIXME: we are in the del handler for the object and delete the canvas
522 // that lives under it from the handler... nasty. deferring doesn't help either
532 ecore_job_add(_deferred_ecore_evas_free, win->ee);
533 _elm_win_deferred_free++;
537 _elm_win_focus_highlight_shutdown(win);
538 eina_stringshare_del(win->focus_highlight.style);
542 if ((!_elm_win_list) &&
543 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
545 edje_file_cache_flush();
546 edje_collection_cache_flush();
547 evas_image_cache_flush(e);
548 evas_font_cache_flush(e);
554 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
557 if (!win->img_obj) return;
558 evas_object_event_callback_del_full
559 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
560 evas_object_del(win->img_obj);
564 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
567 if (obj == win->parent) win->parent = NULL;
571 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
577 if ((x != win->screen.x) || (y != win->screen.y))
581 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
586 evas_object_move(obj, x, y);
591 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
594 // this is called to make sure all smart containers have calculated their
595 // sizes BEFORE we show the window to make sure it initially appears at
596 // our desired size (ie min size is known first)
597 evas_smart_objects_calculate(evas_object_evas_get(obj));
600 evas_object_show(win->frame_obj);
602 else if (win->img_obj)
604 evas_object_show(win->img_obj);
606 evas_object_show(obj);
610 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
614 if (ecore_evas_override_get(win->ee))
618 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
621 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
627 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
631 else if (win->img_obj)
635 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
638 // evas_object_move(win->img_obj, x, y);
643 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
650 else if (win->img_obj)
652 Evas_Coord w = 1, h = 1;
654 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
658 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
664 evas_object_image_size_set(win->img_obj, w, h);
669 _elm_win_delete_request(Ecore_Evas *ee)
671 Evas_Object *obj = ecore_evas_object_associate_get(ee);
673 if (strcmp(elm_widget_type_get(obj), "win")) return;
675 win = elm_widget_data_get(obj);
677 int autodel = win->autodel;
678 win->autodel_clear = &autodel;
679 evas_object_ref(win->win_obj);
680 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
681 // FIXME: if above callback deletes - then the below will be invalid
682 if (autodel) evas_object_del(win->win_obj);
683 else win->autodel_clear = NULL;
684 evas_object_unref(win->win_obj);
688 _elm_win_resize_job(void *data)
695 win->deferred_resize_job = NULL;
696 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
700 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
706 evas_object_resize(win->frame_obj, w, h);
708 else if (win->img_obj)
711 evas_object_resize(win->win_obj, w, h);
712 EINA_LIST_FOREACH(win->subobjs, l, obj)
714 evas_object_move(obj, 0, 0);
715 evas_object_resize(obj, w, h);
719 #ifdef HAVE_ELEMENTARY_X
721 _elm_win_xwindow_get(Elm_Win *win)
725 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
726 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
728 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
730 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
731 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
732 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
733 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
734 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
735 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
736 ENGINE_COMPARE(ELM_OPENGL_COCOA))
739 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
741 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
743 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
745 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
748 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
750 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
753 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
755 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
757 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
759 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
761 #undef ENGINE_COMPARE
765 #ifdef HAVE_ELEMENTARY_X
767 _elm_win_xwin_update(Elm_Win *win)
769 _elm_win_xwindow_get(win);
774 win2 = elm_widget_data_get(win->parent);
778 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
782 if (!win->xwin) return; /* nothing more to do */
787 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
789 case ELM_WIN_DIALOG_BASIC:
790 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
792 case ELM_WIN_DESKTOP:
793 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
796 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
798 case ELM_WIN_TOOLBAR:
799 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
802 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
804 case ELM_WIN_UTILITY:
805 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
808 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
810 case ELM_WIN_DROPDOWN_MENU:
811 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
813 case ELM_WIN_POPUP_MENU:
814 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
816 case ELM_WIN_TOOLTIP:
817 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
819 case ELM_WIN_NOTIFICATION:
820 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
823 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
826 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
831 ecore_x_e_virtual_keyboard_state_set
832 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
837 _elm_win_eval_subobjs(Evas_Object *obj)
840 const Evas_Object *child;
842 Elm_Win *win = elm_widget_data_get(obj);
843 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
847 EINA_LIST_FOREACH(win->subobjs, l, child)
849 evas_object_size_hint_weight_get(child, &wx, &wy);
850 if (wx == 0.0) xx = 0;
851 if (wy == 0.0) xy = 0;
853 evas_object_size_hint_min_get(child, &w, &h);
856 if (w > minw) minw = w;
857 if (h > minh) minh = h;
859 evas_object_size_hint_max_get(child, &w, &h);
862 if (maxw == -1) maxw = w;
863 else if ((w > 0) && (w < maxw)) maxw = w;
864 if (maxh == -1) maxh = h;
865 else if ((h > 0) && (h < maxh)) maxh = h;
867 if (!xx) maxw = minw;
869 if (!xy) maxh = minh;
871 evas_object_size_hint_min_set(obj, minw, minh);
872 evas_object_size_hint_max_set(obj, maxw, maxh);
873 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
874 if (w < minw) w = minw;
875 if (h < minh) h = minh;
876 if ((maxw >= 0) && (w > maxw)) w = maxw;
877 if ((maxh >= 0) && (h > maxh)) h = maxh;
878 evas_object_resize(obj, w, h);
882 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
884 Elm_Win *win = elm_widget_data_get(data);
885 win->subobjs = eina_list_remove(win->subobjs, obj);
886 _elm_win_eval_subobjs(win->win_obj);
890 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
892 _elm_win_eval_subobjs(data);
896 _elm_win_shutdown(void)
898 while (_elm_win_list)
899 evas_object_del(_elm_win_list->data);
903 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
910 EINA_LIST_FOREACH(_elm_win_list, l, obj)
911 elm_widget_theme(obj);
915 EINA_LIST_FOREACH(_elm_win_list, l, obj)
916 elm_widget_theme_specific(obj, th, EINA_FALSE);
921 _elm_win_translate(void)
926 EINA_LIST_FOREACH(_elm_win_list, l, obj)
927 elm_widget_translate(obj);
930 #ifdef HAVE_ELEMENTARY_X
932 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
935 Ecore_X_Event_Client_Message *e = event;
937 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
938 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
940 if ((unsigned)e->data.l[0] == win->xwin)
942 Evas *evas = evas_object_evas_get(win->win_obj);
945 edje_file_cache_flush();
946 edje_collection_cache_flush();
947 evas_image_cache_flush(evas);
948 evas_font_cache_flush(evas);
952 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
954 if ((unsigned)e->data.l[0] == win->xwin)
956 Evas *evas = evas_object_evas_get(win->win_obj);
959 edje_file_cache_flush();
960 edje_collection_cache_flush();
961 evas_image_cache_flush(evas);
962 evas_font_cache_flush(evas);
963 evas_render_dump(evas);
967 return ECORE_CALLBACK_PASS_ON;
972 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
976 win->focus_highlight.geometry_changed = EINA_TRUE;
977 _elm_win_focus_highlight_reconfigure_job_start(win);
981 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
985 win->focus_highlight.geometry_changed = EINA_TRUE;
986 _elm_win_focus_highlight_reconfigure_job_start(win);
990 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
994 win->focus_highlight.cur.target = NULL;
996 _elm_win_focus_highlight_reconfigure_job_start(win);
1000 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1002 Evas_Object *obj = win->focus_highlight.cur.target;
1004 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1005 _elm_win_focus_target_move, win);
1006 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1007 _elm_win_focus_target_resize, win);
1008 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1009 _elm_win_focus_target_del, win);
1013 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1015 Evas_Object *obj = win->focus_highlight.cur.target;
1017 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1018 _elm_win_focus_target_move, win);
1019 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1020 _elm_win_focus_target_resize, win);
1021 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1022 _elm_win_focus_target_del, win);
1025 static Evas_Object *
1026 _elm_win_focus_target_get(Evas_Object *obj)
1028 Evas_Object *o = obj;
1032 if (elm_widget_is(o))
1034 if (!elm_widget_highlight_ignore_get(o))
1036 o = elm_widget_parent_get(o);
1038 o = evas_object_smart_parent_get(o);
1042 o = elm_widget_parent_widget_get(o);
1044 o = evas_object_smart_parent_get(o);
1053 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1055 Evas_Object *obj = event_info, *target;
1056 Elm_Win *win = data;
1058 if (win->focus_highlight.cur.target == obj)
1061 target = _elm_win_focus_target_get(obj);
1062 win->focus_highlight.cur.target = target;
1063 if (elm_widget_highlight_in_theme_get(target))
1064 win->focus_highlight.cur.handled = EINA_TRUE;
1066 _elm_win_focus_target_callbacks_add(win);
1068 _elm_win_focus_highlight_reconfigure_job_start(win);
1072 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1074 Elm_Win *win = data;
1076 if (!win->focus_highlight.cur.target)
1079 if (!win->focus_highlight.cur.handled)
1080 _elm_win_focus_target_callbacks_del(win);
1081 win->focus_highlight.cur.target = NULL;
1082 win->focus_highlight.cur.handled = EINA_FALSE;
1084 _elm_win_focus_highlight_reconfigure_job_start(win);
1088 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1090 evas_object_hide(obj);
1094 _elm_win_focus_highlight_init(Elm_Win *win)
1096 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1097 _elm_win_object_focus_in, win);
1098 evas_event_callback_add(win->evas,
1099 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1100 _elm_win_object_focus_out, win);
1102 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1104 win->focus_highlight.top = edje_object_add(win->evas);
1105 win->focus_highlight.changed_theme = EINA_TRUE;
1106 edje_object_signal_callback_add(win->focus_highlight.top,
1107 "elm,action,focus,hide,end", "",
1108 _elm_win_focus_highlight_hide, NULL);
1109 edje_object_signal_callback_add(win->focus_highlight.top,
1110 "elm,action,focus,anim,end", "",
1111 _elm_win_focus_highlight_anim_end, win);
1112 _elm_win_focus_highlight_reconfigure_job_start(win);
1116 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1118 _elm_win_focus_highlight_reconfigure_job_stop(win);
1119 if (win->focus_highlight.cur.target)
1121 _elm_win_focus_target_callbacks_del(win);
1122 win->focus_highlight.cur.target = NULL;
1124 if (win->focus_highlight.top)
1126 evas_object_del(win->focus_highlight.top);
1127 win->focus_highlight.top = NULL;
1130 evas_event_callback_del_full(win->evas,
1131 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1132 _elm_win_object_focus_in, win);
1133 evas_event_callback_del_full(win->evas,
1134 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1135 _elm_win_object_focus_out, win);
1139 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1143 top = win->focus_highlight.top;
1148 evas_object_show(top);
1149 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1155 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1160 _elm_win_focus_highlight_reconfigure_job(void *data)
1162 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1166 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1168 if (win->focus_highlight.reconf_job)
1169 ecore_job_del(win->focus_highlight.reconf_job);
1170 win->focus_highlight.reconf_job = ecore_job_add(
1171 _elm_win_focus_highlight_reconfigure_job, win);
1175 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1177 if (win->focus_highlight.reconf_job)
1178 ecore_job_del(win->focus_highlight.reconf_job);
1179 win->focus_highlight.reconf_job = NULL;
1183 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1185 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1186 Evas_Coord x, y, w, h;
1188 clip = evas_object_clip_get(target);
1189 evas_object_geometry_get(target, &x, &y, &w, &h);
1191 evas_object_move(obj, x, y);
1192 evas_object_resize(obj, w, h);
1193 evas_object_clip_set(obj, clip);
1197 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1199 Evas_Coord tx, ty, tw, th;
1200 Evas_Coord w, h, px, py, pw, ph;
1201 Edje_Message_Int_Set *m;
1202 Evas_Object *previous = win->focus_highlight.prev.target;
1203 Evas_Object *target = win->focus_highlight.cur.target;
1205 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1206 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1207 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1208 evas_object_move(obj, 0, 0);
1209 evas_object_resize(obj, tw, th);
1210 evas_object_clip_unset(obj);
1212 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1222 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1226 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1228 Elm_Win *win = data;
1229 _elm_win_focus_highlight_simple_setup(win, obj);
1233 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1235 Evas_Object *target = win->focus_highlight.cur.target;
1236 Evas_Object *previous = win->focus_highlight.prev.target;
1237 Evas_Object *top = win->focus_highlight.top;
1238 Eina_Bool visible_changed;
1239 Eina_Bool common_visible;
1240 const char *sig = NULL;
1242 _elm_win_focus_highlight_reconfigure_job_stop(win);
1244 visible_changed = (win->focus_highlight.cur.visible !=
1245 win->focus_highlight.prev.visible);
1247 if ((target == previous) && (!visible_changed) &&
1248 (!win->focus_highlight.geometry_changed))
1251 if ((previous) && (win->focus_highlight.prev.handled))
1252 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1255 common_visible = EINA_FALSE;
1256 else if (win->focus_highlight.cur.handled)
1258 common_visible = EINA_FALSE;
1259 if (win->focus_highlight.cur.visible)
1260 sig = "elm,action,focus_highlight,show";
1262 sig = "elm,action,focus_highlight,hide";
1265 common_visible = win->focus_highlight.cur.visible;
1267 _elm_win_focus_highlight_visible_set(win, common_visible);
1269 elm_widget_signal_emit(target, sig, "elm");
1271 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1274 if (win->focus_highlight.changed_theme)
1277 if (win->focus_highlight.style)
1278 str = win->focus_highlight.style;
1281 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1283 win->focus_highlight.changed_theme = EINA_FALSE;
1285 if (_elm_config->focus_highlight_animate)
1287 str = edje_object_data_get(win->focus_highlight.top, "animate");
1288 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1292 if ((win->focus_highlight.top_animate) && (previous) &&
1293 (!win->focus_highlight.prev.handled))
1294 _elm_win_focus_highlight_anim_setup(win, top);
1296 _elm_win_focus_highlight_simple_setup(win, top);
1297 evas_object_raise(top);
1300 win->focus_highlight.geometry_changed = EINA_FALSE;
1301 win->focus_highlight.prev = win->focus_highlight.cur;
1305 _elm_win_frame_callback_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1308 Evas_Event_Mouse_Down *ev;
1310 if (!(win = data)) return;
1312 if (ev->button == 1)
1314 win->moving = EINA_TRUE;
1315 /* FIXME: Change Mouse Pointer */
1320 _elm_win_frame_callback_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1323 Evas_Event_Mouse_Move *ev;
1325 if (!(win = data)) return;
1329 /* NB: 0, 0 are bogus values and not used */
1330 ecore_evas_move(win->ee, 0, 0);
1335 _elm_win_frame_callback_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1338 Evas_Event_Mouse_Up *ev;
1340 if (!(win = data)) return;
1342 if (ev->button == 1)
1344 win->moving = EINA_FALSE;
1345 /* FIXME: Change Mouse Pointer */
1351 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1353 Evas_Event_Key_Down *ev = event_info;
1355 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1358 if ((strcmp(ev->keyname, "F12")) ||
1359 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1362 printf("Tree graph generated.\n");
1363 elm_object_tree_dot_dump(obj, "./dump.dot");
1368 _win_img_hide(void *data,
1370 Evas_Object *obj __UNUSED__,
1371 void *event_info __UNUSED__)
1373 Elm_Win *win = data;
1375 elm_widget_focus_hide_handle(win->win_obj);
1379 _win_img_mouse_up(void *data,
1381 Evas_Object *obj __UNUSED__,
1384 Elm_Win *win = data;
1385 Evas_Event_Mouse_Up *ev = event_info;
1386 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1387 elm_widget_focus_mouse_up_handle(win->win_obj);
1391 _win_img_focus_in(void *data,
1393 Evas_Object *obj __UNUSED__,
1394 void *event_info __UNUSED__)
1396 Elm_Win *win = data;
1397 elm_widget_focus_steal(win->win_obj);
1401 _win_img_focus_out(void *data,
1403 Evas_Object *obj __UNUSED__,
1404 void *event_info __UNUSED__)
1406 Elm_Win *win = data;
1407 elm_widget_focused_object_clear(win->win_obj);
1411 _win_inlined_image_set(Elm_Win *win)
1413 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1414 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1415 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1416 _elm_win_obj_callback_img_obj_del, win);
1418 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1419 _win_img_hide, win);
1420 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1421 _win_img_mouse_up, win);
1422 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1423 _win_img_focus_in, win);
1424 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1425 _win_img_focus_out, win);
1429 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1431 evas_object_event_callback_del_full(subobj,
1432 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1433 _elm_win_subobj_callback_changed_size_hints,
1435 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1436 _elm_win_subobj_callback_del, obj);
1437 win->subobjs = eina_list_remove(win->subobjs, subobj);
1438 _elm_win_eval_subobjs(obj);
1442 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1446 const char *fontpath;
1448 win = ELM_NEW(Elm_Win);
1450 #define FALLBACK_TRY(engine) \
1453 CRITICAL(engine " engine creation failed. Trying default."); \
1454 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1456 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1458 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1462 case ELM_WIN_INLINED_IMAGE:
1465 Evas *e = evas_object_evas_get(parent);
1468 ee = ecore_evas_ecore_evas_get(e);
1470 win->img_obj = ecore_evas_object_image_new(ee);
1471 if (!win->img_obj) break;
1472 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1475 _win_inlined_image_set(win);
1478 evas_object_del(win->img_obj);
1479 win->img_obj = NULL;
1483 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1485 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1486 #ifdef HAVE_ELEMENTARY_X
1487 win->client_message_handler = ecore_event_handler_add
1488 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1490 FALLBACK_TRY("Sofware X11");
1492 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1494 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1495 FALLBACK_TRY("Sofware FB");
1497 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1499 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1500 FALLBACK_TRY("Sofware DirectFB");
1502 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1504 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1505 FALLBACK_TRY("Sofware-16");
1506 #ifdef HAVE_ELEMENTARY_X
1507 win->client_message_handler = ecore_event_handler_add
1508 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1511 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1513 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1514 FALLBACK_TRY("Sofware-8");
1515 #ifdef HAVE_ELEMENTARY_X
1516 win->client_message_handler = ecore_event_handler_add
1517 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1521 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1523 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1524 FALLBACK_TRY("XRender");
1525 #ifdef HAVE_ELEMENTARY_X
1526 win->client_message_handler = ecore_event_handler_add
1527 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1531 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1536 if (_elm_config->vsync)
1538 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1544 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1546 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1547 FALLBACK_TRY("OpenGL");
1548 #ifdef HAVE_ELEMENTARY_X
1549 win->client_message_handler = ecore_event_handler_add
1550 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1553 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1555 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1556 FALLBACK_TRY("Sofware Win32");
1558 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1560 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1561 FALLBACK_TRY("Sofware-16-WinCE");
1563 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1565 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1566 FALLBACK_TRY("PSL1GHT");
1568 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1570 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1571 FALLBACK_TRY("Sofware SDL");
1573 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1575 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1576 FALLBACK_TRY("Sofware-16-SDL");
1578 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1580 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1581 FALLBACK_TRY("OpenGL SDL");
1583 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1585 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1586 FALLBACK_TRY("OpenGL Cocoa");
1588 else if (ENGINE_COMPARE(ELM_BUFFER))
1590 win->ee = ecore_evas_buffer_new(1, 1);
1592 else if (ENGINE_COMPARE(ELM_EWS))
1594 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1596 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1598 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 1, 1, 0);
1599 win->evas = ecore_evas_get(win->ee);
1600 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1602 win->frame_obj = edje_object_add(win->evas);
1603 _elm_theme_set(NULL, win->frame_obj, "border", "base", "default");
1604 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1605 evas_object_move(win->frame_obj, 0, 0);
1606 evas_object_resize(win->frame_obj, 1, 1);
1608 evas_object_event_callback_add(win->frame_obj,
1609 EVAS_CALLBACK_MOUSE_DOWN,
1610 _elm_win_frame_callback_mouse_down,
1612 evas_object_event_callback_add(win->frame_obj,
1613 EVAS_CALLBACK_MOUSE_MOVE,
1614 _elm_win_frame_callback_mouse_move,
1616 evas_object_event_callback_add(win->frame_obj,
1617 EVAS_CALLBACK_MOUSE_UP,
1618 _elm_win_frame_callback_mouse_up,
1621 else if (!strncmp(_elm_config->engine, "shot:", 5))
1623 win->ee = ecore_evas_buffer_new(1, 1);
1624 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1625 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1634 ERR("Cannot create window.");
1638 #ifdef HAVE_ELEMENTARY_X
1639 _elm_win_xwindow_get(win);
1641 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1642 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1643 // bg pixmap done by x - has other issues like can be redrawn by x before it
1644 // is filled/ready by app
1645 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1648 win->parent = parent;
1650 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1651 _elm_win_obj_callback_parent_del, win);
1653 win->evas = ecore_evas_get(win->ee);
1654 win->win_obj = elm_widget_add(win->evas);
1655 elm_widget_type_set(win->win_obj, "win");
1656 ELM_SET_WIDTYPE(widtype, "win");
1657 elm_widget_data_set(win->win_obj, win);
1658 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1659 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1660 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1661 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1662 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1663 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1664 evas_object_move(win->win_obj, 0, 0);
1665 evas_object_resize(win->win_obj, 1, 1);
1666 evas_object_layer_set(win->win_obj, 50);
1667 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1671 // evas_object_clip_set(win->win_obj, win->frame_obj);
1672 evas_object_stack_below(win->frame_obj, win->win_obj);
1675 if (type == ELM_WIN_INLINED_IMAGE)
1676 elm_widget_parent2_set(win->win_obj, parent);
1677 ecore_evas_object_associate(win->ee, win->win_obj,
1678 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1679 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1680 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1681 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1682 _elm_win_obj_callback_show, win);
1683 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1684 _elm_win_obj_callback_hide, win);
1685 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1686 _elm_win_obj_callback_del, win);
1687 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1688 _elm_win_obj_callback_move, win);
1689 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1690 _elm_win_obj_callback_resize, win);
1692 evas_object_intercept_move_callback_add(win->win_obj,
1693 _elm_win_obj_intercept_move, win);
1694 evas_object_intercept_show_callback_add(win->win_obj,
1695 _elm_win_obj_intercept_show, win);
1697 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
1698 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1699 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1700 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1701 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1702 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1703 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1704 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1705 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1706 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1707 evas_font_path_append(win->evas, fontpath);
1708 if (!_elm_config->font_hinting)
1709 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1710 else if (_elm_config->font_hinting == 1)
1711 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1712 else if (_elm_config->font_hinting == 2)
1713 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1715 #ifdef HAVE_ELEMENTARY_X
1716 _elm_win_xwin_update(win);
1719 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1721 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1723 ecore_evas_fullscreen_set(win->ee, 1);
1725 #undef ENGINE_COMPARE
1727 if (_elm_config->focus_highlight_enable)
1728 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1731 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1732 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1733 _debug_key_down, win);
1735 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1737 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1740 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1742 return win->win_obj;
1746 elm_win_util_standard_add(const char *name, const char *title)
1748 Evas_Object *win, *bg;
1750 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1751 if (!win) return NULL;
1752 elm_win_title_set(win, title);
1753 bg = elm_bg_add(win);
1756 evas_object_del(win);
1759 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1760 elm_win_resize_object_add(win, bg);
1761 evas_object_show(bg);
1766 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1770 ELM_CHECK_WIDTYPE(obj, widtype);
1771 win = elm_widget_data_get(obj);
1773 if (eina_list_data_find(win->subobjs, subobj)) return;
1774 win->subobjs = eina_list_append(win->subobjs, subobj);
1775 elm_widget_sub_object_add(obj, subobj);
1776 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1777 _elm_win_subobj_callback_del, obj);
1778 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1779 _elm_win_subobj_callback_changed_size_hints,
1781 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1782 evas_object_move(subobj, 0, 0);
1783 evas_object_resize(subobj, w, h);
1784 _elm_win_eval_subobjs(obj);
1788 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1791 ELM_CHECK_WIDTYPE(obj, widtype);
1792 win = elm_widget_data_get(obj);
1794 evas_object_event_callback_del_full(subobj,
1795 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1796 _elm_win_subobj_callback_changed_size_hints,
1798 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1799 _elm_win_subobj_callback_del, obj);
1800 win->subobjs = eina_list_remove(win->subobjs, subobj);
1801 elm_widget_sub_object_del(obj, subobj);
1802 _elm_win_eval_subobjs(obj);
1806 elm_win_title_set(Evas_Object *obj, const char *title)
1809 ELM_CHECK_WIDTYPE(obj, widtype);
1810 win = elm_widget_data_get(obj);
1812 ecore_evas_title_set(win->ee, title);
1814 edje_object_part_text_set(win->frame_obj, "elm.text.title", title);
1818 elm_win_title_get(const Evas_Object *obj)
1821 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1822 win = elm_widget_data_get(obj);
1823 if (!win) return NULL;
1824 return ecore_evas_title_get(win->ee);
1828 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1831 ELM_CHECK_WIDTYPE(obj, widtype);
1832 win = elm_widget_data_get(obj);
1834 win->autodel = autodel;
1838 elm_win_autodel_get(const Evas_Object *obj)
1841 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1842 win = elm_widget_data_get(obj);
1843 if (!win) return EINA_FALSE;
1844 return win->autodel;
1848 elm_win_activate(Evas_Object *obj)
1851 ELM_CHECK_WIDTYPE(obj, widtype);
1852 win = elm_widget_data_get(obj);
1854 ecore_evas_activate(win->ee);
1858 elm_win_lower(Evas_Object *obj)
1861 ELM_CHECK_WIDTYPE(obj, widtype);
1862 win = elm_widget_data_get(obj);
1864 ecore_evas_lower(win->ee);
1868 elm_win_raise(Evas_Object *obj)
1871 ELM_CHECK_WIDTYPE(obj, widtype);
1872 win = elm_widget_data_get(obj);
1874 ecore_evas_raise(win->ee);
1878 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
1881 int win_w, win_h, screen_w, screen_h, nx, ny;
1882 ELM_CHECK_WIDTYPE(obj, widtype);
1883 win = elm_widget_data_get(obj);
1885 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
1886 if ((!screen_w) || (!screen_h)) return;
1887 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
1888 if ((!win_w) || (!win_h)) return;
1889 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
1890 else nx = win->screen.x;
1891 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
1892 else ny = win->screen.y;
1895 evas_object_move(obj, nx, ny);
1899 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1902 ELM_CHECK_WIDTYPE(obj, widtype);
1903 win = elm_widget_data_get(obj);
1905 ecore_evas_borderless_set(win->ee, borderless);
1906 #ifdef HAVE_ELEMENTARY_X
1907 _elm_win_xwin_update(win);
1912 elm_win_borderless_get(const Evas_Object *obj)
1915 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1916 win = elm_widget_data_get(obj);
1917 if (!win) return EINA_FALSE;
1918 return ecore_evas_borderless_get(win->ee);
1922 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1925 ELM_CHECK_WIDTYPE(obj, widtype);
1926 win = elm_widget_data_get(obj);
1928 ecore_evas_shaped_set(win->ee, shaped);
1929 #ifdef HAVE_ELEMENTARY_X
1930 _elm_win_xwin_update(win);
1935 elm_win_shaped_get(const Evas_Object *obj)
1938 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1939 win = elm_widget_data_get(obj);
1940 if (!win) return EINA_FALSE;
1941 return ecore_evas_shaped_get(win->ee);
1945 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1948 ELM_CHECK_WIDTYPE(obj, widtype);
1949 win = elm_widget_data_get(obj);
1954 else if (win->img_obj)
1956 evas_object_image_alpha_set(win->img_obj, alpha);
1957 ecore_evas_alpha_set(win->ee, alpha);
1961 #ifdef HAVE_ELEMENTARY_X
1966 if (!_elm_config->compositing)
1967 elm_win_shaped_set(obj, alpha);
1969 ecore_evas_alpha_set(win->ee, alpha);
1972 ecore_evas_alpha_set(win->ee, alpha);
1973 _elm_win_xwin_update(win);
1977 ecore_evas_alpha_set(win->ee, alpha);
1982 elm_win_alpha_get(const Evas_Object *obj)
1985 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1986 win = elm_widget_data_get(obj);
1987 if (!win) return EINA_FALSE;
1991 else if (win->img_obj)
1993 return evas_object_image_alpha_get(win->img_obj);
1995 return ecore_evas_alpha_get(win->ee);
1999 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
2002 ELM_CHECK_WIDTYPE(obj, widtype);
2003 win = elm_widget_data_get(obj);
2009 else if (win->img_obj)
2011 evas_object_image_alpha_set(win->img_obj, transparent);
2015 #ifdef HAVE_ELEMENTARY_X
2018 ecore_evas_transparent_set(win->ee, transparent);
2019 _elm_win_xwin_update(win);
2023 ecore_evas_transparent_set(win->ee, transparent);
2028 elm_win_transparent_get(const Evas_Object *obj)
2031 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2032 win = elm_widget_data_get(obj);
2033 if (!win) return EINA_FALSE;
2035 return ecore_evas_transparent_get(win->ee);
2039 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2042 ELM_CHECK_WIDTYPE(obj, widtype);
2043 win = elm_widget_data_get(obj);
2045 ecore_evas_override_set(win->ee, override);
2046 #ifdef HAVE_ELEMENTARY_X
2047 _elm_win_xwin_update(win);
2052 elm_win_override_get(const Evas_Object *obj)
2055 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2056 win = elm_widget_data_get(obj);
2057 if (!win) return EINA_FALSE;
2058 return ecore_evas_override_get(win->ee);
2062 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2065 ELM_CHECK_WIDTYPE(obj, widtype);
2066 win = elm_widget_data_get(obj);
2069 // YYY: handle if win->img_obj
2070 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2071 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2072 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2074 // these engines... can ONLY be fullscreen
2079 ecore_evas_fullscreen_set(win->ee, fullscreen);
2080 #ifdef HAVE_ELEMENTARY_X
2081 _elm_win_xwin_update(win);
2084 #undef ENGINE_COMPARE
2088 elm_win_fullscreen_get(const Evas_Object *obj)
2091 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2092 win = elm_widget_data_get(obj);
2093 if (!win) return EINA_FALSE;
2095 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2096 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2097 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2099 // these engines... can ONLY be fullscreen
2104 return ecore_evas_fullscreen_get(win->ee);
2106 #undef ENGINE_COMPARE
2110 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2113 ELM_CHECK_WIDTYPE(obj, widtype);
2114 win = elm_widget_data_get(obj);
2116 // YYY: handle if win->img_obj
2117 ecore_evas_maximized_set(win->ee, maximized);
2118 #ifdef HAVE_ELEMENTARY_X
2119 _elm_win_xwin_update(win);
2124 elm_win_maximized_get(const Evas_Object *obj)
2127 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2128 win = elm_widget_data_get(obj);
2129 if (!win) return EINA_FALSE;
2130 return ecore_evas_maximized_get(win->ee);
2134 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2137 ELM_CHECK_WIDTYPE(obj, widtype);
2138 win = elm_widget_data_get(obj);
2140 ecore_evas_iconified_set(win->ee, iconified);
2141 #ifdef HAVE_ELEMENTARY_X
2142 _elm_win_xwin_update(win);
2147 elm_win_iconified_get(const Evas_Object *obj)
2150 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2151 win = elm_widget_data_get(obj);
2152 if (!win) return EINA_FALSE;
2153 return ecore_evas_iconified_get(win->ee);
2157 elm_win_layer_set(Evas_Object *obj, int layer)
2160 ELM_CHECK_WIDTYPE(obj, widtype);
2161 win = elm_widget_data_get(obj);
2163 ecore_evas_layer_set(win->ee, layer);
2164 #ifdef HAVE_ELEMENTARY_X
2165 _elm_win_xwin_update(win);
2170 elm_win_layer_get(const Evas_Object *obj)
2173 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2174 win = elm_widget_data_get(obj);
2175 if (!win) return -1;
2176 return ecore_evas_layer_get(win->ee);
2180 elm_win_rotation_set(Evas_Object *obj, int rotation)
2183 ELM_CHECK_WIDTYPE(obj, widtype);
2184 win = elm_widget_data_get(obj);
2186 if (win->rot == rotation) return;
2187 win->rot = rotation;
2188 ecore_evas_rotation_set(win->ee, rotation);
2189 evas_object_size_hint_min_set(obj, -1, -1);
2190 evas_object_size_hint_max_set(obj, -1, -1);
2191 _elm_win_eval_subobjs(obj);
2192 #ifdef HAVE_ELEMENTARY_X
2193 _elm_win_xwin_update(win);
2198 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2201 ELM_CHECK_WIDTYPE(obj, widtype);
2202 win = elm_widget_data_get(obj);
2204 if (win->rot == rotation) return;
2205 win->rot = rotation;
2206 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2207 evas_object_size_hint_min_set(obj, -1, -1);
2208 evas_object_size_hint_max_set(obj, -1, -1);
2209 _elm_win_eval_subobjs(obj);
2210 #ifdef HAVE_ELEMENTARY_X
2211 _elm_win_xwin_update(win);
2216 elm_win_rotation_get(const Evas_Object *obj)
2219 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2220 win = elm_widget_data_get(obj);
2221 if (!win) return -1;
2226 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2229 ELM_CHECK_WIDTYPE(obj, widtype);
2230 win = elm_widget_data_get(obj);
2232 ecore_evas_sticky_set(win->ee, sticky);
2233 #ifdef HAVE_ELEMENTARY_X
2234 _elm_win_xwin_update(win);
2239 elm_win_sticky_get(const Evas_Object *obj)
2242 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2243 win = elm_widget_data_get(obj);
2244 if (!win) return EINA_FALSE;
2245 return ecore_evas_sticky_get(win->ee);
2249 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2252 ELM_CHECK_WIDTYPE(obj, widtype);
2253 win = elm_widget_data_get(obj);
2255 if (mode == win->kbdmode) return;
2256 #ifdef HAVE_ELEMENTARY_X
2257 _elm_win_xwindow_get(win);
2259 win->kbdmode = mode;
2260 #ifdef HAVE_ELEMENTARY_X
2262 ecore_x_e_virtual_keyboard_state_set
2263 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2267 EAPI Elm_Win_Keyboard_Mode
2268 elm_win_keyboard_mode_get(const Evas_Object *obj)
2271 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2272 win = elm_widget_data_get(obj);
2273 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2274 return win->kbdmode;
2278 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2281 ELM_CHECK_WIDTYPE(obj, widtype);
2282 win = elm_widget_data_get(obj);
2284 #ifdef HAVE_ELEMENTARY_X
2285 _elm_win_xwindow_get(win);
2287 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2294 elm_win_keyboard_win_get(const Evas_Object *obj)
2297 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2298 win = elm_widget_data_get(obj);
2299 if (!win) return EINA_FALSE;
2300 #ifdef HAVE_ELEMENTARY_X
2301 _elm_win_xwindow_get(win);
2303 return ecore_x_e_virtual_keyboard_get(win->xwin);
2309 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2312 ELM_CHECK_WIDTYPE(obj, widtype);
2313 win = elm_widget_data_get(obj);
2315 if (x) *x = win->screen.x;
2316 if (y) *y = win->screen.y;
2320 elm_win_focus_get(const Evas_Object *obj)
2323 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2324 win = elm_widget_data_get(obj);
2325 if (!win) return EINA_FALSE;
2326 return ecore_evas_focus_get(win->ee);
2330 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2333 ELM_CHECK_WIDTYPE(obj, widtype);
2334 win = elm_widget_data_get(obj);
2336 win->constrain = !!constrain;
2340 elm_win_screen_constrain_get(Evas_Object *obj)
2343 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2344 win = elm_widget_data_get(obj);
2345 if (!win) return EINA_FALSE;
2346 return win->constrain;
2350 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2353 ELM_CHECK_WIDTYPE(obj, widtype);
2354 win = elm_widget_data_get(obj);
2356 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2360 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2363 ELM_CHECK_WIDTYPE(obj, widtype);
2364 win = elm_widget_data_get(obj);
2366 #ifdef HAVE_ELEMENTARY_X
2367 _elm_win_xwindow_get(win);
2369 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2376 elm_win_conformant_get(const Evas_Object *obj)
2379 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2380 win = elm_widget_data_get(obj);
2381 if (!win) return EINA_FALSE;
2382 #ifdef HAVE_ELEMENTARY_X
2383 _elm_win_xwindow_get(win);
2385 return ecore_x_e_illume_conformant_get(win->xwin);
2391 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2394 ELM_CHECK_WIDTYPE(obj, widtype);
2395 win = elm_widget_data_get(obj);
2397 #ifdef HAVE_ELEMENTARY_X
2398 _elm_win_xwindow_get(win);
2401 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2404 Ecore_X_Window_State states[2];
2406 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2407 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2408 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2409 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2418 elm_win_quickpanel_get(const Evas_Object *obj)
2421 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2422 win = elm_widget_data_get(obj);
2423 if (!win) return EINA_FALSE;
2424 #ifdef HAVE_ELEMENTARY_X
2425 _elm_win_xwindow_get(win);
2427 return ecore_x_e_illume_quickpanel_get(win->xwin);
2433 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
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_priority_major_set(win->xwin, priority);
2449 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2452 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2453 win = elm_widget_data_get(obj);
2454 if (!win) return -1;
2455 #ifdef HAVE_ELEMENTARY_X
2456 _elm_win_xwindow_get(win);
2458 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2464 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2467 ELM_CHECK_WIDTYPE(obj, widtype);
2468 win = elm_widget_data_get(obj);
2470 #ifdef HAVE_ELEMENTARY_X
2471 _elm_win_xwindow_get(win);
2473 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2480 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2483 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2484 win = elm_widget_data_get(obj);
2485 if (!win) return -1;
2486 #ifdef HAVE_ELEMENTARY_X
2487 _elm_win_xwindow_get(win);
2489 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2495 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2498 ELM_CHECK_WIDTYPE(obj, widtype);
2499 win = elm_widget_data_get(obj);
2501 #ifdef HAVE_ELEMENTARY_X
2502 _elm_win_xwindow_get(win);
2504 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2511 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2514 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2515 win = elm_widget_data_get(obj);
2517 #ifdef HAVE_ELEMENTARY_X
2518 _elm_win_xwindow_get(win);
2520 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2526 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2529 ELM_CHECK_WIDTYPE(obj, widtype);
2530 win = elm_widget_data_get(obj);
2532 #ifdef HAVE_ELEMENTARY_X
2533 _elm_win_xwindow_get(win);
2538 Ecore_X_Window_State states[2];
2540 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2541 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2542 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2543 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2552 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2555 ELM_CHECK_WIDTYPE(obj, widtype);
2556 win = elm_widget_data_get(obj);
2558 #ifdef HAVE_ELEMENTARY_X
2559 _elm_win_xwindow_get(win);
2564 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2565 ecore_x_e_illume_focus_back_send(win->xwin);
2567 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2568 ecore_x_e_illume_focus_forward_send(win->xwin);
2570 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2571 ecore_x_e_illume_focus_home_send(win->xwin);
2573 case ELM_ILLUME_COMMAND_CLOSE:
2574 ecore_x_e_illume_close_send(win->xwin);
2586 elm_win_inlined_image_object_get(Evas_Object *obj)
2589 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2590 win = elm_widget_data_get(obj);
2591 if (!win) return NULL;
2592 return win->img_obj;
2596 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2600 ELM_CHECK_WIDTYPE(obj, widtype);
2602 win = elm_widget_data_get(obj);
2603 enabled = !!enabled;
2604 if (win->focus_highlight.enabled == enabled)
2607 win->focus_highlight.enabled = enabled;
2609 if (win->focus_highlight.enabled)
2610 _elm_win_focus_highlight_init(win);
2612 _elm_win_focus_highlight_shutdown(win);
2616 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2620 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2622 win = elm_widget_data_get(obj);
2623 return win->focus_highlight.enabled;
2627 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2631 ELM_CHECK_WIDTYPE(obj, widtype);
2633 win = elm_widget_data_get(obj);
2634 eina_stringshare_replace(&win->focus_highlight.style, style);
2635 win->focus_highlight.changed_theme = EINA_TRUE;
2636 _elm_win_focus_highlight_reconfigure_job_start(win);
2640 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2644 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2646 win = elm_widget_data_get(obj);
2647 return win->focus_highlight.style;
2650 typedef struct _Widget_Data Widget_Data;
2655 Evas_Object *content;
2658 static void _del_hook(Evas_Object *obj);
2659 static void _theme_hook(Evas_Object *obj);
2660 static void _sizing_eval(Evas_Object *obj);
2661 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2662 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2664 static const char *widtype2 = NULL;
2667 _del_hook(Evas_Object *obj)
2669 Widget_Data *wd = elm_widget_data_get(obj);
2675 _theme_hook(Evas_Object *obj)
2677 Widget_Data *wd = elm_widget_data_get(obj);
2678 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2680 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2683 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2687 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2689 Widget_Data *wd = elm_widget_data_get(obj);
2694 /* Try Focus cycle in subitem */
2697 elm_widget_focus_next_get(wd->content, dir, next);
2702 *next = (Evas_Object *)obj;
2707 _sizing_eval(Evas_Object *obj)
2709 Widget_Data *wd = elm_widget_data_get(obj);
2710 Evas_Coord minw = -1, minh = -1;
2712 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2713 edje_object_size_min_calc(wd->frm, &minw, &minh);
2714 evas_object_size_hint_min_set(obj, minw, minh);
2715 evas_object_size_hint_max_set(obj, -1, -1);
2719 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2725 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2727 Widget_Data *wd = elm_widget_data_get(obj);
2728 Evas_Object *sub = event_info;
2729 if (sub == wd->content)
2731 evas_object_event_callback_del_full
2732 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2739 elm_win_inwin_add(Evas_Object *obj)
2745 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2746 win = elm_widget_data_get(obj);
2747 if (!win) return NULL;
2748 wd = ELM_NEW(Widget_Data);
2749 obj2 = elm_widget_add(win->evas);
2750 elm_widget_type_set(obj2, "inwin");
2751 ELM_SET_WIDTYPE(widtype2, "inwin");
2752 elm_widget_sub_object_add(obj, obj2);
2753 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2754 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2755 elm_win_resize_object_add(obj, obj2);
2757 elm_widget_data_set(obj2, wd);
2758 elm_widget_del_hook_set(obj2, _del_hook);
2759 elm_widget_theme_hook_set(obj2, _theme_hook);
2760 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2761 elm_widget_can_focus_set(obj2, EINA_TRUE);
2762 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2764 wd->frm = edje_object_add(win->evas);
2765 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2766 elm_widget_resize_object_set(obj2, wd->frm);
2768 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2775 elm_win_inwin_activate(Evas_Object *obj)
2777 ELM_CHECK_WIDTYPE(obj, widtype2);
2778 Widget_Data *wd = elm_widget_data_get(obj);
2780 evas_object_raise(obj);
2781 evas_object_show(obj);
2782 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2783 elm_object_focus_set(obj, EINA_TRUE);
2787 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2789 ELM_CHECK_WIDTYPE(obj, widtype2);
2790 Widget_Data *wd = elm_widget_data_get(obj);
2792 if (wd->content == content) return;
2793 if (wd->content) evas_object_del(wd->content);
2794 wd->content = content;
2797 elm_widget_sub_object_add(obj, content);
2798 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2799 _changed_size_hints, obj);
2800 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2806 elm_win_inwin_content_get(const Evas_Object *obj)
2808 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2809 Widget_Data *wd = elm_widget_data_get(obj);
2810 if (!wd) return NULL;
2815 elm_win_inwin_content_unset(Evas_Object *obj)
2817 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2818 Widget_Data *wd = elm_widget_data_get(obj);
2819 if (!wd) return NULL;
2820 if (!wd->content) return NULL;
2821 Evas_Object *content = wd->content;
2822 elm_widget_sub_object_del(obj, wd->content);
2823 evas_object_event_callback_del_full(wd->content,
2824 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2825 _changed_size_hints, obj);
2826 edje_object_part_unswallow(wd->frm, wd->content);
2831 /* windowing spcific calls - shall we do this differently? */
2833 static Ecore_X_Window
2834 _elm_ee_win_get(const Evas_Object *obj)
2837 #ifdef HAVE_ELEMENTARY_X
2838 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2839 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2845 elm_win_xwindow_get(const Evas_Object *obj)
2851 type = elm_widget_type_get(obj);
2852 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
2853 win = elm_widget_data_get(obj);
2855 #ifdef HAVE_ELEMENTARY_X
2856 if (win->xwin) return win->xwin;
2857 if (win->parent) return elm_win_xwindow_get(win->parent);