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;
21 Elm_Win_Indicator_Mode indmode;
22 Elm_Win_Indicator_Opacity_Mode ind_o_mode;
30 int *autodel_clear, rot;
39 Evas_Object *obj, *hot_obj;
47 Eina_Bool visible : 1;
48 Eina_Bool handled : 1;
52 Ecore_Job *reconf_job;
54 Eina_Bool enabled : 1;
55 Eina_Bool changed_theme : 1;
56 Eina_Bool top_animate : 1;
57 Eina_Bool geometry_changed : 1;
62 const char *icon_name;
68 Eina_Bool demand_attention : 1;
69 Eina_Bool autodel : 1;
70 Eina_Bool constrain : 1;
71 Eina_Bool resizing : 1;
72 Eina_Bool iconified : 1;
73 Eina_Bool withdrawn : 1;
75 Eina_Bool fullscreen : 1;
76 Eina_Bool maximized : 1;
77 Eina_Bool skip_focus : 1;
80 static const char *widtype = NULL;
81 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
82 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
83 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
84 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
85 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
86 static void _elm_win_move(Ecore_Evas *ee);
87 static void _elm_win_resize(Ecore_Evas *ee);
88 static void _elm_win_delete_request(Ecore_Evas *ee);
89 static void _elm_win_resize_job(void *data);
90 #ifdef HAVE_ELEMENTARY_X
91 static void _elm_win_xwin_update(Elm_Win *win);
93 static void _elm_win_eval_subobjs(Evas_Object *obj);
94 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
95 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
96 static void _elm_win_focus_highlight_init(Elm_Win *win);
97 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
98 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
99 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
100 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
101 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
102 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
104 static void _elm_win_frame_add(Elm_Win *win, const char *style);
105 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
106 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
107 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
108 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
109 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
111 //static void _elm_win_pointer_add(Elm_Win *win, const char *style);
113 static const char SIG_DELETE_REQUEST[] = "delete,request";
114 static const char SIG_FOCUS_OUT[] = "focus,out";
115 static const char SIG_FOCUS_IN[] = "focus,in";
116 static const char SIG_MOVED[] = "moved";
117 static const char SIG_THEME_CHANGED[] = "theme,changed";
118 static const char SIG_WITHDRAWN[] = "withdrawn";
119 static const char SIG_ICONIFIED[] = "iconified";
120 static const char SIG_NORMAL[] = "normal";
121 static const char SIG_STICK[] = "stick";
122 static const char SIG_UNSTICK[] = "unstick";
123 static const char SIG_FULLSCREEN[] = "fullscreen";
124 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
125 static const char SIG_MAXIMIZED[] = "maximized";
126 static const char SIG_UNMAXIMIZED[] = "unmaximized";
128 static const Evas_Smart_Cb_Description _signals[] = {
129 {SIG_DELETE_REQUEST, ""},
138 {SIG_FULLSCREEN, ""},
139 {SIG_UNFULLSCREEN, ""},
141 {SIG_UNMAXIMIZED, ""},
147 Eina_List *_elm_win_list = NULL;
148 int _elm_win_deferred_free = 0;
150 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
151 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
154 _shot_delay_get(Elm_Win *win)
157 char *d = strdup(win->shot.info);
160 for (p = (char *)win->shot.info; *p; p++)
162 if (!strncmp(p, "delay=", 6))
166 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
181 _shot_file_get(Elm_Win *win)
184 char *tmp = strdup(win->shot.info);
185 char *repname = NULL;
187 if (!tmp) return NULL;
189 for (p = (char *)win->shot.info; *p; p++)
191 if (!strncmp(p, "file=", 5))
194 if (!win->shot.repeat_count) return tmp;
197 char *dotptr = strrchr(tmp, '.');
200 size_t size = sizeof(char)*(strlen(tmp) + 16);
201 repname = malloc(size);
202 strncpy(repname, tmp, dotptr - tmp);
203 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
204 win->shot.shot_counter + 1);
205 strcat(repname, dotptr);
213 if (!win->shot.repeat_count) return strdup("out.png");
215 repname = malloc(sizeof(char) * 24);
216 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
221 _shot_repeat_count_get(Elm_Win *win)
224 char *d = strdup(win->shot.info);
227 for (p = (char *)win->shot.info; *p; p++)
229 if (!strncmp(p, "repeat=", 7))
233 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
240 if (v > 1000) v = 999;
250 _shot_key_get(Elm_Win *win __UNUSED__)
256 _shot_flags_get(Elm_Win *win __UNUSED__)
262 _shot_do(Elm_Win *win)
266 unsigned int *pixels;
268 char *file, *key, *flags;
270 ecore_evas_manual_render(win->ee);
271 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
273 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
274 if ((w < 1) || (h < 1)) return;
275 file = _shot_file_get(win);
277 key = _shot_key_get(win);
278 flags = _shot_flags_get(win);
279 ee = ecore_evas_buffer_new(1, 1);
280 o = evas_object_image_add(ecore_evas_get(ee));
281 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
282 evas_object_image_size_set(o, w, h);
283 evas_object_image_data_set(o, pixels);
284 if (!evas_object_image_save(o, file, key, flags))
286 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
291 if (flags) free(flags);
293 if (win->shot.repeat_count) win->shot.shot_counter++;
297 _shot_delay(void *data)
301 if (win->shot.repeat_count)
303 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
304 if (remainshot > 0) return EINA_TRUE;
306 win->shot.timer = NULL;
312 _shot_init(Elm_Win *win)
314 if (!win->shot.info) return;
315 win->shot.repeat_count = _shot_repeat_count_get(win);
316 win->shot.shot_counter = 0;
320 _shot_handle(Elm_Win *win)
322 if (!win->shot.info) return;
323 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
327 _elm_win_move(Ecore_Evas *ee)
329 Evas_Object *obj = ecore_evas_object_associate_get(ee);
334 win = elm_widget_data_get(obj);
336 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
339 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
343 _elm_win_resize(Ecore_Evas *ee)
345 Evas_Object *obj = ecore_evas_object_associate_get(ee);
349 win = elm_widget_data_get(obj);
351 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
352 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
356 _elm_win_mouse_in(Ecore_Evas *ee)
361 if (!(obj = ecore_evas_object_associate_get(ee))) return;
362 if (!(win = elm_widget_data_get(obj))) return;
363 if (win->resizing) win->resizing = EINA_FALSE;
367 _elm_win_focus_in(Ecore_Evas *ee)
369 Evas_Object *obj = ecore_evas_object_associate_get(ee);
373 win = elm_widget_data_get(obj);
375 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
376 if (!elm_widget_focus_order_get(obj))
378 elm_widget_focus_steal(win->win_obj);
382 elm_widget_focus_restore(win->win_obj);
383 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
384 win->focus_highlight.cur.visible = EINA_TRUE;
385 _elm_win_focus_highlight_reconfigure_job_start(win);
388 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
390 else if (win->img_obj)
397 _elm_win_focus_out(Ecore_Evas *ee)
399 Evas_Object *obj = ecore_evas_object_associate_get(ee);
403 win = elm_widget_data_get(obj);
405 elm_object_focus_set(win->win_obj, EINA_FALSE);
406 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
407 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
408 win->focus_highlight.cur.visible = EINA_FALSE;
409 _elm_win_focus_highlight_reconfigure_job_start(win);
412 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
414 else if (win->img_obj)
421 _elm_win_state_change(Ecore_Evas *ee)
425 Eina_Bool ch_withdrawn = EINA_FALSE;
426 Eina_Bool ch_sticky = EINA_FALSE;
427 Eina_Bool ch_iconified = EINA_FALSE;
428 Eina_Bool ch_fullscreen = EINA_FALSE;
429 Eina_Bool ch_maximized = EINA_FALSE;
431 if (!(obj = ecore_evas_object_associate_get(ee))) return;
433 if (!(win = elm_widget_data_get(obj))) return;
435 if (win->withdrawn != ecore_evas_withdrawn_get(win->ee))
437 win->withdrawn = ecore_evas_withdrawn_get(win->ee);
438 ch_withdrawn = EINA_TRUE;
440 if (win->sticky != ecore_evas_sticky_get(win->ee))
442 win->sticky = ecore_evas_sticky_get(win->ee);
443 ch_sticky = EINA_TRUE;
445 if (win->iconified != ecore_evas_iconified_get(win->ee))
447 win->iconified = ecore_evas_iconified_get(win->ee);
448 ch_iconified = EINA_TRUE;
450 if (win->fullscreen != ecore_evas_fullscreen_get(win->ee))
452 win->fullscreen = ecore_evas_fullscreen_get(win->ee);
453 ch_fullscreen = EINA_TRUE;
455 if (win->maximized != ecore_evas_maximized_get(win->ee))
457 win->maximized = ecore_evas_maximized_get(win->ee);
458 ch_maximized = EINA_TRUE;
460 if ((ch_withdrawn) || (ch_iconified))
463 evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL);
464 else if (win->iconified)
465 evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL);
467 evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL);
472 evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL);
474 evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL);
479 evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL);
481 evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL);
486 evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL);
488 evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL);
493 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
495 Elm_Win *wd = elm_widget_data_get(obj);
496 const Eina_List *items;
497 void *(*list_data_get) (const Eina_List *list);
505 if (!(items = elm_widget_focus_custom_chain_get(obj)))
511 list_data_get = eina_list_data_get;
513 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
519 *next = (Evas_Object *)obj;
524 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
526 Elm_Win *win = elm_widget_data_get(obj);
530 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
532 evas_object_focus_set(obj, elm_widget_focus_get(obj));
536 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
538 if (type == EVAS_CALLBACK_KEY_DOWN)
540 Evas_Event_Key_Down *ev = event_info;
541 if (!strcmp(ev->keyname, "Tab"))
543 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
544 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
546 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
547 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
550 else if ((!strcmp(ev->keyname, "Left")) ||
551 (!strcmp(ev->keyname, "KP_Left")))
553 //TODO : woohyun jung
555 else if ((!strcmp(ev->keyname, "Right")) ||
556 (!strcmp(ev->keyname, "KP_Right")))
558 //TODO : woohyun jung
560 else if ((!strcmp(ev->keyname, "Up")) ||
561 (!strcmp(ev->keyname, "KP_Up")))
563 //TODO : woohyun jung
565 else if ((!strcmp(ev->keyname, "Down")) ||
566 (!strcmp(ev->keyname, "KP_Down")))
568 //TODO : woohyun jung
576 _deferred_ecore_evas_free(void *data)
578 ecore_evas_free(data);
579 _elm_win_deferred_free--;
583 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
587 if (!win->show_count) win->show_count++;
588 if (win->shot.info) _shot_handle(win);
592 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
598 evas_object_hide(win->frame_obj);
600 else if (win->img_obj)
602 evas_object_hide(win->img_obj);
604 if (win->pointer.obj)
606 evas_object_hide(win->pointer.obj);
607 ecore_evas_hide(win->pointer.ee);
612 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
619 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
620 _elm_win_obj_callback_parent_del, win);
623 if (win->autodel_clear) *(win->autodel_clear) = -1;
624 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
625 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
628 ecore_evas_callback_delete_request_set(win->ee, NULL);
629 ecore_evas_callback_resize_set(win->ee, NULL);
631 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
632 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
633 if (win->shot.info) eina_stringshare_del(win->shot.info);
634 if (win->shot.timer) ecore_timer_del(win->shot.timer);
635 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
636 _elm_win_obj_callback_del, win);
637 while (((child = evas_object_bottom_get(win->evas))) &&
640 evas_object_del(child);
642 while (((child = evas_object_top_get(win->evas))) &&
645 evas_object_del(child);
647 #ifdef HAVE_ELEMENTARY_X
648 if (win->client_message_handler)
649 ecore_event_handler_del(win->client_message_handler);
651 // FIXME: Why are we flushing edje on every window destroy ??
652 // edje_file_cache_flush();
653 // edje_collection_cache_flush();
654 // evas_image_cache_flush(win->evas);
655 // evas_font_cache_flush(win->evas);
656 // FIXME: we are in the del handler for the object and delete the canvas
657 // that lives under it from the handler... nasty. deferring doesn't help either
667 ecore_job_add(_deferred_ecore_evas_free, win->ee);
668 _elm_win_deferred_free++;
672 _elm_win_focus_highlight_shutdown(win);
673 eina_stringshare_del(win->focus_highlight.style);
675 if (win->title) eina_stringshare_del(win->title);
676 if (win->icon_name) eina_stringshare_del(win->icon_name);
677 if (win->role) eina_stringshare_del(win->role);
678 if (win->icon) evas_object_del(win->icon);
682 if ((!_elm_win_list) &&
683 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
685 edje_file_cache_flush();
686 edje_collection_cache_flush();
687 evas_image_cache_flush(e);
688 evas_font_cache_flush(e);
694 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
697 if (!win->img_obj) return;
698 evas_object_event_callback_del_full
699 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
700 evas_object_del(win->img_obj);
704 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
707 if (obj == win->parent) win->parent = NULL;
711 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
717 if ((x != win->screen.x) || (y != win->screen.y))
721 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
726 evas_object_move(obj, x, y);
731 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
734 // this is called to make sure all smart containers have calculated their
735 // sizes BEFORE we show the window to make sure it initially appears at
736 // our desired size (ie min size is known first)
737 evas_smart_objects_calculate(evas_object_evas_get(obj));
740 evas_object_show(win->frame_obj);
742 else if (win->img_obj)
744 evas_object_show(win->img_obj);
746 if (win->pointer.obj)
748 ecore_evas_show(win->pointer.ee);
749 evas_object_show(win->pointer.obj);
750 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
752 evas_object_show(obj);
756 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
760 if (ecore_evas_override_get(win->ee))
764 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
767 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
773 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
777 else if (win->img_obj)
781 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
784 // evas_object_move(win->img_obj, x, y);
789 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
796 else if (win->img_obj)
798 Evas_Coord w = 1, h = 1;
800 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
804 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
810 evas_object_image_size_set(win->img_obj, w, h);
815 _elm_win_delete_request(Ecore_Evas *ee)
817 Evas_Object *obj = ecore_evas_object_associate_get(ee);
819 if (strcmp(elm_widget_type_get(obj), "win")) return;
821 win = elm_widget_data_get(obj);
823 int autodel = win->autodel;
824 win->autodel_clear = &autodel;
825 evas_object_ref(win->win_obj);
826 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
827 // FIXME: if above callback deletes - then the below will be invalid
828 if (autodel) evas_object_del(win->win_obj);
829 else win->autodel_clear = NULL;
830 evas_object_unref(win->win_obj);
834 _elm_win_resize_job(void *data)
841 win->deferred_resize_job = NULL;
842 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
846 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
852 evas_object_resize(win->frame_obj, w, h);
854 else if (win->img_obj)
857 evas_object_resize(win->win_obj, w, h);
858 EINA_LIST_FOREACH(win->subobjs, l, obj)
860 evas_object_move(obj, 0, 0);
861 evas_object_resize(obj, w, h);
865 #ifdef HAVE_ELEMENTARY_X
867 _elm_win_xwindow_get(Elm_Win *win)
871 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
872 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
874 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
876 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
877 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
878 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
879 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
880 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
881 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
882 ENGINE_COMPARE(ELM_OPENGL_COCOA))
885 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
887 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
889 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
891 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
894 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
896 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
899 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
901 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
903 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
905 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
907 #undef ENGINE_COMPARE
911 #ifdef HAVE_ELEMENTARY_X
913 _elm_win_xwin_update(Elm_Win *win)
917 _elm_win_xwindow_get(win);
922 win2 = elm_widget_data_get(win->parent);
926 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
930 if (!win->xwin) return; /* nothing more to do */
933 if (!s) s = _elm_appname;
935 if (win->icon_name) s = win->icon_name;
936 ecore_x_icccm_icon_name_set(win->xwin, s);
937 ecore_x_netwm_icon_name_set(win->xwin, s);
940 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
947 data = evas_object_image_data_get(win->icon, EINA_FALSE);
951 int w = 0, h = 0, stride, x, y;
955 evas_object_image_size_get(win->icon, &w, &h);
956 stride = evas_object_image_stride_get(win->icon);
957 if ((w > 0) && (h > 0) &&
958 (stride >= (int)(w * sizeof(unsigned int))))
962 ic.data = malloc(w * h * sizeof(unsigned int));
966 p = (unsigned char *)data;
967 p2 = (unsigned int *)ic.data;
968 for (y = 0; y < h; y++)
970 for (x = 0; x < w; x++)
972 *p2 = *((unsigned int *)p);
973 p += sizeof(unsigned int);
976 p += (stride - (w * sizeof(unsigned int)));
978 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
982 evas_object_image_data_set(win->icon, data);
989 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
991 case ELM_WIN_DIALOG_BASIC:
992 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
994 case ELM_WIN_DESKTOP:
995 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
998 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
1000 case ELM_WIN_TOOLBAR:
1001 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1004 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1006 case ELM_WIN_UTILITY:
1007 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1009 case ELM_WIN_SPLASH:
1010 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1012 case ELM_WIN_DROPDOWN_MENU:
1013 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1015 case ELM_WIN_POPUP_MENU:
1016 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1018 case ELM_WIN_TOOLTIP:
1019 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1021 case ELM_WIN_NOTIFICATION:
1022 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1025 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1028 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1033 ecore_x_e_virtual_keyboard_state_set
1034 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1035 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
1036 ecore_x_e_illume_indicator_state_set
1037 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1038 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
1039 ecore_x_e_illume_indicator_state_set
1040 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1045 _elm_win_eval_subobjs(Evas_Object *obj)
1048 const Evas_Object *child;
1050 Elm_Win *win = elm_widget_data_get(obj);
1051 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1055 EINA_LIST_FOREACH(win->subobjs, l, child)
1057 evas_object_size_hint_weight_get(child, &wx, &wy);
1058 if (wx == 0.0) xx = 0;
1059 if (wy == 0.0) xy = 0;
1061 evas_object_size_hint_min_get(child, &w, &h);
1064 if (w > minw) minw = w;
1065 if (h > minh) minh = h;
1067 evas_object_size_hint_max_get(child, &w, &h);
1070 if (maxw == -1) maxw = w;
1071 else if ((w > 0) && (w < maxw)) maxw = w;
1072 if (maxh == -1) maxh = h;
1073 else if ((h > 0) && (h < maxh)) maxh = h;
1075 if (!xx) maxw = minw;
1077 if (!xy) maxh = minh;
1079 evas_object_size_hint_min_set(obj, minw, minh);
1080 evas_object_size_hint_max_set(obj, maxw, maxh);
1081 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1082 if (w < minw) w = minw;
1083 if (h < minh) h = minh;
1084 if ((maxw >= 0) && (w > maxw)) w = maxw;
1085 if ((maxh >= 0) && (h > maxh)) h = maxh;
1086 evas_object_resize(obj, w, h);
1090 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1092 Elm_Win *win = elm_widget_data_get(data);
1093 win->subobjs = eina_list_remove(win->subobjs, obj);
1094 _elm_win_eval_subobjs(win->win_obj);
1098 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1100 _elm_win_eval_subobjs(data);
1104 _elm_win_shutdown(void)
1106 while (_elm_win_list)
1107 evas_object_del(_elm_win_list->data);
1111 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1118 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1119 elm_widget_theme(obj);
1123 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1124 elm_widget_theme_specific(obj, th, EINA_FALSE);
1129 _elm_win_translate(void)
1134 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1135 elm_widget_translate(obj);
1138 #ifdef HAVE_ELEMENTARY_X
1140 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1142 Elm_Win *win = data;
1143 Ecore_X_Event_Client_Message *e = event;
1145 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1146 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1148 if ((unsigned)e->data.l[0] == win->xwin)
1150 Evas *evas = evas_object_evas_get(win->win_obj);
1153 edje_file_cache_flush();
1154 edje_collection_cache_flush();
1155 evas_image_cache_flush(evas);
1156 evas_font_cache_flush(evas);
1160 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1162 if ((unsigned)e->data.l[0] == win->xwin)
1164 Evas *evas = evas_object_evas_get(win->win_obj);
1167 edje_file_cache_flush();
1168 edje_collection_cache_flush();
1169 evas_image_cache_flush(evas);
1170 evas_font_cache_flush(evas);
1171 evas_render_dump(evas);
1175 return ECORE_CALLBACK_PASS_ON;
1180 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1182 Elm_Win *win = data;
1184 win->focus_highlight.geometry_changed = EINA_TRUE;
1185 _elm_win_focus_highlight_reconfigure_job_start(win);
1189 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1191 Elm_Win *win = data;
1193 win->focus_highlight.geometry_changed = EINA_TRUE;
1194 _elm_win_focus_highlight_reconfigure_job_start(win);
1198 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1200 Elm_Win *win = data;
1202 win->focus_highlight.cur.target = NULL;
1204 _elm_win_focus_highlight_reconfigure_job_start(win);
1208 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1210 Evas_Object *obj = win->focus_highlight.cur.target;
1212 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1213 _elm_win_focus_target_move, win);
1214 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1215 _elm_win_focus_target_resize, win);
1216 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1217 _elm_win_focus_target_del, win);
1221 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1223 Evas_Object *obj = win->focus_highlight.cur.target;
1225 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1226 _elm_win_focus_target_move, win);
1227 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1228 _elm_win_focus_target_resize, win);
1229 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1230 _elm_win_focus_target_del, win);
1233 static Evas_Object *
1234 _elm_win_focus_target_get(Evas_Object *obj)
1236 Evas_Object *o = obj;
1240 if (elm_widget_is(o))
1242 if (!elm_widget_highlight_ignore_get(o))
1244 o = elm_widget_parent_get(o);
1246 o = evas_object_smart_parent_get(o);
1250 o = elm_widget_parent_widget_get(o);
1252 o = evas_object_smart_parent_get(o);
1261 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1263 Evas_Object *obj = event_info, *target;
1264 Elm_Win *win = data;
1266 if (win->focus_highlight.cur.target == obj)
1269 target = _elm_win_focus_target_get(obj);
1270 win->focus_highlight.cur.target = target;
1271 if (elm_widget_highlight_in_theme_get(target))
1272 win->focus_highlight.cur.handled = EINA_TRUE;
1274 _elm_win_focus_target_callbacks_add(win);
1276 _elm_win_focus_highlight_reconfigure_job_start(win);
1280 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1282 Elm_Win *win = data;
1284 if (!win->focus_highlight.cur.target)
1287 if (!win->focus_highlight.cur.handled)
1288 _elm_win_focus_target_callbacks_del(win);
1289 win->focus_highlight.cur.target = NULL;
1290 win->focus_highlight.cur.handled = EINA_FALSE;
1292 _elm_win_focus_highlight_reconfigure_job_start(win);
1296 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1298 evas_object_hide(obj);
1302 _elm_win_focus_highlight_init(Elm_Win *win)
1304 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1305 _elm_win_object_focus_in, win);
1306 evas_event_callback_add(win->evas,
1307 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1308 _elm_win_object_focus_out, win);
1310 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1312 win->focus_highlight.top = edje_object_add(win->evas);
1313 win->focus_highlight.changed_theme = EINA_TRUE;
1314 edje_object_signal_callback_add(win->focus_highlight.top,
1315 "elm,action,focus,hide,end", "",
1316 _elm_win_focus_highlight_hide, NULL);
1317 edje_object_signal_callback_add(win->focus_highlight.top,
1318 "elm,action,focus,anim,end", "",
1319 _elm_win_focus_highlight_anim_end, win);
1320 _elm_win_focus_highlight_reconfigure_job_start(win);
1324 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1326 _elm_win_focus_highlight_reconfigure_job_stop(win);
1327 if (win->focus_highlight.cur.target)
1329 _elm_win_focus_target_callbacks_del(win);
1330 win->focus_highlight.cur.target = NULL;
1332 if (win->focus_highlight.top)
1334 evas_object_del(win->focus_highlight.top);
1335 win->focus_highlight.top = NULL;
1338 evas_event_callback_del_full(win->evas,
1339 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1340 _elm_win_object_focus_in, win);
1341 evas_event_callback_del_full(win->evas,
1342 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1343 _elm_win_object_focus_out, win);
1347 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1351 top = win->focus_highlight.top;
1356 evas_object_show(top);
1357 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1363 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1368 _elm_win_focus_highlight_reconfigure_job(void *data)
1370 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1374 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1376 if (win->focus_highlight.reconf_job)
1377 ecore_job_del(win->focus_highlight.reconf_job);
1378 win->focus_highlight.reconf_job = ecore_job_add(
1379 _elm_win_focus_highlight_reconfigure_job, win);
1383 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1385 if (win->focus_highlight.reconf_job)
1386 ecore_job_del(win->focus_highlight.reconf_job);
1387 win->focus_highlight.reconf_job = NULL;
1391 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1393 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1394 Evas_Coord x, y, w, h;
1396 clip = evas_object_clip_get(target);
1397 evas_object_geometry_get(target, &x, &y, &w, &h);
1399 evas_object_move(obj, x, y);
1400 evas_object_resize(obj, w, h);
1401 evas_object_clip_set(obj, clip);
1405 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1407 Evas_Coord tx, ty, tw, th;
1408 Evas_Coord w, h, px, py, pw, ph;
1409 Edje_Message_Int_Set *m;
1410 Evas_Object *previous = win->focus_highlight.prev.target;
1411 Evas_Object *target = win->focus_highlight.cur.target;
1413 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1414 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1415 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1416 evas_object_move(obj, 0, 0);
1417 evas_object_resize(obj, tw, th);
1418 evas_object_clip_unset(obj);
1420 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1430 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1434 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1436 Elm_Win *win = data;
1437 _elm_win_focus_highlight_simple_setup(win, obj);
1441 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1443 Evas_Object *target = win->focus_highlight.cur.target;
1444 Evas_Object *previous = win->focus_highlight.prev.target;
1445 Evas_Object *top = win->focus_highlight.top;
1446 Eina_Bool visible_changed;
1447 Eina_Bool common_visible;
1448 const char *sig = NULL;
1450 _elm_win_focus_highlight_reconfigure_job_stop(win);
1452 visible_changed = (win->focus_highlight.cur.visible !=
1453 win->focus_highlight.prev.visible);
1455 if ((target == previous) && (!visible_changed) &&
1456 (!win->focus_highlight.geometry_changed))
1459 if ((previous) && (win->focus_highlight.prev.handled))
1460 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1463 common_visible = EINA_FALSE;
1464 else if (win->focus_highlight.cur.handled)
1466 common_visible = EINA_FALSE;
1467 if (win->focus_highlight.cur.visible)
1468 sig = "elm,action,focus_highlight,show";
1470 sig = "elm,action,focus_highlight,hide";
1473 common_visible = win->focus_highlight.cur.visible;
1475 _elm_win_focus_highlight_visible_set(win, common_visible);
1477 elm_widget_signal_emit(target, sig, "elm");
1479 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1482 if (win->focus_highlight.changed_theme)
1485 if (win->focus_highlight.style)
1486 str = win->focus_highlight.style;
1489 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1491 win->focus_highlight.changed_theme = EINA_FALSE;
1493 if (_elm_config->focus_highlight_animate)
1495 str = edje_object_data_get(win->focus_highlight.top, "animate");
1496 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1500 if ((win->focus_highlight.top_animate) && (previous) &&
1501 (!win->focus_highlight.prev.handled))
1502 _elm_win_focus_highlight_anim_setup(win, top);
1504 _elm_win_focus_highlight_simple_setup(win, top);
1505 evas_object_raise(top);
1508 win->focus_highlight.geometry_changed = EINA_FALSE;
1509 win->focus_highlight.prev = win->focus_highlight.cur;
1513 _elm_win_frame_add(Elm_Win *win, const char *style)
1515 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1517 win->frame_obj = edje_object_add(win->evas);
1518 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1519 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1520 evas_object_move(win->frame_obj, 0, 0);
1521 evas_object_resize(win->frame_obj, 1, 1);
1523 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1524 "elm", _elm_win_frame_cb_move_start, win);
1525 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1526 "*", _elm_win_frame_cb_resize_start, win);
1527 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1528 "elm", _elm_win_frame_cb_minimize, win);
1529 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1530 "elm", _elm_win_frame_cb_maximize, win);
1531 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1532 "elm", _elm_win_frame_cb_close, win);
1536 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1540 if (!(win = data)) return;
1541 /* FIXME: Change mouse pointer */
1543 /* NB: 0,0 are dummy values. Wayland handles the move by itself */
1544 ecore_evas_move(win->ee, 0, 0);
1548 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1552 if (!(win = data)) return;
1553 if (win->resizing) return;
1554 win->resizing = EINA_TRUE;
1556 /* FIXME: Change mouse pointer */
1558 if (!strcmp(source, "elm.event.resize.t"))
1559 win->resize_location = 1;
1560 else if (!strcmp(source, "elm.event.resize.b"))
1561 win->resize_location = 2;
1562 else if (!strcmp(source, "elm.event.resize.l"))
1563 win->resize_location = 4;
1564 else if (!strcmp(source, "elm.event.resize.r"))
1565 win->resize_location = 8;
1566 else if (!strcmp(source, "elm.event.resize.tl"))
1567 win->resize_location = 5;
1568 else if (!strcmp(source, "elm.event.resize.tr"))
1569 win->resize_location = 9;
1570 else if (!strcmp(source, "elm.event.resize.bl"))
1571 win->resize_location = 6;
1572 else if (!strcmp(source, "elm.event.resize.br"))
1573 win->resize_location = 10;
1575 win->resize_location = 0;
1577 if (win->resize_location > 0)
1578 ecore_evas_wayland_resize(win->ee, win->resize_location);
1582 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1586 if (!(win = data)) return;
1587 win->iconified = EINA_TRUE;
1588 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1592 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1596 if (!(win = data)) return;
1597 if (win->maximized) win->maximized = EINA_FALSE;
1598 else win->maximized = EINA_TRUE;
1599 ecore_evas_maximized_set(win->ee, win->maximized);
1603 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1607 if (!(win = data)) return;
1608 evas_object_del(win->win_obj);
1613 _elm_win_pointer_add(Elm_Win *win, const char *style)
1619 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1620 ecore_evas_resize(win->pointer.ee, 32, 32);
1622 win->pointer.evas = ecore_evas_get(win->ee);
1624 win->pointer.obj = edje_object_add(win->pointer.evas);
1625 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1626 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1627 evas_object_move(win->pointer.obj, 0, 0);
1628 evas_object_resize(win->pointer.obj, 32, 32);
1629 evas_object_show(win->pointer.obj);
1635 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1637 Evas_Event_Key_Down *ev = event_info;
1639 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1642 if ((strcmp(ev->keyname, "F12")) ||
1643 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1646 printf("Tree graph generated.\n");
1647 elm_object_tree_dot_dump(obj, "./dump.dot");
1652 _win_img_hide(void *data,
1654 Evas_Object *obj __UNUSED__,
1655 void *event_info __UNUSED__)
1657 Elm_Win *win = data;
1659 elm_widget_focus_hide_handle(win->win_obj);
1663 _win_img_mouse_up(void *data,
1665 Evas_Object *obj __UNUSED__,
1668 Elm_Win *win = data;
1669 Evas_Event_Mouse_Up *ev = event_info;
1670 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1671 elm_widget_focus_mouse_up_handle(win->win_obj);
1675 _win_img_focus_in(void *data,
1677 Evas_Object *obj __UNUSED__,
1678 void *event_info __UNUSED__)
1680 Elm_Win *win = data;
1681 elm_widget_focus_steal(win->win_obj);
1685 _win_img_focus_out(void *data,
1687 Evas_Object *obj __UNUSED__,
1688 void *event_info __UNUSED__)
1690 Elm_Win *win = data;
1691 elm_widget_focused_object_clear(win->win_obj);
1695 _win_inlined_image_set(Elm_Win *win)
1697 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1698 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1699 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1700 _elm_win_obj_callback_img_obj_del, win);
1702 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1703 _win_img_hide, win);
1704 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1705 _win_img_mouse_up, win);
1706 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1707 _win_img_focus_in, win);
1708 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1709 _win_img_focus_out, win);
1713 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1715 evas_object_event_callback_del_full(subobj,
1716 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1717 _elm_win_subobj_callback_changed_size_hints,
1719 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1720 _elm_win_subobj_callback_del, obj);
1721 win->subobjs = eina_list_remove(win->subobjs, subobj);
1722 _elm_win_eval_subobjs(obj);
1726 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1728 Elm_Win *win = data;
1729 if (win->icon == obj) win->icon = NULL;
1733 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1737 const char *fontpath;
1739 win = ELM_NEW(Elm_Win);
1741 #define FALLBACK_TRY(engine) \
1744 CRITICAL(engine " engine creation failed. Trying default."); \
1745 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1747 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
1749 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
1751 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
1752 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
1756 case ELM_WIN_INLINED_IMAGE:
1759 Evas *e = evas_object_evas_get(parent);
1762 ee = ecore_evas_ecore_evas_get(e);
1764 win->img_obj = ecore_evas_object_image_new(ee);
1765 if (!win->img_obj) break;
1766 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1769 _win_inlined_image_set(win);
1772 evas_object_del(win->img_obj);
1773 win->img_obj = NULL;
1777 case ELM_WIN_SOCKET_IMAGE:
1778 win->ee = ecore_evas_extn_socket_new(1, 1);
1782 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1784 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1785 #ifdef HAVE_ELEMENTARY_X
1786 win->client_message_handler = ecore_event_handler_add
1787 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1789 FALLBACK_TRY("Sofware X11");
1791 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1793 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1794 FALLBACK_TRY("Sofware FB");
1796 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1798 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1799 FALLBACK_TRY("Sofware DirectFB");
1801 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1803 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1804 FALLBACK_TRY("Sofware-16");
1805 #ifdef HAVE_ELEMENTARY_X
1806 win->client_message_handler = ecore_event_handler_add
1807 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1810 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1812 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1813 FALLBACK_TRY("Sofware-8");
1814 #ifdef HAVE_ELEMENTARY_X
1815 win->client_message_handler = ecore_event_handler_add
1816 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1820 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1822 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1823 FALLBACK_TRY("XRender");
1824 #ifdef HAVE_ELEMENTARY_X
1825 win->client_message_handler = ecore_event_handler_add
1826 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1830 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1835 if (_elm_config->vsync)
1837 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1843 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1845 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1846 FALLBACK_TRY("OpenGL");
1847 #ifdef HAVE_ELEMENTARY_X
1848 win->client_message_handler = ecore_event_handler_add
1849 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1852 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1854 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1855 FALLBACK_TRY("Sofware Win32");
1857 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1859 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1860 FALLBACK_TRY("Sofware-16-WinCE");
1862 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1864 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1865 FALLBACK_TRY("PSL1GHT");
1867 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1869 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1870 FALLBACK_TRY("Sofware SDL");
1872 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1874 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1875 FALLBACK_TRY("Sofware-16-SDL");
1877 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1879 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1880 FALLBACK_TRY("OpenGL SDL");
1882 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1884 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1885 FALLBACK_TRY("OpenGL Cocoa");
1887 else if (ENGINE_COMPARE(ELM_BUFFER))
1889 win->ee = ecore_evas_buffer_new(1, 1);
1891 else if (ENGINE_COMPARE(ELM_EWS))
1893 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1895 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1897 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
1898 win->evas = ecore_evas_get(win->ee);
1900 _elm_win_frame_add(win, "default");
1901 // _elm_win_pointer_add(win, "default");
1903 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
1905 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
1906 win->evas = ecore_evas_get(win->ee);
1908 _elm_win_frame_add(win, "default");
1909 // _elm_win_pointer_add(win, "default");
1911 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
1913 win->ee = ecore_evas_buffer_new(1, 1);
1914 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1915 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
1924 ERR("Cannot create window.");
1928 #ifdef HAVE_ELEMENTARY_X
1929 _elm_win_xwindow_get(win);
1931 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1932 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1933 // bg pixmap done by x - has other issues like can be redrawn by x before it
1934 // is filled/ready by app
1935 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1938 win->parent = parent;
1940 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1941 _elm_win_obj_callback_parent_del, win);
1943 win->evas = ecore_evas_get(win->ee);
1944 win->win_obj = elm_widget_add(win->evas);
1945 elm_widget_type_set(win->win_obj, "win");
1946 ELM_SET_WIDTYPE(widtype, "win");
1947 elm_widget_data_set(win->win_obj, win);
1948 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1949 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1950 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1951 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1952 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1953 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1954 evas_object_move(win->win_obj, 0, 0);
1955 evas_object_resize(win->win_obj, 1, 1);
1956 evas_object_layer_set(win->win_obj, 50);
1957 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1961 evas_object_clip_set(win->win_obj, win->frame_obj);
1962 evas_object_stack_below(win->frame_obj, win->win_obj);
1965 if (type == ELM_WIN_INLINED_IMAGE)
1966 elm_widget_parent2_set(win->win_obj, parent);
1967 ecore_evas_object_associate(win->ee, win->win_obj,
1968 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1969 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1970 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1971 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1972 _elm_win_obj_callback_show, win);
1973 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1974 _elm_win_obj_callback_hide, win);
1975 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1976 _elm_win_obj_callback_del, win);
1977 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1978 _elm_win_obj_callback_move, win);
1979 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1980 _elm_win_obj_callback_resize, win);
1982 evas_object_intercept_move_callback_add(win->win_obj,
1983 _elm_win_obj_intercept_move, win);
1984 evas_object_intercept_show_callback_add(win->win_obj,
1985 _elm_win_obj_intercept_show, win);
1987 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
1988 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1989 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1990 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1991 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
1992 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1993 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1994 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1995 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
1996 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1997 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1998 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1999 evas_font_path_append(win->evas, fontpath);
2000 if (!_elm_config->font_hinting)
2001 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2002 else if (_elm_config->font_hinting == 1)
2003 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2004 else if (_elm_config->font_hinting == 2)
2005 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2007 #ifdef HAVE_ELEMENTARY_X
2008 _elm_win_xwin_update(win);
2011 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2013 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2015 ecore_evas_fullscreen_set(win->ee, 1);
2017 #undef ENGINE_COMPARE
2019 if (_elm_config->focus_highlight_enable)
2020 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2023 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2024 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2025 _debug_key_down, win);
2027 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2029 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2032 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2034 return win->win_obj;
2038 elm_win_util_standard_add(const char *name, const char *title)
2040 Evas_Object *win, *bg;
2042 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2043 if (!win) return NULL;
2044 elm_win_title_set(win, title);
2045 bg = elm_bg_add(win);
2048 evas_object_del(win);
2051 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2052 elm_win_resize_object_add(win, bg);
2053 evas_object_show(bg);
2058 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2062 ELM_CHECK_WIDTYPE(obj, widtype);
2063 win = elm_widget_data_get(obj);
2065 if (eina_list_data_find(win->subobjs, subobj)) return;
2066 win->subobjs = eina_list_append(win->subobjs, subobj);
2067 elm_widget_sub_object_add(obj, subobj);
2068 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2069 _elm_win_subobj_callback_del, obj);
2070 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2071 _elm_win_subobj_callback_changed_size_hints,
2073 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2074 evas_object_move(subobj, 0, 0);
2075 evas_object_resize(subobj, w, h);
2076 _elm_win_eval_subobjs(obj);
2080 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2083 ELM_CHECK_WIDTYPE(obj, widtype);
2084 win = elm_widget_data_get(obj);
2086 evas_object_event_callback_del_full(subobj,
2087 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2088 _elm_win_subobj_callback_changed_size_hints,
2090 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2091 _elm_win_subobj_callback_del, obj);
2092 win->subobjs = eina_list_remove(win->subobjs, subobj);
2093 elm_widget_sub_object_del(obj, subobj);
2094 _elm_win_eval_subobjs(obj);
2098 elm_win_title_set(Evas_Object *obj, const char *title)
2101 ELM_CHECK_WIDTYPE(obj, widtype);
2102 win = elm_widget_data_get(obj);
2103 if (!win || !title) return;
2104 eina_stringshare_replace(&(win->title), title);
2105 ecore_evas_title_set(win->ee, win->title);
2107 edje_object_part_text_set(win->frame_obj, "elm.text.title", win->title);
2111 elm_win_title_get(const Evas_Object *obj)
2114 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2115 win = elm_widget_data_get(obj);
2116 if (!win) return NULL;
2121 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2124 ELM_CHECK_WIDTYPE(obj, widtype);
2125 win = elm_widget_data_get(obj);
2126 if (!win || !icon_name) return;
2127 eina_stringshare_replace(&(win->icon_name), icon_name);
2128 #ifdef HAVE_ELEMENTARY_X
2129 _elm_win_xwin_update(win);
2134 elm_win_icon_name_get(const Evas_Object *obj)
2137 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2138 win = elm_widget_data_get(obj);
2139 if (!win) return NULL;
2140 return win->icon_name;
2144 elm_win_role_set(Evas_Object *obj, const char *role)
2147 ELM_CHECK_WIDTYPE(obj, widtype);
2148 win = elm_widget_data_get(obj);
2149 if (!win || !role) return;
2150 eina_stringshare_replace(&(win->role), role);
2151 #ifdef HAVE_ELEMENTARY_X
2152 _elm_win_xwin_update(win);
2157 elm_win_role_get(const Evas_Object *obj)
2160 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2161 win = elm_widget_data_get(obj);
2162 if (!win) return NULL;
2167 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2170 ELM_CHECK_WIDTYPE(obj, widtype);
2171 win = elm_widget_data_get(obj);
2174 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2175 _elm_win_obj_icon_callback_del, win);
2178 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2179 _elm_win_obj_icon_callback_del, win);
2180 #ifdef HAVE_ELEMENTARY_X
2181 _elm_win_xwin_update(win);
2185 EAPI const Evas_Object *
2186 elm_win_icon_object_get(const Evas_Object *obj)
2189 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2190 win = elm_widget_data_get(obj);
2191 if (!win) return NULL;
2196 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2199 ELM_CHECK_WIDTYPE(obj, widtype);
2200 win = elm_widget_data_get(obj);
2202 win->autodel = autodel;
2206 elm_win_autodel_get(const Evas_Object *obj)
2209 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2210 win = elm_widget_data_get(obj);
2211 if (!win) return EINA_FALSE;
2212 return win->autodel;
2216 elm_win_activate(Evas_Object *obj)
2219 ELM_CHECK_WIDTYPE(obj, widtype);
2220 win = elm_widget_data_get(obj);
2222 ecore_evas_activate(win->ee);
2226 elm_win_lower(Evas_Object *obj)
2229 ELM_CHECK_WIDTYPE(obj, widtype);
2230 win = elm_widget_data_get(obj);
2232 ecore_evas_lower(win->ee);
2236 elm_win_raise(Evas_Object *obj)
2239 ELM_CHECK_WIDTYPE(obj, widtype);
2240 win = elm_widget_data_get(obj);
2242 ecore_evas_raise(win->ee);
2246 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2249 int win_w, win_h, screen_w, screen_h, nx, ny;
2250 ELM_CHECK_WIDTYPE(obj, widtype);
2251 win = elm_widget_data_get(obj);
2253 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2254 if ((!screen_w) || (!screen_h)) return;
2255 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2256 if ((!win_w) || (!win_h)) return;
2257 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2258 else nx = win->screen.x;
2259 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2260 else ny = win->screen.y;
2263 evas_object_move(obj, nx, ny);
2267 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2270 ELM_CHECK_WIDTYPE(obj, widtype);
2271 win = elm_widget_data_get(obj);
2273 ecore_evas_borderless_set(win->ee, borderless);
2274 #ifdef HAVE_ELEMENTARY_X
2275 _elm_win_xwin_update(win);
2280 elm_win_borderless_get(const Evas_Object *obj)
2283 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2284 win = elm_widget_data_get(obj);
2285 if (!win) return EINA_FALSE;
2286 return ecore_evas_borderless_get(win->ee);
2290 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2293 ELM_CHECK_WIDTYPE(obj, widtype);
2294 win = elm_widget_data_get(obj);
2296 ecore_evas_shaped_set(win->ee, shaped);
2297 #ifdef HAVE_ELEMENTARY_X
2298 _elm_win_xwin_update(win);
2303 elm_win_shaped_get(const Evas_Object *obj)
2306 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2307 win = elm_widget_data_get(obj);
2308 if (!win) return EINA_FALSE;
2309 return ecore_evas_shaped_get(win->ee);
2313 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2316 ELM_CHECK_WIDTYPE(obj, widtype);
2317 win = elm_widget_data_get(obj);
2322 else if (win->img_obj)
2324 evas_object_image_alpha_set(win->img_obj, alpha);
2325 ecore_evas_alpha_set(win->ee, alpha);
2329 #ifdef HAVE_ELEMENTARY_X
2334 if (!_elm_config->compositing)
2335 elm_win_shaped_set(obj, alpha);
2337 ecore_evas_alpha_set(win->ee, alpha);
2340 ecore_evas_alpha_set(win->ee, alpha);
2341 _elm_win_xwin_update(win);
2345 ecore_evas_alpha_set(win->ee, alpha);
2350 elm_win_alpha_get(const Evas_Object *obj)
2353 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2354 win = elm_widget_data_get(obj);
2355 if (!win) return EINA_FALSE;
2359 else if (win->img_obj)
2361 return evas_object_image_alpha_get(win->img_obj);
2363 return ecore_evas_alpha_get(win->ee);
2366 EINA_DEPRECATED EAPI void
2367 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
2370 ELM_CHECK_WIDTYPE(obj, widtype);
2371 win = elm_widget_data_get(obj);
2377 else if (win->img_obj)
2379 evas_object_image_alpha_set(win->img_obj, transparent);
2383 #ifdef HAVE_ELEMENTARY_X
2386 ecore_evas_transparent_set(win->ee, transparent);
2387 _elm_win_xwin_update(win);
2391 ecore_evas_transparent_set(win->ee, transparent);
2395 EINA_DEPRECATED EAPI Eina_Bool
2396 elm_win_transparent_get(const Evas_Object *obj)
2399 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2400 win = elm_widget_data_get(obj);
2401 if (!win) return EINA_FALSE;
2403 return ecore_evas_transparent_get(win->ee);
2407 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2410 ELM_CHECK_WIDTYPE(obj, widtype);
2411 win = elm_widget_data_get(obj);
2413 ecore_evas_override_set(win->ee, override);
2414 #ifdef HAVE_ELEMENTARY_X
2415 _elm_win_xwin_update(win);
2420 elm_win_override_get(const Evas_Object *obj)
2423 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2424 win = elm_widget_data_get(obj);
2425 if (!win) return EINA_FALSE;
2426 return ecore_evas_override_get(win->ee);
2430 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2433 ELM_CHECK_WIDTYPE(obj, widtype);
2434 win = elm_widget_data_get(obj);
2436 // YYY: handle if win->img_obj
2437 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2438 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2439 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2441 // these engines... can ONLY be fullscreen
2446 win->fullscreen = fullscreen;
2447 ecore_evas_fullscreen_set(win->ee, fullscreen);
2448 #ifdef HAVE_ELEMENTARY_X
2449 _elm_win_xwin_update(win);
2452 #undef ENGINE_COMPARE
2456 elm_win_fullscreen_get(const Evas_Object *obj)
2459 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2460 win = elm_widget_data_get(obj);
2461 if (!win) return EINA_FALSE;
2462 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2463 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2464 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2466 // these engines... can ONLY be fullscreen
2471 return win->fullscreen;
2473 #undef ENGINE_COMPARE
2477 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2480 ELM_CHECK_WIDTYPE(obj, widtype);
2481 win = elm_widget_data_get(obj);
2483 win->maximized = maximized;
2484 // YYY: handle if win->img_obj
2485 ecore_evas_maximized_set(win->ee, maximized);
2486 #ifdef HAVE_ELEMENTARY_X
2487 _elm_win_xwin_update(win);
2492 elm_win_maximized_get(const Evas_Object *obj)
2495 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2496 win = elm_widget_data_get(obj);
2497 if (!win) return EINA_FALSE;
2498 return win->maximized;
2502 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2505 ELM_CHECK_WIDTYPE(obj, widtype);
2506 win = elm_widget_data_get(obj);
2508 win->iconified = iconified;
2509 ecore_evas_iconified_set(win->ee, iconified);
2510 #ifdef HAVE_ELEMENTARY_X
2511 _elm_win_xwin_update(win);
2516 elm_win_iconified_get(const Evas_Object *obj)
2519 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2520 win = elm_widget_data_get(obj);
2521 if (!win) return EINA_FALSE;
2522 return win->iconified;
2526 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2529 ELM_CHECK_WIDTYPE(obj, widtype);
2530 win = elm_widget_data_get(obj);
2532 win->withdrawn = withdrawn;
2533 ecore_evas_withdrawn_set(win->ee, withdrawn);
2534 #ifdef HAVE_ELEMENTARY_X
2535 _elm_win_xwin_update(win);
2540 elm_win_withdrawn_get(const Evas_Object *obj)
2543 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2544 win = elm_widget_data_get(obj);
2545 if (!win) return EINA_FALSE;
2546 return win->withdrawn;
2550 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2553 ELM_CHECK_WIDTYPE(obj, widtype);
2554 win = elm_widget_data_get(obj);
2556 win->urgent = urgent;
2557 ecore_evas_urgent_set(win->ee, urgent);
2558 #ifdef HAVE_ELEMENTARY_X
2559 _elm_win_xwin_update(win);
2564 elm_win_urgent_get(const Evas_Object *obj)
2567 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2568 win = elm_widget_data_get(obj);
2569 if (!win) return EINA_FALSE;
2574 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2577 ELM_CHECK_WIDTYPE(obj, widtype);
2578 win = elm_widget_data_get(obj);
2580 win->demand_attention = demand_attention;
2581 ecore_evas_demand_attention_set(win->ee, demand_attention);
2582 #ifdef HAVE_ELEMENTARY_X
2583 _elm_win_xwin_update(win);
2588 elm_win_demand_attention_get(const Evas_Object *obj)
2591 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2592 win = elm_widget_data_get(obj);
2593 if (!win) return EINA_FALSE;
2594 return win->demand_attention;
2598 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2601 ELM_CHECK_WIDTYPE(obj, widtype);
2602 win = elm_widget_data_get(obj);
2605 ecore_evas_modal_set(win->ee, modal);
2606 #ifdef HAVE_ELEMENTARY_X
2607 _elm_win_xwin_update(win);
2612 elm_win_modal_get(const Evas_Object *obj)
2615 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2616 win = elm_widget_data_get(obj);
2617 if (!win) return EINA_FALSE;
2622 elm_win_aspect_set(Evas_Object *obj, double aspect)
2625 ELM_CHECK_WIDTYPE(obj, widtype);
2626 win = elm_widget_data_get(obj);
2628 win->aspect = aspect;
2629 ecore_evas_aspect_set(win->ee, aspect);
2630 #ifdef HAVE_ELEMENTARY_X
2631 _elm_win_xwin_update(win);
2636 elm_win_aspect_get(const Evas_Object *obj)
2639 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2640 win = elm_widget_data_get(obj);
2641 if (!win) return EINA_FALSE;
2646 elm_win_layer_set(Evas_Object *obj, int layer)
2649 ELM_CHECK_WIDTYPE(obj, widtype);
2650 win = elm_widget_data_get(obj);
2652 ecore_evas_layer_set(win->ee, layer);
2653 #ifdef HAVE_ELEMENTARY_X
2654 _elm_win_xwin_update(win);
2659 elm_win_layer_get(const Evas_Object *obj)
2662 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2663 win = elm_widget_data_get(obj);
2664 if (!win) return -1;
2665 return ecore_evas_layer_get(win->ee);
2669 elm_win_rotation_set(Evas_Object *obj, int rotation)
2672 ELM_CHECK_WIDTYPE(obj, widtype);
2673 win = elm_widget_data_get(obj);
2675 if (win->rot == rotation) return;
2676 win->rot = rotation;
2677 ecore_evas_rotation_set(win->ee, rotation);
2678 evas_object_size_hint_min_set(obj, -1, -1);
2679 evas_object_size_hint_max_set(obj, -1, -1);
2680 _elm_win_eval_subobjs(obj);
2681 #ifdef HAVE_ELEMENTARY_X
2682 _elm_win_xwin_update(win);
2687 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2690 ELM_CHECK_WIDTYPE(obj, widtype);
2691 win = elm_widget_data_get(obj);
2693 if (win->rot == rotation) return;
2694 win->rot = rotation;
2695 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2696 evas_object_size_hint_min_set(obj, -1, -1);
2697 evas_object_size_hint_max_set(obj, -1, -1);
2698 _elm_win_eval_subobjs(obj);
2699 #ifdef HAVE_ELEMENTARY_X
2700 _elm_win_xwin_update(win);
2705 elm_win_rotation_get(const Evas_Object *obj)
2708 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2709 win = elm_widget_data_get(obj);
2710 if (!win) return -1;
2715 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2718 ELM_CHECK_WIDTYPE(obj, widtype);
2719 win = elm_widget_data_get(obj);
2721 win->sticky = sticky;
2722 ecore_evas_sticky_set(win->ee, sticky);
2723 #ifdef HAVE_ELEMENTARY_X
2724 _elm_win_xwin_update(win);
2729 elm_win_sticky_get(const Evas_Object *obj)
2732 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2733 win = elm_widget_data_get(obj);
2734 if (!win) return EINA_FALSE;
2739 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2742 ELM_CHECK_WIDTYPE(obj, widtype);
2743 win = elm_widget_data_get(obj);
2745 if (mode == win->kbdmode) return;
2746 #ifdef HAVE_ELEMENTARY_X
2747 _elm_win_xwindow_get(win);
2749 win->kbdmode = mode;
2750 #ifdef HAVE_ELEMENTARY_X
2752 ecore_x_e_virtual_keyboard_state_set
2753 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2757 EAPI Elm_Win_Keyboard_Mode
2758 elm_win_keyboard_mode_get(const Evas_Object *obj)
2761 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2762 win = elm_widget_data_get(obj);
2763 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2764 return win->kbdmode;
2768 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2771 ELM_CHECK_WIDTYPE(obj, widtype);
2772 win = elm_widget_data_get(obj);
2774 #ifdef HAVE_ELEMENTARY_X
2775 _elm_win_xwindow_get(win);
2777 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2784 elm_win_keyboard_win_get(const Evas_Object *obj)
2787 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2788 win = elm_widget_data_get(obj);
2789 if (!win) return EINA_FALSE;
2790 #ifdef HAVE_ELEMENTARY_X
2791 _elm_win_xwindow_get(win);
2793 return ecore_x_e_virtual_keyboard_get(win->xwin);
2799 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2802 ELM_CHECK_WIDTYPE(obj, widtype);
2803 win = elm_widget_data_get(obj);
2805 if (mode == win->indmode) return;
2806 #ifdef HAVE_ELEMENTARY_X
2807 _elm_win_xwindow_get(win);
2809 win->indmode = mode;
2810 #ifdef HAVE_ELEMENTARY_X
2813 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
2814 ecore_x_e_illume_indicator_state_set
2815 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
2816 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
2817 ecore_x_e_illume_indicator_state_set
2818 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
2823 EAPI Elm_Win_Indicator_Mode
2824 elm_win_indicator_mode_get(const Evas_Object *obj)
2827 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
2828 win = elm_widget_data_get(obj);
2829 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
2830 return win->indmode;
2834 elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode)
2837 ELM_CHECK_WIDTYPE(obj, widtype);
2838 win = elm_widget_data_get(obj);
2840 if (mode == win->ind_o_mode) return;
2841 win->ind_o_mode = mode;
2842 #ifdef HAVE_ELEMENTARY_X
2843 _elm_win_xwindow_get(win);
2846 if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
2847 ecore_x_e_illume_indicator_opacity_set
2848 (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
2849 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
2850 ecore_x_e_illume_indicator_opacity_set
2851 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
2852 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
2853 ecore_x_e_illume_indicator_opacity_set
2854 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
2860 EAPI Elm_Win_Indicator_Opacity_Mode
2861 elm_win_indicator_opacity_get(const Evas_Object *obj)
2864 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2865 win = elm_widget_data_get(obj);
2866 if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2867 return win->ind_o_mode;
2871 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2874 ELM_CHECK_WIDTYPE(obj, widtype);
2875 win = elm_widget_data_get(obj);
2877 if (x) *x = win->screen.x;
2878 if (y) *y = win->screen.y;
2882 elm_win_focus_get(const Evas_Object *obj)
2885 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2886 win = elm_widget_data_get(obj);
2887 if (!win) return EINA_FALSE;
2888 return ecore_evas_focus_get(win->ee);
2892 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2895 ELM_CHECK_WIDTYPE(obj, widtype);
2896 win = elm_widget_data_get(obj);
2898 win->constrain = !!constrain;
2902 elm_win_screen_constrain_get(Evas_Object *obj)
2905 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2906 win = elm_widget_data_get(obj);
2907 if (!win) return EINA_FALSE;
2908 return win->constrain;
2912 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2915 ELM_CHECK_WIDTYPE(obj, widtype);
2916 win = elm_widget_data_get(obj);
2918 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2922 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2925 ELM_CHECK_WIDTYPE(obj, widtype);
2926 win = elm_widget_data_get(obj);
2928 #ifdef HAVE_ELEMENTARY_X
2929 _elm_win_xwindow_get(win);
2931 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2938 elm_win_conformant_get(const Evas_Object *obj)
2941 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2942 win = elm_widget_data_get(obj);
2943 if (!win) return EINA_FALSE;
2944 #ifdef HAVE_ELEMENTARY_X
2945 _elm_win_xwindow_get(win);
2947 return ecore_x_e_illume_conformant_get(win->xwin);
2953 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2956 ELM_CHECK_WIDTYPE(obj, widtype);
2957 win = elm_widget_data_get(obj);
2959 #ifdef HAVE_ELEMENTARY_X
2960 _elm_win_xwindow_get(win);
2963 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2966 Ecore_X_Window_State states[2];
2968 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2969 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2970 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2971 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2980 elm_win_quickpanel_get(const Evas_Object *obj)
2983 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2984 win = elm_widget_data_get(obj);
2985 if (!win) return EINA_FALSE;
2986 #ifdef HAVE_ELEMENTARY_X
2987 _elm_win_xwindow_get(win);
2989 return ecore_x_e_illume_quickpanel_get(win->xwin);
2995 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2998 ELM_CHECK_WIDTYPE(obj, widtype);
2999 win = elm_widget_data_get(obj);
3001 #ifdef HAVE_ELEMENTARY_X
3002 _elm_win_xwindow_get(win);
3004 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
3011 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
3014 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3015 win = elm_widget_data_get(obj);
3016 if (!win) return -1;
3017 #ifdef HAVE_ELEMENTARY_X
3018 _elm_win_xwindow_get(win);
3020 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
3026 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
3029 ELM_CHECK_WIDTYPE(obj, widtype);
3030 win = elm_widget_data_get(obj);
3032 #ifdef HAVE_ELEMENTARY_X
3033 _elm_win_xwindow_get(win);
3035 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3042 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3045 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3046 win = elm_widget_data_get(obj);
3047 if (!win) return -1;
3048 #ifdef HAVE_ELEMENTARY_X
3049 _elm_win_xwindow_get(win);
3051 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3057 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3060 ELM_CHECK_WIDTYPE(obj, widtype);
3061 win = elm_widget_data_get(obj);
3063 #ifdef HAVE_ELEMENTARY_X
3064 _elm_win_xwindow_get(win);
3066 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3073 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3076 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3077 win = elm_widget_data_get(obj);
3079 #ifdef HAVE_ELEMENTARY_X
3080 _elm_win_xwindow_get(win);
3082 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3088 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3091 ELM_CHECK_WIDTYPE(obj, widtype);
3092 win = elm_widget_data_get(obj);
3094 win->skip_focus = skip;
3095 ecore_evas_focus_skip_set(win->ee, skip);
3099 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3102 ELM_CHECK_WIDTYPE(obj, widtype);
3103 win = elm_widget_data_get(obj);
3105 #ifdef HAVE_ELEMENTARY_X
3106 _elm_win_xwindow_get(win);
3111 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3112 ecore_x_e_illume_focus_back_send(win->xwin);
3114 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3115 ecore_x_e_illume_focus_forward_send(win->xwin);
3117 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3118 ecore_x_e_illume_focus_home_send(win->xwin);
3120 case ELM_ILLUME_COMMAND_CLOSE:
3121 ecore_x_e_illume_close_send(win->xwin);
3133 elm_win_inlined_image_object_get(Evas_Object *obj)
3136 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3137 win = elm_widget_data_get(obj);
3138 if (!win) return NULL;
3139 return win->img_obj;
3143 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3147 ELM_CHECK_WIDTYPE(obj, widtype);
3149 win = elm_widget_data_get(obj);
3150 enabled = !!enabled;
3151 if (win->focus_highlight.enabled == enabled)
3154 win->focus_highlight.enabled = enabled;
3156 if (win->focus_highlight.enabled)
3157 _elm_win_focus_highlight_init(win);
3159 _elm_win_focus_highlight_shutdown(win);
3163 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3167 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3169 win = elm_widget_data_get(obj);
3170 return win->focus_highlight.enabled;
3174 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3178 ELM_CHECK_WIDTYPE(obj, widtype);
3180 win = elm_widget_data_get(obj);
3181 eina_stringshare_replace(&win->focus_highlight.style, style);
3182 win->focus_highlight.changed_theme = EINA_TRUE;
3183 _elm_win_focus_highlight_reconfigure_job_start(win);
3187 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3191 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3193 win = elm_widget_data_get(obj);
3194 return win->focus_highlight.style;
3197 typedef struct _Widget_Data Widget_Data;
3202 Evas_Object *content;
3205 static void _del_hook(Evas_Object *obj);
3206 static void _theme_hook(Evas_Object *obj);
3207 static void _sizing_eval(Evas_Object *obj);
3208 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3209 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3211 static const char *widtype2 = NULL;
3214 _del_hook(Evas_Object *obj)
3216 Widget_Data *wd = elm_widget_data_get(obj);
3222 _theme_hook(Evas_Object *obj)
3224 Widget_Data *wd = elm_widget_data_get(obj);
3225 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3227 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3230 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3234 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3236 Widget_Data *wd = elm_widget_data_get(obj);
3241 /* Try Focus cycle in subitem */
3244 elm_widget_focus_next_get(wd->content, dir, next);
3249 *next = (Evas_Object *)obj;
3254 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3256 Widget_Data *wd = elm_widget_data_get(obj);
3258 if (!wd || !item) return;
3259 edje_object_part_text_set(wd->frm, item, text);
3264 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3266 Widget_Data *wd = elm_widget_data_get(obj);
3268 if (!item || !wd || !wd->frm) return NULL;
3269 return edje_object_part_text_get(wd->frm, item);
3273 _sizing_eval(Evas_Object *obj)
3275 Widget_Data *wd = elm_widget_data_get(obj);
3276 Evas_Coord minw = -1, minh = -1;
3278 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3279 edje_object_size_min_calc(wd->frm, &minw, &minh);
3280 evas_object_size_hint_min_set(obj, minw, minh);
3281 evas_object_size_hint_max_set(obj, -1, -1);
3285 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3291 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3293 Widget_Data *wd = elm_widget_data_get(obj);
3294 Evas_Object *sub = event_info;
3295 if (sub == wd->content)
3297 evas_object_event_callback_del_full
3298 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3305 elm_win_inwin_add(Evas_Object *obj)
3311 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3312 win = elm_widget_data_get(obj);
3313 if (!win) return NULL;
3314 wd = ELM_NEW(Widget_Data);
3315 obj2 = elm_widget_add(win->evas);
3316 elm_widget_type_set(obj2, "inwin");
3317 ELM_SET_WIDTYPE(widtype2, "inwin");
3318 elm_widget_sub_object_add(obj, obj2);
3319 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3320 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3321 elm_win_resize_object_add(obj, obj2);
3323 elm_widget_data_set(obj2, wd);
3324 elm_widget_del_hook_set(obj2, _del_hook);
3325 elm_widget_theme_hook_set(obj2, _theme_hook);
3326 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3327 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3328 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3329 elm_widget_can_focus_set(obj2, EINA_TRUE);
3330 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3332 wd->frm = edje_object_add(win->evas);
3333 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3334 elm_widget_resize_object_set(obj2, wd->frm);
3336 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3343 elm_win_inwin_activate(Evas_Object *obj)
3345 ELM_CHECK_WIDTYPE(obj, widtype2);
3346 Widget_Data *wd = elm_widget_data_get(obj);
3348 evas_object_raise(obj);
3349 evas_object_show(obj);
3350 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3351 elm_object_focus_set(obj, EINA_TRUE);
3355 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3357 ELM_CHECK_WIDTYPE(obj, widtype2);
3358 Widget_Data *wd = elm_widget_data_get(obj);
3360 if (wd->content == content) return;
3361 if (wd->content) evas_object_del(wd->content);
3362 wd->content = content;
3365 elm_widget_sub_object_add(obj, content);
3366 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3367 _changed_size_hints, obj);
3368 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3374 elm_win_inwin_content_get(const Evas_Object *obj)
3376 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3377 Widget_Data *wd = elm_widget_data_get(obj);
3378 if (!wd) return NULL;
3383 elm_win_inwin_content_unset(Evas_Object *obj)
3385 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3386 Widget_Data *wd = elm_widget_data_get(obj);
3387 if (!wd) return NULL;
3388 if (!wd->content) return NULL;
3389 Evas_Object *content = wd->content;
3390 elm_widget_sub_object_del(obj, wd->content);
3391 evas_object_event_callback_del_full(wd->content,
3392 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3393 _changed_size_hints, obj);
3394 edje_object_part_unswallow(wd->frm, wd->content);
3400 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3405 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3406 win = elm_widget_data_get(obj);
3407 if (!win) return EINA_FALSE;
3408 if (!win->ee) return EINA_FALSE;
3410 if(!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3416 /* windowing spcific calls - shall we do this differently? */
3418 static Ecore_X_Window
3419 _elm_ee_win_get(const Evas_Object *obj)
3422 #ifdef HAVE_ELEMENTARY_X
3423 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3424 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3430 elm_win_xwindow_get(const Evas_Object *obj)
3436 type = elm_widget_type_get(obj);
3437 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3438 win = elm_widget_data_get(obj);
3440 #ifdef HAVE_ELEMENTARY_X
3441 if (win->xwin) return win->xwin;
3442 if (win->parent) return elm_win_xwindow_get(win->parent);