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_add(Elm_Win *win, const char *style);
80 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
81 static void _elm_win_frame_cb_move_stop(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
82 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
83 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
84 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
85 static void _elm_win_frame_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info);
87 static const char SIG_DELETE_REQUEST[] = "delete,request";
88 static const char SIG_FOCUS_OUT[] = "focus,out";
89 static const char SIG_FOCUS_IN[] = "focus,in";
90 static const char SIG_MOVED[] = "moved";
91 static const char SIG_THEME_CHANGED[] = "theme,changed";
93 static const Evas_Smart_Cb_Description _signals[] = {
94 {SIG_DELETE_REQUEST, ""},
103 Eina_List *_elm_win_list = NULL;
104 int _elm_win_deferred_free = 0;
106 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
107 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
110 _shot_delay_get(Elm_Win *win)
113 char *d = strdup(win->shot.info);
116 for (p = (char *)win->shot.info; *p; p++)
118 if (!strncmp(p, "delay=", 6))
122 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
137 _shot_file_get(Elm_Win *win)
140 char *tmp = strdup(win->shot.info);
141 char *repname = NULL;
143 if (!tmp) return NULL;
145 for (p = (char *)win->shot.info; *p; p++)
147 if (!strncmp(p, "file=", 5))
150 if (!win->shot.repeat_count) return tmp;
153 char *dotptr = strrchr(tmp, '.');
156 size_t size = sizeof(char)*(strlen(tmp) + 16);
157 repname = malloc(size);
158 strncpy(repname, tmp, dotptr - tmp);
159 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
160 win->shot.shot_counter + 1);
161 strcat(repname, dotptr);
169 if (!win->shot.repeat_count) return strdup("out.png");
171 repname = malloc(sizeof(char) * 24);
172 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
177 _shot_repeat_count_get(Elm_Win *win)
180 char *d = strdup(win->shot.info);
183 for (p = (char *)win->shot.info; *p; p++)
185 if (!strncmp(p, "repeat=", 7))
189 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
196 if (v > 1000) v = 999;
206 _shot_key_get(Elm_Win *win __UNUSED__)
212 _shot_flags_get(Elm_Win *win __UNUSED__)
218 _shot_do(Elm_Win *win)
222 unsigned int *pixels;
224 char *file, *key, *flags;
226 ecore_evas_manual_render(win->ee);
227 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
229 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
230 if ((w < 1) || (h < 1)) return;
231 file = _shot_file_get(win);
233 key = _shot_key_get(win);
234 flags = _shot_flags_get(win);
235 ee = ecore_evas_buffer_new(1, 1);
236 o = evas_object_image_add(ecore_evas_get(ee));
237 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
238 evas_object_image_size_set(o, w, h);
239 evas_object_image_data_set(o, pixels);
240 if (!evas_object_image_save(o, file, key, flags))
242 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
247 if (flags) free(flags);
249 if (win->shot.repeat_count) win->shot.shot_counter++;
253 _shot_delay(void *data)
257 if (win->shot.repeat_count)
259 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
260 if (remainshot > 0) return EINA_TRUE;
262 win->shot.timer = NULL;
268 _shot_init(Elm_Win *win)
270 if (!win->shot.info) return;
271 win->shot.repeat_count = _shot_repeat_count_get(win);
272 win->shot.shot_counter = 0;
276 _shot_handle(Elm_Win *win)
278 if (!win->shot.info) return;
279 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
283 _elm_win_move(Ecore_Evas *ee)
285 Evas_Object *obj = ecore_evas_object_associate_get(ee);
290 win = elm_widget_data_get(obj);
292 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
295 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
299 _elm_win_resize(Ecore_Evas *ee)
301 Evas_Object *obj = ecore_evas_object_associate_get(ee);
305 win = elm_widget_data_get(obj);
307 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
308 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
312 _elm_win_focus_in(Ecore_Evas *ee)
314 Evas_Object *obj = ecore_evas_object_associate_get(ee);
318 win = elm_widget_data_get(obj);
320 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
321 if (win->show_count == 1)
323 elm_widget_focus_steal(win->win_obj);
327 elm_widget_focus_restore(win->win_obj);
328 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
329 win->focus_highlight.cur.visible = EINA_TRUE;
330 _elm_win_focus_highlight_reconfigure_job_start(win);
333 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
335 else if (win->img_obj)
342 _elm_win_focus_out(Ecore_Evas *ee)
344 Evas_Object *obj = ecore_evas_object_associate_get(ee);
348 win = elm_widget_data_get(obj);
350 elm_object_focus_set(win->win_obj, EINA_FALSE);
351 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
352 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
353 win->focus_highlight.cur.visible = EINA_FALSE;
354 _elm_win_focus_highlight_reconfigure_job_start(win);
357 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
359 else if (win->img_obj)
366 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
368 Elm_Win *wd = elm_widget_data_get(obj);
369 const Eina_List *items;
370 void *(*list_data_get) (const Eina_List *list);
378 if (!(items = elm_widget_focus_custom_chain_get(obj)))
384 list_data_get = eina_list_data_get;
386 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
392 *next = (Evas_Object *)obj;
397 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
399 Elm_Win *win = elm_widget_data_get(obj);
403 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
405 evas_object_focus_set(obj, elm_widget_focus_get(obj));
409 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
411 if (type == EVAS_CALLBACK_KEY_DOWN)
413 Evas_Event_Key_Down *ev = event_info;
414 if (!strcmp(ev->keyname, "Tab"))
416 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
417 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
419 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
420 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
423 else if ((!strcmp(ev->keyname, "Left")) ||
424 (!strcmp(ev->keyname, "KP_Left")))
426 //TODO : woohyun jung
428 else if ((!strcmp(ev->keyname, "Right")) ||
429 (!strcmp(ev->keyname, "KP_Right")))
431 //TODO : woohyun jung
433 else if ((!strcmp(ev->keyname, "Up")) ||
434 (!strcmp(ev->keyname, "KP_Up")))
436 //TODO : woohyun jung
438 else if ((!strcmp(ev->keyname, "Down")) ||
439 (!strcmp(ev->keyname, "KP_Down")))
441 //TODO : woohyun jung
449 _deferred_ecore_evas_free(void *data)
451 ecore_evas_free(data);
452 _elm_win_deferred_free--;
456 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
460 if (!win->show_count) win->show_count++;
461 if (win->shot.info) _shot_handle(win);
465 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
471 evas_object_hide(win->frame_obj);
473 else if (win->img_obj)
475 evas_object_hide(win->img_obj);
480 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
487 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
488 _elm_win_obj_callback_parent_del, win);
491 if (win->autodel_clear) *(win->autodel_clear) = -1;
492 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
493 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
496 ecore_evas_callback_delete_request_set(win->ee, NULL);
497 ecore_evas_callback_resize_set(win->ee, NULL);
499 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
500 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
501 if (win->shot.info) eina_stringshare_del(win->shot.info);
502 if (win->shot.timer) ecore_timer_del(win->shot.timer);
503 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
504 _elm_win_obj_callback_del, win);
505 while (((child = evas_object_bottom_get(win->evas))) &&
508 evas_object_del(child);
510 while (((child = evas_object_top_get(win->evas))) &&
513 evas_object_del(child);
515 #ifdef HAVE_ELEMENTARY_X
516 if (win->client_message_handler)
517 ecore_event_handler_del(win->client_message_handler);
519 // FIXME: Why are we flushing edje on every window destroy ??
520 // edje_file_cache_flush();
521 // edje_collection_cache_flush();
522 // evas_image_cache_flush(win->evas);
523 // evas_font_cache_flush(win->evas);
524 // FIXME: we are in the del handler for the object and delete the canvas
525 // that lives under it from the handler... nasty. deferring doesn't help either
535 ecore_job_add(_deferred_ecore_evas_free, win->ee);
536 _elm_win_deferred_free++;
540 _elm_win_focus_highlight_shutdown(win);
541 eina_stringshare_del(win->focus_highlight.style);
545 if ((!_elm_win_list) &&
546 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
548 edje_file_cache_flush();
549 edje_collection_cache_flush();
550 evas_image_cache_flush(e);
551 evas_font_cache_flush(e);
557 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
560 if (!win->img_obj) return;
561 evas_object_event_callback_del_full
562 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
563 evas_object_del(win->img_obj);
567 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
570 if (obj == win->parent) win->parent = NULL;
574 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
580 if ((x != win->screen.x) || (y != win->screen.y))
584 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
589 evas_object_move(obj, x, y);
594 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
597 // this is called to make sure all smart containers have calculated their
598 // sizes BEFORE we show the window to make sure it initially appears at
599 // our desired size (ie min size is known first)
600 evas_smart_objects_calculate(evas_object_evas_get(obj));
603 evas_object_show(win->frame_obj);
605 else if (win->img_obj)
607 evas_object_show(win->img_obj);
609 evas_object_show(obj);
613 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
617 if (ecore_evas_override_get(win->ee))
621 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
624 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
630 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
634 else if (win->img_obj)
638 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
641 // evas_object_move(win->img_obj, x, y);
646 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
653 else if (win->img_obj)
655 Evas_Coord w = 1, h = 1;
657 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
661 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
667 evas_object_image_size_set(win->img_obj, w, h);
672 _elm_win_delete_request(Ecore_Evas *ee)
674 Evas_Object *obj = ecore_evas_object_associate_get(ee);
676 if (strcmp(elm_widget_type_get(obj), "win")) return;
678 win = elm_widget_data_get(obj);
680 int autodel = win->autodel;
681 win->autodel_clear = &autodel;
682 evas_object_ref(win->win_obj);
683 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
684 // FIXME: if above callback deletes - then the below will be invalid
685 if (autodel) evas_object_del(win->win_obj);
686 else win->autodel_clear = NULL;
687 evas_object_unref(win->win_obj);
691 _elm_win_resize_job(void *data)
698 win->deferred_resize_job = NULL;
699 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
703 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
709 evas_object_resize(win->frame_obj, w, h);
711 else if (win->img_obj)
714 evas_object_resize(win->win_obj, w, h);
715 EINA_LIST_FOREACH(win->subobjs, l, obj)
717 evas_object_move(obj, 0, 0);
718 evas_object_resize(obj, w, h);
722 #ifdef HAVE_ELEMENTARY_X
724 _elm_win_xwindow_get(Elm_Win *win)
728 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
729 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
731 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
733 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
734 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
735 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
736 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
737 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
738 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
739 ENGINE_COMPARE(ELM_OPENGL_COCOA))
742 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
744 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
746 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
748 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
751 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
753 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
756 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
758 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
760 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
762 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
764 #undef ENGINE_COMPARE
768 #ifdef HAVE_ELEMENTARY_X
770 _elm_win_xwin_update(Elm_Win *win)
772 _elm_win_xwindow_get(win);
777 win2 = elm_widget_data_get(win->parent);
781 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
785 if (!win->xwin) return; /* nothing more to do */
790 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
792 case ELM_WIN_DIALOG_BASIC:
793 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
795 case ELM_WIN_DESKTOP:
796 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
799 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
801 case ELM_WIN_TOOLBAR:
802 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
805 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
807 case ELM_WIN_UTILITY:
808 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
811 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
813 case ELM_WIN_DROPDOWN_MENU:
814 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
816 case ELM_WIN_POPUP_MENU:
817 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
819 case ELM_WIN_TOOLTIP:
820 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
822 case ELM_WIN_NOTIFICATION:
823 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
826 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
829 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
834 ecore_x_e_virtual_keyboard_state_set
835 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
840 _elm_win_eval_subobjs(Evas_Object *obj)
843 const Evas_Object *child;
845 Elm_Win *win = elm_widget_data_get(obj);
846 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
850 EINA_LIST_FOREACH(win->subobjs, l, child)
852 evas_object_size_hint_weight_get(child, &wx, &wy);
853 if (wx == 0.0) xx = 0;
854 if (wy == 0.0) xy = 0;
856 evas_object_size_hint_min_get(child, &w, &h);
859 if (w > minw) minw = w;
860 if (h > minh) minh = h;
862 evas_object_size_hint_max_get(child, &w, &h);
865 if (maxw == -1) maxw = w;
866 else if ((w > 0) && (w < maxw)) maxw = w;
867 if (maxh == -1) maxh = h;
868 else if ((h > 0) && (h < maxh)) maxh = h;
870 if (!xx) maxw = minw;
872 if (!xy) maxh = minh;
874 evas_object_size_hint_min_set(obj, minw, minh);
875 evas_object_size_hint_max_set(obj, maxw, maxh);
876 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
877 if (w < minw) w = minw;
878 if (h < minh) h = minh;
879 if ((maxw >= 0) && (w > maxw)) w = maxw;
880 if ((maxh >= 0) && (h > maxh)) h = maxh;
881 evas_object_resize(obj, w, h);
885 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
887 Elm_Win *win = elm_widget_data_get(data);
888 win->subobjs = eina_list_remove(win->subobjs, obj);
889 _elm_win_eval_subobjs(win->win_obj);
893 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
895 _elm_win_eval_subobjs(data);
899 _elm_win_shutdown(void)
901 while (_elm_win_list)
902 evas_object_del(_elm_win_list->data);
906 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
913 EINA_LIST_FOREACH(_elm_win_list, l, obj)
914 elm_widget_theme(obj);
918 EINA_LIST_FOREACH(_elm_win_list, l, obj)
919 elm_widget_theme_specific(obj, th, EINA_FALSE);
924 _elm_win_translate(void)
929 EINA_LIST_FOREACH(_elm_win_list, l, obj)
930 elm_widget_translate(obj);
933 #ifdef HAVE_ELEMENTARY_X
935 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
938 Ecore_X_Event_Client_Message *e = event;
940 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
941 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
943 if ((unsigned)e->data.l[0] == win->xwin)
945 Evas *evas = evas_object_evas_get(win->win_obj);
948 edje_file_cache_flush();
949 edje_collection_cache_flush();
950 evas_image_cache_flush(evas);
951 evas_font_cache_flush(evas);
955 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
957 if ((unsigned)e->data.l[0] == win->xwin)
959 Evas *evas = evas_object_evas_get(win->win_obj);
962 edje_file_cache_flush();
963 edje_collection_cache_flush();
964 evas_image_cache_flush(evas);
965 evas_font_cache_flush(evas);
966 evas_render_dump(evas);
970 return ECORE_CALLBACK_PASS_ON;
975 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
979 win->focus_highlight.geometry_changed = EINA_TRUE;
980 _elm_win_focus_highlight_reconfigure_job_start(win);
984 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
988 win->focus_highlight.geometry_changed = EINA_TRUE;
989 _elm_win_focus_highlight_reconfigure_job_start(win);
993 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
997 win->focus_highlight.cur.target = NULL;
999 _elm_win_focus_highlight_reconfigure_job_start(win);
1003 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1005 Evas_Object *obj = win->focus_highlight.cur.target;
1007 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1008 _elm_win_focus_target_move, win);
1009 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1010 _elm_win_focus_target_resize, win);
1011 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1012 _elm_win_focus_target_del, win);
1016 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1018 Evas_Object *obj = win->focus_highlight.cur.target;
1020 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1021 _elm_win_focus_target_move, win);
1022 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1023 _elm_win_focus_target_resize, win);
1024 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1025 _elm_win_focus_target_del, win);
1028 static Evas_Object *
1029 _elm_win_focus_target_get(Evas_Object *obj)
1031 Evas_Object *o = obj;
1035 if (elm_widget_is(o))
1037 if (!elm_widget_highlight_ignore_get(o))
1039 o = elm_widget_parent_get(o);
1041 o = evas_object_smart_parent_get(o);
1045 o = elm_widget_parent_widget_get(o);
1047 o = evas_object_smart_parent_get(o);
1056 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1058 Evas_Object *obj = event_info, *target;
1059 Elm_Win *win = data;
1061 if (win->focus_highlight.cur.target == obj)
1064 target = _elm_win_focus_target_get(obj);
1065 win->focus_highlight.cur.target = target;
1066 if (elm_widget_highlight_in_theme_get(target))
1067 win->focus_highlight.cur.handled = EINA_TRUE;
1069 _elm_win_focus_target_callbacks_add(win);
1071 _elm_win_focus_highlight_reconfigure_job_start(win);
1075 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1077 Elm_Win *win = data;
1079 if (!win->focus_highlight.cur.target)
1082 if (!win->focus_highlight.cur.handled)
1083 _elm_win_focus_target_callbacks_del(win);
1084 win->focus_highlight.cur.target = NULL;
1085 win->focus_highlight.cur.handled = EINA_FALSE;
1087 _elm_win_focus_highlight_reconfigure_job_start(win);
1091 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1093 evas_object_hide(obj);
1097 _elm_win_focus_highlight_init(Elm_Win *win)
1099 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1100 _elm_win_object_focus_in, win);
1101 evas_event_callback_add(win->evas,
1102 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1103 _elm_win_object_focus_out, win);
1105 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1107 win->focus_highlight.top = edje_object_add(win->evas);
1108 win->focus_highlight.changed_theme = EINA_TRUE;
1109 edje_object_signal_callback_add(win->focus_highlight.top,
1110 "elm,action,focus,hide,end", "",
1111 _elm_win_focus_highlight_hide, NULL);
1112 edje_object_signal_callback_add(win->focus_highlight.top,
1113 "elm,action,focus,anim,end", "",
1114 _elm_win_focus_highlight_anim_end, win);
1115 _elm_win_focus_highlight_reconfigure_job_start(win);
1119 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1121 _elm_win_focus_highlight_reconfigure_job_stop(win);
1122 if (win->focus_highlight.cur.target)
1124 _elm_win_focus_target_callbacks_del(win);
1125 win->focus_highlight.cur.target = NULL;
1127 if (win->focus_highlight.top)
1129 evas_object_del(win->focus_highlight.top);
1130 win->focus_highlight.top = NULL;
1133 evas_event_callback_del_full(win->evas,
1134 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1135 _elm_win_object_focus_in, win);
1136 evas_event_callback_del_full(win->evas,
1137 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1138 _elm_win_object_focus_out, win);
1142 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1146 top = win->focus_highlight.top;
1151 evas_object_show(top);
1152 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1158 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1163 _elm_win_focus_highlight_reconfigure_job(void *data)
1165 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1169 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1171 if (win->focus_highlight.reconf_job)
1172 ecore_job_del(win->focus_highlight.reconf_job);
1173 win->focus_highlight.reconf_job = ecore_job_add(
1174 _elm_win_focus_highlight_reconfigure_job, win);
1178 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1180 if (win->focus_highlight.reconf_job)
1181 ecore_job_del(win->focus_highlight.reconf_job);
1182 win->focus_highlight.reconf_job = NULL;
1186 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1188 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1189 Evas_Coord x, y, w, h;
1191 clip = evas_object_clip_get(target);
1192 evas_object_geometry_get(target, &x, &y, &w, &h);
1194 evas_object_move(obj, x, y);
1195 evas_object_resize(obj, w, h);
1196 evas_object_clip_set(obj, clip);
1200 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1202 Evas_Coord tx, ty, tw, th;
1203 Evas_Coord w, h, px, py, pw, ph;
1204 Edje_Message_Int_Set *m;
1205 Evas_Object *previous = win->focus_highlight.prev.target;
1206 Evas_Object *target = win->focus_highlight.cur.target;
1208 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1209 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1210 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1211 evas_object_move(obj, 0, 0);
1212 evas_object_resize(obj, tw, th);
1213 evas_object_clip_unset(obj);
1215 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1225 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1229 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1231 Elm_Win *win = data;
1232 _elm_win_focus_highlight_simple_setup(win, obj);
1236 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1238 Evas_Object *target = win->focus_highlight.cur.target;
1239 Evas_Object *previous = win->focus_highlight.prev.target;
1240 Evas_Object *top = win->focus_highlight.top;
1241 Eina_Bool visible_changed;
1242 Eina_Bool common_visible;
1243 const char *sig = NULL;
1245 _elm_win_focus_highlight_reconfigure_job_stop(win);
1247 visible_changed = (win->focus_highlight.cur.visible !=
1248 win->focus_highlight.prev.visible);
1250 if ((target == previous) && (!visible_changed) &&
1251 (!win->focus_highlight.geometry_changed))
1254 if ((previous) && (win->focus_highlight.prev.handled))
1255 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1258 common_visible = EINA_FALSE;
1259 else if (win->focus_highlight.cur.handled)
1261 common_visible = EINA_FALSE;
1262 if (win->focus_highlight.cur.visible)
1263 sig = "elm,action,focus_highlight,show";
1265 sig = "elm,action,focus_highlight,hide";
1268 common_visible = win->focus_highlight.cur.visible;
1270 _elm_win_focus_highlight_visible_set(win, common_visible);
1272 elm_widget_signal_emit(target, sig, "elm");
1274 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1277 if (win->focus_highlight.changed_theme)
1280 if (win->focus_highlight.style)
1281 str = win->focus_highlight.style;
1284 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1286 win->focus_highlight.changed_theme = EINA_FALSE;
1288 if (_elm_config->focus_highlight_animate)
1290 str = edje_object_data_get(win->focus_highlight.top, "animate");
1291 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1295 if ((win->focus_highlight.top_animate) && (previous) &&
1296 (!win->focus_highlight.prev.handled))
1297 _elm_win_focus_highlight_anim_setup(win, top);
1299 _elm_win_focus_highlight_simple_setup(win, top);
1300 evas_object_raise(top);
1303 win->focus_highlight.geometry_changed = EINA_FALSE;
1304 win->focus_highlight.prev = win->focus_highlight.cur;
1308 _elm_win_frame_add(Elm_Win *win, const char *style)
1310 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1312 win->frame_obj = edje_object_add(win->evas);
1313 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1314 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1315 evas_object_move(win->frame_obj, 0, 0);
1316 evas_object_resize(win->frame_obj, 1, 1);
1318 evas_object_event_callback_add(win->frame_obj, EVAS_CALLBACK_MOUSE_MOVE,
1319 _elm_win_frame_cb_mouse_move, win);
1321 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1322 "elm", _elm_win_frame_cb_move_start, win);
1323 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,stop",
1324 "elm", _elm_win_frame_cb_move_stop, win);
1325 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1326 "elm", _elm_win_frame_cb_minimize, win);
1327 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1328 "elm", _elm_win_frame_cb_maximize, win);
1329 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1330 "elm", _elm_win_frame_cb_close, win);
1334 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1338 if (!(win = data)) return;
1339 win->moving = EINA_TRUE;
1343 _elm_win_frame_cb_move_stop(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1347 if (!(win = data)) return;
1348 win->moving = EINA_FALSE;
1352 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1356 if (!(win = data)) return;
1357 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1361 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1365 if (!(win = data)) return;
1366 ecore_evas_maximized_set(win->ee, EINA_TRUE);
1370 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1374 if (!(win = data)) return;
1375 evas_object_del(win->win_obj);
1379 _elm_win_frame_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
1382 Evas_Event_Mouse_Move *ev;
1384 if (!(win = data)) return;
1388 /* NB: 0, 0 are bogus values and not used in wayland */
1389 ecore_evas_move(win->ee, 0, 0);
1395 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1397 Evas_Event_Key_Down *ev = event_info;
1399 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1402 if ((strcmp(ev->keyname, "F12")) ||
1403 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1406 printf("Tree graph generated.\n");
1407 elm_object_tree_dot_dump(obj, "./dump.dot");
1412 _win_img_hide(void *data,
1414 Evas_Object *obj __UNUSED__,
1415 void *event_info __UNUSED__)
1417 Elm_Win *win = data;
1419 elm_widget_focus_hide_handle(win->win_obj);
1423 _win_img_mouse_up(void *data,
1425 Evas_Object *obj __UNUSED__,
1428 Elm_Win *win = data;
1429 Evas_Event_Mouse_Up *ev = event_info;
1430 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1431 elm_widget_focus_mouse_up_handle(win->win_obj);
1435 _win_img_focus_in(void *data,
1437 Evas_Object *obj __UNUSED__,
1438 void *event_info __UNUSED__)
1440 Elm_Win *win = data;
1441 elm_widget_focus_steal(win->win_obj);
1445 _win_img_focus_out(void *data,
1447 Evas_Object *obj __UNUSED__,
1448 void *event_info __UNUSED__)
1450 Elm_Win *win = data;
1451 elm_widget_focused_object_clear(win->win_obj);
1455 _win_inlined_image_set(Elm_Win *win)
1457 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1458 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1459 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1460 _elm_win_obj_callback_img_obj_del, win);
1462 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1463 _win_img_hide, win);
1464 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1465 _win_img_mouse_up, win);
1466 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1467 _win_img_focus_in, win);
1468 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1469 _win_img_focus_out, win);
1473 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1475 evas_object_event_callback_del_full(subobj,
1476 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1477 _elm_win_subobj_callback_changed_size_hints,
1479 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1480 _elm_win_subobj_callback_del, obj);
1481 win->subobjs = eina_list_remove(win->subobjs, subobj);
1482 _elm_win_eval_subobjs(obj);
1486 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1490 const char *fontpath;
1492 win = ELM_NEW(Elm_Win);
1494 #define FALLBACK_TRY(engine) \
1497 CRITICAL(engine " engine creation failed. Trying default."); \
1498 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1500 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1502 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1506 case ELM_WIN_INLINED_IMAGE:
1509 Evas *e = evas_object_evas_get(parent);
1512 ee = ecore_evas_ecore_evas_get(e);
1514 win->img_obj = ecore_evas_object_image_new(ee);
1515 if (!win->img_obj) break;
1516 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1519 _win_inlined_image_set(win);
1522 evas_object_del(win->img_obj);
1523 win->img_obj = NULL;
1527 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1529 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1530 #ifdef HAVE_ELEMENTARY_X
1531 win->client_message_handler = ecore_event_handler_add
1532 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1534 FALLBACK_TRY("Sofware X11");
1536 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1538 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1539 FALLBACK_TRY("Sofware FB");
1541 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1543 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1544 FALLBACK_TRY("Sofware DirectFB");
1546 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1548 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1549 FALLBACK_TRY("Sofware-16");
1550 #ifdef HAVE_ELEMENTARY_X
1551 win->client_message_handler = ecore_event_handler_add
1552 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1555 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1557 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1558 FALLBACK_TRY("Sofware-8");
1559 #ifdef HAVE_ELEMENTARY_X
1560 win->client_message_handler = ecore_event_handler_add
1561 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1565 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1567 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1568 FALLBACK_TRY("XRender");
1569 #ifdef HAVE_ELEMENTARY_X
1570 win->client_message_handler = ecore_event_handler_add
1571 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1575 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1580 if (_elm_config->vsync)
1582 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1588 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1590 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1591 FALLBACK_TRY("OpenGL");
1592 #ifdef HAVE_ELEMENTARY_X
1593 win->client_message_handler = ecore_event_handler_add
1594 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1597 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1599 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1600 FALLBACK_TRY("Sofware Win32");
1602 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1604 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1605 FALLBACK_TRY("Sofware-16-WinCE");
1607 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1609 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1610 FALLBACK_TRY("PSL1GHT");
1612 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1614 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1615 FALLBACK_TRY("Sofware SDL");
1617 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1619 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1620 FALLBACK_TRY("Sofware-16-SDL");
1622 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1624 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1625 FALLBACK_TRY("OpenGL SDL");
1627 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1629 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1630 FALLBACK_TRY("OpenGL Cocoa");
1632 else if (ENGINE_COMPARE(ELM_BUFFER))
1634 win->ee = ecore_evas_buffer_new(1, 1);
1636 else if (ENGINE_COMPARE(ELM_EWS))
1638 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1640 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1642 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 1, 1, 0);
1643 win->evas = ecore_evas_get(win->ee);
1645 _elm_win_frame_add(win, "default");
1647 else if (!strncmp(_elm_config->engine, "shot:", 5))
1649 win->ee = ecore_evas_buffer_new(1, 1);
1650 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1651 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1660 ERR("Cannot create window.");
1664 #ifdef HAVE_ELEMENTARY_X
1665 _elm_win_xwindow_get(win);
1667 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1668 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1669 // bg pixmap done by x - has other issues like can be redrawn by x before it
1670 // is filled/ready by app
1671 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1674 win->parent = parent;
1676 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1677 _elm_win_obj_callback_parent_del, win);
1679 win->evas = ecore_evas_get(win->ee);
1680 win->win_obj = elm_widget_add(win->evas);
1681 elm_widget_type_set(win->win_obj, "win");
1682 ELM_SET_WIDTYPE(widtype, "win");
1683 elm_widget_data_set(win->win_obj, win);
1684 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1685 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1686 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1687 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1688 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1689 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1690 evas_object_move(win->win_obj, 0, 0);
1691 evas_object_resize(win->win_obj, 1, 1);
1692 evas_object_layer_set(win->win_obj, 50);
1693 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1697 // evas_object_clip_set(win->win_obj, win->frame_obj);
1698 evas_object_stack_below(win->frame_obj, win->win_obj);
1701 if (type == ELM_WIN_INLINED_IMAGE)
1702 elm_widget_parent2_set(win->win_obj, parent);
1703 ecore_evas_object_associate(win->ee, win->win_obj,
1704 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1705 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1706 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1707 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1708 _elm_win_obj_callback_show, win);
1709 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1710 _elm_win_obj_callback_hide, win);
1711 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1712 _elm_win_obj_callback_del, win);
1713 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1714 _elm_win_obj_callback_move, win);
1715 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1716 _elm_win_obj_callback_resize, win);
1718 evas_object_intercept_move_callback_add(win->win_obj,
1719 _elm_win_obj_intercept_move, win);
1720 evas_object_intercept_show_callback_add(win->win_obj,
1721 _elm_win_obj_intercept_show, win);
1723 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
1724 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1725 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1726 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1727 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1728 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1729 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1730 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1731 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1732 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1733 evas_font_path_append(win->evas, fontpath);
1734 if (!_elm_config->font_hinting)
1735 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1736 else if (_elm_config->font_hinting == 1)
1737 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1738 else if (_elm_config->font_hinting == 2)
1739 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1741 #ifdef HAVE_ELEMENTARY_X
1742 _elm_win_xwin_update(win);
1745 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1747 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1749 ecore_evas_fullscreen_set(win->ee, 1);
1751 #undef ENGINE_COMPARE
1753 if (_elm_config->focus_highlight_enable)
1754 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1757 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1758 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1759 _debug_key_down, win);
1761 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1763 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1766 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1768 return win->win_obj;
1772 elm_win_util_standard_add(const char *name, const char *title)
1774 Evas_Object *win, *bg;
1776 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1777 if (!win) return NULL;
1778 elm_win_title_set(win, title);
1779 bg = elm_bg_add(win);
1782 evas_object_del(win);
1785 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1786 elm_win_resize_object_add(win, bg);
1787 evas_object_show(bg);
1792 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1796 ELM_CHECK_WIDTYPE(obj, widtype);
1797 win = elm_widget_data_get(obj);
1799 if (eina_list_data_find(win->subobjs, subobj)) return;
1800 win->subobjs = eina_list_append(win->subobjs, subobj);
1801 elm_widget_sub_object_add(obj, subobj);
1802 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1803 _elm_win_subobj_callback_del, obj);
1804 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1805 _elm_win_subobj_callback_changed_size_hints,
1807 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1808 evas_object_move(subobj, 0, 0);
1809 evas_object_resize(subobj, w, h);
1810 _elm_win_eval_subobjs(obj);
1814 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1817 ELM_CHECK_WIDTYPE(obj, widtype);
1818 win = elm_widget_data_get(obj);
1820 evas_object_event_callback_del_full(subobj,
1821 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1822 _elm_win_subobj_callback_changed_size_hints,
1824 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1825 _elm_win_subobj_callback_del, obj);
1826 win->subobjs = eina_list_remove(win->subobjs, subobj);
1827 elm_widget_sub_object_del(obj, subobj);
1828 _elm_win_eval_subobjs(obj);
1832 elm_win_title_set(Evas_Object *obj, const char *title)
1835 ELM_CHECK_WIDTYPE(obj, widtype);
1836 win = elm_widget_data_get(obj);
1838 ecore_evas_title_set(win->ee, title);
1840 edje_object_part_text_set(win->frame_obj, "elm.text.title", title);
1844 elm_win_title_get(const Evas_Object *obj)
1847 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1848 win = elm_widget_data_get(obj);
1849 if (!win) return NULL;
1850 return ecore_evas_title_get(win->ee);
1854 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1857 ELM_CHECK_WIDTYPE(obj, widtype);
1858 win = elm_widget_data_get(obj);
1860 win->autodel = autodel;
1864 elm_win_autodel_get(const Evas_Object *obj)
1867 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1868 win = elm_widget_data_get(obj);
1869 if (!win) return EINA_FALSE;
1870 return win->autodel;
1874 elm_win_activate(Evas_Object *obj)
1877 ELM_CHECK_WIDTYPE(obj, widtype);
1878 win = elm_widget_data_get(obj);
1880 ecore_evas_activate(win->ee);
1884 elm_win_lower(Evas_Object *obj)
1887 ELM_CHECK_WIDTYPE(obj, widtype);
1888 win = elm_widget_data_get(obj);
1890 ecore_evas_lower(win->ee);
1894 elm_win_raise(Evas_Object *obj)
1897 ELM_CHECK_WIDTYPE(obj, widtype);
1898 win = elm_widget_data_get(obj);
1900 ecore_evas_raise(win->ee);
1904 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
1907 int win_w, win_h, screen_w, screen_h, nx, ny;
1908 ELM_CHECK_WIDTYPE(obj, widtype);
1909 win = elm_widget_data_get(obj);
1911 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
1912 if ((!screen_w) || (!screen_h)) return;
1913 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
1914 if ((!win_w) || (!win_h)) return;
1915 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
1916 else nx = win->screen.x;
1917 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
1918 else ny = win->screen.y;
1921 evas_object_move(obj, nx, ny);
1925 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1928 ELM_CHECK_WIDTYPE(obj, widtype);
1929 win = elm_widget_data_get(obj);
1931 ecore_evas_borderless_set(win->ee, borderless);
1932 #ifdef HAVE_ELEMENTARY_X
1933 _elm_win_xwin_update(win);
1938 elm_win_borderless_get(const Evas_Object *obj)
1941 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1942 win = elm_widget_data_get(obj);
1943 if (!win) return EINA_FALSE;
1944 return ecore_evas_borderless_get(win->ee);
1948 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1951 ELM_CHECK_WIDTYPE(obj, widtype);
1952 win = elm_widget_data_get(obj);
1954 ecore_evas_shaped_set(win->ee, shaped);
1955 #ifdef HAVE_ELEMENTARY_X
1956 _elm_win_xwin_update(win);
1961 elm_win_shaped_get(const Evas_Object *obj)
1964 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1965 win = elm_widget_data_get(obj);
1966 if (!win) return EINA_FALSE;
1967 return ecore_evas_shaped_get(win->ee);
1971 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1974 ELM_CHECK_WIDTYPE(obj, widtype);
1975 win = elm_widget_data_get(obj);
1980 else if (win->img_obj)
1982 evas_object_image_alpha_set(win->img_obj, alpha);
1983 ecore_evas_alpha_set(win->ee, alpha);
1987 #ifdef HAVE_ELEMENTARY_X
1992 if (!_elm_config->compositing)
1993 elm_win_shaped_set(obj, alpha);
1995 ecore_evas_alpha_set(win->ee, alpha);
1998 ecore_evas_alpha_set(win->ee, alpha);
1999 _elm_win_xwin_update(win);
2003 ecore_evas_alpha_set(win->ee, alpha);
2008 elm_win_alpha_get(const Evas_Object *obj)
2011 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2012 win = elm_widget_data_get(obj);
2013 if (!win) return EINA_FALSE;
2017 else if (win->img_obj)
2019 return evas_object_image_alpha_get(win->img_obj);
2021 return ecore_evas_alpha_get(win->ee);
2025 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
2028 ELM_CHECK_WIDTYPE(obj, widtype);
2029 win = elm_widget_data_get(obj);
2035 else if (win->img_obj)
2037 evas_object_image_alpha_set(win->img_obj, transparent);
2041 #ifdef HAVE_ELEMENTARY_X
2044 ecore_evas_transparent_set(win->ee, transparent);
2045 _elm_win_xwin_update(win);
2049 ecore_evas_transparent_set(win->ee, transparent);
2054 elm_win_transparent_get(const Evas_Object *obj)
2057 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2058 win = elm_widget_data_get(obj);
2059 if (!win) return EINA_FALSE;
2061 return ecore_evas_transparent_get(win->ee);
2065 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2068 ELM_CHECK_WIDTYPE(obj, widtype);
2069 win = elm_widget_data_get(obj);
2071 ecore_evas_override_set(win->ee, override);
2072 #ifdef HAVE_ELEMENTARY_X
2073 _elm_win_xwin_update(win);
2078 elm_win_override_get(const Evas_Object *obj)
2081 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2082 win = elm_widget_data_get(obj);
2083 if (!win) return EINA_FALSE;
2084 return ecore_evas_override_get(win->ee);
2088 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2091 ELM_CHECK_WIDTYPE(obj, widtype);
2092 win = elm_widget_data_get(obj);
2095 // YYY: handle if win->img_obj
2096 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2097 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2098 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2100 // these engines... can ONLY be fullscreen
2105 ecore_evas_fullscreen_set(win->ee, fullscreen);
2106 #ifdef HAVE_ELEMENTARY_X
2107 _elm_win_xwin_update(win);
2110 #undef ENGINE_COMPARE
2114 elm_win_fullscreen_get(const Evas_Object *obj)
2117 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2118 win = elm_widget_data_get(obj);
2119 if (!win) return EINA_FALSE;
2121 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2122 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2123 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2125 // these engines... can ONLY be fullscreen
2130 return ecore_evas_fullscreen_get(win->ee);
2132 #undef ENGINE_COMPARE
2136 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2139 ELM_CHECK_WIDTYPE(obj, widtype);
2140 win = elm_widget_data_get(obj);
2142 // YYY: handle if win->img_obj
2143 ecore_evas_maximized_set(win->ee, maximized);
2144 #ifdef HAVE_ELEMENTARY_X
2145 _elm_win_xwin_update(win);
2150 elm_win_maximized_get(const Evas_Object *obj)
2153 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2154 win = elm_widget_data_get(obj);
2155 if (!win) return EINA_FALSE;
2156 return ecore_evas_maximized_get(win->ee);
2160 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2163 ELM_CHECK_WIDTYPE(obj, widtype);
2164 win = elm_widget_data_get(obj);
2166 ecore_evas_iconified_set(win->ee, iconified);
2167 #ifdef HAVE_ELEMENTARY_X
2168 _elm_win_xwin_update(win);
2173 elm_win_iconified_get(const Evas_Object *obj)
2176 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2177 win = elm_widget_data_get(obj);
2178 if (!win) return EINA_FALSE;
2179 return ecore_evas_iconified_get(win->ee);
2183 elm_win_layer_set(Evas_Object *obj, int layer)
2186 ELM_CHECK_WIDTYPE(obj, widtype);
2187 win = elm_widget_data_get(obj);
2189 ecore_evas_layer_set(win->ee, layer);
2190 #ifdef HAVE_ELEMENTARY_X
2191 _elm_win_xwin_update(win);
2196 elm_win_layer_get(const Evas_Object *obj)
2199 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2200 win = elm_widget_data_get(obj);
2201 if (!win) return -1;
2202 return ecore_evas_layer_get(win->ee);
2206 elm_win_rotation_set(Evas_Object *obj, int rotation)
2209 ELM_CHECK_WIDTYPE(obj, widtype);
2210 win = elm_widget_data_get(obj);
2212 if (win->rot == rotation) return;
2213 win->rot = rotation;
2214 ecore_evas_rotation_set(win->ee, rotation);
2215 evas_object_size_hint_min_set(obj, -1, -1);
2216 evas_object_size_hint_max_set(obj, -1, -1);
2217 _elm_win_eval_subobjs(obj);
2218 #ifdef HAVE_ELEMENTARY_X
2219 _elm_win_xwin_update(win);
2224 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2227 ELM_CHECK_WIDTYPE(obj, widtype);
2228 win = elm_widget_data_get(obj);
2230 if (win->rot == rotation) return;
2231 win->rot = rotation;
2232 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2233 evas_object_size_hint_min_set(obj, -1, -1);
2234 evas_object_size_hint_max_set(obj, -1, -1);
2235 _elm_win_eval_subobjs(obj);
2236 #ifdef HAVE_ELEMENTARY_X
2237 _elm_win_xwin_update(win);
2242 elm_win_rotation_get(const Evas_Object *obj)
2245 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2246 win = elm_widget_data_get(obj);
2247 if (!win) return -1;
2252 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2255 ELM_CHECK_WIDTYPE(obj, widtype);
2256 win = elm_widget_data_get(obj);
2258 ecore_evas_sticky_set(win->ee, sticky);
2259 #ifdef HAVE_ELEMENTARY_X
2260 _elm_win_xwin_update(win);
2265 elm_win_sticky_get(const Evas_Object *obj)
2268 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2269 win = elm_widget_data_get(obj);
2270 if (!win) return EINA_FALSE;
2271 return ecore_evas_sticky_get(win->ee);
2275 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2278 ELM_CHECK_WIDTYPE(obj, widtype);
2279 win = elm_widget_data_get(obj);
2281 if (mode == win->kbdmode) return;
2282 #ifdef HAVE_ELEMENTARY_X
2283 _elm_win_xwindow_get(win);
2285 win->kbdmode = mode;
2286 #ifdef HAVE_ELEMENTARY_X
2288 ecore_x_e_virtual_keyboard_state_set
2289 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2293 EAPI Elm_Win_Keyboard_Mode
2294 elm_win_keyboard_mode_get(const Evas_Object *obj)
2297 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2298 win = elm_widget_data_get(obj);
2299 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2300 return win->kbdmode;
2304 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2307 ELM_CHECK_WIDTYPE(obj, widtype);
2308 win = elm_widget_data_get(obj);
2310 #ifdef HAVE_ELEMENTARY_X
2311 _elm_win_xwindow_get(win);
2313 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2320 elm_win_keyboard_win_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 #ifdef HAVE_ELEMENTARY_X
2327 _elm_win_xwindow_get(win);
2329 return ecore_x_e_virtual_keyboard_get(win->xwin);
2335 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2338 ELM_CHECK_WIDTYPE(obj, widtype);
2339 win = elm_widget_data_get(obj);
2341 if (x) *x = win->screen.x;
2342 if (y) *y = win->screen.y;
2346 elm_win_focus_get(const Evas_Object *obj)
2349 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2350 win = elm_widget_data_get(obj);
2351 if (!win) return EINA_FALSE;
2352 return ecore_evas_focus_get(win->ee);
2356 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2359 ELM_CHECK_WIDTYPE(obj, widtype);
2360 win = elm_widget_data_get(obj);
2362 win->constrain = !!constrain;
2366 elm_win_screen_constrain_get(Evas_Object *obj)
2369 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2370 win = elm_widget_data_get(obj);
2371 if (!win) return EINA_FALSE;
2372 return win->constrain;
2376 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2379 ELM_CHECK_WIDTYPE(obj, widtype);
2380 win = elm_widget_data_get(obj);
2382 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2386 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2389 ELM_CHECK_WIDTYPE(obj, widtype);
2390 win = elm_widget_data_get(obj);
2392 #ifdef HAVE_ELEMENTARY_X
2393 _elm_win_xwindow_get(win);
2395 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2402 elm_win_conformant_get(const Evas_Object *obj)
2405 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2406 win = elm_widget_data_get(obj);
2407 if (!win) return EINA_FALSE;
2408 #ifdef HAVE_ELEMENTARY_X
2409 _elm_win_xwindow_get(win);
2411 return ecore_x_e_illume_conformant_get(win->xwin);
2417 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2420 ELM_CHECK_WIDTYPE(obj, widtype);
2421 win = elm_widget_data_get(obj);
2423 #ifdef HAVE_ELEMENTARY_X
2424 _elm_win_xwindow_get(win);
2427 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2430 Ecore_X_Window_State states[2];
2432 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2433 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2434 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2435 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2444 elm_win_quickpanel_get(const Evas_Object *obj)
2447 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2448 win = elm_widget_data_get(obj);
2449 if (!win) return EINA_FALSE;
2450 #ifdef HAVE_ELEMENTARY_X
2451 _elm_win_xwindow_get(win);
2453 return ecore_x_e_illume_quickpanel_get(win->xwin);
2459 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2462 ELM_CHECK_WIDTYPE(obj, widtype);
2463 win = elm_widget_data_get(obj);
2465 #ifdef HAVE_ELEMENTARY_X
2466 _elm_win_xwindow_get(win);
2468 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2475 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2478 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2479 win = elm_widget_data_get(obj);
2480 if (!win) return -1;
2481 #ifdef HAVE_ELEMENTARY_X
2482 _elm_win_xwindow_get(win);
2484 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2490 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2493 ELM_CHECK_WIDTYPE(obj, widtype);
2494 win = elm_widget_data_get(obj);
2496 #ifdef HAVE_ELEMENTARY_X
2497 _elm_win_xwindow_get(win);
2499 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2506 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2509 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2510 win = elm_widget_data_get(obj);
2511 if (!win) return -1;
2512 #ifdef HAVE_ELEMENTARY_X
2513 _elm_win_xwindow_get(win);
2515 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2521 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2524 ELM_CHECK_WIDTYPE(obj, widtype);
2525 win = elm_widget_data_get(obj);
2527 #ifdef HAVE_ELEMENTARY_X
2528 _elm_win_xwindow_get(win);
2530 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2537 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2540 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2541 win = elm_widget_data_get(obj);
2543 #ifdef HAVE_ELEMENTARY_X
2544 _elm_win_xwindow_get(win);
2546 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2552 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
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 Ecore_X_Window_State states[2];
2566 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2567 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2568 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2569 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2578 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2581 ELM_CHECK_WIDTYPE(obj, widtype);
2582 win = elm_widget_data_get(obj);
2584 #ifdef HAVE_ELEMENTARY_X
2585 _elm_win_xwindow_get(win);
2590 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2591 ecore_x_e_illume_focus_back_send(win->xwin);
2593 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2594 ecore_x_e_illume_focus_forward_send(win->xwin);
2596 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2597 ecore_x_e_illume_focus_home_send(win->xwin);
2599 case ELM_ILLUME_COMMAND_CLOSE:
2600 ecore_x_e_illume_close_send(win->xwin);
2612 elm_win_inlined_image_object_get(Evas_Object *obj)
2615 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2616 win = elm_widget_data_get(obj);
2617 if (!win) return NULL;
2618 return win->img_obj;
2622 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2626 ELM_CHECK_WIDTYPE(obj, widtype);
2628 win = elm_widget_data_get(obj);
2629 enabled = !!enabled;
2630 if (win->focus_highlight.enabled == enabled)
2633 win->focus_highlight.enabled = enabled;
2635 if (win->focus_highlight.enabled)
2636 _elm_win_focus_highlight_init(win);
2638 _elm_win_focus_highlight_shutdown(win);
2642 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2646 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2648 win = elm_widget_data_get(obj);
2649 return win->focus_highlight.enabled;
2653 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2657 ELM_CHECK_WIDTYPE(obj, widtype);
2659 win = elm_widget_data_get(obj);
2660 eina_stringshare_replace(&win->focus_highlight.style, style);
2661 win->focus_highlight.changed_theme = EINA_TRUE;
2662 _elm_win_focus_highlight_reconfigure_job_start(win);
2666 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2670 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2672 win = elm_widget_data_get(obj);
2673 return win->focus_highlight.style;
2676 typedef struct _Widget_Data Widget_Data;
2681 Evas_Object *content;
2684 static void _del_hook(Evas_Object *obj);
2685 static void _theme_hook(Evas_Object *obj);
2686 static void _sizing_eval(Evas_Object *obj);
2687 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2688 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2690 static const char *widtype2 = NULL;
2693 _del_hook(Evas_Object *obj)
2695 Widget_Data *wd = elm_widget_data_get(obj);
2701 _theme_hook(Evas_Object *obj)
2703 Widget_Data *wd = elm_widget_data_get(obj);
2704 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2706 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2709 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2713 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2715 Widget_Data *wd = elm_widget_data_get(obj);
2720 /* Try Focus cycle in subitem */
2723 elm_widget_focus_next_get(wd->content, dir, next);
2728 *next = (Evas_Object *)obj;
2733 _sizing_eval(Evas_Object *obj)
2735 Widget_Data *wd = elm_widget_data_get(obj);
2736 Evas_Coord minw = -1, minh = -1;
2738 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2739 edje_object_size_min_calc(wd->frm, &minw, &minh);
2740 evas_object_size_hint_min_set(obj, minw, minh);
2741 evas_object_size_hint_max_set(obj, -1, -1);
2745 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2751 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2753 Widget_Data *wd = elm_widget_data_get(obj);
2754 Evas_Object *sub = event_info;
2755 if (sub == wd->content)
2757 evas_object_event_callback_del_full
2758 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2765 elm_win_inwin_add(Evas_Object *obj)
2771 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2772 win = elm_widget_data_get(obj);
2773 if (!win) return NULL;
2774 wd = ELM_NEW(Widget_Data);
2775 obj2 = elm_widget_add(win->evas);
2776 elm_widget_type_set(obj2, "inwin");
2777 ELM_SET_WIDTYPE(widtype2, "inwin");
2778 elm_widget_sub_object_add(obj, obj2);
2779 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2780 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2781 elm_win_resize_object_add(obj, obj2);
2783 elm_widget_data_set(obj2, wd);
2784 elm_widget_del_hook_set(obj2, _del_hook);
2785 elm_widget_theme_hook_set(obj2, _theme_hook);
2786 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2787 elm_widget_can_focus_set(obj2, EINA_TRUE);
2788 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2790 wd->frm = edje_object_add(win->evas);
2791 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2792 elm_widget_resize_object_set(obj2, wd->frm);
2794 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2801 elm_win_inwin_activate(Evas_Object *obj)
2803 ELM_CHECK_WIDTYPE(obj, widtype2);
2804 Widget_Data *wd = elm_widget_data_get(obj);
2806 evas_object_raise(obj);
2807 evas_object_show(obj);
2808 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2809 elm_object_focus_set(obj, EINA_TRUE);
2813 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2815 ELM_CHECK_WIDTYPE(obj, widtype2);
2816 Widget_Data *wd = elm_widget_data_get(obj);
2818 if (wd->content == content) return;
2819 if (wd->content) evas_object_del(wd->content);
2820 wd->content = content;
2823 elm_widget_sub_object_add(obj, content);
2824 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2825 _changed_size_hints, obj);
2826 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2832 elm_win_inwin_content_get(const Evas_Object *obj)
2834 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2835 Widget_Data *wd = elm_widget_data_get(obj);
2836 if (!wd) return NULL;
2841 elm_win_inwin_content_unset(Evas_Object *obj)
2843 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2844 Widget_Data *wd = elm_widget_data_get(obj);
2845 if (!wd) return NULL;
2846 if (!wd->content) return NULL;
2847 Evas_Object *content = wd->content;
2848 elm_widget_sub_object_del(obj, wd->content);
2849 evas_object_event_callback_del_full(wd->content,
2850 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2851 _changed_size_hints, obj);
2852 edje_object_part_unswallow(wd->frm, wd->content);
2857 /* windowing spcific calls - shall we do this differently? */
2859 static Ecore_X_Window
2860 _elm_ee_win_get(const Evas_Object *obj)
2863 #ifdef HAVE_ELEMENTARY_X
2864 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2865 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2871 elm_win_xwindow_get(const Evas_Object *obj)
2877 type = elm_widget_type_get(obj);
2878 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
2879 win = elm_widget_data_get(obj);
2881 #ifdef HAVE_ELEMENTARY_X
2882 if (win->xwin) return win->xwin;
2883 if (win->parent) return elm_win_xwindow_get(win->parent);