1 #include <Elementary.h>
4 typedef struct _Elm_Win Elm_Win;
10 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
12 #ifdef HAVE_ELEMENTARY_X
14 Ecore_Event_Handler *client_message_handler;
16 Ecore_Job *deferred_resize_job;
17 Ecore_Job *deferred_child_eval_job;
20 Elm_Win_Keyboard_Mode kbdmode;
21 Elm_Win_Indicator_Mode indmode;
22 Elm_Win_Indicator_Opacity_Mode ind_o_mode;
31 int *autodel_clear, rot;
41 Evas_Object *obj, *hot_obj;
51 Eina_Bool visible : 1;
52 Eina_Bool handled : 1;
56 Ecore_Job *reconf_job;
58 Eina_Bool enabled : 1;
59 Eina_Bool changed_theme : 1;
60 Eina_Bool top_animate : 1;
61 Eina_Bool geometry_changed : 1;
66 const char *icon_name;
72 Eina_Bool demand_attention : 1;
73 Eina_Bool autodel : 1;
74 Eina_Bool constrain : 1;
75 Eina_Bool resizing : 1;
76 Eina_Bool iconified : 1;
77 Eina_Bool withdrawn : 1;
79 Eina_Bool fullscreen : 1;
80 Eina_Bool maximized : 1;
81 Eina_Bool skip_focus : 1;
82 Eina_Bool floating : 1;
85 static const char *widtype = NULL;
86 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
87 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
88 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
89 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
90 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
91 static void _elm_win_move(Ecore_Evas *ee);
92 static void _elm_win_resize(Ecore_Evas *ee);
93 static void _elm_win_delete_request(Ecore_Evas *ee);
94 static void _elm_win_resize_job(void *data);
95 #ifdef HAVE_ELEMENTARY_X
96 static void _elm_win_xwin_update(Elm_Win *win);
98 static void _elm_win_eval_subobjs(Evas_Object *obj);
99 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
100 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
101 static void _elm_win_focus_highlight_init(Elm_Win *win);
102 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
103 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
104 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
105 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
106 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
107 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
109 static void _elm_win_frame_add(Elm_Win *win, const char *style);
110 static void _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
111 static void _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source);
112 static void _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
113 static void _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
114 static void _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__);
116 //static void _elm_win_pointer_add(Elm_Win *win, const char *style);
118 static const char SIG_DELETE_REQUEST[] = "delete,request";
119 static const char SIG_FOCUS_OUT[] = "focus,out";
120 static const char SIG_FOCUS_IN[] = "focus,in";
121 static const char SIG_MOVED[] = "moved";
122 static const char SIG_THEME_CHANGED[] = "theme,changed";
123 static const char SIG_WITHDRAWN[] = "withdrawn";
124 static const char SIG_ICONIFIED[] = "iconified";
125 static const char SIG_NORMAL[] = "normal";
126 static const char SIG_STICK[] = "stick";
127 static const char SIG_UNSTICK[] = "unstick";
128 static const char SIG_FULLSCREEN[] = "fullscreen";
129 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
130 static const char SIG_MAXIMIZED[] = "maximized";
131 static const char SIG_UNMAXIMIZED[] = "unmaximized";
133 static const Evas_Smart_Cb_Description _signals[] = {
134 {SIG_DELETE_REQUEST, ""},
143 {SIG_FULLSCREEN, ""},
144 {SIG_UNFULLSCREEN, ""},
146 {SIG_UNMAXIMIZED, ""},
152 Eina_List *_elm_win_list = NULL;
153 int _elm_win_deferred_free = 0;
155 // exmaple shot spec (wait 0.1 sec then save as my-window.png):
156 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
159 _shot_delay_get(Elm_Win *win)
162 char *d = strdup(win->shot.info);
165 for (p = (char *)win->shot.info; *p; p++)
167 if (!strncmp(p, "delay=", 6))
171 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
186 _shot_file_get(Elm_Win *win)
189 char *tmp = strdup(win->shot.info);
190 char *repname = NULL;
192 if (!tmp) return NULL;
194 for (p = (char *)win->shot.info; *p; p++)
196 if (!strncmp(p, "file=", 5))
199 if (!win->shot.repeat_count) return tmp;
202 char *dotptr = strrchr(tmp, '.');
205 size_t size = sizeof(char)*(strlen(tmp) + 16);
206 repname = malloc(size);
207 strncpy(repname, tmp, dotptr - tmp);
208 snprintf(repname + (dotptr - tmp), size - (dotptr - tmp), "%03i",
209 win->shot.shot_counter + 1);
210 strcat(repname, dotptr);
218 if (!win->shot.repeat_count) return strdup("out.png");
220 repname = malloc(sizeof(char) * 24);
221 snprintf(repname, sizeof(char) * 24, "out%03i.png", win->shot.shot_counter + 1);
226 _shot_repeat_count_get(Elm_Win *win)
229 char *d = strdup(win->shot.info);
232 for (p = (char *)win->shot.info; *p; p++)
234 if (!strncmp(p, "repeat=", 7))
238 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
245 if (v > 1000) v = 999;
255 _shot_key_get(Elm_Win *win __UNUSED__)
261 _shot_flags_get(Elm_Win *win __UNUSED__)
267 _shot_do(Elm_Win *win)
271 unsigned int *pixels;
273 char *file, *key, *flags;
275 ecore_evas_manual_render(win->ee);
276 pixels = (void *)ecore_evas_buffer_pixels_get(win->ee);
278 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
279 if ((w < 1) || (h < 1)) return;
280 file = _shot_file_get(win);
282 key = _shot_key_get(win);
283 flags = _shot_flags_get(win);
284 ee = ecore_evas_buffer_new(1, 1);
285 o = evas_object_image_add(ecore_evas_get(ee));
286 evas_object_image_alpha_set(o, ecore_evas_alpha_get(win->ee));
287 evas_object_image_size_set(o, w, h);
288 evas_object_image_data_set(o, pixels);
289 if (!evas_object_image_save(o, file, key, flags))
291 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
296 if (flags) free(flags);
298 if (win->shot.repeat_count) win->shot.shot_counter++;
302 _shot_delay(void *data)
306 if (win->shot.repeat_count)
308 int remainshot = (win->shot.repeat_count - win->shot.shot_counter);
309 if (remainshot > 0) return EINA_TRUE;
311 win->shot.timer = NULL;
317 _shot_init(Elm_Win *win)
319 if (!win->shot.info) return;
320 win->shot.repeat_count = _shot_repeat_count_get(win);
321 win->shot.shot_counter = 0;
325 _shot_handle(Elm_Win *win)
327 if (!win->shot.info) return;
328 win->shot.timer = ecore_timer_add(_shot_delay_get(win), _shot_delay, win);
332 _elm_win_move(Ecore_Evas *ee)
334 Evas_Object *obj = ecore_evas_object_associate_get(ee);
339 win = elm_widget_data_get(obj);
341 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
344 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
348 _elm_win_resize(Ecore_Evas *ee)
350 Evas_Object *obj = ecore_evas_object_associate_get(ee);
354 win = elm_widget_data_get(obj);
356 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
357 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
361 _elm_win_mouse_in(Ecore_Evas *ee)
366 if (!(obj = ecore_evas_object_associate_get(ee))) return;
367 if (!(win = elm_widget_data_get(obj))) return;
368 if (win->resizing) win->resizing = EINA_FALSE;
372 _elm_win_focus_in(Ecore_Evas *ee)
374 Evas_Object *obj = ecore_evas_object_associate_get(ee);
378 win = elm_widget_data_get(obj);
380 _elm_widget_top_win_focused_set(win->win_obj, EINA_TRUE);
381 if (!elm_widget_focus_order_get(obj))
383 elm_widget_focus_steal(win->win_obj);
387 elm_widget_focus_restore(win->win_obj);
388 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_IN, NULL);
389 win->focus_highlight.cur.visible = EINA_TRUE;
390 _elm_win_focus_highlight_reconfigure_job_start(win);
393 edje_object_signal_emit(win->frame_obj, "elm,action,focus", "elm");
395 else if (win->img_obj)
402 _elm_win_focus_out(Ecore_Evas *ee)
404 Evas_Object *obj = ecore_evas_object_associate_get(ee);
408 win = elm_widget_data_get(obj);
410 elm_object_focus_set(win->win_obj, EINA_FALSE);
411 _elm_widget_top_win_focused_set(win->win_obj, EINA_FALSE);
412 evas_object_smart_callback_call(win->win_obj, SIG_FOCUS_OUT, NULL);
413 win->focus_highlight.cur.visible = EINA_FALSE;
414 _elm_win_focus_highlight_reconfigure_job_start(win);
417 edje_object_signal_emit(win->frame_obj, "elm,action,unfocus", "elm");
419 else if (win->img_obj)
426 _elm_win_state_change(Ecore_Evas *ee)
430 Eina_Bool ch_withdrawn = EINA_FALSE;
431 Eina_Bool ch_sticky = EINA_FALSE;
432 Eina_Bool ch_iconified = EINA_FALSE;
433 Eina_Bool ch_fullscreen = EINA_FALSE;
434 Eina_Bool ch_maximized = EINA_FALSE;
436 if (!(obj = ecore_evas_object_associate_get(ee))) return;
438 if (!(win = elm_widget_data_get(obj))) return;
440 if (win->withdrawn != ecore_evas_withdrawn_get(win->ee))
442 win->withdrawn = ecore_evas_withdrawn_get(win->ee);
443 ch_withdrawn = EINA_TRUE;
445 if (win->sticky != ecore_evas_sticky_get(win->ee))
447 win->sticky = ecore_evas_sticky_get(win->ee);
448 ch_sticky = EINA_TRUE;
450 if (win->iconified != ecore_evas_iconified_get(win->ee))
452 win->iconified = ecore_evas_iconified_get(win->ee);
453 ch_iconified = EINA_TRUE;
455 if (win->fullscreen != ecore_evas_fullscreen_get(win->ee))
457 win->fullscreen = ecore_evas_fullscreen_get(win->ee);
458 ch_fullscreen = EINA_TRUE;
460 if (win->maximized != ecore_evas_maximized_get(win->ee))
462 win->maximized = ecore_evas_maximized_get(win->ee);
463 ch_maximized = EINA_TRUE;
465 if ((ch_withdrawn) || (ch_iconified))
468 evas_object_smart_callback_call(win->win_obj, SIG_WITHDRAWN, NULL);
469 else if (win->iconified)
470 evas_object_smart_callback_call(win->win_obj, SIG_ICONIFIED, NULL);
472 evas_object_smart_callback_call(win->win_obj, SIG_NORMAL, NULL);
477 evas_object_smart_callback_call(win->win_obj, SIG_STICK, NULL);
479 evas_object_smart_callback_call(win->win_obj, SIG_UNSTICK, NULL);
484 evas_object_smart_callback_call(win->win_obj, SIG_FULLSCREEN, NULL);
486 evas_object_smart_callback_call(win->win_obj, SIG_UNFULLSCREEN, NULL);
491 evas_object_smart_callback_call(win->win_obj, SIG_MAXIMIZED, NULL);
493 evas_object_smart_callback_call(win->win_obj, SIG_UNMAXIMIZED, NULL);
498 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
500 Elm_Win *wd = elm_widget_data_get(obj);
501 const Eina_List *items;
502 const Eina_List *list;
503 void *(*list_data_get) (const Eina_List *list);
507 list = elm_widget_sub_object_list_get(obj);
512 if (!(items = elm_widget_focus_custom_chain_get(obj)))
515 list_data_get = eina_list_data_get;
517 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
522 *next = (Evas_Object *)obj;
527 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
529 Elm_Win *win = elm_widget_data_get(obj);
533 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
535 evas_object_focus_set(obj, elm_widget_focus_get(obj));
539 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
541 if (type == EVAS_CALLBACK_KEY_DOWN)
543 Evas_Event_Key_Down *ev = event_info;
544 if (!strcmp(ev->keyname, "Tab"))
546 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
547 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
549 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
550 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
553 else if ((!strcmp(ev->keyname, "Left")) ||
554 ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
556 //TODO : woohyun jung
558 else if ((!strcmp(ev->keyname, "Right")) ||
559 ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
561 //TODO : woohyun jung
563 else if ((!strcmp(ev->keyname, "Up")) ||
564 ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
566 //TODO : woohyun jung
568 else if ((!strcmp(ev->keyname, "Down")) ||
569 ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
571 //TODO : woohyun jung
579 _deferred_ecore_evas_free(void *data)
581 ecore_evas_free(data);
582 _elm_win_deferred_free--;
586 _elm_win_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
590 if (!win->show_count) win->show_count++;
591 if (win->shot.info) _shot_handle(win);
595 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
601 evas_object_hide(win->frame_obj);
603 else if (win->img_obj)
605 evas_object_hide(win->img_obj);
607 if (win->pointer.obj)
609 evas_object_hide(win->pointer.obj);
610 ecore_evas_hide(win->pointer.ee);
615 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
618 Evas_Object *child, *child2 = NULL;
622 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
623 _elm_win_obj_callback_parent_del, win);
626 if (win->autodel_clear) *(win->autodel_clear) = -1;
627 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
628 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
631 ecore_evas_callback_delete_request_set(win->ee, NULL);
632 ecore_evas_callback_resize_set(win->ee, NULL);
634 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
635 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
636 if (win->shot.info) eina_stringshare_del(win->shot.info);
637 if (win->shot.timer) ecore_timer_del(win->shot.timer);
638 evas_object_event_callback_del_full(win->win_obj, EVAS_CALLBACK_DEL,
639 _elm_win_obj_callback_del, win);
640 child = evas_object_bottom_get(win->evas);
643 /* if the object we see *IS* the window object (because we are
644 * faking a parent object inside the canvas), then skip it and
645 * go to the next one */
648 child = evas_object_above_get(child);
651 /* if we are using the next object above from the previous loop */
654 /* this object has refcounts from the previous loop */
655 child2 = evas_object_above_get(child);
656 if (child2) evas_object_ref(child2);
657 evas_object_del(child);
658 /* so unref from previous loop */
659 evas_object_unref(child);
664 /* just delete as normal (probably only first object */
665 child2 = evas_object_above_get(child);
666 if (child2) evas_object_ref(child2);
667 evas_object_del(child);
671 #ifdef HAVE_ELEMENTARY_X
672 if (win->client_message_handler)
673 ecore_event_handler_del(win->client_message_handler);
675 // FIXME: Why are we flushing edje on every window destroy ??
676 // edje_file_cache_flush();
677 // edje_collection_cache_flush();
678 // evas_image_cache_flush(win->evas);
679 // evas_font_cache_flush(win->evas);
680 // FIXME: we are in the del handler for the object and delete the canvas
681 // that lives under it from the handler... nasty. deferring doesn't help either
691 ecore_job_add(_deferred_ecore_evas_free, win->ee);
692 _elm_win_deferred_free++;
696 _elm_win_focus_highlight_shutdown(win);
697 eina_stringshare_del(win->focus_highlight.style);
699 if (win->title) eina_stringshare_del(win->title);
700 if (win->icon_name) eina_stringshare_del(win->icon_name);
701 if (win->role) eina_stringshare_del(win->role);
702 if (win->icon) evas_object_del(win->icon);
706 if ((!_elm_win_list) &&
707 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
709 edje_file_cache_flush();
710 edje_collection_cache_flush();
711 evas_image_cache_flush(e);
712 evas_font_cache_flush(e);
718 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
721 if (!win->img_obj) return;
722 evas_object_event_callback_del_full
723 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
724 evas_object_del(win->img_obj);
728 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
731 if (obj == win->parent) win->parent = NULL;
735 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
741 if ((x != win->screen.x) || (y != win->screen.y))
745 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
750 evas_object_move(obj, x, y);
755 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
758 // this is called to make sure all smart containers have calculated their
759 // sizes BEFORE we show the window to make sure it initially appears at
760 // our desired size (ie min size is known first)
761 evas_smart_objects_calculate(evas_object_evas_get(obj));
764 evas_object_show(win->frame_obj);
766 else if (win->img_obj)
768 evas_object_show(win->img_obj);
770 if (win->pointer.obj)
772 ecore_evas_show(win->pointer.ee);
773 evas_object_show(win->pointer.obj);
774 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
776 evas_object_show(obj);
780 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
784 if (ecore_evas_override_get(win->ee))
788 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
791 evas_object_smart_callback_call(win->win_obj, SIG_MOVED, NULL);
797 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
801 /* FIXME: We should update ecore_wl_window_location here !! */
803 else if (win->img_obj)
807 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
810 // evas_object_move(win->img_obj, x, y);
815 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
822 else if (win->img_obj)
824 Evas_Coord w = 1, h = 1;
826 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
830 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
836 evas_object_image_size_set(win->img_obj, w, h);
841 _elm_win_delete_request(Ecore_Evas *ee)
843 Evas_Object *obj = ecore_evas_object_associate_get(ee);
845 if (strcmp(elm_widget_type_get(obj), "win")) return;
847 win = elm_widget_data_get(obj);
849 int autodel = win->autodel;
850 win->autodel_clear = &autodel;
851 evas_object_ref(win->win_obj);
852 evas_object_smart_callback_call(win->win_obj, SIG_DELETE_REQUEST, NULL);
853 // FIXME: if above callback deletes - then the below will be invalid
854 if (autodel) evas_object_del(win->win_obj);
855 else win->autodel_clear = NULL;
856 evas_object_unref(win->win_obj);
860 _elm_win_resize_job(void *data)
867 win->deferred_resize_job = NULL;
868 ecore_evas_request_geometry_get(win->ee, NULL, NULL, &w, &h);
872 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &sw, &sh);
878 evas_object_resize(win->frame_obj, w, h);
880 else if (win->img_obj)
883 evas_object_resize(win->win_obj, w, h);
884 EINA_LIST_FOREACH(win->subobjs, l, obj)
886 evas_object_move(obj, 0, 0);
887 evas_object_resize(obj, w, h);
891 #ifdef HAVE_ELEMENTARY_X
893 _elm_win_xwindow_get(Elm_Win *win)
897 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
898 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
900 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
902 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
903 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
904 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
905 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
906 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
907 ENGINE_COMPARE(ELM_OPENGL_SDL) ||
908 ENGINE_COMPARE(ELM_OPENGL_COCOA))
911 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
913 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
915 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
917 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
920 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
922 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
925 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
927 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
929 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
931 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
933 #undef ENGINE_COMPARE
937 #ifdef HAVE_ELEMENTARY_X
939 _elm_win_xwin_update(Elm_Win *win)
943 _elm_win_xwindow_get(win);
948 win2 = elm_widget_data_get(win->parent);
952 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
956 if (!win->xwin) return; /* nothing more to do */
959 if (!s) s = _elm_appname;
961 if (win->icon_name) s = win->icon_name;
962 ecore_x_icccm_icon_name_set(win->xwin, s);
963 ecore_x_netwm_icon_name_set(win->xwin, s);
966 if (s) ecore_x_icccm_window_role_set(win->xwin, s);
973 data = evas_object_image_data_get(win->icon, EINA_FALSE);
977 int w = 0, h = 0, stride, x, y;
981 evas_object_image_size_get(win->icon, &w, &h);
982 stride = evas_object_image_stride_get(win->icon);
983 if ((w > 0) && (h > 0) &&
984 (stride >= (int)(w * sizeof(unsigned int))))
988 ic.data = malloc(w * h * sizeof(unsigned int));
992 p = (unsigned char *)data;
993 p2 = (unsigned int *)ic.data;
994 for (y = 0; y < h; y++)
996 for (x = 0; x < w; x++)
998 *p2 = *((unsigned int *)p);
999 p += sizeof(unsigned int);
1002 p += (stride - (w * sizeof(unsigned int)));
1004 ecore_x_netwm_icons_set(win->xwin, &ic, 1);
1008 evas_object_image_data_set(win->icon, data);
1015 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
1017 case ELM_WIN_DIALOG_BASIC:
1018 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
1020 case ELM_WIN_DESKTOP:
1021 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1024 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
1026 case ELM_WIN_TOOLBAR:
1027 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1030 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
1032 case ELM_WIN_UTILITY:
1033 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1035 case ELM_WIN_SPLASH:
1036 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1038 case ELM_WIN_DROPDOWN_MENU:
1039 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1041 case ELM_WIN_POPUP_MENU:
1042 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1044 case ELM_WIN_TOOLTIP:
1045 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1047 case ELM_WIN_NOTIFICATION:
1048 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1051 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
1054 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
1059 ecore_x_e_virtual_keyboard_state_set
1060 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
1061 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
1062 ecore_x_e_illume_indicator_state_set
1063 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1064 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
1065 ecore_x_e_illume_indicator_state_set
1066 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1071 _elm_win_eval_subobjs(Evas_Object *obj)
1074 const Evas_Object *child;
1076 Elm_Win *win = elm_widget_data_get(obj);
1077 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1081 EINA_LIST_FOREACH(win->subobjs, l, child)
1083 evas_object_size_hint_weight_get(child, &wx, &wy);
1084 if (wx == 0.0) xx = 0;
1085 if (wy == 0.0) xy = 0;
1087 evas_object_size_hint_min_get(child, &w, &h);
1090 if (w > minw) minw = w;
1091 if (h > minh) minh = h;
1093 evas_object_size_hint_max_get(child, &w, &h);
1096 if (maxw == -1) maxw = w;
1097 else if ((w > 0) && (w < maxw)) maxw = w;
1098 if (maxh == -1) maxh = h;
1099 else if ((h > 0) && (h < maxh)) maxh = h;
1101 if (!xx) maxw = minw;
1103 if (!xy) maxh = minh;
1105 evas_object_size_hint_min_set(obj, minw, minh);
1106 evas_object_size_hint_max_set(obj, maxw, maxh);
1107 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1108 if (w < minw) w = minw;
1109 if (h < minh) h = minh;
1110 if ((maxw >= 0) && (w > maxw)) w = maxw;
1111 if ((maxh >= 0) && (h > maxh)) h = maxh;
1112 evas_object_resize(obj, w, h);
1116 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1118 Elm_Win *win = elm_widget_data_get(data);
1119 win->subobjs = eina_list_remove(win->subobjs, obj);
1120 _elm_win_eval_subobjs(win->win_obj);
1124 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1126 _elm_win_eval_subobjs(data);
1130 _elm_win_shutdown(void)
1132 while (_elm_win_list)
1133 evas_object_del(_elm_win_list->data);
1137 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
1144 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1145 elm_widget_theme(obj);
1149 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1150 elm_widget_theme_specific(obj, th, EINA_FALSE);
1155 _elm_win_translate(void)
1160 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1161 elm_widget_translate(obj);
1164 #ifdef HAVE_ELEMENTARY_X
1166 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
1168 Elm_Win *win = data;
1169 Ecore_X_Event_Client_Message *e = event;
1171 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1172 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1174 if ((unsigned)e->data.l[0] == win->xwin)
1176 Evas *evas = evas_object_evas_get(win->win_obj);
1179 edje_file_cache_flush();
1180 edje_collection_cache_flush();
1181 evas_image_cache_flush(evas);
1182 evas_font_cache_flush(evas);
1186 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1188 if ((unsigned)e->data.l[0] == win->xwin)
1190 Evas *evas = evas_object_evas_get(win->win_obj);
1193 edje_file_cache_flush();
1194 edje_collection_cache_flush();
1195 evas_image_cache_flush(evas);
1196 evas_font_cache_flush(evas);
1197 evas_render_dump(evas);
1201 return ECORE_CALLBACK_PASS_ON;
1206 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1208 Elm_Win *win = data;
1210 win->focus_highlight.geometry_changed = EINA_TRUE;
1211 _elm_win_focus_highlight_reconfigure_job_start(win);
1215 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1217 Elm_Win *win = data;
1219 win->focus_highlight.geometry_changed = EINA_TRUE;
1220 _elm_win_focus_highlight_reconfigure_job_start(win);
1224 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
1226 Elm_Win *win = data;
1228 win->focus_highlight.cur.target = NULL;
1230 _elm_win_focus_highlight_reconfigure_job_start(win);
1234 _elm_win_focus_target_callbacks_add(Elm_Win *win)
1236 Evas_Object *obj = win->focus_highlight.cur.target;
1238 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
1239 _elm_win_focus_target_move, win);
1240 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
1241 _elm_win_focus_target_resize, win);
1242 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
1243 _elm_win_focus_target_del, win);
1247 _elm_win_focus_target_callbacks_del(Elm_Win *win)
1249 Evas_Object *obj = win->focus_highlight.cur.target;
1251 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
1252 _elm_win_focus_target_move, win);
1253 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
1254 _elm_win_focus_target_resize, win);
1255 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
1256 _elm_win_focus_target_del, win);
1259 static Evas_Object *
1260 _elm_win_focus_target_get(Evas_Object *obj)
1262 Evas_Object *o = obj;
1266 if (elm_widget_is(o))
1268 if (!elm_widget_highlight_ignore_get(o))
1270 o = elm_widget_parent_get(o);
1272 o = evas_object_smart_parent_get(o);
1276 o = elm_widget_parent_widget_get(o);
1278 o = evas_object_smart_parent_get(o);
1287 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
1289 Evas_Object *obj = event_info, *target;
1290 Elm_Win *win = data;
1292 if (win->focus_highlight.cur.target == obj)
1295 target = _elm_win_focus_target_get(obj);
1296 win->focus_highlight.cur.target = target;
1297 if (elm_widget_highlight_in_theme_get(target))
1298 win->focus_highlight.cur.handled = EINA_TRUE;
1300 _elm_win_focus_target_callbacks_add(win);
1302 _elm_win_focus_highlight_reconfigure_job_start(win);
1306 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
1308 Elm_Win *win = data;
1310 if (!win->focus_highlight.cur.target)
1313 if (!win->focus_highlight.cur.handled)
1314 _elm_win_focus_target_callbacks_del(win);
1315 win->focus_highlight.cur.target = NULL;
1316 win->focus_highlight.cur.handled = EINA_FALSE;
1318 _elm_win_focus_highlight_reconfigure_job_start(win);
1322 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1324 evas_object_hide(obj);
1328 _elm_win_focus_highlight_init(Elm_Win *win)
1330 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1331 _elm_win_object_focus_in, win);
1332 evas_event_callback_add(win->evas,
1333 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1334 _elm_win_object_focus_out, win);
1336 win->focus_highlight.cur.target = evas_focus_get(win->evas);
1338 win->focus_highlight.top = edje_object_add(win->evas);
1339 win->focus_highlight.changed_theme = EINA_TRUE;
1340 edje_object_signal_callback_add(win->focus_highlight.top,
1341 "elm,action,focus,hide,end", "",
1342 _elm_win_focus_highlight_hide, NULL);
1343 edje_object_signal_callback_add(win->focus_highlight.top,
1344 "elm,action,focus,anim,end", "",
1345 _elm_win_focus_highlight_anim_end, win);
1346 _elm_win_focus_highlight_reconfigure_job_start(win);
1350 _elm_win_focus_highlight_shutdown(Elm_Win *win)
1352 _elm_win_focus_highlight_reconfigure_job_stop(win);
1353 if (win->focus_highlight.cur.target)
1355 _elm_win_focus_target_callbacks_del(win);
1356 win->focus_highlight.cur.target = NULL;
1358 if (win->focus_highlight.top)
1360 evas_object_del(win->focus_highlight.top);
1361 win->focus_highlight.top = NULL;
1364 evas_event_callback_del_full(win->evas,
1365 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1366 _elm_win_object_focus_in, win);
1367 evas_event_callback_del_full(win->evas,
1368 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1369 _elm_win_object_focus_out, win);
1373 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
1377 top = win->focus_highlight.top;
1382 evas_object_show(top);
1383 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
1389 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
1394 _elm_win_focus_highlight_reconfigure_job(void *data)
1396 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
1400 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
1402 if (win->focus_highlight.reconf_job)
1403 ecore_job_del(win->focus_highlight.reconf_job);
1404 win->focus_highlight.reconf_job = ecore_job_add(
1405 _elm_win_focus_highlight_reconfigure_job, win);
1409 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
1411 if (win->focus_highlight.reconf_job)
1412 ecore_job_del(win->focus_highlight.reconf_job);
1413 win->focus_highlight.reconf_job = NULL;
1417 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
1419 Evas_Object *clip, *target = win->focus_highlight.cur.target;
1420 Evas_Coord x, y, w, h;
1422 clip = evas_object_clip_get(target);
1423 evas_object_geometry_get(target, &x, &y, &w, &h);
1425 evas_object_move(obj, x, y);
1426 evas_object_resize(obj, w, h);
1427 evas_object_clip_set(obj, clip);
1431 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
1433 Evas_Coord tx, ty, tw, th;
1434 Evas_Coord w, h, px, py, pw, ph;
1435 Edje_Message_Int_Set *m;
1436 Evas_Object *previous = win->focus_highlight.prev.target;
1437 Evas_Object *target = win->focus_highlight.cur.target;
1439 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
1440 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
1441 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
1442 evas_object_move(obj, 0, 0);
1443 evas_object_resize(obj, tw, th);
1444 evas_object_clip_unset(obj);
1446 m = alloca(sizeof(*m) + (sizeof(int) * 8));
1456 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
1460 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
1462 Elm_Win *win = data;
1463 _elm_win_focus_highlight_simple_setup(win, obj);
1467 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
1469 Evas_Object *target = win->focus_highlight.cur.target;
1470 Evas_Object *previous = win->focus_highlight.prev.target;
1471 Evas_Object *top = win->focus_highlight.top;
1472 Eina_Bool visible_changed;
1473 Eina_Bool common_visible;
1474 const char *sig = NULL;
1476 _elm_win_focus_highlight_reconfigure_job_stop(win);
1478 visible_changed = (win->focus_highlight.cur.visible !=
1479 win->focus_highlight.prev.visible);
1481 if ((target == previous) && (!visible_changed) &&
1482 (!win->focus_highlight.geometry_changed))
1485 if ((previous) && (win->focus_highlight.prev.handled))
1486 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
1489 common_visible = EINA_FALSE;
1490 else if (win->focus_highlight.cur.handled)
1492 common_visible = EINA_FALSE;
1493 if (win->focus_highlight.cur.visible)
1494 sig = "elm,action,focus_highlight,show";
1496 sig = "elm,action,focus_highlight,hide";
1499 common_visible = win->focus_highlight.cur.visible;
1501 _elm_win_focus_highlight_visible_set(win, common_visible);
1503 elm_widget_signal_emit(target, sig, "elm");
1505 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1508 if (win->focus_highlight.changed_theme)
1511 if (win->focus_highlight.style)
1512 str = win->focus_highlight.style;
1515 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1517 win->focus_highlight.changed_theme = EINA_FALSE;
1519 if (_elm_config->focus_highlight_animate)
1521 str = edje_object_data_get(win->focus_highlight.top, "animate");
1522 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1526 if ((win->focus_highlight.top_animate) && (previous) &&
1527 (!win->focus_highlight.prev.handled))
1528 _elm_win_focus_highlight_anim_setup(win, top);
1530 _elm_win_focus_highlight_simple_setup(win, top);
1531 evas_object_raise(top);
1534 win->focus_highlight.geometry_changed = EINA_FALSE;
1535 win->focus_highlight.prev = win->focus_highlight.cur;
1539 _elm_win_frame_add(Elm_Win *win, const char *style)
1541 evas_output_framespace_set(win->evas, 0, 22, 0, 26);
1543 win->frame_obj = edje_object_add(win->evas);
1544 _elm_theme_set(NULL, win->frame_obj, "border", "base", style);
1545 evas_object_is_frame_object_set(win->frame_obj, EINA_TRUE);
1546 evas_object_move(win->frame_obj, 0, 0);
1547 evas_object_resize(win->frame_obj, 1, 1);
1549 edje_object_signal_callback_add(win->frame_obj, "elm,action,move,start",
1550 "elm", _elm_win_frame_cb_move_start, win);
1551 edje_object_signal_callback_add(win->frame_obj, "elm,action,resize,start",
1552 "*", _elm_win_frame_cb_resize_start, win);
1553 edje_object_signal_callback_add(win->frame_obj, "elm,action,minimize",
1554 "elm", _elm_win_frame_cb_minimize, win);
1555 edje_object_signal_callback_add(win->frame_obj, "elm,action,maximize",
1556 "elm", _elm_win_frame_cb_maximize, win);
1557 edje_object_signal_callback_add(win->frame_obj, "elm,action,close",
1558 "elm", _elm_win_frame_cb_close, win);
1562 _elm_win_frame_cb_move_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1566 if (!(win = data)) return;
1567 /* FIXME: Change mouse pointer */
1569 /* NB: Wayland handles moving surfaces by itself so we cannot
1570 * specify a specific x/y we want. Instead, we will pass in the
1571 * existing x/y values so they can be recorded as 'previous' position.
1572 * The new position will get updated automatically when the move is
1575 ecore_evas_wayland_move(win->ee, win->screen.x, win->screen.y);
1579 _elm_win_frame_cb_resize_start(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source)
1583 if (!(win = data)) return;
1584 if (win->resizing) return;
1585 win->resizing = EINA_TRUE;
1587 /* FIXME: Change mouse pointer */
1589 if (!strcmp(source, "elm.event.resize.t"))
1590 win->resize_location = 1;
1591 else if (!strcmp(source, "elm.event.resize.b"))
1592 win->resize_location = 2;
1593 else if (!strcmp(source, "elm.event.resize.l"))
1594 win->resize_location = 4;
1595 else if (!strcmp(source, "elm.event.resize.r"))
1596 win->resize_location = 8;
1597 else if (!strcmp(source, "elm.event.resize.tl"))
1598 win->resize_location = 5;
1599 else if (!strcmp(source, "elm.event.resize.tr"))
1600 win->resize_location = 9;
1601 else if (!strcmp(source, "elm.event.resize.bl"))
1602 win->resize_location = 6;
1603 else if (!strcmp(source, "elm.event.resize.br"))
1604 win->resize_location = 10;
1606 win->resize_location = 0;
1608 if (win->resize_location > 0)
1609 ecore_evas_wayland_resize(win->ee, win->resize_location);
1613 _elm_win_frame_cb_minimize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1617 if (!(win = data)) return;
1618 win->iconified = EINA_TRUE;
1619 ecore_evas_iconified_set(win->ee, EINA_TRUE);
1623 _elm_win_frame_cb_maximize(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1627 if (!(win = data)) return;
1628 if (win->maximized) win->maximized = EINA_FALSE;
1629 else win->maximized = EINA_TRUE;
1630 ecore_evas_maximized_set(win->ee, win->maximized);
1634 _elm_win_frame_cb_close(void *data, Evas_Object *obj __UNUSED__, const char *sig __UNUSED__, const char *source __UNUSED__)
1638 if (!(win = data)) return;
1639 evas_object_del(win->win_obj);
1644 _elm_win_pointer_add(Elm_Win *win, const char *style)
1650 win->pointer.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 32, 32, 0);
1651 ecore_evas_resize(win->pointer.ee, 32, 32);
1653 win->pointer.evas = ecore_evas_get(win->ee);
1655 win->pointer.obj = edje_object_add(win->pointer.evas);
1656 _elm_theme_set(NULL, win->pointer.obj, "pointer", "base", style);
1657 edje_object_size_min_calc(win->pointer.obj, &mw, &mh);
1658 evas_object_move(win->pointer.obj, 0, 0);
1659 evas_object_resize(win->pointer.obj, 32, 32);
1660 evas_object_show(win->pointer.obj);
1666 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1668 Evas_Event_Key_Down *ev = event_info;
1670 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1673 if ((strcmp(ev->keyname, "F12")) ||
1674 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1677 printf("Tree graph generated.\n");
1678 elm_object_tree_dot_dump(obj, "./dump.dot");
1683 _win_img_hide(void *data,
1685 Evas_Object *obj __UNUSED__,
1686 void *event_info __UNUSED__)
1688 Elm_Win *win = data;
1690 elm_widget_focus_hide_handle(win->win_obj);
1694 _win_img_mouse_up(void *data,
1696 Evas_Object *obj __UNUSED__,
1699 Elm_Win *win = data;
1700 Evas_Event_Mouse_Up *ev = event_info;
1701 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
1702 elm_widget_focus_mouse_up_handle(win->win_obj);
1706 _win_img_focus_in(void *data,
1708 Evas_Object *obj __UNUSED__,
1709 void *event_info __UNUSED__)
1711 Elm_Win *win = data;
1712 elm_widget_focus_steal(win->win_obj);
1716 _win_img_focus_out(void *data,
1718 Evas_Object *obj __UNUSED__,
1719 void *event_info __UNUSED__)
1721 Elm_Win *win = data;
1722 elm_widget_focused_object_clear(win->win_obj);
1726 _win_inlined_image_set(Elm_Win *win)
1728 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1729 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1730 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1731 _elm_win_obj_callback_img_obj_del, win);
1733 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1734 _win_img_hide, win);
1735 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_UP,
1736 _win_img_mouse_up, win);
1737 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1738 _win_img_focus_in, win);
1739 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1740 _win_img_focus_out, win);
1744 _subobj_del(Elm_Win *win, Evas_Object *obj, Evas_Object *subobj)
1746 evas_object_event_callback_del_full(subobj,
1747 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1748 _elm_win_subobj_callback_changed_size_hints,
1750 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1751 _elm_win_subobj_callback_del, obj);
1752 win->subobjs = eina_list_remove(win->subobjs, subobj);
1753 _elm_win_eval_subobjs(obj);
1757 _elm_win_obj_icon_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
1759 Elm_Win *win = data;
1760 if (win->icon == obj) win->icon = NULL;
1764 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1768 const char *fontpath;
1770 win = ELM_NEW(Elm_Win);
1772 #define FALLBACK_TRY(engine) \
1775 CRITICAL(engine " engine creation failed. Trying default."); \
1776 win->ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
1778 elm_config_preferred_engine_set(ecore_evas_engine_name_get(win->ee)); \
1780 #define ENGINE_COMPARE(name) (_elm_preferred_engine && !strcmp(_elm_preferred_engine, name))
1782 win->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
1783 win->indmode = ELM_WIN_INDICATOR_UNKNOWN;
1787 case ELM_WIN_INLINED_IMAGE:
1790 Evas *e = evas_object_evas_get(parent);
1793 ee = ecore_evas_ecore_evas_get(e);
1795 win->img_obj = ecore_evas_object_image_new(ee);
1796 if (!win->img_obj) break;
1797 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1800 _win_inlined_image_set(win);
1803 evas_object_del(win->img_obj);
1804 win->img_obj = NULL;
1808 case ELM_WIN_SOCKET_IMAGE:
1809 win->ee = ecore_evas_extn_socket_new(1, 1);
1813 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1815 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1816 #ifdef HAVE_ELEMENTARY_X
1817 win->client_message_handler = ecore_event_handler_add
1818 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1820 FALLBACK_TRY("Sofware X11");
1822 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1824 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1825 FALLBACK_TRY("Sofware FB");
1827 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1829 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1830 FALLBACK_TRY("Sofware DirectFB");
1832 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1834 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1835 FALLBACK_TRY("Sofware-16");
1836 #ifdef HAVE_ELEMENTARY_X
1837 win->client_message_handler = ecore_event_handler_add
1838 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1841 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1843 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1844 FALLBACK_TRY("Sofware-8");
1845 #ifdef HAVE_ELEMENTARY_X
1846 win->client_message_handler = ecore_event_handler_add
1847 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1851 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1853 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1854 FALLBACK_TRY("XRender");
1855 #ifdef HAVE_ELEMENTARY_X
1856 win->client_message_handler = ecore_event_handler_add
1857 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1861 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1866 if (_elm_config->vsync)
1868 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
1874 win->ee = ecore_evas_gl_x11_options_new(NULL, 0, 0, 0, 1, 1, opt);
1876 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1877 FALLBACK_TRY("OpenGL");
1878 #ifdef HAVE_ELEMENTARY_X
1879 win->client_message_handler = ecore_event_handler_add
1880 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1883 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1885 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1886 FALLBACK_TRY("Sofware Win32");
1888 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1890 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1891 FALLBACK_TRY("Sofware-16-WinCE");
1893 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
1895 win->ee = ecore_evas_psl1ght_new(NULL, 1, 1);
1896 FALLBACK_TRY("PSL1GHT");
1898 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1900 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1901 FALLBACK_TRY("Sofware SDL");
1903 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1905 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1906 FALLBACK_TRY("Sofware-16-SDL");
1908 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1910 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1911 FALLBACK_TRY("OpenGL SDL");
1913 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
1915 win->ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
1916 FALLBACK_TRY("OpenGL Cocoa");
1918 else if (ENGINE_COMPARE(ELM_BUFFER))
1920 win->ee = ecore_evas_buffer_new(1, 1);
1922 else if (ENGINE_COMPARE(ELM_EWS))
1924 win->ee = ecore_evas_ews_new(0, 0, 1, 1);
1926 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
1928 win->ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
1929 win->evas = ecore_evas_get(win->ee);
1931 _elm_win_frame_add(win, "default");
1932 // _elm_win_pointer_add(win, "default");
1934 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
1936 win->ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
1937 win->evas = ecore_evas_get(win->ee);
1939 _elm_win_frame_add(win, "default");
1940 // _elm_win_pointer_add(win, "default");
1942 else if (!strncmp(_elm_preferred_engine, "shot:", 5))
1944 win->ee = ecore_evas_buffer_new(1, 1);
1945 ecore_evas_manual_render_set(win->ee, EINA_TRUE);
1946 win->shot.info = eina_stringshare_add(_elm_preferred_engine + 5);
1955 ERR("Cannot create window.");
1959 #ifdef HAVE_ELEMENTARY_X
1960 _elm_win_xwindow_get(win);
1962 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1963 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1964 // bg pixmap done by x - has other issues like can be redrawn by x before it
1965 // is filled/ready by app
1966 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1969 win->parent = parent;
1971 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1972 _elm_win_obj_callback_parent_del, win);
1974 win->evas = ecore_evas_get(win->ee);
1975 win->win_obj = elm_widget_add(win->evas);
1976 elm_widget_type_set(win->win_obj, "win");
1977 ELM_SET_WIDTYPE(widtype, "win");
1978 elm_widget_data_set(win->win_obj, win);
1979 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1980 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1981 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1982 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1983 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1984 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1985 evas_object_move(win->win_obj, 0, 0);
1986 evas_object_resize(win->win_obj, 1, 1);
1987 evas_object_layer_set(win->win_obj, 50);
1988 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1992 evas_object_clip_set(win->win_obj, win->frame_obj);
1993 evas_object_stack_below(win->frame_obj, win->win_obj);
1996 if (type == ELM_WIN_INLINED_IMAGE)
1997 elm_widget_parent2_set(win->win_obj, parent);
1998 ecore_evas_object_associate(win->ee, win->win_obj,
1999 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
2000 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
2001 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
2002 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
2003 _elm_win_obj_callback_show, win);
2004 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
2005 _elm_win_obj_callback_hide, win);
2006 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
2007 _elm_win_obj_callback_del, win);
2008 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
2009 _elm_win_obj_callback_move, win);
2010 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
2011 _elm_win_obj_callback_resize, win);
2013 evas_object_intercept_move_callback_add(win->win_obj,
2014 _elm_win_obj_intercept_move, win);
2015 evas_object_intercept_show_callback_add(win->win_obj,
2016 _elm_win_obj_intercept_show, win);
2018 evas_object_smart_callback_add(win->win_obj, "sub-object-del", (Evas_Smart_Cb)_subobj_del, win);
2019 ecore_evas_name_class_set(win->ee, name, _elm_appname);
2020 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
2021 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
2022 ecore_evas_callback_mouse_in_set(win->ee, _elm_win_mouse_in);
2023 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
2024 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
2025 ecore_evas_callback_move_set(win->ee, _elm_win_move);
2026 ecore_evas_callback_state_change_set(win->ee, _elm_win_state_change);
2027 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
2028 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
2029 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2030 evas_font_path_append(win->evas, fontpath);
2031 if (!_elm_config->font_hinting)
2032 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
2033 else if (_elm_config->font_hinting == 1)
2034 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
2035 else if (_elm_config->font_hinting == 2)
2036 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
2038 #ifdef HAVE_ELEMENTARY_X
2039 _elm_win_xwin_update(win);
2042 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
2044 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2046 ecore_evas_fullscreen_set(win->ee, 1);
2048 #undef ENGINE_COMPARE
2050 if (_elm_config->focus_highlight_enable)
2051 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
2054 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
2055 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
2056 _debug_key_down, win);
2058 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
2060 printf("Ctrl+F12 key combination exclusive for dot tree generation\n");
2063 evas_object_smart_callbacks_descriptions_set(win->win_obj, _signals);
2065 return win->win_obj;
2069 elm_win_util_standard_add(const char *name, const char *title)
2071 Evas_Object *win, *bg;
2073 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
2074 if (!win) return NULL;
2075 elm_win_title_set(win, title);
2076 bg = elm_bg_add(win);
2079 evas_object_del(win);
2082 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2083 elm_win_resize_object_add(win, bg);
2084 evas_object_show(bg);
2089 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
2093 ELM_CHECK_WIDTYPE(obj, widtype);
2094 win = elm_widget_data_get(obj);
2096 if (eina_list_data_find(win->subobjs, subobj)) return;
2097 win->subobjs = eina_list_append(win->subobjs, subobj);
2098 elm_widget_sub_object_add(obj, subobj);
2099 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
2100 _elm_win_subobj_callback_del, obj);
2101 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2102 _elm_win_subobj_callback_changed_size_hints,
2104 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
2105 evas_object_move(subobj, 0, 0);
2106 evas_object_resize(subobj, w, h);
2107 _elm_win_eval_subobjs(obj);
2111 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
2114 ELM_CHECK_WIDTYPE(obj, widtype);
2115 win = elm_widget_data_get(obj);
2117 evas_object_event_callback_del_full(subobj,
2118 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2119 _elm_win_subobj_callback_changed_size_hints,
2121 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
2122 _elm_win_subobj_callback_del, obj);
2123 win->subobjs = eina_list_remove(win->subobjs, subobj);
2124 elm_widget_sub_object_del(obj, subobj);
2125 _elm_win_eval_subobjs(obj);
2129 elm_win_title_set(Evas_Object *obj, const char *title)
2132 ELM_CHECK_WIDTYPE(obj, widtype);
2133 win = elm_widget_data_get(obj);
2134 if (!win || !title) return;
2135 eina_stringshare_replace(&(win->title), title);
2136 ecore_evas_title_set(win->ee, win->title);
2138 edje_object_part_text_escaped_set(win->frame_obj, "elm.text.title", win->title);
2142 elm_win_title_get(const Evas_Object *obj)
2145 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2146 win = elm_widget_data_get(obj);
2147 if (!win) return NULL;
2152 elm_win_icon_name_set(Evas_Object *obj, const char *icon_name)
2155 ELM_CHECK_WIDTYPE(obj, widtype);
2156 win = elm_widget_data_get(obj);
2157 if (!win || !icon_name) return;
2158 eina_stringshare_replace(&(win->icon_name), icon_name);
2159 #ifdef HAVE_ELEMENTARY_X
2160 _elm_win_xwin_update(win);
2165 elm_win_icon_name_get(const Evas_Object *obj)
2168 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2169 win = elm_widget_data_get(obj);
2170 if (!win) return NULL;
2171 return win->icon_name;
2175 elm_win_role_set(Evas_Object *obj, const char *role)
2178 ELM_CHECK_WIDTYPE(obj, widtype);
2179 win = elm_widget_data_get(obj);
2180 if (!win || !role) return;
2181 eina_stringshare_replace(&(win->role), role);
2182 #ifdef HAVE_ELEMENTARY_X
2183 _elm_win_xwin_update(win);
2188 elm_win_role_get(const Evas_Object *obj)
2191 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2192 win = elm_widget_data_get(obj);
2193 if (!win) return NULL;
2198 elm_win_icon_object_set(Evas_Object *obj, Evas_Object *icon)
2201 ELM_CHECK_WIDTYPE(obj, widtype);
2202 win = elm_widget_data_get(obj);
2205 evas_object_event_callback_del_full(win->icon, EVAS_CALLBACK_DEL,
2206 _elm_win_obj_icon_callback_del, win);
2209 evas_object_event_callback_add(win->icon, EVAS_CALLBACK_DEL,
2210 _elm_win_obj_icon_callback_del, win);
2211 #ifdef HAVE_ELEMENTARY_X
2212 _elm_win_xwin_update(win);
2216 EAPI const Evas_Object *
2217 elm_win_icon_object_get(const Evas_Object *obj)
2220 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2221 win = elm_widget_data_get(obj);
2222 if (!win) return NULL;
2227 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
2230 ELM_CHECK_WIDTYPE(obj, widtype);
2231 win = elm_widget_data_get(obj);
2233 win->autodel = autodel;
2237 elm_win_autodel_get(const Evas_Object *obj)
2240 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2241 win = elm_widget_data_get(obj);
2242 if (!win) return EINA_FALSE;
2243 return win->autodel;
2247 elm_win_activate(Evas_Object *obj)
2250 ELM_CHECK_WIDTYPE(obj, widtype);
2251 win = elm_widget_data_get(obj);
2253 ecore_evas_activate(win->ee);
2257 elm_win_lower(Evas_Object *obj)
2260 ELM_CHECK_WIDTYPE(obj, widtype);
2261 win = elm_widget_data_get(obj);
2263 ecore_evas_lower(win->ee);
2267 elm_win_raise(Evas_Object *obj)
2270 ELM_CHECK_WIDTYPE(obj, widtype);
2271 win = elm_widget_data_get(obj);
2273 ecore_evas_raise(win->ee);
2277 elm_win_center(Evas_Object *obj, Eina_Bool h, Eina_Bool v)
2280 int win_w, win_h, screen_w, screen_h, nx, ny;
2281 ELM_CHECK_WIDTYPE(obj, widtype);
2282 win = elm_widget_data_get(obj);
2284 ecore_evas_screen_geometry_get(win->ee, NULL, NULL, &screen_w, &screen_h);
2285 if ((!screen_w) || (!screen_h)) return;
2286 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
2287 if ((!win_w) || (!win_h)) return;
2288 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
2289 else nx = win->screen.x;
2290 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
2291 else ny = win->screen.y;
2294 evas_object_move(obj, nx, ny);
2298 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
2301 ELM_CHECK_WIDTYPE(obj, widtype);
2302 win = elm_widget_data_get(obj);
2304 ecore_evas_borderless_set(win->ee, borderless);
2305 #ifdef HAVE_ELEMENTARY_X
2306 _elm_win_xwin_update(win);
2311 elm_win_borderless_get(const Evas_Object *obj)
2314 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2315 win = elm_widget_data_get(obj);
2316 if (!win) return EINA_FALSE;
2317 return ecore_evas_borderless_get(win->ee);
2321 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
2324 ELM_CHECK_WIDTYPE(obj, widtype);
2325 win = elm_widget_data_get(obj);
2327 ecore_evas_shaped_set(win->ee, shaped);
2328 #ifdef HAVE_ELEMENTARY_X
2329 _elm_win_xwin_update(win);
2334 elm_win_shaped_get(const Evas_Object *obj)
2337 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2338 win = elm_widget_data_get(obj);
2339 if (!win) return EINA_FALSE;
2340 return ecore_evas_shaped_get(win->ee);
2344 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
2347 ELM_CHECK_WIDTYPE(obj, widtype);
2348 win = elm_widget_data_get(obj);
2353 else if (win->img_obj)
2355 evas_object_image_alpha_set(win->img_obj, alpha);
2356 ecore_evas_alpha_set(win->ee, alpha);
2360 #ifdef HAVE_ELEMENTARY_X
2365 if (!_elm_config->compositing)
2366 elm_win_shaped_set(obj, alpha);
2368 ecore_evas_alpha_set(win->ee, alpha);
2371 ecore_evas_alpha_set(win->ee, alpha);
2372 _elm_win_xwin_update(win);
2376 ecore_evas_alpha_set(win->ee, alpha);
2381 elm_win_alpha_get(const Evas_Object *obj)
2384 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2385 win = elm_widget_data_get(obj);
2386 if (!win) return EINA_FALSE;
2390 else if (win->img_obj)
2392 return evas_object_image_alpha_get(win->img_obj);
2394 return ecore_evas_alpha_get(win->ee);
2398 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
2401 ELM_CHECK_WIDTYPE(obj, widtype);
2402 win = elm_widget_data_get(obj);
2404 ecore_evas_override_set(win->ee, override);
2405 #ifdef HAVE_ELEMENTARY_X
2406 _elm_win_xwin_update(win);
2411 elm_win_override_get(const Evas_Object *obj)
2414 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2415 win = elm_widget_data_get(obj);
2416 if (!win) return EINA_FALSE;
2417 return ecore_evas_override_get(win->ee);
2421 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
2424 ELM_CHECK_WIDTYPE(obj, widtype);
2425 win = elm_widget_data_get(obj);
2427 // YYY: handle if win->img_obj
2428 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2429 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2430 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2432 // these engines... can ONLY be fullscreen
2437 win->fullscreen = fullscreen;
2438 ecore_evas_fullscreen_set(win->ee, fullscreen);
2439 #ifdef HAVE_ELEMENTARY_X
2440 _elm_win_xwin_update(win);
2443 #undef ENGINE_COMPARE
2447 elm_win_fullscreen_get(const Evas_Object *obj)
2450 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2451 win = elm_widget_data_get(obj);
2452 if (!win) return EINA_FALSE;
2453 #define ENGINE_COMPARE(name) (!strcmp(_elm_preferred_engine, name))
2454 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
2455 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2457 // these engines... can ONLY be fullscreen
2462 return win->fullscreen;
2464 #undef ENGINE_COMPARE
2468 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
2471 ELM_CHECK_WIDTYPE(obj, widtype);
2472 win = elm_widget_data_get(obj);
2474 win->maximized = maximized;
2475 // YYY: handle if win->img_obj
2476 ecore_evas_maximized_set(win->ee, maximized);
2477 #ifdef HAVE_ELEMENTARY_X
2478 _elm_win_xwin_update(win);
2483 elm_win_maximized_get(const Evas_Object *obj)
2486 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2487 win = elm_widget_data_get(obj);
2488 if (!win) return EINA_FALSE;
2489 return win->maximized;
2493 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
2496 ELM_CHECK_WIDTYPE(obj, widtype);
2497 win = elm_widget_data_get(obj);
2499 win->iconified = iconified;
2500 ecore_evas_iconified_set(win->ee, iconified);
2501 #ifdef HAVE_ELEMENTARY_X
2502 _elm_win_xwin_update(win);
2507 elm_win_iconified_get(const Evas_Object *obj)
2510 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2511 win = elm_widget_data_get(obj);
2512 if (!win) return EINA_FALSE;
2513 return win->iconified;
2517 elm_win_withdrawn_set(Evas_Object *obj, Eina_Bool withdrawn)
2520 ELM_CHECK_WIDTYPE(obj, widtype);
2521 win = elm_widget_data_get(obj);
2523 win->withdrawn = withdrawn;
2524 ecore_evas_withdrawn_set(win->ee, withdrawn);
2525 #ifdef HAVE_ELEMENTARY_X
2526 _elm_win_xwin_update(win);
2531 elm_win_withdrawn_get(const Evas_Object *obj)
2534 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2535 win = elm_widget_data_get(obj);
2536 if (!win) return EINA_FALSE;
2537 return win->withdrawn;
2541 elm_win_urgent_set(Evas_Object *obj, Eina_Bool urgent)
2544 ELM_CHECK_WIDTYPE(obj, widtype);
2545 win = elm_widget_data_get(obj);
2547 win->urgent = urgent;
2548 ecore_evas_urgent_set(win->ee, urgent);
2549 #ifdef HAVE_ELEMENTARY_X
2550 _elm_win_xwin_update(win);
2555 elm_win_urgent_get(const Evas_Object *obj)
2558 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2559 win = elm_widget_data_get(obj);
2560 if (!win) return EINA_FALSE;
2565 elm_win_demand_attention_set(Evas_Object *obj, Eina_Bool demand_attention)
2568 ELM_CHECK_WIDTYPE(obj, widtype);
2569 win = elm_widget_data_get(obj);
2571 win->demand_attention = demand_attention;
2572 ecore_evas_demand_attention_set(win->ee, demand_attention);
2573 #ifdef HAVE_ELEMENTARY_X
2574 _elm_win_xwin_update(win);
2579 elm_win_demand_attention_get(const Evas_Object *obj)
2582 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2583 win = elm_widget_data_get(obj);
2584 if (!win) return EINA_FALSE;
2585 return win->demand_attention;
2589 elm_win_modal_set(Evas_Object *obj, Eina_Bool modal)
2592 ELM_CHECK_WIDTYPE(obj, widtype);
2593 win = elm_widget_data_get(obj);
2596 ecore_evas_modal_set(win->ee, modal);
2597 #ifdef HAVE_ELEMENTARY_X
2598 _elm_win_xwin_update(win);
2603 elm_win_modal_get(const Evas_Object *obj)
2606 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2607 win = elm_widget_data_get(obj);
2608 if (!win) return EINA_FALSE;
2613 elm_win_aspect_set(Evas_Object *obj, double aspect)
2616 ELM_CHECK_WIDTYPE(obj, widtype);
2617 win = elm_widget_data_get(obj);
2619 win->aspect = aspect;
2620 ecore_evas_aspect_set(win->ee, aspect);
2621 #ifdef HAVE_ELEMENTARY_X
2622 _elm_win_xwin_update(win);
2627 elm_win_aspect_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;
2637 elm_win_layer_set(Evas_Object *obj, int layer)
2640 ELM_CHECK_WIDTYPE(obj, widtype);
2641 win = elm_widget_data_get(obj);
2643 ecore_evas_layer_set(win->ee, layer);
2644 #ifdef HAVE_ELEMENTARY_X
2645 _elm_win_xwin_update(win);
2650 elm_win_layer_get(const Evas_Object *obj)
2653 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2654 win = elm_widget_data_get(obj);
2655 if (!win) return -1;
2656 return ecore_evas_layer_get(win->ee);
2660 elm_win_rotation_set(Evas_Object *obj, int rotation)
2663 ELM_CHECK_WIDTYPE(obj, widtype);
2664 win = elm_widget_data_get(obj);
2666 if (win->rot == rotation) return;
2667 win->rot = rotation;
2668 ecore_evas_rotation_set(win->ee, rotation);
2669 evas_object_size_hint_min_set(obj, -1, -1);
2670 evas_object_size_hint_max_set(obj, -1, -1);
2671 _elm_win_eval_subobjs(obj);
2672 #ifdef HAVE_ELEMENTARY_X
2673 _elm_win_xwin_update(win);
2678 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
2681 ELM_CHECK_WIDTYPE(obj, widtype);
2682 win = elm_widget_data_get(obj);
2684 if (win->rot == rotation) return;
2685 win->rot = rotation;
2686 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2687 evas_object_size_hint_min_set(obj, -1, -1);
2688 evas_object_size_hint_max_set(obj, -1, -1);
2689 _elm_win_eval_subobjs(obj);
2690 #ifdef HAVE_ELEMENTARY_X
2691 _elm_win_xwin_update(win);
2696 elm_win_rotation_get(const Evas_Object *obj)
2699 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2700 win = elm_widget_data_get(obj);
2701 if (!win) return -1;
2706 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2709 ELM_CHECK_WIDTYPE(obj, widtype);
2710 win = elm_widget_data_get(obj);
2712 win->sticky = sticky;
2713 ecore_evas_sticky_set(win->ee, sticky);
2714 #ifdef HAVE_ELEMENTARY_X
2715 _elm_win_xwin_update(win);
2720 elm_win_sticky_get(const Evas_Object *obj)
2723 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2724 win = elm_widget_data_get(obj);
2725 if (!win) return EINA_FALSE;
2730 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2733 ELM_CHECK_WIDTYPE(obj, widtype);
2734 win = elm_widget_data_get(obj);
2736 if (mode == win->kbdmode) return;
2737 #ifdef HAVE_ELEMENTARY_X
2738 _elm_win_xwindow_get(win);
2740 win->kbdmode = mode;
2741 #ifdef HAVE_ELEMENTARY_X
2743 ecore_x_e_virtual_keyboard_state_set
2744 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2748 EAPI Elm_Win_Keyboard_Mode
2749 elm_win_keyboard_mode_get(const Evas_Object *obj)
2752 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2753 win = elm_widget_data_get(obj);
2754 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2755 return win->kbdmode;
2759 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2762 ELM_CHECK_WIDTYPE(obj, widtype);
2763 win = elm_widget_data_get(obj);
2765 #ifdef HAVE_ELEMENTARY_X
2766 _elm_win_xwindow_get(win);
2768 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2775 elm_win_keyboard_win_get(const Evas_Object *obj)
2778 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2779 win = elm_widget_data_get(obj);
2780 if (!win) return EINA_FALSE;
2781 #ifdef HAVE_ELEMENTARY_X
2782 _elm_win_xwindow_get(win);
2784 return ecore_x_e_virtual_keyboard_get(win->xwin);
2789 // WRAPPER: Temperary added.
2791 elm_win_indicator_state_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2793 elm_win_indicator_mode_set(obj, mode);
2797 elm_win_indicator_mode_set(Evas_Object *obj, Elm_Win_Indicator_Mode mode)
2800 ELM_CHECK_WIDTYPE(obj, widtype);
2801 win = elm_widget_data_get(obj);
2803 if (mode == win->indmode) return;
2804 #ifdef HAVE_ELEMENTARY_X
2805 _elm_win_xwindow_get(win);
2807 win->indmode = mode;
2808 #ifdef HAVE_ELEMENTARY_X
2811 if (win->indmode == ELM_WIN_INDICATOR_SHOW)
2812 ecore_x_e_illume_indicator_state_set
2813 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
2814 else if (win->indmode == ELM_WIN_INDICATOR_HIDE)
2815 ecore_x_e_illume_indicator_state_set
2816 (win->xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
2821 // WRAPPER: Temperary added.
2822 EAPI Elm_Win_Indicator_Mode
2823 elm_win_indicator_state_get(const Evas_Object *obj)
2825 return elm_win_indicator_mode_get(obj);
2828 EAPI Elm_Win_Indicator_Mode
2829 elm_win_indicator_mode_get(const Evas_Object *obj)
2832 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_UNKNOWN;
2833 win = elm_widget_data_get(obj);
2834 if (!win) return ELM_WIN_INDICATOR_UNKNOWN;
2835 return win->indmode;
2839 elm_win_indicator_opacity_set(Evas_Object *obj, Elm_Win_Indicator_Opacity_Mode mode)
2842 ELM_CHECK_WIDTYPE(obj, widtype);
2843 win = elm_widget_data_get(obj);
2845 if (mode == win->ind_o_mode) return;
2846 win->ind_o_mode = mode;
2847 #ifdef HAVE_ELEMENTARY_X
2848 _elm_win_xwindow_get(win);
2851 if (win->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
2852 ecore_x_e_illume_indicator_opacity_set
2853 (win->xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
2854 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
2855 ecore_x_e_illume_indicator_opacity_set
2856 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
2857 else if (win->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
2858 ecore_x_e_illume_indicator_opacity_set
2859 (win->xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
2865 EAPI Elm_Win_Indicator_Opacity_Mode
2866 elm_win_indicator_opacity_get(const Evas_Object *obj)
2869 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2870 win = elm_widget_data_get(obj);
2871 if (!win) return ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
2872 return win->ind_o_mode;
2876 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2879 ELM_CHECK_WIDTYPE(obj, widtype);
2880 win = elm_widget_data_get(obj);
2882 if (x) *x = win->screen.x;
2883 if (y) *y = win->screen.y;
2887 elm_win_focus_get(const Evas_Object *obj)
2890 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2891 win = elm_widget_data_get(obj);
2892 if (!win) return EINA_FALSE;
2893 return ecore_evas_focus_get(win->ee);
2897 elm_win_screen_constrain_set(Evas_Object *obj, Eina_Bool constrain)
2900 ELM_CHECK_WIDTYPE(obj, widtype);
2901 win = elm_widget_data_get(obj);
2903 win->constrain = !!constrain;
2907 elm_win_screen_constrain_get(Evas_Object *obj)
2910 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2911 win = elm_widget_data_get(obj);
2912 if (!win) return EINA_FALSE;
2913 return win->constrain;
2917 elm_win_screen_size_get(const Evas_Object *obj, int *x, int *y, int *w, int *h)
2920 ELM_CHECK_WIDTYPE(obj, widtype);
2921 win = elm_widget_data_get(obj);
2923 ecore_evas_screen_geometry_get(win->ee, x, y, w, h);
2927 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2930 ELM_CHECK_WIDTYPE(obj, widtype);
2931 win = elm_widget_data_get(obj);
2933 #ifdef HAVE_ELEMENTARY_X
2934 _elm_win_xwindow_get(win);
2936 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2943 elm_win_conformant_get(const Evas_Object *obj)
2946 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2947 win = elm_widget_data_get(obj);
2948 if (!win) return EINA_FALSE;
2949 #ifdef HAVE_ELEMENTARY_X
2950 _elm_win_xwindow_get(win);
2952 return ecore_x_e_illume_conformant_get(win->xwin);
2958 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2961 ELM_CHECK_WIDTYPE(obj, widtype);
2962 win = elm_widget_data_get(obj);
2964 #ifdef HAVE_ELEMENTARY_X
2965 _elm_win_xwindow_get(win);
2968 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2971 Ecore_X_Window_State states[2];
2973 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2974 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2975 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2976 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2985 elm_win_quickpanel_get(const Evas_Object *obj)
2988 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2989 win = elm_widget_data_get(obj);
2990 if (!win) return EINA_FALSE;
2991 #ifdef HAVE_ELEMENTARY_X
2992 _elm_win_xwindow_get(win);
2994 return ecore_x_e_illume_quickpanel_get(win->xwin);
3000 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
3003 ELM_CHECK_WIDTYPE(obj, widtype);
3004 win = elm_widget_data_get(obj);
3006 #ifdef HAVE_ELEMENTARY_X
3007 _elm_win_xwindow_get(win);
3009 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
3016 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
3019 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3020 win = elm_widget_data_get(obj);
3021 if (!win) return -1;
3022 #ifdef HAVE_ELEMENTARY_X
3023 _elm_win_xwindow_get(win);
3025 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
3031 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
3034 ELM_CHECK_WIDTYPE(obj, widtype);
3035 win = elm_widget_data_get(obj);
3037 #ifdef HAVE_ELEMENTARY_X
3038 _elm_win_xwindow_get(win);
3040 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
3047 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
3050 ELM_CHECK_WIDTYPE(obj, widtype) -1;
3051 win = elm_widget_data_get(obj);
3052 if (!win) return -1;
3053 #ifdef HAVE_ELEMENTARY_X
3054 _elm_win_xwindow_get(win);
3056 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
3062 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
3065 ELM_CHECK_WIDTYPE(obj, widtype);
3066 win = elm_widget_data_get(obj);
3068 #ifdef HAVE_ELEMENTARY_X
3069 _elm_win_xwindow_get(win);
3071 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
3078 elm_win_quickpanel_zone_get(const Evas_Object *obj)
3081 ELM_CHECK_WIDTYPE(obj, widtype) 0;
3082 win = elm_widget_data_get(obj);
3084 #ifdef HAVE_ELEMENTARY_X
3085 _elm_win_xwindow_get(win);
3087 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
3093 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
3096 ELM_CHECK_WIDTYPE(obj, widtype);
3097 win = elm_widget_data_get(obj);
3099 win->skip_focus = skip;
3100 ecore_evas_focus_skip_set(win->ee, skip);
3104 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
3107 ELM_CHECK_WIDTYPE(obj, widtype);
3108 win = elm_widget_data_get(obj);
3110 #ifdef HAVE_ELEMENTARY_X
3111 _elm_win_xwindow_get(win);
3116 case ELM_ILLUME_COMMAND_FOCUS_BACK:
3117 ecore_x_e_illume_focus_back_send(win->xwin);
3119 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
3120 ecore_x_e_illume_focus_forward_send(win->xwin);
3122 case ELM_ILLUME_COMMAND_FOCUS_HOME:
3123 ecore_x_e_illume_focus_home_send(win->xwin);
3125 case ELM_ILLUME_COMMAND_CLOSE:
3126 ecore_x_e_illume_close_send(win->xwin);
3138 elm_win_inlined_image_object_get(Evas_Object *obj)
3141 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3142 win = elm_widget_data_get(obj);
3143 if (!win) return NULL;
3144 return win->img_obj;
3148 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
3152 ELM_CHECK_WIDTYPE(obj, widtype);
3154 win = elm_widget_data_get(obj);
3155 enabled = !!enabled;
3156 if (win->focus_highlight.enabled == enabled)
3159 win->focus_highlight.enabled = enabled;
3161 if (win->focus_highlight.enabled)
3162 _elm_win_focus_highlight_init(win);
3164 _elm_win_focus_highlight_shutdown(win);
3168 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
3172 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3174 win = elm_widget_data_get(obj);
3175 return win->focus_highlight.enabled;
3179 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
3183 ELM_CHECK_WIDTYPE(obj, widtype);
3185 win = elm_widget_data_get(obj);
3186 eina_stringshare_replace(&win->focus_highlight.style, style);
3187 win->focus_highlight.changed_theme = EINA_TRUE;
3188 _elm_win_focus_highlight_reconfigure_job_start(win);
3192 elm_win_focus_highlight_style_get(const Evas_Object *obj)
3196 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3198 win = elm_widget_data_get(obj);
3199 return win->focus_highlight.style;
3202 typedef struct _Widget_Data Widget_Data;
3207 Evas_Object *content;
3210 static void _del_hook(Evas_Object *obj);
3211 static void _theme_hook(Evas_Object *obj);
3212 static void _sizing_eval(Evas_Object *obj);
3213 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
3214 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
3216 static const char *widtype2 = NULL;
3219 _del_hook(Evas_Object *obj)
3221 Widget_Data *wd = elm_widget_data_get(obj);
3227 _theme_hook(Evas_Object *obj)
3229 Widget_Data *wd = elm_widget_data_get(obj);
3230 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
3232 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
3235 evas_object_smart_callback_call(obj, SIG_THEME_CHANGED, NULL);
3239 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
3241 Widget_Data *wd = elm_widget_data_get(obj);
3246 /* Try Focus cycle in subitem */
3249 elm_widget_focus_next_get(wd->content, dir, next);
3254 *next = (Evas_Object *)obj;
3259 _elm_inwin_text_set_hook(Evas_Object *obj, const char *item, const char *text)
3261 Widget_Data *wd = elm_widget_data_get(obj);
3263 if (!wd || !item) return;
3264 edje_object_part_text_escaped_set(wd->frm, item, text);
3269 _elm_inwin_text_get_hook(const Evas_Object *obj, const char *item)
3271 Widget_Data *wd = elm_widget_data_get(obj);
3273 if (!item || !wd || !wd->frm) return NULL;
3274 return edje_object_part_text_get(wd->frm, item);
3278 _sizing_eval(Evas_Object *obj)
3280 Widget_Data *wd = elm_widget_data_get(obj);
3281 Evas_Coord minw = -1, minh = -1;
3283 evas_object_size_hint_min_get(wd->content, &minw, &minh);
3284 edje_object_size_min_calc(wd->frm, &minw, &minh);
3285 evas_object_size_hint_min_set(obj, minw, minh);
3286 evas_object_size_hint_max_set(obj, -1, -1);
3290 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
3296 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
3298 Widget_Data *wd = elm_widget_data_get(obj);
3299 Evas_Object *sub = event_info;
3300 if (sub == wd->content)
3302 evas_object_event_callback_del_full
3303 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
3310 elm_win_inwin_add(Evas_Object *obj)
3316 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
3317 win = elm_widget_data_get(obj);
3318 if (!win) return NULL;
3319 wd = ELM_NEW(Widget_Data);
3320 obj2 = elm_widget_add(win->evas);
3321 elm_widget_type_set(obj2, "inwin");
3322 ELM_SET_WIDTYPE(widtype2, "inwin");
3323 elm_widget_sub_object_add(obj, obj2);
3324 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3325 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
3326 elm_win_resize_object_add(obj, obj2);
3328 elm_widget_data_set(obj2, wd);
3329 elm_widget_del_hook_set(obj2, _del_hook);
3330 elm_widget_theme_hook_set(obj2, _theme_hook);
3331 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
3332 elm_widget_text_set_hook_set(obj2, _elm_inwin_text_set_hook);
3333 elm_widget_text_get_hook_set(obj2, _elm_inwin_text_get_hook);
3334 elm_widget_can_focus_set(obj2, EINA_TRUE);
3335 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
3337 wd->frm = edje_object_add(win->evas);
3338 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
3339 elm_widget_resize_object_set(obj2, wd->frm);
3341 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
3348 elm_win_inwin_activate(Evas_Object *obj)
3350 ELM_CHECK_WIDTYPE(obj, widtype2);
3351 Widget_Data *wd = elm_widget_data_get(obj);
3353 evas_object_raise(obj);
3354 evas_object_show(obj);
3355 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
3356 elm_object_focus_set(obj, EINA_TRUE);
3360 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
3362 ELM_CHECK_WIDTYPE(obj, widtype2);
3363 Widget_Data *wd = elm_widget_data_get(obj);
3365 if (wd->content == content) return;
3366 if (wd->content) evas_object_del(wd->content);
3367 wd->content = content;
3370 elm_widget_sub_object_add(obj, content);
3371 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3372 _changed_size_hints, obj);
3373 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
3379 elm_win_inwin_content_get(const Evas_Object *obj)
3381 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3382 Widget_Data *wd = elm_widget_data_get(obj);
3383 if (!wd) return NULL;
3388 elm_win_inwin_content_unset(Evas_Object *obj)
3390 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
3391 Widget_Data *wd = elm_widget_data_get(obj);
3392 if (!wd) return NULL;
3393 if (!wd->content) return NULL;
3394 Evas_Object *content = wd->content;
3395 elm_widget_sub_object_del(obj, wd->content);
3396 evas_object_event_callback_del_full(wd->content,
3397 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3398 _changed_size_hints, obj);
3399 edje_object_part_unswallow(wd->frm, wd->content);
3405 elm_win_socket_listen(Evas_Object *obj, const char *svcname, int svcnum, Eina_Bool svcsys)
3410 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3411 win = elm_widget_data_get(obj);
3412 if (!win) return EINA_FALSE;
3413 if (!win->ee) return EINA_FALSE;
3415 if (!ecore_evas_extn_socket_listen(win->ee, svcname, svcnum, svcsys))
3421 /* windowing specific calls - shall we do this differently? */
3423 static Ecore_X_Window
3424 _elm_ee_win_get(const Evas_Object *obj)
3427 #ifdef HAVE_ELEMENTARY_X
3428 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
3429 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
3435 elm_win_xwindow_get(const Evas_Object *obj)
3441 type = elm_widget_type_get(obj);
3442 if ((!type) || (type != widtype)) return _elm_ee_win_get(obj);
3443 win = elm_widget_data_get(obj);
3445 #ifdef HAVE_ELEMENTARY_X
3446 if (win->xwin) return win->xwin;
3447 if (win->parent) return elm_win_xwindow_get(win->parent);
3453 elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool floating)
3456 ELM_CHECK_WIDTYPE(obj, widtype);
3457 win = elm_widget_data_get(obj);
3459 if (floating == win->floating) return;
3460 #ifdef HAVE_ELEMENTARY_X
3461 _elm_win_xwindow_get(win);
3463 win->floating = floating;
3464 #ifdef HAVE_ELEMENTARY_X
3468 ecore_x_e_illume_window_state_set
3469 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_FLOATING);
3471 ecore_x_e_illume_window_state_set
3472 (win->xwin, ECORE_X_ILLUME_WINDOW_STATE_NORMAL);
3478 elm_win_floating_mode_get(const Evas_Object *obj)
3481 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
3482 win = elm_widget_data_get(obj);
3483 if (!win) return EINA_FALSE;
3485 return win->floating;