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;
72 const char *icon_name;
78 Eina_Bool demand_attention : 1;
79 Eina_Bool autodel : 1;
80 Eina_Bool constrain : 1;
81 Eina_Bool resizing : 1;
82 Eina_Bool iconified : 1;
83 Eina_Bool withdrawn : 1;
85 Eina_Bool fullscreen : 1;
86 Eina_Bool maximized : 1;
87 Eina_Bool skip_focus : 1;
88 Eina_Bool floating : 1;
91 static const char *widtype = NULL;
92 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
93 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
94 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
95 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
96 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
97 static void _elm_win_move(Ecore_Evas *ee);
98 static void _elm_win_resize(Ecore_Evas *ee);
99 static void _elm_win_delete_request(Ecore_Evas *ee);
100 static void _elm_win_resize_job(void *data);
101 #ifdef HAVE_ELEMENTARY_X
102 static void _elm_win_xwin_update(Elm_Win *win);
104 static void _elm_win_eval_subobjs(Evas_Object *obj);
105 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
106 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
107 static void _elm_win_focus_highlight_init(Elm_Win *win);
108 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
109 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
110 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
111 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
112 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
113 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
115 static void _elm_win_frame_add(Elm_Win *win, const char *style);
116 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
117 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
118 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
119 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
120 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
122 //static void _elm_win_pointer_add(Elm_Win *win, const char *style);
124 static const char SIG_DELETE_REQUEST[] = "delete,request";
125 static const char SIG_FOCUS_OUT[] = "focus,out";
126 static const char SIG_FOCUS_IN[] = "focus,in";
127 static const char SIG_MOVED[] = "moved";
128 static const char SIG_THEME_CHANGED[] = "theme,changed";
129 static const char SIG_WITHDRAWN[] = "withdrawn";
130 static const char SIG_ICONIFIED[] = "iconified";
131 static const char SIG_NORMAL[] = "normal";
132 static const char SIG_STICK[] = "stick";
133 static const char SIG_UNSTICK[] = "unstick";
134 static const char SIG_FULLSCREEN[] = "fullscreen";
135 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
136 static const char SIG_MAXIMIZED[] = "maximized";
137 static const char SIG_UNMAXIMIZED[] = "unmaximized";
138 static const char SIG_PROFILE_CHANGED[] = "profile,changed";
140 static const Evas_Smart_Cb_Description _signals[] = {
141 {SIG_DELETE_REQUEST, ""},
150 {SIG_FULLSCREEN, ""},
151 {SIG_UNFULLSCREEN, ""},
153 {SIG_UNMAXIMIZED, ""},
154 {SIG_PROFILE_CHANGED, ""},
160 Eina_List *_elm_win_list = NULL;
161 int _elm_win_deferred_free = 0;
163 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
164 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
167 _shot_delay_get(Elm_Win *win)
170 char *d = strdup(win->shot.info);
173 for (p = (char *)win->shot.info; *p; p++)
175 if (!strncmp(p, "delay=", 6))
179 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
194 _shot_file_get(Elm_Win *win)
197 char *tmp = strdup(win->shot.info);
198 char *repname = NULL;
200 if (!tmp) return NULL;
202 for (p = (char *)win->shot.info; *p; p++)
204 if (!strncmp(p, "file=", 5))
207 if (!win->shot.repeat_count) return tmp;
210 char *dotptr = strrchr(tmp, '.');
213 size_t size = sizeof(char)*(strlen(tmp) + 16);
214 repname = malloc(size);
215 strncpy(repname, tmp, dotptr - tmp);
216 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
217 win->shot.shot_counter + 1);
218 strcat(repname, dotptr);
226 if (!win->shot.repeat_count) return strdup("out.png");
228 repname = malloc(sizeof(char) * 24);
229 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
234 _shot_repeat_count_get(Elm_Win *win)
237 char *d = strdup(win->shot.info);
240 for (p = (char *)win->shot.info; *p; p++)
242 if (!strncmp(p, "repeat=", 7))
246 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
253 if (v > 1000) v = 999;
263 _shot_key_get(Elm_Win *win __UNUSED__)
269 _shot_flags_get(Elm_Win *win __UNUSED__)
275 _shot_do(Elm_Win *win)
279 unsigned int *pixels;
281 char *file, *key, *flags;
283 ecore_evas_manual_render(win->ee);
284 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
286 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
287 if ((w < 1) || (h < 1)) return;
288 file = _shot_file_get(win);
290 key = _shot_key_get(win);
291 flags = _shot_flags_get(win);
292 ee = ecore_evas_buffer_new(1, 1);
293 o = evas_object_image_add(ecore_evas_get(ee));
294 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
295 evas_object_image_size_set(o, w, h);
296 evas_object_image_data_set(o, pixels);
297 if (!evas_object_image_save(o, file, key, flags))
299 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
304 if (flags) free(flags);
306 if (win->shot.repeat_count) win->shot.shot_counter++;
310 _shot_delay(void *data)
314 if (win->shot.repeat_count)
316 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
317 if (remainshot > 0) return EINA_TRUE;
319 win->shot.timer = NULL;
325 _shot_init(Elm_Win *win)
327 if (!win->shot.info) return;
328 win->shot.repeat_count = _shot_repeat_count_get(win);
329 win->shot.shot_counter = 0;
333 _shot_handle(Elm_Win *win)
335 if (!win->shot.info) return;
336 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
340 _elm_win_move(Ecore_Evas *ee)
342 Evas_Object *obj = ecore_evas_object_associate_get(ee);
347 win = elm_widget_data_get(obj);
349 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
352 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
356 _elm_win_resize(Ecore_Evas *ee)
358 Evas_Object *obj = ecore_evas_object_associate_get(ee);
362 win = elm_widget_data_get(obj);
364 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
365 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
369 _elm_win_mouse_in(Ecore_Evas *ee)
374 if (!(obj = ecore_evas_object_associate_get(ee))) return;
375 if (!(win = elm_widget_data_get(obj))) return;
376 if (win->resizing) win->resizing = EINA_FALSE;
380 _elm_win_focus_in(Ecore_Evas *ee)
382 Evas_Object *obj = ecore_evas_object_associate_get(ee);
386 win = elm_widget_data_get(obj);
388 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
389 if (!elm_widget_focus_order_get(obj))
391 elm_widget_focus_steal(win->win_obj);
395 elm_widget_focus_restore(win->win_obj);
396 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
397 win->focus_highlight.cur.visible = EINA_TRUE;
398 _elm_win_focus_highlight_reconfigure_job_start(win);
401 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
403 else if (win->img_obj)
410 _elm_win_focus_out(Ecore_Evas *ee)
412 Evas_Object *obj = ecore_evas_object_associate_get(ee);
416 win = elm_widget_data_get(obj);
418 elm_object_focus_set(win->win_obj, EINA_FALSE);
419 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
420 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
421 win->focus_highlight.cur.visible = EINA_FALSE;
422 _elm_win_focus_highlight_reconfigure_job_start(win);
425 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
427 else if (win->img_obj)
434 _elm_win_profile_update(Ecore_Evas *ee)
436 Evas_Object *obj = ecore_evas_object_associate_get(ee);
440 win = elm_widget_data_get(obj);
443 if (win->profile.timer)
444 ecore_timer_del(win->profile.timer);
445 win->profile.timer = NULL;
447 /* TODO: We need the ability to bind a profile to a specific window.
448 * Elementary's configuration still has a single global profile for the app.
450 _elm_config_profile_set(win->profile.name);
452 evas_object_smart_callback_call(win->win_obj, SIG_PROFILE_CHANGED, NULL);
456 _elm_win_profile_change_delay(void *data)
460 Eina_Bool changed = EINA_FALSE;
462 profile = eina_list_nth(win->profile.names, 0);
465 if (win->profile.name)
467 if (strcmp(win->profile.name, profile))
469 eina_stringshare_replace(&(win->profile.name), profile);
475 win->profile.name = eina_stringshare_add(profile);
479 win->profile.timer = NULL;
480 if (changed) _elm_win_profile_update(win->ee);
485 _elm_win_state_change(Ecore_Evas *ee)
489 Eina_Bool ch_withdrawn = EINA_FALSE;
490 Eina_Bool ch_sticky = EINA_FALSE;
491 Eina_Bool ch_iconified = EINA_FALSE;
492 Eina_Bool ch_fullscreen = EINA_FALSE;
493 Eina_Bool ch_maximized = EINA_FALSE;
494 Eina_Bool ch_profile = EINA_FALSE;
497 if (!(obj = ecore_evas_object_associate_get(ee))) return;
499 if (!(win = elm_widget_data_get(obj))) return;
501 if (win->withdrawn != ecore_evas_withdrawn_get(win->ee))
503 win->withdrawn = ecore_evas_withdrawn_get(win->ee);
504 ch_withdrawn = EINA_TRUE;
506 if (win->sticky != ecore_evas_sticky_get(win->ee))
508 win->sticky = ecore_evas_sticky_get(win->ee);
509 ch_sticky = EINA_TRUE;
511 if (win->iconified != ecore_evas_iconified_get(win->ee))
513 win->iconified = ecore_evas_iconified_get(win->ee);
514 ch_iconified = EINA_TRUE;
516 if (win->fullscreen != ecore_evas_fullscreen_get(win->ee))
518 win->fullscreen = ecore_evas_fullscreen_get(win->ee);
519 ch_fullscreen = EINA_TRUE;
521 if (win->maximized != ecore_evas_maximized_get(win->ee))
523 win->maximized = ecore_evas_maximized_get(win->ee);
524 ch_maximized = EINA_TRUE;
526 profile = ecore_evas_profile_get(win->ee);
528 _elm_config_profile_exists(profile))
530 if (win->profile.name)
532 if (strcmp(win->profile.name, profile))
534 eina_stringshare_replace(&(win->profile.name), profile);
535 ch_profile = EINA_TRUE;
540 win->profile.name = eina_stringshare_add(profile);
541 ch_profile = EINA_TRUE;
544 if ((ch_withdrawn) || (ch_iconified))
547 evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL);
548 else if (win->iconified)
549 evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL);
551 evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL);
556 evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL);
558 evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL);
563 evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL);
565 evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL);
570 evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL);
572 evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL);
576 _elm_win_profile_update(win->ee);
581 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
583 Elm_Win *wd = elm_widget_data_get(obj);
584 const Eina_List *items;
585 const Eina_List *list;
586 void *(*list_data_get) (const Eina_List *list);
590 list = elm_widget_sub_object_list_get(obj);
595 if (!(items = elm_widget_focus_custom_chain_get(obj)))
598 list_data_get = eina_list_data_get;
600 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
605 *next = (Evas_Object *)obj;
610 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
612 Elm_Win *win = elm_widget_data_get(obj);
616 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
618 evas_object_focus_set(obj, elm_widget_focus_get(obj));
622 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
624 if (type == EVAS_CALLBACK_KEY_DOWN)
626 Evas_Event_Key_Down *ev = event_info;
627 if (!strcmp(ev->keyname, "Tab"))
629 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
630 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
632 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
633 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
636 else if ((!strcmp(ev->keyname, "Left")) ||
637 ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
639 //TODO : woohyun jung
641 else if ((!strcmp(ev->keyname, "Right")) ||
642 ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
644 //TODO : woohyun jung
646 else if ((!strcmp(ev->keyname, "Up")) ||
647 ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
649 //TODO : woohyun jung
651 else if ((!strcmp(ev->keyname, "Down")) ||
652 ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
654 //TODO : woohyun jung
662 _deferred_ecore_evas_free(void *data)
664 ecore_evas_free(data);
665 _elm_win_deferred_free--;
669 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
673 if (!win->show_count) win->show_count++;
674 if (win->shot.info) _shot_handle(win);
678 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
684 evas_object_hide(win->frame_obj);
686 else if (win->img_obj)
688 evas_object_hide(win->img_obj);
690 if (win->pointer.obj)
692 evas_object_hide(win->pointer.obj);
693 ecore_evas_hide(win->pointer.ee);
698 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
705 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
708 Evas_Object *child, *child2 = NULL;
713 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
714 _elm_win_obj_callback_parent_del, win);
717 if (win->autodel_clear) *(win->autodel_clear) = -1;
718 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
719 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
722 ecore_evas_callback_delete_request_set(win->ee, NULL);
723 ecore_evas_callback_resize_set(win->ee, NULL);
725 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
726 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
727 if (win->shot.info) eina_stringshare_del(win->shot.info);
728 if (win->shot.timer) ecore_timer_del(win->shot.timer);
729 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
730 _elm_win_obj_callback_del, win);
731 child = evas_object_bottom_get(win->evas);
734 /* if the object we see *IS* the window object (because we are
735 * faking a parent object inside the canvas), then skip it and
736 * go to the next one */
739 child = evas_object_above_get(child);
742 /* if we are using the next object above from the previous loop */
745 /* this object has refcounts from the previous loop */
746 child2 = evas_object_above_get(child);
747 if (child2) evas_object_ref(child2);
748 evas_object_del(child);
749 /* so unref from previous loop */
750 evas_object_unref(child);
755 /* just delete as normal (probably only first object */
756 child2 = evas_object_above_get(child);
757 if (child2) evas_object_ref(child2);
758 evas_object_del(child);
762 #ifdef HAVE_ELEMENTARY_X
763 if (win->client_message_handler)
764 ecore_event_handler_del(win->client_message_handler);
766 // FIXME: Why are we flushing edje on every window destroy ??
767 // edje_file_cache_flush();
768 // edje_collection_cache_flush();
769 // evas_image_cache_flush(win->evas);
770 // evas_font_cache_flush(win->evas);
771 // FIXME: we are in the del handler for the object and delete the canvas
772 // that lives under it from the handler... nasty. deferring doesn't help either
776 evas_object_event_callback_del_full
777 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
784 ecore_job_add(_deferred_ecore_evas_free, win->ee);
785 _elm_win_deferred_free++;
789 _elm_win_focus_highlight_shutdown(win);
790 eina_stringshare_del(win->focus_highlight.style);
792 if (win->title) eina_stringshare_del(win->title);
793 if (win->icon_name) eina_stringshare_del(win->icon_name);
794 if (win->role) eina_stringshare_del(win->role);
795 if (win->icon) evas_object_del(win->icon);
797 EINA_LIST_FREE(win->profile.names, str) eina_stringshare_del(str);
798 if (win->profile.name) eina_stringshare_del(win->profile.name);
799 if (win->profile.timer) ecore_timer_del(win->profile.timer);
803 if ((!_elm_win_list) &&
804 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
806 edje_file_cache_flush();
807 edje_collection_cache_flush();
808 evas_image_cache_flush(e);
809 evas_font_cache_flush(e);
816 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
819 if (obj == win->parent) win->parent = NULL;
823 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
829 if ((x != win->screen.x) || (y != win->screen.y))
833 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
838 evas_object_move(obj, x, y);
843 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
846 // this is called to make sure all smart containers have calculated their
847 // sizes BEFORE we show the window to make sure it initially appears at
848 // our desired size (ie min size is known first)
849 evas_smart_objects_calculate(evas_object_evas_get(obj));
852 evas_object_show(win->frame_obj);
854 else if (win->img_obj)
856 evas_object_show(win->img_obj);
858 if (win->pointer.obj)
860 ecore_evas_show(win->pointer.ee);
861 evas_object_show(win->pointer.obj);
862 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
864 evas_object_show(obj);
868 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
872 if (ecore_evas_override_get(win->ee))
876 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
879 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
885 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
889 /* FIXME: We should update ecore_wl_window_location here !! */
891 else if (win->img_obj)
895 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
898 // evas_object_move(win->img_obj, x, y);
903 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
910 else if (win->img_obj)
912 Evas_Coord w = 1, h = 1;
914 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
918 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
924 evas_object_image_size_set(win->img_obj, w, h);
929 _elm_win_delete_request(Ecore_Evas *ee)
931 Evas_Object *obj = ecore_evas_object_associate_get(ee);
933 if (strcmp(elm_widget_type_get(obj), "win")) return;
935 win = elm_widget_data_get(obj);
937 int autodel = win->autodel;
938 win->autodel_clear = &autodel;
939 evas_object_ref(win->win_obj);
940 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
941 // FIXME: if above callback deletes - then the below will be invalid
942 if (autodel) evas_object_del(win->win_obj);
943 else win->autodel_clear = NULL;
944 evas_object_unref(win->win_obj);
948 _elm_win_resize_job(void *data)
955 win->deferred_resize_job = NULL;
956 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
960 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
966 evas_object_resize(win->frame_obj, w, h);
968 else if (win->img_obj)
971 evas_object_resize(win->win_obj, w, h);
972 EINA_LIST_FOREACH(win->subobjs, l, obj)
974 evas_object_move(obj, 0, 0);
975 evas_object_resize(obj, w, h);
979 #ifdef HAVE_ELEMENTARY_X
981 _elm_win_xwindow_get(Elm_Win *win)
985 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
986 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
988 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
990 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
991 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
992 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
993 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
994 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
995 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
996 ENGINE_COMPARE(ELM_OPENGL_COCOA))
999 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1001 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
1003 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1005 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
1008 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1010 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
1013 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1015 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
1017 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1019 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
1021 #undef ENGINE_COMPARE
1025 #ifdef HAVE_ELEMENTARY_X
1027 _elm_win_xwin_update(Elm_Win *win)
1031 _elm_win_xwindow_get(win);
1036 win2 = elm_widget_data_get(win->parent);
1040 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
1044 if (!win->xwin) return; /* nothing more to do */
1047 if (!s) s = _elm_appname;
1049 if (win->icon_name) s = win->icon_name;
1050 ecore_x_icccm_icon_name_set(win->xwin, s);
1051 ecore_x_netwm_icon_name_set(win->xwin, s);
1054 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
1061 data = evas_object_image_data_get(win->icon, EINA_FALSE);
1065 int w = 0, h = 0, stride, x, y;
1069 evas_object_image_size_get(win->icon, &w, &h);
1070 stride = evas_object_image_stride_get(win->icon);
1071 if ((w > 0) && (h > 0) &&
1072 (stride >= (int)(w * sizeof(unsigned int))))
1076 ic.data = malloc(w * h * sizeof(unsigned int));
1080 p = (unsigned char *)data;
1081 p2 = (unsigned int *)ic.data;
1082 for (y = 0; y < h; y++)
1084 for (x = 0; x < w; x++)
1086 *p2 = *((unsigned int *)p);
1087 p += sizeof(unsigned int);
1090 p += (stride - (w * sizeof(unsigned int)));
1092 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
1096 evas_object_image_data_set(win->icon, data);
1103 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
1105 case ELM_WIN_DIALOG_BASIC:
1106 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
1108 case ELM_WIN_DESKTOP:
1109 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1112 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
1114 case ELM_WIN_TOOLBAR:
1115 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1118 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1120 case ELM_WIN_UTILITY:
1121 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1123 case ELM_WIN_SPLASH:
1124 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1126 case ELM_WIN_DROPDOWN_MENU:
1127 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1129 case ELM_WIN_POPUP_MENU:
1130 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1132 case ELM_WIN_TOOLTIP:
1133 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1135 case ELM_WIN_NOTIFICATION:
1136 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1139 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1142 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1147 ecore_x_e_virtual_keyboard_state_set
1148 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1149 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
1150 ecore_x_e_illume_indicator_state_set
1151 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1152 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
1153 ecore_x_e_illume_indicator_state_set
1154 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1159 _elm_win_eval_subobjs(Evas_Object *obj)
1162 const Evas_Object *child;
1164 Elm_Win *win = elm_widget_data_get(obj);
1165 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1169 EINA_LIST_FOREACH(win->subobjs, l, child)
1171 evas_object_size_hint_weight_get(child, &wx, &wy);
1172 if (wx == 0.0) xx = 0;
1173 if (wy == 0.0) xy = 0;
1175 evas_object_size_hint_min_get(child, &w, &h);
1178 if (w > minw) minw = w;
1179 if (h > minh) minh = h;
1181 evas_object_size_hint_max_get(child, &w, &h);
1184 if (maxw == -1) maxw = w;
1185 else if ((w > 0) && (w < maxw)) maxw = w;
1186 if (maxh == -1) maxh = h;
1187 else if ((h > 0) && (h < maxh)) maxh = h;
1189 if (!xx) maxw = minw;
1191 if (!xy) maxh = minh;
1193 evas_object_size_hint_min_set(obj, minw, minh);
1194 evas_object_size_hint_max_set(obj, maxw, maxh);
1195 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1196 if (w < minw) w = minw;
1197 if (h < minh) h = minh;
1198 if ((maxw >= 0) && (w > maxw)) w = maxw;
1199 if ((maxh >= 0) && (h > maxh)) h = maxh;
1200 evas_object_resize(obj, w, h);
1204 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1206 Elm_Win *win = elm_widget_data_get(data);
1207 win->subobjs = eina_list_remove(win->subobjs, obj);
1208 _elm_win_eval_subobjs(win->win_obj);
1212 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1214 _elm_win_eval_subobjs(data);
1218 _elm_win_shutdown(void)
1220 while (_elm_win_list)
1221 evas_object_del(_elm_win_list->data);
1225 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1232 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1233 elm_widget_theme(obj);
1237 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1238 elm_widget_theme_specific(obj, th, EINA_FALSE);
1243 _elm_win_translate(void)
1248 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1249 elm_widget_translate(obj);
1252 #ifdef HAVE_ELEMENTARY_X
1254 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1256 Elm_Win *win = data;
1257 Ecore_X_Event_Client_Message *e = event;
1259 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1260 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1262 if ((unsigned)e->data.l[0] == win->xwin)
1264 Evas *evas = evas_object_evas_get(win->win_obj);
1267 edje_file_cache_flush();
1268 edje_collection_cache_flush();
1269 evas_image_cache_flush(evas);
1270 evas_font_cache_flush(evas);
1274 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1276 if ((unsigned)e->data.l[0] == win->xwin)
1278 Evas *evas = evas_object_evas_get(win->win_obj);
1281 edje_file_cache_flush();
1282 edje_collection_cache_flush();
1283 evas_image_cache_flush(evas);
1284 evas_font_cache_flush(evas);
1285 evas_render_dump(evas);
1289 return ECORE_CALLBACK_PASS_ON;
1294 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1296 Elm_Win *win = data;
1298 win->focus_highlight.geometry_changed = EINA_TRUE;
1299 _elm_win_focus_highlight_reconfigure_job_start(win);
1303 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1305 Elm_Win *win = data;
1307 win->focus_highlight.geometry_changed = EINA_TRUE;
1308 _elm_win_focus_highlight_reconfigure_job_start(win);
1312 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1314 Elm_Win *win = data;
1316 win->focus_highlight.cur.target = NULL;
1318 _elm_win_focus_highlight_reconfigure_job_start(win);
1322 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1324 Evas_Object *obj = win->focus_highlight.cur.target;
1326 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1327 _elm_win_focus_target_move, win);
1328 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1329 _elm_win_focus_target_resize, win);
1330 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1331 _elm_win_focus_target_del, win);
1335 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1337 Evas_Object *obj = win->focus_highlight.cur.target;
1339 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1340 _elm_win_focus_target_move, win);
1341 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1342 _elm_win_focus_target_resize, win);
1343 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1344 _elm_win_focus_target_del, win);
1347 static Evas_Object *
1348 _elm_win_focus_target_get(Evas_Object *obj)
1350 Evas_Object *o = obj;
1354 if (elm_widget_is(o))
1356 if (!elm_widget_highlight_ignore_get(o))
1358 o = elm_widget_parent_get(o);
1360 o = evas_object_smart_parent_get(o);
1364 o = elm_widget_parent_widget_get(o);
1366 o = evas_object_smart_parent_get(o);
1375 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1377 Evas_Object *obj = event_info, *target;
1378 Elm_Win *win = data;
1380 if (win->focus_highlight.cur.target == obj)
1383 target = _elm_win_focus_target_get(obj);
1384 win->focus_highlight.cur.target = target;
1385 if (elm_widget_highlight_in_theme_get(target))
1386 win->focus_highlight.cur.handled = EINA_TRUE;
1388 _elm_win_focus_target_callbacks_add(win);
1390 _elm_win_focus_highlight_reconfigure_job_start(win);
1394 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1396 Elm_Win *win = data;
1398 if (!win->focus_highlight.cur.target)
1401 if (!win->focus_highlight.cur.handled)
1402 _elm_win_focus_target_callbacks_del(win);
1403 win->focus_highlight.cur.target = NULL;
1404 win->focus_highlight.cur.handled = EINA_FALSE;
1406 _elm_win_focus_highlight_reconfigure_job_start(win);
1410 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1412 evas_object_hide(obj);
1416 _elm_win_focus_highlight_init(Elm_Win *win)
1418 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1419 _elm_win_object_focus_in, win);
1420 evas_event_callback_add(win->evas,
1421 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1422 _elm_win_object_focus_out, win);
1424 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1426 win->focus_highlight.top = edje_object_add(win->evas);
1427 win->focus_highlight.changed_theme = EINA_TRUE;
1428 edje_object_signal_callback_add(win->focus_highlight.top,
1429 "elm,action,focus,hide,end", "",
1430 _elm_win_focus_highlight_hide, NULL);
1431 edje_object_signal_callback_add(win->focus_highlight.top,
1432 "elm,action,focus,anim,end", "",
1433 _elm_win_focus_highlight_anim_end, win);
1434 _elm_win_focus_highlight_reconfigure_job_start(win);
1438 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1440 _elm_win_focus_highlight_reconfigure_job_stop(win);
1441 if (win->focus_highlight.cur.target)
1443 _elm_win_focus_target_callbacks_del(win);
1444 win->focus_highlight.cur.target = NULL;
1446 if (win->focus_highlight.top)
1448 evas_object_del(win->focus_highlight.top);
1449 win->focus_highlight.top = NULL;
1452 evas_event_callback_del_full(win->evas,
1453 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1454 _elm_win_object_focus_in, win);
1455 evas_event_callback_del_full(win->evas,
1456 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1457 _elm_win_object_focus_out, win);
1461 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1465 top = win->focus_highlight.top;
1470 evas_object_show(top);
1471 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1477 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1482 _elm_win_focus_highlight_reconfigure_job(void *data)
1484 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1488 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1490 if (win->focus_highlight.reconf_job)
1491 ecore_job_del(win->focus_highlight.reconf_job);
1492 win->focus_highlight.reconf_job = ecore_job_add(
1493 _elm_win_focus_highlight_reconfigure_job, win);
1497 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1499 if (win->focus_highlight.reconf_job)
1500 ecore_job_del(win->focus_highlight.reconf_job);
1501 win->focus_highlight.reconf_job = NULL;
1505 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1507 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1508 Evas_Coord x, y, w, h;
1510 clip = evas_object_clip_get(target);
1511 evas_object_geometry_get(target, &x, &y, &w, &h);
1513 evas_object_move(obj, x, y);
1514 evas_object_resize(obj, w, h);
1515 evas_object_clip_set(obj, clip);
1519 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1521 Evas_Coord tx, ty, tw, th;
1522 Evas_Coord w, h, px, py, pw, ph;
1523 Edje_Message_Int_Set *m;
1524 Evas_Object *previous = win->focus_highlight.prev.target;
1525 Evas_Object *target = win->focus_highlight.cur.target;
1527 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1528 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1529 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1530 evas_object_move(obj, 0, 0);
1531 evas_object_resize(obj, tw, th);
1532 evas_object_clip_unset(obj);
1534 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1544 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1548 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1550 Elm_Win *win = data;
1551 _elm_win_focus_highlight_simple_setup(win, obj);
1555 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1557 Evas_Object *target = win->focus_highlight.cur.target;
1558 Evas_Object *previous = win->focus_highlight.prev.target;
1559 Evas_Object *top = win->focus_highlight.top;
1560 Eina_Bool visible_changed;
1561 Eina_Bool common_visible;
1562 const char *sig = NULL;
1564 _elm_win_focus_highlight_reconfigure_job_stop(win);
1566 visible_changed = (win->focus_highlight.cur.visible !=
1567 win->focus_highlight.prev.visible);
1569 if ((target == previous) && (!visible_changed) &&
1570 (!win->focus_highlight.geometry_changed))
1573 if ((previous) && (win->focus_highlight.prev.handled))
1574 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1577 common_visible = EINA_FALSE;
1578 else if (win->focus_highlight.cur.handled)
1580 common_visible = EINA_FALSE;
1581 if (win->focus_highlight.cur.visible)
1582 sig = "elm,action,focus_highlight,show";
1584 sig = "elm,action,focus_highlight,hide";
1587 common_visible = win->focus_highlight.cur.visible;
1589 _elm_win_focus_highlight_visible_set(win, common_visible);
1591 elm_widget_signal_emit(target, sig, "elm");
1593 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1596 if (win->focus_highlight.changed_theme)
1599 if (win->focus_highlight.style)
1600 str = win->focus_highlight.style;
1603 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1605 win->focus_highlight.changed_theme = EINA_FALSE;
1607 if (_elm_config->focus_highlight_animate)
1609 str = edje_object_data_get(win->focus_highlight.top, "animate");
1610 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1614 if ((win->focus_highlight.top_animate) && (previous) &&
1615 (!win->focus_highlight.prev.handled))
1616 _elm_win_focus_highlight_anim_setup(win, top);
1618 _elm_win_focus_highlight_simple_setup(win, top);
1619 evas_object_raise(top);
1622 win->focus_highlight.geometry_changed = EINA_FALSE;
1623 win->focus_highlight.prev = win->focus_highlight.cur;
1627 _elm_win_frame_add(Elm_Win *win, const char *style)
1629 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1631 win->frame_obj = edje_object_add(win->evas);
1632 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1633 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1634 evas_object_move(win->frame_obj, 0, 0);
1635 evas_object_resize(win->frame_obj, 1, 1);
1637 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1638 "elm", _elm_win_frame_cb_move_start, win);
1639 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1640 "*", _elm_win_frame_cb_resize_start, win);
1641 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1642 "elm", _elm_win_frame_cb_minimize, win);
1643 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1644 "elm", _elm_win_frame_cb_maximize, win);
1645 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1646 "elm", _elm_win_frame_cb_close, win);
1650 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1654 if (!(win = data)) return;
1655 /* FIXME: Change mouse pointer */
1657 /* NB: Wayland handles moving surfaces by itself so we cannot
1658 * specify a specific x/y we want. Instead, we will pass in the
1659 * existing x/y values so they can be recorded as 'previous' position.
1660 * The new position will get updated automatically when the move is
1663 ecore_evas_wayland_move(win->ee, win->screen.x, win->screen.y);
1667 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1671 if (!(win = data)) return;
1672 if (win->resizing) return;
1673 win->resizing = EINA_TRUE;
1675 /* FIXME: Change mouse pointer */
1677 if (!strcmp(source, "elm.event.resize.t"))
1678 win->resize_location = 1;
1679 else if (!strcmp(source, "elm.event.resize.b"))
1680 win->resize_location = 2;
1681 else if (!strcmp(source, "elm.event.resize.l"))
1682 win->resize_location = 4;
1683 else if (!strcmp(source, "elm.event.resize.r"))
1684 win->resize_location = 8;
1685 else if (!strcmp(source, "elm.event.resize.tl"))
1686 win->resize_location = 5;
1687 else if (!strcmp(source, "elm.event.resize.tr"))
1688 win->resize_location = 9;
1689 else if (!strcmp(source, "elm.event.resize.bl"))
1690 win->resize_location = 6;
1691 else if (!strcmp(source, "elm.event.resize.br"))
1692 win->resize_location = 10;
1694 win->resize_location = 0;
1696 if (win->resize_location > 0)
1697 ecore_evas_wayland_resize(win->ee, win->resize_location);
1701 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1705 if (!(win = data)) return;
1706 win->iconified = EINA_TRUE;
1707 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1711 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1715 if (!(win = data)) return;
1716 if (win->maximized) win->maximized = EINA_FALSE;
1717 else win->maximized = EINA_TRUE;
1718 ecore_evas_maximized_set(win->ee, win->maximized);
1722 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1726 if (!(win = data)) return;
1727 evas_object_del(win->win_obj);
1732 _elm_win_pointer_add(Elm_Win *win, const char *style)
1738 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1739 ecore_evas_resize(win->pointer.ee, 32, 32);
1741 win->pointer.evas = ecore_evas_get(win->ee);
1743 win->pointer.obj = edje_object_add(win->pointer.evas);
1744 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1745 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1746 evas_object_move(win->pointer.obj, 0, 0);
1747 evas_object_resize(win->pointer.obj, 32, 32);
1748 evas_object_show(win->pointer.obj);
1754 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1756 Evas_Event_Key_Down *ev = event_info;
1758 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1761 if ((strcmp(ev->keyname, "F12")) ||
1762 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1765 printf("Tree graph generated.\n");
1766 elm_object_tree_dot_dump(obj, "./dump.dot");
1771 _win_img_hide(void *data,
1773 Evas_Object *obj __UNUSED__,
1774 void *event_info __UNUSED__)
1776 Elm_Win *win = data;
1778 elm_widget_focus_hide_handle(win->win_obj);
1782 _win_img_mouse_up(void *data,
1784 Evas_Object *obj __UNUSED__,
1787 Elm_Win *win = data;
1788 Evas_Event_Mouse_Up *ev = event_info;
1789 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1790 elm_widget_focus_mouse_up_handle(win->win_obj);
1794 _win_img_focus_in(void *data,
1796 Evas_Object *obj __UNUSED__,
1797 void *event_info __UNUSED__)
1799 Elm_Win *win = data;
1800 elm_widget_focus_steal(win->win_obj);
1804 _win_img_focus_out(void *data,
1806 Evas_Object *obj __UNUSED__,
1807 void *event_info __UNUSED__)
1809 Elm_Win *win = data;
1810 elm_widget_focused_object_clear(win->win_obj);
1814 _win_inlined_image_set(Elm_Win *win)
1816 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1817 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1818 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1819 _elm_win_obj_callback_img_obj_del, win);
1821 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1822 _win_img_hide, win);
1823 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1824 _win_img_mouse_up, win);
1825 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1826 _win_img_focus_in, win);
1827 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1828 _win_img_focus_out, win);
1832 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1834 evas_object_event_callback_del_full(subobj,
1835 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1836 _elm_win_subobj_callback_changed_size_hints,
1838 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1839 _elm_win_subobj_callback_del, obj);
1840 win->subobjs = eina_list_remove(win->subobjs, subobj);
1841 _elm_win_eval_subobjs(obj);
1845 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1847 Elm_Win *win = data;
1848 if (win->icon == obj) win->icon = NULL;
1852 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1856 const char *fontpath;
1858 win = ELM_NEW(Elm_Win);
1860 #define FALLBACK_TRY(engine) \
1863 CRITICAL(engine " engine creation failed. Trying default."); \
1864 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1866 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
1868 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
1870 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
1871 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
1875 case ELM_WIN_INLINED_IMAGE:
1878 Evas *e = evas_object_evas_get(parent);
1881 ee = ecore_evas_ecore_evas_get(e);
1883 win->img_obj = ecore_evas_object_image_new(ee);
1884 if (!win->img_obj) break;
1885 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1888 _win_inlined_image_set(win);
1891 evas_object_del(win->img_obj);
1892 win->img_obj = NULL;
1896 case ELM_WIN_SOCKET_IMAGE:
1897 win->ee = ecore_evas_extn_socket_new(1, 1);
1901 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1903 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1904 #ifdef HAVE_ELEMENTARY_X
1905 win->client_message_handler = ecore_event_handler_add
1906 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1908 FALLBACK_TRY("Sofware X11");
1910 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1912 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1913 FALLBACK_TRY("Sofware FB");
1915 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1917 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1918 FALLBACK_TRY("Sofware DirectFB");
1920 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1922 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1923 FALLBACK_TRY("Sofware-16");
1924 #ifdef HAVE_ELEMENTARY_X
1925 win->client_message_handler = ecore_event_handler_add
1926 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1929 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1931 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1932 FALLBACK_TRY("Sofware-8");
1933 #ifdef HAVE_ELEMENTARY_X
1934 win->client_message_handler = ecore_event_handler_add
1935 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1939 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1941 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1942 FALLBACK_TRY("XRender");
1943 #ifdef HAVE_ELEMENTARY_X
1944 win->client_message_handler = ecore_event_handler_add
1945 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1949 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1954 if (_elm_config->vsync)
1956 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1962 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1964 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1965 FALLBACK_TRY("OpenGL");
1966 #ifdef HAVE_ELEMENTARY_X
1967 win->client_message_handler = ecore_event_handler_add
1968 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1971 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1973 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1974 FALLBACK_TRY("Sofware Win32");
1976 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1978 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1979 FALLBACK_TRY("Sofware-16-WinCE");
1981 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1983 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1984 FALLBACK_TRY("PSL1GHT");
1986 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1988 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1989 FALLBACK_TRY("Sofware SDL");
1991 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1993 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1994 FALLBACK_TRY("Sofware-16-SDL");
1996 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1998 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1999 FALLBACK_TRY("OpenGL SDL");
2001 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
2003 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
2004 FALLBACK_TRY("OpenGL Cocoa");
2006 else if (ENGINE_COMPARE(ELM_BUFFER))
2008 win->ee = ecore_evas_buffer_new(1, 1);
2010 else if (ENGINE_COMPARE(ELM_EWS))
2012 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
2014 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
2016 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
2017 win->evas = ecore_evas_get(win->ee);
2019 _elm_win_frame_add(win, "default");
2020 // _elm_win_pointer_add(win, "default");
2022 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
2024 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
2025 win->evas = ecore_evas_get(win->ee);
2027 _elm_win_frame_add(win, "default");
2028 // _elm_win_pointer_add(win, "default");
2030 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
2032 win->ee = ecore_evas_buffer_new(1, 1);
2033 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
2034 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
2043 ERR("Cannot create window.");
2047 #ifdef HAVE_ELEMENTARY_X
2048 _elm_win_xwindow_get(win);
2050 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
2051 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
2052 // bg pixmap done by x - has other issues like can be redrawn by x before it
2053 // is filled/ready by app
2054 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
2057 win->parent = parent;
2059 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
2060 _elm_win_obj_callback_parent_del, win);
2062 win->evas = ecore_evas_get(win->ee);
2063 win->win_obj = elm_widget_add(win->evas);
2064 elm_widget_type_set(win->win_obj, "win");
2065 ELM_SET_WIDTYPE(widtype, "win");
2066 elm_widget_data_set(win->win_obj, win);
2067 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
2068 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
2069 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
2070 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
2071 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
2072 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
2073 evas_object_move(win->win_obj, 0, 0);
2074 evas_object_resize(win->win_obj, 1, 1);
2075 evas_object_layer_set(win->win_obj, 50);
2076 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
2080 evas_object_clip_set(win->win_obj, win->frame_obj);
2081 evas_object_stack_below(win->frame_obj, win->win_obj);
2084 if (type == ELM_WIN_INLINED_IMAGE)
2085 elm_widget_parent2_set(win->win_obj, parent);
2086 ecore_evas_object_associate(win->ee, win->win_obj,
2087 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
2088 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
2089 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
2090 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
2091 _elm_win_obj_callback_show, win);
2092 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
2093 _elm_win_obj_callback_hide, win);
2094 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
2095 _elm_win_obj_callback_del, win);
2096 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
2097 _elm_win_obj_callback_move, win);
2098 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
2099 _elm_win_obj_callback_resize, win);
2101 evas_object_intercept_move_callback_add(win->win_obj,
2102 _elm_win_obj_intercept_move, win);
2103 evas_object_intercept_show_callback_add(win->win_obj,
2104 _elm_win_obj_intercept_show, win);
2106 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
2107 ecore_evas_name_class_set(win->ee, name, _elm_appname);
2108 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
2109 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
2110 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
2111 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
2112 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
2113 ecore_evas_callback_move_set(win->ee, _elm_win_move);
2114 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
2115 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
2116 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
2117 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2118 evas_font_path_append(win->evas, fontpath);
2119 if (!_elm_config->font_hinting)
2120 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2121 else if (_elm_config->font_hinting == 1)
2122 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2123 else if (_elm_config->font_hinting == 2)
2124 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2126 #ifdef HAVE_ELEMENTARY_X
2127 _elm_win_xwin_update(win);
2130 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2132 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2134 ecore_evas_fullscreen_set(win->ee, 1);
2136 #undef ENGINE_COMPARE
2138 if (_elm_config->focus_highlight_enable)
2139 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2142 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2143 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2144 _debug_key_down, win);
2146 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2148 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2151 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2153 return win->win_obj;
2157 elm_win_util_standard_add(const char *name, const char *title)
2159 Evas_Object *win, *bg;
2161 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2162 if (!win) return NULL;
2163 elm_win_title_set(win, title);
2164 bg = elm_bg_add(win);
2167 evas_object_del(win);
2170 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2171 elm_win_resize_object_add(win, bg);
2172 evas_object_show(bg);
2177 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2181 ELM_CHECK_WIDTYPE(obj, widtype);
2182 win = elm_widget_data_get(obj);
2184 if (eina_list_data_find(win->subobjs, subobj)) return;
2185 win->subobjs = eina_list_append(win->subobjs, subobj);
2186 elm_widget_sub_object_add(obj, subobj);
2187 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2188 _elm_win_subobj_callback_del, obj);
2189 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2190 _elm_win_subobj_callback_changed_size_hints,
2192 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2193 evas_object_move(subobj, 0, 0);
2194 evas_object_resize(subobj, w, h);
2195 _elm_win_eval_subobjs(obj);
2199 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2202 ELM_CHECK_WIDTYPE(obj, widtype);
2203 win = elm_widget_data_get(obj);
2205 evas_object_event_callback_del_full(subobj,
2206 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2207 _elm_win_subobj_callback_changed_size_hints,
2209 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2210 _elm_win_subobj_callback_del, obj);
2211 win->subobjs = eina_list_remove(win->subobjs, subobj);
2212 elm_widget_sub_object_del(obj, subobj);
2213 _elm_win_eval_subobjs(obj);
2217 elm_win_title_set(Evas_Object *obj, const char *title)
2220 ELM_CHECK_WIDTYPE(obj, widtype);
2221 win = elm_widget_data_get(obj);
2222 if (!win || !title) return;
2223 eina_stringshare_replace(&(win->title), title);
2224 ecore_evas_title_set(win->ee, win->title);
2226 edje_object_part_text_escaped_set(win->frame_obj, "elm.text.title", win->title);
2230 elm_win_title_get(const Evas_Object *obj)
2233 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2234 win = elm_widget_data_get(obj);
2235 if (!win) return NULL;
2240 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2243 ELM_CHECK_WIDTYPE(obj, widtype);
2244 win = elm_widget_data_get(obj);
2245 if (!win || !icon_name) return;
2246 eina_stringshare_replace(&(win->icon_name), icon_name);
2247 #ifdef HAVE_ELEMENTARY_X
2248 _elm_win_xwin_update(win);
2253 elm_win_icon_name_get(const Evas_Object *obj)
2256 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2257 win = elm_widget_data_get(obj);
2258 if (!win) return NULL;
2259 return win->icon_name;
2263 elm_win_role_set(Evas_Object *obj, const char *role)
2266 ELM_CHECK_WIDTYPE(obj, widtype);
2267 win = elm_widget_data_get(obj);
2268 if (!win || !role) return;
2269 eina_stringshare_replace(&(win->role), role);
2270 #ifdef HAVE_ELEMENTARY_X
2271 _elm_win_xwin_update(win);
2276 elm_win_role_get(const Evas_Object *obj)
2279 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2280 win = elm_widget_data_get(obj);
2281 if (!win) return NULL;
2286 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2289 ELM_CHECK_WIDTYPE(obj, widtype);
2290 win = elm_widget_data_get(obj);
2293 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2294 _elm_win_obj_icon_callback_del, win);
2297 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2298 _elm_win_obj_icon_callback_del, win);
2299 #ifdef HAVE_ELEMENTARY_X
2300 _elm_win_xwin_update(win);
2304 EAPI const Evas_Object *
2305 elm_win_icon_object_get(const Evas_Object *obj)
2308 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2309 win = elm_widget_data_get(obj);
2310 if (!win) return NULL;
2315 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2318 ELM_CHECK_WIDTYPE(obj, widtype);
2319 win = elm_widget_data_get(obj);
2321 win->autodel = autodel;
2325 elm_win_autodel_get(const Evas_Object *obj)
2328 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2329 win = elm_widget_data_get(obj);
2330 if (!win) return EINA_FALSE;
2331 return win->autodel;
2335 elm_win_activate(Evas_Object *obj)
2338 ELM_CHECK_WIDTYPE(obj, widtype);
2339 win = elm_widget_data_get(obj);
2341 ecore_evas_activate(win->ee);
2345 elm_win_lower(Evas_Object *obj)
2348 ELM_CHECK_WIDTYPE(obj, widtype);
2349 win = elm_widget_data_get(obj);
2351 ecore_evas_lower(win->ee);
2355 elm_win_raise(Evas_Object *obj)
2358 ELM_CHECK_WIDTYPE(obj, widtype);
2359 win = elm_widget_data_get(obj);
2361 ecore_evas_raise(win->ee);
2365 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2368 int win_w, win_h, screen_w, screen_h, nx, ny;
2369 ELM_CHECK_WIDTYPE(obj, widtype);
2370 win = elm_widget_data_get(obj);
2372 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2373 if ((!screen_w) || (!screen_h)) return;
2374 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2375 if ((!win_w) || (!win_h)) return;
2376 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2377 else nx = win->screen.x;
2378 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2379 else ny = win->screen.y;
2382 evas_object_move(obj, nx, ny);
2386 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2389 ELM_CHECK_WIDTYPE(obj, widtype);
2390 win = elm_widget_data_get(obj);
2392 ecore_evas_borderless_set(win->ee, borderless);
2393 #ifdef HAVE_ELEMENTARY_X
2394 _elm_win_xwin_update(win);
2399 elm_win_borderless_get(const Evas_Object *obj)
2402 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2403 win = elm_widget_data_get(obj);
2404 if (!win) return EINA_FALSE;
2405 return ecore_evas_borderless_get(win->ee);
2409 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2412 ELM_CHECK_WIDTYPE(obj, widtype);
2413 win = elm_widget_data_get(obj);
2415 ecore_evas_shaped_set(win->ee, shaped);
2416 #ifdef HAVE_ELEMENTARY_X
2417 _elm_win_xwin_update(win);
2422 elm_win_shaped_get(const Evas_Object *obj)
2425 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2426 win = elm_widget_data_get(obj);
2427 if (!win) return EINA_FALSE;
2428 return ecore_evas_shaped_get(win->ee);
2432 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2435 ELM_CHECK_WIDTYPE(obj, widtype);
2436 win = elm_widget_data_get(obj);
2441 else if (win->img_obj)
2443 evas_object_image_alpha_set(win->img_obj, alpha);
2444 ecore_evas_alpha_set(win->ee, alpha);
2448 #ifdef HAVE_ELEMENTARY_X
2453 if (!_elm_config->compositing)
2454 elm_win_shaped_set(obj, alpha);
2456 ecore_evas_alpha_set(win->ee, alpha);
2459 ecore_evas_alpha_set(win->ee, alpha);
2460 _elm_win_xwin_update(win);
2464 ecore_evas_alpha_set(win->ee, alpha);
2469 elm_win_alpha_get(const Evas_Object *obj)
2472 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2473 win = elm_widget_data_get(obj);
2474 if (!win) return EINA_FALSE;
2478 else if (win->img_obj)
2480 return evas_object_image_alpha_get(win->img_obj);
2482 return ecore_evas_alpha_get(win->ee);
2486 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2489 ELM_CHECK_WIDTYPE(obj, widtype);
2490 win = elm_widget_data_get(obj);
2492 ecore_evas_override_set(win->ee, override);
2493 #ifdef HAVE_ELEMENTARY_X
2494 _elm_win_xwin_update(win);
2499 elm_win_override_get(const Evas_Object *obj)
2502 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2503 win = elm_widget_data_get(obj);
2504 if (!win) return EINA_FALSE;
2505 return ecore_evas_override_get(win->ee);
2509 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2512 ELM_CHECK_WIDTYPE(obj, widtype);
2513 win = elm_widget_data_get(obj);
2515 // YYY: handle if win->img_obj
2516 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2517 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2518 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2520 // these engines... can ONLY be fullscreen
2525 win->fullscreen = fullscreen;
2526 ecore_evas_fullscreen_set(win->ee, fullscreen);
2527 #ifdef HAVE_ELEMENTARY_X
2528 _elm_win_xwin_update(win);
2531 #undef ENGINE_COMPARE
2535 elm_win_fullscreen_get(const Evas_Object *obj)
2538 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2539 win = elm_widget_data_get(obj);
2540 if (!win) return EINA_FALSE;
2541 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2542 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2543 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2545 // these engines... can ONLY be fullscreen
2550 return win->fullscreen;
2552 #undef ENGINE_COMPARE
2556 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2559 ELM_CHECK_WIDTYPE(obj, widtype);
2560 win = elm_widget_data_get(obj);
2562 win->maximized = maximized;
2563 // YYY: handle if win->img_obj
2564 ecore_evas_maximized_set(win->ee, maximized);
2565 #ifdef HAVE_ELEMENTARY_X
2566 _elm_win_xwin_update(win);
2571 elm_win_maximized_get(const Evas_Object *obj)
2574 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2575 win = elm_widget_data_get(obj);
2576 if (!win) return EINA_FALSE;
2577 return win->maximized;
2581 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2584 ELM_CHECK_WIDTYPE(obj, widtype);
2585 win = elm_widget_data_get(obj);
2587 win->iconified = iconified;
2588 ecore_evas_iconified_set(win->ee, iconified);
2589 #ifdef HAVE_ELEMENTARY_X
2590 _elm_win_xwin_update(win);
2595 elm_win_iconified_get(const Evas_Object *obj)
2598 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2599 win = elm_widget_data_get(obj);
2600 if (!win) return EINA_FALSE;
2601 return win->iconified;
2605 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2608 ELM_CHECK_WIDTYPE(obj, widtype);
2609 win = elm_widget_data_get(obj);
2611 win->withdrawn = withdrawn;
2612 ecore_evas_withdrawn_set(win->ee, withdrawn);
2613 #ifdef HAVE_ELEMENTARY_X
2614 _elm_win_xwin_update(win);
2619 elm_win_withdrawn_get(const Evas_Object *obj)
2622 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2623 win = elm_widget_data_get(obj);
2624 if (!win) return EINA_FALSE;
2625 return win->withdrawn;
2629 elm_win_profiles_set(Evas_Object *obj, const char **profiles, unsigned int num_profiles)
2632 char **profiles_int;
2634 unsigned int i, num;
2637 ELM_CHECK_WIDTYPE(obj, widtype);
2638 win = elm_widget_data_get(obj);
2640 if (!profiles) return;
2642 if (win->profile.timer) ecore_timer_del(win->profile.timer);
2643 win->profile.timer = ecore_timer_add(0.1, _elm_win_profile_change_delay, win);
2644 EINA_LIST_FREE(win->profile.names, str) eina_stringshare_del(str);
2646 for (i = 0; i < num_profiles; i++)
2648 if ((profiles[i]) &&
2649 _elm_config_profile_exists(profiles[i]))
2651 str = eina_stringshare_add(profiles[i]);
2652 win->profile.names = eina_list_append(win->profile.names, str);
2656 num = eina_list_count(win->profile.names);
2657 profiles_int = alloca(num * sizeof(char *));
2662 EINA_LIST_FOREACH(win->profile.names, l, str)
2665 profiles_int[i] = strdup(str);
2667 profiles_int[i] = NULL;
2670 ecore_evas_profiles_set(win->ee, (const char **)profiles_int, i);
2671 for (i = 0; i < num; i++)
2673 if (profiles_int[i]) free(profiles_int[i]);
2677 ecore_evas_profiles_set(win->ee, profiles, num_profiles);
2681 elm_win_profile_get(const Evas_Object *obj)
2684 ELM_CHECK_WIDTYPE(obj, widtype);
2685 win = elm_widget_data_get(obj);
2686 if (!win) return NULL;
2688 return win->profile.name;
2692 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2695 ELM_CHECK_WIDTYPE(obj, widtype);
2696 win = elm_widget_data_get(obj);
2698 win->urgent = urgent;
2699 ecore_evas_urgent_set(win->ee, urgent);
2700 #ifdef HAVE_ELEMENTARY_X
2701 _elm_win_xwin_update(win);
2706 elm_win_urgent_get(const Evas_Object *obj)
2709 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2710 win = elm_widget_data_get(obj);
2711 if (!win) return EINA_FALSE;
2716 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2719 ELM_CHECK_WIDTYPE(obj, widtype);
2720 win = elm_widget_data_get(obj);
2722 win->demand_attention = demand_attention;
2723 ecore_evas_demand_attention_set(win->ee, demand_attention);
2724 #ifdef HAVE_ELEMENTARY_X
2725 _elm_win_xwin_update(win);
2730 elm_win_demand_attention_get(const Evas_Object *obj)
2733 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2734 win = elm_widget_data_get(obj);
2735 if (!win) return EINA_FALSE;
2736 return win->demand_attention;
2740 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2743 ELM_CHECK_WIDTYPE(obj, widtype);
2744 win = elm_widget_data_get(obj);
2747 ecore_evas_modal_set(win->ee, modal);
2748 #ifdef HAVE_ELEMENTARY_X
2749 _elm_win_xwin_update(win);
2754 elm_win_modal_get(const Evas_Object *obj)
2757 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2758 win = elm_widget_data_get(obj);
2759 if (!win) return EINA_FALSE;
2764 elm_win_aspect_set(Evas_Object *obj, double aspect)
2767 ELM_CHECK_WIDTYPE(obj, widtype);
2768 win = elm_widget_data_get(obj);
2770 win->aspect = aspect;
2771 ecore_evas_aspect_set(win->ee, aspect);
2772 #ifdef HAVE_ELEMENTARY_X
2773 _elm_win_xwin_update(win);
2778 elm_win_aspect_get(const Evas_Object *obj)
2781 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2782 win = elm_widget_data_get(obj);
2783 if (!win) return EINA_FALSE;
2788 elm_win_layer_set(Evas_Object *obj, int layer)
2791 ELM_CHECK_WIDTYPE(obj, widtype);
2792 win = elm_widget_data_get(obj);
2794 ecore_evas_layer_set(win->ee, layer);
2795 #ifdef HAVE_ELEMENTARY_X
2796 _elm_win_xwin_update(win);
2801 elm_win_layer_get(const Evas_Object *obj)
2804 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2805 win = elm_widget_data_get(obj);
2806 if (!win) return -1;
2807 return ecore_evas_layer_get(win->ee);
2811 elm_win_rotation_set(Evas_Object *obj, int rotation)
2814 ELM_CHECK_WIDTYPE(obj, widtype);
2815 win = elm_widget_data_get(obj);
2817 if (win->rot == rotation) return;
2818 win->rot = rotation;
2819 ecore_evas_rotation_set(win->ee, rotation);
2820 evas_object_size_hint_min_set(obj, -1, -1);
2821 evas_object_size_hint_max_set(obj, -1, -1);
2822 _elm_win_eval_subobjs(obj);
2823 #ifdef HAVE_ELEMENTARY_X
2824 _elm_win_xwin_update(win);
2829 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2832 ELM_CHECK_WIDTYPE(obj, widtype);
2833 win = elm_widget_data_get(obj);
2835 if (win->rot == rotation) return;
2836 win->rot = rotation;
2837 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2838 evas_object_size_hint_min_set(obj, -1, -1);
2839 evas_object_size_hint_max_set(obj, -1, -1);
2840 _elm_win_eval_subobjs(obj);
2841 #ifdef HAVE_ELEMENTARY_X
2842 _elm_win_xwin_update(win);
2847 elm_win_rotation_get(const Evas_Object *obj)
2850 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2851 win = elm_widget_data_get(obj);
2852 if (!win) return -1;
2857 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2860 ELM_CHECK_WIDTYPE(obj, widtype);
2861 win = elm_widget_data_get(obj);
2863 win->sticky = sticky;
2864 ecore_evas_sticky_set(win->ee, sticky);
2865 #ifdef HAVE_ELEMENTARY_X
2866 _elm_win_xwin_update(win);
2871 elm_win_sticky_get(const Evas_Object *obj)
2874 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2875 win = elm_widget_data_get(obj);
2876 if (!win) return EINA_FALSE;
2881 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2884 ELM_CHECK_WIDTYPE(obj, widtype);
2885 win = elm_widget_data_get(obj);
2887 if (mode == win->kbdmode) return;
2888 #ifdef HAVE_ELEMENTARY_X
2889 _elm_win_xwindow_get(win);
2891 win->kbdmode = mode;
2892 #ifdef HAVE_ELEMENTARY_X
2894 ecore_x_e_virtual_keyboard_state_set
2895 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2899 EAPI Elm_Win_Keyboard_Mode
2900 elm_win_keyboard_mode_get(const Evas_Object *obj)
2903 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2904 win = elm_widget_data_get(obj);
2905 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2906 return win->kbdmode;
2910 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2913 ELM_CHECK_WIDTYPE(obj, widtype);
2914 win = elm_widget_data_get(obj);
2916 #ifdef HAVE_ELEMENTARY_X
2917 _elm_win_xwindow_get(win);
2919 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2926 elm_win_keyboard_win_get(const Evas_Object *obj)
2929 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2930 win = elm_widget_data_get(obj);
2931 if (!win) return EINA_FALSE;
2932 #ifdef HAVE_ELEMENTARY_X
2933 _elm_win_xwindow_get(win);
2935 return ecore_x_e_virtual_keyboard_get(win->xwin);
2940 // WRAPPER: Temperary added.
2942 elm_win_indicator_state_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2944 elm_win_indicator_mode_set(obj, mode);
2948 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2951 ELM_CHECK_WIDTYPE(obj, widtype);
2952 win = elm_widget_data_get(obj);
2954 if (mode == win->indmode) return;
2955 #ifdef HAVE_ELEMENTARY_X
2956 _elm_win_xwindow_get(win);
2958 win->indmode = mode;
2959 #ifdef HAVE_ELEMENTARY_X
2962 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
2963 ecore_x_e_illume_indicator_state_set
2964 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
2965 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
2966 ecore_x_e_illume_indicator_state_set
2967 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
2972 // WRAPPER: Temperary added.
2973 EAPI Elm_Win_Indicator_Mode
2974 elm_win_indicator_state_get(const Evas_Object *obj)
2976 return elm_win_indicator_mode_get(obj);
2979 EAPI Elm_Win_Indicator_Mode
2980 elm_win_indicator_mode_get(const Evas_Object *obj)
2983 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
2984 win = elm_widget_data_get(obj);
2985 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
2986 return win->indmode;
2990 elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode)
2993 ELM_CHECK_WIDTYPE(obj, widtype);
2994 win = elm_widget_data_get(obj);
2996 if (mode == win->ind_o_mode) return;
2997 win->ind_o_mode = mode;
2998 #ifdef HAVE_ELEMENTARY_X
2999 _elm_win_xwindow_get(win);
3002 if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
3003 ecore_x_e_illume_indicator_opacity_set
3004 (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
3005 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
3006 ecore_x_e_illume_indicator_opacity_set
3007 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
3008 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
3009 ecore_x_e_illume_indicator_opacity_set
3010 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
3016 EAPI Elm_Win_Indicator_Opacity_Mode
3017 elm_win_indicator_opacity_get(const Evas_Object *obj)
3020 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
3021 win = elm_widget_data_get(obj);
3022 if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
3023 return win->ind_o_mode;
3027 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
3030 ELM_CHECK_WIDTYPE(obj, widtype);
3031 win = elm_widget_data_get(obj);
3033 if (x) *x = win->screen.x;
3034 if (y) *y = win->screen.y;
3038 elm_win_focus_get(const Evas_Object *obj)
3041 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3042 win = elm_widget_data_get(obj);
3043 if (!win) return EINA_FALSE;
3044 return ecore_evas_focus_get(win->ee);
3048 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
3051 ELM_CHECK_WIDTYPE(obj, widtype);
3052 win = elm_widget_data_get(obj);
3054 win->constrain = !!constrain;
3058 elm_win_screen_constrain_get(Evas_Object *obj)
3061 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3062 win = elm_widget_data_get(obj);
3063 if (!win) return EINA_FALSE;
3064 return win->constrain;
3068 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
3071 ELM_CHECK_WIDTYPE(obj, widtype);
3072 win = elm_widget_data_get(obj);
3074 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
3078 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
3081 ELM_CHECK_WIDTYPE(obj, widtype);
3082 win = elm_widget_data_get(obj);
3084 #ifdef HAVE_ELEMENTARY_X
3085 _elm_win_xwindow_get(win);
3087 ecore_x_e_illume_conformant_set(win->xwin, conformant);
3094 elm_win_conformant_get(const Evas_Object *obj)
3097 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3098 win = elm_widget_data_get(obj);
3099 if (!win) return EINA_FALSE;
3100 #ifdef HAVE_ELEMENTARY_X
3101 _elm_win_xwindow_get(win);
3103 return ecore_x_e_illume_conformant_get(win->xwin);
3109 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
3112 ELM_CHECK_WIDTYPE(obj, widtype);
3113 win = elm_widget_data_get(obj);
3115 #ifdef HAVE_ELEMENTARY_X
3116 _elm_win_xwindow_get(win);
3119 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
3122 Ecore_X_Window_State states[2];
3124 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
3125 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
3126 ecore_x_netwm_window_state_set(win->xwin, states, 2);
3127 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
3136 elm_win_quickpanel_get(const Evas_Object *obj)
3139 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3140 win = elm_widget_data_get(obj);
3141 if (!win) return EINA_FALSE;
3142 #ifdef HAVE_ELEMENTARY_X
3143 _elm_win_xwindow_get(win);
3145 return ecore_x_e_illume_quickpanel_get(win->xwin);
3151 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
3154 ELM_CHECK_WIDTYPE(obj, widtype);
3155 win = elm_widget_data_get(obj);
3157 #ifdef HAVE_ELEMENTARY_X
3158 _elm_win_xwindow_get(win);
3160 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
3167 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
3170 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3171 win = elm_widget_data_get(obj);
3172 if (!win) return -1;
3173 #ifdef HAVE_ELEMENTARY_X
3174 _elm_win_xwindow_get(win);
3176 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
3182 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
3185 ELM_CHECK_WIDTYPE(obj, widtype);
3186 win = elm_widget_data_get(obj);
3188 #ifdef HAVE_ELEMENTARY_X
3189 _elm_win_xwindow_get(win);
3191 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3198 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3201 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3202 win = elm_widget_data_get(obj);
3203 if (!win) return -1;
3204 #ifdef HAVE_ELEMENTARY_X
3205 _elm_win_xwindow_get(win);
3207 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3213 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3216 ELM_CHECK_WIDTYPE(obj, widtype);
3217 win = elm_widget_data_get(obj);
3219 #ifdef HAVE_ELEMENTARY_X
3220 _elm_win_xwindow_get(win);
3222 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3229 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3232 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3233 win = elm_widget_data_get(obj);
3235 #ifdef HAVE_ELEMENTARY_X
3236 _elm_win_xwindow_get(win);
3238 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3244 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3247 ELM_CHECK_WIDTYPE(obj, widtype);
3248 win = elm_widget_data_get(obj);
3250 win->skip_focus = skip;
3251 ecore_evas_focus_skip_set(win->ee, skip);
3255 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3258 ELM_CHECK_WIDTYPE(obj, widtype);
3259 win = elm_widget_data_get(obj);
3261 #ifdef HAVE_ELEMENTARY_X
3262 _elm_win_xwindow_get(win);
3267 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3268 ecore_x_e_illume_focus_back_send(win->xwin);
3270 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3271 ecore_x_e_illume_focus_forward_send(win->xwin);
3273 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3274 ecore_x_e_illume_focus_home_send(win->xwin);
3276 case ELM_ILLUME_COMMAND_CLOSE:
3277 ecore_x_e_illume_close_send(win->xwin);
3289 elm_win_inlined_image_object_get(Evas_Object *obj)
3292 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3293 win = elm_widget_data_get(obj);
3294 if (!win) return NULL;
3295 return win->img_obj;
3299 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3303 ELM_CHECK_WIDTYPE(obj, widtype);
3305 win = elm_widget_data_get(obj);
3306 enabled = !!enabled;
3307 if (win->focus_highlight.enabled == enabled)
3310 win->focus_highlight.enabled = enabled;
3312 if (win->focus_highlight.enabled)
3313 _elm_win_focus_highlight_init(win);
3315 _elm_win_focus_highlight_shutdown(win);
3319 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3323 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3325 win = elm_widget_data_get(obj);
3326 return win->focus_highlight.enabled;
3330 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3334 ELM_CHECK_WIDTYPE(obj, widtype);
3336 win = elm_widget_data_get(obj);
3337 eina_stringshare_replace(&win->focus_highlight.style, style);
3338 win->focus_highlight.changed_theme = EINA_TRUE;
3339 _elm_win_focus_highlight_reconfigure_job_start(win);
3343 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3347 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3349 win = elm_widget_data_get(obj);
3350 return win->focus_highlight.style;
3353 typedef struct _Widget_Data Widget_Data;
3358 Evas_Object *content;
3361 static void _del_hook(Evas_Object *obj);
3362 static void _theme_hook(Evas_Object *obj);
3363 static void _sizing_eval(Evas_Object *obj);
3364 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3365 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3367 static const char *widtype2 = NULL;
3370 _del_hook(Evas_Object *obj)
3372 Widget_Data *wd = elm_widget_data_get(obj);
3378 _theme_hook(Evas_Object *obj)
3380 Widget_Data *wd = elm_widget_data_get(obj);
3381 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3383 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3386 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3390 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3392 Widget_Data *wd = elm_widget_data_get(obj);
3397 /* Try Focus cycle in subitem */
3400 elm_widget_focus_next_get(wd->content, dir, next);
3405 *next = (Evas_Object *)obj;
3410 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3412 Widget_Data *wd = elm_widget_data_get(obj);
3414 if (!wd || !item) return;
3415 edje_object_part_text_escaped_set(wd->frm, item, text);
3420 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3422 Widget_Data *wd = elm_widget_data_get(obj);
3424 if (!item || !wd || !wd->frm) return NULL;
3425 return edje_object_part_text_get(wd->frm, item);
3429 _sizing_eval(Evas_Object *obj)
3431 Widget_Data *wd = elm_widget_data_get(obj);
3432 Evas_Coord minw = -1, minh = -1;
3434 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3435 edje_object_size_min_calc(wd->frm, &minw, &minh);
3436 evas_object_size_hint_min_set(obj, minw, minh);
3437 evas_object_size_hint_max_set(obj, -1, -1);
3441 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3447 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3449 Widget_Data *wd = elm_widget_data_get(obj);
3450 Evas_Object *sub = event_info;
3451 if (sub == wd->content)
3453 evas_object_event_callback_del_full
3454 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3461 elm_win_inwin_add(Evas_Object *obj)
3467 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3468 win = elm_widget_data_get(obj);
3469 if (!win) return NULL;
3470 wd = ELM_NEW(Widget_Data);
3471 obj2 = elm_widget_add(win->evas);
3472 elm_widget_type_set(obj2, "inwin");
3473 ELM_SET_WIDTYPE(widtype2, "inwin");
3474 elm_widget_sub_object_add(obj, obj2);
3475 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3476 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3477 elm_win_resize_object_add(obj, obj2);
3479 elm_widget_data_set(obj2, wd);
3480 elm_widget_del_hook_set(obj2, _del_hook);
3481 elm_widget_theme_hook_set(obj2, _theme_hook);
3482 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3483 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3484 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3485 elm_widget_can_focus_set(obj2, EINA_TRUE);
3486 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3488 wd->frm = edje_object_add(win->evas);
3489 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3490 elm_widget_resize_object_set(obj2, wd->frm);
3492 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3499 elm_win_inwin_activate(Evas_Object *obj)
3501 ELM_CHECK_WIDTYPE(obj, widtype2);
3502 Widget_Data *wd = elm_widget_data_get(obj);
3504 evas_object_raise(obj);
3505 evas_object_show(obj);
3506 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3507 elm_object_focus_set(obj, EINA_TRUE);
3511 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3513 ELM_CHECK_WIDTYPE(obj, widtype2);
3514 Widget_Data *wd = elm_widget_data_get(obj);
3516 if (wd->content == content) return;
3517 if (wd->content) evas_object_del(wd->content);
3518 wd->content = content;
3521 elm_widget_sub_object_add(obj, content);
3522 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3523 _changed_size_hints, obj);
3524 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3530 elm_win_inwin_content_get(const Evas_Object *obj)
3532 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3533 Widget_Data *wd = elm_widget_data_get(obj);
3534 if (!wd) return NULL;
3539 elm_win_inwin_content_unset(Evas_Object *obj)
3541 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3542 Widget_Data *wd = elm_widget_data_get(obj);
3543 if (!wd) return NULL;
3544 if (!wd->content) return NULL;
3545 Evas_Object *content = wd->content;
3546 elm_widget_sub_object_del(obj, wd->content);
3547 evas_object_event_callback_del_full(wd->content,
3548 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3549 _changed_size_hints, obj);
3550 edje_object_part_unswallow(wd->frm, wd->content);
3556 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3561 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3562 win = elm_widget_data_get(obj);
3563 if (!win) return EINA_FALSE;
3564 if (!win->ee) return EINA_FALSE;
3566 if (!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3572 /* windowing specific calls - shall we do this differently? */
3574 static Ecore_X_Window
3575 _elm_ee_win_get(const Evas_Object *obj)
3578 #ifdef HAVE_ELEMENTARY_X
3579 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3580 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3586 elm_win_xwindow_get(const Evas_Object *obj)
3592 type = elm_widget_type_get(obj);
3593 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3594 win = elm_widget_data_get(obj);
3596 #ifdef HAVE_ELEMENTARY_X
3597 if (win->xwin) return win->xwin;
3598 if (win->parent) return elm_win_xwindow_get(win->parent);
3604 elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool floating)
3607 ELM_CHECK_WIDTYPE(obj, widtype);
3608 win = elm_widget_data_get(obj);
3610 if (floating == win->floating) return;
3611 #ifdef HAVE_ELEMENTARY_X
3612 _elm_win_xwindow_get(win);
3614 win->floating = floating;
3615 #ifdef HAVE_ELEMENTARY_X
3619 ecore_x_e_illume_window_state_set
3620 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_FLOATING);
3622 ecore_x_e_illume_window_state_set
3623 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_NORMAL);
3629 elm_win_floating_mode_get(const Evas_Object *obj)
3632 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3633 win = elm_widget_data_get(obj);
3634 if (!win) return EINA_FALSE;
3636 return win->floating;