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;
15 Ecore_Event_Handler *property_handler;
17 Ecore_Job *deferred_resize_job;
18 Ecore_Job *deferred_child_eval_job;
21 Elm_Win_Keyboard_Mode kbdmode;
22 Elm_Win_Indicator_Mode indmode;
23 Elm_Win_Indicator_Opacity_Mode ind_o_mode;
32 int *autodel_clear, rot;
42 Evas_Object *obj, *hot_obj;
52 Eina_Bool visible : 1;
53 Eina_Bool handled : 1;
57 Ecore_Job *reconf_job;
59 Eina_Bool enabled : 1;
60 Eina_Bool changed_theme : 1;
61 Eina_Bool top_animate : 1;
62 Eina_Bool geometry_changed : 1;
73 const char *icon_name;
79 Eina_Bool demand_attention : 1;
80 Eina_Bool autodel : 1;
81 Eina_Bool constrain : 1;
82 Eina_Bool resizing : 1;
83 Eina_Bool iconified : 1;
84 Eina_Bool withdrawn : 1;
86 Eina_Bool fullscreen : 1;
87 Eina_Bool maximized : 1;
88 Eina_Bool skip_focus : 1;
89 Eina_Bool floating : 1;
92 static const char *widtype = NULL;
93 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
94 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
95 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
96 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
97 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
98 static void _elm_win_move(Ecore_Evas *ee);
99 static void _elm_win_resize(Ecore_Evas *ee);
100 static void _elm_win_delete_request(Ecore_Evas *ee);
101 static void _elm_win_resize_job(void *data);
102 #ifdef HAVE_ELEMENTARY_X
103 static void _elm_win_xwin_update(Elm_Win *win);
105 static void _elm_win_eval_subobjs(Evas_Object *obj);
106 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
107 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
108 static void _elm_win_focus_highlight_init(Elm_Win *win);
109 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
110 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
111 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
112 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
113 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
114 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
116 static void _elm_win_frame_add(Elm_Win *win, const char *style);
117 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
118 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
119 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
120 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
121 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
123 //static void _elm_win_pointer_add(Elm_Win *win, const char *style);
125 static const char SIG_DELETE_REQUEST[] = "delete,request";
126 static const char SIG_FOCUS_OUT[] = "focus,out";
127 static const char SIG_FOCUS_IN[] = "focus,in";
128 static const char SIG_MOVED[] = "moved";
129 static const char SIG_THEME_CHANGED[] = "theme,changed";
130 static const char SIG_WITHDRAWN[] = "withdrawn";
131 static const char SIG_ICONIFIED[] = "iconified";
132 static const char SIG_NORMAL[] = "normal";
133 static const char SIG_STICK[] = "stick";
134 static const char SIG_UNSTICK[] = "unstick";
135 static const char SIG_FULLSCREEN[] = "fullscreen";
136 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
137 static const char SIG_MAXIMIZED[] = "maximized";
138 static const char SIG_UNMAXIMIZED[] = "unmaximized";
139 static const char SIG_PROFILE_CHANGED[] = "profile,changed";
141 static const Evas_Smart_Cb_Description _signals[] = {
142 {SIG_DELETE_REQUEST, ""},
151 {SIG_FULLSCREEN, ""},
152 {SIG_UNFULLSCREEN, ""},
154 {SIG_UNMAXIMIZED, ""},
155 {SIG_PROFILE_CHANGED, ""},
161 Eina_List *_elm_win_list = NULL;
162 int _elm_win_deferred_free = 0;
164 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
165 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
168 _shot_delay_get(Elm_Win *win)
171 char *d = strdup(win->shot.info);
174 for (p = (char *)win->shot.info; *p; p++)
176 if (!strncmp(p, "delay=", 6))
180 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
195 _shot_file_get(Elm_Win *win)
198 char *tmp = strdup(win->shot.info);
199 char *repname = NULL;
201 if (!tmp) return NULL;
203 for (p = (char *)win->shot.info; *p; p++)
205 if (!strncmp(p, "file=", 5))
208 if (!win->shot.repeat_count) return tmp;
211 char *dotptr = strrchr(tmp, '.');
214 size_t size = sizeof(char)*(strlen(tmp) + 16);
215 repname = malloc(size);
216 strncpy(repname, tmp, dotptr - tmp);
217 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
218 win->shot.shot_counter + 1);
219 strcat(repname, dotptr);
227 if (!win->shot.repeat_count) return strdup("out.png");
229 repname = malloc(sizeof(char) * 24);
230 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
235 _shot_repeat_count_get(Elm_Win *win)
238 char *d = strdup(win->shot.info);
241 for (p = (char *)win->shot.info; *p; p++)
243 if (!strncmp(p, "repeat=", 7))
247 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
254 if (v > 1000) v = 999;
264 _shot_key_get(Elm_Win *win __UNUSED__)
270 _shot_flags_get(Elm_Win *win __UNUSED__)
276 _shot_do(Elm_Win *win)
280 unsigned int *pixels;
282 char *file, *key, *flags;
284 ecore_evas_manual_render(win->ee);
285 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
287 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
288 if ((w < 1) || (h < 1)) return;
289 file = _shot_file_get(win);
291 key = _shot_key_get(win);
292 flags = _shot_flags_get(win);
293 ee = ecore_evas_buffer_new(1, 1);
294 o = evas_object_image_add(ecore_evas_get(ee));
295 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
296 evas_object_image_size_set(o, w, h);
297 evas_object_image_data_set(o, pixels);
298 if (!evas_object_image_save(o, file, key, flags))
300 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
305 if (flags) free(flags);
307 if (win->shot.repeat_count) win->shot.shot_counter++;
311 _shot_delay(void *data)
315 if (win->shot.repeat_count)
317 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
318 if (remainshot > 0) return EINA_TRUE;
320 win->shot.timer = NULL;
326 _shot_init(Elm_Win *win)
328 if (!win->shot.info) return;
329 win->shot.repeat_count = _shot_repeat_count_get(win);
330 win->shot.shot_counter = 0;
334 _shot_handle(Elm_Win *win)
336 if (!win->shot.info) return;
337 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
341 _elm_win_move(Ecore_Evas *ee)
343 Evas_Object *obj = ecore_evas_object_associate_get(ee);
348 win = elm_widget_data_get(obj);
350 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
353 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
357 _elm_win_resize(Ecore_Evas *ee)
359 Evas_Object *obj = ecore_evas_object_associate_get(ee);
363 win = elm_widget_data_get(obj);
365 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
366 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
370 _elm_win_mouse_in(Ecore_Evas *ee)
375 if (!(obj = ecore_evas_object_associate_get(ee))) return;
376 if (!(win = elm_widget_data_get(obj))) return;
377 if (win->resizing) win->resizing = EINA_FALSE;
381 _elm_win_focus_in(Ecore_Evas *ee)
383 Evas_Object *obj = ecore_evas_object_associate_get(ee);
387 win = elm_widget_data_get(obj);
389 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
390 if (!elm_widget_focus_order_get(obj))
392 elm_widget_focus_steal(win->win_obj);
396 elm_widget_focus_restore(win->win_obj);
397 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
398 win->focus_highlight.cur.visible = EINA_TRUE;
399 _elm_win_focus_highlight_reconfigure_job_start(win);
402 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
404 else if (win->img_obj)
411 _elm_win_focus_out(Ecore_Evas *ee)
413 Evas_Object *obj = ecore_evas_object_associate_get(ee);
417 win = elm_widget_data_get(obj);
419 elm_object_focus_set(win->win_obj, EINA_FALSE);
420 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
421 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
422 win->focus_highlight.cur.visible = EINA_FALSE;
423 _elm_win_focus_highlight_reconfigure_job_start(win);
426 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
428 else if (win->img_obj)
435 _elm_win_profile_update(Ecore_Evas *ee)
437 Evas_Object *obj = ecore_evas_object_associate_get(ee);
441 win = elm_widget_data_get(obj);
444 if (win->profile.timer)
445 ecore_timer_del(win->profile.timer);
446 win->profile.timer = NULL;
448 /* TODO: We need the ability to bind a profile to a specific window.
449 * Elementary's configuration still has a single global profile for the app.
451 _elm_config_profile_set(win->profile.name);
453 evas_object_smart_callback_call(win->win_obj, SIG_PROFILE_CHANGED, NULL);
457 _elm_win_profile_change_delay(void *data)
461 Eina_Bool changed = EINA_FALSE;
463 profile = eina_list_nth(win->profile.names, 0);
466 if (win->profile.name)
468 if (strcmp(win->profile.name, profile))
470 eina_stringshare_replace(&(win->profile.name), profile);
476 win->profile.name = eina_stringshare_add(profile);
480 win->profile.timer = NULL;
481 if (changed) _elm_win_profile_update(win->ee);
486 _elm_win_state_change(Ecore_Evas *ee)
490 Eina_Bool ch_withdrawn = EINA_FALSE;
491 Eina_Bool ch_sticky = EINA_FALSE;
492 Eina_Bool ch_iconified = EINA_FALSE;
493 Eina_Bool ch_fullscreen = EINA_FALSE;
494 Eina_Bool ch_maximized = EINA_FALSE;
495 Eina_Bool ch_profile = EINA_FALSE;
498 if (!(obj = ecore_evas_object_associate_get(ee))) return;
500 if (!(win = elm_widget_data_get(obj))) return;
502 if (win->withdrawn != ecore_evas_withdrawn_get(win->ee))
504 win->withdrawn = ecore_evas_withdrawn_get(win->ee);
505 ch_withdrawn = EINA_TRUE;
507 if (win->sticky != ecore_evas_sticky_get(win->ee))
509 win->sticky = ecore_evas_sticky_get(win->ee);
510 ch_sticky = EINA_TRUE;
512 if (win->iconified != ecore_evas_iconified_get(win->ee))
514 win->iconified = ecore_evas_iconified_get(win->ee);
515 ch_iconified = EINA_TRUE;
517 if (win->fullscreen != ecore_evas_fullscreen_get(win->ee))
519 win->fullscreen = ecore_evas_fullscreen_get(win->ee);
520 ch_fullscreen = EINA_TRUE;
522 if (win->maximized != ecore_evas_maximized_get(win->ee))
524 win->maximized = ecore_evas_maximized_get(win->ee);
525 ch_maximized = EINA_TRUE;
527 profile = ecore_evas_profile_get(win->ee);
529 _elm_config_profile_exists(profile))
531 if (win->profile.name)
533 if (strcmp(win->profile.name, profile))
535 eina_stringshare_replace(&(win->profile.name), profile);
536 ch_profile = EINA_TRUE;
541 win->profile.name = eina_stringshare_add(profile);
542 ch_profile = EINA_TRUE;
545 if ((ch_withdrawn) || (ch_iconified))
548 evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL);
549 else if (win->iconified)
550 evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL);
552 evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL);
557 evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL);
559 evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL);
564 evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL);
566 evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL);
571 evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL);
573 evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL);
577 _elm_win_profile_update(win->ee);
582 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
584 Elm_Win *wd = elm_widget_data_get(obj);
585 const Eina_List *items;
586 const Eina_List *list;
587 void *(*list_data_get) (const Eina_List *list);
591 list = elm_widget_sub_object_list_get(obj);
596 if (!(items = elm_widget_focus_custom_chain_get(obj)))
599 list_data_get = eina_list_data_get;
601 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
606 *next = (Evas_Object *)obj;
611 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
613 Elm_Win *win = elm_widget_data_get(obj);
617 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
619 evas_object_focus_set(obj, elm_widget_focus_get(obj));
623 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
625 if (type == EVAS_CALLBACK_KEY_DOWN)
627 Evas_Event_Key_Down *ev = event_info;
628 if (!strcmp(ev->keyname, "Tab"))
630 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
631 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
633 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
634 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
637 else if ((!strcmp(ev->keyname, "Left")) ||
638 ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
640 //TODO : woohyun jung
642 else if ((!strcmp(ev->keyname, "Right")) ||
643 ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
645 //TODO : woohyun jung
647 else if ((!strcmp(ev->keyname, "Up")) ||
648 ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
650 //TODO : woohyun jung
652 else if ((!strcmp(ev->keyname, "Down")) ||
653 ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
655 //TODO : woohyun jung
663 _deferred_ecore_evas_free(void *data)
665 ecore_evas_free(data);
666 _elm_win_deferred_free--;
670 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
674 if (!win->show_count) win->show_count++;
675 if (win->shot.info) _shot_handle(win);
679 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
685 evas_object_hide(win->frame_obj);
687 else if (win->img_obj)
689 evas_object_hide(win->img_obj);
691 if (win->pointer.obj)
693 evas_object_hide(win->pointer.obj);
694 ecore_evas_hide(win->pointer.ee);
699 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
706 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
709 Evas_Object *child, *child2 = NULL;
714 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
715 _elm_win_obj_callback_parent_del, win);
718 if (win->autodel_clear) *(win->autodel_clear) = -1;
719 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
720 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
723 ecore_evas_callback_delete_request_set(win->ee, NULL);
724 ecore_evas_callback_resize_set(win->ee, NULL);
726 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
727 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
728 if (win->shot.info) eina_stringshare_del(win->shot.info);
729 if (win->shot.timer) ecore_timer_del(win->shot.timer);
730 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
731 _elm_win_obj_callback_del, win);
732 child = evas_object_bottom_get(win->evas);
735 /* if the object we see *IS* the window object (because we are
736 * faking a parent object inside the canvas), then skip it and
737 * go to the next one */
740 child = evas_object_above_get(child);
743 /* if we are using the next object above from the previous loop */
746 /* this object has refcounts from the previous loop */
747 child2 = evas_object_above_get(child);
748 if (child2) evas_object_ref(child2);
749 evas_object_del(child);
750 /* so unref from previous loop */
751 evas_object_unref(child);
756 /* just delete as normal (probably only first object */
757 child2 = evas_object_above_get(child);
758 if (child2) evas_object_ref(child2);
759 evas_object_del(child);
763 #ifdef HAVE_ELEMENTARY_X
764 if (win->client_message_handler)
765 ecore_event_handler_del(win->client_message_handler);
766 if (win->property_handler)
767 ecore_event_handler_del(win->property_handler);
769 // FIXME: Why are we flushing edje on every window destroy ??
770 // edje_file_cache_flush();
771 // edje_collection_cache_flush();
772 // evas_image_cache_flush(win->evas);
773 // evas_font_cache_flush(win->evas);
774 // FIXME: we are in the del handler for the object and delete the canvas
775 // that lives under it from the handler... nasty. deferring doesn't help either
779 evas_object_event_callback_del_full
780 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
787 ecore_job_add(_deferred_ecore_evas_free, win->ee);
788 _elm_win_deferred_free++;
792 _elm_win_focus_highlight_shutdown(win);
793 eina_stringshare_del(win->focus_highlight.style);
795 if (win->title) eina_stringshare_del(win->title);
796 if (win->icon_name) eina_stringshare_del(win->icon_name);
797 if (win->role) eina_stringshare_del(win->role);
798 if (win->icon) evas_object_del(win->icon);
800 EINA_LIST_FREE(win->profile.names, str) eina_stringshare_del(str);
801 if (win->profile.name) eina_stringshare_del(win->profile.name);
802 if (win->profile.timer) ecore_timer_del(win->profile.timer);
806 if ((!_elm_win_list) &&
807 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
809 edje_file_cache_flush();
810 edje_collection_cache_flush();
811 evas_image_cache_flush(e);
812 evas_font_cache_flush(e);
819 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
822 if (obj == win->parent) win->parent = NULL;
826 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
832 if ((x != win->screen.x) || (y != win->screen.y))
836 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
841 evas_object_move(obj, x, y);
846 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
849 // this is called to make sure all smart containers have calculated their
850 // sizes BEFORE we show the window to make sure it initially appears at
851 // our desired size (ie min size is known first)
852 evas_smart_objects_calculate(evas_object_evas_get(obj));
855 evas_object_show(win->frame_obj);
857 else if (win->img_obj)
859 evas_object_show(win->img_obj);
861 if (win->pointer.obj)
863 ecore_evas_show(win->pointer.ee);
864 evas_object_show(win->pointer.obj);
865 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
867 evas_object_show(obj);
871 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
875 if (ecore_evas_override_get(win->ee))
879 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
882 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
888 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
892 /* FIXME: We should update ecore_wl_window_location here !! */
894 else if (win->img_obj)
898 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
901 // evas_object_move(win->img_obj, x, y);
906 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
913 else if (win->img_obj)
915 Evas_Coord w = 1, h = 1;
917 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
921 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
927 evas_object_image_size_set(win->img_obj, w, h);
932 _elm_win_delete_request(Ecore_Evas *ee)
934 Evas_Object *obj = ecore_evas_object_associate_get(ee);
936 if (strcmp(elm_widget_type_get(obj), "win")) return;
938 win = elm_widget_data_get(obj);
940 int autodel = win->autodel;
941 win->autodel_clear = &autodel;
942 evas_object_ref(win->win_obj);
943 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
944 // FIXME: if above callback deletes - then the below will be invalid
945 if (autodel) evas_object_del(win->win_obj);
946 else win->autodel_clear = NULL;
947 evas_object_unref(win->win_obj);
951 _elm_win_resize_job(void *data)
958 win->deferred_resize_job = NULL;
959 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
963 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
969 evas_object_resize(win->frame_obj, w, h);
971 else if (win->img_obj)
974 evas_object_resize(win->win_obj, w, h);
975 EINA_LIST_FOREACH(win->subobjs, l, obj)
977 evas_object_move(obj, 0, 0);
978 evas_object_resize(obj, w, h);
982 #ifdef HAVE_ELEMENTARY_X
984 _elm_win_xwindow_get(Elm_Win *win)
988 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
989 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
991 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
993 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
994 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
995 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
996 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
997 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
998 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
999 ENGINE_COMPARE(ELM_OPENGL_COCOA))
1002 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1004 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
1006 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1008 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
1011 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1013 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
1016 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1018 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
1020 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1022 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
1024 #undef ENGINE_COMPARE
1028 #ifdef HAVE_ELEMENTARY_X
1030 _elm_win_xwin_update(Elm_Win *win)
1033 Elm_Win_Indicator_Mode mode;
1035 _elm_win_xwindow_get(win);
1040 win2 = elm_widget_data_get(win->parent);
1044 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
1048 if (!win->xwin) return; /* nothing more to do */
1051 if (!s) s = _elm_appname;
1053 if (win->icon_name) s = win->icon_name;
1054 ecore_x_icccm_icon_name_set(win->xwin, s);
1055 ecore_x_netwm_icon_name_set(win->xwin, s);
1058 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
1065 data = evas_object_image_data_get(win->icon, EINA_FALSE);
1069 int w = 0, h = 0, stride, x, y;
1073 evas_object_image_size_get(win->icon, &w, &h);
1074 stride = evas_object_image_stride_get(win->icon);
1075 if ((w > 0) && (h > 0) &&
1076 (stride >= (int)(w * sizeof(unsigned int))))
1080 ic.data = malloc(w * h * sizeof(unsigned int));
1084 p = (unsigned char *)data;
1085 p2 = (unsigned int *)ic.data;
1086 for (y = 0; y < h; y++)
1088 for (x = 0; x < w; x++)
1090 *p2 = *((unsigned int *)p);
1091 p += sizeof(unsigned int);
1094 p += (stride - (w * sizeof(unsigned int)));
1096 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
1100 evas_object_image_data_set(win->icon, data);
1107 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
1109 case ELM_WIN_DIALOG_BASIC:
1110 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
1112 case ELM_WIN_DESKTOP:
1113 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1116 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
1118 case ELM_WIN_TOOLBAR:
1119 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1122 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1124 case ELM_WIN_UTILITY:
1125 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1127 case ELM_WIN_SPLASH:
1128 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1130 case ELM_WIN_DROPDOWN_MENU:
1131 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1133 case ELM_WIN_POPUP_MENU:
1134 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1136 case ELM_WIN_TOOLTIP:
1137 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1139 case ELM_WIN_NOTIFICATION:
1140 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1143 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1146 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1151 ecore_x_e_virtual_keyboard_state_set
1152 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1154 mode = ecore_x_e_illume_indicator_state_get(win->xwin);
1155 if (mode != win->indmode)
1157 if (mode == ELM_WIN_INDICATOR_SHOW)
1158 ecore_x_e_illume_indicator_state_set
1159 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1160 else if (mode == ELM_WIN_INDICATOR_HIDE)
1161 ecore_x_e_illume_indicator_state_set
1162 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1168 _elm_win_eval_subobjs(Evas_Object *obj)
1171 const Evas_Object *child;
1173 Elm_Win *win = elm_widget_data_get(obj);
1174 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1178 EINA_LIST_FOREACH(win->subobjs, l, child)
1180 evas_object_size_hint_weight_get(child, &wx, &wy);
1181 if (wx == 0.0) xx = 0;
1182 if (wy == 0.0) xy = 0;
1184 evas_object_size_hint_min_get(child, &w, &h);
1187 if (w > minw) minw = w;
1188 if (h > minh) minh = h;
1190 evas_object_size_hint_max_get(child, &w, &h);
1193 if (maxw == -1) maxw = w;
1194 else if ((w > 0) && (w < maxw)) maxw = w;
1195 if (maxh == -1) maxh = h;
1196 else if ((h > 0) && (h < maxh)) maxh = h;
1198 if (!xx) maxw = minw;
1200 if (!xy) maxh = minh;
1202 evas_object_size_hint_min_set(obj, minw, minh);
1203 evas_object_size_hint_max_set(obj, maxw, maxh);
1204 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1205 if (w < minw) w = minw;
1206 if (h < minh) h = minh;
1207 if ((maxw >= 0) && (w > maxw)) w = maxw;
1208 if ((maxh >= 0) && (h > maxh)) h = maxh;
1209 evas_object_resize(obj, w, h);
1213 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1215 Elm_Win *win = elm_widget_data_get(data);
1216 win->subobjs = eina_list_remove(win->subobjs, obj);
1217 _elm_win_eval_subobjs(win->win_obj);
1221 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1223 _elm_win_eval_subobjs(data);
1227 _elm_win_shutdown(void)
1229 while (_elm_win_list)
1230 evas_object_del(_elm_win_list->data);
1234 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1241 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1242 elm_widget_theme(obj);
1246 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1247 elm_widget_theme_specific(obj, th, EINA_FALSE);
1252 _elm_win_translate(void)
1257 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1258 elm_widget_translate(obj);
1261 #ifdef HAVE_ELEMENTARY_X
1263 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1265 Elm_Win *win = data;
1266 Ecore_X_Event_Client_Message *e = event;
1268 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1269 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1271 if ((unsigned)e->data.l[0] == win->xwin)
1273 Evas *evas = evas_object_evas_get(win->win_obj);
1276 edje_file_cache_flush();
1277 edje_collection_cache_flush();
1278 evas_image_cache_flush(evas);
1279 evas_font_cache_flush(evas);
1283 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1285 if ((unsigned)e->data.l[0] == win->xwin)
1287 Evas *evas = evas_object_evas_get(win->win_obj);
1290 edje_file_cache_flush();
1291 edje_collection_cache_flush();
1292 evas_image_cache_flush(evas);
1293 evas_font_cache_flush(evas);
1294 evas_render_dump(evas);
1298 return ECORE_CALLBACK_PASS_ON;
1302 _elm_win_property_change(void *data, int type __UNUSED__, void *event)
1304 Elm_Win *win = data;
1305 Ecore_X_Event_Window_Property *e = event;
1307 if (e->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE)
1309 if (e->win == win->xwin)
1311 win->indmode = ecore_x_e_illume_indicator_state_get(e->win);
1314 return ECORE_CALLBACK_PASS_ON;
1319 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1321 Elm_Win *win = data;
1323 win->focus_highlight.geometry_changed = EINA_TRUE;
1324 _elm_win_focus_highlight_reconfigure_job_start(win);
1328 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1330 Elm_Win *win = data;
1332 win->focus_highlight.geometry_changed = EINA_TRUE;
1333 _elm_win_focus_highlight_reconfigure_job_start(win);
1337 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1339 Elm_Win *win = data;
1341 win->focus_highlight.cur.target = NULL;
1343 _elm_win_focus_highlight_reconfigure_job_start(win);
1347 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1349 Evas_Object *obj = win->focus_highlight.cur.target;
1351 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1352 _elm_win_focus_target_move, win);
1353 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1354 _elm_win_focus_target_resize, win);
1355 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1356 _elm_win_focus_target_del, win);
1360 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1362 Evas_Object *obj = win->focus_highlight.cur.target;
1364 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1365 _elm_win_focus_target_move, win);
1366 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1367 _elm_win_focus_target_resize, win);
1368 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1369 _elm_win_focus_target_del, win);
1372 static Evas_Object *
1373 _elm_win_focus_target_get(Evas_Object *obj)
1375 Evas_Object *o = obj;
1379 if (elm_widget_is(o))
1381 if (!elm_widget_highlight_ignore_get(o))
1383 o = elm_widget_parent_get(o);
1385 o = evas_object_smart_parent_get(o);
1389 o = elm_widget_parent_widget_get(o);
1391 o = evas_object_smart_parent_get(o);
1400 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1402 Evas_Object *obj = event_info, *target;
1403 Elm_Win *win = data;
1405 if (win->focus_highlight.cur.target == obj)
1408 target = _elm_win_focus_target_get(obj);
1409 win->focus_highlight.cur.target = target;
1410 if (elm_widget_highlight_in_theme_get(target))
1411 win->focus_highlight.cur.handled = EINA_TRUE;
1413 _elm_win_focus_target_callbacks_add(win);
1415 _elm_win_focus_highlight_reconfigure_job_start(win);
1419 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1421 Elm_Win *win = data;
1423 if (!win->focus_highlight.cur.target)
1426 if (!win->focus_highlight.cur.handled)
1427 _elm_win_focus_target_callbacks_del(win);
1428 win->focus_highlight.cur.target = NULL;
1429 win->focus_highlight.cur.handled = EINA_FALSE;
1431 _elm_win_focus_highlight_reconfigure_job_start(win);
1435 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1437 evas_object_hide(obj);
1441 _elm_win_focus_highlight_init(Elm_Win *win)
1443 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1444 _elm_win_object_focus_in, win);
1445 evas_event_callback_add(win->evas,
1446 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1447 _elm_win_object_focus_out, win);
1449 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1451 win->focus_highlight.top = edje_object_add(win->evas);
1452 win->focus_highlight.changed_theme = EINA_TRUE;
1453 edje_object_signal_callback_add(win->focus_highlight.top,
1454 "elm,action,focus,hide,end", "",
1455 _elm_win_focus_highlight_hide, NULL);
1456 edje_object_signal_callback_add(win->focus_highlight.top,
1457 "elm,action,focus,anim,end", "",
1458 _elm_win_focus_highlight_anim_end, win);
1459 _elm_win_focus_highlight_reconfigure_job_start(win);
1463 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1465 _elm_win_focus_highlight_reconfigure_job_stop(win);
1466 if (win->focus_highlight.cur.target)
1468 _elm_win_focus_target_callbacks_del(win);
1469 win->focus_highlight.cur.target = NULL;
1471 if (win->focus_highlight.top)
1473 evas_object_del(win->focus_highlight.top);
1474 win->focus_highlight.top = NULL;
1477 evas_event_callback_del_full(win->evas,
1478 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1479 _elm_win_object_focus_in, win);
1480 evas_event_callback_del_full(win->evas,
1481 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1482 _elm_win_object_focus_out, win);
1486 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1490 top = win->focus_highlight.top;
1495 evas_object_show(top);
1496 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1502 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1507 _elm_win_focus_highlight_reconfigure_job(void *data)
1509 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1513 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1515 if (win->focus_highlight.reconf_job)
1516 ecore_job_del(win->focus_highlight.reconf_job);
1517 win->focus_highlight.reconf_job = ecore_job_add(
1518 _elm_win_focus_highlight_reconfigure_job, win);
1522 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1524 if (win->focus_highlight.reconf_job)
1525 ecore_job_del(win->focus_highlight.reconf_job);
1526 win->focus_highlight.reconf_job = NULL;
1530 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1532 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1533 Evas_Coord x, y, w, h;
1535 clip = evas_object_clip_get(target);
1536 evas_object_geometry_get(target, &x, &y, &w, &h);
1538 evas_object_move(obj, x, y);
1539 evas_object_resize(obj, w, h);
1540 evas_object_clip_set(obj, clip);
1544 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1546 Evas_Coord tx, ty, tw, th;
1547 Evas_Coord w, h, px, py, pw, ph;
1548 Edje_Message_Int_Set *m;
1549 Evas_Object *previous = win->focus_highlight.prev.target;
1550 Evas_Object *target = win->focus_highlight.cur.target;
1552 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1553 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1554 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1555 evas_object_move(obj, 0, 0);
1556 evas_object_resize(obj, tw, th);
1557 evas_object_clip_unset(obj);
1559 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1569 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1573 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1575 Elm_Win *win = data;
1576 _elm_win_focus_highlight_simple_setup(win, obj);
1580 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1582 Evas_Object *target = win->focus_highlight.cur.target;
1583 Evas_Object *previous = win->focus_highlight.prev.target;
1584 Evas_Object *top = win->focus_highlight.top;
1585 Eina_Bool visible_changed;
1586 Eina_Bool common_visible;
1587 const char *sig = NULL;
1589 _elm_win_focus_highlight_reconfigure_job_stop(win);
1591 visible_changed = (win->focus_highlight.cur.visible !=
1592 win->focus_highlight.prev.visible);
1594 if ((target == previous) && (!visible_changed) &&
1595 (!win->focus_highlight.geometry_changed))
1598 if ((previous) && (win->focus_highlight.prev.handled))
1599 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1602 common_visible = EINA_FALSE;
1603 else if (win->focus_highlight.cur.handled)
1605 common_visible = EINA_FALSE;
1606 if (win->focus_highlight.cur.visible)
1607 sig = "elm,action,focus_highlight,show";
1609 sig = "elm,action,focus_highlight,hide";
1612 common_visible = win->focus_highlight.cur.visible;
1614 _elm_win_focus_highlight_visible_set(win, common_visible);
1616 elm_widget_signal_emit(target, sig, "elm");
1618 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1621 if (win->focus_highlight.changed_theme)
1624 if (win->focus_highlight.style)
1625 str = win->focus_highlight.style;
1628 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1630 win->focus_highlight.changed_theme = EINA_FALSE;
1632 if (_elm_config->focus_highlight_animate)
1634 str = edje_object_data_get(win->focus_highlight.top, "animate");
1635 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1639 if ((win->focus_highlight.top_animate) && (previous) &&
1640 (!win->focus_highlight.prev.handled))
1641 _elm_win_focus_highlight_anim_setup(win, top);
1643 _elm_win_focus_highlight_simple_setup(win, top);
1644 evas_object_raise(top);
1647 win->focus_highlight.geometry_changed = EINA_FALSE;
1648 win->focus_highlight.prev = win->focus_highlight.cur;
1652 _elm_win_frame_add(Elm_Win *win, const char *style)
1654 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1656 win->frame_obj = edje_object_add(win->evas);
1657 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1658 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1659 evas_object_move(win->frame_obj, 0, 0);
1660 evas_object_resize(win->frame_obj, 1, 1);
1662 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1663 "elm", _elm_win_frame_cb_move_start, win);
1664 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1665 "*", _elm_win_frame_cb_resize_start, win);
1666 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1667 "elm", _elm_win_frame_cb_minimize, win);
1668 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1669 "elm", _elm_win_frame_cb_maximize, win);
1670 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1671 "elm", _elm_win_frame_cb_close, win);
1675 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1679 if (!(win = data)) return;
1680 /* FIXME: Change mouse pointer */
1682 /* NB: Wayland handles moving surfaces by itself so we cannot
1683 * specify a specific x/y we want. Instead, we will pass in the
1684 * existing x/y values so they can be recorded as 'previous' position.
1685 * The new position will get updated automatically when the move is
1688 ecore_evas_wayland_move(win->ee, win->screen.x, win->screen.y);
1692 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1696 if (!(win = data)) return;
1697 if (win->resizing) return;
1698 win->resizing = EINA_TRUE;
1700 /* FIXME: Change mouse pointer */
1702 if (!strcmp(source, "elm.event.resize.t"))
1703 win->resize_location = 1;
1704 else if (!strcmp(source, "elm.event.resize.b"))
1705 win->resize_location = 2;
1706 else if (!strcmp(source, "elm.event.resize.l"))
1707 win->resize_location = 4;
1708 else if (!strcmp(source, "elm.event.resize.r"))
1709 win->resize_location = 8;
1710 else if (!strcmp(source, "elm.event.resize.tl"))
1711 win->resize_location = 5;
1712 else if (!strcmp(source, "elm.event.resize.tr"))
1713 win->resize_location = 9;
1714 else if (!strcmp(source, "elm.event.resize.bl"))
1715 win->resize_location = 6;
1716 else if (!strcmp(source, "elm.event.resize.br"))
1717 win->resize_location = 10;
1719 win->resize_location = 0;
1721 if (win->resize_location > 0)
1722 ecore_evas_wayland_resize(win->ee, win->resize_location);
1726 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1730 if (!(win = data)) return;
1731 win->iconified = EINA_TRUE;
1732 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1736 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1740 if (!(win = data)) return;
1741 if (win->maximized) win->maximized = EINA_FALSE;
1742 else win->maximized = EINA_TRUE;
1743 ecore_evas_maximized_set(win->ee, win->maximized);
1747 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1751 if (!(win = data)) return;
1752 evas_object_del(win->win_obj);
1757 _elm_win_pointer_add(Elm_Win *win, const char *style)
1763 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1764 ecore_evas_resize(win->pointer.ee, 32, 32);
1766 win->pointer.evas = ecore_evas_get(win->ee);
1768 win->pointer.obj = edje_object_add(win->pointer.evas);
1769 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1770 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1771 evas_object_move(win->pointer.obj, 0, 0);
1772 evas_object_resize(win->pointer.obj, 32, 32);
1773 evas_object_show(win->pointer.obj);
1779 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1781 Evas_Event_Key_Down *ev = event_info;
1783 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1786 if ((strcmp(ev->keyname, "F12")) ||
1787 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1790 printf("Tree graph generated.\n");
1791 elm_object_tree_dot_dump(obj, "./dump.dot");
1796 _win_img_hide(void *data,
1798 Evas_Object *obj __UNUSED__,
1799 void *event_info __UNUSED__)
1801 Elm_Win *win = data;
1803 elm_widget_focus_hide_handle(win->win_obj);
1807 _win_img_mouse_up(void *data,
1809 Evas_Object *obj __UNUSED__,
1812 Elm_Win *win = data;
1813 Evas_Event_Mouse_Up *ev = event_info;
1814 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1815 elm_widget_focus_mouse_up_handle(win->win_obj);
1819 _win_img_focus_in(void *data,
1821 Evas_Object *obj __UNUSED__,
1822 void *event_info __UNUSED__)
1824 Elm_Win *win = data;
1825 elm_widget_focus_steal(win->win_obj);
1829 _win_img_focus_out(void *data,
1831 Evas_Object *obj __UNUSED__,
1832 void *event_info __UNUSED__)
1834 Elm_Win *win = data;
1835 elm_widget_focused_object_clear(win->win_obj);
1839 _win_inlined_image_set(Elm_Win *win)
1841 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1842 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1843 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1844 _elm_win_obj_callback_img_obj_del, win);
1846 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1847 _win_img_hide, win);
1848 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1849 _win_img_mouse_up, win);
1850 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1851 _win_img_focus_in, win);
1852 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1853 _win_img_focus_out, win);
1857 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1859 evas_object_event_callback_del_full(subobj,
1860 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1861 _elm_win_subobj_callback_changed_size_hints,
1863 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1864 _elm_win_subobj_callback_del, obj);
1865 win->subobjs = eina_list_remove(win->subobjs, subobj);
1866 _elm_win_eval_subobjs(obj);
1870 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1872 Elm_Win *win = data;
1873 if (win->icon == obj) win->icon = NULL;
1877 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1881 const char *fontpath;
1883 win = ELM_NEW(Elm_Win);
1885 #define FALLBACK_TRY(engine) \
1888 CRITICAL(engine " engine creation failed. Trying default."); \
1889 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1891 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
1893 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
1895 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
1896 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
1900 case ELM_WIN_INLINED_IMAGE:
1903 Evas *e = evas_object_evas_get(parent);
1906 ee = ecore_evas_ecore_evas_get(e);
1908 win->img_obj = ecore_evas_object_image_new(ee);
1909 if (!win->img_obj) break;
1910 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1913 _win_inlined_image_set(win);
1916 evas_object_del(win->img_obj);
1917 win->img_obj = NULL;
1921 case ELM_WIN_SOCKET_IMAGE:
1922 win->ee = ecore_evas_extn_socket_new(1, 1);
1926 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1928 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1929 #ifdef HAVE_ELEMENTARY_X
1930 win->client_message_handler = ecore_event_handler_add
1931 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1932 win->property_handler = ecore_event_handler_add
1933 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
1935 FALLBACK_TRY("Sofware X11");
1937 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1939 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1940 FALLBACK_TRY("Sofware FB");
1942 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1944 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1945 FALLBACK_TRY("Sofware DirectFB");
1947 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1949 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1950 FALLBACK_TRY("Sofware-16");
1951 #ifdef HAVE_ELEMENTARY_X
1952 win->client_message_handler = ecore_event_handler_add
1953 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1954 win->property_handler = ecore_event_handler_add
1955 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
1958 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1960 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1961 FALLBACK_TRY("Sofware-8");
1962 #ifdef HAVE_ELEMENTARY_X
1963 win->client_message_handler = ecore_event_handler_add
1964 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1965 win->property_handler = ecore_event_handler_add
1966 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
1970 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1972 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1973 FALLBACK_TRY("XRender");
1974 #ifdef HAVE_ELEMENTARY_X
1975 win->client_message_handler = ecore_event_handler_add
1976 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1977 win->property_handler = ecore_event_handler_add
1978 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
1982 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1987 if (_elm_config->vsync)
1989 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1995 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1997 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1998 FALLBACK_TRY("OpenGL");
1999 #ifdef HAVE_ELEMENTARY_X
2000 win->client_message_handler = ecore_event_handler_add
2001 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
2002 win->property_handler = ecore_event_handler_add
2003 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, win);
2006 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
2008 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
2009 FALLBACK_TRY("Sofware Win32");
2011 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2013 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
2014 FALLBACK_TRY("Sofware-16-WinCE");
2016 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
2018 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
2019 FALLBACK_TRY("PSL1GHT");
2021 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
2023 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
2024 FALLBACK_TRY("Sofware SDL");
2026 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
2028 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
2029 FALLBACK_TRY("Sofware-16-SDL");
2031 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
2033 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
2034 FALLBACK_TRY("OpenGL SDL");
2036 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
2038 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
2039 FALLBACK_TRY("OpenGL Cocoa");
2041 else if (ENGINE_COMPARE(ELM_BUFFER))
2043 win->ee = ecore_evas_buffer_new(1, 1);
2045 else if (ENGINE_COMPARE(ELM_EWS))
2047 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
2049 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
2051 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
2052 win->evas = ecore_evas_get(win->ee);
2054 _elm_win_frame_add(win, "default");
2055 // _elm_win_pointer_add(win, "default");
2057 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
2059 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
2060 win->evas = ecore_evas_get(win->ee);
2062 _elm_win_frame_add(win, "default");
2063 // _elm_win_pointer_add(win, "default");
2065 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
2067 win->ee = ecore_evas_buffer_new(1, 1);
2068 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
2069 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
2078 ERR("Cannot create window.");
2082 #ifdef HAVE_ELEMENTARY_X
2083 _elm_win_xwindow_get(win);
2085 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
2086 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
2087 // bg pixmap done by x - has other issues like can be redrawn by x before it
2088 // is filled/ready by app
2089 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
2092 win->parent = parent;
2094 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
2095 _elm_win_obj_callback_parent_del, win);
2097 win->evas = ecore_evas_get(win->ee);
2098 win->win_obj = elm_widget_add(win->evas);
2099 elm_widget_type_set(win->win_obj, "win");
2100 ELM_SET_WIDTYPE(widtype, "win");
2101 elm_widget_data_set(win->win_obj, win);
2102 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
2103 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
2104 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
2105 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
2106 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
2107 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
2108 evas_object_move(win->win_obj, 0, 0);
2109 evas_object_resize(win->win_obj, 1, 1);
2110 evas_object_layer_set(win->win_obj, 50);
2111 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
2115 evas_object_clip_set(win->win_obj, win->frame_obj);
2116 evas_object_stack_below(win->frame_obj, win->win_obj);
2119 if (type == ELM_WIN_INLINED_IMAGE)
2120 elm_widget_parent2_set(win->win_obj, parent);
2121 ecore_evas_object_associate(win->ee, win->win_obj,
2122 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
2123 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
2124 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
2125 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
2126 _elm_win_obj_callback_show, win);
2127 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
2128 _elm_win_obj_callback_hide, win);
2129 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
2130 _elm_win_obj_callback_del, win);
2131 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
2132 _elm_win_obj_callback_move, win);
2133 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
2134 _elm_win_obj_callback_resize, win);
2136 evas_object_intercept_move_callback_add(win->win_obj,
2137 _elm_win_obj_intercept_move, win);
2138 evas_object_intercept_show_callback_add(win->win_obj,
2139 _elm_win_obj_intercept_show, win);
2141 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
2142 ecore_evas_name_class_set(win->ee, name, _elm_appname);
2143 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
2144 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
2145 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
2146 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
2147 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
2148 ecore_evas_callback_move_set(win->ee, _elm_win_move);
2149 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
2150 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
2151 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
2152 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2153 evas_font_path_append(win->evas, fontpath);
2154 if (!_elm_config->font_hinting)
2155 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2156 else if (_elm_config->font_hinting == 1)
2157 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2158 else if (_elm_config->font_hinting == 2)
2159 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2161 #ifdef HAVE_ELEMENTARY_X
2162 _elm_win_xwin_update(win);
2165 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2167 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2169 ecore_evas_fullscreen_set(win->ee, 1);
2171 #undef ENGINE_COMPARE
2173 if (_elm_config->focus_highlight_enable)
2174 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2177 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2178 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2179 _debug_key_down, win);
2181 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2183 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2186 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2188 return win->win_obj;
2192 elm_win_util_standard_add(const char *name, const char *title)
2194 Evas_Object *win, *bg;
2196 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2197 if (!win) return NULL;
2198 elm_win_title_set(win, title);
2199 bg = elm_bg_add(win);
2202 evas_object_del(win);
2205 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2206 elm_win_resize_object_add(win, bg);
2207 evas_object_show(bg);
2212 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2216 ELM_CHECK_WIDTYPE(obj, widtype);
2217 win = elm_widget_data_get(obj);
2219 if (eina_list_data_find(win->subobjs, subobj)) return;
2220 win->subobjs = eina_list_append(win->subobjs, subobj);
2221 elm_widget_sub_object_add(obj, subobj);
2222 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2223 _elm_win_subobj_callback_del, obj);
2224 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2225 _elm_win_subobj_callback_changed_size_hints,
2227 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2228 evas_object_move(subobj, 0, 0);
2229 evas_object_resize(subobj, w, h);
2230 _elm_win_eval_subobjs(obj);
2234 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2237 ELM_CHECK_WIDTYPE(obj, widtype);
2238 win = elm_widget_data_get(obj);
2240 evas_object_event_callback_del_full(subobj,
2241 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2242 _elm_win_subobj_callback_changed_size_hints,
2244 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2245 _elm_win_subobj_callback_del, obj);
2246 win->subobjs = eina_list_remove(win->subobjs, subobj);
2247 elm_widget_sub_object_del(obj, subobj);
2248 _elm_win_eval_subobjs(obj);
2252 elm_win_title_set(Evas_Object *obj, const char *title)
2255 ELM_CHECK_WIDTYPE(obj, widtype);
2256 win = elm_widget_data_get(obj);
2257 if (!win || !title) return;
2258 eina_stringshare_replace(&(win->title), title);
2259 ecore_evas_title_set(win->ee, win->title);
2261 edje_object_part_text_escaped_set(win->frame_obj, "elm.text.title", win->title);
2265 elm_win_title_get(const Evas_Object *obj)
2268 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2269 win = elm_widget_data_get(obj);
2270 if (!win) return NULL;
2275 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2278 ELM_CHECK_WIDTYPE(obj, widtype);
2279 win = elm_widget_data_get(obj);
2280 if (!win || !icon_name) return;
2281 eina_stringshare_replace(&(win->icon_name), icon_name);
2282 #ifdef HAVE_ELEMENTARY_X
2283 _elm_win_xwin_update(win);
2288 elm_win_icon_name_get(const Evas_Object *obj)
2291 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2292 win = elm_widget_data_get(obj);
2293 if (!win) return NULL;
2294 return win->icon_name;
2298 elm_win_role_set(Evas_Object *obj, const char *role)
2301 ELM_CHECK_WIDTYPE(obj, widtype);
2302 win = elm_widget_data_get(obj);
2303 if (!win || !role) return;
2304 eina_stringshare_replace(&(win->role), role);
2305 #ifdef HAVE_ELEMENTARY_X
2306 _elm_win_xwin_update(win);
2311 elm_win_role_get(const Evas_Object *obj)
2314 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2315 win = elm_widget_data_get(obj);
2316 if (!win) return NULL;
2321 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2324 ELM_CHECK_WIDTYPE(obj, widtype);
2325 win = elm_widget_data_get(obj);
2328 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2329 _elm_win_obj_icon_callback_del, win);
2332 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2333 _elm_win_obj_icon_callback_del, win);
2334 #ifdef HAVE_ELEMENTARY_X
2335 _elm_win_xwin_update(win);
2339 EAPI const Evas_Object *
2340 elm_win_icon_object_get(const Evas_Object *obj)
2343 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2344 win = elm_widget_data_get(obj);
2345 if (!win) return NULL;
2350 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2353 ELM_CHECK_WIDTYPE(obj, widtype);
2354 win = elm_widget_data_get(obj);
2356 win->autodel = autodel;
2360 elm_win_autodel_get(const Evas_Object *obj)
2363 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2364 win = elm_widget_data_get(obj);
2365 if (!win) return EINA_FALSE;
2366 return win->autodel;
2370 elm_win_activate(Evas_Object *obj)
2373 ELM_CHECK_WIDTYPE(obj, widtype);
2374 win = elm_widget_data_get(obj);
2376 ecore_evas_activate(win->ee);
2380 elm_win_lower(Evas_Object *obj)
2383 ELM_CHECK_WIDTYPE(obj, widtype);
2384 win = elm_widget_data_get(obj);
2386 ecore_evas_lower(win->ee);
2390 elm_win_raise(Evas_Object *obj)
2393 ELM_CHECK_WIDTYPE(obj, widtype);
2394 win = elm_widget_data_get(obj);
2396 ecore_evas_raise(win->ee);
2400 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2403 int win_w, win_h, screen_w, screen_h, nx, ny;
2404 ELM_CHECK_WIDTYPE(obj, widtype);
2405 win = elm_widget_data_get(obj);
2407 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2408 if ((!screen_w) || (!screen_h)) return;
2409 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2410 if ((!win_w) || (!win_h)) return;
2411 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2412 else nx = win->screen.x;
2413 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2414 else ny = win->screen.y;
2417 evas_object_move(obj, nx, ny);
2421 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2424 ELM_CHECK_WIDTYPE(obj, widtype);
2425 win = elm_widget_data_get(obj);
2427 ecore_evas_borderless_set(win->ee, borderless);
2428 #ifdef HAVE_ELEMENTARY_X
2429 _elm_win_xwin_update(win);
2434 elm_win_borderless_get(const Evas_Object *obj)
2437 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2438 win = elm_widget_data_get(obj);
2439 if (!win) return EINA_FALSE;
2440 return ecore_evas_borderless_get(win->ee);
2444 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2447 ELM_CHECK_WIDTYPE(obj, widtype);
2448 win = elm_widget_data_get(obj);
2450 ecore_evas_shaped_set(win->ee, shaped);
2451 #ifdef HAVE_ELEMENTARY_X
2452 _elm_win_xwin_update(win);
2457 elm_win_shaped_get(const Evas_Object *obj)
2460 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2461 win = elm_widget_data_get(obj);
2462 if (!win) return EINA_FALSE;
2463 return ecore_evas_shaped_get(win->ee);
2467 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2470 ELM_CHECK_WIDTYPE(obj, widtype);
2471 win = elm_widget_data_get(obj);
2476 else if (win->img_obj)
2478 evas_object_image_alpha_set(win->img_obj, alpha);
2479 ecore_evas_alpha_set(win->ee, alpha);
2483 #ifdef HAVE_ELEMENTARY_X
2488 if (!_elm_config->compositing)
2489 elm_win_shaped_set(obj, alpha);
2491 ecore_evas_alpha_set(win->ee, alpha);
2494 ecore_evas_alpha_set(win->ee, alpha);
2495 _elm_win_xwin_update(win);
2499 ecore_evas_alpha_set(win->ee, alpha);
2504 elm_win_alpha_get(const Evas_Object *obj)
2507 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2508 win = elm_widget_data_get(obj);
2509 if (!win) return EINA_FALSE;
2513 else if (win->img_obj)
2515 return evas_object_image_alpha_get(win->img_obj);
2517 return ecore_evas_alpha_get(win->ee);
2521 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2524 ELM_CHECK_WIDTYPE(obj, widtype);
2525 win = elm_widget_data_get(obj);
2527 ecore_evas_override_set(win->ee, override);
2528 #ifdef HAVE_ELEMENTARY_X
2529 _elm_win_xwin_update(win);
2534 elm_win_override_get(const Evas_Object *obj)
2537 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2538 win = elm_widget_data_get(obj);
2539 if (!win) return EINA_FALSE;
2540 return ecore_evas_override_get(win->ee);
2544 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2547 ELM_CHECK_WIDTYPE(obj, widtype);
2548 win = elm_widget_data_get(obj);
2550 // YYY: handle if win->img_obj
2551 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2552 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2553 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2555 // these engines... can ONLY be fullscreen
2560 win->fullscreen = fullscreen;
2561 ecore_evas_fullscreen_set(win->ee, fullscreen);
2562 #ifdef HAVE_ELEMENTARY_X
2563 _elm_win_xwin_update(win);
2566 #undef ENGINE_COMPARE
2570 elm_win_fullscreen_get(const Evas_Object *obj)
2573 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2574 win = elm_widget_data_get(obj);
2575 if (!win) return EINA_FALSE;
2576 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2577 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2578 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2580 // these engines... can ONLY be fullscreen
2585 return win->fullscreen;
2587 #undef ENGINE_COMPARE
2591 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2594 ELM_CHECK_WIDTYPE(obj, widtype);
2595 win = elm_widget_data_get(obj);
2597 win->maximized = maximized;
2598 // YYY: handle if win->img_obj
2599 ecore_evas_maximized_set(win->ee, maximized);
2600 #ifdef HAVE_ELEMENTARY_X
2601 _elm_win_xwin_update(win);
2606 elm_win_maximized_get(const Evas_Object *obj)
2609 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2610 win = elm_widget_data_get(obj);
2611 if (!win) return EINA_FALSE;
2612 return win->maximized;
2616 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2619 ELM_CHECK_WIDTYPE(obj, widtype);
2620 win = elm_widget_data_get(obj);
2622 win->iconified = iconified;
2623 ecore_evas_iconified_set(win->ee, iconified);
2624 #ifdef HAVE_ELEMENTARY_X
2625 _elm_win_xwin_update(win);
2630 elm_win_iconified_get(const Evas_Object *obj)
2633 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2634 win = elm_widget_data_get(obj);
2635 if (!win) return EINA_FALSE;
2636 return win->iconified;
2640 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2643 ELM_CHECK_WIDTYPE(obj, widtype);
2644 win = elm_widget_data_get(obj);
2646 win->withdrawn = withdrawn;
2647 ecore_evas_withdrawn_set(win->ee, withdrawn);
2648 #ifdef HAVE_ELEMENTARY_X
2649 _elm_win_xwin_update(win);
2654 elm_win_withdrawn_get(const Evas_Object *obj)
2657 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2658 win = elm_widget_data_get(obj);
2659 if (!win) return EINA_FALSE;
2660 return win->withdrawn;
2664 elm_win_profiles_set(Evas_Object *obj, const char **profiles, unsigned int num_profiles)
2667 char **profiles_int;
2669 unsigned int i, num;
2672 ELM_CHECK_WIDTYPE(obj, widtype);
2673 win = elm_widget_data_get(obj);
2675 if (!profiles) return;
2677 if (win->profile.timer) ecore_timer_del(win->profile.timer);
2678 win->profile.timer = ecore_timer_add(0.1, _elm_win_profile_change_delay, win);
2679 EINA_LIST_FREE(win->profile.names, str) eina_stringshare_del(str);
2681 for (i = 0; i < num_profiles; i++)
2683 if ((profiles[i]) &&
2684 _elm_config_profile_exists(profiles[i]))
2686 str = eina_stringshare_add(profiles[i]);
2687 win->profile.names = eina_list_append(win->profile.names, str);
2691 num = eina_list_count(win->profile.names);
2692 profiles_int = alloca(num * sizeof(char *));
2697 EINA_LIST_FOREACH(win->profile.names, l, str)
2700 profiles_int[i] = strdup(str);
2702 profiles_int[i] = NULL;
2705 ecore_evas_profiles_set(win->ee, (const char **)profiles_int, i);
2706 for (i = 0; i < num; i++)
2708 if (profiles_int[i]) free(profiles_int[i]);
2712 ecore_evas_profiles_set(win->ee, profiles, num_profiles);
2716 elm_win_profile_get(const Evas_Object *obj)
2719 ELM_CHECK_WIDTYPE(obj, widtype);
2720 win = elm_widget_data_get(obj);
2721 if (!win) return NULL;
2723 return win->profile.name;
2727 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2730 ELM_CHECK_WIDTYPE(obj, widtype);
2731 win = elm_widget_data_get(obj);
2733 win->urgent = urgent;
2734 ecore_evas_urgent_set(win->ee, urgent);
2735 #ifdef HAVE_ELEMENTARY_X
2736 _elm_win_xwin_update(win);
2741 elm_win_urgent_get(const Evas_Object *obj)
2744 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2745 win = elm_widget_data_get(obj);
2746 if (!win) return EINA_FALSE;
2751 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2754 ELM_CHECK_WIDTYPE(obj, widtype);
2755 win = elm_widget_data_get(obj);
2757 win->demand_attention = demand_attention;
2758 ecore_evas_demand_attention_set(win->ee, demand_attention);
2759 #ifdef HAVE_ELEMENTARY_X
2760 _elm_win_xwin_update(win);
2765 elm_win_demand_attention_get(const Evas_Object *obj)
2768 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2769 win = elm_widget_data_get(obj);
2770 if (!win) return EINA_FALSE;
2771 return win->demand_attention;
2775 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2778 ELM_CHECK_WIDTYPE(obj, widtype);
2779 win = elm_widget_data_get(obj);
2782 ecore_evas_modal_set(win->ee, modal);
2783 #ifdef HAVE_ELEMENTARY_X
2784 _elm_win_xwin_update(win);
2789 elm_win_modal_get(const Evas_Object *obj)
2792 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2793 win = elm_widget_data_get(obj);
2794 if (!win) return EINA_FALSE;
2799 elm_win_aspect_set(Evas_Object *obj, double aspect)
2802 ELM_CHECK_WIDTYPE(obj, widtype);
2803 win = elm_widget_data_get(obj);
2805 win->aspect = aspect;
2806 ecore_evas_aspect_set(win->ee, aspect);
2807 #ifdef HAVE_ELEMENTARY_X
2808 _elm_win_xwin_update(win);
2813 elm_win_aspect_get(const Evas_Object *obj)
2816 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2817 win = elm_widget_data_get(obj);
2818 if (!win) return EINA_FALSE;
2823 elm_win_layer_set(Evas_Object *obj, int layer)
2826 ELM_CHECK_WIDTYPE(obj, widtype);
2827 win = elm_widget_data_get(obj);
2829 ecore_evas_layer_set(win->ee, layer);
2830 #ifdef HAVE_ELEMENTARY_X
2831 _elm_win_xwin_update(win);
2836 elm_win_layer_get(const Evas_Object *obj)
2839 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2840 win = elm_widget_data_get(obj);
2841 if (!win) return -1;
2842 return ecore_evas_layer_get(win->ee);
2846 elm_win_rotation_set(Evas_Object *obj, int rotation)
2849 ELM_CHECK_WIDTYPE(obj, widtype);
2850 win = elm_widget_data_get(obj);
2852 if (win->rot == rotation) return;
2853 win->rot = rotation;
2854 ecore_evas_rotation_set(win->ee, rotation);
2855 evas_object_size_hint_min_set(obj, -1, -1);
2856 evas_object_size_hint_max_set(obj, -1, -1);
2857 _elm_win_eval_subobjs(obj);
2858 #ifdef HAVE_ELEMENTARY_X
2859 _elm_win_xwin_update(win);
2864 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2867 ELM_CHECK_WIDTYPE(obj, widtype);
2868 win = elm_widget_data_get(obj);
2870 if (win->rot == rotation) return;
2871 win->rot = rotation;
2872 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2873 evas_object_size_hint_min_set(obj, -1, -1);
2874 evas_object_size_hint_max_set(obj, -1, -1);
2875 _elm_win_eval_subobjs(obj);
2876 #ifdef HAVE_ELEMENTARY_X
2877 _elm_win_xwin_update(win);
2882 elm_win_rotation_get(const Evas_Object *obj)
2885 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2886 win = elm_widget_data_get(obj);
2887 if (!win) return -1;
2892 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2895 ELM_CHECK_WIDTYPE(obj, widtype);
2896 win = elm_widget_data_get(obj);
2898 win->sticky = sticky;
2899 ecore_evas_sticky_set(win->ee, sticky);
2900 #ifdef HAVE_ELEMENTARY_X
2901 _elm_win_xwin_update(win);
2906 elm_win_sticky_get(const Evas_Object *obj)
2909 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2910 win = elm_widget_data_get(obj);
2911 if (!win) return EINA_FALSE;
2916 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2919 ELM_CHECK_WIDTYPE(obj, widtype);
2920 win = elm_widget_data_get(obj);
2922 if (mode == win->kbdmode) return;
2923 #ifdef HAVE_ELEMENTARY_X
2924 _elm_win_xwindow_get(win);
2926 win->kbdmode = mode;
2927 #ifdef HAVE_ELEMENTARY_X
2929 ecore_x_e_virtual_keyboard_state_set
2930 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2934 EAPI Elm_Win_Keyboard_Mode
2935 elm_win_keyboard_mode_get(const Evas_Object *obj)
2938 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2939 win = elm_widget_data_get(obj);
2940 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2941 return win->kbdmode;
2945 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2948 ELM_CHECK_WIDTYPE(obj, widtype);
2949 win = elm_widget_data_get(obj);
2951 #ifdef HAVE_ELEMENTARY_X
2952 _elm_win_xwindow_get(win);
2954 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2961 elm_win_keyboard_win_get(const Evas_Object *obj)
2964 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2965 win = elm_widget_data_get(obj);
2966 if (!win) return EINA_FALSE;
2967 #ifdef HAVE_ELEMENTARY_X
2968 _elm_win_xwindow_get(win);
2970 return ecore_x_e_virtual_keyboard_get(win->xwin);
2975 // WRAPPER: Temperary added.
2977 elm_win_indicator_state_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2979 elm_win_indicator_mode_set(obj, mode);
2983 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2986 ELM_CHECK_WIDTYPE(obj, widtype);
2987 win = elm_widget_data_get(obj);
2989 if (mode == win->indmode) return;
2990 #ifdef HAVE_ELEMENTARY_X
2991 _elm_win_xwindow_get(win);
2993 win->indmode = mode;
2994 #ifdef HAVE_ELEMENTARY_X
2997 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
2998 ecore_x_e_illume_indicator_state_set
2999 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
3000 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
3001 ecore_x_e_illume_indicator_state_set
3002 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
3007 // WRAPPER: Temperary added.
3008 EAPI Elm_Win_Indicator_Mode
3009 elm_win_indicator_state_get(const Evas_Object *obj)
3011 return elm_win_indicator_mode_get(obj);
3014 EAPI Elm_Win_Indicator_Mode
3015 elm_win_indicator_mode_get(const Evas_Object *obj)
3018 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
3019 win = elm_widget_data_get(obj);
3020 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
3021 return win->indmode;
3025 elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode)
3028 ELM_CHECK_WIDTYPE(obj, widtype);
3029 win = elm_widget_data_get(obj);
3031 if (mode == win->ind_o_mode) return;
3032 win->ind_o_mode = mode;
3033 #ifdef HAVE_ELEMENTARY_X
3034 _elm_win_xwindow_get(win);
3037 if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
3038 ecore_x_e_illume_indicator_opacity_set
3039 (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
3040 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
3041 ecore_x_e_illume_indicator_opacity_set
3042 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
3043 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
3044 ecore_x_e_illume_indicator_opacity_set
3045 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
3051 EAPI Elm_Win_Indicator_Opacity_Mode
3052 elm_win_indicator_opacity_get(const Evas_Object *obj)
3055 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
3056 win = elm_widget_data_get(obj);
3057 if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
3058 return win->ind_o_mode;
3062 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
3065 ELM_CHECK_WIDTYPE(obj, widtype);
3066 win = elm_widget_data_get(obj);
3068 if (x) *x = win->screen.x;
3069 if (y) *y = win->screen.y;
3073 elm_win_focus_get(const Evas_Object *obj)
3076 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3077 win = elm_widget_data_get(obj);
3078 if (!win) return EINA_FALSE;
3079 return ecore_evas_focus_get(win->ee);
3083 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
3086 ELM_CHECK_WIDTYPE(obj, widtype);
3087 win = elm_widget_data_get(obj);
3089 win->constrain = !!constrain;
3093 elm_win_screen_constrain_get(Evas_Object *obj)
3096 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3097 win = elm_widget_data_get(obj);
3098 if (!win) return EINA_FALSE;
3099 return win->constrain;
3103 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
3106 ELM_CHECK_WIDTYPE(obj, widtype);
3107 win = elm_widget_data_get(obj);
3109 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
3113 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
3116 ELM_CHECK_WIDTYPE(obj, widtype);
3117 win = elm_widget_data_get(obj);
3119 #ifdef HAVE_ELEMENTARY_X
3120 _elm_win_xwindow_get(win);
3122 ecore_x_e_illume_conformant_set(win->xwin, conformant);
3129 elm_win_conformant_get(const Evas_Object *obj)
3132 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3133 win = elm_widget_data_get(obj);
3134 if (!win) return EINA_FALSE;
3135 #ifdef HAVE_ELEMENTARY_X
3136 _elm_win_xwindow_get(win);
3138 return ecore_x_e_illume_conformant_get(win->xwin);
3144 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
3147 ELM_CHECK_WIDTYPE(obj, widtype);
3148 win = elm_widget_data_get(obj);
3150 #ifdef HAVE_ELEMENTARY_X
3151 _elm_win_xwindow_get(win);
3154 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
3157 Ecore_X_Window_State states[2];
3159 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
3160 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
3161 ecore_x_netwm_window_state_set(win->xwin, states, 2);
3162 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
3171 elm_win_quickpanel_get(const Evas_Object *obj)
3174 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3175 win = elm_widget_data_get(obj);
3176 if (!win) return EINA_FALSE;
3177 #ifdef HAVE_ELEMENTARY_X
3178 _elm_win_xwindow_get(win);
3180 return ecore_x_e_illume_quickpanel_get(win->xwin);
3186 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
3189 ELM_CHECK_WIDTYPE(obj, widtype);
3190 win = elm_widget_data_get(obj);
3192 #ifdef HAVE_ELEMENTARY_X
3193 _elm_win_xwindow_get(win);
3195 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
3202 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
3205 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3206 win = elm_widget_data_get(obj);
3207 if (!win) return -1;
3208 #ifdef HAVE_ELEMENTARY_X
3209 _elm_win_xwindow_get(win);
3211 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
3217 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
3220 ELM_CHECK_WIDTYPE(obj, widtype);
3221 win = elm_widget_data_get(obj);
3223 #ifdef HAVE_ELEMENTARY_X
3224 _elm_win_xwindow_get(win);
3226 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3233 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3236 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3237 win = elm_widget_data_get(obj);
3238 if (!win) return -1;
3239 #ifdef HAVE_ELEMENTARY_X
3240 _elm_win_xwindow_get(win);
3242 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3248 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3251 ELM_CHECK_WIDTYPE(obj, widtype);
3252 win = elm_widget_data_get(obj);
3254 #ifdef HAVE_ELEMENTARY_X
3255 _elm_win_xwindow_get(win);
3257 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3264 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3267 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3268 win = elm_widget_data_get(obj);
3270 #ifdef HAVE_ELEMENTARY_X
3271 _elm_win_xwindow_get(win);
3273 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3279 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3282 ELM_CHECK_WIDTYPE(obj, widtype);
3283 win = elm_widget_data_get(obj);
3285 win->skip_focus = skip;
3286 ecore_evas_focus_skip_set(win->ee, skip);
3290 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3293 ELM_CHECK_WIDTYPE(obj, widtype);
3294 win = elm_widget_data_get(obj);
3296 #ifdef HAVE_ELEMENTARY_X
3297 _elm_win_xwindow_get(win);
3302 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3303 ecore_x_e_illume_focus_back_send(win->xwin);
3305 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3306 ecore_x_e_illume_focus_forward_send(win->xwin);
3308 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3309 ecore_x_e_illume_focus_home_send(win->xwin);
3311 case ELM_ILLUME_COMMAND_CLOSE:
3312 ecore_x_e_illume_close_send(win->xwin);
3324 elm_win_inlined_image_object_get(Evas_Object *obj)
3327 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3328 win = elm_widget_data_get(obj);
3329 if (!win) return NULL;
3330 return win->img_obj;
3334 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3338 ELM_CHECK_WIDTYPE(obj, widtype);
3340 win = elm_widget_data_get(obj);
3341 enabled = !!enabled;
3342 if (win->focus_highlight.enabled == enabled)
3345 win->focus_highlight.enabled = enabled;
3347 if (win->focus_highlight.enabled)
3348 _elm_win_focus_highlight_init(win);
3350 _elm_win_focus_highlight_shutdown(win);
3354 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3358 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3360 win = elm_widget_data_get(obj);
3361 return win->focus_highlight.enabled;
3365 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3369 ELM_CHECK_WIDTYPE(obj, widtype);
3371 win = elm_widget_data_get(obj);
3372 eina_stringshare_replace(&win->focus_highlight.style, style);
3373 win->focus_highlight.changed_theme = EINA_TRUE;
3374 _elm_win_focus_highlight_reconfigure_job_start(win);
3378 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3382 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3384 win = elm_widget_data_get(obj);
3385 return win->focus_highlight.style;
3388 typedef struct _Widget_Data Widget_Data;
3393 Evas_Object *content;
3396 static void _del_hook(Evas_Object *obj);
3397 static void _theme_hook(Evas_Object *obj);
3398 static void _sizing_eval(Evas_Object *obj);
3399 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3400 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3402 static const char *widtype2 = NULL;
3405 _del_hook(Evas_Object *obj)
3407 Widget_Data *wd = elm_widget_data_get(obj);
3413 _theme_hook(Evas_Object *obj)
3415 Widget_Data *wd = elm_widget_data_get(obj);
3416 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3418 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3421 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3425 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3427 Widget_Data *wd = elm_widget_data_get(obj);
3432 /* Try Focus cycle in subitem */
3435 elm_widget_focus_next_get(wd->content, dir, next);
3440 *next = (Evas_Object *)obj;
3445 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3447 Widget_Data *wd = elm_widget_data_get(obj);
3449 if (!wd || !item) return;
3450 edje_object_part_text_escaped_set(wd->frm, item, text);
3455 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3457 Widget_Data *wd = elm_widget_data_get(obj);
3459 if (!item || !wd || !wd->frm) return NULL;
3460 return edje_object_part_text_get(wd->frm, item);
3464 _sizing_eval(Evas_Object *obj)
3466 Widget_Data *wd = elm_widget_data_get(obj);
3467 Evas_Coord minw = -1, minh = -1;
3469 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3470 edje_object_size_min_calc(wd->frm, &minw, &minh);
3471 evas_object_size_hint_min_set(obj, minw, minh);
3472 evas_object_size_hint_max_set(obj, -1, -1);
3476 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3482 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3484 Widget_Data *wd = elm_widget_data_get(obj);
3485 Evas_Object *sub = event_info;
3486 if (sub == wd->content)
3488 evas_object_event_callback_del_full
3489 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3496 elm_win_inwin_add(Evas_Object *obj)
3502 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3503 win = elm_widget_data_get(obj);
3504 if (!win) return NULL;
3505 wd = ELM_NEW(Widget_Data);
3506 obj2 = elm_widget_add(win->evas);
3507 elm_widget_type_set(obj2, "inwin");
3508 ELM_SET_WIDTYPE(widtype2, "inwin");
3509 elm_widget_sub_object_add(obj, obj2);
3510 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3511 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3512 elm_win_resize_object_add(obj, obj2);
3514 elm_widget_data_set(obj2, wd);
3515 elm_widget_del_hook_set(obj2, _del_hook);
3516 elm_widget_theme_hook_set(obj2, _theme_hook);
3517 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3518 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3519 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3520 elm_widget_can_focus_set(obj2, EINA_TRUE);
3521 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3523 wd->frm = edje_object_add(win->evas);
3524 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3525 elm_widget_resize_object_set(obj2, wd->frm);
3527 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3534 elm_win_inwin_activate(Evas_Object *obj)
3536 ELM_CHECK_WIDTYPE(obj, widtype2);
3537 Widget_Data *wd = elm_widget_data_get(obj);
3539 evas_object_raise(obj);
3540 evas_object_show(obj);
3541 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3542 elm_object_focus_set(obj, EINA_TRUE);
3546 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3548 ELM_CHECK_WIDTYPE(obj, widtype2);
3549 Widget_Data *wd = elm_widget_data_get(obj);
3551 if (wd->content == content) return;
3552 if (wd->content) evas_object_del(wd->content);
3553 wd->content = content;
3556 elm_widget_sub_object_add(obj, content);
3557 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3558 _changed_size_hints, obj);
3559 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3565 elm_win_inwin_content_get(const Evas_Object *obj)
3567 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3568 Widget_Data *wd = elm_widget_data_get(obj);
3569 if (!wd) return NULL;
3574 elm_win_inwin_content_unset(Evas_Object *obj)
3576 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3577 Widget_Data *wd = elm_widget_data_get(obj);
3578 if (!wd) return NULL;
3579 if (!wd->content) return NULL;
3580 Evas_Object *content = wd->content;
3581 elm_widget_sub_object_del(obj, wd->content);
3582 evas_object_event_callback_del_full(wd->content,
3583 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3584 _changed_size_hints, obj);
3585 edje_object_part_unswallow(wd->frm, wd->content);
3591 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3596 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3597 win = elm_widget_data_get(obj);
3598 if (!win) return EINA_FALSE;
3599 if (!win->ee) return EINA_FALSE;
3601 if (!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3607 /* windowing specific calls - shall we do this differently? */
3609 static Ecore_X_Window
3610 _elm_ee_win_get(const Evas_Object *obj)
3613 #ifdef HAVE_ELEMENTARY_X
3614 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3615 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3621 elm_win_xwindow_get(const Evas_Object *obj)
3627 type = elm_widget_type_get(obj);
3628 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3629 win = elm_widget_data_get(obj);
3631 #ifdef HAVE_ELEMENTARY_X
3632 if (win->xwin) return win->xwin;
3633 if (win->parent) return elm_win_xwindow_get(win->parent);
3639 elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool floating)
3642 ELM_CHECK_WIDTYPE(obj, widtype);
3643 win = elm_widget_data_get(obj);
3645 if (floating == win->floating) return;
3646 #ifdef HAVE_ELEMENTARY_X
3647 _elm_win_xwindow_get(win);
3649 win->floating = floating;
3650 #ifdef HAVE_ELEMENTARY_X
3654 ecore_x_e_illume_window_state_set
3655 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_FLOATING);
3657 ecore_x_e_illume_window_state_set
3658 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_NORMAL);
3664 elm_win_floating_mode_get(const Evas_Object *obj)
3667 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3668 win = elm_widget_data_get(obj);
3669 if (!win) return EINA_FALSE;
3671 return win->floating;