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 const Eina_List *list;
502 void *(*list_data_get) (const Eina_List *list);
506 list = elm_widget_sub_object_list_get(obj);
511 if (!(items = elm_widget_focus_custom_chain_get(obj)))
513 if (!list) return EINA_FALSE;
516 list_data_get = eina_list_data_get;
518 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
524 *next = (Evas_Object *)obj;
529 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
531 Elm_Win *win = elm_widget_data_get(obj);
535 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
537 evas_object_focus_set(obj, elm_widget_focus_get(obj));
541 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
543 if (type == EVAS_CALLBACK_KEY_DOWN)
545 Evas_Event_Key_Down *ev = event_info;
546 if (!strcmp(ev->keyname, "Tab"))
548 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
549 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
551 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
552 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
555 else if ((!strcmp(ev->keyname, "Left")) ||
556 (!strcmp(ev->keyname, "KP_Left")))
558 //TODO : woohyun jung
560 else if ((!strcmp(ev->keyname, "Right")) ||
561 (!strcmp(ev->keyname, "KP_Right")))
563 //TODO : woohyun jung
565 else if ((!strcmp(ev->keyname, "Up")) ||
566 (!strcmp(ev->keyname, "KP_Up")))
568 //TODO : woohyun jung
570 else if ((!strcmp(ev->keyname, "Down")) ||
571 (!strcmp(ev->keyname, "KP_Down")))
573 //TODO : woohyun jung
581 _deferred_ecore_evas_free(void *data)
583 ecore_evas_free(data);
584 _elm_win_deferred_free--;
588 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
592 if (!win->show_count) win->show_count++;
593 if (win->shot.info) _shot_handle(win);
597 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
603 evas_object_hide(win->frame_obj);
605 else if (win->img_obj)
607 evas_object_hide(win->img_obj);
609 if (win->pointer.obj)
611 evas_object_hide(win->pointer.obj);
612 ecore_evas_hide(win->pointer.ee);
617 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
620 Evas_Object *child, *child2 = NULL;
624 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
625 _elm_win_obj_callback_parent_del, win);
628 if (win->autodel_clear) *(win->autodel_clear) = -1;
629 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
630 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
633 ecore_evas_callback_delete_request_set(win->ee, NULL);
634 ecore_evas_callback_resize_set(win->ee, NULL);
636 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
637 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
638 if (win->shot.info) eina_stringshare_del(win->shot.info);
639 if (win->shot.timer) ecore_timer_del(win->shot.timer);
640 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
641 _elm_win_obj_callback_del, win);
642 child = evas_object_bottom_get(win->evas);
645 /* if the object we see *IS* the window object (because we are
646 * faking a parent object inside the canvas), then skip it and
647 * go to the next one */
650 child = evas_object_above_get(child);
653 /* if we are using the next object above from the previous loop */
656 /* this object has refcounts from the previous loop */
657 child2 = evas_object_above_get(child);
658 if (child2) evas_object_ref(child2);
659 evas_object_del(child);
660 /* so unref from previous loop */
661 evas_object_unref(child);
666 /* just delete as normal (probably only first object */
667 child2 = evas_object_above_get(child);
668 if (child2) evas_object_ref(child2);
669 evas_object_del(child);
673 #ifdef HAVE_ELEMENTARY_X
674 if (win->client_message_handler)
675 ecore_event_handler_del(win->client_message_handler);
677 // FIXME: Why are we flushing edje on every window destroy ??
678 // edje_file_cache_flush();
679 // edje_collection_cache_flush();
680 // evas_image_cache_flush(win->evas);
681 // evas_font_cache_flush(win->evas);
682 // FIXME: we are in the del handler for the object and delete the canvas
683 // that lives under it from the handler... nasty. deferring doesn't help either
693 ecore_job_add(_deferred_ecore_evas_free, win->ee);
694 _elm_win_deferred_free++;
698 _elm_win_focus_highlight_shutdown(win);
699 eina_stringshare_del(win->focus_highlight.style);
701 if (win->title) eina_stringshare_del(win->title);
702 if (win->icon_name) eina_stringshare_del(win->icon_name);
703 if (win->role) eina_stringshare_del(win->role);
704 if (win->icon) evas_object_del(win->icon);
708 if ((!_elm_win_list) &&
709 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
711 edje_file_cache_flush();
712 edje_collection_cache_flush();
713 evas_image_cache_flush(e);
714 evas_font_cache_flush(e);
720 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
723 if (!win->img_obj) return;
724 evas_object_event_callback_del_full
725 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
726 evas_object_del(win->img_obj);
730 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
733 if (obj == win->parent) win->parent = NULL;
737 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
743 if ((x != win->screen.x) || (y != win->screen.y))
747 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
752 evas_object_move(obj, x, y);
757 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
760 // this is called to make sure all smart containers have calculated their
761 // sizes BEFORE we show the window to make sure it initially appears at
762 // our desired size (ie min size is known first)
763 evas_smart_objects_calculate(evas_object_evas_get(obj));
766 evas_object_show(win->frame_obj);
768 else if (win->img_obj)
770 evas_object_show(win->img_obj);
772 if (win->pointer.obj)
774 ecore_evas_show(win->pointer.ee);
775 evas_object_show(win->pointer.obj);
776 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
778 evas_object_show(obj);
782 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
786 if (ecore_evas_override_get(win->ee))
790 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
793 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
799 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
803 else if (win->img_obj)
807 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
810 // evas_object_move(win->img_obj, x, y);
815 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
822 else if (win->img_obj)
824 Evas_Coord w = 1, h = 1;
826 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
830 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
836 evas_object_image_size_set(win->img_obj, w, h);
841 _elm_win_delete_request(Ecore_Evas *ee)
843 Evas_Object *obj = ecore_evas_object_associate_get(ee);
845 if (strcmp(elm_widget_type_get(obj), "win")) return;
847 win = elm_widget_data_get(obj);
849 int autodel = win->autodel;
850 win->autodel_clear = &autodel;
851 evas_object_ref(win->win_obj);
852 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
853 // FIXME: if above callback deletes - then the below will be invalid
854 if (autodel) evas_object_del(win->win_obj);
855 else win->autodel_clear = NULL;
856 evas_object_unref(win->win_obj);
860 _elm_win_resize_job(void *data)
867 win->deferred_resize_job = NULL;
868 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
872 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
878 evas_object_resize(win->frame_obj, w, h);
880 else if (win->img_obj)
883 evas_object_resize(win->win_obj, w, h);
884 EINA_LIST_FOREACH(win->subobjs, l, obj)
886 evas_object_move(obj, 0, 0);
887 evas_object_resize(obj, w, h);
891 #ifdef HAVE_ELEMENTARY_X
893 _elm_win_xwindow_get(Elm_Win *win)
897 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
898 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
900 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
902 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
903 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
904 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
905 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
906 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
907 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
908 ENGINE_COMPARE(ELM_OPENGL_COCOA))
911 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
913 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
915 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
917 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
920 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
922 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
925 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
927 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
929 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
931 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
933 #undef ENGINE_COMPARE
937 #ifdef HAVE_ELEMENTARY_X
939 _elm_win_xwin_update(Elm_Win *win)
943 _elm_win_xwindow_get(win);
948 win2 = elm_widget_data_get(win->parent);
952 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
956 if (!win->xwin) return; /* nothing more to do */
959 if (!s) s = _elm_appname;
961 if (win->icon_name) s = win->icon_name;
962 ecore_x_icccm_icon_name_set(win->xwin, s);
963 ecore_x_netwm_icon_name_set(win->xwin, s);
966 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
973 data = evas_object_image_data_get(win->icon, EINA_FALSE);
977 int w = 0, h = 0, stride, x, y;
981 evas_object_image_size_get(win->icon, &w, &h);
982 stride = evas_object_image_stride_get(win->icon);
983 if ((w > 0) && (h > 0) &&
984 (stride >= (int)(w * sizeof(unsigned int))))
988 ic.data = malloc(w * h * sizeof(unsigned int));
992 p = (unsigned char *)data;
993 p2 = (unsigned int *)ic.data;
994 for (y = 0; y < h; y++)
996 for (x = 0; x < w; x++)
998 *p2 = *((unsigned int *)p);
999 p += sizeof(unsigned int);
1002 p += (stride - (w * sizeof(unsigned int)));
1004 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
1008 evas_object_image_data_set(win->icon, data);
1015 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
1017 case ELM_WIN_DIALOG_BASIC:
1018 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
1020 case ELM_WIN_DESKTOP:
1021 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1024 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
1026 case ELM_WIN_TOOLBAR:
1027 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1030 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1032 case ELM_WIN_UTILITY:
1033 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1035 case ELM_WIN_SPLASH:
1036 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1038 case ELM_WIN_DROPDOWN_MENU:
1039 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1041 case ELM_WIN_POPUP_MENU:
1042 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1044 case ELM_WIN_TOOLTIP:
1045 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1047 case ELM_WIN_NOTIFICATION:
1048 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1051 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1054 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1059 ecore_x_e_virtual_keyboard_state_set
1060 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1061 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
1062 ecore_x_e_illume_indicator_state_set
1063 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1064 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
1065 ecore_x_e_illume_indicator_state_set
1066 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1071 _elm_win_eval_subobjs(Evas_Object *obj)
1074 const Evas_Object *child;
1076 Elm_Win *win = elm_widget_data_get(obj);
1077 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1081 EINA_LIST_FOREACH(win->subobjs, l, child)
1083 evas_object_size_hint_weight_get(child, &wx, &wy);
1084 if (wx == 0.0) xx = 0;
1085 if (wy == 0.0) xy = 0;
1087 evas_object_size_hint_min_get(child, &w, &h);
1090 if (w > minw) minw = w;
1091 if (h > minh) minh = h;
1093 evas_object_size_hint_max_get(child, &w, &h);
1096 if (maxw == -1) maxw = w;
1097 else if ((w > 0) && (w < maxw)) maxw = w;
1098 if (maxh == -1) maxh = h;
1099 else if ((h > 0) && (h < maxh)) maxh = h;
1101 if (!xx) maxw = minw;
1103 if (!xy) maxh = minh;
1105 evas_object_size_hint_min_set(obj, minw, minh);
1106 evas_object_size_hint_max_set(obj, maxw, maxh);
1107 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1108 if (w < minw) w = minw;
1109 if (h < minh) h = minh;
1110 if ((maxw >= 0) && (w > maxw)) w = maxw;
1111 if ((maxh >= 0) && (h > maxh)) h = maxh;
1112 evas_object_resize(obj, w, h);
1116 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1118 Elm_Win *win = elm_widget_data_get(data);
1119 win->subobjs = eina_list_remove(win->subobjs, obj);
1120 _elm_win_eval_subobjs(win->win_obj);
1124 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1126 _elm_win_eval_subobjs(data);
1130 _elm_win_shutdown(void)
1132 while (_elm_win_list)
1133 evas_object_del(_elm_win_list->data);
1137 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1144 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1145 elm_widget_theme(obj);
1149 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1150 elm_widget_theme_specific(obj, th, EINA_FALSE);
1155 _elm_win_translate(void)
1160 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1161 elm_widget_translate(obj);
1164 #ifdef HAVE_ELEMENTARY_X
1166 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1168 Elm_Win *win = data;
1169 Ecore_X_Event_Client_Message *e = event;
1171 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1172 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1174 if ((unsigned)e->data.l[0] == win->xwin)
1176 Evas *evas = evas_object_evas_get(win->win_obj);
1179 edje_file_cache_flush();
1180 edje_collection_cache_flush();
1181 evas_image_cache_flush(evas);
1182 evas_font_cache_flush(evas);
1186 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1188 if ((unsigned)e->data.l[0] == win->xwin)
1190 Evas *evas = evas_object_evas_get(win->win_obj);
1193 edje_file_cache_flush();
1194 edje_collection_cache_flush();
1195 evas_image_cache_flush(evas);
1196 evas_font_cache_flush(evas);
1197 evas_render_dump(evas);
1201 return ECORE_CALLBACK_PASS_ON;
1206 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1208 Elm_Win *win = data;
1210 win->focus_highlight.geometry_changed = EINA_TRUE;
1211 _elm_win_focus_highlight_reconfigure_job_start(win);
1215 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1217 Elm_Win *win = data;
1219 win->focus_highlight.geometry_changed = EINA_TRUE;
1220 _elm_win_focus_highlight_reconfigure_job_start(win);
1224 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1226 Elm_Win *win = data;
1228 win->focus_highlight.cur.target = NULL;
1230 _elm_win_focus_highlight_reconfigure_job_start(win);
1234 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1236 Evas_Object *obj = win->focus_highlight.cur.target;
1238 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1239 _elm_win_focus_target_move, win);
1240 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1241 _elm_win_focus_target_resize, win);
1242 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1243 _elm_win_focus_target_del, win);
1247 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1249 Evas_Object *obj = win->focus_highlight.cur.target;
1251 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1252 _elm_win_focus_target_move, win);
1253 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1254 _elm_win_focus_target_resize, win);
1255 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1256 _elm_win_focus_target_del, win);
1259 static Evas_Object *
1260 _elm_win_focus_target_get(Evas_Object *obj)
1262 Evas_Object *o = obj;
1266 if (elm_widget_is(o))
1268 if (!elm_widget_highlight_ignore_get(o))
1270 o = elm_widget_parent_get(o);
1272 o = evas_object_smart_parent_get(o);
1276 o = elm_widget_parent_widget_get(o);
1278 o = evas_object_smart_parent_get(o);
1287 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1289 Evas_Object *obj = event_info, *target;
1290 Elm_Win *win = data;
1292 if (win->focus_highlight.cur.target == obj)
1295 target = _elm_win_focus_target_get(obj);
1296 win->focus_highlight.cur.target = target;
1297 if (elm_widget_highlight_in_theme_get(target))
1298 win->focus_highlight.cur.handled = EINA_TRUE;
1300 _elm_win_focus_target_callbacks_add(win);
1302 _elm_win_focus_highlight_reconfigure_job_start(win);
1306 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1308 Elm_Win *win = data;
1310 if (!win->focus_highlight.cur.target)
1313 if (!win->focus_highlight.cur.handled)
1314 _elm_win_focus_target_callbacks_del(win);
1315 win->focus_highlight.cur.target = NULL;
1316 win->focus_highlight.cur.handled = EINA_FALSE;
1318 _elm_win_focus_highlight_reconfigure_job_start(win);
1322 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1324 evas_object_hide(obj);
1328 _elm_win_focus_highlight_init(Elm_Win *win)
1330 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1331 _elm_win_object_focus_in, win);
1332 evas_event_callback_add(win->evas,
1333 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1334 _elm_win_object_focus_out, win);
1336 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1338 win->focus_highlight.top = edje_object_add(win->evas);
1339 win->focus_highlight.changed_theme = EINA_TRUE;
1340 edje_object_signal_callback_add(win->focus_highlight.top,
1341 "elm,action,focus,hide,end", "",
1342 _elm_win_focus_highlight_hide, NULL);
1343 edje_object_signal_callback_add(win->focus_highlight.top,
1344 "elm,action,focus,anim,end", "",
1345 _elm_win_focus_highlight_anim_end, win);
1346 _elm_win_focus_highlight_reconfigure_job_start(win);
1350 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1352 _elm_win_focus_highlight_reconfigure_job_stop(win);
1353 if (win->focus_highlight.cur.target)
1355 _elm_win_focus_target_callbacks_del(win);
1356 win->focus_highlight.cur.target = NULL;
1358 if (win->focus_highlight.top)
1360 evas_object_del(win->focus_highlight.top);
1361 win->focus_highlight.top = NULL;
1364 evas_event_callback_del_full(win->evas,
1365 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1366 _elm_win_object_focus_in, win);
1367 evas_event_callback_del_full(win->evas,
1368 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1369 _elm_win_object_focus_out, win);
1373 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1377 top = win->focus_highlight.top;
1382 evas_object_show(top);
1383 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1389 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1394 _elm_win_focus_highlight_reconfigure_job(void *data)
1396 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1400 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1402 if (win->focus_highlight.reconf_job)
1403 ecore_job_del(win->focus_highlight.reconf_job);
1404 win->focus_highlight.reconf_job = ecore_job_add(
1405 _elm_win_focus_highlight_reconfigure_job, win);
1409 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1411 if (win->focus_highlight.reconf_job)
1412 ecore_job_del(win->focus_highlight.reconf_job);
1413 win->focus_highlight.reconf_job = NULL;
1417 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1419 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1420 Evas_Coord x, y, w, h;
1422 clip = evas_object_clip_get(target);
1423 evas_object_geometry_get(target, &x, &y, &w, &h);
1425 evas_object_move(obj, x, y);
1426 evas_object_resize(obj, w, h);
1427 evas_object_clip_set(obj, clip);
1431 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1433 Evas_Coord tx, ty, tw, th;
1434 Evas_Coord w, h, px, py, pw, ph;
1435 Edje_Message_Int_Set *m;
1436 Evas_Object *previous = win->focus_highlight.prev.target;
1437 Evas_Object *target = win->focus_highlight.cur.target;
1439 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1440 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1441 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1442 evas_object_move(obj, 0, 0);
1443 evas_object_resize(obj, tw, th);
1444 evas_object_clip_unset(obj);
1446 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1456 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1460 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1462 Elm_Win *win = data;
1463 _elm_win_focus_highlight_simple_setup(win, obj);
1467 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1469 Evas_Object *target = win->focus_highlight.cur.target;
1470 Evas_Object *previous = win->focus_highlight.prev.target;
1471 Evas_Object *top = win->focus_highlight.top;
1472 Eina_Bool visible_changed;
1473 Eina_Bool common_visible;
1474 const char *sig = NULL;
1476 _elm_win_focus_highlight_reconfigure_job_stop(win);
1478 visible_changed = (win->focus_highlight.cur.visible !=
1479 win->focus_highlight.prev.visible);
1481 if ((target == previous) && (!visible_changed) &&
1482 (!win->focus_highlight.geometry_changed))
1485 if ((previous) && (win->focus_highlight.prev.handled))
1486 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1489 common_visible = EINA_FALSE;
1490 else if (win->focus_highlight.cur.handled)
1492 common_visible = EINA_FALSE;
1493 if (win->focus_highlight.cur.visible)
1494 sig = "elm,action,focus_highlight,show";
1496 sig = "elm,action,focus_highlight,hide";
1499 common_visible = win->focus_highlight.cur.visible;
1501 _elm_win_focus_highlight_visible_set(win, common_visible);
1503 elm_widget_signal_emit(target, sig, "elm");
1505 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1508 if (win->focus_highlight.changed_theme)
1511 if (win->focus_highlight.style)
1512 str = win->focus_highlight.style;
1515 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1517 win->focus_highlight.changed_theme = EINA_FALSE;
1519 if (_elm_config->focus_highlight_animate)
1521 str = edje_object_data_get(win->focus_highlight.top, "animate");
1522 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1526 if ((win->focus_highlight.top_animate) && (previous) &&
1527 (!win->focus_highlight.prev.handled))
1528 _elm_win_focus_highlight_anim_setup(win, top);
1530 _elm_win_focus_highlight_simple_setup(win, top);
1531 evas_object_raise(top);
1534 win->focus_highlight.geometry_changed = EINA_FALSE;
1535 win->focus_highlight.prev = win->focus_highlight.cur;
1539 _elm_win_frame_add(Elm_Win *win, const char *style)
1541 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1543 win->frame_obj = edje_object_add(win->evas);
1544 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1545 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1546 evas_object_move(win->frame_obj, 0, 0);
1547 evas_object_resize(win->frame_obj, 1, 1);
1549 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1550 "elm", _elm_win_frame_cb_move_start, win);
1551 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1552 "*", _elm_win_frame_cb_resize_start, win);
1553 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1554 "elm", _elm_win_frame_cb_minimize, win);
1555 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1556 "elm", _elm_win_frame_cb_maximize, win);
1557 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1558 "elm", _elm_win_frame_cb_close, win);
1562 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1566 if (!(win = data)) return;
1567 /* FIXME: Change mouse pointer */
1569 /* NB: 0,0 are dummy values. Wayland handles the move by itself */
1570 ecore_evas_move(win->ee, 0, 0);
1574 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1578 if (!(win = data)) return;
1579 if (win->resizing) return;
1580 win->resizing = EINA_TRUE;
1582 /* FIXME: Change mouse pointer */
1584 if (!strcmp(source, "elm.event.resize.t"))
1585 win->resize_location = 1;
1586 else if (!strcmp(source, "elm.event.resize.b"))
1587 win->resize_location = 2;
1588 else if (!strcmp(source, "elm.event.resize.l"))
1589 win->resize_location = 4;
1590 else if (!strcmp(source, "elm.event.resize.r"))
1591 win->resize_location = 8;
1592 else if (!strcmp(source, "elm.event.resize.tl"))
1593 win->resize_location = 5;
1594 else if (!strcmp(source, "elm.event.resize.tr"))
1595 win->resize_location = 9;
1596 else if (!strcmp(source, "elm.event.resize.bl"))
1597 win->resize_location = 6;
1598 else if (!strcmp(source, "elm.event.resize.br"))
1599 win->resize_location = 10;
1601 win->resize_location = 0;
1603 if (win->resize_location > 0)
1604 ecore_evas_wayland_resize(win->ee, win->resize_location);
1608 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1612 if (!(win = data)) return;
1613 win->iconified = EINA_TRUE;
1614 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1618 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1622 if (!(win = data)) return;
1623 if (win->maximized) win->maximized = EINA_FALSE;
1624 else win->maximized = EINA_TRUE;
1625 ecore_evas_maximized_set(win->ee, win->maximized);
1629 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1633 if (!(win = data)) return;
1634 evas_object_del(win->win_obj);
1639 _elm_win_pointer_add(Elm_Win *win, const char *style)
1645 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1646 ecore_evas_resize(win->pointer.ee, 32, 32);
1648 win->pointer.evas = ecore_evas_get(win->ee);
1650 win->pointer.obj = edje_object_add(win->pointer.evas);
1651 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1652 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1653 evas_object_move(win->pointer.obj, 0, 0);
1654 evas_object_resize(win->pointer.obj, 32, 32);
1655 evas_object_show(win->pointer.obj);
1661 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1663 Evas_Event_Key_Down *ev = event_info;
1665 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1668 if ((strcmp(ev->keyname, "F12")) ||
1669 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1672 printf("Tree graph generated.\n");
1673 elm_object_tree_dot_dump(obj, "./dump.dot");
1678 _win_img_hide(void *data,
1680 Evas_Object *obj __UNUSED__,
1681 void *event_info __UNUSED__)
1683 Elm_Win *win = data;
1685 elm_widget_focus_hide_handle(win->win_obj);
1689 _win_img_mouse_up(void *data,
1691 Evas_Object *obj __UNUSED__,
1694 Elm_Win *win = data;
1695 Evas_Event_Mouse_Up *ev = event_info;
1696 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1697 elm_widget_focus_mouse_up_handle(win->win_obj);
1701 _win_img_focus_in(void *data,
1703 Evas_Object *obj __UNUSED__,
1704 void *event_info __UNUSED__)
1706 Elm_Win *win = data;
1707 elm_widget_focus_steal(win->win_obj);
1711 _win_img_focus_out(void *data,
1713 Evas_Object *obj __UNUSED__,
1714 void *event_info __UNUSED__)
1716 Elm_Win *win = data;
1717 elm_widget_focused_object_clear(win->win_obj);
1721 _win_inlined_image_set(Elm_Win *win)
1723 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1724 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1725 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1726 _elm_win_obj_callback_img_obj_del, win);
1728 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1729 _win_img_hide, win);
1730 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1731 _win_img_mouse_up, win);
1732 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1733 _win_img_focus_in, win);
1734 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1735 _win_img_focus_out, win);
1739 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1741 evas_object_event_callback_del_full(subobj,
1742 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1743 _elm_win_subobj_callback_changed_size_hints,
1745 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1746 _elm_win_subobj_callback_del, obj);
1747 win->subobjs = eina_list_remove(win->subobjs, subobj);
1748 _elm_win_eval_subobjs(obj);
1752 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1754 Elm_Win *win = data;
1755 if (win->icon == obj) win->icon = NULL;
1759 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1763 const char *fontpath;
1765 win = ELM_NEW(Elm_Win);
1767 #define FALLBACK_TRY(engine) \
1770 CRITICAL(engine " engine creation failed. Trying default."); \
1771 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1773 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
1775 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
1777 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
1778 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
1782 case ELM_WIN_INLINED_IMAGE:
1785 Evas *e = evas_object_evas_get(parent);
1788 ee = ecore_evas_ecore_evas_get(e);
1790 win->img_obj = ecore_evas_object_image_new(ee);
1791 if (!win->img_obj) break;
1792 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1795 _win_inlined_image_set(win);
1798 evas_object_del(win->img_obj);
1799 win->img_obj = NULL;
1803 case ELM_WIN_SOCKET_IMAGE:
1804 win->ee = ecore_evas_extn_socket_new(1, 1);
1808 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1810 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1811 #ifdef HAVE_ELEMENTARY_X
1812 win->client_message_handler = ecore_event_handler_add
1813 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1815 FALLBACK_TRY("Sofware X11");
1817 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1819 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1820 FALLBACK_TRY("Sofware FB");
1822 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1824 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1825 FALLBACK_TRY("Sofware DirectFB");
1827 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1829 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1830 FALLBACK_TRY("Sofware-16");
1831 #ifdef HAVE_ELEMENTARY_X
1832 win->client_message_handler = ecore_event_handler_add
1833 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1836 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1838 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1839 FALLBACK_TRY("Sofware-8");
1840 #ifdef HAVE_ELEMENTARY_X
1841 win->client_message_handler = ecore_event_handler_add
1842 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1846 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1848 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1849 FALLBACK_TRY("XRender");
1850 #ifdef HAVE_ELEMENTARY_X
1851 win->client_message_handler = ecore_event_handler_add
1852 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1856 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1861 if (_elm_config->vsync)
1863 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1869 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1871 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1872 FALLBACK_TRY("OpenGL");
1873 #ifdef HAVE_ELEMENTARY_X
1874 win->client_message_handler = ecore_event_handler_add
1875 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1878 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1880 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1881 FALLBACK_TRY("Sofware Win32");
1883 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1885 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1886 FALLBACK_TRY("Sofware-16-WinCE");
1888 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1890 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1891 FALLBACK_TRY("PSL1GHT");
1893 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1895 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1896 FALLBACK_TRY("Sofware SDL");
1898 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1900 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1901 FALLBACK_TRY("Sofware-16-SDL");
1903 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1905 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1906 FALLBACK_TRY("OpenGL SDL");
1908 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1910 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1911 FALLBACK_TRY("OpenGL Cocoa");
1913 else if (ENGINE_COMPARE(ELM_BUFFER))
1915 win->ee = ecore_evas_buffer_new(1, 1);
1917 else if (ENGINE_COMPARE(ELM_EWS))
1919 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1921 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1923 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
1924 win->evas = ecore_evas_get(win->ee);
1926 _elm_win_frame_add(win, "default");
1927 // _elm_win_pointer_add(win, "default");
1929 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
1931 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
1932 win->evas = ecore_evas_get(win->ee);
1934 _elm_win_frame_add(win, "default");
1935 // _elm_win_pointer_add(win, "default");
1937 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
1939 win->ee = ecore_evas_buffer_new(1, 1);
1940 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1941 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
1950 ERR("Cannot create window.");
1954 #ifdef HAVE_ELEMENTARY_X
1955 _elm_win_xwindow_get(win);
1957 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1958 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1959 // bg pixmap done by x - has other issues like can be redrawn by x before it
1960 // is filled/ready by app
1961 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1964 win->parent = parent;
1966 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1967 _elm_win_obj_callback_parent_del, win);
1969 win->evas = ecore_evas_get(win->ee);
1970 win->win_obj = elm_widget_add(win->evas);
1971 elm_widget_type_set(win->win_obj, "win");
1972 ELM_SET_WIDTYPE(widtype, "win");
1973 elm_widget_data_set(win->win_obj, win);
1974 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1975 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1976 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1977 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1978 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1979 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1980 evas_object_move(win->win_obj, 0, 0);
1981 evas_object_resize(win->win_obj, 1, 1);
1982 evas_object_layer_set(win->win_obj, 50);
1983 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1987 evas_object_clip_set(win->win_obj, win->frame_obj);
1988 evas_object_stack_below(win->frame_obj, win->win_obj);
1991 if (type == ELM_WIN_INLINED_IMAGE)
1992 elm_widget_parent2_set(win->win_obj, parent);
1993 ecore_evas_object_associate(win->ee, win->win_obj,
1994 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1995 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1996 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1997 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1998 _elm_win_obj_callback_show, win);
1999 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
2000 _elm_win_obj_callback_hide, win);
2001 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
2002 _elm_win_obj_callback_del, win);
2003 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
2004 _elm_win_obj_callback_move, win);
2005 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
2006 _elm_win_obj_callback_resize, win);
2008 evas_object_intercept_move_callback_add(win->win_obj,
2009 _elm_win_obj_intercept_move, win);
2010 evas_object_intercept_show_callback_add(win->win_obj,
2011 _elm_win_obj_intercept_show, win);
2013 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
2014 ecore_evas_name_class_set(win->ee, name, _elm_appname);
2015 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
2016 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
2017 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
2018 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
2019 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
2020 ecore_evas_callback_move_set(win->ee, _elm_win_move);
2021 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
2022 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
2023 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
2024 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2025 evas_font_path_append(win->evas, fontpath);
2026 if (!_elm_config->font_hinting)
2027 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2028 else if (_elm_config->font_hinting == 1)
2029 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2030 else if (_elm_config->font_hinting == 2)
2031 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2033 #ifdef HAVE_ELEMENTARY_X
2034 _elm_win_xwin_update(win);
2037 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2039 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2041 ecore_evas_fullscreen_set(win->ee, 1);
2043 #undef ENGINE_COMPARE
2045 if (_elm_config->focus_highlight_enable)
2046 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2049 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2050 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2051 _debug_key_down, win);
2053 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2055 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2058 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2060 return win->win_obj;
2064 elm_win_util_standard_add(const char *name, const char *title)
2066 Evas_Object *win, *bg;
2068 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2069 if (!win) return NULL;
2070 elm_win_title_set(win, title);
2071 bg = elm_bg_add(win);
2074 evas_object_del(win);
2077 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2078 elm_win_resize_object_add(win, bg);
2079 evas_object_show(bg);
2084 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2088 ELM_CHECK_WIDTYPE(obj, widtype);
2089 win = elm_widget_data_get(obj);
2091 if (eina_list_data_find(win->subobjs, subobj)) return;
2092 win->subobjs = eina_list_append(win->subobjs, subobj);
2093 elm_widget_sub_object_add(obj, subobj);
2094 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2095 _elm_win_subobj_callback_del, obj);
2096 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2097 _elm_win_subobj_callback_changed_size_hints,
2099 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2100 evas_object_move(subobj, 0, 0);
2101 evas_object_resize(subobj, w, h);
2102 _elm_win_eval_subobjs(obj);
2106 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2109 ELM_CHECK_WIDTYPE(obj, widtype);
2110 win = elm_widget_data_get(obj);
2112 evas_object_event_callback_del_full(subobj,
2113 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2114 _elm_win_subobj_callback_changed_size_hints,
2116 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2117 _elm_win_subobj_callback_del, obj);
2118 win->subobjs = eina_list_remove(win->subobjs, subobj);
2119 elm_widget_sub_object_del(obj, subobj);
2120 _elm_win_eval_subobjs(obj);
2124 elm_win_title_set(Evas_Object *obj, const char *title)
2127 ELM_CHECK_WIDTYPE(obj, widtype);
2128 win = elm_widget_data_get(obj);
2129 if (!win || !title) return;
2130 eina_stringshare_replace(&(win->title), title);
2131 ecore_evas_title_set(win->ee, win->title);
2133 edje_object_part_text_set(win->frame_obj, "elm.text.title", win->title);
2137 elm_win_title_get(const Evas_Object *obj)
2140 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2141 win = elm_widget_data_get(obj);
2142 if (!win) return NULL;
2147 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2150 ELM_CHECK_WIDTYPE(obj, widtype);
2151 win = elm_widget_data_get(obj);
2152 if (!win || !icon_name) return;
2153 eina_stringshare_replace(&(win->icon_name), icon_name);
2154 #ifdef HAVE_ELEMENTARY_X
2155 _elm_win_xwin_update(win);
2160 elm_win_icon_name_get(const Evas_Object *obj)
2163 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2164 win = elm_widget_data_get(obj);
2165 if (!win) return NULL;
2166 return win->icon_name;
2170 elm_win_role_set(Evas_Object *obj, const char *role)
2173 ELM_CHECK_WIDTYPE(obj, widtype);
2174 win = elm_widget_data_get(obj);
2175 if (!win || !role) return;
2176 eina_stringshare_replace(&(win->role), role);
2177 #ifdef HAVE_ELEMENTARY_X
2178 _elm_win_xwin_update(win);
2183 elm_win_role_get(const Evas_Object *obj)
2186 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2187 win = elm_widget_data_get(obj);
2188 if (!win) return NULL;
2193 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2196 ELM_CHECK_WIDTYPE(obj, widtype);
2197 win = elm_widget_data_get(obj);
2200 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2201 _elm_win_obj_icon_callback_del, win);
2204 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2205 _elm_win_obj_icon_callback_del, win);
2206 #ifdef HAVE_ELEMENTARY_X
2207 _elm_win_xwin_update(win);
2211 EAPI const Evas_Object *
2212 elm_win_icon_object_get(const Evas_Object *obj)
2215 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2216 win = elm_widget_data_get(obj);
2217 if (!win) return NULL;
2222 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2225 ELM_CHECK_WIDTYPE(obj, widtype);
2226 win = elm_widget_data_get(obj);
2228 win->autodel = autodel;
2232 elm_win_autodel_get(const Evas_Object *obj)
2235 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2236 win = elm_widget_data_get(obj);
2237 if (!win) return EINA_FALSE;
2238 return win->autodel;
2242 elm_win_activate(Evas_Object *obj)
2245 ELM_CHECK_WIDTYPE(obj, widtype);
2246 win = elm_widget_data_get(obj);
2248 ecore_evas_activate(win->ee);
2252 elm_win_lower(Evas_Object *obj)
2255 ELM_CHECK_WIDTYPE(obj, widtype);
2256 win = elm_widget_data_get(obj);
2258 ecore_evas_lower(win->ee);
2262 elm_win_raise(Evas_Object *obj)
2265 ELM_CHECK_WIDTYPE(obj, widtype);
2266 win = elm_widget_data_get(obj);
2268 ecore_evas_raise(win->ee);
2272 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2275 int win_w, win_h, screen_w, screen_h, nx, ny;
2276 ELM_CHECK_WIDTYPE(obj, widtype);
2277 win = elm_widget_data_get(obj);
2279 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2280 if ((!screen_w) || (!screen_h)) return;
2281 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2282 if ((!win_w) || (!win_h)) return;
2283 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2284 else nx = win->screen.x;
2285 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2286 else ny = win->screen.y;
2289 evas_object_move(obj, nx, ny);
2293 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2296 ELM_CHECK_WIDTYPE(obj, widtype);
2297 win = elm_widget_data_get(obj);
2299 ecore_evas_borderless_set(win->ee, borderless);
2300 #ifdef HAVE_ELEMENTARY_X
2301 _elm_win_xwin_update(win);
2306 elm_win_borderless_get(const Evas_Object *obj)
2309 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2310 win = elm_widget_data_get(obj);
2311 if (!win) return EINA_FALSE;
2312 return ecore_evas_borderless_get(win->ee);
2316 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2319 ELM_CHECK_WIDTYPE(obj, widtype);
2320 win = elm_widget_data_get(obj);
2322 ecore_evas_shaped_set(win->ee, shaped);
2323 #ifdef HAVE_ELEMENTARY_X
2324 _elm_win_xwin_update(win);
2329 elm_win_shaped_get(const Evas_Object *obj)
2332 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2333 win = elm_widget_data_get(obj);
2334 if (!win) return EINA_FALSE;
2335 return ecore_evas_shaped_get(win->ee);
2339 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2342 ELM_CHECK_WIDTYPE(obj, widtype);
2343 win = elm_widget_data_get(obj);
2348 else if (win->img_obj)
2350 evas_object_image_alpha_set(win->img_obj, alpha);
2351 ecore_evas_alpha_set(win->ee, alpha);
2355 #ifdef HAVE_ELEMENTARY_X
2360 if (!_elm_config->compositing)
2361 elm_win_shaped_set(obj, alpha);
2363 ecore_evas_alpha_set(win->ee, alpha);
2366 ecore_evas_alpha_set(win->ee, alpha);
2367 _elm_win_xwin_update(win);
2371 ecore_evas_alpha_set(win->ee, alpha);
2376 elm_win_alpha_get(const Evas_Object *obj)
2379 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2380 win = elm_widget_data_get(obj);
2381 if (!win) return EINA_FALSE;
2385 else if (win->img_obj)
2387 return evas_object_image_alpha_get(win->img_obj);
2389 return ecore_evas_alpha_get(win->ee);
2393 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2396 ELM_CHECK_WIDTYPE(obj, widtype);
2397 win = elm_widget_data_get(obj);
2399 ecore_evas_override_set(win->ee, override);
2400 #ifdef HAVE_ELEMENTARY_X
2401 _elm_win_xwin_update(win);
2406 elm_win_override_get(const Evas_Object *obj)
2409 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2410 win = elm_widget_data_get(obj);
2411 if (!win) return EINA_FALSE;
2412 return ecore_evas_override_get(win->ee);
2416 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2419 ELM_CHECK_WIDTYPE(obj, widtype);
2420 win = elm_widget_data_get(obj);
2422 // YYY: handle if win->img_obj
2423 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2424 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2425 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2427 // these engines... can ONLY be fullscreen
2432 win->fullscreen = fullscreen;
2433 ecore_evas_fullscreen_set(win->ee, fullscreen);
2434 #ifdef HAVE_ELEMENTARY_X
2435 _elm_win_xwin_update(win);
2438 #undef ENGINE_COMPARE
2442 elm_win_fullscreen_get(const Evas_Object *obj)
2445 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2446 win = elm_widget_data_get(obj);
2447 if (!win) return EINA_FALSE;
2448 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2449 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2450 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2452 // these engines... can ONLY be fullscreen
2457 return win->fullscreen;
2459 #undef ENGINE_COMPARE
2463 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2466 ELM_CHECK_WIDTYPE(obj, widtype);
2467 win = elm_widget_data_get(obj);
2469 win->maximized = maximized;
2470 // YYY: handle if win->img_obj
2471 ecore_evas_maximized_set(win->ee, maximized);
2472 #ifdef HAVE_ELEMENTARY_X
2473 _elm_win_xwin_update(win);
2478 elm_win_maximized_get(const Evas_Object *obj)
2481 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2482 win = elm_widget_data_get(obj);
2483 if (!win) return EINA_FALSE;
2484 return win->maximized;
2488 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2491 ELM_CHECK_WIDTYPE(obj, widtype);
2492 win = elm_widget_data_get(obj);
2494 win->iconified = iconified;
2495 ecore_evas_iconified_set(win->ee, iconified);
2496 #ifdef HAVE_ELEMENTARY_X
2497 _elm_win_xwin_update(win);
2502 elm_win_iconified_get(const Evas_Object *obj)
2505 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2506 win = elm_widget_data_get(obj);
2507 if (!win) return EINA_FALSE;
2508 return win->iconified;
2512 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2515 ELM_CHECK_WIDTYPE(obj, widtype);
2516 win = elm_widget_data_get(obj);
2518 win->withdrawn = withdrawn;
2519 ecore_evas_withdrawn_set(win->ee, withdrawn);
2520 #ifdef HAVE_ELEMENTARY_X
2521 _elm_win_xwin_update(win);
2526 elm_win_withdrawn_get(const Evas_Object *obj)
2529 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2530 win = elm_widget_data_get(obj);
2531 if (!win) return EINA_FALSE;
2532 return win->withdrawn;
2536 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2539 ELM_CHECK_WIDTYPE(obj, widtype);
2540 win = elm_widget_data_get(obj);
2542 win->urgent = urgent;
2543 ecore_evas_urgent_set(win->ee, urgent);
2544 #ifdef HAVE_ELEMENTARY_X
2545 _elm_win_xwin_update(win);
2550 elm_win_urgent_get(const Evas_Object *obj)
2553 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2554 win = elm_widget_data_get(obj);
2555 if (!win) return EINA_FALSE;
2560 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2563 ELM_CHECK_WIDTYPE(obj, widtype);
2564 win = elm_widget_data_get(obj);
2566 win->demand_attention = demand_attention;
2567 ecore_evas_demand_attention_set(win->ee, demand_attention);
2568 #ifdef HAVE_ELEMENTARY_X
2569 _elm_win_xwin_update(win);
2574 elm_win_demand_attention_get(const Evas_Object *obj)
2577 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2578 win = elm_widget_data_get(obj);
2579 if (!win) return EINA_FALSE;
2580 return win->demand_attention;
2584 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2587 ELM_CHECK_WIDTYPE(obj, widtype);
2588 win = elm_widget_data_get(obj);
2591 ecore_evas_modal_set(win->ee, modal);
2592 #ifdef HAVE_ELEMENTARY_X
2593 _elm_win_xwin_update(win);
2598 elm_win_modal_get(const Evas_Object *obj)
2601 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2602 win = elm_widget_data_get(obj);
2603 if (!win) return EINA_FALSE;
2608 elm_win_aspect_set(Evas_Object *obj, double aspect)
2611 ELM_CHECK_WIDTYPE(obj, widtype);
2612 win = elm_widget_data_get(obj);
2614 win->aspect = aspect;
2615 ecore_evas_aspect_set(win->ee, aspect);
2616 #ifdef HAVE_ELEMENTARY_X
2617 _elm_win_xwin_update(win);
2622 elm_win_aspect_get(const Evas_Object *obj)
2625 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2626 win = elm_widget_data_get(obj);
2627 if (!win) return EINA_FALSE;
2632 elm_win_layer_set(Evas_Object *obj, int layer)
2635 ELM_CHECK_WIDTYPE(obj, widtype);
2636 win = elm_widget_data_get(obj);
2638 ecore_evas_layer_set(win->ee, layer);
2639 #ifdef HAVE_ELEMENTARY_X
2640 _elm_win_xwin_update(win);
2645 elm_win_layer_get(const Evas_Object *obj)
2648 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2649 win = elm_widget_data_get(obj);
2650 if (!win) return -1;
2651 return ecore_evas_layer_get(win->ee);
2655 elm_win_rotation_set(Evas_Object *obj, int rotation)
2658 ELM_CHECK_WIDTYPE(obj, widtype);
2659 win = elm_widget_data_get(obj);
2661 if (win->rot == rotation) return;
2662 win->rot = rotation;
2663 ecore_evas_rotation_set(win->ee, rotation);
2664 evas_object_size_hint_min_set(obj, -1, -1);
2665 evas_object_size_hint_max_set(obj, -1, -1);
2666 _elm_win_eval_subobjs(obj);
2667 #ifdef HAVE_ELEMENTARY_X
2668 _elm_win_xwin_update(win);
2673 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2676 ELM_CHECK_WIDTYPE(obj, widtype);
2677 win = elm_widget_data_get(obj);
2679 if (win->rot == rotation) return;
2680 win->rot = rotation;
2681 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2682 evas_object_size_hint_min_set(obj, -1, -1);
2683 evas_object_size_hint_max_set(obj, -1, -1);
2684 _elm_win_eval_subobjs(obj);
2685 #ifdef HAVE_ELEMENTARY_X
2686 _elm_win_xwin_update(win);
2691 elm_win_rotation_get(const Evas_Object *obj)
2694 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2695 win = elm_widget_data_get(obj);
2696 if (!win) return -1;
2701 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2704 ELM_CHECK_WIDTYPE(obj, widtype);
2705 win = elm_widget_data_get(obj);
2707 win->sticky = sticky;
2708 ecore_evas_sticky_set(win->ee, sticky);
2709 #ifdef HAVE_ELEMENTARY_X
2710 _elm_win_xwin_update(win);
2715 elm_win_sticky_get(const Evas_Object *obj)
2718 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2719 win = elm_widget_data_get(obj);
2720 if (!win) return EINA_FALSE;
2725 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2728 ELM_CHECK_WIDTYPE(obj, widtype);
2729 win = elm_widget_data_get(obj);
2731 if (mode == win->kbdmode) return;
2732 #ifdef HAVE_ELEMENTARY_X
2733 _elm_win_xwindow_get(win);
2735 win->kbdmode = mode;
2736 #ifdef HAVE_ELEMENTARY_X
2738 ecore_x_e_virtual_keyboard_state_set
2739 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2743 EAPI Elm_Win_Keyboard_Mode
2744 elm_win_keyboard_mode_get(const Evas_Object *obj)
2747 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2748 win = elm_widget_data_get(obj);
2749 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2750 return win->kbdmode;
2754 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2757 ELM_CHECK_WIDTYPE(obj, widtype);
2758 win = elm_widget_data_get(obj);
2760 #ifdef HAVE_ELEMENTARY_X
2761 _elm_win_xwindow_get(win);
2763 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2770 elm_win_keyboard_win_get(const Evas_Object *obj)
2773 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2774 win = elm_widget_data_get(obj);
2775 if (!win) return EINA_FALSE;
2776 #ifdef HAVE_ELEMENTARY_X
2777 _elm_win_xwindow_get(win);
2779 return ecore_x_e_virtual_keyboard_get(win->xwin);
2784 // WRAPPER: Temperary added.
2786 elm_win_indicator_state_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2788 elm_win_indicator_mode_set(obj, mode);
2792 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2795 ELM_CHECK_WIDTYPE(obj, widtype);
2796 win = elm_widget_data_get(obj);
2798 if (mode == win->indmode) return;
2799 #ifdef HAVE_ELEMENTARY_X
2800 _elm_win_xwindow_get(win);
2802 win->indmode = mode;
2803 #ifdef HAVE_ELEMENTARY_X
2806 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
2807 ecore_x_e_illume_indicator_state_set
2808 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
2809 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
2810 ecore_x_e_illume_indicator_state_set
2811 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
2816 // WRAPPER: Temperary added.
2817 EAPI Elm_Win_Indicator_Mode
2818 elm_win_indicator_state_get(const Evas_Object *obj)
2820 return elm_win_indicator_mode_get(obj);
2823 EAPI Elm_Win_Indicator_Mode
2824 elm_win_indicator_mode_get(const Evas_Object *obj)
2827 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
2828 win = elm_widget_data_get(obj);
2829 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
2830 return win->indmode;
2834 elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode)
2837 ELM_CHECK_WIDTYPE(obj, widtype);
2838 win = elm_widget_data_get(obj);
2840 if (mode == win->ind_o_mode) return;
2841 win->ind_o_mode = mode;
2842 #ifdef HAVE_ELEMENTARY_X
2843 _elm_win_xwindow_get(win);
2846 if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
2847 ecore_x_e_illume_indicator_opacity_set
2848 (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
2849 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
2850 ecore_x_e_illume_indicator_opacity_set
2851 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
2852 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
2853 ecore_x_e_illume_indicator_opacity_set
2854 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
2860 EAPI Elm_Win_Indicator_Opacity_Mode
2861 elm_win_indicator_opacity_get(const Evas_Object *obj)
2864 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2865 win = elm_widget_data_get(obj);
2866 if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2867 return win->ind_o_mode;
2871 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2874 ELM_CHECK_WIDTYPE(obj, widtype);
2875 win = elm_widget_data_get(obj);
2877 if (x) *x = win->screen.x;
2878 if (y) *y = win->screen.y;
2882 elm_win_focus_get(const Evas_Object *obj)
2885 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2886 win = elm_widget_data_get(obj);
2887 if (!win) return EINA_FALSE;
2888 return ecore_evas_focus_get(win->ee);
2892 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2895 ELM_CHECK_WIDTYPE(obj, widtype);
2896 win = elm_widget_data_get(obj);
2898 win->constrain = !!constrain;
2902 elm_win_screen_constrain_get(Evas_Object *obj)
2905 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2906 win = elm_widget_data_get(obj);
2907 if (!win) return EINA_FALSE;
2908 return win->constrain;
2912 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2915 ELM_CHECK_WIDTYPE(obj, widtype);
2916 win = elm_widget_data_get(obj);
2918 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2922 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2925 ELM_CHECK_WIDTYPE(obj, widtype);
2926 win = elm_widget_data_get(obj);
2928 #ifdef HAVE_ELEMENTARY_X
2929 _elm_win_xwindow_get(win);
2931 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2938 elm_win_conformant_get(const Evas_Object *obj)
2941 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2942 win = elm_widget_data_get(obj);
2943 if (!win) return EINA_FALSE;
2944 #ifdef HAVE_ELEMENTARY_X
2945 _elm_win_xwindow_get(win);
2947 return ecore_x_e_illume_conformant_get(win->xwin);
2953 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2956 ELM_CHECK_WIDTYPE(obj, widtype);
2957 win = elm_widget_data_get(obj);
2959 #ifdef HAVE_ELEMENTARY_X
2960 _elm_win_xwindow_get(win);
2963 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2966 Ecore_X_Window_State states[2];
2968 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2969 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2970 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2971 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2980 elm_win_quickpanel_get(const Evas_Object *obj)
2983 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2984 win = elm_widget_data_get(obj);
2985 if (!win) return EINA_FALSE;
2986 #ifdef HAVE_ELEMENTARY_X
2987 _elm_win_xwindow_get(win);
2989 return ecore_x_e_illume_quickpanel_get(win->xwin);
2995 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2998 ELM_CHECK_WIDTYPE(obj, widtype);
2999 win = elm_widget_data_get(obj);
3001 #ifdef HAVE_ELEMENTARY_X
3002 _elm_win_xwindow_get(win);
3004 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
3011 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
3014 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3015 win = elm_widget_data_get(obj);
3016 if (!win) return -1;
3017 #ifdef HAVE_ELEMENTARY_X
3018 _elm_win_xwindow_get(win);
3020 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
3026 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
3029 ELM_CHECK_WIDTYPE(obj, widtype);
3030 win = elm_widget_data_get(obj);
3032 #ifdef HAVE_ELEMENTARY_X
3033 _elm_win_xwindow_get(win);
3035 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3042 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3045 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3046 win = elm_widget_data_get(obj);
3047 if (!win) return -1;
3048 #ifdef HAVE_ELEMENTARY_X
3049 _elm_win_xwindow_get(win);
3051 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3057 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3060 ELM_CHECK_WIDTYPE(obj, widtype);
3061 win = elm_widget_data_get(obj);
3063 #ifdef HAVE_ELEMENTARY_X
3064 _elm_win_xwindow_get(win);
3066 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3073 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3076 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3077 win = elm_widget_data_get(obj);
3079 #ifdef HAVE_ELEMENTARY_X
3080 _elm_win_xwindow_get(win);
3082 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3088 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3091 ELM_CHECK_WIDTYPE(obj, widtype);
3092 win = elm_widget_data_get(obj);
3094 win->skip_focus = skip;
3095 ecore_evas_focus_skip_set(win->ee, skip);
3099 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3102 ELM_CHECK_WIDTYPE(obj, widtype);
3103 win = elm_widget_data_get(obj);
3105 #ifdef HAVE_ELEMENTARY_X
3106 _elm_win_xwindow_get(win);
3111 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3112 ecore_x_e_illume_focus_back_send(win->xwin);
3114 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3115 ecore_x_e_illume_focus_forward_send(win->xwin);
3117 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3118 ecore_x_e_illume_focus_home_send(win->xwin);
3120 case ELM_ILLUME_COMMAND_CLOSE:
3121 ecore_x_e_illume_close_send(win->xwin);
3133 elm_win_inlined_image_object_get(Evas_Object *obj)
3136 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3137 win = elm_widget_data_get(obj);
3138 if (!win) return NULL;
3139 return win->img_obj;
3143 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3147 ELM_CHECK_WIDTYPE(obj, widtype);
3149 win = elm_widget_data_get(obj);
3150 enabled = !!enabled;
3151 if (win->focus_highlight.enabled == enabled)
3154 win->focus_highlight.enabled = enabled;
3156 if (win->focus_highlight.enabled)
3157 _elm_win_focus_highlight_init(win);
3159 _elm_win_focus_highlight_shutdown(win);
3163 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3167 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3169 win = elm_widget_data_get(obj);
3170 return win->focus_highlight.enabled;
3174 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3178 ELM_CHECK_WIDTYPE(obj, widtype);
3180 win = elm_widget_data_get(obj);
3181 eina_stringshare_replace(&win->focus_highlight.style, style);
3182 win->focus_highlight.changed_theme = EINA_TRUE;
3183 _elm_win_focus_highlight_reconfigure_job_start(win);
3187 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3191 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3193 win = elm_widget_data_get(obj);
3194 return win->focus_highlight.style;
3197 typedef struct _Widget_Data Widget_Data;
3202 Evas_Object *content;
3205 static void _del_hook(Evas_Object *obj);
3206 static void _theme_hook(Evas_Object *obj);
3207 static void _sizing_eval(Evas_Object *obj);
3208 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3209 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3211 static const char *widtype2 = NULL;
3214 _del_hook(Evas_Object *obj)
3216 Widget_Data *wd = elm_widget_data_get(obj);
3222 _theme_hook(Evas_Object *obj)
3224 Widget_Data *wd = elm_widget_data_get(obj);
3225 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3227 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3230 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3234 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3236 Widget_Data *wd = elm_widget_data_get(obj);
3241 /* Try Focus cycle in subitem */
3244 elm_widget_focus_next_get(wd->content, dir, next);
3249 *next = (Evas_Object *)obj;
3254 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3256 Widget_Data *wd = elm_widget_data_get(obj);
3258 if (!wd || !item) return;
3259 edje_object_part_text_set(wd->frm, item, text);
3264 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3266 Widget_Data *wd = elm_widget_data_get(obj);
3268 if (!item || !wd || !wd->frm) return NULL;
3269 return edje_object_part_text_get(wd->frm, item);
3273 _sizing_eval(Evas_Object *obj)
3275 Widget_Data *wd = elm_widget_data_get(obj);
3276 Evas_Coord minw = -1, minh = -1;
3278 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3279 edje_object_size_min_calc(wd->frm, &minw, &minh);
3280 evas_object_size_hint_min_set(obj, minw, minh);
3281 evas_object_size_hint_max_set(obj, -1, -1);
3285 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3291 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3293 Widget_Data *wd = elm_widget_data_get(obj);
3294 Evas_Object *sub = event_info;
3295 if (sub == wd->content)
3297 evas_object_event_callback_del_full
3298 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3305 elm_win_inwin_add(Evas_Object *obj)
3311 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3312 win = elm_widget_data_get(obj);
3313 if (!win) return NULL;
3314 wd = ELM_NEW(Widget_Data);
3315 obj2 = elm_widget_add(win->evas);
3316 elm_widget_type_set(obj2, "inwin");
3317 ELM_SET_WIDTYPE(widtype2, "inwin");
3318 elm_widget_sub_object_add(obj, obj2);
3319 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3320 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3321 elm_win_resize_object_add(obj, obj2);
3323 elm_widget_data_set(obj2, wd);
3324 elm_widget_del_hook_set(obj2, _del_hook);
3325 elm_widget_theme_hook_set(obj2, _theme_hook);
3326 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3327 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3328 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3329 elm_widget_can_focus_set(obj2, EINA_TRUE);
3330 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3332 wd->frm = edje_object_add(win->evas);
3333 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3334 elm_widget_resize_object_set(obj2, wd->frm);
3336 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3343 elm_win_inwin_activate(Evas_Object *obj)
3345 ELM_CHECK_WIDTYPE(obj, widtype2);
3346 Widget_Data *wd = elm_widget_data_get(obj);
3348 evas_object_raise(obj);
3349 evas_object_show(obj);
3350 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3351 elm_object_focus_set(obj, EINA_TRUE);
3355 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3357 ELM_CHECK_WIDTYPE(obj, widtype2);
3358 Widget_Data *wd = elm_widget_data_get(obj);
3360 if (wd->content == content) return;
3361 if (wd->content) evas_object_del(wd->content);
3362 wd->content = content;
3365 elm_widget_sub_object_add(obj, content);
3366 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3367 _changed_size_hints, obj);
3368 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3374 elm_win_inwin_content_get(const Evas_Object *obj)
3376 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3377 Widget_Data *wd = elm_widget_data_get(obj);
3378 if (!wd) return NULL;
3383 elm_win_inwin_content_unset(Evas_Object *obj)
3385 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3386 Widget_Data *wd = elm_widget_data_get(obj);
3387 if (!wd) return NULL;
3388 if (!wd->content) return NULL;
3389 Evas_Object *content = wd->content;
3390 elm_widget_sub_object_del(obj, wd->content);
3391 evas_object_event_callback_del_full(wd->content,
3392 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3393 _changed_size_hints, obj);
3394 edje_object_part_unswallow(wd->frm, wd->content);
3400 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3405 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3406 win = elm_widget_data_get(obj);
3407 if (!win) return EINA_FALSE;
3408 if (!win->ee) return EINA_FALSE;
3410 if (!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3416 /* windowing specific calls - shall we do this differently? */
3418 static Ecore_X_Window
3419 _elm_ee_win_get(const Evas_Object *obj)
3422 #ifdef HAVE_ELEMENTARY_X
3423 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3424 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3430 elm_win_xwindow_get(const Evas_Object *obj)
3436 type = elm_widget_type_get(obj);
3437 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3438 win = elm_widget_data_get(obj);
3440 #ifdef HAVE_ELEMENTARY_X
3441 if (win->xwin) return win->xwin;
3442 if (win->parent) return elm_win_xwindow_get(win->parent);