1 #include <Elementary.h>
4 typedef struct _Elm_Win Elm_Win;
7 typedef struct _Object_Dump_Mod Object_Dump_Mod;
9 struct _Object_Dump_Mod
11 Eina_List *(*tree_create) (Evas_Object *root);
12 void (*tree_free) (Eina_List *tree);
13 char *(*tree_string_get) (Eina_List *tree);
14 char *(*tree_string_get_for_sdb) (Eina_List *tree);
15 char *(*command_for_sdb) (Eina_List *tree, char *data);
23 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
25 #ifdef HAVE_ELEMENTARY_X
27 Ecore_Event_Handler *client_message_handler;
28 Ecore_Event_Handler *property_handler;
31 Object_Dump_Mod *od_mod;
32 Ecore_Ipc_Server *sdb_server;
33 Ecore_Event_Handler *sdb_server_data_handler, *sdb_server_del_handler;
35 Ecore_Job *deferred_resize_job;
36 Ecore_Job *deferred_child_eval_job;
39 Elm_Win_Keyboard_Mode kbdmode;
40 Elm_Win_Indicator_Mode indmode;
41 Elm_Win_Indicator_Opacity_Mode ind_o_mode;
50 int *autodel_clear, rot;
60 Evas_Object *obj, *hot_obj;
70 Eina_Bool visible : 1;
71 Eina_Bool handled : 1;
75 Ecore_Job *reconf_job;
77 Eina_Bool enabled : 1;
78 Eina_Bool changed_theme : 1;
79 Eina_Bool top_animate : 1;
80 Eina_Bool geometry_changed : 1;
91 const char *icon_name;
97 Eina_Bool demand_attention : 1;
98 Eina_Bool autodel : 1;
99 Eina_Bool constrain : 1;
100 Eina_Bool resizing : 1;
101 Eina_Bool iconified : 1;
102 Eina_Bool withdrawn : 1;
103 Eina_Bool sticky : 1;
104 Eina_Bool fullscreen : 1;
105 Eina_Bool maximized : 1;
106 Eina_Bool skip_focus : 1;
107 Eina_Bool floating : 1;
110 static const char *widtype = NULL;
111 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
112 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
113 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
114 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
115 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
116 static void _elm_win_move(Ecore_Evas *ee);
117 static void _elm_win_resize(Ecore_Evas *ee);
118 static void _elm_win_delete_request(Ecore_Evas *ee);
119 static void _elm_win_resize_job(void *data);
120 #ifdef HAVE_ELEMENTARY_X
121 static void _elm_win_xwin_update(Elm_Win *win);
123 static void _elm_win_eval_subobjs(Evas_Object *obj);
124 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
125 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
126 static void _elm_win_focus_highlight_init(Elm_Win *win);
127 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
128 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
129 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
130 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
131 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
132 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
134 static void _elm_win_frame_add(Elm_Win *win, const char *style);
135 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
136 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
137 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
138 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
139 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
141 //static void _elm_win_pointer_add(Elm_Win *win, const char *style);
143 static const char SIG_DELETE_REQUEST[] = "delete,request";
144 static const char SIG_FOCUS_OUT[] = "focus,out";
145 static const char SIG_FOCUS_IN[] = "focus,in";
146 static const char SIG_MOVED[] = "moved";
147 static const char SIG_THEME_CHANGED[] = "theme,changed";
148 static const char SIG_WITHDRAWN[] = "withdrawn";
149 static const char SIG_ICONIFIED[] = "iconified";
150 static const char SIG_NORMAL[] = "normal";
151 static const char SIG_STICK[] = "stick";
152 static const char SIG_UNSTICK[] = "unstick";
153 static const char SIG_FULLSCREEN[] = "fullscreen";
154 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
155 static const char SIG_MAXIMIZED[] = "maximized";
156 static const char SIG_UNMAXIMIZED[] = "unmaximized";
157 static const char SIG_PROFILE_CHANGED[] = "profile,changed";
159 static const Evas_Smart_Cb_Description _signals[] = {
160 {SIG_DELETE_REQUEST, ""},
169 {SIG_FULLSCREEN, ""},
170 {SIG_UNFULLSCREEN, ""},
172 {SIG_UNMAXIMIZED, ""},
173 {SIG_PROFILE_CHANGED, ""},
179 Eina_List *_elm_win_list = NULL;
180 int _elm_win_deferred_free = 0;
182 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
183 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
186 _shot_delay_get(Elm_Win *win)
189 char *d = strdup(win->shot.info);
192 for (p = (char *)win->shot.info; *p; p++)
194 if (!strncmp(p, "delay=", 6))
198 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
213 _shot_file_get(Elm_Win *win)
216 char *tmp = strdup(win->shot.info);
217 char *repname = NULL;
219 if (!tmp) return NULL;
221 for (p = (char *)win->shot.info; *p; p++)
223 if (!strncmp(p, "file=", 5))
226 if (!win->shot.repeat_count) return tmp;
229 char *dotptr = strrchr(tmp, '.');
232 size_t size = sizeof(char)*(strlen(tmp) + 16);
233 repname = malloc(size);
234 strncpy(repname, tmp, dotptr - tmp);
235 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
236 win->shot.shot_counter + 1);
237 strcat(repname, dotptr);
245 if (!win->shot.repeat_count) return strdup("out.png");
247 repname = malloc(sizeof(char) * 24);
248 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
253 _shot_repeat_count_get(Elm_Win *win)
256 char *d = strdup(win->shot.info);
259 for (p = (char *)win->shot.info; *p; p++)
261 if (!strncmp(p, "repeat=", 7))
265 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
272 if (v > 1000) v = 999;
282 _shot_key_get(Elm_Win *win __UNUSED__)
288 _shot_flags_get(Elm_Win *win __UNUSED__)
294 _shot_do(Elm_Win *win)
298 unsigned int *pixels;
300 char *file, *key, *flags;
302 ecore_evas_manual_render(win->ee);
303 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
305 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
306 if ((w < 1) || (h < 1)) return;
307 file = _shot_file_get(win);
309 key = _shot_key_get(win);
310 flags = _shot_flags_get(win);
311 ee = ecore_evas_buffer_new(1, 1);
312 o = evas_object_image_add(ecore_evas_get(ee));
313 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
314 evas_object_image_size_set(o, w, h);
315 evas_object_image_data_set(o, pixels);
316 if (!evas_object_image_save(o, file, key, flags))
318 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
323 if (flags) free(flags);
325 if (win->shot.repeat_count) win->shot.shot_counter++;
329 _shot_delay(void *data)
333 if (win->shot.repeat_count)
335 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
336 if (remainshot > 0) return EINA_TRUE;
338 win->shot.timer = NULL;
344 _shot_init(Elm_Win *win)
346 if (!win->shot.info) return;
347 win->shot.repeat_count = _shot_repeat_count_get(win);
348 win->shot.shot_counter = 0;
352 _shot_handle(Elm_Win *win)
354 if (!win->shot.info) return;
355 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
359 _elm_win_move(Ecore_Evas *ee)
361 Evas_Object *obj = ecore_evas_object_associate_get(ee);
366 win = elm_widget_data_get(obj);
368 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
371 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
375 _elm_win_resize(Ecore_Evas *ee)
377 Evas_Object *obj = ecore_evas_object_associate_get(ee);
381 win = elm_widget_data_get(obj);
383 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
384 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
388 _elm_win_mouse_in(Ecore_Evas *ee)
393 if (!(obj = ecore_evas_object_associate_get(ee))) return;
394 if (!(win = elm_widget_data_get(obj))) return;
395 if (win->resizing) win->resizing = EINA_FALSE;
399 _elm_win_focus_in(Ecore_Evas *ee)
401 Evas_Object *obj = ecore_evas_object_associate_get(ee);
405 win = elm_widget_data_get(obj);
407 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
408 if (!elm_widget_focus_order_get(obj))
410 elm_widget_focus_steal(win->win_obj);
414 elm_widget_focus_restore(win->win_obj);
415 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
416 win->focus_highlight.cur.visible = EINA_TRUE;
417 _elm_win_focus_highlight_reconfigure_job_start(win);
420 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
422 else if (win->img_obj)
429 _elm_win_focus_out(Ecore_Evas *ee)
431 Evas_Object *obj = ecore_evas_object_associate_get(ee);
435 win = elm_widget_data_get(obj);
437 elm_object_focus_set(win->win_obj, EINA_FALSE);
438 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
439 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
440 win->focus_highlight.cur.visible = EINA_FALSE;
441 _elm_win_focus_highlight_reconfigure_job_start(win);
444 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
446 else if (win->img_obj)
453 if (win->od_mod) free(win->od_mod);
454 ecore_event_handler_del(win->sdb_server_data_handler);
455 ecore_event_handler_del(win->sdb_server_del_handler);
456 ecore_ipc_shutdown();
459 win->sdb_server = NULL;
460 win->sdb_server_data_handler = NULL;
461 win->sdb_server_del_handler = NULL;
467 _elm_win_profile_update(Ecore_Evas *ee)
469 Evas_Object *obj = ecore_evas_object_associate_get(ee);
473 win = elm_widget_data_get(obj);
476 if (win->profile.timer)
477 ecore_timer_del(win->profile.timer);
478 win->profile.timer = NULL;
480 /* TODO: We need the ability to bind a profile to a specific window.
481 * Elementary's configuration still has a single global profile for the app.
483 _elm_config_profile_set(win->profile.name);
485 evas_object_smart_callback_call(win->win_obj, SIG_PROFILE_CHANGED, NULL);
489 _elm_win_profile_change_delay(void *data)
493 Eina_Bool changed = EINA_FALSE;
495 profile = eina_list_nth(win->profile.names, 0);
498 if (win->profile.name)
500 if (strcmp(win->profile.name, profile))
502 eina_stringshare_replace(&(win->profile.name), profile);
508 win->profile.name = eina_stringshare_add(profile);
512 win->profile.timer = NULL;
513 if (changed) _elm_win_profile_update(win->ee);
518 _elm_win_state_change(Ecore_Evas *ee)
522 Eina_Bool ch_withdrawn = EINA_FALSE;
523 Eina_Bool ch_sticky = EINA_FALSE;
524 Eina_Bool ch_iconified = EINA_FALSE;
525 Eina_Bool ch_fullscreen = EINA_FALSE;
526 Eina_Bool ch_maximized = EINA_FALSE;
527 Eina_Bool ch_profile = EINA_FALSE;
530 if (!(obj = ecore_evas_object_associate_get(ee))) return;
532 if (!(win = elm_widget_data_get(obj))) return;
534 if (win->withdrawn != ecore_evas_withdrawn_get(win->ee))
536 win->withdrawn = ecore_evas_withdrawn_get(win->ee);
537 ch_withdrawn = EINA_TRUE;
539 if (win->sticky != ecore_evas_sticky_get(win->ee))
541 win->sticky = ecore_evas_sticky_get(win->ee);
542 ch_sticky = EINA_TRUE;
544 if (win->iconified != ecore_evas_iconified_get(win->ee))
546 win->iconified = ecore_evas_iconified_get(win->ee);
547 ch_iconified = EINA_TRUE;
549 if (win->fullscreen != ecore_evas_fullscreen_get(win->ee))
551 win->fullscreen = ecore_evas_fullscreen_get(win->ee);
552 ch_fullscreen = EINA_TRUE;
554 if (win->maximized != ecore_evas_maximized_get(win->ee))
556 win->maximized = ecore_evas_maximized_get(win->ee);
557 ch_maximized = EINA_TRUE;
559 profile = ecore_evas_profile_get(win->ee);
561 _elm_config_profile_exists(profile))
563 if (win->profile.name)
565 if (strcmp(win->profile.name, profile))
567 eina_stringshare_replace(&(win->profile.name), profile);
568 ch_profile = EINA_TRUE;
573 win->profile.name = eina_stringshare_add(profile);
574 ch_profile = EINA_TRUE;
577 if ((ch_withdrawn) || (ch_iconified))
580 evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL);
581 else if (win->iconified)
582 evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL);
584 evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL);
589 evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL);
591 evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL);
596 evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL);
598 evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL);
603 evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL);
605 evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL);
609 _elm_win_profile_update(win->ee);
614 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
616 Elm_Win *wd = elm_widget_data_get(obj);
617 const Eina_List *items;
618 const Eina_List *list;
619 void *(*list_data_get) (const Eina_List *list);
623 list = elm_widget_sub_object_list_get(obj);
628 if (!(items = elm_widget_focus_custom_chain_get(obj)))
631 list_data_get = eina_list_data_get;
633 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
638 *next = (Evas_Object *)obj;
643 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
645 Elm_Win *win = elm_widget_data_get(obj);
649 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
651 evas_object_focus_set(obj, elm_widget_focus_get(obj));
655 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
657 if (type == EVAS_CALLBACK_KEY_DOWN)
659 Evas_Event_Key_Down *ev = event_info;
660 if (!strcmp(ev->keyname, "Tab"))
662 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
663 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
665 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
666 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
669 else if ((!strcmp(ev->keyname, "Left")) ||
670 ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
672 //TODO : woohyun jung
674 else if ((!strcmp(ev->keyname, "Right")) ||
675 ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
677 //TODO : woohyun jung
679 else if ((!strcmp(ev->keyname, "Up")) ||
680 ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
682 //TODO : woohyun jung
684 else if ((!strcmp(ev->keyname, "Down")) ||
685 ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
687 //TODO : woohyun jung
695 _deferred_ecore_evas_free(void *data)
697 ecore_evas_free(data);
698 _elm_win_deferred_free--;
702 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
706 if (!win->show_count) win->show_count++;
707 if (win->shot.info) _shot_handle(win);
711 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
717 evas_object_hide(win->frame_obj);
719 else if (win->img_obj)
721 evas_object_hide(win->img_obj);
723 if (win->pointer.obj)
725 evas_object_hide(win->pointer.obj);
726 ecore_evas_hide(win->pointer.ee);
731 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
738 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
741 Evas_Object *child, *child2 = NULL;
746 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
747 _elm_win_obj_callback_parent_del, win);
750 if (win->autodel_clear) *(win->autodel_clear) = -1;
751 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
752 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
755 ecore_evas_callback_delete_request_set(win->ee, NULL);
756 ecore_evas_callback_resize_set(win->ee, NULL);
758 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
759 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
760 if (win->shot.info) eina_stringshare_del(win->shot.info);
761 if (win->shot.timer) ecore_timer_del(win->shot.timer);
762 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
763 _elm_win_obj_callback_del, win);
764 child = evas_object_bottom_get(win->evas);
767 /* if the object we see *IS* the window object (because we are
768 * faking a parent object inside the canvas), then skip it and
769 * go to the next one */
772 child = evas_object_above_get(child);
775 /* if we are using the next object above from the previous loop */
778 /* this object has refcounts from the previous loop */
779 child2 = evas_object_above_get(child);
780 if (child2) evas_object_ref(child2);
781 evas_object_del(child);
782 /* so unref from previous loop */
783 evas_object_unref(child);
788 /* just delete as normal (probably only first object */
789 child2 = evas_object_above_get(child);
790 if (child2) evas_object_ref(child2);
791 evas_object_del(child);
795 #ifdef HAVE_ELEMENTARY_X
796 if (win->client_message_handler)
797 ecore_event_handler_del(win->client_message_handler);
798 if (win->property_handler)
799 ecore_event_handler_del(win->property_handler);
804 if (win->od_mod) free(win->od_mod);
805 ecore_event_handler_del(win->sdb_server_data_handler);
806 ecore_event_handler_del(win->sdb_server_del_handler);
807 ecore_ipc_shutdown();
810 win->sdb_server = NULL;
811 win->sdb_server_data_handler = NULL;
812 win->sdb_server_del_handler = NULL;
815 // FIXME: Why are we flushing edje on every window destroy ??
816 // edje_file_cache_flush();
817 // edje_collection_cache_flush();
818 // evas_image_cache_flush(win->evas);
819 // evas_font_cache_flush(win->evas);
820 // FIXME: we are in the del handler for the object and delete the canvas
821 // that lives under it from the handler... nasty. deferring doesn't help either
825 evas_object_event_callback_del_full
826 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
833 ecore_job_add(_deferred_ecore_evas_free, win->ee);
834 _elm_win_deferred_free++;
838 _elm_win_focus_highlight_shutdown(win);
839 eina_stringshare_del(win->focus_highlight.style);
841 if (win->title) eina_stringshare_del(win->title);
842 if (win->icon_name) eina_stringshare_del(win->icon_name);
843 if (win->role) eina_stringshare_del(win->role);
844 if (win->icon) evas_object_del(win->icon);
846 EINA_LIST_FREE(win->profile.names, str) eina_stringshare_del(str);
847 if (win->profile.name) eina_stringshare_del(win->profile.name);
848 if (win->profile.timer) ecore_timer_del(win->profile.timer);
852 if ((!_elm_win_list) &&
853 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
855 edje_file_cache_flush();
856 edje_collection_cache_flush();
857 evas_image_cache_flush(e);
858 evas_font_cache_flush(e);
865 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
868 if (obj == win->parent) win->parent = NULL;
872 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
878 if ((x != win->screen.x) || (y != win->screen.y))
882 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
887 evas_object_move(obj, x, y);
892 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
895 // this is called to make sure all smart containers have calculated their
896 // sizes BEFORE we show the window to make sure it initially appears at
897 // our desired size (ie min size is known first)
898 evas_smart_objects_calculate(evas_object_evas_get(obj));
901 evas_object_show(win->frame_obj);
903 else if (win->img_obj)
905 evas_object_show(win->img_obj);
907 if (win->pointer.obj)
909 ecore_evas_show(win->pointer.ee);
910 evas_object_show(win->pointer.obj);
911 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
913 evas_object_show(obj);
917 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
921 if (ecore_evas_override_get(win->ee))
925 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
928 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
934 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
938 /* FIXME: We should update ecore_wl_window_location here !! */
940 else if (win->img_obj)
944 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
947 // evas_object_move(win->img_obj, x, y);
952 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
959 else if (win->img_obj)
961 Evas_Coord w = 1, h = 1;
963 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
967 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
973 evas_object_image_size_set(win->img_obj, w, h);
978 _elm_win_delete_request(Ecore_Evas *ee)
980 Evas_Object *obj = ecore_evas_object_associate_get(ee);
982 if (strcmp(elm_widget_type_get(obj), "win")) return;
984 win = elm_widget_data_get(obj);
986 int autodel = win->autodel;
987 win->autodel_clear = &autodel;
988 evas_object_ref(win->win_obj);
989 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
990 // FIXME: if above callback deletes - then the below will be invalid
991 if (autodel) evas_object_del(win->win_obj);
992 else win->autodel_clear = NULL;
993 evas_object_unref(win->win_obj);
997 _elm_win_resize_job(void *data)
1004 win->deferred_resize_job = NULL;
1005 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
1009 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
1015 evas_object_resize(win->frame_obj, w, h);
1017 else if (win->img_obj)
1020 evas_object_resize(win->win_obj, w, h);
1021 EINA_LIST_FOREACH(win->subobjs, l, obj)
1023 evas_object_move(obj, 0, 0);
1024 evas_object_resize(obj, w, h);
1028 #ifdef HAVE_ELEMENTARY_X
1030 _elm_win_xwindow_get(Elm_Win *win)
1034 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
1035 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1037 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
1039 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
1040 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1041 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
1042 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
1043 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
1044 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
1045 ENGINE_COMPARE(ELM_OPENGL_COCOA))
1048 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1050 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
1052 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1054 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
1057 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1059 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
1062 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1064 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
1066 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1068 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
1070 #undef ENGINE_COMPARE
1074 #ifdef HAVE_ELEMENTARY_X
1076 _elm_win_xwin_update(Elm_Win *win)
1079 Elm_Win_Indicator_Mode mode;
1081 _elm_win_xwindow_get(win);
1086 win2 = elm_widget_data_get(win->parent);
1090 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
1094 if (!win->xwin) return; /* nothing more to do */
1097 if (!s) s = _elm_appname;
1099 if (win->icon_name) s = win->icon_name;
1100 ecore_x_icccm_icon_name_set(win->xwin, s);
1101 ecore_x_netwm_icon_name_set(win->xwin, s);
1104 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
1111 data = evas_object_image_data_get(win->icon, EINA_FALSE);
1115 int w = 0, h = 0, stride, x, y;
1119 evas_object_image_size_get(win->icon, &w, &h);
1120 stride = evas_object_image_stride_get(win->icon);
1121 if ((w > 0) && (h > 0) &&
1122 (stride >= (int)(w * sizeof(unsigned int))))
1126 ic.data = malloc(w * h * sizeof(unsigned int));
1130 p = (unsigned char *)data;
1131 p2 = (unsigned int *)ic.data;
1132 for (y = 0; y < h; y++)
1134 for (x = 0; x < w; x++)
1136 *p2 = *((unsigned int *)p);
1137 p += sizeof(unsigned int);
1140 p += (stride - (w * sizeof(unsigned int)));
1142 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
1146 evas_object_image_data_set(win->icon, data);
1153 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
1155 case ELM_WIN_DIALOG_BASIC:
1156 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
1158 case ELM_WIN_DESKTOP:
1159 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1162 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
1164 case ELM_WIN_TOOLBAR:
1165 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1168 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1170 case ELM_WIN_UTILITY:
1171 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1173 case ELM_WIN_SPLASH:
1174 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1176 case ELM_WIN_DROPDOWN_MENU:
1177 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1179 case ELM_WIN_POPUP_MENU:
1180 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1182 case ELM_WIN_TOOLTIP:
1183 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1185 case ELM_WIN_NOTIFICATION:
1186 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1189 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1192 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1197 ecore_x_e_virtual_keyboard_state_set
1198 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1200 mode = ecore_x_e_illume_indicator_state_get(win->xwin);
1201 if (mode != win->indmode)
1203 if (mode == ELM_WIN_INDICATOR_SHOW)
1204 ecore_x_e_illume_indicator_state_set
1205 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1206 else if (mode == ELM_WIN_INDICATOR_HIDE)
1207 ecore_x_e_illume_indicator_state_set
1208 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1214 _elm_win_eval_subobjs(Evas_Object *obj)
1217 const Evas_Object *child;
1219 Elm_Win *win = elm_widget_data_get(obj);
1220 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1224 EINA_LIST_FOREACH(win->subobjs, l, child)
1226 evas_object_size_hint_weight_get(child, &wx, &wy);
1227 if (wx == 0.0) xx = 0;
1228 if (wy == 0.0) xy = 0;
1230 evas_object_size_hint_min_get(child, &w, &h);
1233 if (w > minw) minw = w;
1234 if (h > minh) minh = h;
1236 evas_object_size_hint_max_get(child, &w, &h);
1239 if (maxw == -1) maxw = w;
1240 else if ((w > 0) && (w < maxw)) maxw = w;
1241 if (maxh == -1) maxh = h;
1242 else if ((h > 0) && (h < maxh)) maxh = h;
1244 if (!xx) maxw = minw;
1246 if (!xy) maxh = minh;
1248 evas_object_size_hint_min_set(obj, minw, minh);
1249 evas_object_size_hint_max_set(obj, maxw, maxh);
1250 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1251 if (w < minw) w = minw;
1252 if (h < minh) h = minh;
1253 if ((maxw >= 0) && (w > maxw)) w = maxw;
1254 if ((maxh >= 0) && (h > maxh)) h = maxh;
1255 evas_object_resize(obj, w, h);
1259 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1261 Elm_Win *win = elm_widget_data_get(data);
1262 win->subobjs = eina_list_remove(win->subobjs, obj);
1263 _elm_win_eval_subobjs(win->win_obj);
1267 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1269 _elm_win_eval_subobjs(data);
1273 _elm_win_shutdown(void)
1275 while (_elm_win_list)
1276 evas_object_del(_elm_win_list->data);
1280 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1287 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1288 elm_widget_theme(obj);
1292 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1293 elm_widget_theme_specific(obj, th, EINA_FALSE);
1298 _elm_win_translate(void)
1303 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1304 elm_widget_translate(obj);
1309 _elm_win_send_message_to_sdb(Elm_Win *win, char *msg)
1311 if (win->sdb_server && msg)
1312 return ecore_ipc_server_send(win->sdb_server, 0, 0, 0, 0, 0, msg, strlen(msg)+1);
1318 _elm_win_sdb_server_sent(void *data, int type __UNUSED__, void *event)
1320 Elm_Win *win = data;
1321 Ecore_Ipc_Event_Server_Data *e;
1322 e = (Ecore_Ipc_Event_Server_Data *) event;
1324 if (win->sdb_server != e->server) return EINA_FALSE;
1325 if (!win->od_mod) return EINA_FALSE;
1327 Object_Dump_Mod *mod = win->od_mod;
1328 char *msg = strdup((char *)e->data);
1329 const char *command = strtok(msg,"=");
1331 Eina_List *tree = NULL;
1333 if (mod->tree_create)
1334 tree = mod->tree_create(win->win_obj);
1338 if (!strcmp(command, "AT+DUMPWND"))
1340 if (mod->tree_string_get_for_sdb)
1341 text = mod->tree_string_get_for_sdb(tree);
1343 else if (!strcmp(command, "AT+GETPARAM") ||
1344 !strcmp(command, "AT+GETOTEXT") ||
1345 !strcmp(command, "AT+CLRENTRY") ||
1346 !strcmp(command, "AT+SETENTRY"))
1348 if (mod->command_for_sdb)
1349 text = mod->command_for_sdb(tree, e->data);
1352 text = strdup("Invaild Command!!");
1354 _elm_win_send_message_to_sdb(win, text);
1355 if (mod->tree_free) mod->tree_free(tree);
1356 if (text) free(text);
1365 _elm_win_sdb_server_del(void *data, int type __UNUSED__, void *event __UNUSED__)
1367 Elm_Win *win = data;
1369 if (win->od_mod) free(win->od_mod);
1370 ecore_event_handler_del(win->sdb_server_data_handler);
1371 ecore_event_handler_del(win->sdb_server_del_handler);
1372 ecore_ipc_shutdown();
1375 win->sdb_server = NULL;
1376 win->sdb_server_data_handler = NULL;
1377 win->sdb_server_del_handler = NULL;
1382 static Object_Dump_Mod *
1383 _object_dump_mod_init()
1385 Elm_Module *mod = NULL;
1386 mod = _elm_module_find_as("win/api");
1387 if (!mod) return NULL;
1389 mod->api = malloc(sizeof(Object_Dump_Mod));
1390 if (!mod->api) return NULL;
1392 ((Object_Dump_Mod *)(mod->api))->tree_create = _elm_module_symbol_get(mod, "tree_create");
1393 ((Object_Dump_Mod *)(mod->api))->tree_free = _elm_module_symbol_get(mod, "tree_free");
1394 ((Object_Dump_Mod *)(mod->api))->tree_string_get = _elm_module_symbol_get(mod, "tree_string_get");
1395 ((Object_Dump_Mod *)(mod->api))->tree_string_get_for_sdb = _elm_module_symbol_get(mod, "tree_string_get_for_sdb");
1396 ((Object_Dump_Mod *)(mod->api))->command_for_sdb = _elm_module_symbol_get(mod, "command_for_sdb");
1402 #ifdef HAVE_ELEMENTARY_X
1404 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1406 Elm_Win *win = data;
1407 Ecore_X_Event_Client_Message *e = event;
1409 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1410 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1412 if ((unsigned)e->data.l[0] == win->xwin)
1414 Evas *evas = evas_object_evas_get(win->win_obj);
1417 edje_file_cache_flush();
1418 edje_collection_cache_flush();
1419 evas_image_cache_flush(evas);
1420 evas_font_cache_flush(evas);
1424 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1426 if ((unsigned)e->data.l[0] == win->xwin)
1428 Evas *evas = evas_object_evas_get(win->win_obj);
1431 edje_file_cache_flush();
1432 edje_collection_cache_flush();
1433 evas_image_cache_flush(evas);
1434 evas_font_cache_flush(evas);
1435 evas_render_dump(evas);
1440 else if (e->message_type == ECORE_X_ATOM_SDB_SERVER_CONNECT)
1442 if ((unsigned)e->data.l[0] == win->xwin)
1445 win->od_mod = _object_dump_mod_init();
1447 win->sdb_server = ecore_ipc_server_connect(ECORE_IPC_LOCAL_SYSTEM, "sdb", 0, NULL);
1448 win->sdb_server_data_handler = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, _elm_win_sdb_server_sent, win);
1449 win->sdb_server_del_handler = ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, _elm_win_sdb_server_del, win);
1452 else if (e->message_type == ECORE_X_ATOM_SDB_SERVER_DISCONNECT)
1454 if ((unsigned)e->data.l[0] == win->xwin)
1456 if (win->od_mod) free(win->od_mod);
1457 ecore_event_handler_del(win->sdb_server_data_handler);
1458 ecore_event_handler_del(win->sdb_server_del_handler);
1459 ecore_ipc_shutdown();
1462 win->sdb_server = NULL;
1463 win->sdb_server_data_handler = NULL;
1464 win->sdb_server_del_handler = NULL;
1468 return ECORE_CALLBACK_PASS_ON;
1472 _elm_win_property_change(void *data, int type __UNUSED__, void *event)
1474 Elm_Win *win = data;
1475 Ecore_X_Event_Window_Property *e = event;
1477 if (e->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE)
1479 if (e->win == win->xwin)
1481 win->indmode = ecore_x_e_illume_indicator_state_get(e->win);
1484 return ECORE_CALLBACK_PASS_ON;
1489 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1491 Elm_Win *win = data;
1493 win->focus_highlight.geometry_changed = EINA_TRUE;
1494 _elm_win_focus_highlight_reconfigure_job_start(win);
1498 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1500 Elm_Win *win = data;
1502 win->focus_highlight.geometry_changed = EINA_TRUE;
1503 _elm_win_focus_highlight_reconfigure_job_start(win);
1507 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1509 Elm_Win *win = data;
1511 win->focus_highlight.cur.target = NULL;
1513 _elm_win_focus_highlight_reconfigure_job_start(win);
1517 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1519 Evas_Object *obj = win->focus_highlight.cur.target;
1521 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1522 _elm_win_focus_target_move, win);
1523 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1524 _elm_win_focus_target_resize, win);
1525 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1526 _elm_win_focus_target_del, win);
1530 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1532 Evas_Object *obj = win->focus_highlight.cur.target;
1534 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1535 _elm_win_focus_target_move, win);
1536 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1537 _elm_win_focus_target_resize, win);
1538 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1539 _elm_win_focus_target_del, win);
1542 static Evas_Object *
1543 _elm_win_focus_target_get(Evas_Object *obj)
1545 Evas_Object *o = obj;
1549 if (elm_widget_is(o))
1551 if (!elm_widget_highlight_ignore_get(o))
1553 o = elm_widget_parent_get(o);
1555 o = evas_object_smart_parent_get(o);
1559 o = elm_widget_parent_widget_get(o);
1561 o = evas_object_smart_parent_get(o);
1570 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1572 Evas_Object *obj = event_info, *target;
1573 Elm_Win *win = data;
1575 if (win->focus_highlight.cur.target == obj)
1578 target = _elm_win_focus_target_get(obj);
1579 win->focus_highlight.cur.target = target;
1580 if (elm_widget_highlight_in_theme_get(target))
1581 win->focus_highlight.cur.handled = EINA_TRUE;
1583 _elm_win_focus_target_callbacks_add(win);
1585 _elm_win_focus_highlight_reconfigure_job_start(win);
1589 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1591 Elm_Win *win = data;
1593 if (!win->focus_highlight.cur.target)
1596 if (!win->focus_highlight.cur.handled)
1597 _elm_win_focus_target_callbacks_del(win);
1598 win->focus_highlight.cur.target = NULL;
1599 win->focus_highlight.cur.handled = EINA_FALSE;
1601 _elm_win_focus_highlight_reconfigure_job_start(win);
1605 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1607 evas_object_hide(obj);
1611 _elm_win_focus_highlight_init(Elm_Win *win)
1613 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1614 _elm_win_object_focus_in, win);
1615 evas_event_callback_add(win->evas,
1616 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1617 _elm_win_object_focus_out, win);
1619 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1621 win->focus_highlight.top = edje_object_add(win->evas);
1622 win->focus_highlight.changed_theme = EINA_TRUE;
1623 edje_object_signal_callback_add(win->focus_highlight.top,
1624 "elm,action,focus,hide,end", "",
1625 _elm_win_focus_highlight_hide, NULL);
1626 edje_object_signal_callback_add(win->focus_highlight.top,
1627 "elm,action,focus,anim,end", "",
1628 _elm_win_focus_highlight_anim_end, win);
1629 _elm_win_focus_highlight_reconfigure_job_start(win);
1633 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1635 _elm_win_focus_highlight_reconfigure_job_stop(win);
1636 if (win->focus_highlight.cur.target)
1638 _elm_win_focus_target_callbacks_del(win);
1639 win->focus_highlight.cur.target = NULL;
1641 if (win->focus_highlight.top)
1643 evas_object_del(win->focus_highlight.top);
1644 win->focus_highlight.top = NULL;
1647 evas_event_callback_del_full(win->evas,
1648 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1649 _elm_win_object_focus_in, win);
1650 evas_event_callback_del_full(win->evas,
1651 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1652 _elm_win_object_focus_out, win);
1656 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1660 top = win->focus_highlight.top;
1665 evas_object_show(top);
1666 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1672 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1677 _elm_win_focus_highlight_reconfigure_job(void *data)
1679 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1683 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1685 if (win->focus_highlight.reconf_job)
1686 ecore_job_del(win->focus_highlight.reconf_job);
1687 win->focus_highlight.reconf_job = ecore_job_add(
1688 _elm_win_focus_highlight_reconfigure_job, win);
1692 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1694 if (win->focus_highlight.reconf_job)
1695 ecore_job_del(win->focus_highlight.reconf_job);
1696 win->focus_highlight.reconf_job = NULL;
1700 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1702 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1703 Evas_Coord x, y, w, h;
1705 clip = evas_object_clip_get(target);
1706 evas_object_geometry_get(target, &x, &y, &w, &h);
1708 evas_object_move(obj, x, y);
1709 evas_object_resize(obj, w, h);
1710 evas_object_clip_set(obj, clip);
1714 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1716 Evas_Coord tx, ty, tw, th;
1717 Evas_Coord w, h, px, py, pw, ph;
1718 Edje_Message_Int_Set *m;
1719 Evas_Object *previous = win->focus_highlight.prev.target;
1720 Evas_Object *target = win->focus_highlight.cur.target;
1722 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1723 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1724 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1725 evas_object_move(obj, 0, 0);
1726 evas_object_resize(obj, tw, th);
1727 evas_object_clip_unset(obj);
1729 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1739 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1743 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1745 Elm_Win *win = data;
1746 _elm_win_focus_highlight_simple_setup(win, obj);
1750 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1752 Evas_Object *target = win->focus_highlight.cur.target;
1753 Evas_Object *previous = win->focus_highlight.prev.target;
1754 Evas_Object *top = win->focus_highlight.top;
1755 Eina_Bool visible_changed;
1756 Eina_Bool common_visible;
1757 const char *sig = NULL;
1759 _elm_win_focus_highlight_reconfigure_job_stop(win);
1761 visible_changed = (win->focus_highlight.cur.visible !=
1762 win->focus_highlight.prev.visible);
1764 if ((target == previous) && (!visible_changed) &&
1765 (!win->focus_highlight.geometry_changed))
1768 if ((previous) && (win->focus_highlight.prev.handled))
1769 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1772 common_visible = EINA_FALSE;
1773 else if (win->focus_highlight.cur.handled)
1775 common_visible = EINA_FALSE;
1776 if (win->focus_highlight.cur.visible)
1777 sig = "elm,action,focus_highlight,show";
1779 sig = "elm,action,focus_highlight,hide";
1782 common_visible = win->focus_highlight.cur.visible;
1784 _elm_win_focus_highlight_visible_set(win, common_visible);
1786 elm_widget_signal_emit(target, sig, "elm");
1788 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1791 if (win->focus_highlight.changed_theme)
1794 if (win->focus_highlight.style)
1795 str = win->focus_highlight.style;
1798 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1800 win->focus_highlight.changed_theme = EINA_FALSE;
1802 if (_elm_config->focus_highlight_animate)
1804 str = edje_object_data_get(win->focus_highlight.top, "animate");
1805 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1809 if ((win->focus_highlight.top_animate) && (previous) &&
1810 (!win->focus_highlight.prev.handled))
1811 _elm_win_focus_highlight_anim_setup(win, top);
1813 _elm_win_focus_highlight_simple_setup(win, top);
1814 evas_object_raise(top);
1817 win->focus_highlight.geometry_changed = EINA_FALSE;
1818 win->focus_highlight.prev = win->focus_highlight.cur;
1822 _elm_win_frame_add(Elm_Win *win, const char *style)
1824 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1826 win->frame_obj = edje_object_add(win->evas);
1827 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1828 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1829 evas_object_move(win->frame_obj, 0, 0);
1830 evas_object_resize(win->frame_obj, 1, 1);
1832 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1833 "elm", _elm_win_frame_cb_move_start, win);
1834 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1835 "*", _elm_win_frame_cb_resize_start, win);
1836 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1837 "elm", _elm_win_frame_cb_minimize, win);
1838 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1839 "elm", _elm_win_frame_cb_maximize, win);
1840 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1841 "elm", _elm_win_frame_cb_close, win);
1845 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1849 if (!(win = data)) return;
1850 /* FIXME: Change mouse pointer */
1852 /* NB: Wayland handles moving surfaces by itself so we cannot
1853 * specify a specific x/y we want. Instead, we will pass in the
1854 * existing x/y values so they can be recorded as 'previous' position.
1855 * The new position will get updated automatically when the move is
1858 ecore_evas_wayland_move(win->ee, win->screen.x, win->screen.y);
1862 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1866 if (!(win = data)) return;
1867 if (win->resizing) return;
1868 win->resizing = EINA_TRUE;
1870 /* FIXME: Change mouse pointer */
1872 if (!strcmp(source, "elm.event.resize.t"))
1873 win->resize_location = 1;
1874 else if (!strcmp(source, "elm.event.resize.b"))
1875 win->resize_location = 2;
1876 else if (!strcmp(source, "elm.event.resize.l"))
1877 win->resize_location = 4;
1878 else if (!strcmp(source, "elm.event.resize.r"))
1879 win->resize_location = 8;
1880 else if (!strcmp(source, "elm.event.resize.tl"))
1881 win->resize_location = 5;
1882 else if (!strcmp(source, "elm.event.resize.tr"))
1883 win->resize_location = 9;
1884 else if (!strcmp(source, "elm.event.resize.bl"))
1885 win->resize_location = 6;
1886 else if (!strcmp(source, "elm.event.resize.br"))
1887 win->resize_location = 10;
1889 win->resize_location = 0;
1891 if (win->resize_location > 0)
1892 ecore_evas_wayland_resize(win->ee, win->resize_location);
1896 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1900 if (!(win = data)) return;
1901 win->iconified = EINA_TRUE;
1902 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1906 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1910 if (!(win = data)) return;
1911 if (win->maximized) win->maximized = EINA_FALSE;
1912 else win->maximized = EINA_TRUE;
1913 ecore_evas_maximized_set(win->ee, win->maximized);
1917 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1921 if (!(win = data)) return;
1922 evas_object_del(win->win_obj);
1927 _elm_win_pointer_add(Elm_Win *win, const char *style)
1933 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1934 ecore_evas_resize(win->pointer.ee, 32, 32);
1936 win->pointer.evas = ecore_evas_get(win->ee);
1938 win->pointer.obj = edje_object_add(win->pointer.evas);
1939 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1940 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1941 evas_object_move(win->pointer.obj, 0, 0);
1942 evas_object_resize(win->pointer.obj, 32, 32);
1943 evas_object_show(win->pointer.obj);
1949 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1951 Evas_Event_Key_Down *ev = event_info;
1953 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1956 if ((strcmp(ev->keyname, "F12")) ||
1957 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1960 printf("Tree graph generated.\n");
1961 elm_object_tree_dot_dump(obj, "./dump.dot");
1966 _win_img_hide(void *data,
1968 Evas_Object *obj __UNUSED__,
1969 void *event_info __UNUSED__)
1971 Elm_Win *win = data;
1973 elm_widget_focus_hide_handle(win->win_obj);
1977 _win_img_mouse_up(void *data,
1979 Evas_Object *obj __UNUSED__,
1982 Elm_Win *win = data;
1983 Evas_Event_Mouse_Up *ev = event_info;
1984 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1985 elm_widget_focus_mouse_up_handle(win->win_obj);
1989 _win_img_focus_in(void *data,
1991 Evas_Object *obj __UNUSED__,
1992 void *event_info __UNUSED__)
1994 Elm_Win *win = data;
1995 elm_widget_focus_steal(win->win_obj);
1999 _win_img_focus_out(void *data,
2001 Evas_Object *obj __UNUSED__,
2002 void *event_info __UNUSED__)
2004 Elm_Win *win = data;
2005 elm_widget_focused_object_clear(win->win_obj);
2009 _win_inlined_image_set(Elm_Win *win)
2011 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
2012 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
2013 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
2014 _elm_win_obj_callback_img_obj_del, win);
2016 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
2017 _win_img_hide, win);
2018 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
2019 _win_img_mouse_up, win);
2020 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
2021 _win_img_focus_in, win);
2022 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
2023 _win_img_focus_out, win);
2027 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
2029 evas_object_event_callback_del_full(subobj,
2030 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2031 _elm_win_subobj_callback_changed_size_hints,
2033 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2034 _elm_win_subobj_callback_del, obj);
2035 win->subobjs = eina_list_remove(win->subobjs, subobj);
2036 _elm_win_eval_subobjs(obj);
2040 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
2042 Elm_Win *win = data;
2043 if (win->icon == obj) win->icon = NULL;
2047 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
2051 const char *fontpath;
2053 win = ELM_NEW(Elm_Win);
2055 #define FALLBACK_TRY(engine) \
2058 CRITICAL(engine " engine creation failed. Trying default."); \
2059 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
2061 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
2063 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
2065 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
2066 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
2070 case ELM_WIN_INLINED_IMAGE:
2073 Evas *e = evas_object_evas_get(parent);
2076 ee = ecore_evas_ecore_evas_get(e);
2078 win->img_obj = ecore_evas_object_image_new(ee);
2079 if (!win->img_obj) break;
2080 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
2083 _win_inlined_image_set(win);
2086 evas_object_del(win->img_obj);
2087 win->img_obj = NULL;
2091 case ELM_WIN_SOCKET_IMAGE:
2092 win->ee = ecore_evas_extn_socket_new(1, 1);
2096 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
2098 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2099 #ifdef HAVE_ELEMENTARY_X
2100 win->client_message_handler = ecore_event_handler_add
2101 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2102 win->property_handler = ecore_event_handler_add
2103 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
2105 FALLBACK_TRY("Sofware X11");
2107 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2109 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2110 FALLBACK_TRY("Sofware FB");
2112 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
2114 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
2115 FALLBACK_TRY("Sofware DirectFB");
2117 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
2119 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
2120 FALLBACK_TRY("Sofware-16");
2121 #ifdef HAVE_ELEMENTARY_X
2122 win->client_message_handler = ecore_event_handler_add
2123 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2124 win->property_handler = ecore_event_handler_add
2125 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
2128 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
2130 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
2131 FALLBACK_TRY("Sofware-8");
2132 #ifdef HAVE_ELEMENTARY_X
2133 win->client_message_handler = ecore_event_handler_add
2134 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2135 win->property_handler = ecore_event_handler_add
2136 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
2140 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
2142 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
2143 FALLBACK_TRY("XRender");
2144 #ifdef HAVE_ELEMENTARY_X
2145 win->client_message_handler = ecore_event_handler_add
2146 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2147 win->property_handler = ecore_event_handler_add
2148 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
2152 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
2157 if (_elm_config->vsync)
2159 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
2165 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
2167 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
2168 FALLBACK_TRY("OpenGL");
2169 #ifdef HAVE_ELEMENTARY_X
2170 win->client_message_handler = ecore_event_handler_add
2171 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2172 win->property_handler = ecore_event_handler_add
2173 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
2176 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
2178 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
2179 FALLBACK_TRY("Sofware Win32");
2181 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2183 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
2184 FALLBACK_TRY("Sofware-16-WinCE");
2186 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
2188 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
2189 FALLBACK_TRY("PSL1GHT");
2191 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
2193 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
2194 FALLBACK_TRY("Sofware SDL");
2196 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
2198 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
2199 FALLBACK_TRY("Sofware-16-SDL");
2201 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
2203 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
2204 FALLBACK_TRY("OpenGL SDL");
2206 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
2208 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
2209 FALLBACK_TRY("OpenGL Cocoa");
2211 else if (ENGINE_COMPARE(ELM_BUFFER))
2213 win->ee = ecore_evas_buffer_new(1, 1);
2215 else if (ENGINE_COMPARE(ELM_EWS))
2217 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
2219 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
2221 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
2222 win->evas = ecore_evas_get(win->ee);
2224 _elm_win_frame_add(win, "default");
2225 // _elm_win_pointer_add(win, "default");
2227 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
2229 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
2230 win->evas = ecore_evas_get(win->ee);
2232 _elm_win_frame_add(win, "default");
2233 // _elm_win_pointer_add(win, "default");
2235 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
2237 win->ee = ecore_evas_buffer_new(1, 1);
2238 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
2239 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
2248 ERR("Cannot create window.");
2252 #ifdef HAVE_ELEMENTARY_X
2253 _elm_win_xwindow_get(win);
2255 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
2256 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
2257 // bg pixmap done by x - has other issues like can be redrawn by x before it
2258 // is filled/ready by app
2259 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
2262 win->parent = parent;
2264 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
2265 _elm_win_obj_callback_parent_del, win);
2267 win->evas = ecore_evas_get(win->ee);
2268 win->win_obj = elm_widget_add(win->evas);
2269 elm_widget_type_set(win->win_obj, "win");
2270 ELM_SET_WIDTYPE(widtype, "win");
2271 elm_widget_data_set(win->win_obj, win);
2272 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
2273 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
2274 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
2275 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
2276 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
2277 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
2278 evas_object_move(win->win_obj, 0, 0);
2279 evas_object_resize(win->win_obj, 1, 1);
2280 evas_object_layer_set(win->win_obj, 50);
2281 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
2285 evas_object_clip_set(win->win_obj, win->frame_obj);
2286 evas_object_stack_below(win->frame_obj, win->win_obj);
2289 if (type == ELM_WIN_INLINED_IMAGE)
2290 elm_widget_parent2_set(win->win_obj, parent);
2291 ecore_evas_object_associate(win->ee, win->win_obj,
2292 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
2293 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
2294 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
2295 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
2296 _elm_win_obj_callback_show, win);
2297 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
2298 _elm_win_obj_callback_hide, win);
2299 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
2300 _elm_win_obj_callback_del, win);
2301 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
2302 _elm_win_obj_callback_move, win);
2303 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
2304 _elm_win_obj_callback_resize, win);
2306 evas_object_intercept_move_callback_add(win->win_obj,
2307 _elm_win_obj_intercept_move, win);
2308 evas_object_intercept_show_callback_add(win->win_obj,
2309 _elm_win_obj_intercept_show, win);
2311 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
2312 ecore_evas_name_class_set(win->ee, name, _elm_appname);
2313 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
2314 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
2315 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
2316 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
2317 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
2318 ecore_evas_callback_move_set(win->ee, _elm_win_move);
2319 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
2320 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
2321 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
2322 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2323 evas_font_path_append(win->evas, fontpath);
2324 if (!_elm_config->font_hinting)
2325 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2326 else if (_elm_config->font_hinting == 1)
2327 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2328 else if (_elm_config->font_hinting == 2)
2329 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2331 #ifdef HAVE_ELEMENTARY_X
2332 _elm_win_xwin_update(win);
2335 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2337 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2339 ecore_evas_fullscreen_set(win->ee, 1);
2341 #undef ENGINE_COMPARE
2343 if (_elm_config->focus_highlight_enable)
2344 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2347 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2348 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2349 _debug_key_down, win);
2351 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2353 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2356 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2358 return win->win_obj;
2362 elm_win_util_standard_add(const char *name, const char *title)
2364 Evas_Object *win, *bg;
2366 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2367 if (!win) return NULL;
2368 elm_win_title_set(win, title);
2369 bg = elm_bg_add(win);
2372 evas_object_del(win);
2375 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2376 elm_win_resize_object_add(win, bg);
2377 evas_object_show(bg);
2382 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2386 ELM_CHECK_WIDTYPE(obj, widtype);
2387 win = elm_widget_data_get(obj);
2389 if (eina_list_data_find(win->subobjs, subobj)) return;
2390 win->subobjs = eina_list_append(win->subobjs, subobj);
2391 elm_widget_sub_object_add(obj, subobj);
2392 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2393 _elm_win_subobj_callback_del, obj);
2394 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2395 _elm_win_subobj_callback_changed_size_hints,
2397 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2398 evas_object_move(subobj, 0, 0);
2399 evas_object_resize(subobj, w, h);
2400 _elm_win_eval_subobjs(obj);
2404 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2407 ELM_CHECK_WIDTYPE(obj, widtype);
2408 win = elm_widget_data_get(obj);
2410 evas_object_event_callback_del_full(subobj,
2411 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2412 _elm_win_subobj_callback_changed_size_hints,
2414 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2415 _elm_win_subobj_callback_del, obj);
2416 win->subobjs = eina_list_remove(win->subobjs, subobj);
2417 elm_widget_sub_object_del(obj, subobj);
2418 _elm_win_eval_subobjs(obj);
2422 elm_win_title_set(Evas_Object *obj, const char *title)
2425 ELM_CHECK_WIDTYPE(obj, widtype);
2426 win = elm_widget_data_get(obj);
2427 if (!win || !title) return;
2428 eina_stringshare_replace(&(win->title), title);
2429 ecore_evas_title_set(win->ee, win->title);
2431 edje_object_part_text_escaped_set(win->frame_obj, "elm.text.title", win->title);
2435 elm_win_title_get(const Evas_Object *obj)
2438 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2439 win = elm_widget_data_get(obj);
2440 if (!win) return NULL;
2445 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2448 ELM_CHECK_WIDTYPE(obj, widtype);
2449 win = elm_widget_data_get(obj);
2450 if (!win || !icon_name) return;
2451 eina_stringshare_replace(&(win->icon_name), icon_name);
2452 #ifdef HAVE_ELEMENTARY_X
2453 _elm_win_xwin_update(win);
2458 elm_win_icon_name_get(const Evas_Object *obj)
2461 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2462 win = elm_widget_data_get(obj);
2463 if (!win) return NULL;
2464 return win->icon_name;
2468 elm_win_role_set(Evas_Object *obj, const char *role)
2471 ELM_CHECK_WIDTYPE(obj, widtype);
2472 win = elm_widget_data_get(obj);
2473 if (!win || !role) return;
2474 eina_stringshare_replace(&(win->role), role);
2475 #ifdef HAVE_ELEMENTARY_X
2476 _elm_win_xwin_update(win);
2481 elm_win_role_get(const Evas_Object *obj)
2484 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2485 win = elm_widget_data_get(obj);
2486 if (!win) return NULL;
2491 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2494 ELM_CHECK_WIDTYPE(obj, widtype);
2495 win = elm_widget_data_get(obj);
2498 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2499 _elm_win_obj_icon_callback_del, win);
2502 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2503 _elm_win_obj_icon_callback_del, win);
2504 #ifdef HAVE_ELEMENTARY_X
2505 _elm_win_xwin_update(win);
2509 EAPI const Evas_Object *
2510 elm_win_icon_object_get(const Evas_Object *obj)
2513 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2514 win = elm_widget_data_get(obj);
2515 if (!win) return NULL;
2520 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2523 ELM_CHECK_WIDTYPE(obj, widtype);
2524 win = elm_widget_data_get(obj);
2526 win->autodel = autodel;
2530 elm_win_autodel_get(const Evas_Object *obj)
2533 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2534 win = elm_widget_data_get(obj);
2535 if (!win) return EINA_FALSE;
2536 return win->autodel;
2540 elm_win_activate(Evas_Object *obj)
2543 ELM_CHECK_WIDTYPE(obj, widtype);
2544 win = elm_widget_data_get(obj);
2546 ecore_evas_activate(win->ee);
2550 elm_win_lower(Evas_Object *obj)
2553 ELM_CHECK_WIDTYPE(obj, widtype);
2554 win = elm_widget_data_get(obj);
2556 ecore_evas_lower(win->ee);
2560 elm_win_raise(Evas_Object *obj)
2563 ELM_CHECK_WIDTYPE(obj, widtype);
2564 win = elm_widget_data_get(obj);
2566 ecore_evas_raise(win->ee);
2570 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2573 int win_w, win_h, screen_w, screen_h, nx, ny;
2574 ELM_CHECK_WIDTYPE(obj, widtype);
2575 win = elm_widget_data_get(obj);
2577 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2578 if ((!screen_w) || (!screen_h)) return;
2579 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2580 if ((!win_w) || (!win_h)) return;
2581 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2582 else nx = win->screen.x;
2583 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2584 else ny = win->screen.y;
2587 evas_object_move(obj, nx, ny);
2591 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2594 ELM_CHECK_WIDTYPE(obj, widtype);
2595 win = elm_widget_data_get(obj);
2597 ecore_evas_borderless_set(win->ee, borderless);
2598 #ifdef HAVE_ELEMENTARY_X
2599 _elm_win_xwin_update(win);
2604 elm_win_borderless_get(const Evas_Object *obj)
2607 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2608 win = elm_widget_data_get(obj);
2609 if (!win) return EINA_FALSE;
2610 return ecore_evas_borderless_get(win->ee);
2614 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2617 ELM_CHECK_WIDTYPE(obj, widtype);
2618 win = elm_widget_data_get(obj);
2620 ecore_evas_shaped_set(win->ee, shaped);
2621 #ifdef HAVE_ELEMENTARY_X
2622 _elm_win_xwin_update(win);
2627 elm_win_shaped_get(const Evas_Object *obj)
2630 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2631 win = elm_widget_data_get(obj);
2632 if (!win) return EINA_FALSE;
2633 return ecore_evas_shaped_get(win->ee);
2637 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2640 ELM_CHECK_WIDTYPE(obj, widtype);
2641 win = elm_widget_data_get(obj);
2646 else if (win->img_obj)
2648 evas_object_image_alpha_set(win->img_obj, alpha);
2649 ecore_evas_alpha_set(win->ee, alpha);
2653 #ifdef HAVE_ELEMENTARY_X
2658 if (!_elm_config->compositing)
2659 elm_win_shaped_set(obj, alpha);
2661 ecore_evas_alpha_set(win->ee, alpha);
2664 ecore_evas_alpha_set(win->ee, alpha);
2665 _elm_win_xwin_update(win);
2669 ecore_evas_alpha_set(win->ee, alpha);
2674 elm_win_alpha_get(const Evas_Object *obj)
2677 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2678 win = elm_widget_data_get(obj);
2679 if (!win) return EINA_FALSE;
2683 else if (win->img_obj)
2685 return evas_object_image_alpha_get(win->img_obj);
2687 return ecore_evas_alpha_get(win->ee);
2691 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2694 ELM_CHECK_WIDTYPE(obj, widtype);
2695 win = elm_widget_data_get(obj);
2697 ecore_evas_override_set(win->ee, override);
2698 #ifdef HAVE_ELEMENTARY_X
2699 _elm_win_xwin_update(win);
2704 elm_win_override_get(const Evas_Object *obj)
2707 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2708 win = elm_widget_data_get(obj);
2709 if (!win) return EINA_FALSE;
2710 return ecore_evas_override_get(win->ee);
2714 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2717 ELM_CHECK_WIDTYPE(obj, widtype);
2718 win = elm_widget_data_get(obj);
2720 // YYY: handle if win->img_obj
2721 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2722 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2723 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2725 // these engines... can ONLY be fullscreen
2730 win->fullscreen = fullscreen;
2731 ecore_evas_fullscreen_set(win->ee, fullscreen);
2732 #ifdef HAVE_ELEMENTARY_X
2733 _elm_win_xwin_update(win);
2736 #undef ENGINE_COMPARE
2740 elm_win_fullscreen_get(const Evas_Object *obj)
2743 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2744 win = elm_widget_data_get(obj);
2745 if (!win) return EINA_FALSE;
2746 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2747 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2748 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2750 // these engines... can ONLY be fullscreen
2755 return win->fullscreen;
2757 #undef ENGINE_COMPARE
2761 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2764 ELM_CHECK_WIDTYPE(obj, widtype);
2765 win = elm_widget_data_get(obj);
2767 win->maximized = maximized;
2768 // YYY: handle if win->img_obj
2769 ecore_evas_maximized_set(win->ee, maximized);
2770 #ifdef HAVE_ELEMENTARY_X
2771 _elm_win_xwin_update(win);
2776 elm_win_maximized_get(const Evas_Object *obj)
2779 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2780 win = elm_widget_data_get(obj);
2781 if (!win) return EINA_FALSE;
2782 return win->maximized;
2786 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2789 ELM_CHECK_WIDTYPE(obj, widtype);
2790 win = elm_widget_data_get(obj);
2792 win->iconified = iconified;
2793 ecore_evas_iconified_set(win->ee, iconified);
2794 #ifdef HAVE_ELEMENTARY_X
2795 _elm_win_xwin_update(win);
2800 elm_win_iconified_get(const Evas_Object *obj)
2803 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2804 win = elm_widget_data_get(obj);
2805 if (!win) return EINA_FALSE;
2806 return win->iconified;
2810 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2813 ELM_CHECK_WIDTYPE(obj, widtype);
2814 win = elm_widget_data_get(obj);
2816 win->withdrawn = withdrawn;
2817 ecore_evas_withdrawn_set(win->ee, withdrawn);
2818 #ifdef HAVE_ELEMENTARY_X
2819 _elm_win_xwin_update(win);
2824 elm_win_withdrawn_get(const Evas_Object *obj)
2827 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2828 win = elm_widget_data_get(obj);
2829 if (!win) return EINA_FALSE;
2830 return win->withdrawn;
2834 elm_win_profiles_set(Evas_Object *obj, const char **profiles, unsigned int num_profiles)
2837 char **profiles_int;
2839 unsigned int i, num;
2842 ELM_CHECK_WIDTYPE(obj, widtype);
2843 win = elm_widget_data_get(obj);
2845 if (!profiles) return;
2847 if (win->profile.timer) ecore_timer_del(win->profile.timer);
2848 win->profile.timer = ecore_timer_add(0.1, _elm_win_profile_change_delay, win);
2849 EINA_LIST_FREE(win->profile.names, str) eina_stringshare_del(str);
2851 for (i = 0; i < num_profiles; i++)
2853 if ((profiles[i]) &&
2854 _elm_config_profile_exists(profiles[i]))
2856 str = eina_stringshare_add(profiles[i]);
2857 win->profile.names = eina_list_append(win->profile.names, str);
2861 num = eina_list_count(win->profile.names);
2862 profiles_int = alloca(num * sizeof(char *));
2867 EINA_LIST_FOREACH(win->profile.names, l, str)
2870 profiles_int[i] = strdup(str);
2872 profiles_int[i] = NULL;
2875 ecore_evas_profiles_set(win->ee, (const char **)profiles_int, i);
2876 for (i = 0; i < num; i++)
2878 if (profiles_int[i]) free(profiles_int[i]);
2882 ecore_evas_profiles_set(win->ee, profiles, num_profiles);
2886 elm_win_profile_get(const Evas_Object *obj)
2889 ELM_CHECK_WIDTYPE(obj, widtype);
2890 win = elm_widget_data_get(obj);
2891 if (!win) return NULL;
2893 return win->profile.name;
2897 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2900 ELM_CHECK_WIDTYPE(obj, widtype);
2901 win = elm_widget_data_get(obj);
2903 win->urgent = urgent;
2904 ecore_evas_urgent_set(win->ee, urgent);
2905 #ifdef HAVE_ELEMENTARY_X
2906 _elm_win_xwin_update(win);
2911 elm_win_urgent_get(const Evas_Object *obj)
2914 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2915 win = elm_widget_data_get(obj);
2916 if (!win) return EINA_FALSE;
2921 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2924 ELM_CHECK_WIDTYPE(obj, widtype);
2925 win = elm_widget_data_get(obj);
2927 win->demand_attention = demand_attention;
2928 ecore_evas_demand_attention_set(win->ee, demand_attention);
2929 #ifdef HAVE_ELEMENTARY_X
2930 _elm_win_xwin_update(win);
2935 elm_win_demand_attention_get(const Evas_Object *obj)
2938 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2939 win = elm_widget_data_get(obj);
2940 if (!win) return EINA_FALSE;
2941 return win->demand_attention;
2945 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2948 ELM_CHECK_WIDTYPE(obj, widtype);
2949 win = elm_widget_data_get(obj);
2952 ecore_evas_modal_set(win->ee, modal);
2953 #ifdef HAVE_ELEMENTARY_X
2954 _elm_win_xwin_update(win);
2959 elm_win_modal_get(const Evas_Object *obj)
2962 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2963 win = elm_widget_data_get(obj);
2964 if (!win) return EINA_FALSE;
2969 elm_win_aspect_set(Evas_Object *obj, double aspect)
2972 ELM_CHECK_WIDTYPE(obj, widtype);
2973 win = elm_widget_data_get(obj);
2975 win->aspect = aspect;
2976 ecore_evas_aspect_set(win->ee, aspect);
2977 #ifdef HAVE_ELEMENTARY_X
2978 _elm_win_xwin_update(win);
2983 elm_win_aspect_get(const Evas_Object *obj)
2986 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2987 win = elm_widget_data_get(obj);
2988 if (!win) return EINA_FALSE;
2993 elm_win_layer_set(Evas_Object *obj, int layer)
2996 ELM_CHECK_WIDTYPE(obj, widtype);
2997 win = elm_widget_data_get(obj);
2999 ecore_evas_layer_set(win->ee, layer);
3000 #ifdef HAVE_ELEMENTARY_X
3001 _elm_win_xwin_update(win);
3006 elm_win_layer_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 return ecore_evas_layer_get(win->ee);
3016 elm_win_rotation_set(Evas_Object *obj, int rotation)
3019 ELM_CHECK_WIDTYPE(obj, widtype);
3020 win = elm_widget_data_get(obj);
3022 if (win->rot == rotation) return;
3023 win->rot = rotation;
3024 ecore_evas_rotation_set(win->ee, rotation);
3025 evas_object_size_hint_min_set(obj, -1, -1);
3026 evas_object_size_hint_max_set(obj, -1, -1);
3027 _elm_win_eval_subobjs(obj);
3028 #ifdef HAVE_ELEMENTARY_X
3029 _elm_win_xwin_update(win);
3034 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
3037 ELM_CHECK_WIDTYPE(obj, widtype);
3038 win = elm_widget_data_get(obj);
3040 if (win->rot == rotation) return;
3041 win->rot = rotation;
3042 ecore_evas_rotation_with_resize_set(win->ee, rotation);
3043 evas_object_size_hint_min_set(obj, -1, -1);
3044 evas_object_size_hint_max_set(obj, -1, -1);
3045 _elm_win_eval_subobjs(obj);
3046 #ifdef HAVE_ELEMENTARY_X
3047 _elm_win_xwin_update(win);
3052 elm_win_rotation_get(const Evas_Object *obj)
3055 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3056 win = elm_widget_data_get(obj);
3057 if (!win) return -1;
3062 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
3065 ELM_CHECK_WIDTYPE(obj, widtype);
3066 win = elm_widget_data_get(obj);
3068 win->sticky = sticky;
3069 ecore_evas_sticky_set(win->ee, sticky);
3070 #ifdef HAVE_ELEMENTARY_X
3071 _elm_win_xwin_update(win);
3076 elm_win_sticky_get(const Evas_Object *obj)
3079 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3080 win = elm_widget_data_get(obj);
3081 if (!win) return EINA_FALSE;
3086 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
3089 ELM_CHECK_WIDTYPE(obj, widtype);
3090 win = elm_widget_data_get(obj);
3092 if (mode == win->kbdmode) return;
3093 #ifdef HAVE_ELEMENTARY_X
3094 _elm_win_xwindow_get(win);
3096 win->kbdmode = mode;
3097 #ifdef HAVE_ELEMENTARY_X
3099 ecore_x_e_virtual_keyboard_state_set
3100 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
3104 EAPI Elm_Win_Keyboard_Mode
3105 elm_win_keyboard_mode_get(const Evas_Object *obj)
3108 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
3109 win = elm_widget_data_get(obj);
3110 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
3111 return win->kbdmode;
3115 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
3118 ELM_CHECK_WIDTYPE(obj, widtype);
3119 win = elm_widget_data_get(obj);
3121 #ifdef HAVE_ELEMENTARY_X
3122 _elm_win_xwindow_get(win);
3124 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
3131 elm_win_keyboard_win_get(const Evas_Object *obj)
3134 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3135 win = elm_widget_data_get(obj);
3136 if (!win) return EINA_FALSE;
3137 #ifdef HAVE_ELEMENTARY_X
3138 _elm_win_xwindow_get(win);
3140 return ecore_x_e_virtual_keyboard_get(win->xwin);
3145 // WRAPPER: Temperary added.
3147 elm_win_indicator_state_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
3149 elm_win_indicator_mode_set(obj, mode);
3153 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
3156 ELM_CHECK_WIDTYPE(obj, widtype);
3157 win = elm_widget_data_get(obj);
3159 if (mode == win->indmode) return;
3160 #ifdef HAVE_ELEMENTARY_X
3161 _elm_win_xwindow_get(win);
3163 win->indmode = mode;
3164 #ifdef HAVE_ELEMENTARY_X
3167 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
3168 ecore_x_e_illume_indicator_state_set
3169 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
3170 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
3171 ecore_x_e_illume_indicator_state_set
3172 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
3177 // WRAPPER: Temperary added.
3178 EAPI Elm_Win_Indicator_Mode
3179 elm_win_indicator_state_get(const Evas_Object *obj)
3181 return elm_win_indicator_mode_get(obj);
3184 EAPI Elm_Win_Indicator_Mode
3185 elm_win_indicator_mode_get(const Evas_Object *obj)
3188 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
3189 win = elm_widget_data_get(obj);
3190 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
3191 return win->indmode;
3195 elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode)
3198 ELM_CHECK_WIDTYPE(obj, widtype);
3199 win = elm_widget_data_get(obj);
3201 if (mode == win->ind_o_mode) return;
3202 win->ind_o_mode = mode;
3203 #ifdef HAVE_ELEMENTARY_X
3204 _elm_win_xwindow_get(win);
3207 if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
3208 ecore_x_e_illume_indicator_opacity_set
3209 (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
3210 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
3211 ecore_x_e_illume_indicator_opacity_set
3212 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
3213 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
3214 ecore_x_e_illume_indicator_opacity_set
3215 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
3221 EAPI Elm_Win_Indicator_Opacity_Mode
3222 elm_win_indicator_opacity_get(const Evas_Object *obj)
3225 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
3226 win = elm_widget_data_get(obj);
3227 if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
3228 return win->ind_o_mode;
3232 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
3235 ELM_CHECK_WIDTYPE(obj, widtype);
3236 win = elm_widget_data_get(obj);
3238 if (x) *x = win->screen.x;
3239 if (y) *y = win->screen.y;
3243 elm_win_focus_get(const Evas_Object *obj)
3246 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3247 win = elm_widget_data_get(obj);
3248 if (!win) return EINA_FALSE;
3249 return ecore_evas_focus_get(win->ee);
3253 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
3256 ELM_CHECK_WIDTYPE(obj, widtype);
3257 win = elm_widget_data_get(obj);
3259 win->constrain = !!constrain;
3263 elm_win_screen_constrain_get(Evas_Object *obj)
3266 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3267 win = elm_widget_data_get(obj);
3268 if (!win) return EINA_FALSE;
3269 return win->constrain;
3273 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
3276 ELM_CHECK_WIDTYPE(obj, widtype);
3277 win = elm_widget_data_get(obj);
3279 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
3283 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
3286 ELM_CHECK_WIDTYPE(obj, widtype);
3287 win = elm_widget_data_get(obj);
3289 #ifdef HAVE_ELEMENTARY_X
3290 _elm_win_xwindow_get(win);
3292 ecore_x_e_illume_conformant_set(win->xwin, conformant);
3299 elm_win_conformant_get(const Evas_Object *obj)
3302 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3303 win = elm_widget_data_get(obj);
3304 if (!win) return EINA_FALSE;
3305 #ifdef HAVE_ELEMENTARY_X
3306 _elm_win_xwindow_get(win);
3308 return ecore_x_e_illume_conformant_get(win->xwin);
3314 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
3317 ELM_CHECK_WIDTYPE(obj, widtype);
3318 win = elm_widget_data_get(obj);
3320 #ifdef HAVE_ELEMENTARY_X
3321 _elm_win_xwindow_get(win);
3324 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
3327 Ecore_X_Window_State states[2];
3329 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
3330 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
3331 ecore_x_netwm_window_state_set(win->xwin, states, 2);
3332 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
3341 elm_win_quickpanel_get(const Evas_Object *obj)
3344 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3345 win = elm_widget_data_get(obj);
3346 if (!win) return EINA_FALSE;
3347 #ifdef HAVE_ELEMENTARY_X
3348 _elm_win_xwindow_get(win);
3350 return ecore_x_e_illume_quickpanel_get(win->xwin);
3356 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
3359 ELM_CHECK_WIDTYPE(obj, widtype);
3360 win = elm_widget_data_get(obj);
3362 #ifdef HAVE_ELEMENTARY_X
3363 _elm_win_xwindow_get(win);
3365 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
3372 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
3375 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3376 win = elm_widget_data_get(obj);
3377 if (!win) return -1;
3378 #ifdef HAVE_ELEMENTARY_X
3379 _elm_win_xwindow_get(win);
3381 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
3387 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
3390 ELM_CHECK_WIDTYPE(obj, widtype);
3391 win = elm_widget_data_get(obj);
3393 #ifdef HAVE_ELEMENTARY_X
3394 _elm_win_xwindow_get(win);
3396 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3403 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3406 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3407 win = elm_widget_data_get(obj);
3408 if (!win) return -1;
3409 #ifdef HAVE_ELEMENTARY_X
3410 _elm_win_xwindow_get(win);
3412 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3418 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3421 ELM_CHECK_WIDTYPE(obj, widtype);
3422 win = elm_widget_data_get(obj);
3424 #ifdef HAVE_ELEMENTARY_X
3425 _elm_win_xwindow_get(win);
3427 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3434 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3437 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3438 win = elm_widget_data_get(obj);
3440 #ifdef HAVE_ELEMENTARY_X
3441 _elm_win_xwindow_get(win);
3443 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3449 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3452 ELM_CHECK_WIDTYPE(obj, widtype);
3453 win = elm_widget_data_get(obj);
3455 win->skip_focus = skip;
3456 ecore_evas_focus_skip_set(win->ee, skip);
3460 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3463 ELM_CHECK_WIDTYPE(obj, widtype);
3464 win = elm_widget_data_get(obj);
3466 #ifdef HAVE_ELEMENTARY_X
3467 _elm_win_xwindow_get(win);
3472 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3473 ecore_x_e_illume_focus_back_send(win->xwin);
3475 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3476 ecore_x_e_illume_focus_forward_send(win->xwin);
3478 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3479 ecore_x_e_illume_focus_home_send(win->xwin);
3481 case ELM_ILLUME_COMMAND_CLOSE:
3482 ecore_x_e_illume_close_send(win->xwin);
3494 elm_win_inlined_image_object_get(Evas_Object *obj)
3497 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3498 win = elm_widget_data_get(obj);
3499 if (!win) return NULL;
3500 return win->img_obj;
3504 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3508 ELM_CHECK_WIDTYPE(obj, widtype);
3510 win = elm_widget_data_get(obj);
3511 enabled = !!enabled;
3512 if (win->focus_highlight.enabled == enabled)
3515 win->focus_highlight.enabled = enabled;
3517 if (win->focus_highlight.enabled)
3518 _elm_win_focus_highlight_init(win);
3520 _elm_win_focus_highlight_shutdown(win);
3524 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3528 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3530 win = elm_widget_data_get(obj);
3531 return win->focus_highlight.enabled;
3535 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3539 ELM_CHECK_WIDTYPE(obj, widtype);
3541 win = elm_widget_data_get(obj);
3542 eina_stringshare_replace(&win->focus_highlight.style, style);
3543 win->focus_highlight.changed_theme = EINA_TRUE;
3544 _elm_win_focus_highlight_reconfigure_job_start(win);
3548 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3552 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3554 win = elm_widget_data_get(obj);
3555 return win->focus_highlight.style;
3558 typedef struct _Widget_Data Widget_Data;
3563 Evas_Object *content;
3566 static void _del_hook(Evas_Object *obj);
3567 static void _theme_hook(Evas_Object *obj);
3568 static void _sizing_eval(Evas_Object *obj);
3569 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3570 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3572 static const char *widtype2 = NULL;
3575 _del_hook(Evas_Object *obj)
3577 Widget_Data *wd = elm_widget_data_get(obj);
3583 _theme_hook(Evas_Object *obj)
3585 Widget_Data *wd = elm_widget_data_get(obj);
3586 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3588 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3591 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3595 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3597 Widget_Data *wd = elm_widget_data_get(obj);
3602 /* Try Focus cycle in subitem */
3605 elm_widget_focus_next_get(wd->content, dir, next);
3610 *next = (Evas_Object *)obj;
3615 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3617 Widget_Data *wd = elm_widget_data_get(obj);
3619 if (!wd || !item) return;
3620 edje_object_part_text_escaped_set(wd->frm, item, text);
3625 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3627 Widget_Data *wd = elm_widget_data_get(obj);
3629 if (!item || !wd || !wd->frm) return NULL;
3630 return edje_object_part_text_get(wd->frm, item);
3634 _sizing_eval(Evas_Object *obj)
3636 Widget_Data *wd = elm_widget_data_get(obj);
3637 Evas_Coord minw = -1, minh = -1;
3639 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3640 edje_object_size_min_calc(wd->frm, &minw, &minh);
3641 evas_object_size_hint_min_set(obj, minw, minh);
3642 evas_object_size_hint_max_set(obj, -1, -1);
3646 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3652 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3654 Widget_Data *wd = elm_widget_data_get(obj);
3655 Evas_Object *sub = event_info;
3656 if (sub == wd->content)
3658 evas_object_event_callback_del_full
3659 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3666 elm_win_inwin_add(Evas_Object *obj)
3672 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3673 win = elm_widget_data_get(obj);
3674 if (!win) return NULL;
3675 wd = ELM_NEW(Widget_Data);
3676 obj2 = elm_widget_add(win->evas);
3677 elm_widget_type_set(obj2, "inwin");
3678 ELM_SET_WIDTYPE(widtype2, "inwin");
3679 elm_widget_sub_object_add(obj, obj2);
3680 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3681 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3682 elm_win_resize_object_add(obj, obj2);
3684 elm_widget_data_set(obj2, wd);
3685 elm_widget_del_hook_set(obj2, _del_hook);
3686 elm_widget_theme_hook_set(obj2, _theme_hook);
3687 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3688 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3689 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3690 elm_widget_can_focus_set(obj2, EINA_TRUE);
3691 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3693 wd->frm = edje_object_add(win->evas);
3694 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3695 elm_widget_resize_object_set(obj2, wd->frm);
3697 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3704 elm_win_inwin_activate(Evas_Object *obj)
3706 ELM_CHECK_WIDTYPE(obj, widtype2);
3707 Widget_Data *wd = elm_widget_data_get(obj);
3709 evas_object_raise(obj);
3710 evas_object_show(obj);
3711 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3712 elm_object_focus_set(obj, EINA_TRUE);
3716 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3718 ELM_CHECK_WIDTYPE(obj, widtype2);
3719 Widget_Data *wd = elm_widget_data_get(obj);
3721 if (wd->content == content) return;
3722 if (wd->content) evas_object_del(wd->content);
3723 wd->content = content;
3726 elm_widget_sub_object_add(obj, content);
3727 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3728 _changed_size_hints, obj);
3729 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3735 elm_win_inwin_content_get(const Evas_Object *obj)
3737 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3738 Widget_Data *wd = elm_widget_data_get(obj);
3739 if (!wd) return NULL;
3744 elm_win_inwin_content_unset(Evas_Object *obj)
3746 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3747 Widget_Data *wd = elm_widget_data_get(obj);
3748 if (!wd) return NULL;
3749 if (!wd->content) return NULL;
3750 Evas_Object *content = wd->content;
3751 elm_widget_sub_object_del(obj, wd->content);
3752 evas_object_event_callback_del_full(wd->content,
3753 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3754 _changed_size_hints, obj);
3755 edje_object_part_unswallow(wd->frm, wd->content);
3761 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3766 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3767 win = elm_widget_data_get(obj);
3768 if (!win) return EINA_FALSE;
3769 if (!win->ee) return EINA_FALSE;
3771 if (!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3777 /* windowing specific calls - shall we do this differently? */
3779 static Ecore_X_Window
3780 _elm_ee_win_get(const Evas_Object *obj)
3783 #ifdef HAVE_ELEMENTARY_X
3784 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3785 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3791 elm_win_xwindow_get(const Evas_Object *obj)
3797 type = elm_widget_type_get(obj);
3798 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3799 win = elm_widget_data_get(obj);
3801 #ifdef HAVE_ELEMENTARY_X
3802 if (win->xwin) return win->xwin;
3803 if (win->parent) return elm_win_xwindow_get(win->parent);
3809 elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool floating)
3812 ELM_CHECK_WIDTYPE(obj, widtype);
3813 win = elm_widget_data_get(obj);
3815 if (floating == win->floating) return;
3816 #ifdef HAVE_ELEMENTARY_X
3817 _elm_win_xwindow_get(win);
3819 win->floating = floating;
3820 #ifdef HAVE_ELEMENTARY_X
3824 ecore_x_e_illume_window_state_set
3825 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_FLOATING);
3827 ecore_x_e_illume_window_state_set
3828 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_NORMAL);
3834 elm_win_floating_mode_get(const Evas_Object *obj)
3837 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3838 win = elm_widget_data_get(obj);
3839 if (!win) return EINA_FALSE;
3841 return win->floating;