1 #include <Elementary.h>
4 typedef struct _Elm_Win Elm_Win;
10 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
12 #ifdef HAVE_ELEMENTARY_X
14 Ecore_Event_Handler *client_message_handler;
16 Ecore_Job *deferred_resize_job;
17 Ecore_Job *deferred_child_eval_job;
20 Elm_Win_Keyboard_Mode kbdmode;
21 Elm_Win_Indicator_Mode indmode;
22 Elm_Win_Indicator_Opacity_Mode ind_o_mode;
30 int *autodel_clear, rot;
39 Evas_Object *obj, *hot_obj;
47 Eina_Bool visible : 1;
48 Eina_Bool handled : 1;
52 Ecore_Job *reconf_job;
54 Eina_Bool enabled : 1;
55 Eina_Bool changed_theme : 1;
56 Eina_Bool top_animate : 1;
57 Eina_Bool geometry_changed : 1;
62 const char *icon_name;
68 Eina_Bool demand_attention : 1;
69 Eina_Bool autodel : 1;
70 Eina_Bool constrain : 1;
71 Eina_Bool resizing : 1;
72 Eina_Bool iconified : 1;
73 Eina_Bool withdrawn : 1;
75 Eina_Bool fullscreen : 1;
76 Eina_Bool maximized : 1;
77 Eina_Bool skip_focus : 1;
80 static const char *widtype = NULL;
81 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
82 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
83 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
84 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
85 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
86 static void _elm_win_move(Ecore_Evas *ee);
87 static void _elm_win_resize(Ecore_Evas *ee);
88 static void _elm_win_delete_request(Ecore_Evas *ee);
89 static void _elm_win_resize_job(void *data);
90 #ifdef HAVE_ELEMENTARY_X
91 static void _elm_win_xwin_update(Elm_Win *win);
93 static void _elm_win_eval_subobjs(Evas_Object *obj);
94 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
95 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
96 static void _elm_win_focus_highlight_init(Elm_Win *win);
97 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
98 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
99 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
100 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
101 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
102 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
104 static void _elm_win_frame_add(Elm_Win *win, const char *style);
105 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
106 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
107 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
108 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
109 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
111 //static void _elm_win_pointer_add(Elm_Win *win, const char *style);
113 static const char SIG_DELETE_REQUEST[] = "delete,request";
114 static const char SIG_FOCUS_OUT[] = "focus,out";
115 static const char SIG_FOCUS_IN[] = "focus,in";
116 static const char SIG_MOVED[] = "moved";
117 static const char SIG_THEME_CHANGED[] = "theme,changed";
118 static const char SIG_WITHDRAWN[] = "withdrawn";
119 static const char SIG_ICONIFIED[] = "iconified";
120 static const char SIG_NORMAL[] = "normal";
121 static const char SIG_STICK[] = "stick";
122 static const char SIG_UNSTICK[] = "unstick";
123 static const char SIG_FULLSCREEN[] = "fullscreen";
124 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
125 static const char SIG_MAXIMIZED[] = "maximized";
126 static const char SIG_UNMAXIMIZED[] = "unmaximized";
128 static const Evas_Smart_Cb_Description _signals[] = {
129 {SIG_DELETE_REQUEST, ""},
138 {SIG_FULLSCREEN, ""},
139 {SIG_UNFULLSCREEN, ""},
141 {SIG_UNMAXIMIZED, ""},
147 Eina_List *_elm_win_list = NULL;
148 int _elm_win_deferred_free = 0;
150 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
151 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
154 _shot_delay_get(Elm_Win *win)
157 char *d = strdup(win->shot.info);
160 for (p = (char *)win->shot.info; *p; p++)
162 if (!strncmp(p, "delay=", 6))
166 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
181 _shot_file_get(Elm_Win *win)
184 char *tmp = strdup(win->shot.info);
185 char *repname = NULL;
187 if (!tmp) return NULL;
189 for (p = (char *)win->shot.info; *p; p++)
191 if (!strncmp(p, "file=", 5))
194 if (!win->shot.repeat_count) return tmp;
197 char *dotptr = strrchr(tmp, '.');
200 size_t size = sizeof(char)*(strlen(tmp) + 16);
201 repname = malloc(size);
202 strncpy(repname, tmp, dotptr - tmp);
203 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
204 win->shot.shot_counter + 1);
205 strcat(repname, dotptr);
213 if (!win->shot.repeat_count) return strdup("out.png");
215 repname = malloc(sizeof(char) * 24);
216 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
221 _shot_repeat_count_get(Elm_Win *win)
224 char *d = strdup(win->shot.info);
227 for (p = (char *)win->shot.info; *p; p++)
229 if (!strncmp(p, "repeat=", 7))
233 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
240 if (v > 1000) v = 999;
250 _shot_key_get(Elm_Win *win __UNUSED__)
256 _shot_flags_get(Elm_Win *win __UNUSED__)
262 _shot_do(Elm_Win *win)
266 unsigned int *pixels;
268 char *file, *key, *flags;
270 ecore_evas_manual_render(win->ee);
271 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
273 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
274 if ((w < 1) || (h < 1)) return;
275 file = _shot_file_get(win);
277 key = _shot_key_get(win);
278 flags = _shot_flags_get(win);
279 ee = ecore_evas_buffer_new(1, 1);
280 o = evas_object_image_add(ecore_evas_get(ee));
281 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
282 evas_object_image_size_set(o, w, h);
283 evas_object_image_data_set(o, pixels);
284 if (!evas_object_image_save(o, file, key, flags))
286 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
291 if (flags) free(flags);
293 if (win->shot.repeat_count) win->shot.shot_counter++;
297 _shot_delay(void *data)
301 if (win->shot.repeat_count)
303 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
304 if (remainshot > 0) return EINA_TRUE;
306 win->shot.timer = NULL;
312 _shot_init(Elm_Win *win)
314 if (!win->shot.info) return;
315 win->shot.repeat_count = _shot_repeat_count_get(win);
316 win->shot.shot_counter = 0;
320 _shot_handle(Elm_Win *win)
322 if (!win->shot.info) return;
323 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
327 _elm_win_move(Ecore_Evas *ee)
329 Evas_Object *obj = ecore_evas_object_associate_get(ee);
334 win = elm_widget_data_get(obj);
336 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
339 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
343 _elm_win_resize(Ecore_Evas *ee)
345 Evas_Object *obj = ecore_evas_object_associate_get(ee);
349 win = elm_widget_data_get(obj);
351 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
352 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
356 _elm_win_mouse_in(Ecore_Evas *ee)
361 if (!(obj = ecore_evas_object_associate_get(ee))) return;
362 if (!(win = elm_widget_data_get(obj))) return;
363 if (win->resizing) win->resizing = EINA_FALSE;
367 _elm_win_focus_in(Ecore_Evas *ee)
369 Evas_Object *obj = ecore_evas_object_associate_get(ee);
373 win = elm_widget_data_get(obj);
375 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
376 if (!elm_widget_focus_order_get(obj))
378 elm_widget_focus_steal(win->win_obj);
382 elm_widget_focus_restore(win->win_obj);
383 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
384 win->focus_highlight.cur.visible = EINA_TRUE;
385 _elm_win_focus_highlight_reconfigure_job_start(win);
388 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
390 else if (win->img_obj)
397 _elm_win_focus_out(Ecore_Evas *ee)
399 Evas_Object *obj = ecore_evas_object_associate_get(ee);
403 win = elm_widget_data_get(obj);
405 elm_object_focus_set(win->win_obj, EINA_FALSE);
406 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
407 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
408 win->focus_highlight.cur.visible = EINA_FALSE;
409 _elm_win_focus_highlight_reconfigure_job_start(win);
412 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
414 else if (win->img_obj)
421 _elm_win_state_change(Ecore_Evas *ee)
425 Eina_Bool ch_withdrawn = EINA_FALSE;
426 Eina_Bool ch_sticky = EINA_FALSE;
427 Eina_Bool ch_iconified = EINA_FALSE;
428 Eina_Bool ch_fullscreen = EINA_FALSE;
429 Eina_Bool ch_maximized = EINA_FALSE;
431 if (!(obj = ecore_evas_object_associate_get(ee))) return;
433 if (!(win = elm_widget_data_get(obj))) return;
435 if (win->withdrawn != ecore_evas_withdrawn_get(win->ee))
437 win->withdrawn = ecore_evas_withdrawn_get(win->ee);
438 ch_withdrawn = EINA_TRUE;
440 if (win->sticky != ecore_evas_sticky_get(win->ee))
442 win->sticky = ecore_evas_sticky_get(win->ee);
443 ch_sticky = EINA_TRUE;
445 if (win->iconified != ecore_evas_iconified_get(win->ee))
447 win->iconified = ecore_evas_iconified_get(win->ee);
448 ch_iconified = EINA_TRUE;
450 if (win->fullscreen != ecore_evas_fullscreen_get(win->ee))
452 win->fullscreen = ecore_evas_fullscreen_get(win->ee);
453 ch_fullscreen = EINA_TRUE;
455 if (win->maximized != ecore_evas_maximized_get(win->ee))
457 win->maximized = ecore_evas_maximized_get(win->ee);
458 ch_maximized = EINA_TRUE;
460 if ((ch_withdrawn) || (ch_iconified))
463 evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL);
464 else if (win->iconified)
465 evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL);
467 evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL);
472 evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL);
474 evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL);
479 evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL);
481 evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL);
486 evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL);
488 evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL);
493 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
495 Elm_Win *wd = elm_widget_data_get(obj);
496 const Eina_List *items;
497 void *(*list_data_get) (const Eina_List *list);
505 if (!(items = elm_widget_focus_custom_chain_get(obj)))
511 list_data_get = eina_list_data_get;
513 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
519 *next = (Evas_Object *)obj;
524 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
526 Elm_Win *win = elm_widget_data_get(obj);
530 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
532 evas_object_focus_set(obj, elm_widget_focus_get(obj));
536 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
538 if (type == EVAS_CALLBACK_KEY_DOWN)
540 Evas_Event_Key_Down *ev = event_info;
541 if (!strcmp(ev->keyname, "Tab"))
543 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
544 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
546 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
547 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
550 else if ((!strcmp(ev->keyname, "Left")) ||
551 (!strcmp(ev->keyname, "KP_Left")))
553 //TODO : woohyun jung
555 else if ((!strcmp(ev->keyname, "Right")) ||
556 (!strcmp(ev->keyname, "KP_Right")))
558 //TODO : woohyun jung
560 else if ((!strcmp(ev->keyname, "Up")) ||
561 (!strcmp(ev->keyname, "KP_Up")))
563 //TODO : woohyun jung
565 else if ((!strcmp(ev->keyname, "Down")) ||
566 (!strcmp(ev->keyname, "KP_Down")))
568 //TODO : woohyun jung
576 _deferred_ecore_evas_free(void *data)
578 ecore_evas_free(data);
579 _elm_win_deferred_free--;
583 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
587 if (!win->show_count) win->show_count++;
588 if (win->shot.info) _shot_handle(win);
592 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
598 evas_object_hide(win->frame_obj);
600 else if (win->img_obj)
602 evas_object_hide(win->img_obj);
604 if (win->pointer.obj)
606 evas_object_hide(win->pointer.obj);
607 ecore_evas_hide(win->pointer.ee);
612 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
615 Evas_Object *child, *child2 = NULL;
619 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
620 _elm_win_obj_callback_parent_del, win);
623 if (win->autodel_clear) *(win->autodel_clear) = -1;
624 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
625 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
628 ecore_evas_callback_delete_request_set(win->ee, NULL);
629 ecore_evas_callback_resize_set(win->ee, NULL);
631 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
632 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
633 if (win->shot.info) eina_stringshare_del(win->shot.info);
634 if (win->shot.timer) ecore_timer_del(win->shot.timer);
635 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
636 _elm_win_obj_callback_del, win);
637 child = evas_object_bottom_get(win->evas);
640 /* if the object we see *IS* the window object (because we are
641 * faking a parent object inside the canvas), then skip it and
642 * go to the next one */
645 child = evas_object_above_get(child);
648 /* if we are using the next object above from the previous loop */
651 /* this object has refcounts from the previous loop */
652 child2 = evas_object_above_get(child);
653 if (child2) evas_object_ref(child2);
654 evas_object_del(child);
655 /* so unref from previous loop */
656 evas_object_unref(child);
661 /* just delete as normal (probably only first object */
662 child2 = evas_object_above_get(child);
663 if (child2) evas_object_ref(child2);
664 evas_object_del(child);
668 #ifdef HAVE_ELEMENTARY_X
669 if (win->client_message_handler)
670 ecore_event_handler_del(win->client_message_handler);
672 // FIXME: Why are we flushing edje on every window destroy ??
673 // edje_file_cache_flush();
674 // edje_collection_cache_flush();
675 // evas_image_cache_flush(win->evas);
676 // evas_font_cache_flush(win->evas);
677 // FIXME: we are in the del handler for the object and delete the canvas
678 // that lives under it from the handler... nasty. deferring doesn't help either
688 ecore_job_add(_deferred_ecore_evas_free, win->ee);
689 _elm_win_deferred_free++;
693 _elm_win_focus_highlight_shutdown(win);
694 eina_stringshare_del(win->focus_highlight.style);
696 if (win->title) eina_stringshare_del(win->title);
697 if (win->icon_name) eina_stringshare_del(win->icon_name);
698 if (win->role) eina_stringshare_del(win->role);
699 if (win->icon) evas_object_del(win->icon);
703 if ((!_elm_win_list) &&
704 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
706 edje_file_cache_flush();
707 edje_collection_cache_flush();
708 evas_image_cache_flush(e);
709 evas_font_cache_flush(e);
715 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
718 if (!win->img_obj) return;
719 evas_object_event_callback_del_full
720 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
721 evas_object_del(win->img_obj);
725 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
728 if (obj == win->parent) win->parent = NULL;
732 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
738 if ((x != win->screen.x) || (y != win->screen.y))
742 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
747 evas_object_move(obj, x, y);
752 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
755 // this is called to make sure all smart containers have calculated their
756 // sizes BEFORE we show the window to make sure it initially appears at
757 // our desired size (ie min size is known first)
758 evas_smart_objects_calculate(evas_object_evas_get(obj));
761 evas_object_show(win->frame_obj);
763 else if (win->img_obj)
765 evas_object_show(win->img_obj);
767 if (win->pointer.obj)
769 ecore_evas_show(win->pointer.ee);
770 evas_object_show(win->pointer.obj);
771 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
773 evas_object_show(obj);
777 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
781 if (ecore_evas_override_get(win->ee))
785 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
788 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
794 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
798 else if (win->img_obj)
802 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
805 // evas_object_move(win->img_obj, x, y);
810 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
817 else if (win->img_obj)
819 Evas_Coord w = 1, h = 1;
821 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
825 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
831 evas_object_image_size_set(win->img_obj, w, h);
836 _elm_win_delete_request(Ecore_Evas *ee)
838 Evas_Object *obj = ecore_evas_object_associate_get(ee);
840 if (strcmp(elm_widget_type_get(obj), "win")) return;
842 win = elm_widget_data_get(obj);
844 int autodel = win->autodel;
845 win->autodel_clear = &autodel;
846 evas_object_ref(win->win_obj);
847 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
848 // FIXME: if above callback deletes - then the below will be invalid
849 if (autodel) evas_object_del(win->win_obj);
850 else win->autodel_clear = NULL;
851 evas_object_unref(win->win_obj);
855 _elm_win_resize_job(void *data)
862 win->deferred_resize_job = NULL;
863 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
867 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
873 evas_object_resize(win->frame_obj, w, h);
875 else if (win->img_obj)
878 evas_object_resize(win->win_obj, w, h);
879 EINA_LIST_FOREACH(win->subobjs, l, obj)
881 evas_object_move(obj, 0, 0);
882 evas_object_resize(obj, w, h);
886 #ifdef HAVE_ELEMENTARY_X
888 _elm_win_xwindow_get(Elm_Win *win)
892 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
893 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
895 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
897 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
898 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
899 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
900 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
901 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
902 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
903 ENGINE_COMPARE(ELM_OPENGL_COCOA))
906 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
908 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
910 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
912 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
915 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
917 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
920 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
922 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
924 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
926 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
928 #undef ENGINE_COMPARE
932 #ifdef HAVE_ELEMENTARY_X
934 _elm_win_xwin_update(Elm_Win *win)
938 _elm_win_xwindow_get(win);
943 win2 = elm_widget_data_get(win->parent);
947 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
951 if (!win->xwin) return; /* nothing more to do */
954 if (!s) s = _elm_appname;
956 if (win->icon_name) s = win->icon_name;
957 ecore_x_icccm_icon_name_set(win->xwin, s);
958 ecore_x_netwm_icon_name_set(win->xwin, s);
961 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
968 data = evas_object_image_data_get(win->icon, EINA_FALSE);
972 int w = 0, h = 0, stride, x, y;
976 evas_object_image_size_get(win->icon, &w, &h);
977 stride = evas_object_image_stride_get(win->icon);
978 if ((w > 0) && (h > 0) &&
979 (stride >= (int)(w * sizeof(unsigned int))))
983 ic.data = malloc(w * h * sizeof(unsigned int));
987 p = (unsigned char *)data;
988 p2 = (unsigned int *)ic.data;
989 for (y = 0; y < h; y++)
991 for (x = 0; x < w; x++)
993 *p2 = *((unsigned int *)p);
994 p += sizeof(unsigned int);
997 p += (stride - (w * sizeof(unsigned int)));
999 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
1003 evas_object_image_data_set(win->icon, data);
1010 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
1012 case ELM_WIN_DIALOG_BASIC:
1013 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
1015 case ELM_WIN_DESKTOP:
1016 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1019 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
1021 case ELM_WIN_TOOLBAR:
1022 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1025 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1027 case ELM_WIN_UTILITY:
1028 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1030 case ELM_WIN_SPLASH:
1031 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1033 case ELM_WIN_DROPDOWN_MENU:
1034 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1036 case ELM_WIN_POPUP_MENU:
1037 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1039 case ELM_WIN_TOOLTIP:
1040 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1042 case ELM_WIN_NOTIFICATION:
1043 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1046 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1049 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1054 ecore_x_e_virtual_keyboard_state_set
1055 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1056 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
1057 ecore_x_e_illume_indicator_state_set
1058 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1059 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
1060 ecore_x_e_illume_indicator_state_set
1061 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1066 _elm_win_eval_subobjs(Evas_Object *obj)
1069 const Evas_Object *child;
1071 Elm_Win *win = elm_widget_data_get(obj);
1072 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1076 EINA_LIST_FOREACH(win->subobjs, l, child)
1078 evas_object_size_hint_weight_get(child, &wx, &wy);
1079 if (wx == 0.0) xx = 0;
1080 if (wy == 0.0) xy = 0;
1082 evas_object_size_hint_min_get(child, &w, &h);
1085 if (w > minw) minw = w;
1086 if (h > minh) minh = h;
1088 evas_object_size_hint_max_get(child, &w, &h);
1091 if (maxw == -1) maxw = w;
1092 else if ((w > 0) && (w < maxw)) maxw = w;
1093 if (maxh == -1) maxh = h;
1094 else if ((h > 0) && (h < maxh)) maxh = h;
1096 if (!xx) maxw = minw;
1098 if (!xy) maxh = minh;
1100 evas_object_size_hint_min_set(obj, minw, minh);
1101 evas_object_size_hint_max_set(obj, maxw, maxh);
1102 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1103 if (w < minw) w = minw;
1104 if (h < minh) h = minh;
1105 if ((maxw >= 0) && (w > maxw)) w = maxw;
1106 if ((maxh >= 0) && (h > maxh)) h = maxh;
1107 evas_object_resize(obj, w, h);
1111 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1113 Elm_Win *win = elm_widget_data_get(data);
1114 win->subobjs = eina_list_remove(win->subobjs, obj);
1115 _elm_win_eval_subobjs(win->win_obj);
1119 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1121 _elm_win_eval_subobjs(data);
1125 _elm_win_shutdown(void)
1127 while (_elm_win_list)
1128 evas_object_del(_elm_win_list->data);
1132 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1139 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1140 elm_widget_theme(obj);
1144 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1145 elm_widget_theme_specific(obj, th, EINA_FALSE);
1150 _elm_win_translate(void)
1155 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1156 elm_widget_translate(obj);
1159 #ifdef HAVE_ELEMENTARY_X
1161 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1163 Elm_Win *win = data;
1164 Ecore_X_Event_Client_Message *e = event;
1166 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1167 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1169 if ((unsigned)e->data.l[0] == win->xwin)
1171 Evas *evas = evas_object_evas_get(win->win_obj);
1174 edje_file_cache_flush();
1175 edje_collection_cache_flush();
1176 evas_image_cache_flush(evas);
1177 evas_font_cache_flush(evas);
1181 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1183 if ((unsigned)e->data.l[0] == win->xwin)
1185 Evas *evas = evas_object_evas_get(win->win_obj);
1188 edje_file_cache_flush();
1189 edje_collection_cache_flush();
1190 evas_image_cache_flush(evas);
1191 evas_font_cache_flush(evas);
1192 evas_render_dump(evas);
1196 return ECORE_CALLBACK_PASS_ON;
1201 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1203 Elm_Win *win = data;
1205 win->focus_highlight.geometry_changed = EINA_TRUE;
1206 _elm_win_focus_highlight_reconfigure_job_start(win);
1210 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1212 Elm_Win *win = data;
1214 win->focus_highlight.geometry_changed = EINA_TRUE;
1215 _elm_win_focus_highlight_reconfigure_job_start(win);
1219 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1221 Elm_Win *win = data;
1223 win->focus_highlight.cur.target = NULL;
1225 _elm_win_focus_highlight_reconfigure_job_start(win);
1229 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1231 Evas_Object *obj = win->focus_highlight.cur.target;
1233 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1234 _elm_win_focus_target_move, win);
1235 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1236 _elm_win_focus_target_resize, win);
1237 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1238 _elm_win_focus_target_del, win);
1242 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1244 Evas_Object *obj = win->focus_highlight.cur.target;
1246 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1247 _elm_win_focus_target_move, win);
1248 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1249 _elm_win_focus_target_resize, win);
1250 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1251 _elm_win_focus_target_del, win);
1254 static Evas_Object *
1255 _elm_win_focus_target_get(Evas_Object *obj)
1257 Evas_Object *o = obj;
1261 if (elm_widget_is(o))
1263 if (!elm_widget_highlight_ignore_get(o))
1265 o = elm_widget_parent_get(o);
1267 o = evas_object_smart_parent_get(o);
1271 o = elm_widget_parent_widget_get(o);
1273 o = evas_object_smart_parent_get(o);
1282 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1284 Evas_Object *obj = event_info, *target;
1285 Elm_Win *win = data;
1287 if (win->focus_highlight.cur.target == obj)
1290 target = _elm_win_focus_target_get(obj);
1291 win->focus_highlight.cur.target = target;
1292 if (elm_widget_highlight_in_theme_get(target))
1293 win->focus_highlight.cur.handled = EINA_TRUE;
1295 _elm_win_focus_target_callbacks_add(win);
1297 _elm_win_focus_highlight_reconfigure_job_start(win);
1301 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1303 Elm_Win *win = data;
1305 if (!win->focus_highlight.cur.target)
1308 if (!win->focus_highlight.cur.handled)
1309 _elm_win_focus_target_callbacks_del(win);
1310 win->focus_highlight.cur.target = NULL;
1311 win->focus_highlight.cur.handled = EINA_FALSE;
1313 _elm_win_focus_highlight_reconfigure_job_start(win);
1317 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1319 evas_object_hide(obj);
1323 _elm_win_focus_highlight_init(Elm_Win *win)
1325 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1326 _elm_win_object_focus_in, win);
1327 evas_event_callback_add(win->evas,
1328 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1329 _elm_win_object_focus_out, win);
1331 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1333 win->focus_highlight.top = edje_object_add(win->evas);
1334 win->focus_highlight.changed_theme = EINA_TRUE;
1335 edje_object_signal_callback_add(win->focus_highlight.top,
1336 "elm,action,focus,hide,end", "",
1337 _elm_win_focus_highlight_hide, NULL);
1338 edje_object_signal_callback_add(win->focus_highlight.top,
1339 "elm,action,focus,anim,end", "",
1340 _elm_win_focus_highlight_anim_end, win);
1341 _elm_win_focus_highlight_reconfigure_job_start(win);
1345 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1347 _elm_win_focus_highlight_reconfigure_job_stop(win);
1348 if (win->focus_highlight.cur.target)
1350 _elm_win_focus_target_callbacks_del(win);
1351 win->focus_highlight.cur.target = NULL;
1353 if (win->focus_highlight.top)
1355 evas_object_del(win->focus_highlight.top);
1356 win->focus_highlight.top = NULL;
1359 evas_event_callback_del_full(win->evas,
1360 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1361 _elm_win_object_focus_in, win);
1362 evas_event_callback_del_full(win->evas,
1363 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1364 _elm_win_object_focus_out, win);
1368 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1372 top = win->focus_highlight.top;
1377 evas_object_show(top);
1378 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1384 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1389 _elm_win_focus_highlight_reconfigure_job(void *data)
1391 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1395 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1397 if (win->focus_highlight.reconf_job)
1398 ecore_job_del(win->focus_highlight.reconf_job);
1399 win->focus_highlight.reconf_job = ecore_job_add(
1400 _elm_win_focus_highlight_reconfigure_job, win);
1404 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1406 if (win->focus_highlight.reconf_job)
1407 ecore_job_del(win->focus_highlight.reconf_job);
1408 win->focus_highlight.reconf_job = NULL;
1412 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1414 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1415 Evas_Coord x, y, w, h;
1417 clip = evas_object_clip_get(target);
1418 evas_object_geometry_get(target, &x, &y, &w, &h);
1420 evas_object_move(obj, x, y);
1421 evas_object_resize(obj, w, h);
1422 evas_object_clip_set(obj, clip);
1426 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1428 Evas_Coord tx, ty, tw, th;
1429 Evas_Coord w, h, px, py, pw, ph;
1430 Edje_Message_Int_Set *m;
1431 Evas_Object *previous = win->focus_highlight.prev.target;
1432 Evas_Object *target = win->focus_highlight.cur.target;
1434 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1435 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1436 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1437 evas_object_move(obj, 0, 0);
1438 evas_object_resize(obj, tw, th);
1439 evas_object_clip_unset(obj);
1441 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1451 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1455 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1457 Elm_Win *win = data;
1458 _elm_win_focus_highlight_simple_setup(win, obj);
1462 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1464 Evas_Object *target = win->focus_highlight.cur.target;
1465 Evas_Object *previous = win->focus_highlight.prev.target;
1466 Evas_Object *top = win->focus_highlight.top;
1467 Eina_Bool visible_changed;
1468 Eina_Bool common_visible;
1469 const char *sig = NULL;
1471 _elm_win_focus_highlight_reconfigure_job_stop(win);
1473 visible_changed = (win->focus_highlight.cur.visible !=
1474 win->focus_highlight.prev.visible);
1476 if ((target == previous) && (!visible_changed) &&
1477 (!win->focus_highlight.geometry_changed))
1480 if ((previous) && (win->focus_highlight.prev.handled))
1481 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1484 common_visible = EINA_FALSE;
1485 else if (win->focus_highlight.cur.handled)
1487 common_visible = EINA_FALSE;
1488 if (win->focus_highlight.cur.visible)
1489 sig = "elm,action,focus_highlight,show";
1491 sig = "elm,action,focus_highlight,hide";
1494 common_visible = win->focus_highlight.cur.visible;
1496 _elm_win_focus_highlight_visible_set(win, common_visible);
1498 elm_widget_signal_emit(target, sig, "elm");
1500 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1503 if (win->focus_highlight.changed_theme)
1506 if (win->focus_highlight.style)
1507 str = win->focus_highlight.style;
1510 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1512 win->focus_highlight.changed_theme = EINA_FALSE;
1514 if (_elm_config->focus_highlight_animate)
1516 str = edje_object_data_get(win->focus_highlight.top, "animate");
1517 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1521 if ((win->focus_highlight.top_animate) && (previous) &&
1522 (!win->focus_highlight.prev.handled))
1523 _elm_win_focus_highlight_anim_setup(win, top);
1525 _elm_win_focus_highlight_simple_setup(win, top);
1526 evas_object_raise(top);
1529 win->focus_highlight.geometry_changed = EINA_FALSE;
1530 win->focus_highlight.prev = win->focus_highlight.cur;
1534 _elm_win_frame_add(Elm_Win *win, const char *style)
1536 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1538 win->frame_obj = edje_object_add(win->evas);
1539 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1540 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1541 evas_object_move(win->frame_obj, 0, 0);
1542 evas_object_resize(win->frame_obj, 1, 1);
1544 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1545 "elm", _elm_win_frame_cb_move_start, win);
1546 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1547 "*", _elm_win_frame_cb_resize_start, win);
1548 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1549 "elm", _elm_win_frame_cb_minimize, win);
1550 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1551 "elm", _elm_win_frame_cb_maximize, win);
1552 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1553 "elm", _elm_win_frame_cb_close, win);
1557 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1561 if (!(win = data)) return;
1562 /* FIXME: Change mouse pointer */
1564 /* NB: 0,0 are dummy values. Wayland handles the move by itself */
1565 ecore_evas_move(win->ee, 0, 0);
1569 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1573 if (!(win = data)) return;
1574 if (win->resizing) return;
1575 win->resizing = EINA_TRUE;
1577 /* FIXME: Change mouse pointer */
1579 if (!strcmp(source, "elm.event.resize.t"))
1580 win->resize_location = 1;
1581 else if (!strcmp(source, "elm.event.resize.b"))
1582 win->resize_location = 2;
1583 else if (!strcmp(source, "elm.event.resize.l"))
1584 win->resize_location = 4;
1585 else if (!strcmp(source, "elm.event.resize.r"))
1586 win->resize_location = 8;
1587 else if (!strcmp(source, "elm.event.resize.tl"))
1588 win->resize_location = 5;
1589 else if (!strcmp(source, "elm.event.resize.tr"))
1590 win->resize_location = 9;
1591 else if (!strcmp(source, "elm.event.resize.bl"))
1592 win->resize_location = 6;
1593 else if (!strcmp(source, "elm.event.resize.br"))
1594 win->resize_location = 10;
1596 win->resize_location = 0;
1598 if (win->resize_location > 0)
1599 ecore_evas_wayland_resize(win->ee, win->resize_location);
1603 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1607 if (!(win = data)) return;
1608 win->iconified = EINA_TRUE;
1609 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1613 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1617 if (!(win = data)) return;
1618 if (win->maximized) win->maximized = EINA_FALSE;
1619 else win->maximized = EINA_TRUE;
1620 ecore_evas_maximized_set(win->ee, win->maximized);
1624 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1628 if (!(win = data)) return;
1629 evas_object_del(win->win_obj);
1634 _elm_win_pointer_add(Elm_Win *win, const char *style)
1640 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1641 ecore_evas_resize(win->pointer.ee, 32, 32);
1643 win->pointer.evas = ecore_evas_get(win->ee);
1645 win->pointer.obj = edje_object_add(win->pointer.evas);
1646 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1647 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1648 evas_object_move(win->pointer.obj, 0, 0);
1649 evas_object_resize(win->pointer.obj, 32, 32);
1650 evas_object_show(win->pointer.obj);
1656 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1658 Evas_Event_Key_Down *ev = event_info;
1660 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1663 if ((strcmp(ev->keyname, "F12")) ||
1664 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1667 printf("Tree graph generated.\n");
1668 elm_object_tree_dot_dump(obj, "./dump.dot");
1673 _win_img_hide(void *data,
1675 Evas_Object *obj __UNUSED__,
1676 void *event_info __UNUSED__)
1678 Elm_Win *win = data;
1680 elm_widget_focus_hide_handle(win->win_obj);
1684 _win_img_mouse_up(void *data,
1686 Evas_Object *obj __UNUSED__,
1689 Elm_Win *win = data;
1690 Evas_Event_Mouse_Up *ev = event_info;
1691 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1692 elm_widget_focus_mouse_up_handle(win->win_obj);
1696 _win_img_focus_in(void *data,
1698 Evas_Object *obj __UNUSED__,
1699 void *event_info __UNUSED__)
1701 Elm_Win *win = data;
1702 elm_widget_focus_steal(win->win_obj);
1706 _win_img_focus_out(void *data,
1708 Evas_Object *obj __UNUSED__,
1709 void *event_info __UNUSED__)
1711 Elm_Win *win = data;
1712 elm_widget_focused_object_clear(win->win_obj);
1716 _win_inlined_image_set(Elm_Win *win)
1718 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1719 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1720 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1721 _elm_win_obj_callback_img_obj_del, win);
1723 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1724 _win_img_hide, win);
1725 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1726 _win_img_mouse_up, win);
1727 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1728 _win_img_focus_in, win);
1729 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1730 _win_img_focus_out, win);
1734 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1736 evas_object_event_callback_del_full(subobj,
1737 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1738 _elm_win_subobj_callback_changed_size_hints,
1740 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1741 _elm_win_subobj_callback_del, obj);
1742 win->subobjs = eina_list_remove(win->subobjs, subobj);
1743 _elm_win_eval_subobjs(obj);
1747 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1749 Elm_Win *win = data;
1750 if (win->icon == obj) win->icon = NULL;
1754 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1758 const char *fontpath;
1760 win = ELM_NEW(Elm_Win);
1762 #define FALLBACK_TRY(engine) \
1765 CRITICAL(engine " engine creation failed. Trying default."); \
1766 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1768 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
1770 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
1772 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
1773 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
1777 case ELM_WIN_INLINED_IMAGE:
1780 Evas *e = evas_object_evas_get(parent);
1783 ee = ecore_evas_ecore_evas_get(e);
1785 win->img_obj = ecore_evas_object_image_new(ee);
1786 if (!win->img_obj) break;
1787 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1790 _win_inlined_image_set(win);
1793 evas_object_del(win->img_obj);
1794 win->img_obj = NULL;
1798 case ELM_WIN_SOCKET_IMAGE:
1799 win->ee = ecore_evas_extn_socket_new(1, 1);
1803 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1805 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1806 #ifdef HAVE_ELEMENTARY_X
1807 win->client_message_handler = ecore_event_handler_add
1808 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1810 FALLBACK_TRY("Sofware X11");
1812 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1814 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1815 FALLBACK_TRY("Sofware FB");
1817 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1819 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1820 FALLBACK_TRY("Sofware DirectFB");
1822 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1824 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1825 FALLBACK_TRY("Sofware-16");
1826 #ifdef HAVE_ELEMENTARY_X
1827 win->client_message_handler = ecore_event_handler_add
1828 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1831 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1833 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1834 FALLBACK_TRY("Sofware-8");
1835 #ifdef HAVE_ELEMENTARY_X
1836 win->client_message_handler = ecore_event_handler_add
1837 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1841 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1843 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1844 FALLBACK_TRY("XRender");
1845 #ifdef HAVE_ELEMENTARY_X
1846 win->client_message_handler = ecore_event_handler_add
1847 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1851 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1856 if (_elm_config->vsync)
1858 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1864 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1866 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1867 FALLBACK_TRY("OpenGL");
1868 #ifdef HAVE_ELEMENTARY_X
1869 win->client_message_handler = ecore_event_handler_add
1870 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1873 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1875 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1876 FALLBACK_TRY("Sofware Win32");
1878 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1880 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1881 FALLBACK_TRY("Sofware-16-WinCE");
1883 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1885 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1886 FALLBACK_TRY("PSL1GHT");
1888 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1890 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1891 FALLBACK_TRY("Sofware SDL");
1893 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1895 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1896 FALLBACK_TRY("Sofware-16-SDL");
1898 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1900 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1901 FALLBACK_TRY("OpenGL SDL");
1903 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1905 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1906 FALLBACK_TRY("OpenGL Cocoa");
1908 else if (ENGINE_COMPARE(ELM_BUFFER))
1910 win->ee = ecore_evas_buffer_new(1, 1);
1912 else if (ENGINE_COMPARE(ELM_EWS))
1914 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1916 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1918 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
1919 win->evas = ecore_evas_get(win->ee);
1921 _elm_win_frame_add(win, "default");
1922 // _elm_win_pointer_add(win, "default");
1924 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
1926 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
1927 win->evas = ecore_evas_get(win->ee);
1929 _elm_win_frame_add(win, "default");
1930 // _elm_win_pointer_add(win, "default");
1932 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
1934 win->ee = ecore_evas_buffer_new(1, 1);
1935 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1936 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
1945 ERR("Cannot create window.");
1949 #ifdef HAVE_ELEMENTARY_X
1950 _elm_win_xwindow_get(win);
1952 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1953 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1954 // bg pixmap done by x - has other issues like can be redrawn by x before it
1955 // is filled/ready by app
1956 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1959 win->parent = parent;
1961 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1962 _elm_win_obj_callback_parent_del, win);
1964 win->evas = ecore_evas_get(win->ee);
1965 win->win_obj = elm_widget_add(win->evas);
1966 elm_widget_type_set(win->win_obj, "win");
1967 ELM_SET_WIDTYPE(widtype, "win");
1968 elm_widget_data_set(win->win_obj, win);
1969 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1970 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1971 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1972 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1973 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1974 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1975 evas_object_move(win->win_obj, 0, 0);
1976 evas_object_resize(win->win_obj, 1, 1);
1977 evas_object_layer_set(win->win_obj, 50);
1978 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1982 evas_object_clip_set(win->win_obj, win->frame_obj);
1983 evas_object_stack_below(win->frame_obj, win->win_obj);
1986 if (type == ELM_WIN_INLINED_IMAGE)
1987 elm_widget_parent2_set(win->win_obj, parent);
1988 ecore_evas_object_associate(win->ee, win->win_obj,
1989 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1990 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1991 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1992 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1993 _elm_win_obj_callback_show, win);
1994 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1995 _elm_win_obj_callback_hide, win);
1996 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1997 _elm_win_obj_callback_del, win);
1998 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1999 _elm_win_obj_callback_move, win);
2000 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
2001 _elm_win_obj_callback_resize, win);
2003 evas_object_intercept_move_callback_add(win->win_obj,
2004 _elm_win_obj_intercept_move, win);
2005 evas_object_intercept_show_callback_add(win->win_obj,
2006 _elm_win_obj_intercept_show, win);
2008 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
2009 ecore_evas_name_class_set(win->ee, name, _elm_appname);
2010 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
2011 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
2012 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
2013 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
2014 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
2015 ecore_evas_callback_move_set(win->ee, _elm_win_move);
2016 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
2017 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
2018 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
2019 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2020 evas_font_path_append(win->evas, fontpath);
2021 if (!_elm_config->font_hinting)
2022 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2023 else if (_elm_config->font_hinting == 1)
2024 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2025 else if (_elm_config->font_hinting == 2)
2026 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2028 #ifdef HAVE_ELEMENTARY_X
2029 _elm_win_xwin_update(win);
2032 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2034 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2036 ecore_evas_fullscreen_set(win->ee, 1);
2038 #undef ENGINE_COMPARE
2040 if (_elm_config->focus_highlight_enable)
2041 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2044 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2045 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2046 _debug_key_down, win);
2048 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2050 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2053 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2055 return win->win_obj;
2059 elm_win_util_standard_add(const char *name, const char *title)
2061 Evas_Object *win, *bg;
2063 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2064 if (!win) return NULL;
2065 elm_win_title_set(win, title);
2066 bg = elm_bg_add(win);
2069 evas_object_del(win);
2072 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2073 elm_win_resize_object_add(win, bg);
2074 evas_object_show(bg);
2079 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2083 ELM_CHECK_WIDTYPE(obj, widtype);
2084 win = elm_widget_data_get(obj);
2086 if (eina_list_data_find(win->subobjs, subobj)) return;
2087 win->subobjs = eina_list_append(win->subobjs, subobj);
2088 elm_widget_sub_object_add(obj, subobj);
2089 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2090 _elm_win_subobj_callback_del, obj);
2091 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2092 _elm_win_subobj_callback_changed_size_hints,
2094 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2095 evas_object_move(subobj, 0, 0);
2096 evas_object_resize(subobj, w, h);
2097 _elm_win_eval_subobjs(obj);
2101 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2104 ELM_CHECK_WIDTYPE(obj, widtype);
2105 win = elm_widget_data_get(obj);
2107 evas_object_event_callback_del_full(subobj,
2108 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2109 _elm_win_subobj_callback_changed_size_hints,
2111 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2112 _elm_win_subobj_callback_del, obj);
2113 win->subobjs = eina_list_remove(win->subobjs, subobj);
2114 elm_widget_sub_object_del(obj, subobj);
2115 _elm_win_eval_subobjs(obj);
2119 elm_win_title_set(Evas_Object *obj, const char *title)
2122 ELM_CHECK_WIDTYPE(obj, widtype);
2123 win = elm_widget_data_get(obj);
2124 if (!win || !title) return;
2125 eina_stringshare_replace(&(win->title), title);
2126 ecore_evas_title_set(win->ee, win->title);
2128 edje_object_part_text_set(win->frame_obj, "elm.text.title", win->title);
2132 elm_win_title_get(const Evas_Object *obj)
2135 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2136 win = elm_widget_data_get(obj);
2137 if (!win) return NULL;
2142 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2145 ELM_CHECK_WIDTYPE(obj, widtype);
2146 win = elm_widget_data_get(obj);
2147 if (!win || !icon_name) return;
2148 eina_stringshare_replace(&(win->icon_name), icon_name);
2149 #ifdef HAVE_ELEMENTARY_X
2150 _elm_win_xwin_update(win);
2155 elm_win_icon_name_get(const Evas_Object *obj)
2158 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2159 win = elm_widget_data_get(obj);
2160 if (!win) return NULL;
2161 return win->icon_name;
2165 elm_win_role_set(Evas_Object *obj, const char *role)
2168 ELM_CHECK_WIDTYPE(obj, widtype);
2169 win = elm_widget_data_get(obj);
2170 if (!win || !role) return;
2171 eina_stringshare_replace(&(win->role), role);
2172 #ifdef HAVE_ELEMENTARY_X
2173 _elm_win_xwin_update(win);
2178 elm_win_role_get(const Evas_Object *obj)
2181 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2182 win = elm_widget_data_get(obj);
2183 if (!win) return NULL;
2188 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2191 ELM_CHECK_WIDTYPE(obj, widtype);
2192 win = elm_widget_data_get(obj);
2195 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2196 _elm_win_obj_icon_callback_del, win);
2199 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2200 _elm_win_obj_icon_callback_del, win);
2201 #ifdef HAVE_ELEMENTARY_X
2202 _elm_win_xwin_update(win);
2206 EAPI const Evas_Object *
2207 elm_win_icon_object_get(const Evas_Object *obj)
2210 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2211 win = elm_widget_data_get(obj);
2212 if (!win) return NULL;
2217 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2220 ELM_CHECK_WIDTYPE(obj, widtype);
2221 win = elm_widget_data_get(obj);
2223 win->autodel = autodel;
2227 elm_win_autodel_get(const Evas_Object *obj)
2230 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2231 win = elm_widget_data_get(obj);
2232 if (!win) return EINA_FALSE;
2233 return win->autodel;
2237 elm_win_activate(Evas_Object *obj)
2240 ELM_CHECK_WIDTYPE(obj, widtype);
2241 win = elm_widget_data_get(obj);
2243 ecore_evas_activate(win->ee);
2247 elm_win_lower(Evas_Object *obj)
2250 ELM_CHECK_WIDTYPE(obj, widtype);
2251 win = elm_widget_data_get(obj);
2253 ecore_evas_lower(win->ee);
2257 elm_win_raise(Evas_Object *obj)
2260 ELM_CHECK_WIDTYPE(obj, widtype);
2261 win = elm_widget_data_get(obj);
2263 ecore_evas_raise(win->ee);
2267 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2270 int win_w, win_h, screen_w, screen_h, nx, ny;
2271 ELM_CHECK_WIDTYPE(obj, widtype);
2272 win = elm_widget_data_get(obj);
2274 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2275 if ((!screen_w) || (!screen_h)) return;
2276 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2277 if ((!win_w) || (!win_h)) return;
2278 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2279 else nx = win->screen.x;
2280 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2281 else ny = win->screen.y;
2284 evas_object_move(obj, nx, ny);
2288 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2291 ELM_CHECK_WIDTYPE(obj, widtype);
2292 win = elm_widget_data_get(obj);
2294 ecore_evas_borderless_set(win->ee, borderless);
2295 #ifdef HAVE_ELEMENTARY_X
2296 _elm_win_xwin_update(win);
2301 elm_win_borderless_get(const Evas_Object *obj)
2304 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2305 win = elm_widget_data_get(obj);
2306 if (!win) return EINA_FALSE;
2307 return ecore_evas_borderless_get(win->ee);
2311 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2314 ELM_CHECK_WIDTYPE(obj, widtype);
2315 win = elm_widget_data_get(obj);
2317 ecore_evas_shaped_set(win->ee, shaped);
2318 #ifdef HAVE_ELEMENTARY_X
2319 _elm_win_xwin_update(win);
2324 elm_win_shaped_get(const Evas_Object *obj)
2327 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2328 win = elm_widget_data_get(obj);
2329 if (!win) return EINA_FALSE;
2330 return ecore_evas_shaped_get(win->ee);
2334 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2337 ELM_CHECK_WIDTYPE(obj, widtype);
2338 win = elm_widget_data_get(obj);
2343 else if (win->img_obj)
2345 evas_object_image_alpha_set(win->img_obj, alpha);
2346 ecore_evas_alpha_set(win->ee, alpha);
2350 #ifdef HAVE_ELEMENTARY_X
2355 if (!_elm_config->compositing)
2356 elm_win_shaped_set(obj, alpha);
2358 ecore_evas_alpha_set(win->ee, alpha);
2361 ecore_evas_alpha_set(win->ee, alpha);
2362 _elm_win_xwin_update(win);
2366 ecore_evas_alpha_set(win->ee, alpha);
2371 elm_win_alpha_get(const Evas_Object *obj)
2374 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2375 win = elm_widget_data_get(obj);
2376 if (!win) return EINA_FALSE;
2380 else if (win->img_obj)
2382 return evas_object_image_alpha_get(win->img_obj);
2384 return ecore_evas_alpha_get(win->ee);
2388 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2391 ELM_CHECK_WIDTYPE(obj, widtype);
2392 win = elm_widget_data_get(obj);
2394 ecore_evas_override_set(win->ee, override);
2395 #ifdef HAVE_ELEMENTARY_X
2396 _elm_win_xwin_update(win);
2401 elm_win_override_get(const Evas_Object *obj)
2404 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2405 win = elm_widget_data_get(obj);
2406 if (!win) return EINA_FALSE;
2407 return ecore_evas_override_get(win->ee);
2411 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2414 ELM_CHECK_WIDTYPE(obj, widtype);
2415 win = elm_widget_data_get(obj);
2417 // YYY: handle if win->img_obj
2418 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2419 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2420 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2422 // these engines... can ONLY be fullscreen
2427 win->fullscreen = fullscreen;
2428 ecore_evas_fullscreen_set(win->ee, fullscreen);
2429 #ifdef HAVE_ELEMENTARY_X
2430 _elm_win_xwin_update(win);
2433 #undef ENGINE_COMPARE
2437 elm_win_fullscreen_get(const Evas_Object *obj)
2440 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2441 win = elm_widget_data_get(obj);
2442 if (!win) return EINA_FALSE;
2443 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2444 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2445 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2447 // these engines... can ONLY be fullscreen
2452 return win->fullscreen;
2454 #undef ENGINE_COMPARE
2458 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2461 ELM_CHECK_WIDTYPE(obj, widtype);
2462 win = elm_widget_data_get(obj);
2464 win->maximized = maximized;
2465 // YYY: handle if win->img_obj
2466 ecore_evas_maximized_set(win->ee, maximized);
2467 #ifdef HAVE_ELEMENTARY_X
2468 _elm_win_xwin_update(win);
2473 elm_win_maximized_get(const Evas_Object *obj)
2476 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2477 win = elm_widget_data_get(obj);
2478 if (!win) return EINA_FALSE;
2479 return win->maximized;
2483 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2486 ELM_CHECK_WIDTYPE(obj, widtype);
2487 win = elm_widget_data_get(obj);
2489 win->iconified = iconified;
2490 ecore_evas_iconified_set(win->ee, iconified);
2491 #ifdef HAVE_ELEMENTARY_X
2492 _elm_win_xwin_update(win);
2497 elm_win_iconified_get(const Evas_Object *obj)
2500 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2501 win = elm_widget_data_get(obj);
2502 if (!win) return EINA_FALSE;
2503 return win->iconified;
2507 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2510 ELM_CHECK_WIDTYPE(obj, widtype);
2511 win = elm_widget_data_get(obj);
2513 win->withdrawn = withdrawn;
2514 ecore_evas_withdrawn_set(win->ee, withdrawn);
2515 #ifdef HAVE_ELEMENTARY_X
2516 _elm_win_xwin_update(win);
2521 elm_win_withdrawn_get(const Evas_Object *obj)
2524 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2525 win = elm_widget_data_get(obj);
2526 if (!win) return EINA_FALSE;
2527 return win->withdrawn;
2531 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2534 ELM_CHECK_WIDTYPE(obj, widtype);
2535 win = elm_widget_data_get(obj);
2537 win->urgent = urgent;
2538 ecore_evas_urgent_set(win->ee, urgent);
2539 #ifdef HAVE_ELEMENTARY_X
2540 _elm_win_xwin_update(win);
2545 elm_win_urgent_get(const Evas_Object *obj)
2548 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2549 win = elm_widget_data_get(obj);
2550 if (!win) return EINA_FALSE;
2555 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2558 ELM_CHECK_WIDTYPE(obj, widtype);
2559 win = elm_widget_data_get(obj);
2561 win->demand_attention = demand_attention;
2562 ecore_evas_demand_attention_set(win->ee, demand_attention);
2563 #ifdef HAVE_ELEMENTARY_X
2564 _elm_win_xwin_update(win);
2569 elm_win_demand_attention_get(const Evas_Object *obj)
2572 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2573 win = elm_widget_data_get(obj);
2574 if (!win) return EINA_FALSE;
2575 return win->demand_attention;
2579 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2582 ELM_CHECK_WIDTYPE(obj, widtype);
2583 win = elm_widget_data_get(obj);
2586 ecore_evas_modal_set(win->ee, modal);
2587 #ifdef HAVE_ELEMENTARY_X
2588 _elm_win_xwin_update(win);
2593 elm_win_modal_get(const Evas_Object *obj)
2596 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2597 win = elm_widget_data_get(obj);
2598 if (!win) return EINA_FALSE;
2603 elm_win_aspect_set(Evas_Object *obj, double aspect)
2606 ELM_CHECK_WIDTYPE(obj, widtype);
2607 win = elm_widget_data_get(obj);
2609 win->aspect = aspect;
2610 ecore_evas_aspect_set(win->ee, aspect);
2611 #ifdef HAVE_ELEMENTARY_X
2612 _elm_win_xwin_update(win);
2617 elm_win_aspect_get(const Evas_Object *obj)
2620 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2621 win = elm_widget_data_get(obj);
2622 if (!win) return EINA_FALSE;
2627 elm_win_layer_set(Evas_Object *obj, int layer)
2630 ELM_CHECK_WIDTYPE(obj, widtype);
2631 win = elm_widget_data_get(obj);
2633 ecore_evas_layer_set(win->ee, layer);
2634 #ifdef HAVE_ELEMENTARY_X
2635 _elm_win_xwin_update(win);
2640 elm_win_layer_get(const Evas_Object *obj)
2643 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2644 win = elm_widget_data_get(obj);
2645 if (!win) return -1;
2646 return ecore_evas_layer_get(win->ee);
2650 elm_win_rotation_set(Evas_Object *obj, int rotation)
2653 ELM_CHECK_WIDTYPE(obj, widtype);
2654 win = elm_widget_data_get(obj);
2656 if (win->rot == rotation) return;
2657 win->rot = rotation;
2658 ecore_evas_rotation_set(win->ee, rotation);
2659 evas_object_size_hint_min_set(obj, -1, -1);
2660 evas_object_size_hint_max_set(obj, -1, -1);
2661 _elm_win_eval_subobjs(obj);
2662 #ifdef HAVE_ELEMENTARY_X
2663 _elm_win_xwin_update(win);
2668 elm_win_rotation_with_resize_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_with_resize_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_get(const Evas_Object *obj)
2689 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2690 win = elm_widget_data_get(obj);
2691 if (!win) return -1;
2696 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2699 ELM_CHECK_WIDTYPE(obj, widtype);
2700 win = elm_widget_data_get(obj);
2702 win->sticky = sticky;
2703 ecore_evas_sticky_set(win->ee, sticky);
2704 #ifdef HAVE_ELEMENTARY_X
2705 _elm_win_xwin_update(win);
2710 elm_win_sticky_get(const Evas_Object *obj)
2713 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2714 win = elm_widget_data_get(obj);
2715 if (!win) return EINA_FALSE;
2720 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2723 ELM_CHECK_WIDTYPE(obj, widtype);
2724 win = elm_widget_data_get(obj);
2726 if (mode == win->kbdmode) return;
2727 #ifdef HAVE_ELEMENTARY_X
2728 _elm_win_xwindow_get(win);
2730 win->kbdmode = mode;
2731 #ifdef HAVE_ELEMENTARY_X
2733 ecore_x_e_virtual_keyboard_state_set
2734 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2738 EAPI Elm_Win_Keyboard_Mode
2739 elm_win_keyboard_mode_get(const Evas_Object *obj)
2742 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2743 win = elm_widget_data_get(obj);
2744 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2745 return win->kbdmode;
2749 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2752 ELM_CHECK_WIDTYPE(obj, widtype);
2753 win = elm_widget_data_get(obj);
2755 #ifdef HAVE_ELEMENTARY_X
2756 _elm_win_xwindow_get(win);
2758 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2765 elm_win_keyboard_win_get(const Evas_Object *obj)
2768 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2769 win = elm_widget_data_get(obj);
2770 if (!win) return EINA_FALSE;
2771 #ifdef HAVE_ELEMENTARY_X
2772 _elm_win_xwindow_get(win);
2774 return ecore_x_e_virtual_keyboard_get(win->xwin);
2779 // WRAPPER: Temperary added.
2781 elm_win_indicator_state_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2783 elm_win_indicator_mode_set(obj, mode);
2787 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2790 ELM_CHECK_WIDTYPE(obj, widtype);
2791 win = elm_widget_data_get(obj);
2793 if (mode == win->indmode) return;
2794 #ifdef HAVE_ELEMENTARY_X
2795 _elm_win_xwindow_get(win);
2797 win->indmode = mode;
2798 #ifdef HAVE_ELEMENTARY_X
2801 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
2802 ecore_x_e_illume_indicator_state_set
2803 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
2804 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
2805 ecore_x_e_illume_indicator_state_set
2806 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
2811 // WRAPPER: Temperary added.
2812 EAPI Elm_Win_Indicator_Mode
2813 elm_win_indicator_state_get(const Evas_Object *obj)
2815 return elm_win_indicator_mode_get(obj);
2818 EAPI Elm_Win_Indicator_Mode
2819 elm_win_indicator_mode_get(const Evas_Object *obj)
2822 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
2823 win = elm_widget_data_get(obj);
2824 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
2825 return win->indmode;
2829 elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode)
2832 ELM_CHECK_WIDTYPE(obj, widtype);
2833 win = elm_widget_data_get(obj);
2835 if (mode == win->ind_o_mode) return;
2836 win->ind_o_mode = mode;
2837 #ifdef HAVE_ELEMENTARY_X
2838 _elm_win_xwindow_get(win);
2841 if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
2842 ecore_x_e_illume_indicator_opacity_set
2843 (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
2844 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
2845 ecore_x_e_illume_indicator_opacity_set
2846 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
2847 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
2848 ecore_x_e_illume_indicator_opacity_set
2849 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
2855 EAPI Elm_Win_Indicator_Opacity_Mode
2856 elm_win_indicator_opacity_get(const Evas_Object *obj)
2859 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2860 win = elm_widget_data_get(obj);
2861 if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2862 return win->ind_o_mode;
2866 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2869 ELM_CHECK_WIDTYPE(obj, widtype);
2870 win = elm_widget_data_get(obj);
2872 if (x) *x = win->screen.x;
2873 if (y) *y = win->screen.y;
2877 elm_win_focus_get(const Evas_Object *obj)
2880 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2881 win = elm_widget_data_get(obj);
2882 if (!win) return EINA_FALSE;
2883 return ecore_evas_focus_get(win->ee);
2887 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2890 ELM_CHECK_WIDTYPE(obj, widtype);
2891 win = elm_widget_data_get(obj);
2893 win->constrain = !!constrain;
2897 elm_win_screen_constrain_get(Evas_Object *obj)
2900 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2901 win = elm_widget_data_get(obj);
2902 if (!win) return EINA_FALSE;
2903 return win->constrain;
2907 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2910 ELM_CHECK_WIDTYPE(obj, widtype);
2911 win = elm_widget_data_get(obj);
2913 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2917 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2920 ELM_CHECK_WIDTYPE(obj, widtype);
2921 win = elm_widget_data_get(obj);
2923 #ifdef HAVE_ELEMENTARY_X
2924 _elm_win_xwindow_get(win);
2926 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2933 elm_win_conformant_get(const Evas_Object *obj)
2936 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2937 win = elm_widget_data_get(obj);
2938 if (!win) return EINA_FALSE;
2939 #ifdef HAVE_ELEMENTARY_X
2940 _elm_win_xwindow_get(win);
2942 return ecore_x_e_illume_conformant_get(win->xwin);
2948 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2951 ELM_CHECK_WIDTYPE(obj, widtype);
2952 win = elm_widget_data_get(obj);
2954 #ifdef HAVE_ELEMENTARY_X
2955 _elm_win_xwindow_get(win);
2958 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2961 Ecore_X_Window_State states[2];
2963 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2964 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2965 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2966 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2975 elm_win_quickpanel_get(const Evas_Object *obj)
2978 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2979 win = elm_widget_data_get(obj);
2980 if (!win) return EINA_FALSE;
2981 #ifdef HAVE_ELEMENTARY_X
2982 _elm_win_xwindow_get(win);
2984 return ecore_x_e_illume_quickpanel_get(win->xwin);
2990 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2993 ELM_CHECK_WIDTYPE(obj, widtype);
2994 win = elm_widget_data_get(obj);
2996 #ifdef HAVE_ELEMENTARY_X
2997 _elm_win_xwindow_get(win);
2999 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
3006 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
3009 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3010 win = elm_widget_data_get(obj);
3011 if (!win) return -1;
3012 #ifdef HAVE_ELEMENTARY_X
3013 _elm_win_xwindow_get(win);
3015 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
3021 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
3024 ELM_CHECK_WIDTYPE(obj, widtype);
3025 win = elm_widget_data_get(obj);
3027 #ifdef HAVE_ELEMENTARY_X
3028 _elm_win_xwindow_get(win);
3030 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3037 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3040 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3041 win = elm_widget_data_get(obj);
3042 if (!win) return -1;
3043 #ifdef HAVE_ELEMENTARY_X
3044 _elm_win_xwindow_get(win);
3046 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3052 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3055 ELM_CHECK_WIDTYPE(obj, widtype);
3056 win = elm_widget_data_get(obj);
3058 #ifdef HAVE_ELEMENTARY_X
3059 _elm_win_xwindow_get(win);
3061 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3068 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3071 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3072 win = elm_widget_data_get(obj);
3074 #ifdef HAVE_ELEMENTARY_X
3075 _elm_win_xwindow_get(win);
3077 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3083 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3086 ELM_CHECK_WIDTYPE(obj, widtype);
3087 win = elm_widget_data_get(obj);
3089 win->skip_focus = skip;
3090 ecore_evas_focus_skip_set(win->ee, skip);
3094 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3097 ELM_CHECK_WIDTYPE(obj, widtype);
3098 win = elm_widget_data_get(obj);
3100 #ifdef HAVE_ELEMENTARY_X
3101 _elm_win_xwindow_get(win);
3106 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3107 ecore_x_e_illume_focus_back_send(win->xwin);
3109 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3110 ecore_x_e_illume_focus_forward_send(win->xwin);
3112 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3113 ecore_x_e_illume_focus_home_send(win->xwin);
3115 case ELM_ILLUME_COMMAND_CLOSE:
3116 ecore_x_e_illume_close_send(win->xwin);
3128 elm_win_inlined_image_object_get(Evas_Object *obj)
3131 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3132 win = elm_widget_data_get(obj);
3133 if (!win) return NULL;
3134 return win->img_obj;
3138 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3142 ELM_CHECK_WIDTYPE(obj, widtype);
3144 win = elm_widget_data_get(obj);
3145 enabled = !!enabled;
3146 if (win->focus_highlight.enabled == enabled)
3149 win->focus_highlight.enabled = enabled;
3151 if (win->focus_highlight.enabled)
3152 _elm_win_focus_highlight_init(win);
3154 _elm_win_focus_highlight_shutdown(win);
3158 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3162 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3164 win = elm_widget_data_get(obj);
3165 return win->focus_highlight.enabled;
3169 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3173 ELM_CHECK_WIDTYPE(obj, widtype);
3175 win = elm_widget_data_get(obj);
3176 eina_stringshare_replace(&win->focus_highlight.style, style);
3177 win->focus_highlight.changed_theme = EINA_TRUE;
3178 _elm_win_focus_highlight_reconfigure_job_start(win);
3182 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3186 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3188 win = elm_widget_data_get(obj);
3189 return win->focus_highlight.style;
3192 typedef struct _Widget_Data Widget_Data;
3197 Evas_Object *content;
3200 static void _del_hook(Evas_Object *obj);
3201 static void _theme_hook(Evas_Object *obj);
3202 static void _sizing_eval(Evas_Object *obj);
3203 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3204 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3206 static const char *widtype2 = NULL;
3209 _del_hook(Evas_Object *obj)
3211 Widget_Data *wd = elm_widget_data_get(obj);
3217 _theme_hook(Evas_Object *obj)
3219 Widget_Data *wd = elm_widget_data_get(obj);
3220 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3222 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3225 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3229 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3231 Widget_Data *wd = elm_widget_data_get(obj);
3236 /* Try Focus cycle in subitem */
3239 elm_widget_focus_next_get(wd->content, dir, next);
3244 *next = (Evas_Object *)obj;
3249 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3251 Widget_Data *wd = elm_widget_data_get(obj);
3253 if (!wd || !item) return;
3254 edje_object_part_text_set(wd->frm, item, text);
3259 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3261 Widget_Data *wd = elm_widget_data_get(obj);
3263 if (!item || !wd || !wd->frm) return NULL;
3264 return edje_object_part_text_get(wd->frm, item);
3268 _sizing_eval(Evas_Object *obj)
3270 Widget_Data *wd = elm_widget_data_get(obj);
3271 Evas_Coord minw = -1, minh = -1;
3273 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3274 edje_object_size_min_calc(wd->frm, &minw, &minh);
3275 evas_object_size_hint_min_set(obj, minw, minh);
3276 evas_object_size_hint_max_set(obj, -1, -1);
3280 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3286 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3288 Widget_Data *wd = elm_widget_data_get(obj);
3289 Evas_Object *sub = event_info;
3290 if (sub == wd->content)
3292 evas_object_event_callback_del_full
3293 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3300 elm_win_inwin_add(Evas_Object *obj)
3306 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3307 win = elm_widget_data_get(obj);
3308 if (!win) return NULL;
3309 wd = ELM_NEW(Widget_Data);
3310 obj2 = elm_widget_add(win->evas);
3311 elm_widget_type_set(obj2, "inwin");
3312 ELM_SET_WIDTYPE(widtype2, "inwin");
3313 elm_widget_sub_object_add(obj, obj2);
3314 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3315 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3316 elm_win_resize_object_add(obj, obj2);
3318 elm_widget_data_set(obj2, wd);
3319 elm_widget_del_hook_set(obj2, _del_hook);
3320 elm_widget_theme_hook_set(obj2, _theme_hook);
3321 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3322 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3323 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3324 elm_widget_can_focus_set(obj2, EINA_TRUE);
3325 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3327 wd->frm = edje_object_add(win->evas);
3328 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3329 elm_widget_resize_object_set(obj2, wd->frm);
3331 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3338 elm_win_inwin_activate(Evas_Object *obj)
3340 ELM_CHECK_WIDTYPE(obj, widtype2);
3341 Widget_Data *wd = elm_widget_data_get(obj);
3343 evas_object_raise(obj);
3344 evas_object_show(obj);
3345 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3346 elm_object_focus_set(obj, EINA_TRUE);
3350 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3352 ELM_CHECK_WIDTYPE(obj, widtype2);
3353 Widget_Data *wd = elm_widget_data_get(obj);
3355 if (wd->content == content) return;
3356 if (wd->content) evas_object_del(wd->content);
3357 wd->content = content;
3360 elm_widget_sub_object_add(obj, content);
3361 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3362 _changed_size_hints, obj);
3363 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3369 elm_win_inwin_content_get(const Evas_Object *obj)
3371 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3372 Widget_Data *wd = elm_widget_data_get(obj);
3373 if (!wd) return NULL;
3378 elm_win_inwin_content_unset(Evas_Object *obj)
3380 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3381 Widget_Data *wd = elm_widget_data_get(obj);
3382 if (!wd) return NULL;
3383 if (!wd->content) return NULL;
3384 Evas_Object *content = wd->content;
3385 elm_widget_sub_object_del(obj, wd->content);
3386 evas_object_event_callback_del_full(wd->content,
3387 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3388 _changed_size_hints, obj);
3389 edje_object_part_unswallow(wd->frm, wd->content);
3395 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3400 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3401 win = elm_widget_data_get(obj);
3402 if (!win) return EINA_FALSE;
3403 if (!win->ee) return EINA_FALSE;
3405 if(!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3411 /* windowing spcific calls - shall we do this differently? */
3413 static Ecore_X_Window
3414 _elm_ee_win_get(const Evas_Object *obj)
3417 #ifdef HAVE_ELEMENTARY_X
3418 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3419 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3425 elm_win_xwindow_get(const Evas_Object *obj)
3431 type = elm_widget_type_get(obj);
3432 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3433 win = elm_widget_data_get(obj);
3435 #ifdef HAVE_ELEMENTARY_X
3436 if (win->xwin) return win->xwin;
3437 if (win->parent) return elm_win_xwindow_get(win->parent);