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;
29 int *autodel_clear, rot;
38 Evas_Object *obj, *hot_obj;
46 Eina_Bool visible : 1;
47 Eina_Bool handled : 1;
51 Ecore_Job *reconf_job;
53 Eina_Bool enabled : 1;
54 Eina_Bool changed_theme : 1;
55 Eina_Bool top_animate : 1;
56 Eina_Bool geometry_changed : 1;
61 const char *icon_name;
67 Eina_Bool demand_attention : 1;
68 Eina_Bool autodel : 1;
69 Eina_Bool constrain : 1;
70 Eina_Bool resizing : 1;
71 Eina_Bool iconified : 1;
72 Eina_Bool withdrawn : 1;
74 Eina_Bool fullscreen : 1;
75 Eina_Bool maximized : 1;
76 Eina_Bool skip_focus : 1;
79 static const char *widtype = NULL;
80 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
81 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
82 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
83 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
84 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
85 static void _elm_win_move(Ecore_Evas *ee);
86 static void _elm_win_resize(Ecore_Evas *ee);
87 static void _elm_win_delete_request(Ecore_Evas *ee);
88 static void _elm_win_resize_job(void *data);
89 #ifdef HAVE_ELEMENTARY_X
90 static void _elm_win_xwin_update(Elm_Win *win);
92 static void _elm_win_eval_subobjs(Evas_Object *obj);
93 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
94 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
95 static void _elm_win_focus_highlight_init(Elm_Win *win);
96 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
97 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
98 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
99 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
100 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
101 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
103 static void _elm_win_frame_add(Elm_Win *win, const char *style);
104 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
105 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
106 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
107 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
108 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
110 //static void _elm_win_pointer_add(Elm_Win *win, const char *style);
112 static const char SIG_DELETE_REQUEST[] = "delete,request";
113 static const char SIG_FOCUS_OUT[] = "focus,out";
114 static const char SIG_FOCUS_IN[] = "focus,in";
115 static const char SIG_MOVED[] = "moved";
116 static const char SIG_THEME_CHANGED[] = "theme,changed";
117 static const char SIG_WITHDRAWN[] = "withdrawn";
118 static const char SIG_ICONIFIED[] = "iconified";
119 static const char SIG_NORMAL[] = "normal";
120 static const char SIG_STICK[] = "stick";
121 static const char SIG_UNSTICK[] = "unstick";
122 static const char SIG_FULLSCREEN[] = "fullscreen";
123 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
124 static const char SIG_MAXIMIZED[] = "maximized";
125 static const char SIG_UNMAXIMIZED[] = "unmaximized";
127 static const Evas_Smart_Cb_Description _signals[] = {
128 {SIG_DELETE_REQUEST, ""},
137 {SIG_FULLSCREEN, ""},
138 {SIG_UNFULLSCREEN, ""},
140 {SIG_UNMAXIMIZED, ""},
146 Eina_List *_elm_win_list = NULL;
147 int _elm_win_deferred_free = 0;
149 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
150 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
153 _shot_delay_get(Elm_Win *win)
156 char *d = strdup(win->shot.info);
159 for (p = (char *)win->shot.info; *p; p++)
161 if (!strncmp(p, "delay=", 6))
165 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
180 _shot_file_get(Elm_Win *win)
183 char *tmp = strdup(win->shot.info);
184 char *repname = NULL;
186 if (!tmp) return NULL;
188 for (p = (char *)win->shot.info; *p; p++)
190 if (!strncmp(p, "file=", 5))
193 if (!win->shot.repeat_count) return tmp;
196 char *dotptr = strrchr(tmp, '.');
199 size_t size = sizeof(char)*(strlen(tmp) + 16);
200 repname = malloc(size);
201 strncpy(repname, tmp, dotptr - tmp);
202 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
203 win->shot.shot_counter + 1);
204 strcat(repname, dotptr);
212 if (!win->shot.repeat_count) return strdup("out.png");
214 repname = malloc(sizeof(char) * 24);
215 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
220 _shot_repeat_count_get(Elm_Win *win)
223 char *d = strdup(win->shot.info);
226 for (p = (char *)win->shot.info; *p; p++)
228 if (!strncmp(p, "repeat=", 7))
232 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
239 if (v > 1000) v = 999;
249 _shot_key_get(Elm_Win *win __UNUSED__)
255 _shot_flags_get(Elm_Win *win __UNUSED__)
261 _shot_do(Elm_Win *win)
265 unsigned int *pixels;
267 char *file, *key, *flags;
269 ecore_evas_manual_render(win->ee);
270 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
272 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
273 if ((w < 1) || (h < 1)) return;
274 file = _shot_file_get(win);
276 key = _shot_key_get(win);
277 flags = _shot_flags_get(win);
278 ee = ecore_evas_buffer_new(1, 1);
279 o = evas_object_image_add(ecore_evas_get(ee));
280 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
281 evas_object_image_size_set(o, w, h);
282 evas_object_image_data_set(o, pixels);
283 if (!evas_object_image_save(o, file, key, flags))
285 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
290 if (flags) free(flags);
292 if (win->shot.repeat_count) win->shot.shot_counter++;
296 _shot_delay(void *data)
300 if (win->shot.repeat_count)
302 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
303 if (remainshot > 0) return EINA_TRUE;
305 win->shot.timer = NULL;
311 _shot_init(Elm_Win *win)
313 if (!win->shot.info) return;
314 win->shot.repeat_count = _shot_repeat_count_get(win);
315 win->shot.shot_counter = 0;
319 _shot_handle(Elm_Win *win)
321 if (!win->shot.info) return;
322 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
326 _elm_win_move(Ecore_Evas *ee)
328 Evas_Object *obj = ecore_evas_object_associate_get(ee);
333 win = elm_widget_data_get(obj);
335 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
338 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
342 _elm_win_resize(Ecore_Evas *ee)
344 Evas_Object *obj = ecore_evas_object_associate_get(ee);
348 win = elm_widget_data_get(obj);
350 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
351 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
355 _elm_win_mouse_in(Ecore_Evas *ee)
360 if (!(obj = ecore_evas_object_associate_get(ee))) return;
361 if (!(win = elm_widget_data_get(obj))) return;
362 if (win->resizing) win->resizing = EINA_FALSE;
366 _elm_win_focus_in(Ecore_Evas *ee)
368 Evas_Object *obj = ecore_evas_object_associate_get(ee);
372 win = elm_widget_data_get(obj);
374 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
375 if (!elm_widget_focus_order_get(obj))
377 elm_widget_focus_steal(win->win_obj);
381 elm_widget_focus_restore(win->win_obj);
382 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
383 win->focus_highlight.cur.visible = EINA_TRUE;
384 _elm_win_focus_highlight_reconfigure_job_start(win);
387 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
389 else if (win->img_obj)
396 _elm_win_focus_out(Ecore_Evas *ee)
398 Evas_Object *obj = ecore_evas_object_associate_get(ee);
402 win = elm_widget_data_get(obj);
404 elm_object_focus_set(win->win_obj, EINA_FALSE);
405 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
406 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
407 win->focus_highlight.cur.visible = EINA_FALSE;
408 _elm_win_focus_highlight_reconfigure_job_start(win);
411 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
413 else if (win->img_obj)
420 _elm_win_state_change(Ecore_Evas *ee)
424 Eina_Bool ch_withdrawn = EINA_FALSE;
425 Eina_Bool ch_sticky = EINA_FALSE;
426 Eina_Bool ch_iconified = EINA_FALSE;
427 Eina_Bool ch_fullscreen = EINA_FALSE;
428 Eina_Bool ch_maximized = EINA_FALSE;
430 if (!(obj = ecore_evas_object_associate_get(ee))) return;
432 if (!(win = elm_widget_data_get(obj))) return;
434 if (win->withdrawn != ecore_evas_withdrawn_get(win->ee))
436 win->withdrawn = ecore_evas_withdrawn_get(win->ee);
437 ch_withdrawn = EINA_TRUE;
439 if (win->sticky != ecore_evas_sticky_get(win->ee))
441 win->sticky = ecore_evas_sticky_get(win->ee);
442 ch_sticky = EINA_TRUE;
444 if (win->iconified != ecore_evas_iconified_get(win->ee))
446 win->iconified = ecore_evas_iconified_get(win->ee);
447 ch_iconified = EINA_TRUE;
449 if (win->fullscreen != ecore_evas_fullscreen_get(win->ee))
451 win->fullscreen = ecore_evas_fullscreen_get(win->ee);
452 ch_fullscreen = EINA_TRUE;
454 if (win->maximized != ecore_evas_maximized_get(win->ee))
456 win->maximized = ecore_evas_maximized_get(win->ee);
457 ch_maximized = EINA_TRUE;
459 if ((ch_withdrawn) || (ch_iconified))
462 evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL);
463 else if (win->iconified)
464 evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL);
466 evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL);
471 evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL);
473 evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL);
478 evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL);
480 evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL);
485 evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL);
487 evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL);
492 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
494 Elm_Win *wd = elm_widget_data_get(obj);
495 const Eina_List *items;
496 void *(*list_data_get) (const Eina_List *list);
504 if (!(items = elm_widget_focus_custom_chain_get(obj)))
510 list_data_get = eina_list_data_get;
512 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
518 *next = (Evas_Object *)obj;
523 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
525 Elm_Win *win = elm_widget_data_get(obj);
529 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
531 evas_object_focus_set(obj, elm_widget_focus_get(obj));
535 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
537 if (type == EVAS_CALLBACK_KEY_DOWN)
539 Evas_Event_Key_Down *ev = event_info;
540 if (!strcmp(ev->keyname, "Tab"))
542 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
543 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
545 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
546 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
549 else if ((!strcmp(ev->keyname, "Left")) ||
550 (!strcmp(ev->keyname, "KP_Left")))
552 //TODO : woohyun jung
554 else if ((!strcmp(ev->keyname, "Right")) ||
555 (!strcmp(ev->keyname, "KP_Right")))
557 //TODO : woohyun jung
559 else if ((!strcmp(ev->keyname, "Up")) ||
560 (!strcmp(ev->keyname, "KP_Up")))
562 //TODO : woohyun jung
564 else if ((!strcmp(ev->keyname, "Down")) ||
565 (!strcmp(ev->keyname, "KP_Down")))
567 //TODO : woohyun jung
575 _deferred_ecore_evas_free(void *data)
577 ecore_evas_free(data);
578 _elm_win_deferred_free--;
582 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
586 if (!win->show_count) win->show_count++;
587 if (win->shot.info) _shot_handle(win);
591 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
597 evas_object_hide(win->frame_obj);
599 else if (win->img_obj)
601 evas_object_hide(win->img_obj);
603 if (win->pointer.obj)
605 evas_object_hide(win->pointer.obj);
606 ecore_evas_hide(win->pointer.ee);
611 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
618 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
619 _elm_win_obj_callback_parent_del, win);
622 if (win->autodel_clear) *(win->autodel_clear) = -1;
623 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
624 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
627 ecore_evas_callback_delete_request_set(win->ee, NULL);
628 ecore_evas_callback_resize_set(win->ee, NULL);
630 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
631 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
632 if (win->shot.info) eina_stringshare_del(win->shot.info);
633 if (win->shot.timer) ecore_timer_del(win->shot.timer);
634 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
635 _elm_win_obj_callback_del, win);
636 while (((child = evas_object_bottom_get(win->evas))) &&
639 evas_object_del(child);
641 while (((child = evas_object_top_get(win->evas))) &&
644 evas_object_del(child);
646 #ifdef HAVE_ELEMENTARY_X
647 if (win->client_message_handler)
648 ecore_event_handler_del(win->client_message_handler);
650 // FIXME: Why are we flushing edje on every window destroy ??
651 // edje_file_cache_flush();
652 // edje_collection_cache_flush();
653 // evas_image_cache_flush(win->evas);
654 // evas_font_cache_flush(win->evas);
655 // FIXME: we are in the del handler for the object and delete the canvas
656 // that lives under it from the handler... nasty. deferring doesn't help either
666 ecore_job_add(_deferred_ecore_evas_free, win->ee);
667 _elm_win_deferred_free++;
671 _elm_win_focus_highlight_shutdown(win);
672 eina_stringshare_del(win->focus_highlight.style);
674 if (win->title) eina_stringshare_del(win->title);
675 if (win->icon_name) eina_stringshare_del(win->icon_name);
676 if (win->role) eina_stringshare_del(win->role);
677 if (win->icon) evas_object_del(win->icon);
681 if ((!_elm_win_list) &&
682 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
684 edje_file_cache_flush();
685 edje_collection_cache_flush();
686 evas_image_cache_flush(e);
687 evas_font_cache_flush(e);
693 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
696 if (!win->img_obj) return;
697 evas_object_event_callback_del_full
698 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
699 evas_object_del(win->img_obj);
703 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
706 if (obj == win->parent) win->parent = NULL;
710 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
716 if ((x != win->screen.x) || (y != win->screen.y))
720 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
725 evas_object_move(obj, x, y);
730 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
733 // this is called to make sure all smart containers have calculated their
734 // sizes BEFORE we show the window to make sure it initially appears at
735 // our desired size (ie min size is known first)
736 evas_smart_objects_calculate(evas_object_evas_get(obj));
739 evas_object_show(win->frame_obj);
741 else if (win->img_obj)
743 evas_object_show(win->img_obj);
745 if (win->pointer.obj)
747 ecore_evas_show(win->pointer.ee);
748 evas_object_show(win->pointer.obj);
749 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
751 evas_object_show(obj);
755 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
759 if (ecore_evas_override_get(win->ee))
763 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
766 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
772 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
776 else if (win->img_obj)
780 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
783 // evas_object_move(win->img_obj, x, y);
788 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
795 else if (win->img_obj)
797 Evas_Coord w = 1, h = 1;
799 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
803 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
809 evas_object_image_size_set(win->img_obj, w, h);
814 _elm_win_delete_request(Ecore_Evas *ee)
816 Evas_Object *obj = ecore_evas_object_associate_get(ee);
818 if (strcmp(elm_widget_type_get(obj), "win")) return;
820 win = elm_widget_data_get(obj);
822 int autodel = win->autodel;
823 win->autodel_clear = &autodel;
824 evas_object_ref(win->win_obj);
825 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
826 // FIXME: if above callback deletes - then the below will be invalid
827 if (autodel) evas_object_del(win->win_obj);
828 else win->autodel_clear = NULL;
829 evas_object_unref(win->win_obj);
833 _elm_win_resize_job(void *data)
840 win->deferred_resize_job = NULL;
841 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
845 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
851 evas_object_resize(win->frame_obj, w, h);
853 else if (win->img_obj)
856 evas_object_resize(win->win_obj, w, h);
857 EINA_LIST_FOREACH(win->subobjs, l, obj)
859 evas_object_move(obj, 0, 0);
860 evas_object_resize(obj, w, h);
864 #ifdef HAVE_ELEMENTARY_X
866 _elm_win_xwindow_get(Elm_Win *win)
870 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
871 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
873 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
875 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
876 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
877 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
878 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
879 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
880 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
881 ENGINE_COMPARE(ELM_OPENGL_COCOA))
884 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
886 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
888 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
890 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
893 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
895 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
898 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
900 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
902 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
904 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
906 #undef ENGINE_COMPARE
910 #ifdef HAVE_ELEMENTARY_X
912 _elm_win_xwin_update(Elm_Win *win)
916 _elm_win_xwindow_get(win);
921 win2 = elm_widget_data_get(win->parent);
925 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
929 if (!win->xwin) return; /* nothing more to do */
932 if (!s) s = _elm_appname;
934 if (win->icon_name) s = win->icon_name;
935 ecore_x_icccm_icon_name_set(win->xwin, s);
936 ecore_x_netwm_icon_name_set(win->xwin, s);
939 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
946 data = evas_object_image_data_get(win->icon, EINA_FALSE);
950 int w = 0, h = 0, stride, x, y;
954 evas_object_image_size_get(win->icon, &w, &h);
955 stride = evas_object_image_stride_get(win->icon);
956 if ((w > 0) && (h > 0) &&
957 (stride >= (int)(w * sizeof(unsigned int))))
961 ic.data = malloc(w * h * sizeof(unsigned int));
965 p = (unsigned char *)data;
966 p2 = (unsigned int *)ic.data;
967 for (y = 0; y < h; y++)
969 for (x = 0; x < w; x++)
971 *p2 = *((unsigned int *)p);
972 p += sizeof(unsigned int);
975 p += (stride - (w * sizeof(unsigned int)));
977 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
981 evas_object_image_data_set(win->icon, data);
988 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
990 case ELM_WIN_DIALOG_BASIC:
991 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
993 case ELM_WIN_DESKTOP:
994 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
997 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
999 case ELM_WIN_TOOLBAR:
1000 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1003 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1005 case ELM_WIN_UTILITY:
1006 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1008 case ELM_WIN_SPLASH:
1009 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1011 case ELM_WIN_DROPDOWN_MENU:
1012 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1014 case ELM_WIN_POPUP_MENU:
1015 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1017 case ELM_WIN_TOOLTIP:
1018 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1020 case ELM_WIN_NOTIFICATION:
1021 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1024 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1027 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1032 ecore_x_e_virtual_keyboard_state_set
1033 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1034 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
1035 ecore_x_e_illume_indicator_state_set
1036 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1037 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
1038 ecore_x_e_illume_indicator_state_set
1039 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1044 _elm_win_eval_subobjs(Evas_Object *obj)
1047 const Evas_Object *child;
1049 Elm_Win *win = elm_widget_data_get(obj);
1050 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1054 EINA_LIST_FOREACH(win->subobjs, l, child)
1056 evas_object_size_hint_weight_get(child, &wx, &wy);
1057 if (wx == 0.0) xx = 0;
1058 if (wy == 0.0) xy = 0;
1060 evas_object_size_hint_min_get(child, &w, &h);
1063 if (w > minw) minw = w;
1064 if (h > minh) minh = h;
1066 evas_object_size_hint_max_get(child, &w, &h);
1069 if (maxw == -1) maxw = w;
1070 else if ((w > 0) && (w < maxw)) maxw = w;
1071 if (maxh == -1) maxh = h;
1072 else if ((h > 0) && (h < maxh)) maxh = h;
1074 if (!xx) maxw = minw;
1076 if (!xy) maxh = minh;
1078 evas_object_size_hint_min_set(obj, minw, minh);
1079 evas_object_size_hint_max_set(obj, maxw, maxh);
1080 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1081 if (w < minw) w = minw;
1082 if (h < minh) h = minh;
1083 if ((maxw >= 0) && (w > maxw)) w = maxw;
1084 if ((maxh >= 0) && (h > maxh)) h = maxh;
1085 evas_object_resize(obj, w, h);
1089 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1091 Elm_Win *win = elm_widget_data_get(data);
1092 win->subobjs = eina_list_remove(win->subobjs, obj);
1093 _elm_win_eval_subobjs(win->win_obj);
1097 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1099 _elm_win_eval_subobjs(data);
1103 _elm_win_shutdown(void)
1105 while (_elm_win_list)
1106 evas_object_del(_elm_win_list->data);
1110 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1117 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1118 elm_widget_theme(obj);
1122 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1123 elm_widget_theme_specific(obj, th, EINA_FALSE);
1128 _elm_win_translate(void)
1133 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1134 elm_widget_translate(obj);
1137 #ifdef HAVE_ELEMENTARY_X
1139 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1141 Elm_Win *win = data;
1142 Ecore_X_Event_Client_Message *e = event;
1144 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1145 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1147 if ((unsigned)e->data.l[0] == win->xwin)
1149 Evas *evas = evas_object_evas_get(win->win_obj);
1152 edje_file_cache_flush();
1153 edje_collection_cache_flush();
1154 evas_image_cache_flush(evas);
1155 evas_font_cache_flush(evas);
1159 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1161 if ((unsigned)e->data.l[0] == win->xwin)
1163 Evas *evas = evas_object_evas_get(win->win_obj);
1166 edje_file_cache_flush();
1167 edje_collection_cache_flush();
1168 evas_image_cache_flush(evas);
1169 evas_font_cache_flush(evas);
1170 evas_render_dump(evas);
1174 return ECORE_CALLBACK_PASS_ON;
1179 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1181 Elm_Win *win = data;
1183 win->focus_highlight.geometry_changed = EINA_TRUE;
1184 _elm_win_focus_highlight_reconfigure_job_start(win);
1188 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1190 Elm_Win *win = data;
1192 win->focus_highlight.geometry_changed = EINA_TRUE;
1193 _elm_win_focus_highlight_reconfigure_job_start(win);
1197 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1199 Elm_Win *win = data;
1201 win->focus_highlight.cur.target = NULL;
1203 _elm_win_focus_highlight_reconfigure_job_start(win);
1207 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1209 Evas_Object *obj = win->focus_highlight.cur.target;
1211 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1212 _elm_win_focus_target_move, win);
1213 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1214 _elm_win_focus_target_resize, win);
1215 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1216 _elm_win_focus_target_del, win);
1220 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1222 Evas_Object *obj = win->focus_highlight.cur.target;
1224 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1225 _elm_win_focus_target_move, win);
1226 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1227 _elm_win_focus_target_resize, win);
1228 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1229 _elm_win_focus_target_del, win);
1232 static Evas_Object *
1233 _elm_win_focus_target_get(Evas_Object *obj)
1235 Evas_Object *o = obj;
1239 if (elm_widget_is(o))
1241 if (!elm_widget_highlight_ignore_get(o))
1243 o = elm_widget_parent_get(o);
1245 o = evas_object_smart_parent_get(o);
1249 o = elm_widget_parent_widget_get(o);
1251 o = evas_object_smart_parent_get(o);
1260 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1262 Evas_Object *obj = event_info, *target;
1263 Elm_Win *win = data;
1265 if (win->focus_highlight.cur.target == obj)
1268 target = _elm_win_focus_target_get(obj);
1269 win->focus_highlight.cur.target = target;
1270 if (elm_widget_highlight_in_theme_get(target))
1271 win->focus_highlight.cur.handled = EINA_TRUE;
1273 _elm_win_focus_target_callbacks_add(win);
1275 _elm_win_focus_highlight_reconfigure_job_start(win);
1279 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1281 Elm_Win *win = data;
1283 if (!win->focus_highlight.cur.target)
1286 if (!win->focus_highlight.cur.handled)
1287 _elm_win_focus_target_callbacks_del(win);
1288 win->focus_highlight.cur.target = NULL;
1289 win->focus_highlight.cur.handled = EINA_FALSE;
1291 _elm_win_focus_highlight_reconfigure_job_start(win);
1295 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1297 evas_object_hide(obj);
1301 _elm_win_focus_highlight_init(Elm_Win *win)
1303 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1304 _elm_win_object_focus_in, win);
1305 evas_event_callback_add(win->evas,
1306 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1307 _elm_win_object_focus_out, win);
1309 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1311 win->focus_highlight.top = edje_object_add(win->evas);
1312 win->focus_highlight.changed_theme = EINA_TRUE;
1313 edje_object_signal_callback_add(win->focus_highlight.top,
1314 "elm,action,focus,hide,end", "",
1315 _elm_win_focus_highlight_hide, NULL);
1316 edje_object_signal_callback_add(win->focus_highlight.top,
1317 "elm,action,focus,anim,end", "",
1318 _elm_win_focus_highlight_anim_end, win);
1319 _elm_win_focus_highlight_reconfigure_job_start(win);
1323 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1325 _elm_win_focus_highlight_reconfigure_job_stop(win);
1326 if (win->focus_highlight.cur.target)
1328 _elm_win_focus_target_callbacks_del(win);
1329 win->focus_highlight.cur.target = NULL;
1331 if (win->focus_highlight.top)
1333 evas_object_del(win->focus_highlight.top);
1334 win->focus_highlight.top = NULL;
1337 evas_event_callback_del_full(win->evas,
1338 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1339 _elm_win_object_focus_in, win);
1340 evas_event_callback_del_full(win->evas,
1341 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1342 _elm_win_object_focus_out, win);
1346 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1350 top = win->focus_highlight.top;
1355 evas_object_show(top);
1356 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1362 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1367 _elm_win_focus_highlight_reconfigure_job(void *data)
1369 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1373 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1375 if (win->focus_highlight.reconf_job)
1376 ecore_job_del(win->focus_highlight.reconf_job);
1377 win->focus_highlight.reconf_job = ecore_job_add(
1378 _elm_win_focus_highlight_reconfigure_job, win);
1382 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1384 if (win->focus_highlight.reconf_job)
1385 ecore_job_del(win->focus_highlight.reconf_job);
1386 win->focus_highlight.reconf_job = NULL;
1390 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1392 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1393 Evas_Coord x, y, w, h;
1395 clip = evas_object_clip_get(target);
1396 evas_object_geometry_get(target, &x, &y, &w, &h);
1398 evas_object_move(obj, x, y);
1399 evas_object_resize(obj, w, h);
1400 evas_object_clip_set(obj, clip);
1404 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1406 Evas_Coord tx, ty, tw, th;
1407 Evas_Coord w, h, px, py, pw, ph;
1408 Edje_Message_Int_Set *m;
1409 Evas_Object *previous = win->focus_highlight.prev.target;
1410 Evas_Object *target = win->focus_highlight.cur.target;
1412 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1413 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1414 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1415 evas_object_move(obj, 0, 0);
1416 evas_object_resize(obj, tw, th);
1417 evas_object_clip_unset(obj);
1419 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1429 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1433 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1435 Elm_Win *win = data;
1436 _elm_win_focus_highlight_simple_setup(win, obj);
1440 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1442 Evas_Object *target = win->focus_highlight.cur.target;
1443 Evas_Object *previous = win->focus_highlight.prev.target;
1444 Evas_Object *top = win->focus_highlight.top;
1445 Eina_Bool visible_changed;
1446 Eina_Bool common_visible;
1447 const char *sig = NULL;
1449 _elm_win_focus_highlight_reconfigure_job_stop(win);
1451 visible_changed = (win->focus_highlight.cur.visible !=
1452 win->focus_highlight.prev.visible);
1454 if ((target == previous) && (!visible_changed) &&
1455 (!win->focus_highlight.geometry_changed))
1458 if ((previous) && (win->focus_highlight.prev.handled))
1459 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1462 common_visible = EINA_FALSE;
1463 else if (win->focus_highlight.cur.handled)
1465 common_visible = EINA_FALSE;
1466 if (win->focus_highlight.cur.visible)
1467 sig = "elm,action,focus_highlight,show";
1469 sig = "elm,action,focus_highlight,hide";
1472 common_visible = win->focus_highlight.cur.visible;
1474 _elm_win_focus_highlight_visible_set(win, common_visible);
1476 elm_widget_signal_emit(target, sig, "elm");
1478 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1481 if (win->focus_highlight.changed_theme)
1484 if (win->focus_highlight.style)
1485 str = win->focus_highlight.style;
1488 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1490 win->focus_highlight.changed_theme = EINA_FALSE;
1492 if (_elm_config->focus_highlight_animate)
1494 str = edje_object_data_get(win->focus_highlight.top, "animate");
1495 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1499 if ((win->focus_highlight.top_animate) && (previous) &&
1500 (!win->focus_highlight.prev.handled))
1501 _elm_win_focus_highlight_anim_setup(win, top);
1503 _elm_win_focus_highlight_simple_setup(win, top);
1504 evas_object_raise(top);
1507 win->focus_highlight.geometry_changed = EINA_FALSE;
1508 win->focus_highlight.prev = win->focus_highlight.cur;
1512 _elm_win_frame_add(Elm_Win *win, const char *style)
1514 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1516 win->frame_obj = edje_object_add(win->evas);
1517 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1518 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1519 evas_object_move(win->frame_obj, 0, 0);
1520 evas_object_resize(win->frame_obj, 1, 1);
1522 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1523 "elm", _elm_win_frame_cb_move_start, win);
1524 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1525 "*", _elm_win_frame_cb_resize_start, win);
1526 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1527 "elm", _elm_win_frame_cb_minimize, win);
1528 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1529 "elm", _elm_win_frame_cb_maximize, win);
1530 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1531 "elm", _elm_win_frame_cb_close, win);
1535 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1539 if (!(win = data)) return;
1540 /* FIXME: Change mouse pointer */
1542 /* NB: 0,0 are dummy values. Wayland handles the move by itself */
1543 ecore_evas_move(win->ee, 0, 0);
1547 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1551 if (!(win = data)) return;
1552 if (win->resizing) return;
1553 win->resizing = EINA_TRUE;
1555 /* FIXME: Change mouse pointer */
1557 if (!strcmp(source, "elm.event.resize.t"))
1558 win->resize_location = 1;
1559 else if (!strcmp(source, "elm.event.resize.b"))
1560 win->resize_location = 2;
1561 else if (!strcmp(source, "elm.event.resize.l"))
1562 win->resize_location = 4;
1563 else if (!strcmp(source, "elm.event.resize.r"))
1564 win->resize_location = 8;
1565 else if (!strcmp(source, "elm.event.resize.tl"))
1566 win->resize_location = 5;
1567 else if (!strcmp(source, "elm.event.resize.tr"))
1568 win->resize_location = 9;
1569 else if (!strcmp(source, "elm.event.resize.bl"))
1570 win->resize_location = 6;
1571 else if (!strcmp(source, "elm.event.resize.br"))
1572 win->resize_location = 10;
1574 win->resize_location = 0;
1576 if (win->resize_location > 0)
1577 ecore_evas_wayland_resize(win->ee, win->resize_location);
1581 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1585 if (!(win = data)) return;
1586 win->iconified = EINA_TRUE;
1587 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1591 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1595 if (!(win = data)) return;
1596 if (win->maximized) win->maximized = EINA_FALSE;
1597 else win->maximized = EINA_TRUE;
1598 ecore_evas_maximized_set(win->ee, win->maximized);
1602 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1606 if (!(win = data)) return;
1607 evas_object_del(win->win_obj);
1612 _elm_win_pointer_add(Elm_Win *win, const char *style)
1618 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1619 ecore_evas_resize(win->pointer.ee, 32, 32);
1621 win->pointer.evas = ecore_evas_get(win->ee);
1623 win->pointer.obj = edje_object_add(win->pointer.evas);
1624 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1625 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1626 evas_object_move(win->pointer.obj, 0, 0);
1627 evas_object_resize(win->pointer.obj, 32, 32);
1628 evas_object_show(win->pointer.obj);
1634 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1636 Evas_Event_Key_Down *ev = event_info;
1638 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1641 if ((strcmp(ev->keyname, "F12")) ||
1642 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1645 printf("Tree graph generated.\n");
1646 elm_object_tree_dot_dump(obj, "./dump.dot");
1651 _win_img_hide(void *data,
1653 Evas_Object *obj __UNUSED__,
1654 void *event_info __UNUSED__)
1656 Elm_Win *win = data;
1658 elm_widget_focus_hide_handle(win->win_obj);
1662 _win_img_mouse_up(void *data,
1664 Evas_Object *obj __UNUSED__,
1667 Elm_Win *win = data;
1668 Evas_Event_Mouse_Up *ev = event_info;
1669 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1670 elm_widget_focus_mouse_up_handle(win->win_obj);
1674 _win_img_focus_in(void *data,
1676 Evas_Object *obj __UNUSED__,
1677 void *event_info __UNUSED__)
1679 Elm_Win *win = data;
1680 elm_widget_focus_steal(win->win_obj);
1684 _win_img_focus_out(void *data,
1686 Evas_Object *obj __UNUSED__,
1687 void *event_info __UNUSED__)
1689 Elm_Win *win = data;
1690 elm_widget_focused_object_clear(win->win_obj);
1694 _win_inlined_image_set(Elm_Win *win)
1696 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1697 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1698 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1699 _elm_win_obj_callback_img_obj_del, win);
1701 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1702 _win_img_hide, win);
1703 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1704 _win_img_mouse_up, win);
1705 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1706 _win_img_focus_in, win);
1707 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1708 _win_img_focus_out, win);
1712 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1714 evas_object_event_callback_del_full(subobj,
1715 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1716 _elm_win_subobj_callback_changed_size_hints,
1718 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1719 _elm_win_subobj_callback_del, obj);
1720 win->subobjs = eina_list_remove(win->subobjs, subobj);
1721 _elm_win_eval_subobjs(obj);
1725 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1727 Elm_Win *win = data;
1728 if (win->icon == obj) win->icon = NULL;
1732 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1736 const char *fontpath;
1738 win = ELM_NEW(Elm_Win);
1740 #define FALLBACK_TRY(engine) \
1743 CRITICAL(engine " engine creation failed. Trying default."); \
1744 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1746 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
1748 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
1750 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
1751 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
1755 case ELM_WIN_INLINED_IMAGE:
1758 Evas *e = evas_object_evas_get(parent);
1761 ee = ecore_evas_ecore_evas_get(e);
1763 win->img_obj = ecore_evas_object_image_new(ee);
1764 if (!win->img_obj) break;
1765 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1768 _win_inlined_image_set(win);
1771 evas_object_del(win->img_obj);
1772 win->img_obj = NULL;
1776 case ELM_WIN_SOCKET_IMAGE:
1777 win->ee = ecore_evas_extn_socket_new(1, 1);
1781 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1783 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1784 #ifdef HAVE_ELEMENTARY_X
1785 win->client_message_handler = ecore_event_handler_add
1786 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1788 FALLBACK_TRY("Sofware X11");
1790 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1792 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1793 FALLBACK_TRY("Sofware FB");
1795 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1797 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1798 FALLBACK_TRY("Sofware DirectFB");
1800 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1802 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1803 FALLBACK_TRY("Sofware-16");
1804 #ifdef HAVE_ELEMENTARY_X
1805 win->client_message_handler = ecore_event_handler_add
1806 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1809 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1811 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1812 FALLBACK_TRY("Sofware-8");
1813 #ifdef HAVE_ELEMENTARY_X
1814 win->client_message_handler = ecore_event_handler_add
1815 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1819 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1821 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1822 FALLBACK_TRY("XRender");
1823 #ifdef HAVE_ELEMENTARY_X
1824 win->client_message_handler = ecore_event_handler_add
1825 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1829 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1834 if (_elm_config->vsync)
1836 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1842 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1844 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1845 FALLBACK_TRY("OpenGL");
1846 #ifdef HAVE_ELEMENTARY_X
1847 win->client_message_handler = ecore_event_handler_add
1848 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1851 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1853 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1854 FALLBACK_TRY("Sofware Win32");
1856 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1858 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1859 FALLBACK_TRY("Sofware-16-WinCE");
1861 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1863 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1864 FALLBACK_TRY("PSL1GHT");
1866 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1868 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1869 FALLBACK_TRY("Sofware SDL");
1871 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1873 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1874 FALLBACK_TRY("Sofware-16-SDL");
1876 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1878 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1879 FALLBACK_TRY("OpenGL SDL");
1881 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1883 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1884 FALLBACK_TRY("OpenGL Cocoa");
1886 else if (ENGINE_COMPARE(ELM_BUFFER))
1888 win->ee = ecore_evas_buffer_new(1, 1);
1890 else if (ENGINE_COMPARE(ELM_EWS))
1892 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1894 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1896 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
1897 win->evas = ecore_evas_get(win->ee);
1899 _elm_win_frame_add(win, "default");
1900 // _elm_win_pointer_add(win, "default");
1902 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
1904 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
1905 win->evas = ecore_evas_get(win->ee);
1907 _elm_win_frame_add(win, "default");
1908 // _elm_win_pointer_add(win, "default");
1910 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
1912 win->ee = ecore_evas_buffer_new(1, 1);
1913 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1914 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
1923 ERR("Cannot create window.");
1927 #ifdef HAVE_ELEMENTARY_X
1928 _elm_win_xwindow_get(win);
1930 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1931 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1932 // bg pixmap done by x - has other issues like can be redrawn by x before it
1933 // is filled/ready by app
1934 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1937 win->parent = parent;
1939 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1940 _elm_win_obj_callback_parent_del, win);
1942 win->evas = ecore_evas_get(win->ee);
1943 win->win_obj = elm_widget_add(win->evas);
1944 elm_widget_type_set(win->win_obj, "win");
1945 ELM_SET_WIDTYPE(widtype, "win");
1946 elm_widget_data_set(win->win_obj, win);
1947 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1948 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1949 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1950 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1951 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1952 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1953 evas_object_move(win->win_obj, 0, 0);
1954 evas_object_resize(win->win_obj, 1, 1);
1955 evas_object_layer_set(win->win_obj, 50);
1956 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1960 evas_object_clip_set(win->win_obj, win->frame_obj);
1961 evas_object_stack_below(win->frame_obj, win->win_obj);
1964 if (type == ELM_WIN_INLINED_IMAGE)
1965 elm_widget_parent2_set(win->win_obj, parent);
1966 ecore_evas_object_associate(win->ee, win->win_obj,
1967 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1968 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1969 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1970 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1971 _elm_win_obj_callback_show, win);
1972 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1973 _elm_win_obj_callback_hide, win);
1974 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1975 _elm_win_obj_callback_del, win);
1976 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1977 _elm_win_obj_callback_move, win);
1978 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1979 _elm_win_obj_callback_resize, win);
1981 evas_object_intercept_move_callback_add(win->win_obj,
1982 _elm_win_obj_intercept_move, win);
1983 evas_object_intercept_show_callback_add(win->win_obj,
1984 _elm_win_obj_intercept_show, win);
1986 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
1987 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1988 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1989 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1990 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
1991 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1992 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1993 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1994 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
1995 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1996 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1997 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1998 evas_font_path_append(win->evas, fontpath);
1999 if (!_elm_config->font_hinting)
2000 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2001 else if (_elm_config->font_hinting == 1)
2002 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2003 else if (_elm_config->font_hinting == 2)
2004 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2006 #ifdef HAVE_ELEMENTARY_X
2007 _elm_win_xwin_update(win);
2010 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2012 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2014 ecore_evas_fullscreen_set(win->ee, 1);
2016 #undef ENGINE_COMPARE
2018 if (_elm_config->focus_highlight_enable)
2019 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2022 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2023 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2024 _debug_key_down, win);
2026 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2028 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2031 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2033 return win->win_obj;
2037 elm_win_util_standard_add(const char *name, const char *title)
2039 Evas_Object *win, *bg;
2041 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2042 if (!win) return NULL;
2043 elm_win_title_set(win, title);
2044 bg = elm_bg_add(win);
2047 evas_object_del(win);
2050 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2051 elm_win_resize_object_add(win, bg);
2052 evas_object_show(bg);
2057 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2061 ELM_CHECK_WIDTYPE(obj, widtype);
2062 win = elm_widget_data_get(obj);
2064 if (eina_list_data_find(win->subobjs, subobj)) return;
2065 win->subobjs = eina_list_append(win->subobjs, subobj);
2066 elm_widget_sub_object_add(obj, subobj);
2067 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2068 _elm_win_subobj_callback_del, obj);
2069 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2070 _elm_win_subobj_callback_changed_size_hints,
2072 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2073 evas_object_move(subobj, 0, 0);
2074 evas_object_resize(subobj, w, h);
2075 _elm_win_eval_subobjs(obj);
2079 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2082 ELM_CHECK_WIDTYPE(obj, widtype);
2083 win = elm_widget_data_get(obj);
2085 evas_object_event_callback_del_full(subobj,
2086 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2087 _elm_win_subobj_callback_changed_size_hints,
2089 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2090 _elm_win_subobj_callback_del, obj);
2091 win->subobjs = eina_list_remove(win->subobjs, subobj);
2092 elm_widget_sub_object_del(obj, subobj);
2093 _elm_win_eval_subobjs(obj);
2097 elm_win_title_set(Evas_Object *obj, const char *title)
2100 ELM_CHECK_WIDTYPE(obj, widtype);
2101 win = elm_widget_data_get(obj);
2102 if (!win || !title) return;
2103 eina_stringshare_replace(&(win->title), title);
2104 ecore_evas_title_set(win->ee, win->title);
2106 edje_object_part_text_set(win->frame_obj, "elm.text.title", win->title);
2110 elm_win_title_get(const Evas_Object *obj)
2113 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2114 win = elm_widget_data_get(obj);
2115 if (!win) return NULL;
2120 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2123 ELM_CHECK_WIDTYPE(obj, widtype);
2124 win = elm_widget_data_get(obj);
2125 if (!win || !icon_name) return;
2126 eina_stringshare_replace(&(win->icon_name), icon_name);
2127 #ifdef HAVE_ELEMENTARY_X
2128 _elm_win_xwin_update(win);
2133 elm_win_icon_name_get(const Evas_Object *obj)
2136 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2137 win = elm_widget_data_get(obj);
2138 if (!win) return NULL;
2139 return win->icon_name;
2143 elm_win_role_set(Evas_Object *obj, const char *role)
2146 ELM_CHECK_WIDTYPE(obj, widtype);
2147 win = elm_widget_data_get(obj);
2148 if (!win || !role) return;
2149 eina_stringshare_replace(&(win->role), role);
2150 #ifdef HAVE_ELEMENTARY_X
2151 _elm_win_xwin_update(win);
2156 elm_win_role_get(const Evas_Object *obj)
2159 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2160 win = elm_widget_data_get(obj);
2161 if (!win) return NULL;
2166 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2169 ELM_CHECK_WIDTYPE(obj, widtype);
2170 win = elm_widget_data_get(obj);
2173 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2174 _elm_win_obj_icon_callback_del, win);
2177 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2178 _elm_win_obj_icon_callback_del, win);
2179 #ifdef HAVE_ELEMENTARY_X
2180 _elm_win_xwin_update(win);
2184 EAPI const Evas_Object *
2185 elm_win_icon_object_get(const Evas_Object *obj)
2188 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2189 win = elm_widget_data_get(obj);
2190 if (!win) return NULL;
2195 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2198 ELM_CHECK_WIDTYPE(obj, widtype);
2199 win = elm_widget_data_get(obj);
2201 win->autodel = autodel;
2205 elm_win_autodel_get(const Evas_Object *obj)
2208 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2209 win = elm_widget_data_get(obj);
2210 if (!win) return EINA_FALSE;
2211 return win->autodel;
2215 elm_win_activate(Evas_Object *obj)
2218 ELM_CHECK_WIDTYPE(obj, widtype);
2219 win = elm_widget_data_get(obj);
2221 ecore_evas_activate(win->ee);
2225 elm_win_lower(Evas_Object *obj)
2228 ELM_CHECK_WIDTYPE(obj, widtype);
2229 win = elm_widget_data_get(obj);
2231 ecore_evas_lower(win->ee);
2235 elm_win_raise(Evas_Object *obj)
2238 ELM_CHECK_WIDTYPE(obj, widtype);
2239 win = elm_widget_data_get(obj);
2241 ecore_evas_raise(win->ee);
2245 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2248 int win_w, win_h, screen_w, screen_h, nx, ny;
2249 ELM_CHECK_WIDTYPE(obj, widtype);
2250 win = elm_widget_data_get(obj);
2252 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2253 if ((!screen_w) || (!screen_h)) return;
2254 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2255 if ((!win_w) || (!win_h)) return;
2256 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2257 else nx = win->screen.x;
2258 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2259 else ny = win->screen.y;
2262 evas_object_move(obj, nx, ny);
2266 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2269 ELM_CHECK_WIDTYPE(obj, widtype);
2270 win = elm_widget_data_get(obj);
2272 ecore_evas_borderless_set(win->ee, borderless);
2273 #ifdef HAVE_ELEMENTARY_X
2274 _elm_win_xwin_update(win);
2279 elm_win_borderless_get(const Evas_Object *obj)
2282 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2283 win = elm_widget_data_get(obj);
2284 if (!win) return EINA_FALSE;
2285 return ecore_evas_borderless_get(win->ee);
2289 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2292 ELM_CHECK_WIDTYPE(obj, widtype);
2293 win = elm_widget_data_get(obj);
2295 ecore_evas_shaped_set(win->ee, shaped);
2296 #ifdef HAVE_ELEMENTARY_X
2297 _elm_win_xwin_update(win);
2302 elm_win_shaped_get(const Evas_Object *obj)
2305 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2306 win = elm_widget_data_get(obj);
2307 if (!win) return EINA_FALSE;
2308 return ecore_evas_shaped_get(win->ee);
2312 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2315 ELM_CHECK_WIDTYPE(obj, widtype);
2316 win = elm_widget_data_get(obj);
2321 else if (win->img_obj)
2323 evas_object_image_alpha_set(win->img_obj, alpha);
2324 ecore_evas_alpha_set(win->ee, alpha);
2328 #ifdef HAVE_ELEMENTARY_X
2333 if (!_elm_config->compositing)
2334 elm_win_shaped_set(obj, alpha);
2336 ecore_evas_alpha_set(win->ee, alpha);
2339 ecore_evas_alpha_set(win->ee, alpha);
2340 _elm_win_xwin_update(win);
2344 ecore_evas_alpha_set(win->ee, alpha);
2349 elm_win_alpha_get(const Evas_Object *obj)
2352 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2353 win = elm_widget_data_get(obj);
2354 if (!win) return EINA_FALSE;
2358 else if (win->img_obj)
2360 return evas_object_image_alpha_get(win->img_obj);
2362 return ecore_evas_alpha_get(win->ee);
2365 EINA_DEPRECATED EAPI void
2366 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
2369 ELM_CHECK_WIDTYPE(obj, widtype);
2370 win = elm_widget_data_get(obj);
2376 else if (win->img_obj)
2378 evas_object_image_alpha_set(win->img_obj, transparent);
2382 #ifdef HAVE_ELEMENTARY_X
2385 ecore_evas_transparent_set(win->ee, transparent);
2386 _elm_win_xwin_update(win);
2390 ecore_evas_transparent_set(win->ee, transparent);
2394 EINA_DEPRECATED EAPI Eina_Bool
2395 elm_win_transparent_get(const Evas_Object *obj)
2398 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2399 win = elm_widget_data_get(obj);
2400 if (!win) return EINA_FALSE;
2402 return ecore_evas_transparent_get(win->ee);
2406 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2409 ELM_CHECK_WIDTYPE(obj, widtype);
2410 win = elm_widget_data_get(obj);
2412 ecore_evas_override_set(win->ee, override);
2413 #ifdef HAVE_ELEMENTARY_X
2414 _elm_win_xwin_update(win);
2419 elm_win_override_get(const Evas_Object *obj)
2422 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2423 win = elm_widget_data_get(obj);
2424 if (!win) return EINA_FALSE;
2425 return ecore_evas_override_get(win->ee);
2429 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2432 ELM_CHECK_WIDTYPE(obj, widtype);
2433 win = elm_widget_data_get(obj);
2435 // YYY: handle if win->img_obj
2436 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2437 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2438 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2440 // these engines... can ONLY be fullscreen
2445 win->fullscreen = fullscreen;
2446 ecore_evas_fullscreen_set(win->ee, fullscreen);
2447 #ifdef HAVE_ELEMENTARY_X
2448 _elm_win_xwin_update(win);
2451 #undef ENGINE_COMPARE
2455 elm_win_fullscreen_get(const Evas_Object *obj)
2458 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2459 win = elm_widget_data_get(obj);
2460 if (!win) return EINA_FALSE;
2461 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2462 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2463 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2465 // these engines... can ONLY be fullscreen
2470 return win->fullscreen;
2472 #undef ENGINE_COMPARE
2476 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2479 ELM_CHECK_WIDTYPE(obj, widtype);
2480 win = elm_widget_data_get(obj);
2482 win->maximized = maximized;
2483 // YYY: handle if win->img_obj
2484 ecore_evas_maximized_set(win->ee, maximized);
2485 #ifdef HAVE_ELEMENTARY_X
2486 _elm_win_xwin_update(win);
2491 elm_win_maximized_get(const Evas_Object *obj)
2494 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2495 win = elm_widget_data_get(obj);
2496 if (!win) return EINA_FALSE;
2497 return win->maximized;
2501 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2504 ELM_CHECK_WIDTYPE(obj, widtype);
2505 win = elm_widget_data_get(obj);
2507 win->iconified = iconified;
2508 ecore_evas_iconified_set(win->ee, iconified);
2509 #ifdef HAVE_ELEMENTARY_X
2510 _elm_win_xwin_update(win);
2515 elm_win_iconified_get(const Evas_Object *obj)
2518 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2519 win = elm_widget_data_get(obj);
2520 if (!win) return EINA_FALSE;
2521 return win->iconified;
2525 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2528 ELM_CHECK_WIDTYPE(obj, widtype);
2529 win = elm_widget_data_get(obj);
2531 win->withdrawn = withdrawn;
2532 ecore_evas_withdrawn_set(win->ee, withdrawn);
2533 #ifdef HAVE_ELEMENTARY_X
2534 _elm_win_xwin_update(win);
2539 elm_win_withdrawn_get(const Evas_Object *obj)
2542 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2543 win = elm_widget_data_get(obj);
2544 if (!win) return EINA_FALSE;
2545 return win->withdrawn;
2549 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2552 ELM_CHECK_WIDTYPE(obj, widtype);
2553 win = elm_widget_data_get(obj);
2555 win->urgent = urgent;
2556 ecore_evas_urgent_set(win->ee, urgent);
2557 #ifdef HAVE_ELEMENTARY_X
2558 _elm_win_xwin_update(win);
2563 elm_win_urgent_get(const Evas_Object *obj)
2566 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2567 win = elm_widget_data_get(obj);
2568 if (!win) return EINA_FALSE;
2573 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2576 ELM_CHECK_WIDTYPE(obj, widtype);
2577 win = elm_widget_data_get(obj);
2579 win->demand_attention = demand_attention;
2580 ecore_evas_demand_attention_set(win->ee, demand_attention);
2581 #ifdef HAVE_ELEMENTARY_X
2582 _elm_win_xwin_update(win);
2587 elm_win_demand_attention_get(const Evas_Object *obj)
2590 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2591 win = elm_widget_data_get(obj);
2592 if (!win) return EINA_FALSE;
2593 return win->demand_attention;
2597 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2600 ELM_CHECK_WIDTYPE(obj, widtype);
2601 win = elm_widget_data_get(obj);
2604 ecore_evas_modal_set(win->ee, modal);
2605 #ifdef HAVE_ELEMENTARY_X
2606 _elm_win_xwin_update(win);
2611 elm_win_modal_get(const Evas_Object *obj)
2614 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2615 win = elm_widget_data_get(obj);
2616 if (!win) return EINA_FALSE;
2621 elm_win_aspect_set(Evas_Object *obj, double aspect)
2624 ELM_CHECK_WIDTYPE(obj, widtype);
2625 win = elm_widget_data_get(obj);
2627 win->aspect = aspect;
2628 ecore_evas_aspect_set(win->ee, aspect);
2629 #ifdef HAVE_ELEMENTARY_X
2630 _elm_win_xwin_update(win);
2635 elm_win_aspect_get(const Evas_Object *obj)
2638 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2639 win = elm_widget_data_get(obj);
2640 if (!win) return EINA_FALSE;
2645 elm_win_layer_set(Evas_Object *obj, int layer)
2648 ELM_CHECK_WIDTYPE(obj, widtype);
2649 win = elm_widget_data_get(obj);
2651 ecore_evas_layer_set(win->ee, layer);
2652 #ifdef HAVE_ELEMENTARY_X
2653 _elm_win_xwin_update(win);
2658 elm_win_layer_get(const Evas_Object *obj)
2661 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2662 win = elm_widget_data_get(obj);
2663 if (!win) return -1;
2664 return ecore_evas_layer_get(win->ee);
2668 elm_win_rotation_set(Evas_Object *obj, int rotation)
2671 ELM_CHECK_WIDTYPE(obj, widtype);
2672 win = elm_widget_data_get(obj);
2674 if (win->rot == rotation) return;
2675 win->rot = rotation;
2676 ecore_evas_rotation_set(win->ee, rotation);
2677 evas_object_size_hint_min_set(obj, -1, -1);
2678 evas_object_size_hint_max_set(obj, -1, -1);
2679 _elm_win_eval_subobjs(obj);
2680 #ifdef HAVE_ELEMENTARY_X
2681 _elm_win_xwin_update(win);
2686 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2689 ELM_CHECK_WIDTYPE(obj, widtype);
2690 win = elm_widget_data_get(obj);
2692 if (win->rot == rotation) return;
2693 win->rot = rotation;
2694 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2695 evas_object_size_hint_min_set(obj, -1, -1);
2696 evas_object_size_hint_max_set(obj, -1, -1);
2697 _elm_win_eval_subobjs(obj);
2698 #ifdef HAVE_ELEMENTARY_X
2699 _elm_win_xwin_update(win);
2704 elm_win_rotation_get(const Evas_Object *obj)
2707 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2708 win = elm_widget_data_get(obj);
2709 if (!win) return -1;
2714 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2717 ELM_CHECK_WIDTYPE(obj, widtype);
2718 win = elm_widget_data_get(obj);
2720 win->sticky = sticky;
2721 ecore_evas_sticky_set(win->ee, sticky);
2722 #ifdef HAVE_ELEMENTARY_X
2723 _elm_win_xwin_update(win);
2728 elm_win_sticky_get(const Evas_Object *obj)
2731 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2732 win = elm_widget_data_get(obj);
2733 if (!win) return EINA_FALSE;
2738 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2741 ELM_CHECK_WIDTYPE(obj, widtype);
2742 win = elm_widget_data_get(obj);
2744 if (mode == win->kbdmode) return;
2745 #ifdef HAVE_ELEMENTARY_X
2746 _elm_win_xwindow_get(win);
2748 win->kbdmode = mode;
2749 #ifdef HAVE_ELEMENTARY_X
2751 ecore_x_e_virtual_keyboard_state_set
2752 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2756 EAPI Elm_Win_Keyboard_Mode
2757 elm_win_keyboard_mode_get(const Evas_Object *obj)
2760 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2761 win = elm_widget_data_get(obj);
2762 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2763 return win->kbdmode;
2767 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2770 ELM_CHECK_WIDTYPE(obj, widtype);
2771 win = elm_widget_data_get(obj);
2773 #ifdef HAVE_ELEMENTARY_X
2774 _elm_win_xwindow_get(win);
2776 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2783 elm_win_keyboard_win_get(const Evas_Object *obj)
2786 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2787 win = elm_widget_data_get(obj);
2788 if (!win) return EINA_FALSE;
2789 #ifdef HAVE_ELEMENTARY_X
2790 _elm_win_xwindow_get(win);
2792 return ecore_x_e_virtual_keyboard_get(win->xwin);
2798 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2801 ELM_CHECK_WIDTYPE(obj, widtype);
2802 win = elm_widget_data_get(obj);
2804 if (mode == win->indmode) return;
2805 #ifdef HAVE_ELEMENTARY_X
2806 _elm_win_xwindow_get(win);
2808 win->indmode = mode;
2809 #ifdef HAVE_ELEMENTARY_X
2812 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
2813 ecore_x_e_illume_indicator_state_set
2814 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
2815 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
2816 ecore_x_e_illume_indicator_state_set
2817 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
2822 EAPI Elm_Win_Indicator_Mode
2823 elm_win_indicator_mode_get(const Evas_Object *obj)
2826 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
2827 win = elm_widget_data_get(obj);
2828 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
2829 return win->indmode;
2833 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2836 ELM_CHECK_WIDTYPE(obj, widtype);
2837 win = elm_widget_data_get(obj);
2839 if (x) *x = win->screen.x;
2840 if (y) *y = win->screen.y;
2844 elm_win_focus_get(const Evas_Object *obj)
2847 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2848 win = elm_widget_data_get(obj);
2849 if (!win) return EINA_FALSE;
2850 return ecore_evas_focus_get(win->ee);
2854 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2857 ELM_CHECK_WIDTYPE(obj, widtype);
2858 win = elm_widget_data_get(obj);
2860 win->constrain = !!constrain;
2864 elm_win_screen_constrain_get(Evas_Object *obj)
2867 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2868 win = elm_widget_data_get(obj);
2869 if (!win) return EINA_FALSE;
2870 return win->constrain;
2874 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2877 ELM_CHECK_WIDTYPE(obj, widtype);
2878 win = elm_widget_data_get(obj);
2880 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2884 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2887 ELM_CHECK_WIDTYPE(obj, widtype);
2888 win = elm_widget_data_get(obj);
2890 #ifdef HAVE_ELEMENTARY_X
2891 _elm_win_xwindow_get(win);
2893 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2900 elm_win_conformant_get(const Evas_Object *obj)
2903 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2904 win = elm_widget_data_get(obj);
2905 if (!win) return EINA_FALSE;
2906 #ifdef HAVE_ELEMENTARY_X
2907 _elm_win_xwindow_get(win);
2909 return ecore_x_e_illume_conformant_get(win->xwin);
2915 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2918 ELM_CHECK_WIDTYPE(obj, widtype);
2919 win = elm_widget_data_get(obj);
2921 #ifdef HAVE_ELEMENTARY_X
2922 _elm_win_xwindow_get(win);
2925 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2928 Ecore_X_Window_State states[2];
2930 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2931 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2932 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2933 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2942 elm_win_quickpanel_get(const Evas_Object *obj)
2945 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2946 win = elm_widget_data_get(obj);
2947 if (!win) return EINA_FALSE;
2948 #ifdef HAVE_ELEMENTARY_X
2949 _elm_win_xwindow_get(win);
2951 return ecore_x_e_illume_quickpanel_get(win->xwin);
2957 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2960 ELM_CHECK_WIDTYPE(obj, widtype);
2961 win = elm_widget_data_get(obj);
2963 #ifdef HAVE_ELEMENTARY_X
2964 _elm_win_xwindow_get(win);
2966 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2973 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2976 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2977 win = elm_widget_data_get(obj);
2978 if (!win) return -1;
2979 #ifdef HAVE_ELEMENTARY_X
2980 _elm_win_xwindow_get(win);
2982 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2988 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2991 ELM_CHECK_WIDTYPE(obj, widtype);
2992 win = elm_widget_data_get(obj);
2994 #ifdef HAVE_ELEMENTARY_X
2995 _elm_win_xwindow_get(win);
2997 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3004 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3007 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3008 win = elm_widget_data_get(obj);
3009 if (!win) return -1;
3010 #ifdef HAVE_ELEMENTARY_X
3011 _elm_win_xwindow_get(win);
3013 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3019 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3022 ELM_CHECK_WIDTYPE(obj, widtype);
3023 win = elm_widget_data_get(obj);
3025 #ifdef HAVE_ELEMENTARY_X
3026 _elm_win_xwindow_get(win);
3028 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3035 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3038 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3039 win = elm_widget_data_get(obj);
3041 #ifdef HAVE_ELEMENTARY_X
3042 _elm_win_xwindow_get(win);
3044 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3050 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3053 ELM_CHECK_WIDTYPE(obj, widtype);
3054 win = elm_widget_data_get(obj);
3056 win->skip_focus = skip;
3057 ecore_evas_focus_skip_set(win->ee, skip);
3061 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3064 ELM_CHECK_WIDTYPE(obj, widtype);
3065 win = elm_widget_data_get(obj);
3067 #ifdef HAVE_ELEMENTARY_X
3068 _elm_win_xwindow_get(win);
3073 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3074 ecore_x_e_illume_focus_back_send(win->xwin);
3076 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3077 ecore_x_e_illume_focus_forward_send(win->xwin);
3079 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3080 ecore_x_e_illume_focus_home_send(win->xwin);
3082 case ELM_ILLUME_COMMAND_CLOSE:
3083 ecore_x_e_illume_close_send(win->xwin);
3095 elm_win_inlined_image_object_get(Evas_Object *obj)
3098 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3099 win = elm_widget_data_get(obj);
3100 if (!win) return NULL;
3101 return win->img_obj;
3105 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3109 ELM_CHECK_WIDTYPE(obj, widtype);
3111 win = elm_widget_data_get(obj);
3112 enabled = !!enabled;
3113 if (win->focus_highlight.enabled == enabled)
3116 win->focus_highlight.enabled = enabled;
3118 if (win->focus_highlight.enabled)
3119 _elm_win_focus_highlight_init(win);
3121 _elm_win_focus_highlight_shutdown(win);
3125 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3129 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3131 win = elm_widget_data_get(obj);
3132 return win->focus_highlight.enabled;
3136 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3140 ELM_CHECK_WIDTYPE(obj, widtype);
3142 win = elm_widget_data_get(obj);
3143 eina_stringshare_replace(&win->focus_highlight.style, style);
3144 win->focus_highlight.changed_theme = EINA_TRUE;
3145 _elm_win_focus_highlight_reconfigure_job_start(win);
3149 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3153 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3155 win = elm_widget_data_get(obj);
3156 return win->focus_highlight.style;
3159 typedef struct _Widget_Data Widget_Data;
3164 Evas_Object *content;
3167 static void _del_hook(Evas_Object *obj);
3168 static void _theme_hook(Evas_Object *obj);
3169 static void _sizing_eval(Evas_Object *obj);
3170 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3171 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3173 static const char *widtype2 = NULL;
3176 _del_hook(Evas_Object *obj)
3178 Widget_Data *wd = elm_widget_data_get(obj);
3184 _theme_hook(Evas_Object *obj)
3186 Widget_Data *wd = elm_widget_data_get(obj);
3187 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3189 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3192 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3196 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3198 Widget_Data *wd = elm_widget_data_get(obj);
3203 /* Try Focus cycle in subitem */
3206 elm_widget_focus_next_get(wd->content, dir, next);
3211 *next = (Evas_Object *)obj;
3216 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3218 Widget_Data *wd = elm_widget_data_get(obj);
3220 if (!wd || !item) return;
3221 edje_object_part_text_set(wd->frm, item, text);
3226 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3228 Widget_Data *wd = elm_widget_data_get(obj);
3230 if (!item || !wd || !wd->frm) return NULL;
3231 return edje_object_part_text_get(wd->frm, item);
3235 _sizing_eval(Evas_Object *obj)
3237 Widget_Data *wd = elm_widget_data_get(obj);
3238 Evas_Coord minw = -1, minh = -1;
3240 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3241 edje_object_size_min_calc(wd->frm, &minw, &minh);
3242 evas_object_size_hint_min_set(obj, minw, minh);
3243 evas_object_size_hint_max_set(obj, -1, -1);
3247 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3253 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3255 Widget_Data *wd = elm_widget_data_get(obj);
3256 Evas_Object *sub = event_info;
3257 if (sub == wd->content)
3259 evas_object_event_callback_del_full
3260 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3267 elm_win_inwin_add(Evas_Object *obj)
3273 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3274 win = elm_widget_data_get(obj);
3275 if (!win) return NULL;
3276 wd = ELM_NEW(Widget_Data);
3277 obj2 = elm_widget_add(win->evas);
3278 elm_widget_type_set(obj2, "inwin");
3279 ELM_SET_WIDTYPE(widtype2, "inwin");
3280 elm_widget_sub_object_add(obj, obj2);
3281 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3282 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3283 elm_win_resize_object_add(obj, obj2);
3285 elm_widget_data_set(obj2, wd);
3286 elm_widget_del_hook_set(obj2, _del_hook);
3287 elm_widget_theme_hook_set(obj2, _theme_hook);
3288 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3289 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3290 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3291 elm_widget_can_focus_set(obj2, EINA_TRUE);
3292 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3294 wd->frm = edje_object_add(win->evas);
3295 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3296 elm_widget_resize_object_set(obj2, wd->frm);
3298 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3305 elm_win_inwin_activate(Evas_Object *obj)
3307 ELM_CHECK_WIDTYPE(obj, widtype2);
3308 Widget_Data *wd = elm_widget_data_get(obj);
3310 evas_object_raise(obj);
3311 evas_object_show(obj);
3312 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3313 elm_object_focus_set(obj, EINA_TRUE);
3317 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3319 ELM_CHECK_WIDTYPE(obj, widtype2);
3320 Widget_Data *wd = elm_widget_data_get(obj);
3322 if (wd->content == content) return;
3323 if (wd->content) evas_object_del(wd->content);
3324 wd->content = content;
3327 elm_widget_sub_object_add(obj, content);
3328 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3329 _changed_size_hints, obj);
3330 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3336 elm_win_inwin_content_get(const Evas_Object *obj)
3338 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3339 Widget_Data *wd = elm_widget_data_get(obj);
3340 if (!wd) return NULL;
3345 elm_win_inwin_content_unset(Evas_Object *obj)
3347 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3348 Widget_Data *wd = elm_widget_data_get(obj);
3349 if (!wd) return NULL;
3350 if (!wd->content) return NULL;
3351 Evas_Object *content = wd->content;
3352 elm_widget_sub_object_del(obj, wd->content);
3353 evas_object_event_callback_del_full(wd->content,
3354 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3355 _changed_size_hints, obj);
3356 edje_object_part_unswallow(wd->frm, wd->content);
3362 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3367 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3368 win = elm_widget_data_get(obj);
3369 if (!win) return EINA_FALSE;
3370 if (!win->ee) return EINA_FALSE;
3372 if(!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3378 /* windowing spcific calls - shall we do this differently? */
3380 static Ecore_X_Window
3381 _elm_ee_win_get(const Evas_Object *obj)
3384 #ifdef HAVE_ELEMENTARY_X
3385 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3386 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3392 elm_win_xwindow_get(const Evas_Object *obj)
3398 type = elm_widget_type_get(obj);
3399 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3400 win = elm_widget_data_get(obj);
3402 #ifdef HAVE_ELEMENTARY_X
3403 if (win->xwin) return win->xwin;
3404 if (win->parent) return elm_win_xwindow_get(win->parent);