1 #include <Elementary.h>
4 typedef struct _Elm_Win Elm_Win;
10 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
12 #ifdef HAVE_ELEMENTARY_X
14 Ecore_Event_Handler *client_message_handler;
16 Ecore_Job *deferred_resize_job;
17 Ecore_Job *deferred_child_eval_job;
20 Elm_Win_Keyboard_Mode kbdmode;
27 Eina_Bool autodel : 1;
28 Eina_Bool constrain : 1;
29 Eina_Bool resizing : 1;
31 int *autodel_clear, rot;
42 Eina_Bool visible : 1;
43 Eina_Bool handled : 1;
47 Ecore_Job *reconf_job;
49 Eina_Bool enabled : 1;
50 Eina_Bool changed_theme : 1;
51 Eina_Bool top_animate : 1;
52 Eina_Bool geometry_changed : 1;
56 static const char *widtype = NULL;
57 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
58 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
59 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
60 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
61 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
62 static void _elm_win_move(Ecore_Evas *ee);
63 static void _elm_win_resize(Ecore_Evas *ee);
64 static void _elm_win_delete_request(Ecore_Evas *ee);
65 static void _elm_win_resize_job(void *data);
66 #ifdef HAVE_ELEMENTARY_X
67 static void _elm_win_xwin_update(Elm_Win *win);
69 static void _elm_win_eval_subobjs(Evas_Object *obj);
70 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
71 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
72 static void _elm_win_focus_highlight_init(Elm_Win *win);
73 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
74 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
75 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
76 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
77 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
78 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
80 static void _elm_win_frame_add(Elm_Win *win, const char *style);
81 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
82 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
83 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
84 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
85 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
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_mouse_in(Ecore_Evas *ee)
317 if (!(obj = ecore_evas_object_associate_get(ee))) return;
318 if (!(win = elm_widget_data_get(obj))) return;
319 if (win->resizing) win->resizing = EINA_FALSE;
323 _elm_win_focus_in(Ecore_Evas *ee)
325 Evas_Object *obj = ecore_evas_object_associate_get(ee);
329 win = elm_widget_data_get(obj);
331 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
332 if (win->show_count == 1)
334 elm_widget_focus_steal(win->win_obj);
338 elm_widget_focus_restore(win->win_obj);
339 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
340 win->focus_highlight.cur.visible = EINA_TRUE;
341 _elm_win_focus_highlight_reconfigure_job_start(win);
344 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
346 else if (win->img_obj)
353 _elm_win_focus_out(Ecore_Evas *ee)
355 Evas_Object *obj = ecore_evas_object_associate_get(ee);
359 win = elm_widget_data_get(obj);
361 elm_object_focus_set(win->win_obj, EINA_FALSE);
362 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
363 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
364 win->focus_highlight.cur.visible = EINA_FALSE;
365 _elm_win_focus_highlight_reconfigure_job_start(win);
368 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
370 else if (win->img_obj)
377 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
379 Elm_Win *wd = elm_widget_data_get(obj);
380 const Eina_List *items;
381 void *(*list_data_get) (const Eina_List *list);
389 if (!(items = elm_widget_focus_custom_chain_get(obj)))
395 list_data_get = eina_list_data_get;
397 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
403 *next = (Evas_Object *)obj;
408 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
410 Elm_Win *win = elm_widget_data_get(obj);
414 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
416 evas_object_focus_set(obj, elm_widget_focus_get(obj));
420 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
422 if (type == EVAS_CALLBACK_KEY_DOWN)
424 Evas_Event_Key_Down *ev = event_info;
425 if (!strcmp(ev->keyname, "Tab"))
427 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
428 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
430 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
431 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
434 else if ((!strcmp(ev->keyname, "Left")) ||
435 (!strcmp(ev->keyname, "KP_Left")))
437 //TODO : woohyun jung
439 else if ((!strcmp(ev->keyname, "Right")) ||
440 (!strcmp(ev->keyname, "KP_Right")))
442 //TODO : woohyun jung
444 else if ((!strcmp(ev->keyname, "Up")) ||
445 (!strcmp(ev->keyname, "KP_Up")))
447 //TODO : woohyun jung
449 else if ((!strcmp(ev->keyname, "Down")) ||
450 (!strcmp(ev->keyname, "KP_Down")))
452 //TODO : woohyun jung
460 _deferred_ecore_evas_free(void *data)
462 ecore_evas_free(data);
463 _elm_win_deferred_free--;
467 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
471 if (!win->show_count) win->show_count++;
472 if (win->shot.info) _shot_handle(win);
476 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
482 evas_object_hide(win->frame_obj);
484 else if (win->img_obj)
486 evas_object_hide(win->img_obj);
491 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
498 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
499 _elm_win_obj_callback_parent_del, win);
502 if (win->autodel_clear) *(win->autodel_clear) = -1;
503 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
504 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
507 ecore_evas_callback_delete_request_set(win->ee, NULL);
508 ecore_evas_callback_resize_set(win->ee, NULL);
510 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
511 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
512 if (win->shot.info) eina_stringshare_del(win->shot.info);
513 if (win->shot.timer) ecore_timer_del(win->shot.timer);
514 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
515 _elm_win_obj_callback_del, win);
516 while (((child = evas_object_bottom_get(win->evas))) &&
519 evas_object_del(child);
521 while (((child = evas_object_top_get(win->evas))) &&
524 evas_object_del(child);
526 #ifdef HAVE_ELEMENTARY_X
527 if (win->client_message_handler)
528 ecore_event_handler_del(win->client_message_handler);
530 // FIXME: Why are we flushing edje on every window destroy ??
531 // edje_file_cache_flush();
532 // edje_collection_cache_flush();
533 // evas_image_cache_flush(win->evas);
534 // evas_font_cache_flush(win->evas);
535 // FIXME: we are in the del handler for the object and delete the canvas
536 // that lives under it from the handler... nasty. deferring doesn't help either
546 ecore_job_add(_deferred_ecore_evas_free, win->ee);
547 _elm_win_deferred_free++;
551 _elm_win_focus_highlight_shutdown(win);
552 eina_stringshare_del(win->focus_highlight.style);
556 if ((!_elm_win_list) &&
557 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
559 edje_file_cache_flush();
560 edje_collection_cache_flush();
561 evas_image_cache_flush(e);
562 evas_font_cache_flush(e);
568 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
571 if (!win->img_obj) return;
572 evas_object_event_callback_del_full
573 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
574 evas_object_del(win->img_obj);
578 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
581 if (obj == win->parent) win->parent = NULL;
585 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
591 if ((x != win->screen.x) || (y != win->screen.y))
595 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
600 evas_object_move(obj, x, y);
605 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
608 // this is called to make sure all smart containers have calculated their
609 // sizes BEFORE we show the window to make sure it initially appears at
610 // our desired size (ie min size is known first)
611 evas_smart_objects_calculate(evas_object_evas_get(obj));
614 evas_object_show(win->frame_obj);
616 else if (win->img_obj)
618 evas_object_show(win->img_obj);
620 evas_object_show(obj);
624 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
628 if (ecore_evas_override_get(win->ee))
632 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
635 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
641 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
645 else if (win->img_obj)
649 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
652 // evas_object_move(win->img_obj, x, y);
657 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
664 else if (win->img_obj)
666 Evas_Coord w = 1, h = 1;
668 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
672 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
678 evas_object_image_size_set(win->img_obj, w, h);
683 _elm_win_delete_request(Ecore_Evas *ee)
685 Evas_Object *obj = ecore_evas_object_associate_get(ee);
687 if (strcmp(elm_widget_type_get(obj), "win")) return;
689 win = elm_widget_data_get(obj);
691 int autodel = win->autodel;
692 win->autodel_clear = &autodel;
693 evas_object_ref(win->win_obj);
694 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
695 // FIXME: if above callback deletes - then the below will be invalid
696 if (autodel) evas_object_del(win->win_obj);
697 else win->autodel_clear = NULL;
698 evas_object_unref(win->win_obj);
702 _elm_win_resize_job(void *data)
709 win->deferred_resize_job = NULL;
710 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
714 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
720 evas_object_resize(win->frame_obj, w, h);
722 else if (win->img_obj)
725 evas_object_resize(win->win_obj, w, h);
726 EINA_LIST_FOREACH(win->subobjs, l, obj)
728 evas_object_move(obj, 0, 0);
729 evas_object_resize(obj, w, h);
733 #ifdef HAVE_ELEMENTARY_X
735 _elm_win_xwindow_get(Elm_Win *win)
739 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
740 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
742 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
744 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
745 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
746 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
747 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
748 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
749 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
750 ENGINE_COMPARE(ELM_OPENGL_COCOA))
753 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
755 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
757 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
759 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
762 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
764 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
767 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
769 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
771 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
773 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
775 #undef ENGINE_COMPARE
779 #ifdef HAVE_ELEMENTARY_X
781 _elm_win_xwin_update(Elm_Win *win)
783 _elm_win_xwindow_get(win);
788 win2 = elm_widget_data_get(win->parent);
792 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
796 if (!win->xwin) return; /* nothing more to do */
801 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
803 case ELM_WIN_DIALOG_BASIC:
804 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
806 case ELM_WIN_DESKTOP:
807 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
810 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
812 case ELM_WIN_TOOLBAR:
813 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
816 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
818 case ELM_WIN_UTILITY:
819 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
822 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
824 case ELM_WIN_DROPDOWN_MENU:
825 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
827 case ELM_WIN_POPUP_MENU:
828 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
830 case ELM_WIN_TOOLTIP:
831 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
833 case ELM_WIN_NOTIFICATION:
834 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
837 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
840 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
845 ecore_x_e_virtual_keyboard_state_set
846 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
851 _elm_win_eval_subobjs(Evas_Object *obj)
854 const Evas_Object *child;
856 Elm_Win *win = elm_widget_data_get(obj);
857 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
861 EINA_LIST_FOREACH(win->subobjs, l, child)
863 evas_object_size_hint_weight_get(child, &wx, &wy);
864 if (wx == 0.0) xx = 0;
865 if (wy == 0.0) xy = 0;
867 evas_object_size_hint_min_get(child, &w, &h);
870 if (w > minw) minw = w;
871 if (h > minh) minh = h;
873 evas_object_size_hint_max_get(child, &w, &h);
876 if (maxw == -1) maxw = w;
877 else if ((w > 0) && (w < maxw)) maxw = w;
878 if (maxh == -1) maxh = h;
879 else if ((h > 0) && (h < maxh)) maxh = h;
881 if (!xx) maxw = minw;
883 if (!xy) maxh = minh;
885 evas_object_size_hint_min_set(obj, minw, minh);
886 evas_object_size_hint_max_set(obj, maxw, maxh);
887 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
888 if (w < minw) w = minw;
889 if (h < minh) h = minh;
890 if ((maxw >= 0) && (w > maxw)) w = maxw;
891 if ((maxh >= 0) && (h > maxh)) h = maxh;
892 evas_object_resize(obj, w, h);
896 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
898 Elm_Win *win = elm_widget_data_get(data);
899 win->subobjs = eina_list_remove(win->subobjs, obj);
900 _elm_win_eval_subobjs(win->win_obj);
904 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
906 _elm_win_eval_subobjs(data);
910 _elm_win_shutdown(void)
912 while (_elm_win_list)
913 evas_object_del(_elm_win_list->data);
917 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
924 EINA_LIST_FOREACH(_elm_win_list, l, obj)
925 elm_widget_theme(obj);
929 EINA_LIST_FOREACH(_elm_win_list, l, obj)
930 elm_widget_theme_specific(obj, th, EINA_FALSE);
935 _elm_win_translate(void)
940 EINA_LIST_FOREACH(_elm_win_list, l, obj)
941 elm_widget_translate(obj);
944 #ifdef HAVE_ELEMENTARY_X
946 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
949 Ecore_X_Event_Client_Message *e = event;
951 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
952 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
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);
966 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
968 if ((unsigned)e->data.l[0] == win->xwin)
970 Evas *evas = evas_object_evas_get(win->win_obj);
973 edje_file_cache_flush();
974 edje_collection_cache_flush();
975 evas_image_cache_flush(evas);
976 evas_font_cache_flush(evas);
977 evas_render_dump(evas);
981 return ECORE_CALLBACK_PASS_ON;
986 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
990 win->focus_highlight.geometry_changed = EINA_TRUE;
991 _elm_win_focus_highlight_reconfigure_job_start(win);
995 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
999 win->focus_highlight.geometry_changed = EINA_TRUE;
1000 _elm_win_focus_highlight_reconfigure_job_start(win);
1004 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1006 Elm_Win *win = data;
1008 win->focus_highlight.cur.target = NULL;
1010 _elm_win_focus_highlight_reconfigure_job_start(win);
1014 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1016 Evas_Object *obj = win->focus_highlight.cur.target;
1018 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1019 _elm_win_focus_target_move, win);
1020 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1021 _elm_win_focus_target_resize, win);
1022 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1023 _elm_win_focus_target_del, win);
1027 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1029 Evas_Object *obj = win->focus_highlight.cur.target;
1031 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1032 _elm_win_focus_target_move, win);
1033 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1034 _elm_win_focus_target_resize, win);
1035 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1036 _elm_win_focus_target_del, win);
1039 static Evas_Object *
1040 _elm_win_focus_target_get(Evas_Object *obj)
1042 Evas_Object *o = obj;
1046 if (elm_widget_is(o))
1048 if (!elm_widget_highlight_ignore_get(o))
1050 o = elm_widget_parent_get(o);
1052 o = evas_object_smart_parent_get(o);
1056 o = elm_widget_parent_widget_get(o);
1058 o = evas_object_smart_parent_get(o);
1067 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1069 Evas_Object *obj = event_info, *target;
1070 Elm_Win *win = data;
1072 if (win->focus_highlight.cur.target == obj)
1075 target = _elm_win_focus_target_get(obj);
1076 win->focus_highlight.cur.target = target;
1077 if (elm_widget_highlight_in_theme_get(target))
1078 win->focus_highlight.cur.handled = EINA_TRUE;
1080 _elm_win_focus_target_callbacks_add(win);
1082 _elm_win_focus_highlight_reconfigure_job_start(win);
1086 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1088 Elm_Win *win = data;
1090 if (!win->focus_highlight.cur.target)
1093 if (!win->focus_highlight.cur.handled)
1094 _elm_win_focus_target_callbacks_del(win);
1095 win->focus_highlight.cur.target = NULL;
1096 win->focus_highlight.cur.handled = EINA_FALSE;
1098 _elm_win_focus_highlight_reconfigure_job_start(win);
1102 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1104 evas_object_hide(obj);
1108 _elm_win_focus_highlight_init(Elm_Win *win)
1110 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1111 _elm_win_object_focus_in, win);
1112 evas_event_callback_add(win->evas,
1113 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1114 _elm_win_object_focus_out, win);
1116 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1118 win->focus_highlight.top = edje_object_add(win->evas);
1119 win->focus_highlight.changed_theme = EINA_TRUE;
1120 edje_object_signal_callback_add(win->focus_highlight.top,
1121 "elm,action,focus,hide,end", "",
1122 _elm_win_focus_highlight_hide, NULL);
1123 edje_object_signal_callback_add(win->focus_highlight.top,
1124 "elm,action,focus,anim,end", "",
1125 _elm_win_focus_highlight_anim_end, win);
1126 _elm_win_focus_highlight_reconfigure_job_start(win);
1130 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1132 _elm_win_focus_highlight_reconfigure_job_stop(win);
1133 if (win->focus_highlight.cur.target)
1135 _elm_win_focus_target_callbacks_del(win);
1136 win->focus_highlight.cur.target = NULL;
1138 if (win->focus_highlight.top)
1140 evas_object_del(win->focus_highlight.top);
1141 win->focus_highlight.top = NULL;
1144 evas_event_callback_del_full(win->evas,
1145 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1146 _elm_win_object_focus_in, win);
1147 evas_event_callback_del_full(win->evas,
1148 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1149 _elm_win_object_focus_out, win);
1153 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1157 top = win->focus_highlight.top;
1162 evas_object_show(top);
1163 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1169 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1174 _elm_win_focus_highlight_reconfigure_job(void *data)
1176 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1180 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1182 if (win->focus_highlight.reconf_job)
1183 ecore_job_del(win->focus_highlight.reconf_job);
1184 win->focus_highlight.reconf_job = ecore_job_add(
1185 _elm_win_focus_highlight_reconfigure_job, win);
1189 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1191 if (win->focus_highlight.reconf_job)
1192 ecore_job_del(win->focus_highlight.reconf_job);
1193 win->focus_highlight.reconf_job = NULL;
1197 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1199 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1200 Evas_Coord x, y, w, h;
1202 clip = evas_object_clip_get(target);
1203 evas_object_geometry_get(target, &x, &y, &w, &h);
1205 evas_object_move(obj, x, y);
1206 evas_object_resize(obj, w, h);
1207 evas_object_clip_set(obj, clip);
1211 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1213 Evas_Coord tx, ty, tw, th;
1214 Evas_Coord w, h, px, py, pw, ph;
1215 Edje_Message_Int_Set *m;
1216 Evas_Object *previous = win->focus_highlight.prev.target;
1217 Evas_Object *target = win->focus_highlight.cur.target;
1219 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1220 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1221 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1222 evas_object_move(obj, 0, 0);
1223 evas_object_resize(obj, tw, th);
1224 evas_object_clip_unset(obj);
1226 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1236 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1240 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1242 Elm_Win *win = data;
1243 _elm_win_focus_highlight_simple_setup(win, obj);
1247 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1249 Evas_Object *target = win->focus_highlight.cur.target;
1250 Evas_Object *previous = win->focus_highlight.prev.target;
1251 Evas_Object *top = win->focus_highlight.top;
1252 Eina_Bool visible_changed;
1253 Eina_Bool common_visible;
1254 const char *sig = NULL;
1256 _elm_win_focus_highlight_reconfigure_job_stop(win);
1258 visible_changed = (win->focus_highlight.cur.visible !=
1259 win->focus_highlight.prev.visible);
1261 if ((target == previous) && (!visible_changed) &&
1262 (!win->focus_highlight.geometry_changed))
1265 if ((previous) && (win->focus_highlight.prev.handled))
1266 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1269 common_visible = EINA_FALSE;
1270 else if (win->focus_highlight.cur.handled)
1272 common_visible = EINA_FALSE;
1273 if (win->focus_highlight.cur.visible)
1274 sig = "elm,action,focus_highlight,show";
1276 sig = "elm,action,focus_highlight,hide";
1279 common_visible = win->focus_highlight.cur.visible;
1281 _elm_win_focus_highlight_visible_set(win, common_visible);
1283 elm_widget_signal_emit(target, sig, "elm");
1285 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1288 if (win->focus_highlight.changed_theme)
1291 if (win->focus_highlight.style)
1292 str = win->focus_highlight.style;
1295 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1297 win->focus_highlight.changed_theme = EINA_FALSE;
1299 if (_elm_config->focus_highlight_animate)
1301 str = edje_object_data_get(win->focus_highlight.top, "animate");
1302 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1306 if ((win->focus_highlight.top_animate) && (previous) &&
1307 (!win->focus_highlight.prev.handled))
1308 _elm_win_focus_highlight_anim_setup(win, top);
1310 _elm_win_focus_highlight_simple_setup(win, top);
1311 evas_object_raise(top);
1314 win->focus_highlight.geometry_changed = EINA_FALSE;
1315 win->focus_highlight.prev = win->focus_highlight.cur;
1319 _elm_win_frame_add(Elm_Win *win, const char *style)
1321 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1323 win->frame_obj = edje_object_add(win->evas);
1324 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1325 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1326 evas_object_move(win->frame_obj, 0, 0);
1327 evas_object_resize(win->frame_obj, 1, 1);
1329 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1330 "elm", _elm_win_frame_cb_move_start, win);
1331 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1332 "*", _elm_win_frame_cb_resize_start, win);
1333 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1334 "elm", _elm_win_frame_cb_minimize, win);
1335 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1336 "elm", _elm_win_frame_cb_maximize, win);
1337 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1338 "elm", _elm_win_frame_cb_close, win);
1342 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1346 if (!(win = data)) return;
1347 /* FIXME: Change mouse pointer */
1349 /* NB: 0,0 are dummy values. Wayland handles the move by itself */
1350 ecore_evas_move(win->ee, 0, 0);
1354 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1358 if (!(win = data)) return;
1359 if (win->resizing) return;
1360 win->resizing = EINA_TRUE;
1362 /* FIXME: Change mouse pointer */
1364 if (!strcmp(source, "elm.event.resize.t"))
1365 win->resize_location = 1;
1366 else if (!strcmp(source, "elm.event.resize.b"))
1367 win->resize_location = 2;
1368 else if (!strcmp(source, "elm.event.resize.l"))
1369 win->resize_location = 4;
1370 else if (!strcmp(source, "elm.event.resize.r"))
1371 win->resize_location = 8;
1372 else if (!strcmp(source, "elm.event.resize.tl"))
1373 win->resize_location = 5;
1374 else if (!strcmp(source, "elm.event.resize.tr"))
1375 win->resize_location = 9;
1376 else if (!strcmp(source, "elm.event.resize.bl"))
1377 win->resize_location = 6;
1378 else if (!strcmp(source, "elm.event.resize.br"))
1379 win->resize_location = 10;
1381 win->resize_location = 0;
1383 if (win->resize_location > 0)
1384 ecore_evas_wayland_shm_resize(win->ee, win->resize_location);
1388 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1392 if (!(win = data)) return;
1393 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1397 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1401 if (!(win = data)) return;
1402 ecore_evas_maximized_set(win->ee, EINA_TRUE);
1406 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1410 if (!(win = data)) return;
1411 evas_object_del(win->win_obj);
1416 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1418 Evas_Event_Key_Down *ev = event_info;
1420 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1423 if ((strcmp(ev->keyname, "F12")) ||
1424 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1427 printf("Tree graph generated.\n");
1428 elm_object_tree_dot_dump(obj, "./dump.dot");
1433 _win_img_hide(void *data,
1435 Evas_Object *obj __UNUSED__,
1436 void *event_info __UNUSED__)
1438 Elm_Win *win = data;
1440 elm_widget_focus_hide_handle(win->win_obj);
1444 _win_img_mouse_up(void *data,
1446 Evas_Object *obj __UNUSED__,
1449 Elm_Win *win = data;
1450 Evas_Event_Mouse_Up *ev = event_info;
1451 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1452 elm_widget_focus_mouse_up_handle(win->win_obj);
1456 _win_img_focus_in(void *data,
1458 Evas_Object *obj __UNUSED__,
1459 void *event_info __UNUSED__)
1461 Elm_Win *win = data;
1462 elm_widget_focus_steal(win->win_obj);
1466 _win_img_focus_out(void *data,
1468 Evas_Object *obj __UNUSED__,
1469 void *event_info __UNUSED__)
1471 Elm_Win *win = data;
1472 elm_widget_focused_object_clear(win->win_obj);
1476 _win_inlined_image_set(Elm_Win *win)
1478 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1479 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1480 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1481 _elm_win_obj_callback_img_obj_del, win);
1483 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1484 _win_img_hide, win);
1485 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1486 _win_img_mouse_up, win);
1487 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1488 _win_img_focus_in, win);
1489 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1490 _win_img_focus_out, win);
1494 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1496 evas_object_event_callback_del_full(subobj,
1497 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1498 _elm_win_subobj_callback_changed_size_hints,
1500 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1501 _elm_win_subobj_callback_del, obj);
1502 win->subobjs = eina_list_remove(win->subobjs, subobj);
1503 _elm_win_eval_subobjs(obj);
1507 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1511 const char *fontpath;
1513 win = ELM_NEW(Elm_Win);
1515 #define FALLBACK_TRY(engine) \
1518 CRITICAL(engine " engine creation failed. Trying default."); \
1519 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1521 elm_engine_set(ecore_evas_engine_name_get(win->ee)); \
1523 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1527 case ELM_WIN_INLINED_IMAGE:
1530 Evas *e = evas_object_evas_get(parent);
1533 ee = ecore_evas_ecore_evas_get(e);
1535 win->img_obj = ecore_evas_object_image_new(ee);
1536 if (!win->img_obj) break;
1537 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1540 _win_inlined_image_set(win);
1543 evas_object_del(win->img_obj);
1544 win->img_obj = NULL;
1548 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1550 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1551 #ifdef HAVE_ELEMENTARY_X
1552 win->client_message_handler = ecore_event_handler_add
1553 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1555 FALLBACK_TRY("Sofware X11");
1557 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1559 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1560 FALLBACK_TRY("Sofware FB");
1562 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1564 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1565 FALLBACK_TRY("Sofware DirectFB");
1567 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1569 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1570 FALLBACK_TRY("Sofware-16");
1571 #ifdef HAVE_ELEMENTARY_X
1572 win->client_message_handler = ecore_event_handler_add
1573 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1576 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1578 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1579 FALLBACK_TRY("Sofware-8");
1580 #ifdef HAVE_ELEMENTARY_X
1581 win->client_message_handler = ecore_event_handler_add
1582 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1586 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1588 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1589 FALLBACK_TRY("XRender");
1590 #ifdef HAVE_ELEMENTARY_X
1591 win->client_message_handler = ecore_event_handler_add
1592 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1596 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1601 if (_elm_config->vsync)
1603 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1609 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1611 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1612 FALLBACK_TRY("OpenGL");
1613 #ifdef HAVE_ELEMENTARY_X
1614 win->client_message_handler = ecore_event_handler_add
1615 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1618 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1620 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1621 FALLBACK_TRY("Sofware Win32");
1623 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1625 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1626 FALLBACK_TRY("Sofware-16-WinCE");
1628 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1630 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1631 FALLBACK_TRY("PSL1GHT");
1633 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1635 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1636 FALLBACK_TRY("Sofware SDL");
1638 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1640 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1641 FALLBACK_TRY("Sofware-16-SDL");
1643 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1645 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1646 FALLBACK_TRY("OpenGL SDL");
1648 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1650 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1651 FALLBACK_TRY("OpenGL Cocoa");
1653 else if (ENGINE_COMPARE(ELM_BUFFER))
1655 win->ee = ecore_evas_buffer_new(1, 1);
1657 else if (ENGINE_COMPARE(ELM_EWS))
1659 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1661 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1663 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 1, 1, 0);
1664 win->evas = ecore_evas_get(win->ee);
1666 _elm_win_frame_add(win, "default");
1668 else if (!strncmp(_elm_config->engine, "shot:", 5))
1670 win->ee = ecore_evas_buffer_new(1, 1);
1671 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1672 win->shot.info = eina_stringshare_add(_elm_config->engine + 5);
1681 ERR("Cannot create window.");
1685 #ifdef HAVE_ELEMENTARY_X
1686 _elm_win_xwindow_get(win);
1688 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1689 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1690 // bg pixmap done by x - has other issues like can be redrawn by x before it
1691 // is filled/ready by app
1692 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1695 win->parent = parent;
1697 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1698 _elm_win_obj_callback_parent_del, win);
1700 win->evas = ecore_evas_get(win->ee);
1701 win->win_obj = elm_widget_add(win->evas);
1702 elm_widget_type_set(win->win_obj, "win");
1703 ELM_SET_WIDTYPE(widtype, "win");
1704 elm_widget_data_set(win->win_obj, win);
1705 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1706 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1707 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1708 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1709 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1710 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1711 evas_object_move(win->win_obj, 0, 0);
1712 evas_object_resize(win->win_obj, 1, 1);
1713 evas_object_layer_set(win->win_obj, 50);
1714 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1718 // evas_object_clip_set(win->win_obj, win->frame_obj);
1719 evas_object_stack_below(win->frame_obj, win->win_obj);
1722 if (type == ELM_WIN_INLINED_IMAGE)
1723 elm_widget_parent2_set(win->win_obj, parent);
1724 ecore_evas_object_associate(win->ee, win->win_obj,
1725 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1726 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1727 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1728 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1729 _elm_win_obj_callback_show, win);
1730 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1731 _elm_win_obj_callback_hide, win);
1732 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1733 _elm_win_obj_callback_del, win);
1734 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1735 _elm_win_obj_callback_move, win);
1736 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1737 _elm_win_obj_callback_resize, win);
1739 evas_object_intercept_move_callback_add(win->win_obj,
1740 _elm_win_obj_intercept_move, win);
1741 evas_object_intercept_show_callback_add(win->win_obj,
1742 _elm_win_obj_intercept_show, win);
1744 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
1745 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1746 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1747 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1748 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
1749 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1750 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1751 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1752 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1753 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1754 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1755 evas_font_path_append(win->evas, fontpath);
1756 if (!_elm_config->font_hinting)
1757 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1758 else if (_elm_config->font_hinting == 1)
1759 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1760 else if (_elm_config->font_hinting == 2)
1761 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1763 #ifdef HAVE_ELEMENTARY_X
1764 _elm_win_xwin_update(win);
1767 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1769 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1771 ecore_evas_fullscreen_set(win->ee, 1);
1773 #undef ENGINE_COMPARE
1775 if (_elm_config->focus_highlight_enable)
1776 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1779 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1780 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1781 _debug_key_down, win);
1783 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1785 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
1788 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
1790 return win->win_obj;
1794 elm_win_util_standard_add(const char *name, const char *title)
1796 Evas_Object *win, *bg;
1798 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
1799 if (!win) return NULL;
1800 elm_win_title_set(win, title);
1801 bg = elm_bg_add(win);
1804 evas_object_del(win);
1807 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1808 elm_win_resize_object_add(win, bg);
1809 evas_object_show(bg);
1814 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1818 ELM_CHECK_WIDTYPE(obj, widtype);
1819 win = elm_widget_data_get(obj);
1821 if (eina_list_data_find(win->subobjs, subobj)) return;
1822 win->subobjs = eina_list_append(win->subobjs, subobj);
1823 elm_widget_sub_object_add(obj, subobj);
1824 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1825 _elm_win_subobj_callback_del, obj);
1826 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1827 _elm_win_subobj_callback_changed_size_hints,
1829 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1830 evas_object_move(subobj, 0, 0);
1831 evas_object_resize(subobj, w, h);
1832 _elm_win_eval_subobjs(obj);
1836 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1839 ELM_CHECK_WIDTYPE(obj, widtype);
1840 win = elm_widget_data_get(obj);
1842 evas_object_event_callback_del_full(subobj,
1843 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1844 _elm_win_subobj_callback_changed_size_hints,
1846 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1847 _elm_win_subobj_callback_del, obj);
1848 win->subobjs = eina_list_remove(win->subobjs, subobj);
1849 elm_widget_sub_object_del(obj, subobj);
1850 _elm_win_eval_subobjs(obj);
1854 elm_win_title_set(Evas_Object *obj, const char *title)
1857 ELM_CHECK_WIDTYPE(obj, widtype);
1858 win = elm_widget_data_get(obj);
1860 ecore_evas_title_set(win->ee, title);
1862 edje_object_part_text_set(win->frame_obj, "elm.text.title", title);
1866 elm_win_title_get(const Evas_Object *obj)
1869 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1870 win = elm_widget_data_get(obj);
1871 if (!win) return NULL;
1872 return ecore_evas_title_get(win->ee);
1876 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1879 ELM_CHECK_WIDTYPE(obj, widtype);
1880 win = elm_widget_data_get(obj);
1882 win->autodel = autodel;
1886 elm_win_autodel_get(const Evas_Object *obj)
1889 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1890 win = elm_widget_data_get(obj);
1891 if (!win) return EINA_FALSE;
1892 return win->autodel;
1896 elm_win_activate(Evas_Object *obj)
1899 ELM_CHECK_WIDTYPE(obj, widtype);
1900 win = elm_widget_data_get(obj);
1902 ecore_evas_activate(win->ee);
1906 elm_win_lower(Evas_Object *obj)
1909 ELM_CHECK_WIDTYPE(obj, widtype);
1910 win = elm_widget_data_get(obj);
1912 ecore_evas_lower(win->ee);
1916 elm_win_raise(Evas_Object *obj)
1919 ELM_CHECK_WIDTYPE(obj, widtype);
1920 win = elm_widget_data_get(obj);
1922 ecore_evas_raise(win->ee);
1926 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
1929 int win_w, win_h, screen_w, screen_h, nx, ny;
1930 ELM_CHECK_WIDTYPE(obj, widtype);
1931 win = elm_widget_data_get(obj);
1933 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
1934 if ((!screen_w) || (!screen_h)) return;
1935 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
1936 if ((!win_w) || (!win_h)) return;
1937 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
1938 else nx = win->screen.x;
1939 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
1940 else ny = win->screen.y;
1943 evas_object_move(obj, nx, ny);
1947 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1950 ELM_CHECK_WIDTYPE(obj, widtype);
1951 win = elm_widget_data_get(obj);
1953 ecore_evas_borderless_set(win->ee, borderless);
1954 #ifdef HAVE_ELEMENTARY_X
1955 _elm_win_xwin_update(win);
1960 elm_win_borderless_get(const Evas_Object *obj)
1963 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1964 win = elm_widget_data_get(obj);
1965 if (!win) return EINA_FALSE;
1966 return ecore_evas_borderless_get(win->ee);
1970 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1973 ELM_CHECK_WIDTYPE(obj, widtype);
1974 win = elm_widget_data_get(obj);
1976 ecore_evas_shaped_set(win->ee, shaped);
1977 #ifdef HAVE_ELEMENTARY_X
1978 _elm_win_xwin_update(win);
1983 elm_win_shaped_get(const Evas_Object *obj)
1986 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1987 win = elm_widget_data_get(obj);
1988 if (!win) return EINA_FALSE;
1989 return ecore_evas_shaped_get(win->ee);
1993 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1996 ELM_CHECK_WIDTYPE(obj, widtype);
1997 win = elm_widget_data_get(obj);
2002 else if (win->img_obj)
2004 evas_object_image_alpha_set(win->img_obj, alpha);
2005 ecore_evas_alpha_set(win->ee, alpha);
2009 #ifdef HAVE_ELEMENTARY_X
2014 if (!_elm_config->compositing)
2015 elm_win_shaped_set(obj, alpha);
2017 ecore_evas_alpha_set(win->ee, alpha);
2020 ecore_evas_alpha_set(win->ee, alpha);
2021 _elm_win_xwin_update(win);
2025 ecore_evas_alpha_set(win->ee, alpha);
2030 elm_win_alpha_get(const Evas_Object *obj)
2033 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2034 win = elm_widget_data_get(obj);
2035 if (!win) return EINA_FALSE;
2039 else if (win->img_obj)
2041 return evas_object_image_alpha_get(win->img_obj);
2043 return ecore_evas_alpha_get(win->ee);
2047 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
2050 ELM_CHECK_WIDTYPE(obj, widtype);
2051 win = elm_widget_data_get(obj);
2057 else if (win->img_obj)
2059 evas_object_image_alpha_set(win->img_obj, transparent);
2063 #ifdef HAVE_ELEMENTARY_X
2066 ecore_evas_transparent_set(win->ee, transparent);
2067 _elm_win_xwin_update(win);
2071 ecore_evas_transparent_set(win->ee, transparent);
2076 elm_win_transparent_get(const Evas_Object *obj)
2079 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2080 win = elm_widget_data_get(obj);
2081 if (!win) return EINA_FALSE;
2083 return ecore_evas_transparent_get(win->ee);
2087 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2090 ELM_CHECK_WIDTYPE(obj, widtype);
2091 win = elm_widget_data_get(obj);
2093 ecore_evas_override_set(win->ee, override);
2094 #ifdef HAVE_ELEMENTARY_X
2095 _elm_win_xwin_update(win);
2100 elm_win_override_get(const Evas_Object *obj)
2103 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2104 win = elm_widget_data_get(obj);
2105 if (!win) return EINA_FALSE;
2106 return ecore_evas_override_get(win->ee);
2110 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2113 ELM_CHECK_WIDTYPE(obj, widtype);
2114 win = elm_widget_data_get(obj);
2117 // YYY: handle if win->img_obj
2118 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2119 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2120 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2122 // these engines... can ONLY be fullscreen
2127 ecore_evas_fullscreen_set(win->ee, fullscreen);
2128 #ifdef HAVE_ELEMENTARY_X
2129 _elm_win_xwin_update(win);
2132 #undef ENGINE_COMPARE
2136 elm_win_fullscreen_get(const Evas_Object *obj)
2139 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2140 win = elm_widget_data_get(obj);
2141 if (!win) return EINA_FALSE;
2143 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
2144 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2145 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2147 // these engines... can ONLY be fullscreen
2152 return ecore_evas_fullscreen_get(win->ee);
2154 #undef ENGINE_COMPARE
2158 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2161 ELM_CHECK_WIDTYPE(obj, widtype);
2162 win = elm_widget_data_get(obj);
2164 // YYY: handle if win->img_obj
2165 ecore_evas_maximized_set(win->ee, maximized);
2166 #ifdef HAVE_ELEMENTARY_X
2167 _elm_win_xwin_update(win);
2172 elm_win_maximized_get(const Evas_Object *obj)
2175 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2176 win = elm_widget_data_get(obj);
2177 if (!win) return EINA_FALSE;
2178 return ecore_evas_maximized_get(win->ee);
2182 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2185 ELM_CHECK_WIDTYPE(obj, widtype);
2186 win = elm_widget_data_get(obj);
2188 ecore_evas_iconified_set(win->ee, iconified);
2189 #ifdef HAVE_ELEMENTARY_X
2190 _elm_win_xwin_update(win);
2195 elm_win_iconified_get(const Evas_Object *obj)
2198 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2199 win = elm_widget_data_get(obj);
2200 if (!win) return EINA_FALSE;
2201 return ecore_evas_iconified_get(win->ee);
2205 elm_win_layer_set(Evas_Object *obj, int layer)
2208 ELM_CHECK_WIDTYPE(obj, widtype);
2209 win = elm_widget_data_get(obj);
2211 ecore_evas_layer_set(win->ee, layer);
2212 #ifdef HAVE_ELEMENTARY_X
2213 _elm_win_xwin_update(win);
2218 elm_win_layer_get(const Evas_Object *obj)
2221 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2222 win = elm_widget_data_get(obj);
2223 if (!win) return -1;
2224 return ecore_evas_layer_get(win->ee);
2228 elm_win_rotation_set(Evas_Object *obj, int rotation)
2231 ELM_CHECK_WIDTYPE(obj, widtype);
2232 win = elm_widget_data_get(obj);
2234 if (win->rot == rotation) return;
2235 win->rot = rotation;
2236 ecore_evas_rotation_set(win->ee, rotation);
2237 evas_object_size_hint_min_set(obj, -1, -1);
2238 evas_object_size_hint_max_set(obj, -1, -1);
2239 _elm_win_eval_subobjs(obj);
2240 #ifdef HAVE_ELEMENTARY_X
2241 _elm_win_xwin_update(win);
2246 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2249 ELM_CHECK_WIDTYPE(obj, widtype);
2250 win = elm_widget_data_get(obj);
2252 if (win->rot == rotation) return;
2253 win->rot = rotation;
2254 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2255 evas_object_size_hint_min_set(obj, -1, -1);
2256 evas_object_size_hint_max_set(obj, -1, -1);
2257 _elm_win_eval_subobjs(obj);
2258 #ifdef HAVE_ELEMENTARY_X
2259 _elm_win_xwin_update(win);
2264 elm_win_rotation_get(const Evas_Object *obj)
2267 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2268 win = elm_widget_data_get(obj);
2269 if (!win) return -1;
2274 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2277 ELM_CHECK_WIDTYPE(obj, widtype);
2278 win = elm_widget_data_get(obj);
2280 ecore_evas_sticky_set(win->ee, sticky);
2281 #ifdef HAVE_ELEMENTARY_X
2282 _elm_win_xwin_update(win);
2287 elm_win_sticky_get(const Evas_Object *obj)
2290 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2291 win = elm_widget_data_get(obj);
2292 if (!win) return EINA_FALSE;
2293 return ecore_evas_sticky_get(win->ee);
2297 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2300 ELM_CHECK_WIDTYPE(obj, widtype);
2301 win = elm_widget_data_get(obj);
2303 if (mode == win->kbdmode) return;
2304 #ifdef HAVE_ELEMENTARY_X
2305 _elm_win_xwindow_get(win);
2307 win->kbdmode = mode;
2308 #ifdef HAVE_ELEMENTARY_X
2310 ecore_x_e_virtual_keyboard_state_set
2311 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2315 EAPI Elm_Win_Keyboard_Mode
2316 elm_win_keyboard_mode_get(const Evas_Object *obj)
2319 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2320 win = elm_widget_data_get(obj);
2321 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2322 return win->kbdmode;
2326 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2329 ELM_CHECK_WIDTYPE(obj, widtype);
2330 win = elm_widget_data_get(obj);
2332 #ifdef HAVE_ELEMENTARY_X
2333 _elm_win_xwindow_get(win);
2335 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2342 elm_win_keyboard_win_get(const Evas_Object *obj)
2345 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2346 win = elm_widget_data_get(obj);
2347 if (!win) return EINA_FALSE;
2348 #ifdef HAVE_ELEMENTARY_X
2349 _elm_win_xwindow_get(win);
2351 return ecore_x_e_virtual_keyboard_get(win->xwin);
2357 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2360 ELM_CHECK_WIDTYPE(obj, widtype);
2361 win = elm_widget_data_get(obj);
2363 if (x) *x = win->screen.x;
2364 if (y) *y = win->screen.y;
2368 elm_win_focus_get(const Evas_Object *obj)
2371 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2372 win = elm_widget_data_get(obj);
2373 if (!win) return EINA_FALSE;
2374 return ecore_evas_focus_get(win->ee);
2378 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2381 ELM_CHECK_WIDTYPE(obj, widtype);
2382 win = elm_widget_data_get(obj);
2384 win->constrain = !!constrain;
2388 elm_win_screen_constrain_get(Evas_Object *obj)
2391 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2392 win = elm_widget_data_get(obj);
2393 if (!win) return EINA_FALSE;
2394 return win->constrain;
2398 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2401 ELM_CHECK_WIDTYPE(obj, widtype);
2402 win = elm_widget_data_get(obj);
2404 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2408 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2411 ELM_CHECK_WIDTYPE(obj, widtype);
2412 win = elm_widget_data_get(obj);
2414 #ifdef HAVE_ELEMENTARY_X
2415 _elm_win_xwindow_get(win);
2417 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2424 elm_win_conformant_get(const Evas_Object *obj)
2427 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2428 win = elm_widget_data_get(obj);
2429 if (!win) return EINA_FALSE;
2430 #ifdef HAVE_ELEMENTARY_X
2431 _elm_win_xwindow_get(win);
2433 return ecore_x_e_illume_conformant_get(win->xwin);
2439 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2442 ELM_CHECK_WIDTYPE(obj, widtype);
2443 win = elm_widget_data_get(obj);
2445 #ifdef HAVE_ELEMENTARY_X
2446 _elm_win_xwindow_get(win);
2449 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2452 Ecore_X_Window_State states[2];
2454 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2455 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2456 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2457 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2466 elm_win_quickpanel_get(const Evas_Object *obj)
2469 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2470 win = elm_widget_data_get(obj);
2471 if (!win) return EINA_FALSE;
2472 #ifdef HAVE_ELEMENTARY_X
2473 _elm_win_xwindow_get(win);
2475 return ecore_x_e_illume_quickpanel_get(win->xwin);
2481 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2484 ELM_CHECK_WIDTYPE(obj, widtype);
2485 win = elm_widget_data_get(obj);
2487 #ifdef HAVE_ELEMENTARY_X
2488 _elm_win_xwindow_get(win);
2490 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2497 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2500 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2501 win = elm_widget_data_get(obj);
2502 if (!win) return -1;
2503 #ifdef HAVE_ELEMENTARY_X
2504 _elm_win_xwindow_get(win);
2506 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2512 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2515 ELM_CHECK_WIDTYPE(obj, widtype);
2516 win = elm_widget_data_get(obj);
2518 #ifdef HAVE_ELEMENTARY_X
2519 _elm_win_xwindow_get(win);
2521 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2528 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2531 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2532 win = elm_widget_data_get(obj);
2533 if (!win) return -1;
2534 #ifdef HAVE_ELEMENTARY_X
2535 _elm_win_xwindow_get(win);
2537 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2543 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2546 ELM_CHECK_WIDTYPE(obj, widtype);
2547 win = elm_widget_data_get(obj);
2549 #ifdef HAVE_ELEMENTARY_X
2550 _elm_win_xwindow_get(win);
2552 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2559 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2562 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2563 win = elm_widget_data_get(obj);
2565 #ifdef HAVE_ELEMENTARY_X
2566 _elm_win_xwindow_get(win);
2568 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2574 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2577 ELM_CHECK_WIDTYPE(obj, widtype);
2578 win = elm_widget_data_get(obj);
2580 #ifdef HAVE_ELEMENTARY_X
2581 _elm_win_xwindow_get(win);
2586 Ecore_X_Window_State states[2];
2588 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2589 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2590 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2591 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2600 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2603 ELM_CHECK_WIDTYPE(obj, widtype);
2604 win = elm_widget_data_get(obj);
2606 #ifdef HAVE_ELEMENTARY_X
2607 _elm_win_xwindow_get(win);
2612 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2613 ecore_x_e_illume_focus_back_send(win->xwin);
2615 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2616 ecore_x_e_illume_focus_forward_send(win->xwin);
2618 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2619 ecore_x_e_illume_focus_home_send(win->xwin);
2621 case ELM_ILLUME_COMMAND_CLOSE:
2622 ecore_x_e_illume_close_send(win->xwin);
2634 elm_win_inlined_image_object_get(Evas_Object *obj)
2637 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2638 win = elm_widget_data_get(obj);
2639 if (!win) return NULL;
2640 return win->img_obj;
2644 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2648 ELM_CHECK_WIDTYPE(obj, widtype);
2650 win = elm_widget_data_get(obj);
2651 enabled = !!enabled;
2652 if (win->focus_highlight.enabled == enabled)
2655 win->focus_highlight.enabled = enabled;
2657 if (win->focus_highlight.enabled)
2658 _elm_win_focus_highlight_init(win);
2660 _elm_win_focus_highlight_shutdown(win);
2664 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2668 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2670 win = elm_widget_data_get(obj);
2671 return win->focus_highlight.enabled;
2675 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2679 ELM_CHECK_WIDTYPE(obj, widtype);
2681 win = elm_widget_data_get(obj);
2682 eina_stringshare_replace(&win->focus_highlight.style, style);
2683 win->focus_highlight.changed_theme = EINA_TRUE;
2684 _elm_win_focus_highlight_reconfigure_job_start(win);
2688 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2692 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2694 win = elm_widget_data_get(obj);
2695 return win->focus_highlight.style;
2698 typedef struct _Widget_Data Widget_Data;
2703 Evas_Object *content;
2706 static void _del_hook(Evas_Object *obj);
2707 static void _theme_hook(Evas_Object *obj);
2708 static void _sizing_eval(Evas_Object *obj);
2709 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2710 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2712 static const char *widtype2 = NULL;
2715 _del_hook(Evas_Object *obj)
2717 Widget_Data *wd = elm_widget_data_get(obj);
2723 _theme_hook(Evas_Object *obj)
2725 Widget_Data *wd = elm_widget_data_get(obj);
2726 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2728 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2731 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
2735 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2737 Widget_Data *wd = elm_widget_data_get(obj);
2742 /* Try Focus cycle in subitem */
2745 elm_widget_focus_next_get(wd->content, dir, next);
2750 *next = (Evas_Object *)obj;
2755 _sizing_eval(Evas_Object *obj)
2757 Widget_Data *wd = elm_widget_data_get(obj);
2758 Evas_Coord minw = -1, minh = -1;
2760 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2761 edje_object_size_min_calc(wd->frm, &minw, &minh);
2762 evas_object_size_hint_min_set(obj, minw, minh);
2763 evas_object_size_hint_max_set(obj, -1, -1);
2767 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2773 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2775 Widget_Data *wd = elm_widget_data_get(obj);
2776 Evas_Object *sub = event_info;
2777 if (sub == wd->content)
2779 evas_object_event_callback_del_full
2780 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2787 elm_win_inwin_add(Evas_Object *obj)
2793 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2794 win = elm_widget_data_get(obj);
2795 if (!win) return NULL;
2796 wd = ELM_NEW(Widget_Data);
2797 obj2 = elm_widget_add(win->evas);
2798 elm_widget_type_set(obj2, "inwin");
2799 ELM_SET_WIDTYPE(widtype2, "inwin");
2800 elm_widget_sub_object_add(obj, obj2);
2801 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2802 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2803 elm_win_resize_object_add(obj, obj2);
2805 elm_widget_data_set(obj2, wd);
2806 elm_widget_del_hook_set(obj2, _del_hook);
2807 elm_widget_theme_hook_set(obj2, _theme_hook);
2808 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2809 elm_widget_can_focus_set(obj2, EINA_TRUE);
2810 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2812 wd->frm = edje_object_add(win->evas);
2813 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2814 elm_widget_resize_object_set(obj2, wd->frm);
2816 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2823 elm_win_inwin_activate(Evas_Object *obj)
2825 ELM_CHECK_WIDTYPE(obj, widtype2);
2826 Widget_Data *wd = elm_widget_data_get(obj);
2828 evas_object_raise(obj);
2829 evas_object_show(obj);
2830 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2831 elm_object_focus_set(obj, EINA_TRUE);
2835 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2837 ELM_CHECK_WIDTYPE(obj, widtype2);
2838 Widget_Data *wd = elm_widget_data_get(obj);
2840 if (wd->content == content) return;
2841 if (wd->content) evas_object_del(wd->content);
2842 wd->content = content;
2845 elm_widget_sub_object_add(obj, content);
2846 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2847 _changed_size_hints, obj);
2848 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2854 elm_win_inwin_content_get(const Evas_Object *obj)
2856 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2857 Widget_Data *wd = elm_widget_data_get(obj);
2858 if (!wd) return NULL;
2863 elm_win_inwin_content_unset(Evas_Object *obj)
2865 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2866 Widget_Data *wd = elm_widget_data_get(obj);
2867 if (!wd) return NULL;
2868 if (!wd->content) return NULL;
2869 Evas_Object *content = wd->content;
2870 elm_widget_sub_object_del(obj, wd->content);
2871 evas_object_event_callback_del_full(wd->content,
2872 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2873 _changed_size_hints, obj);
2874 edje_object_part_unswallow(wd->frm, wd->content);
2879 /* windowing spcific calls - shall we do this differently? */
2881 static Ecore_X_Window
2882 _elm_ee_win_get(const Evas_Object *obj)
2885 #ifdef HAVE_ELEMENTARY_X
2886 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2887 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2893 elm_win_xwindow_get(const Evas_Object *obj)
2899 type = elm_widget_type_get(obj);
2900 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
2901 win = elm_widget_data_get(obj);
2903 #ifdef HAVE_ELEMENTARY_X
2904 if (win->xwin) return win->xwin;
2905 if (win->parent) return elm_win_xwindow_get(win->parent);