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;
31 int *autodel_clear, rot;
41 Evas_Object *obj, *hot_obj;
51 Eina_Bool visible : 1;
52 Eina_Bool handled : 1;
56 Ecore_Job *reconf_job;
58 Eina_Bool enabled : 1;
59 Eina_Bool changed_theme : 1;
60 Eina_Bool top_animate : 1;
61 Eina_Bool geometry_changed : 1;
66 const char *icon_name;
72 Eina_Bool demand_attention : 1;
73 Eina_Bool autodel : 1;
74 Eina_Bool constrain : 1;
75 Eina_Bool resizing : 1;
76 Eina_Bool iconified : 1;
77 Eina_Bool withdrawn : 1;
79 Eina_Bool fullscreen : 1;
80 Eina_Bool maximized : 1;
81 Eina_Bool skip_focus : 1;
84 static const char *widtype = NULL;
85 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
86 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
87 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
88 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
89 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
90 static void _elm_win_move(Ecore_Evas *ee);
91 static void _elm_win_resize(Ecore_Evas *ee);
92 static void _elm_win_delete_request(Ecore_Evas *ee);
93 static void _elm_win_resize_job(void *data);
94 #ifdef HAVE_ELEMENTARY_X
95 static void _elm_win_xwin_update(Elm_Win *win);
97 static void _elm_win_eval_subobjs(Evas_Object *obj);
98 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
99 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
100 static void _elm_win_focus_highlight_init(Elm_Win *win);
101 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
102 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
103 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
104 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
105 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
106 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
108 static void _elm_win_frame_add(Elm_Win *win, const char *style);
109 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
110 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
111 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
112 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
113 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
115 //static void _elm_win_pointer_add(Elm_Win *win, const char *style);
117 static const char SIG_DELETE_REQUEST[] = "delete,request";
118 static const char SIG_FOCUS_OUT[] = "focus,out";
119 static const char SIG_FOCUS_IN[] = "focus,in";
120 static const char SIG_MOVED[] = "moved";
121 static const char SIG_THEME_CHANGED[] = "theme,changed";
122 static const char SIG_WITHDRAWN[] = "withdrawn";
123 static const char SIG_ICONIFIED[] = "iconified";
124 static const char SIG_NORMAL[] = "normal";
125 static const char SIG_STICK[] = "stick";
126 static const char SIG_UNSTICK[] = "unstick";
127 static const char SIG_FULLSCREEN[] = "fullscreen";
128 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
129 static const char SIG_MAXIMIZED[] = "maximized";
130 static const char SIG_UNMAXIMIZED[] = "unmaximized";
132 static const Evas_Smart_Cb_Description _signals[] = {
133 {SIG_DELETE_REQUEST, ""},
142 {SIG_FULLSCREEN, ""},
143 {SIG_UNFULLSCREEN, ""},
145 {SIG_UNMAXIMIZED, ""},
151 Eina_List *_elm_win_list = NULL;
152 int _elm_win_deferred_free = 0;
154 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
155 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
158 _shot_delay_get(Elm_Win *win)
161 char *d = strdup(win->shot.info);
164 for (p = (char *)win->shot.info; *p; p++)
166 if (!strncmp(p, "delay=", 6))
170 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
185 _shot_file_get(Elm_Win *win)
188 char *tmp = strdup(win->shot.info);
189 char *repname = NULL;
191 if (!tmp) return NULL;
193 for (p = (char *)win->shot.info; *p; p++)
195 if (!strncmp(p, "file=", 5))
198 if (!win->shot.repeat_count) return tmp;
201 char *dotptr = strrchr(tmp, '.');
204 size_t size = sizeof(char)*(strlen(tmp) + 16);
205 repname = malloc(size);
206 strncpy(repname, tmp, dotptr - tmp);
207 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
208 win->shot.shot_counter + 1);
209 strcat(repname, dotptr);
217 if (!win->shot.repeat_count) return strdup("out.png");
219 repname = malloc(sizeof(char) * 24);
220 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
225 _shot_repeat_count_get(Elm_Win *win)
228 char *d = strdup(win->shot.info);
231 for (p = (char *)win->shot.info; *p; p++)
233 if (!strncmp(p, "repeat=", 7))
237 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
244 if (v > 1000) v = 999;
254 _shot_key_get(Elm_Win *win __UNUSED__)
260 _shot_flags_get(Elm_Win *win __UNUSED__)
266 _shot_do(Elm_Win *win)
270 unsigned int *pixels;
272 char *file, *key, *flags;
274 ecore_evas_manual_render(win->ee);
275 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
277 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
278 if ((w < 1) || (h < 1)) return;
279 file = _shot_file_get(win);
281 key = _shot_key_get(win);
282 flags = _shot_flags_get(win);
283 ee = ecore_evas_buffer_new(1, 1);
284 o = evas_object_image_add(ecore_evas_get(ee));
285 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
286 evas_object_image_size_set(o, w, h);
287 evas_object_image_data_set(o, pixels);
288 if (!evas_object_image_save(o, file, key, flags))
290 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
295 if (flags) free(flags);
297 if (win->shot.repeat_count) win->shot.shot_counter++;
301 _shot_delay(void *data)
305 if (win->shot.repeat_count)
307 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
308 if (remainshot > 0) return EINA_TRUE;
310 win->shot.timer = NULL;
316 _shot_init(Elm_Win *win)
318 if (!win->shot.info) return;
319 win->shot.repeat_count = _shot_repeat_count_get(win);
320 win->shot.shot_counter = 0;
324 _shot_handle(Elm_Win *win)
326 if (!win->shot.info) return;
327 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
331 _elm_win_move(Ecore_Evas *ee)
333 Evas_Object *obj = ecore_evas_object_associate_get(ee);
338 win = elm_widget_data_get(obj);
340 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
343 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
347 _elm_win_resize(Ecore_Evas *ee)
349 Evas_Object *obj = ecore_evas_object_associate_get(ee);
353 win = elm_widget_data_get(obj);
355 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
356 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
360 _elm_win_mouse_in(Ecore_Evas *ee)
365 if (!(obj = ecore_evas_object_associate_get(ee))) return;
366 if (!(win = elm_widget_data_get(obj))) return;
367 if (win->resizing) win->resizing = EINA_FALSE;
371 _elm_win_focus_in(Ecore_Evas *ee)
373 Evas_Object *obj = ecore_evas_object_associate_get(ee);
377 win = elm_widget_data_get(obj);
379 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
380 if (!elm_widget_focus_order_get(obj))
382 elm_widget_focus_steal(win->win_obj);
386 elm_widget_focus_restore(win->win_obj);
387 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
388 win->focus_highlight.cur.visible = EINA_TRUE;
389 _elm_win_focus_highlight_reconfigure_job_start(win);
392 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
394 else if (win->img_obj)
401 _elm_win_focus_out(Ecore_Evas *ee)
403 Evas_Object *obj = ecore_evas_object_associate_get(ee);
407 win = elm_widget_data_get(obj);
409 elm_object_focus_set(win->win_obj, EINA_FALSE);
410 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
411 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
412 win->focus_highlight.cur.visible = EINA_FALSE;
413 _elm_win_focus_highlight_reconfigure_job_start(win);
416 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
418 else if (win->img_obj)
425 _elm_win_state_change(Ecore_Evas *ee)
429 Eina_Bool ch_withdrawn = EINA_FALSE;
430 Eina_Bool ch_sticky = EINA_FALSE;
431 Eina_Bool ch_iconified = EINA_FALSE;
432 Eina_Bool ch_fullscreen = EINA_FALSE;
433 Eina_Bool ch_maximized = EINA_FALSE;
435 if (!(obj = ecore_evas_object_associate_get(ee))) return;
437 if (!(win = elm_widget_data_get(obj))) return;
439 if (win->withdrawn != ecore_evas_withdrawn_get(win->ee))
441 win->withdrawn = ecore_evas_withdrawn_get(win->ee);
442 ch_withdrawn = EINA_TRUE;
444 if (win->sticky != ecore_evas_sticky_get(win->ee))
446 win->sticky = ecore_evas_sticky_get(win->ee);
447 ch_sticky = EINA_TRUE;
449 if (win->iconified != ecore_evas_iconified_get(win->ee))
451 win->iconified = ecore_evas_iconified_get(win->ee);
452 ch_iconified = EINA_TRUE;
454 if (win->fullscreen != ecore_evas_fullscreen_get(win->ee))
456 win->fullscreen = ecore_evas_fullscreen_get(win->ee);
457 ch_fullscreen = EINA_TRUE;
459 if (win->maximized != ecore_evas_maximized_get(win->ee))
461 win->maximized = ecore_evas_maximized_get(win->ee);
462 ch_maximized = EINA_TRUE;
464 if ((ch_withdrawn) || (ch_iconified))
467 evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL);
468 else if (win->iconified)
469 evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL);
471 evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL);
476 evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL);
478 evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL);
483 evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL);
485 evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL);
490 evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL);
492 evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL);
497 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
499 Elm_Win *wd = elm_widget_data_get(obj);
500 const Eina_List *items;
501 void *(*list_data_get) (const Eina_List *list);
509 if (!(items = elm_widget_focus_custom_chain_get(obj)))
515 list_data_get = eina_list_data_get;
517 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
523 *next = (Evas_Object *)obj;
528 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
530 Elm_Win *win = elm_widget_data_get(obj);
534 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
536 evas_object_focus_set(obj, elm_widget_focus_get(obj));
540 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
542 if (type == EVAS_CALLBACK_KEY_DOWN)
544 Evas_Event_Key_Down *ev = event_info;
545 if (!strcmp(ev->keyname, "Tab"))
547 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
548 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
550 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
551 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
554 else if ((!strcmp(ev->keyname, "Left")) ||
555 (!strcmp(ev->keyname, "KP_Left")))
557 //TODO : woohyun jung
559 else if ((!strcmp(ev->keyname, "Right")) ||
560 (!strcmp(ev->keyname, "KP_Right")))
562 //TODO : woohyun jung
564 else if ((!strcmp(ev->keyname, "Up")) ||
565 (!strcmp(ev->keyname, "KP_Up")))
567 //TODO : woohyun jung
569 else if ((!strcmp(ev->keyname, "Down")) ||
570 (!strcmp(ev->keyname, "KP_Down")))
572 //TODO : woohyun jung
580 _deferred_ecore_evas_free(void *data)
582 ecore_evas_free(data);
583 _elm_win_deferred_free--;
587 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
591 if (!win->show_count) win->show_count++;
592 if (win->shot.info) _shot_handle(win);
596 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
602 evas_object_hide(win->frame_obj);
604 else if (win->img_obj)
606 evas_object_hide(win->img_obj);
608 if (win->pointer.obj)
610 evas_object_hide(win->pointer.obj);
611 ecore_evas_hide(win->pointer.ee);
616 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
623 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
624 _elm_win_obj_callback_parent_del, win);
627 if (win->autodel_clear) *(win->autodel_clear) = -1;
628 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
629 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
632 ecore_evas_callback_delete_request_set(win->ee, NULL);
633 ecore_evas_callback_resize_set(win->ee, NULL);
635 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
636 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
637 if (win->shot.info) eina_stringshare_del(win->shot.info);
638 if (win->shot.timer) ecore_timer_del(win->shot.timer);
639 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
640 _elm_win_obj_callback_del, win);
641 while (((child = evas_object_bottom_get(win->evas))) &&
644 evas_object_del(child);
646 while (((child = evas_object_top_get(win->evas))) &&
649 evas_object_del(child);
651 #ifdef HAVE_ELEMENTARY_X
652 if (win->client_message_handler)
653 ecore_event_handler_del(win->client_message_handler);
655 // FIXME: Why are we flushing edje on every window destroy ??
656 // edje_file_cache_flush();
657 // edje_collection_cache_flush();
658 // evas_image_cache_flush(win->evas);
659 // evas_font_cache_flush(win->evas);
660 // FIXME: we are in the del handler for the object and delete the canvas
661 // that lives under it from the handler... nasty. deferring doesn't help either
671 ecore_job_add(_deferred_ecore_evas_free, win->ee);
672 _elm_win_deferred_free++;
676 _elm_win_focus_highlight_shutdown(win);
677 eina_stringshare_del(win->focus_highlight.style);
679 if (win->title) eina_stringshare_del(win->title);
680 if (win->icon_name) eina_stringshare_del(win->icon_name);
681 if (win->role) eina_stringshare_del(win->role);
682 if (win->icon) evas_object_del(win->icon);
686 if ((!_elm_win_list) &&
687 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
689 edje_file_cache_flush();
690 edje_collection_cache_flush();
691 evas_image_cache_flush(e);
692 evas_font_cache_flush(e);
698 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
701 if (!win->img_obj) return;
702 evas_object_event_callback_del_full
703 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
704 evas_object_del(win->img_obj);
708 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
711 if (obj == win->parent) win->parent = NULL;
715 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
721 if ((x != win->screen.x) || (y != win->screen.y))
725 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
730 evas_object_move(obj, x, y);
735 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
738 // this is called to make sure all smart containers have calculated their
739 // sizes BEFORE we show the window to make sure it initially appears at
740 // our desired size (ie min size is known first)
741 evas_smart_objects_calculate(evas_object_evas_get(obj));
744 evas_object_show(win->frame_obj);
746 else if (win->img_obj)
748 evas_object_show(win->img_obj);
750 if (win->pointer.obj)
752 ecore_evas_show(win->pointer.ee);
753 evas_object_show(win->pointer.obj);
754 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
756 evas_object_show(obj);
760 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
764 if (ecore_evas_override_get(win->ee))
768 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
771 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
777 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
781 else if (win->img_obj)
785 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
788 // evas_object_move(win->img_obj, x, y);
793 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
800 else if (win->img_obj)
802 Evas_Coord w = 1, h = 1;
804 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
808 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
814 evas_object_image_size_set(win->img_obj, w, h);
819 _elm_win_delete_request(Ecore_Evas *ee)
821 Evas_Object *obj = ecore_evas_object_associate_get(ee);
823 if (strcmp(elm_widget_type_get(obj), "win")) return;
825 win = elm_widget_data_get(obj);
827 int autodel = win->autodel;
828 win->autodel_clear = &autodel;
829 evas_object_ref(win->win_obj);
830 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
831 // FIXME: if above callback deletes - then the below will be invalid
832 if (autodel) evas_object_del(win->win_obj);
833 else win->autodel_clear = NULL;
834 evas_object_unref(win->win_obj);
838 _elm_win_resize_job(void *data)
845 win->deferred_resize_job = NULL;
846 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
850 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
856 evas_object_resize(win->frame_obj, w, h);
858 else if (win->img_obj)
861 evas_object_resize(win->win_obj, w, h);
862 EINA_LIST_FOREACH(win->subobjs, l, obj)
864 evas_object_move(obj, 0, 0);
865 evas_object_resize(obj, w, h);
869 #ifdef HAVE_ELEMENTARY_X
871 _elm_win_xwindow_get(Elm_Win *win)
875 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
876 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
878 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
880 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
881 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
882 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
883 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
884 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
885 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
886 ENGINE_COMPARE(ELM_OPENGL_COCOA))
889 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
891 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
893 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
895 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
898 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
900 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
903 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
905 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
907 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
909 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
911 #undef ENGINE_COMPARE
915 #ifdef HAVE_ELEMENTARY_X
917 _elm_win_xwin_update(Elm_Win *win)
921 _elm_win_xwindow_get(win);
926 win2 = elm_widget_data_get(win->parent);
930 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
934 if (!win->xwin) return; /* nothing more to do */
937 if (!s) s = _elm_appname;
939 if (win->icon_name) s = win->icon_name;
940 ecore_x_icccm_icon_name_set(win->xwin, s);
941 ecore_x_netwm_icon_name_set(win->xwin, s);
944 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
951 data = evas_object_image_data_get(win->icon, EINA_FALSE);
955 int w = 0, h = 0, stride, x, y;
959 evas_object_image_size_get(win->icon, &w, &h);
960 stride = evas_object_image_stride_get(win->icon);
961 if ((w > 0) && (h > 0) &&
962 (stride >= (int)(w * sizeof(unsigned int))))
966 ic.data = malloc(w * h * sizeof(unsigned int));
970 p = (unsigned char *)data;
971 p2 = (unsigned int *)ic.data;
972 for (y = 0; y < h; y++)
974 for (x = 0; x < w; x++)
976 *p2 = *((unsigned int *)p);
977 p += sizeof(unsigned int);
980 p += (stride - (w * sizeof(unsigned int)));
982 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
986 evas_object_image_data_set(win->icon, data);
993 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
995 case ELM_WIN_DIALOG_BASIC:
996 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
998 case ELM_WIN_DESKTOP:
999 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1002 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
1004 case ELM_WIN_TOOLBAR:
1005 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1008 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1010 case ELM_WIN_UTILITY:
1011 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1013 case ELM_WIN_SPLASH:
1014 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1016 case ELM_WIN_DROPDOWN_MENU:
1017 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1019 case ELM_WIN_POPUP_MENU:
1020 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1022 case ELM_WIN_TOOLTIP:
1023 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1025 case ELM_WIN_NOTIFICATION:
1026 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1029 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1032 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1037 ecore_x_e_virtual_keyboard_state_set
1038 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1039 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
1040 ecore_x_e_illume_indicator_state_set
1041 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1042 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
1043 ecore_x_e_illume_indicator_state_set
1044 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1049 _elm_win_eval_subobjs(Evas_Object *obj)
1052 const Evas_Object *child;
1054 Elm_Win *win = elm_widget_data_get(obj);
1055 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1059 EINA_LIST_FOREACH(win->subobjs, l, child)
1061 evas_object_size_hint_weight_get(child, &wx, &wy);
1062 if (wx == 0.0) xx = 0;
1063 if (wy == 0.0) xy = 0;
1065 evas_object_size_hint_min_get(child, &w, &h);
1068 if (w > minw) minw = w;
1069 if (h > minh) minh = h;
1071 evas_object_size_hint_max_get(child, &w, &h);
1074 if (maxw == -1) maxw = w;
1075 else if ((w > 0) && (w < maxw)) maxw = w;
1076 if (maxh == -1) maxh = h;
1077 else if ((h > 0) && (h < maxh)) maxh = h;
1079 if (!xx) maxw = minw;
1081 if (!xy) maxh = minh;
1083 evas_object_size_hint_min_set(obj, minw, minh);
1084 evas_object_size_hint_max_set(obj, maxw, maxh);
1085 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1086 if (w < minw) w = minw;
1087 if (h < minh) h = minh;
1088 if ((maxw >= 0) && (w > maxw)) w = maxw;
1089 if ((maxh >= 0) && (h > maxh)) h = maxh;
1090 evas_object_resize(obj, w, h);
1094 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1096 Elm_Win *win = elm_widget_data_get(data);
1097 win->subobjs = eina_list_remove(win->subobjs, obj);
1098 _elm_win_eval_subobjs(win->win_obj);
1102 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1104 _elm_win_eval_subobjs(data);
1108 _elm_win_shutdown(void)
1110 while (_elm_win_list)
1111 evas_object_del(_elm_win_list->data);
1115 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1122 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1123 elm_widget_theme(obj);
1127 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1128 elm_widget_theme_specific(obj, th, EINA_FALSE);
1133 _elm_win_translate(void)
1138 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1139 elm_widget_translate(obj);
1142 #ifdef HAVE_ELEMENTARY_X
1144 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1146 Elm_Win *win = data;
1147 Ecore_X_Event_Client_Message *e = event;
1149 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1150 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1152 if ((unsigned)e->data.l[0] == win->xwin)
1154 Evas *evas = evas_object_evas_get(win->win_obj);
1157 edje_file_cache_flush();
1158 edje_collection_cache_flush();
1159 evas_image_cache_flush(evas);
1160 evas_font_cache_flush(evas);
1164 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1166 if ((unsigned)e->data.l[0] == win->xwin)
1168 Evas *evas = evas_object_evas_get(win->win_obj);
1171 edje_file_cache_flush();
1172 edje_collection_cache_flush();
1173 evas_image_cache_flush(evas);
1174 evas_font_cache_flush(evas);
1175 evas_render_dump(evas);
1179 return ECORE_CALLBACK_PASS_ON;
1184 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1186 Elm_Win *win = data;
1188 win->focus_highlight.geometry_changed = EINA_TRUE;
1189 _elm_win_focus_highlight_reconfigure_job_start(win);
1193 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1195 Elm_Win *win = data;
1197 win->focus_highlight.geometry_changed = EINA_TRUE;
1198 _elm_win_focus_highlight_reconfigure_job_start(win);
1202 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1204 Elm_Win *win = data;
1206 win->focus_highlight.cur.target = NULL;
1208 _elm_win_focus_highlight_reconfigure_job_start(win);
1212 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1214 Evas_Object *obj = win->focus_highlight.cur.target;
1216 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1217 _elm_win_focus_target_move, win);
1218 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1219 _elm_win_focus_target_resize, win);
1220 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1221 _elm_win_focus_target_del, win);
1225 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1227 Evas_Object *obj = win->focus_highlight.cur.target;
1229 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1230 _elm_win_focus_target_move, win);
1231 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1232 _elm_win_focus_target_resize, win);
1233 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1234 _elm_win_focus_target_del, win);
1237 static Evas_Object *
1238 _elm_win_focus_target_get(Evas_Object *obj)
1240 Evas_Object *o = obj;
1244 if (elm_widget_is(o))
1246 if (!elm_widget_highlight_ignore_get(o))
1248 o = elm_widget_parent_get(o);
1250 o = evas_object_smart_parent_get(o);
1254 o = elm_widget_parent_widget_get(o);
1256 o = evas_object_smart_parent_get(o);
1265 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1267 Evas_Object *obj = event_info, *target;
1268 Elm_Win *win = data;
1270 if (win->focus_highlight.cur.target == obj)
1273 target = _elm_win_focus_target_get(obj);
1274 win->focus_highlight.cur.target = target;
1275 if (elm_widget_highlight_in_theme_get(target))
1276 win->focus_highlight.cur.handled = EINA_TRUE;
1278 _elm_win_focus_target_callbacks_add(win);
1280 _elm_win_focus_highlight_reconfigure_job_start(win);
1284 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1286 Elm_Win *win = data;
1288 if (!win->focus_highlight.cur.target)
1291 if (!win->focus_highlight.cur.handled)
1292 _elm_win_focus_target_callbacks_del(win);
1293 win->focus_highlight.cur.target = NULL;
1294 win->focus_highlight.cur.handled = EINA_FALSE;
1296 _elm_win_focus_highlight_reconfigure_job_start(win);
1300 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1302 evas_object_hide(obj);
1306 _elm_win_focus_highlight_init(Elm_Win *win)
1308 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1309 _elm_win_object_focus_in, win);
1310 evas_event_callback_add(win->evas,
1311 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1312 _elm_win_object_focus_out, win);
1314 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1316 win->focus_highlight.top = edje_object_add(win->evas);
1317 win->focus_highlight.changed_theme = EINA_TRUE;
1318 edje_object_signal_callback_add(win->focus_highlight.top,
1319 "elm,action,focus,hide,end", "",
1320 _elm_win_focus_highlight_hide, NULL);
1321 edje_object_signal_callback_add(win->focus_highlight.top,
1322 "elm,action,focus,anim,end", "",
1323 _elm_win_focus_highlight_anim_end, win);
1324 _elm_win_focus_highlight_reconfigure_job_start(win);
1328 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1330 _elm_win_focus_highlight_reconfigure_job_stop(win);
1331 if (win->focus_highlight.cur.target)
1333 _elm_win_focus_target_callbacks_del(win);
1334 win->focus_highlight.cur.target = NULL;
1336 if (win->focus_highlight.top)
1338 evas_object_del(win->focus_highlight.top);
1339 win->focus_highlight.top = NULL;
1342 evas_event_callback_del_full(win->evas,
1343 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1344 _elm_win_object_focus_in, win);
1345 evas_event_callback_del_full(win->evas,
1346 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1347 _elm_win_object_focus_out, win);
1351 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1355 top = win->focus_highlight.top;
1360 evas_object_show(top);
1361 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1367 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1372 _elm_win_focus_highlight_reconfigure_job(void *data)
1374 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1378 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1380 if (win->focus_highlight.reconf_job)
1381 ecore_job_del(win->focus_highlight.reconf_job);
1382 win->focus_highlight.reconf_job = ecore_job_add(
1383 _elm_win_focus_highlight_reconfigure_job, win);
1387 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1389 if (win->focus_highlight.reconf_job)
1390 ecore_job_del(win->focus_highlight.reconf_job);
1391 win->focus_highlight.reconf_job = NULL;
1395 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1397 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1398 Evas_Coord x, y, w, h;
1400 clip = evas_object_clip_get(target);
1401 evas_object_geometry_get(target, &x, &y, &w, &h);
1403 evas_object_move(obj, x, y);
1404 evas_object_resize(obj, w, h);
1405 evas_object_clip_set(obj, clip);
1409 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1411 Evas_Coord tx, ty, tw, th;
1412 Evas_Coord w, h, px, py, pw, ph;
1413 Edje_Message_Int_Set *m;
1414 Evas_Object *previous = win->focus_highlight.prev.target;
1415 Evas_Object *target = win->focus_highlight.cur.target;
1417 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1418 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1419 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1420 evas_object_move(obj, 0, 0);
1421 evas_object_resize(obj, tw, th);
1422 evas_object_clip_unset(obj);
1424 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1434 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1438 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1440 Elm_Win *win = data;
1441 _elm_win_focus_highlight_simple_setup(win, obj);
1445 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1447 Evas_Object *target = win->focus_highlight.cur.target;
1448 Evas_Object *previous = win->focus_highlight.prev.target;
1449 Evas_Object *top = win->focus_highlight.top;
1450 Eina_Bool visible_changed;
1451 Eina_Bool common_visible;
1452 const char *sig = NULL;
1454 _elm_win_focus_highlight_reconfigure_job_stop(win);
1456 visible_changed = (win->focus_highlight.cur.visible !=
1457 win->focus_highlight.prev.visible);
1459 if ((target == previous) && (!visible_changed) &&
1460 (!win->focus_highlight.geometry_changed))
1463 if ((previous) && (win->focus_highlight.prev.handled))
1464 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1467 common_visible = EINA_FALSE;
1468 else if (win->focus_highlight.cur.handled)
1470 common_visible = EINA_FALSE;
1471 if (win->focus_highlight.cur.visible)
1472 sig = "elm,action,focus_highlight,show";
1474 sig = "elm,action,focus_highlight,hide";
1477 common_visible = win->focus_highlight.cur.visible;
1479 _elm_win_focus_highlight_visible_set(win, common_visible);
1481 elm_widget_signal_emit(target, sig, "elm");
1483 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1486 if (win->focus_highlight.changed_theme)
1489 if (win->focus_highlight.style)
1490 str = win->focus_highlight.style;
1493 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1495 win->focus_highlight.changed_theme = EINA_FALSE;
1497 if (_elm_config->focus_highlight_animate)
1499 str = edje_object_data_get(win->focus_highlight.top, "animate");
1500 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1504 if ((win->focus_highlight.top_animate) && (previous) &&
1505 (!win->focus_highlight.prev.handled))
1506 _elm_win_focus_highlight_anim_setup(win, top);
1508 _elm_win_focus_highlight_simple_setup(win, top);
1509 evas_object_raise(top);
1512 win->focus_highlight.geometry_changed = EINA_FALSE;
1513 win->focus_highlight.prev = win->focus_highlight.cur;
1517 _elm_win_frame_add(Elm_Win *win, const char *style)
1519 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1521 win->frame_obj = edje_object_add(win->evas);
1522 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1523 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1524 evas_object_move(win->frame_obj, 0, 0);
1525 evas_object_resize(win->frame_obj, 1, 1);
1527 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1528 "elm", _elm_win_frame_cb_move_start, win);
1529 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1530 "*", _elm_win_frame_cb_resize_start, win);
1531 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1532 "elm", _elm_win_frame_cb_minimize, win);
1533 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1534 "elm", _elm_win_frame_cb_maximize, win);
1535 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1536 "elm", _elm_win_frame_cb_close, win);
1540 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1544 if (!(win = data)) return;
1545 /* FIXME: Change mouse pointer */
1547 /* NB: 0,0 are dummy values. Wayland handles the move by itself */
1548 ecore_evas_move(win->ee, 0, 0);
1552 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1556 if (!(win = data)) return;
1557 if (win->resizing) return;
1558 win->resizing = EINA_TRUE;
1560 /* FIXME: Change mouse pointer */
1562 if (!strcmp(source, "elm.event.resize.t"))
1563 win->resize_location = 1;
1564 else if (!strcmp(source, "elm.event.resize.b"))
1565 win->resize_location = 2;
1566 else if (!strcmp(source, "elm.event.resize.l"))
1567 win->resize_location = 4;
1568 else if (!strcmp(source, "elm.event.resize.r"))
1569 win->resize_location = 8;
1570 else if (!strcmp(source, "elm.event.resize.tl"))
1571 win->resize_location = 5;
1572 else if (!strcmp(source, "elm.event.resize.tr"))
1573 win->resize_location = 9;
1574 else if (!strcmp(source, "elm.event.resize.bl"))
1575 win->resize_location = 6;
1576 else if (!strcmp(source, "elm.event.resize.br"))
1577 win->resize_location = 10;
1579 win->resize_location = 0;
1581 if (win->resize_location > 0)
1582 ecore_evas_wayland_resize(win->ee, win->resize_location);
1586 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1590 if (!(win = data)) return;
1591 win->iconified = EINA_TRUE;
1592 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1596 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1600 if (!(win = data)) return;
1601 if (win->maximized) win->maximized = EINA_FALSE;
1602 else win->maximized = EINA_TRUE;
1603 ecore_evas_maximized_set(win->ee, win->maximized);
1607 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1611 if (!(win = data)) return;
1612 evas_object_del(win->win_obj);
1617 _elm_win_pointer_add(Elm_Win *win, const char *style)
1623 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1624 ecore_evas_resize(win->pointer.ee, 32, 32);
1626 win->pointer.evas = ecore_evas_get(win->ee);
1628 win->pointer.obj = edje_object_add(win->pointer.evas);
1629 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1630 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1631 evas_object_move(win->pointer.obj, 0, 0);
1632 evas_object_resize(win->pointer.obj, 32, 32);
1633 evas_object_show(win->pointer.obj);
1639 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1641 Evas_Event_Key_Down *ev = event_info;
1643 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1646 if ((strcmp(ev->keyname, "F12")) ||
1647 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1650 printf("Tree graph generated.\n");
1651 elm_object_tree_dot_dump(obj, "./dump.dot");
1656 _win_img_hide(void *data,
1658 Evas_Object *obj __UNUSED__,
1659 void *event_info __UNUSED__)
1661 Elm_Win *win = data;
1663 elm_widget_focus_hide_handle(win->win_obj);
1667 _win_img_mouse_up(void *data,
1669 Evas_Object *obj __UNUSED__,
1672 Elm_Win *win = data;
1673 Evas_Event_Mouse_Up *ev = event_info;
1674 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1675 elm_widget_focus_mouse_up_handle(win->win_obj);
1679 _win_img_focus_in(void *data,
1681 Evas_Object *obj __UNUSED__,
1682 void *event_info __UNUSED__)
1684 Elm_Win *win = data;
1685 elm_widget_focus_steal(win->win_obj);
1689 _win_img_focus_out(void *data,
1691 Evas_Object *obj __UNUSED__,
1692 void *event_info __UNUSED__)
1694 Elm_Win *win = data;
1695 elm_widget_focused_object_clear(win->win_obj);
1699 _win_inlined_image_set(Elm_Win *win)
1701 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1702 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1703 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1704 _elm_win_obj_callback_img_obj_del, win);
1706 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1707 _win_img_hide, win);
1708 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1709 _win_img_mouse_up, win);
1710 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1711 _win_img_focus_in, win);
1712 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1713 _win_img_focus_out, win);
1717 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1719 evas_object_event_callback_del_full(subobj,
1720 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1721 _elm_win_subobj_callback_changed_size_hints,
1723 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1724 _elm_win_subobj_callback_del, obj);
1725 win->subobjs = eina_list_remove(win->subobjs, subobj);
1726 _elm_win_eval_subobjs(obj);
1730 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1732 Elm_Win *win = data;
1733 if (win->icon == obj) win->icon = NULL;
1737 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1741 const char *fontpath;
1743 win = ELM_NEW(Elm_Win);
1745 #define FALLBACK_TRY(engine) \
1748 CRITICAL(engine " engine creation failed. Trying default."); \
1749 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1751 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
1753 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
1755 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
1756 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
1760 case ELM_WIN_INLINED_IMAGE:
1763 Evas *e = evas_object_evas_get(parent);
1766 ee = ecore_evas_ecore_evas_get(e);
1768 win->img_obj = ecore_evas_object_image_new(ee);
1769 if (!win->img_obj) break;
1770 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1773 _win_inlined_image_set(win);
1776 evas_object_del(win->img_obj);
1777 win->img_obj = NULL;
1781 case ELM_WIN_SOCKET_IMAGE:
1782 win->ee = ecore_evas_extn_socket_new(1, 1);
1786 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1788 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1789 #ifdef HAVE_ELEMENTARY_X
1790 win->client_message_handler = ecore_event_handler_add
1791 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1793 FALLBACK_TRY("Sofware X11");
1795 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1797 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1798 FALLBACK_TRY("Sofware FB");
1800 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1802 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1803 FALLBACK_TRY("Sofware DirectFB");
1805 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1807 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1808 FALLBACK_TRY("Sofware-16");
1809 #ifdef HAVE_ELEMENTARY_X
1810 win->client_message_handler = ecore_event_handler_add
1811 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1814 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1816 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1817 FALLBACK_TRY("Sofware-8");
1818 #ifdef HAVE_ELEMENTARY_X
1819 win->client_message_handler = ecore_event_handler_add
1820 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1824 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1826 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1827 FALLBACK_TRY("XRender");
1828 #ifdef HAVE_ELEMENTARY_X
1829 win->client_message_handler = ecore_event_handler_add
1830 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1834 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1839 if (_elm_config->vsync)
1841 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1847 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1849 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1850 FALLBACK_TRY("OpenGL");
1851 #ifdef HAVE_ELEMENTARY_X
1852 win->client_message_handler = ecore_event_handler_add
1853 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1856 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1858 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1859 FALLBACK_TRY("Sofware Win32");
1861 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1863 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1864 FALLBACK_TRY("Sofware-16-WinCE");
1866 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1868 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1869 FALLBACK_TRY("PSL1GHT");
1871 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1873 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1874 FALLBACK_TRY("Sofware SDL");
1876 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1878 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1879 FALLBACK_TRY("Sofware-16-SDL");
1881 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1883 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1884 FALLBACK_TRY("OpenGL SDL");
1886 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1888 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1889 FALLBACK_TRY("OpenGL Cocoa");
1891 else if (ENGINE_COMPARE(ELM_BUFFER))
1893 win->ee = ecore_evas_buffer_new(1, 1);
1895 else if (ENGINE_COMPARE(ELM_EWS))
1897 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1899 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1901 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
1902 win->evas = ecore_evas_get(win->ee);
1904 _elm_win_frame_add(win, "default");
1905 // _elm_win_pointer_add(win, "default");
1907 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
1909 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
1910 win->evas = ecore_evas_get(win->ee);
1912 _elm_win_frame_add(win, "default");
1913 // _elm_win_pointer_add(win, "default");
1915 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
1917 win->ee = ecore_evas_buffer_new(1, 1);
1918 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1919 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
1928 ERR("Cannot create window.");
1932 #ifdef HAVE_ELEMENTARY_X
1933 _elm_win_xwindow_get(win);
1935 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1936 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1937 // bg pixmap done by x - has other issues like can be redrawn by x before it
1938 // is filled/ready by app
1939 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1942 win->parent = parent;
1944 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1945 _elm_win_obj_callback_parent_del, win);
1947 win->evas = ecore_evas_get(win->ee);
1948 win->win_obj = elm_widget_add(win->evas);
1949 elm_widget_type_set(win->win_obj, "win");
1950 ELM_SET_WIDTYPE(widtype, "win");
1951 elm_widget_data_set(win->win_obj, win);
1952 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1953 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1954 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1955 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1956 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1957 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1958 evas_object_move(win->win_obj, 0, 0);
1959 evas_object_resize(win->win_obj, 1, 1);
1960 evas_object_layer_set(win->win_obj, 50);
1961 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1965 evas_object_clip_set(win->win_obj, win->frame_obj);
1966 evas_object_stack_below(win->frame_obj, win->win_obj);
1969 if (type == ELM_WIN_INLINED_IMAGE)
1970 elm_widget_parent2_set(win->win_obj, parent);
1971 ecore_evas_object_associate(win->ee, win->win_obj,
1972 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1973 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1974 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1975 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1976 _elm_win_obj_callback_show, win);
1977 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1978 _elm_win_obj_callback_hide, win);
1979 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1980 _elm_win_obj_callback_del, win);
1981 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1982 _elm_win_obj_callback_move, win);
1983 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1984 _elm_win_obj_callback_resize, win);
1986 evas_object_intercept_move_callback_add(win->win_obj,
1987 _elm_win_obj_intercept_move, win);
1988 evas_object_intercept_show_callback_add(win->win_obj,
1989 _elm_win_obj_intercept_show, win);
1991 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
1992 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1993 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1994 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1995 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
1996 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1997 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1998 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1999 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
2000 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
2001 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
2002 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2003 evas_font_path_append(win->evas, fontpath);
2004 if (!_elm_config->font_hinting)
2005 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2006 else if (_elm_config->font_hinting == 1)
2007 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2008 else if (_elm_config->font_hinting == 2)
2009 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2011 #ifdef HAVE_ELEMENTARY_X
2012 _elm_win_xwin_update(win);
2015 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2017 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2019 ecore_evas_fullscreen_set(win->ee, 1);
2021 #undef ENGINE_COMPARE
2023 if (_elm_config->focus_highlight_enable)
2024 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2027 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2028 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2029 _debug_key_down, win);
2031 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2033 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2036 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2038 return win->win_obj;
2042 elm_win_util_standard_add(const char *name, const char *title)
2044 Evas_Object *win, *bg;
2046 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2047 if (!win) return NULL;
2048 elm_win_title_set(win, title);
2049 bg = elm_bg_add(win);
2052 evas_object_del(win);
2055 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2056 elm_win_resize_object_add(win, bg);
2057 evas_object_show(bg);
2062 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2066 ELM_CHECK_WIDTYPE(obj, widtype);
2067 win = elm_widget_data_get(obj);
2069 if (eina_list_data_find(win->subobjs, subobj)) return;
2070 win->subobjs = eina_list_append(win->subobjs, subobj);
2071 elm_widget_sub_object_add(obj, subobj);
2072 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2073 _elm_win_subobj_callback_del, obj);
2074 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2075 _elm_win_subobj_callback_changed_size_hints,
2077 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2078 evas_object_move(subobj, 0, 0);
2079 evas_object_resize(subobj, w, h);
2080 _elm_win_eval_subobjs(obj);
2084 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2087 ELM_CHECK_WIDTYPE(obj, widtype);
2088 win = elm_widget_data_get(obj);
2090 evas_object_event_callback_del_full(subobj,
2091 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2092 _elm_win_subobj_callback_changed_size_hints,
2094 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2095 _elm_win_subobj_callback_del, obj);
2096 win->subobjs = eina_list_remove(win->subobjs, subobj);
2097 elm_widget_sub_object_del(obj, subobj);
2098 _elm_win_eval_subobjs(obj);
2102 elm_win_title_set(Evas_Object *obj, const char *title)
2105 ELM_CHECK_WIDTYPE(obj, widtype);
2106 win = elm_widget_data_get(obj);
2107 if (!win || !title) return;
2108 eina_stringshare_replace(&(win->title), title);
2109 ecore_evas_title_set(win->ee, win->title);
2111 edje_object_part_text_set(win->frame_obj, "elm.text.title", win->title);
2115 elm_win_title_get(const Evas_Object *obj)
2118 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2119 win = elm_widget_data_get(obj);
2120 if (!win) return NULL;
2125 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2128 ELM_CHECK_WIDTYPE(obj, widtype);
2129 win = elm_widget_data_get(obj);
2130 if (!win || !icon_name) return;
2131 eina_stringshare_replace(&(win->icon_name), icon_name);
2132 #ifdef HAVE_ELEMENTARY_X
2133 _elm_win_xwin_update(win);
2138 elm_win_icon_name_get(const Evas_Object *obj)
2141 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2142 win = elm_widget_data_get(obj);
2143 if (!win) return NULL;
2144 return win->icon_name;
2148 elm_win_role_set(Evas_Object *obj, const char *role)
2151 ELM_CHECK_WIDTYPE(obj, widtype);
2152 win = elm_widget_data_get(obj);
2153 if (!win || !role) return;
2154 eina_stringshare_replace(&(win->role), role);
2155 #ifdef HAVE_ELEMENTARY_X
2156 _elm_win_xwin_update(win);
2161 elm_win_role_get(const Evas_Object *obj)
2164 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2165 win = elm_widget_data_get(obj);
2166 if (!win) return NULL;
2171 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2174 ELM_CHECK_WIDTYPE(obj, widtype);
2175 win = elm_widget_data_get(obj);
2178 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2179 _elm_win_obj_icon_callback_del, win);
2182 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2183 _elm_win_obj_icon_callback_del, win);
2184 #ifdef HAVE_ELEMENTARY_X
2185 _elm_win_xwin_update(win);
2189 EAPI const Evas_Object *
2190 elm_win_icon_object_get(const Evas_Object *obj)
2193 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2194 win = elm_widget_data_get(obj);
2195 if (!win) return NULL;
2200 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2203 ELM_CHECK_WIDTYPE(obj, widtype);
2204 win = elm_widget_data_get(obj);
2206 win->autodel = autodel;
2210 elm_win_autodel_get(const Evas_Object *obj)
2213 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2214 win = elm_widget_data_get(obj);
2215 if (!win) return EINA_FALSE;
2216 return win->autodel;
2220 elm_win_activate(Evas_Object *obj)
2223 ELM_CHECK_WIDTYPE(obj, widtype);
2224 win = elm_widget_data_get(obj);
2226 ecore_evas_activate(win->ee);
2230 elm_win_lower(Evas_Object *obj)
2233 ELM_CHECK_WIDTYPE(obj, widtype);
2234 win = elm_widget_data_get(obj);
2236 ecore_evas_lower(win->ee);
2240 elm_win_raise(Evas_Object *obj)
2243 ELM_CHECK_WIDTYPE(obj, widtype);
2244 win = elm_widget_data_get(obj);
2246 ecore_evas_raise(win->ee);
2250 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2253 int win_w, win_h, screen_w, screen_h, nx, ny;
2254 ELM_CHECK_WIDTYPE(obj, widtype);
2255 win = elm_widget_data_get(obj);
2257 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2258 if ((!screen_w) || (!screen_h)) return;
2259 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2260 if ((!win_w) || (!win_h)) return;
2261 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2262 else nx = win->screen.x;
2263 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2264 else ny = win->screen.y;
2267 evas_object_move(obj, nx, ny);
2271 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2274 ELM_CHECK_WIDTYPE(obj, widtype);
2275 win = elm_widget_data_get(obj);
2277 ecore_evas_borderless_set(win->ee, borderless);
2278 #ifdef HAVE_ELEMENTARY_X
2279 _elm_win_xwin_update(win);
2284 elm_win_borderless_get(const Evas_Object *obj)
2287 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2288 win = elm_widget_data_get(obj);
2289 if (!win) return EINA_FALSE;
2290 return ecore_evas_borderless_get(win->ee);
2294 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2297 ELM_CHECK_WIDTYPE(obj, widtype);
2298 win = elm_widget_data_get(obj);
2300 ecore_evas_shaped_set(win->ee, shaped);
2301 #ifdef HAVE_ELEMENTARY_X
2302 _elm_win_xwin_update(win);
2307 elm_win_shaped_get(const Evas_Object *obj)
2310 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2311 win = elm_widget_data_get(obj);
2312 if (!win) return EINA_FALSE;
2313 return ecore_evas_shaped_get(win->ee);
2317 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2320 ELM_CHECK_WIDTYPE(obj, widtype);
2321 win = elm_widget_data_get(obj);
2326 else if (win->img_obj)
2328 evas_object_image_alpha_set(win->img_obj, alpha);
2329 ecore_evas_alpha_set(win->ee, alpha);
2333 #ifdef HAVE_ELEMENTARY_X
2338 if (!_elm_config->compositing)
2339 elm_win_shaped_set(obj, alpha);
2341 ecore_evas_alpha_set(win->ee, alpha);
2344 ecore_evas_alpha_set(win->ee, alpha);
2345 _elm_win_xwin_update(win);
2349 ecore_evas_alpha_set(win->ee, alpha);
2354 elm_win_alpha_get(const Evas_Object *obj)
2357 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2358 win = elm_widget_data_get(obj);
2359 if (!win) return EINA_FALSE;
2363 else if (win->img_obj)
2365 return evas_object_image_alpha_get(win->img_obj);
2367 return ecore_evas_alpha_get(win->ee);
2371 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2374 ELM_CHECK_WIDTYPE(obj, widtype);
2375 win = elm_widget_data_get(obj);
2377 ecore_evas_override_set(win->ee, override);
2378 #ifdef HAVE_ELEMENTARY_X
2379 _elm_win_xwin_update(win);
2384 elm_win_override_get(const Evas_Object *obj)
2387 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2388 win = elm_widget_data_get(obj);
2389 if (!win) return EINA_FALSE;
2390 return ecore_evas_override_get(win->ee);
2394 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2397 ELM_CHECK_WIDTYPE(obj, widtype);
2398 win = elm_widget_data_get(obj);
2400 // YYY: handle if win->img_obj
2401 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2402 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2403 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2405 // these engines... can ONLY be fullscreen
2410 win->fullscreen = fullscreen;
2411 ecore_evas_fullscreen_set(win->ee, fullscreen);
2412 #ifdef HAVE_ELEMENTARY_X
2413 _elm_win_xwin_update(win);
2416 #undef ENGINE_COMPARE
2420 elm_win_fullscreen_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 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2427 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2428 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2430 // these engines... can ONLY be fullscreen
2435 return win->fullscreen;
2437 #undef ENGINE_COMPARE
2441 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2444 ELM_CHECK_WIDTYPE(obj, widtype);
2445 win = elm_widget_data_get(obj);
2447 win->maximized = maximized;
2448 // YYY: handle if win->img_obj
2449 ecore_evas_maximized_set(win->ee, maximized);
2450 #ifdef HAVE_ELEMENTARY_X
2451 _elm_win_xwin_update(win);
2456 elm_win_maximized_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 return win->maximized;
2466 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2469 ELM_CHECK_WIDTYPE(obj, widtype);
2470 win = elm_widget_data_get(obj);
2472 win->iconified = iconified;
2473 ecore_evas_iconified_set(win->ee, iconified);
2474 #ifdef HAVE_ELEMENTARY_X
2475 _elm_win_xwin_update(win);
2480 elm_win_iconified_get(const Evas_Object *obj)
2483 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2484 win = elm_widget_data_get(obj);
2485 if (!win) return EINA_FALSE;
2486 return win->iconified;
2490 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2493 ELM_CHECK_WIDTYPE(obj, widtype);
2494 win = elm_widget_data_get(obj);
2496 win->withdrawn = withdrawn;
2497 ecore_evas_withdrawn_set(win->ee, withdrawn);
2498 #ifdef HAVE_ELEMENTARY_X
2499 _elm_win_xwin_update(win);
2504 elm_win_withdrawn_get(const Evas_Object *obj)
2507 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2508 win = elm_widget_data_get(obj);
2509 if (!win) return EINA_FALSE;
2510 return win->withdrawn;
2514 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2517 ELM_CHECK_WIDTYPE(obj, widtype);
2518 win = elm_widget_data_get(obj);
2520 win->urgent = urgent;
2521 ecore_evas_urgent_set(win->ee, urgent);
2522 #ifdef HAVE_ELEMENTARY_X
2523 _elm_win_xwin_update(win);
2528 elm_win_urgent_get(const Evas_Object *obj)
2531 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2532 win = elm_widget_data_get(obj);
2533 if (!win) return EINA_FALSE;
2538 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2541 ELM_CHECK_WIDTYPE(obj, widtype);
2542 win = elm_widget_data_get(obj);
2544 win->demand_attention = demand_attention;
2545 ecore_evas_demand_attention_set(win->ee, demand_attention);
2546 #ifdef HAVE_ELEMENTARY_X
2547 _elm_win_xwin_update(win);
2552 elm_win_demand_attention_get(const Evas_Object *obj)
2555 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2556 win = elm_widget_data_get(obj);
2557 if (!win) return EINA_FALSE;
2558 return win->demand_attention;
2562 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2565 ELM_CHECK_WIDTYPE(obj, widtype);
2566 win = elm_widget_data_get(obj);
2569 ecore_evas_modal_set(win->ee, modal);
2570 #ifdef HAVE_ELEMENTARY_X
2571 _elm_win_xwin_update(win);
2576 elm_win_modal_get(const Evas_Object *obj)
2579 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2580 win = elm_widget_data_get(obj);
2581 if (!win) return EINA_FALSE;
2586 elm_win_aspect_set(Evas_Object *obj, double aspect)
2589 ELM_CHECK_WIDTYPE(obj, widtype);
2590 win = elm_widget_data_get(obj);
2592 win->aspect = aspect;
2593 ecore_evas_aspect_set(win->ee, aspect);
2594 #ifdef HAVE_ELEMENTARY_X
2595 _elm_win_xwin_update(win);
2600 elm_win_aspect_get(const Evas_Object *obj)
2603 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2604 win = elm_widget_data_get(obj);
2605 if (!win) return EINA_FALSE;
2610 elm_win_layer_set(Evas_Object *obj, int layer)
2613 ELM_CHECK_WIDTYPE(obj, widtype);
2614 win = elm_widget_data_get(obj);
2616 ecore_evas_layer_set(win->ee, layer);
2617 #ifdef HAVE_ELEMENTARY_X
2618 _elm_win_xwin_update(win);
2623 elm_win_layer_get(const Evas_Object *obj)
2626 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2627 win = elm_widget_data_get(obj);
2628 if (!win) return -1;
2629 return ecore_evas_layer_get(win->ee);
2633 elm_win_rotation_set(Evas_Object *obj, int rotation)
2636 ELM_CHECK_WIDTYPE(obj, widtype);
2637 win = elm_widget_data_get(obj);
2639 if (win->rot == rotation) return;
2640 win->rot = rotation;
2641 ecore_evas_rotation_set(win->ee, rotation);
2642 evas_object_size_hint_min_set(obj, -1, -1);
2643 evas_object_size_hint_max_set(obj, -1, -1);
2644 _elm_win_eval_subobjs(obj);
2645 #ifdef HAVE_ELEMENTARY_X
2646 _elm_win_xwin_update(win);
2651 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2654 ELM_CHECK_WIDTYPE(obj, widtype);
2655 win = elm_widget_data_get(obj);
2657 if (win->rot == rotation) return;
2658 win->rot = rotation;
2659 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2660 evas_object_size_hint_min_set(obj, -1, -1);
2661 evas_object_size_hint_max_set(obj, -1, -1);
2662 _elm_win_eval_subobjs(obj);
2663 #ifdef HAVE_ELEMENTARY_X
2664 _elm_win_xwin_update(win);
2669 elm_win_rotation_get(const Evas_Object *obj)
2672 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2673 win = elm_widget_data_get(obj);
2674 if (!win) return -1;
2679 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2682 ELM_CHECK_WIDTYPE(obj, widtype);
2683 win = elm_widget_data_get(obj);
2685 win->sticky = sticky;
2686 ecore_evas_sticky_set(win->ee, sticky);
2687 #ifdef HAVE_ELEMENTARY_X
2688 _elm_win_xwin_update(win);
2693 elm_win_sticky_get(const Evas_Object *obj)
2696 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2697 win = elm_widget_data_get(obj);
2698 if (!win) return EINA_FALSE;
2703 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2706 ELM_CHECK_WIDTYPE(obj, widtype);
2707 win = elm_widget_data_get(obj);
2709 if (mode == win->kbdmode) return;
2710 #ifdef HAVE_ELEMENTARY_X
2711 _elm_win_xwindow_get(win);
2713 win->kbdmode = mode;
2714 #ifdef HAVE_ELEMENTARY_X
2716 ecore_x_e_virtual_keyboard_state_set
2717 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2721 EAPI Elm_Win_Keyboard_Mode
2722 elm_win_keyboard_mode_get(const Evas_Object *obj)
2725 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2726 win = elm_widget_data_get(obj);
2727 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2728 return win->kbdmode;
2732 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2735 ELM_CHECK_WIDTYPE(obj, widtype);
2736 win = elm_widget_data_get(obj);
2738 #ifdef HAVE_ELEMENTARY_X
2739 _elm_win_xwindow_get(win);
2741 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2748 elm_win_keyboard_win_get(const Evas_Object *obj)
2751 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2752 win = elm_widget_data_get(obj);
2753 if (!win) return EINA_FALSE;
2754 #ifdef HAVE_ELEMENTARY_X
2755 _elm_win_xwindow_get(win);
2757 return ecore_x_e_virtual_keyboard_get(win->xwin);
2763 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2766 ELM_CHECK_WIDTYPE(obj, widtype);
2767 win = elm_widget_data_get(obj);
2769 if (mode == win->indmode) return;
2770 #ifdef HAVE_ELEMENTARY_X
2771 _elm_win_xwindow_get(win);
2773 win->indmode = mode;
2774 #ifdef HAVE_ELEMENTARY_X
2777 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
2778 ecore_x_e_illume_indicator_state_set
2779 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
2780 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
2781 ecore_x_e_illume_indicator_state_set
2782 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
2787 EAPI Elm_Win_Indicator_Mode
2788 elm_win_indicator_mode_get(const Evas_Object *obj)
2791 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
2792 win = elm_widget_data_get(obj);
2793 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
2794 return win->indmode;
2798 elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode)
2801 ELM_CHECK_WIDTYPE(obj, widtype);
2802 win = elm_widget_data_get(obj);
2804 if (mode == win->ind_o_mode) return;
2805 win->ind_o_mode = mode;
2806 #ifdef HAVE_ELEMENTARY_X
2807 _elm_win_xwindow_get(win);
2810 if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
2811 ecore_x_e_illume_indicator_opacity_set
2812 (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
2813 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
2814 ecore_x_e_illume_indicator_opacity_set
2815 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
2816 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
2817 ecore_x_e_illume_indicator_opacity_set
2818 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
2824 EAPI Elm_Win_Indicator_Opacity_Mode
2825 elm_win_indicator_opacity_get(const Evas_Object *obj)
2828 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2829 win = elm_widget_data_get(obj);
2830 if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2831 return win->ind_o_mode;
2835 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2838 ELM_CHECK_WIDTYPE(obj, widtype);
2839 win = elm_widget_data_get(obj);
2841 if (x) *x = win->screen.x;
2842 if (y) *y = win->screen.y;
2846 elm_win_focus_get(const Evas_Object *obj)
2849 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2850 win = elm_widget_data_get(obj);
2851 if (!win) return EINA_FALSE;
2852 return ecore_evas_focus_get(win->ee);
2856 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2859 ELM_CHECK_WIDTYPE(obj, widtype);
2860 win = elm_widget_data_get(obj);
2862 win->constrain = !!constrain;
2866 elm_win_screen_constrain_get(Evas_Object *obj)
2869 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2870 win = elm_widget_data_get(obj);
2871 if (!win) return EINA_FALSE;
2872 return win->constrain;
2876 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2879 ELM_CHECK_WIDTYPE(obj, widtype);
2880 win = elm_widget_data_get(obj);
2882 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2886 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2889 ELM_CHECK_WIDTYPE(obj, widtype);
2890 win = elm_widget_data_get(obj);
2892 #ifdef HAVE_ELEMENTARY_X
2893 _elm_win_xwindow_get(win);
2895 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2902 elm_win_conformant_get(const 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 #ifdef HAVE_ELEMENTARY_X
2909 _elm_win_xwindow_get(win);
2911 return ecore_x_e_illume_conformant_get(win->xwin);
2917 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2920 ELM_CHECK_WIDTYPE(obj, widtype);
2921 win = elm_widget_data_get(obj);
2923 #ifdef HAVE_ELEMENTARY_X
2924 _elm_win_xwindow_get(win);
2927 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2930 Ecore_X_Window_State states[2];
2932 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2933 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2934 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2935 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2944 elm_win_quickpanel_get(const Evas_Object *obj)
2947 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2948 win = elm_widget_data_get(obj);
2949 if (!win) return EINA_FALSE;
2950 #ifdef HAVE_ELEMENTARY_X
2951 _elm_win_xwindow_get(win);
2953 return ecore_x_e_illume_quickpanel_get(win->xwin);
2959 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2962 ELM_CHECK_WIDTYPE(obj, widtype);
2963 win = elm_widget_data_get(obj);
2965 #ifdef HAVE_ELEMENTARY_X
2966 _elm_win_xwindow_get(win);
2968 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2975 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2978 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2979 win = elm_widget_data_get(obj);
2980 if (!win) return -1;
2981 #ifdef HAVE_ELEMENTARY_X
2982 _elm_win_xwindow_get(win);
2984 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2990 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2993 ELM_CHECK_WIDTYPE(obj, widtype);
2994 win = elm_widget_data_get(obj);
2996 #ifdef HAVE_ELEMENTARY_X
2997 _elm_win_xwindow_get(win);
2999 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3006 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3009 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3010 win = elm_widget_data_get(obj);
3011 if (!win) return -1;
3012 #ifdef HAVE_ELEMENTARY_X
3013 _elm_win_xwindow_get(win);
3015 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3021 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3024 ELM_CHECK_WIDTYPE(obj, widtype);
3025 win = elm_widget_data_get(obj);
3027 #ifdef HAVE_ELEMENTARY_X
3028 _elm_win_xwindow_get(win);
3030 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3037 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3040 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3041 win = elm_widget_data_get(obj);
3043 #ifdef HAVE_ELEMENTARY_X
3044 _elm_win_xwindow_get(win);
3046 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3052 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3055 ELM_CHECK_WIDTYPE(obj, widtype);
3056 win = elm_widget_data_get(obj);
3058 win->skip_focus = skip;
3059 ecore_evas_focus_skip_set(win->ee, skip);
3063 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3066 ELM_CHECK_WIDTYPE(obj, widtype);
3067 win = elm_widget_data_get(obj);
3069 #ifdef HAVE_ELEMENTARY_X
3070 _elm_win_xwindow_get(win);
3075 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3076 ecore_x_e_illume_focus_back_send(win->xwin);
3078 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3079 ecore_x_e_illume_focus_forward_send(win->xwin);
3081 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3082 ecore_x_e_illume_focus_home_send(win->xwin);
3084 case ELM_ILLUME_COMMAND_CLOSE:
3085 ecore_x_e_illume_close_send(win->xwin);
3097 elm_win_inlined_image_object_get(Evas_Object *obj)
3100 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3101 win = elm_widget_data_get(obj);
3102 if (!win) return NULL;
3103 return win->img_obj;
3107 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3111 ELM_CHECK_WIDTYPE(obj, widtype);
3113 win = elm_widget_data_get(obj);
3114 enabled = !!enabled;
3115 if (win->focus_highlight.enabled == enabled)
3118 win->focus_highlight.enabled = enabled;
3120 if (win->focus_highlight.enabled)
3121 _elm_win_focus_highlight_init(win);
3123 _elm_win_focus_highlight_shutdown(win);
3127 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3131 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3133 win = elm_widget_data_get(obj);
3134 return win->focus_highlight.enabled;
3138 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3142 ELM_CHECK_WIDTYPE(obj, widtype);
3144 win = elm_widget_data_get(obj);
3145 eina_stringshare_replace(&win->focus_highlight.style, style);
3146 win->focus_highlight.changed_theme = EINA_TRUE;
3147 _elm_win_focus_highlight_reconfigure_job_start(win);
3151 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3155 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3157 win = elm_widget_data_get(obj);
3158 return win->focus_highlight.style;
3161 typedef struct _Widget_Data Widget_Data;
3166 Evas_Object *content;
3169 static void _del_hook(Evas_Object *obj);
3170 static void _theme_hook(Evas_Object *obj);
3171 static void _sizing_eval(Evas_Object *obj);
3172 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3173 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3175 static const char *widtype2 = NULL;
3178 _del_hook(Evas_Object *obj)
3180 Widget_Data *wd = elm_widget_data_get(obj);
3186 _theme_hook(Evas_Object *obj)
3188 Widget_Data *wd = elm_widget_data_get(obj);
3189 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3191 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3194 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3198 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3200 Widget_Data *wd = elm_widget_data_get(obj);
3205 /* Try Focus cycle in subitem */
3208 elm_widget_focus_next_get(wd->content, dir, next);
3213 *next = (Evas_Object *)obj;
3218 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3220 Widget_Data *wd = elm_widget_data_get(obj);
3222 if (!wd || !item) return;
3223 edje_object_part_text_set(wd->frm, item, text);
3228 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3230 Widget_Data *wd = elm_widget_data_get(obj);
3232 if (!item || !wd || !wd->frm) return NULL;
3233 return edje_object_part_text_get(wd->frm, item);
3237 _sizing_eval(Evas_Object *obj)
3239 Widget_Data *wd = elm_widget_data_get(obj);
3240 Evas_Coord minw = -1, minh = -1;
3242 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3243 edje_object_size_min_calc(wd->frm, &minw, &minh);
3244 evas_object_size_hint_min_set(obj, minw, minh);
3245 evas_object_size_hint_max_set(obj, -1, -1);
3249 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3255 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3257 Widget_Data *wd = elm_widget_data_get(obj);
3258 Evas_Object *sub = event_info;
3259 if (sub == wd->content)
3261 evas_object_event_callback_del_full
3262 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3269 elm_win_inwin_add(Evas_Object *obj)
3275 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3276 win = elm_widget_data_get(obj);
3277 if (!win) return NULL;
3278 wd = ELM_NEW(Widget_Data);
3279 obj2 = elm_widget_add(win->evas);
3280 elm_widget_type_set(obj2, "inwin");
3281 ELM_SET_WIDTYPE(widtype2, "inwin");
3282 elm_widget_sub_object_add(obj, obj2);
3283 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3284 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3285 elm_win_resize_object_add(obj, obj2);
3287 elm_widget_data_set(obj2, wd);
3288 elm_widget_del_hook_set(obj2, _del_hook);
3289 elm_widget_theme_hook_set(obj2, _theme_hook);
3290 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3291 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3292 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3293 elm_widget_can_focus_set(obj2, EINA_TRUE);
3294 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3296 wd->frm = edje_object_add(win->evas);
3297 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3298 elm_widget_resize_object_set(obj2, wd->frm);
3300 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3307 elm_win_inwin_activate(Evas_Object *obj)
3309 ELM_CHECK_WIDTYPE(obj, widtype2);
3310 Widget_Data *wd = elm_widget_data_get(obj);
3312 evas_object_raise(obj);
3313 evas_object_show(obj);
3314 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3315 elm_object_focus_set(obj, EINA_TRUE);
3319 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3321 ELM_CHECK_WIDTYPE(obj, widtype2);
3322 Widget_Data *wd = elm_widget_data_get(obj);
3324 if (wd->content == content) return;
3325 if (wd->content) evas_object_del(wd->content);
3326 wd->content = content;
3329 elm_widget_sub_object_add(obj, content);
3330 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3331 _changed_size_hints, obj);
3332 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3338 elm_win_inwin_content_get(const Evas_Object *obj)
3340 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3341 Widget_Data *wd = elm_widget_data_get(obj);
3342 if (!wd) return NULL;
3347 elm_win_inwin_content_unset(Evas_Object *obj)
3349 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3350 Widget_Data *wd = elm_widget_data_get(obj);
3351 if (!wd) return NULL;
3352 if (!wd->content) return NULL;
3353 Evas_Object *content = wd->content;
3354 elm_widget_sub_object_del(obj, wd->content);
3355 evas_object_event_callback_del_full(wd->content,
3356 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3357 _changed_size_hints, obj);
3358 edje_object_part_unswallow(wd->frm, wd->content);
3364 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3369 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3370 win = elm_widget_data_get(obj);
3371 if (!win) return EINA_FALSE;
3372 if (!win->ee) return EINA_FALSE;
3374 if(!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3380 /* windowing specific calls - shall we do this differently? */
3382 static Ecore_X_Window
3383 _elm_ee_win_get(const Evas_Object *obj)
3386 #ifdef HAVE_ELEMENTARY_X
3387 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3388 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3394 elm_win_xwindow_get(const Evas_Object *obj)
3400 type = elm_widget_type_get(obj);
3401 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3402 win = elm_widget_data_get(obj);
3404 #ifdef HAVE_ELEMENTARY_X
3405 if (win->xwin) return win->xwin;
3406 if (win->parent) return elm_win_xwindow_get(win->parent);