1 #include <Elementary.h>
2 #include <Elementary_Cursor.h>
5 static const char WIN_SMART_NAME[] = "elm_win";
7 static const Elm_Win_Trap *trap = NULL;
9 #define TRAP(sd, name, ...) \
12 if ((!trap) || (!trap->name) || \
14 (trap->name(sd->trap_data, sd->base.obj, ## __VA_ARGS__)))) \
15 ecore_evas_##name(sd->ee, ##__VA_ARGS__); \
19 #define ELM_WIN_DATA_GET(o, sd) \
20 Elm_Win_Smart_Data * sd = evas_object_smart_data_get(o)
22 #define ELM_WIN_DATA_GET_OR_RETURN(o, ptr) \
23 ELM_WIN_DATA_GET(o, ptr); \
26 CRITICAL("No widget data for object %p (%s)", \
27 o, evas_object_type_get(o)); \
31 #define ELM_WIN_DATA_GET_OR_RETURN_VAL(o, ptr, val) \
32 ELM_WIN_DATA_GET(o, ptr); \
35 CRITICAL("No widget data for object %p (%s)", \
36 o, evas_object_type_get(o)); \
40 #define ELM_WIN_CHECK(obj) \
41 if (!obj || !elm_widget_type_check((obj), WIN_SMART_NAME, __func__)) \
44 #define ENGINE_GET() (_elm_preferred_engine ? _elm_preferred_engine : (_elm_config->engine ? _elm_config->engine : ""))
45 #define ENGINE_COMPARE(name) (!strcmp(ENGINE_GET(), name))
46 #define EE_ENGINE_COMPARE(ee, name) (!strcmp(ecore_evas_engine_name_get(ee), name))
48 typedef struct _Elm_Win_Smart_Data Elm_Win_Smart_Data;
50 struct _Elm_Win_Smart_Data
52 Elm_Widget_Smart_Data base; /* base widget smart data as
53 * first member obligatory, as
54 * we're inheriting from it */
58 Evas_Object *parent; /* parent *window* object*/
59 Evas_Object *img_obj, *frame_obj;
60 Eina_List *resize_objs; /* a window may have
63 #ifdef HAVE_ELEMENTARY_X
67 Ecore_Event_Handler *client_message_handler;
68 Ecore_Event_Handler *property_handler;
71 #ifdef HAVE_ELEMENTARY_WAYLAND
78 Ecore_Job *deferred_resize_job;
79 Ecore_Job *deferred_child_eval_job;
82 Elm_Win_Keyboard_Mode kbdmode;
83 Elm_Win_Indicator_Mode indmode;
84 Elm_Win_Indicator_Opacity_Mode ind_o_mode;
85 Elm_Win_Indicator_Type_Mode ind_t_mode;
94 int *autodel_clear, rot;
103 Evas_Object *obj, *hot_obj;
113 Eina_Bool visible : 1;
114 Eina_Bool handled : 1;
118 Ecore_Job *reconf_job;
120 Eina_Bool enabled : 1;
121 Eina_Bool changed_theme : 1;
122 Eina_Bool top_animate : 1;
123 Eina_Bool geometry_changed : 1;
133 int preferred_rot; // specified by app
134 int *rots; // available rotations
135 unsigned int count; // number of elements in available rotations
136 Eina_Bool wm_supported : 1;
142 const char *icon_name;
148 int size_base_w, size_base_h;
149 int size_step_w, size_step_h;
151 Eina_Bool urgent : 1;
153 Eina_Bool demand_attention : 1;
154 Eina_Bool autodel : 1;
155 Eina_Bool constrain : 1;
156 Eina_Bool resizing : 1;
157 Eina_Bool iconified : 1;
158 Eina_Bool withdrawn : 1;
159 Eina_Bool sticky : 1;
160 Eina_Bool fullscreen : 1;
161 Eina_Bool maximized : 1;
162 Eina_Bool skip_focus : 1;
163 Eina_Bool floating : 1;
166 static const char SIG_DELETE_REQUEST[] = "delete,request";
167 static const char SIG_FOCUS_OUT[] = "focus,out";
168 static const char SIG_FOCUS_IN[] = "focus,in";
169 static const char SIG_MOVED[] = "moved";
170 static const char SIG_WITHDRAWN[] = "withdrawn";
171 static const char SIG_ICONIFIED[] = "iconified";
172 static const char SIG_NORMAL[] = "normal";
173 static const char SIG_STICK[] = "stick";
174 static const char SIG_UNSTICK[] = "unstick";
175 static const char SIG_FULLSCREEN[] = "fullscreen";
176 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
177 static const char SIG_MAXIMIZED[] = "maximized";
178 static const char SIG_UNMAXIMIZED[] = "unmaximized";
179 static const char SIG_IOERR[] = "ioerr";
180 static const char SIG_INDICATOR_PROP_CHANGED[] = "indicator,prop,changed";
181 static const char SIG_ROTATION_CHANGED[] = "rotation,changed";
182 static const char SIG_PROFILE_CHANGED[] = "profile,changed";
183 static const char SIG_WM_ROTATION_CHANGED[] = "wm,rotation,changed";
185 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
186 {SIG_DELETE_REQUEST, ""},
195 {SIG_FULLSCREEN, ""},
196 {SIG_UNFULLSCREEN, ""},
198 {SIG_UNMAXIMIZED, ""},
200 {SIG_INDICATOR_PROP_CHANGED, ""},
201 {SIG_ROTATION_CHANGED, ""},
202 {SIG_PROFILE_CHANGED, ""},
203 {SIG_WM_ROTATION_CHANGED, ""},
207 EVAS_SMART_SUBCLASS_NEW
208 (WIN_SMART_NAME, _elm_win, Elm_Widget_Smart_Class,
209 Elm_Widget_Smart_Class, elm_widget_smart_class_get, _smart_callbacks);
211 Eina_List *_elm_win_list = NULL;
212 int _elm_win_deferred_free = 0;
214 static int _elm_win_count = 0;
216 static Eina_Bool _elm_win_auto_throttled = EINA_FALSE;
218 static Ecore_Job *_elm_win_state_eval_job = NULL;
220 static void _elm_win_resize_objects_eval(Evas_Object *obj);
222 #ifdef HAVE_ELEMENTARY_X
223 static void _elm_win_xwin_update(Elm_Win_Smart_Data *sd);
224 static void _elm_win_xwin_type_set(Elm_Win_Smart_Data *sd);
228 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
230 Elm_Win_Smart_Data *sd = data;
231 // this is called to make sure all smart containers have calculated their
232 // sizes BEFORE we show the window to make sure it initially appears at
233 // our desired size (ie min size is known first)
234 evas_smart_objects_calculate(evas_object_evas_get(obj));
237 evas_object_show(sd->frame_obj);
239 else if (sd->img_obj)
241 evas_object_show(sd->img_obj);
245 ecore_evas_show(sd->pointer.ee);
246 evas_object_show(sd->pointer.obj);
247 /* ecore_evas_wayland_pointer_set(win->pointer.ee, 10, 10); */
249 evas_object_show(obj);
254 _elm_win_state_eval(void *data __UNUSED__)
258 int _elm_win_count_shown = 0;
259 int _elm_win_count_iconified = 0;
260 int _elm_win_count_withdrawn = 0;
262 _elm_win_state_eval_job = NULL;
264 if (_elm_config->auto_norender_withdrawn)
266 EINA_LIST_FOREACH(_elm_win_list, l, obj)
268 if ((elm_win_withdrawn_get(obj)) ||
269 ((elm_win_iconified_get(obj) &&
270 (_elm_config->auto_norender_iconified_same_as_withdrawn))))
272 if (!evas_object_data_get(obj, "__win_auto_norender"))
274 Evas *evas = evas_object_evas_get(obj);
276 elm_win_norender_push(obj);
277 evas_object_data_set(obj, "__win_auto_norender", obj);
279 if (_elm_config->auto_flush_withdrawn)
281 edje_file_cache_flush();
282 edje_collection_cache_flush();
283 evas_image_cache_flush(evas);
284 evas_font_cache_flush(evas);
286 if (_elm_config->auto_dump_withdrawn)
288 evas_render_dump(evas);
294 if (evas_object_data_get(obj, "__win_auto_norender"))
296 elm_win_norender_pop(obj);
297 evas_object_data_del(obj, "__win_auto_norender");
302 if (_elm_config->auto_throttle)
304 if (_elm_win_count == 0)
306 if (_elm_win_auto_throttled)
308 ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
309 _elm_win_auto_throttled = EINA_FALSE;
314 EINA_LIST_FOREACH(_elm_win_list, l, obj)
316 if (elm_win_withdrawn_get(obj))
317 _elm_win_count_withdrawn++;
318 else if (elm_win_iconified_get(obj))
319 _elm_win_count_iconified++;
320 else if (evas_object_visible_get(obj))
321 _elm_win_count_shown++;
323 if (_elm_win_count_shown <= 0)
325 if (!_elm_win_auto_throttled)
327 ecore_throttle_adjust(_elm_config->auto_throttle_amount);
328 _elm_win_auto_throttled = EINA_TRUE;
333 if (_elm_win_auto_throttled)
335 ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
336 _elm_win_auto_throttled = EINA_FALSE;
344 _elm_win_state_eval_queue(void)
346 if (_elm_win_state_eval_job) ecore_job_del(_elm_win_state_eval_job);
347 _elm_win_state_eval_job = ecore_job_add(_elm_win_state_eval, NULL);
350 // example shot spec (wait 0.1 sec then save as my-window.png):
351 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
354 _shot_delay_get(Elm_Win_Smart_Data *sd)
357 char *d = strdup(sd->shot.info);
360 for (p = (char *)sd->shot.info; *p; p++)
362 if (!strncmp(p, "delay=", 6))
366 for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
382 _shot_file_get(Elm_Win_Smart_Data *sd)
385 char *tmp = strdup(sd->shot.info);
386 char *repname = NULL;
388 if (!tmp) return NULL;
390 for (p = (char *)sd->shot.info; *p; p++)
392 if (!strncmp(p, "file=", 5))
395 if (!sd->shot.repeat_count) return tmp;
398 char *dotptr = strrchr(tmp, '.');
401 size_t size = sizeof(char) * (strlen(tmp) + 16);
402 repname = malloc(size);
403 strncpy(repname, tmp, dotptr - tmp);
404 snprintf(repname + (dotptr - tmp), size -
405 (dotptr - tmp), "%03i",
406 sd->shot.shot_counter + 1);
407 strcat(repname, dotptr);
415 if (!sd->shot.repeat_count) return strdup("out.png");
417 repname = malloc(sizeof(char) * 24);
418 snprintf(repname, sizeof(char) * 24, "out%03i.png",
419 sd->shot.shot_counter + 1);
425 _shot_repeat_count_get(Elm_Win_Smart_Data *sd)
428 char *d = strdup(sd->shot.info);
431 for (p = (char *)sd->shot.info; *p; p++)
433 if (!strncmp(p, "repeat=", 7))
437 for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
444 if (v > 1000) v = 999;
455 _shot_key_get(Elm_Win_Smart_Data *sd __UNUSED__)
461 _shot_flags_get(Elm_Win_Smart_Data *sd __UNUSED__)
467 _shot_do(Elm_Win_Smart_Data *sd)
471 unsigned int *pixels;
473 char *file, *key, *flags;
475 ecore_evas_manual_render(sd->ee);
476 pixels = (void *)ecore_evas_buffer_pixels_get(sd->ee);
479 ecore_evas_geometry_get(sd->ee, NULL, NULL, &w, &h);
480 if ((w < 1) || (h < 1)) return;
482 file = _shot_file_get(sd);
485 key = _shot_key_get(sd);
486 flags = _shot_flags_get(sd);
487 ee = ecore_evas_buffer_new(1, 1);
488 o = evas_object_image_add(ecore_evas_get(ee));
489 evas_object_image_alpha_set(o, ecore_evas_alpha_get(sd->ee));
490 evas_object_image_size_set(o, w, h);
491 evas_object_image_data_set(o, pixels);
492 if (!evas_object_image_save(o, file, key, flags))
494 ERR("Cannot save window to '%s' (key '%s', flags '%s')",
499 if (flags) free(flags);
501 if (sd->shot.repeat_count) sd->shot.shot_counter++;
505 _shot_delay(void *data)
507 Elm_Win_Smart_Data *sd = data;
510 if (sd->shot.repeat_count)
512 int remainshot = (sd->shot.repeat_count - sd->shot.shot_counter);
513 if (remainshot > 0) return EINA_TRUE;
515 sd->shot.timer = NULL;
522 _shot_init(Elm_Win_Smart_Data *sd)
524 if (!sd->shot.info) return;
526 sd->shot.repeat_count = _shot_repeat_count_get(sd);
527 sd->shot.shot_counter = 0;
531 _shot_handle(Elm_Win_Smart_Data *sd)
533 if (!sd->shot.info) return;
535 sd->shot.timer = ecore_timer_add(_shot_delay_get(sd), _shot_delay, sd);
538 /* elm-win specific associate, does the trap while ecore_evas_object_associate()
541 static Elm_Win_Smart_Data *
542 _elm_win_associate_get(const Ecore_Evas *ee)
544 return ecore_evas_data_get(ee, "elm_win");
547 /* Interceptors Callbacks */
549 _elm_win_obj_intercept_raise(void *data, Evas_Object *obj __UNUSED__)
551 Elm_Win_Smart_Data *sd = data;
556 _elm_win_obj_intercept_lower(void *data, Evas_Object *obj __UNUSED__)
558 Elm_Win_Smart_Data *sd = data;
563 _elm_win_obj_intercept_stack_above(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *above __UNUSED__)
565 INF("TODO: %s", __FUNCTION__);
569 _elm_win_obj_intercept_stack_below(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *below __UNUSED__)
571 INF("TODO: %s", __FUNCTION__);
575 _elm_win_obj_intercept_layer_set(void *data, Evas_Object *obj __UNUSED__, int l)
577 Elm_Win_Smart_Data *sd = data;
578 TRAP(sd, layer_set, l);
582 _ecore_evas_move_(void *data, Evas_Object *obj __UNUSED__, int a, int b)
584 printf("[%s][%d] a=%d, b=%d\n", __FUNCTION__, __LINE__, a, b);
585 Elm_Win_Smart_Data *sd = data;
586 TRAP(sd, move, a, b);
589 /* Event Callbacks */
592 _elm_win_obj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
594 Elm_Win_Smart_Data *sd = data;
597 evas_object_size_hint_min_get(obj, &w, &h);
598 TRAP(sd, size_min_set, w, h);
600 evas_object_size_hint_max_get(obj, &w, &h);
603 TRAP(sd, size_max_set, w, h);
605 /* end of elm-win specific associate */
609 _elm_win_move(Ecore_Evas *ee)
611 Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
614 EINA_SAFETY_ON_NULL_RETURN(sd);
616 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
619 evas_object_smart_callback_call(ELM_WIDGET_DATA(sd)->obj, SIG_MOVED, NULL);
623 _elm_win_resize_job(void *data)
625 Elm_Win_Smart_Data *sd = data;
630 sd->deferred_resize_job = NULL;
631 ecore_evas_request_geometry_get(sd->ee, NULL, NULL, &w, &h);
635 ecore_evas_screen_geometry_get(sd->ee, NULL, NULL, &sw, &sh);
644 evas_output_framespace_get(sd->evas, NULL, NULL, &fw, &fh);
645 evas_object_resize(sd->frame_obj, w + fw, h + fh);
648 /* if (sd->img_obj) */
652 evas_object_resize(ELM_WIDGET_DATA(sd)->obj, w, h);
653 EINA_LIST_FOREACH(sd->resize_objs, l, obj)
655 evas_object_move(obj, 0, 0);
656 evas_object_resize(obj, w, h);
661 _elm_win_resize(Ecore_Evas *ee)
663 Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
664 EINA_SAFETY_ON_NULL_RETURN(sd);
666 if (sd->deferred_resize_job) ecore_job_del(sd->deferred_resize_job);
667 sd->deferred_resize_job = ecore_job_add(_elm_win_resize_job, sd);
671 _elm_win_mouse_in(Ecore_Evas *ee)
673 Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
674 EINA_SAFETY_ON_NULL_RETURN(sd);
676 if (sd->resizing) sd->resizing = EINA_FALSE;
680 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win_Smart_Data *sd)
682 if (sd->focus_highlight.reconf_job)
683 ecore_job_del(sd->focus_highlight.reconf_job);
684 sd->focus_highlight.reconf_job = NULL;
688 _elm_win_focus_highlight_visible_set(Elm_Win_Smart_Data *sd,
693 top = sd->focus_highlight.top;
698 evas_object_show(top);
699 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
705 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
710 _elm_win_focus_highlight_anim_setup(Elm_Win_Smart_Data *sd,
713 Evas_Coord tx, ty, tw, th;
714 Evas_Coord w, h, px, py, pw, ph;
715 Edje_Message_Int_Set *m;
716 Evas_Object *previous = sd->focus_highlight.prev.target;
717 Evas_Object *target = sd->focus_highlight.cur.target;
719 evas_object_geometry_get(ELM_WIDGET_DATA(sd)->obj, NULL, NULL, &w, &h);
720 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
721 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
722 evas_object_move(obj, tx, ty);
723 evas_object_resize(obj, tw, th);
724 evas_object_clip_unset(obj);
726 m = alloca(sizeof(*m) + (sizeof(int) * 8));
736 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
740 _elm_win_focus_highlight_simple_setup(Elm_Win_Smart_Data *sd,
743 Evas_Object *clip, *target = sd->focus_highlight.cur.target;
744 Evas_Coord x, y, w, h;
746 clip = evas_object_clip_get(target);
747 evas_object_geometry_get(target, &x, &y, &w, &h);
749 evas_object_move(obj, x, y);
750 evas_object_resize(obj, w, h);
751 evas_object_clip_set(obj, clip);
755 _elm_win_focus_highlight_reconfigure(Elm_Win_Smart_Data *sd)
757 Evas_Object *target = sd->focus_highlight.cur.target;
758 Evas_Object *previous = sd->focus_highlight.prev.target;
759 Evas_Object *top = sd->focus_highlight.top;
760 Eina_Bool visible_changed;
761 Eina_Bool common_visible;
762 const char *sig = NULL;
764 _elm_win_focus_highlight_reconfigure_job_stop(sd);
766 visible_changed = (sd->focus_highlight.cur.visible !=
767 sd->focus_highlight.prev.visible);
769 if ((target == previous) && (!visible_changed) &&
770 (!sd->focus_highlight.geometry_changed))
773 if ((previous) && (sd->focus_highlight.prev.handled))
774 elm_widget_signal_emit
775 (previous, "elm,action,focus_highlight,hide", "elm");
778 common_visible = EINA_FALSE;
779 else if (sd->focus_highlight.cur.handled)
781 common_visible = EINA_FALSE;
782 if (sd->focus_highlight.cur.visible)
783 sig = "elm,action,focus_highlight,show";
785 sig = "elm,action,focus_highlight,hide";
788 common_visible = sd->focus_highlight.cur.visible;
790 _elm_win_focus_highlight_visible_set(sd, common_visible);
792 elm_widget_signal_emit(target, sig, "elm");
794 if ((!target) || (!common_visible) || (sd->focus_highlight.cur.handled))
797 if (sd->focus_highlight.changed_theme)
800 if (sd->focus_highlight.style)
801 str = sd->focus_highlight.style;
804 elm_widget_theme_object_set
805 (ELM_WIDGET_DATA(sd)->obj, top, "focus_highlight", "top", str);
806 sd->focus_highlight.changed_theme = EINA_FALSE;
808 if (_elm_config->focus_highlight_animate)
810 str = edje_object_data_get(sd->focus_highlight.top, "animate");
811 sd->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
815 if ((sd->focus_highlight.top_animate) && (previous) &&
816 (!sd->focus_highlight.prev.handled))
817 _elm_win_focus_highlight_anim_setup(sd, top);
819 _elm_win_focus_highlight_simple_setup(sd, top);
820 evas_object_raise(top);
823 sd->focus_highlight.geometry_changed = EINA_FALSE;
824 sd->focus_highlight.prev = sd->focus_highlight.cur;
828 _elm_win_focus_highlight_reconfigure_job(void *data)
830 _elm_win_focus_highlight_reconfigure((Elm_Win_Smart_Data *)data);
834 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win_Smart_Data *sd)
836 if (sd->focus_highlight.reconf_job)
837 ecore_job_del(sd->focus_highlight.reconf_job);
839 sd->focus_highlight.reconf_job = ecore_job_add(
840 _elm_win_focus_highlight_reconfigure_job, sd);
844 _elm_win_focus_in(Ecore_Evas *ee)
846 Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
848 unsigned int order = 0;
850 EINA_SAFETY_ON_NULL_RETURN(sd);
852 obj = ELM_WIDGET_DATA(sd)->obj;
854 _elm_widget_top_win_focused_set(obj, EINA_TRUE);
855 if (!elm_widget_focus_order_get(obj)
856 || (obj == elm_widget_newest_focus_order_get(obj, &order, EINA_TRUE)))
858 elm_widget_focus_steal(obj);
861 elm_widget_focus_restore(obj);
862 evas_object_smart_callback_call(obj, SIG_FOCUS_IN, NULL);
863 sd->focus_highlight.cur.visible = EINA_TRUE;
864 _elm_win_focus_highlight_reconfigure_job_start(sd);
867 edje_object_signal_emit(sd->frame_obj, "elm,action,focus", "elm");
871 /* else if (sd->img_obj) */
877 _elm_win_focus_out(Ecore_Evas *ee)
879 Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
882 EINA_SAFETY_ON_NULL_RETURN(sd);
884 obj = ELM_WIDGET_DATA(sd)->obj;
886 elm_object_focus_set(obj, EINA_FALSE);
887 _elm_widget_top_win_focused_set(obj, EINA_FALSE);
888 evas_object_smart_callback_call(obj, SIG_FOCUS_OUT, NULL);
889 sd->focus_highlight.cur.visible = EINA_FALSE;
890 _elm_win_focus_highlight_reconfigure_job_start(sd);
893 edje_object_signal_emit(sd->frame_obj, "elm,action,unfocus", "elm");
897 _elm_access_object_hilight_disable(evas_object_evas_get(obj));
900 /* if (sd->img_obj) */
906 _elm_win_profile_update(Ecore_Evas *ee)
908 Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
911 EINA_SAFETY_ON_NULL_RETURN(sd);
913 obj = ELM_WIDGET_DATA(sd)->obj;
916 if (sd->profile.timer)
917 ecore_timer_del(sd->profile.timer);
918 sd->profile.timer = NULL;
920 /* It should be replaced per-window ELM profile later. */
921 _elm_config_profile_set(sd->profile.name);
923 evas_object_smart_callback_call(obj, SIG_PROFILE_CHANGED, NULL);
927 _elm_win_profile_change_delay(void *data)
929 Elm_Win_Smart_Data *sd = data;
931 Eina_Bool changed = EINA_FALSE;
933 profile = eina_list_nth(sd->profile.names, 0);
936 if (sd->profile.name)
938 if (strcmp(sd->profile.name, profile))
940 eina_stringshare_replace(&(sd->profile.name), profile);
946 sd->profile.name = eina_stringshare_add(profile);
950 sd->profile.timer = NULL;
951 if (changed) _elm_win_profile_update(sd->ee);
956 _elm_win_state_change(Ecore_Evas *ee)
958 Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
960 Eina_Bool ch_withdrawn = EINA_FALSE;
961 Eina_Bool ch_sticky = EINA_FALSE;
962 Eina_Bool ch_iconified = EINA_FALSE;
963 Eina_Bool ch_fullscreen = EINA_FALSE;
964 Eina_Bool ch_maximized = EINA_FALSE;
965 Eina_Bool ch_profile = EINA_FALSE;
966 Eina_Bool ch_wm_rotation = EINA_FALSE;
969 EINA_SAFETY_ON_NULL_RETURN(sd);
971 obj = ELM_WIDGET_DATA(sd)->obj;
973 if (sd->withdrawn != ecore_evas_withdrawn_get(sd->ee))
975 sd->withdrawn = ecore_evas_withdrawn_get(sd->ee);
976 ch_withdrawn = EINA_TRUE;
978 if (sd->sticky != ecore_evas_sticky_get(sd->ee))
980 sd->sticky = ecore_evas_sticky_get(sd->ee);
981 ch_sticky = EINA_TRUE;
983 if (sd->iconified != ecore_evas_iconified_get(sd->ee))
985 sd->iconified = ecore_evas_iconified_get(sd->ee);
986 ch_iconified = EINA_TRUE;
988 if (sd->fullscreen != ecore_evas_fullscreen_get(sd->ee))
990 sd->fullscreen = ecore_evas_fullscreen_get(sd->ee);
991 ch_fullscreen = EINA_TRUE;
993 if (sd->maximized != ecore_evas_maximized_get(sd->ee))
995 sd->maximized = ecore_evas_maximized_get(sd->ee);
996 ch_maximized = EINA_TRUE;
998 profile = ecore_evas_profile_get(sd->ee);
1000 _elm_config_profile_exists(profile))
1002 if (sd->profile.name)
1004 if (strcmp(sd->profile.name, profile))
1006 eina_stringshare_replace(&(sd->profile.name), profile);
1007 ch_profile = EINA_TRUE;
1012 sd->profile.name = eina_stringshare_add(profile);
1013 ch_profile = EINA_TRUE;
1018 if (sd->rot != ecore_evas_rotation_get(sd->ee))
1020 sd->rot = ecore_evas_rotation_get(sd->ee);
1021 ch_wm_rotation = EINA_TRUE;
1025 _elm_win_state_eval_queue();
1027 if ((ch_withdrawn) || (ch_iconified))
1030 evas_object_smart_callback_call(obj, SIG_WITHDRAWN, NULL);
1031 else if (sd->iconified)
1032 evas_object_smart_callback_call(obj, SIG_ICONIFIED, NULL);
1034 evas_object_smart_callback_call(obj, SIG_NORMAL, NULL);
1039 evas_object_smart_callback_call(obj, SIG_STICK, NULL);
1041 evas_object_smart_callback_call(obj, SIG_UNSTICK, NULL);
1046 evas_object_smart_callback_call(obj, SIG_FULLSCREEN, NULL);
1048 evas_object_smart_callback_call(obj, SIG_UNFULLSCREEN, NULL);
1053 evas_object_smart_callback_call(obj, SIG_MAXIMIZED, NULL);
1055 evas_object_smart_callback_call(obj, SIG_UNMAXIMIZED, NULL);
1059 _elm_win_profile_update(ee);
1063 evas_object_size_hint_min_set(obj, -1, -1);
1064 evas_object_size_hint_max_set(obj, -1, -1);
1065 _elm_win_resize_objects_eval(obj);
1066 #ifdef HAVE_ELEMENTARY_X
1067 _elm_win_xwin_update(sd);
1069 elm_widget_orientation_set(obj, sd->rot);
1070 evas_object_smart_callback_call(obj, SIG_ROTATION_CHANGED, NULL);
1071 evas_object_smart_callback_call(obj, SIG_WM_ROTATION_CHANGED, NULL);
1076 _elm_win_smart_focus_next(const Evas_Object *obj,
1077 Elm_Focus_Direction dir,
1080 ELM_WIN_DATA_GET(obj, sd);
1082 const Eina_List *items;
1083 void *(*list_data_get)(const Eina_List *list);
1086 if (ELM_WIDGET_DATA(sd)->subobjs)
1088 if (!(items = elm_widget_focus_custom_chain_get(obj)))
1090 items = ELM_WIDGET_DATA(sd)->subobjs;
1094 list_data_get = eina_list_data_get;
1096 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
1101 *next = (Evas_Object *)obj;
1106 _elm_win_smart_focus_direction(const Evas_Object *obj,
1107 const Evas_Object *base,
1109 Evas_Object **direction,
1112 const Eina_List *items;
1113 void *(*list_data_get)(const Eina_List *list);
1115 ELM_WIN_DATA_GET(obj, sd);
1118 if (ELM_WIDGET_DATA(sd)->subobjs)
1120 if (!(items = elm_widget_focus_custom_chain_get(obj)))
1121 items = ELM_WIDGET_DATA(sd)->subobjs;
1123 list_data_get = eina_list_data_get;
1125 return elm_widget_focus_list_direction_get
1126 (obj, base, items, list_data_get, degree, direction, weight);
1133 _elm_win_smart_on_focus(Evas_Object *obj)
1135 ELM_WIN_DATA_GET(obj, sd);
1138 evas_object_focus_set(sd->img_obj, elm_widget_focus_get(obj));
1140 evas_object_focus_set(obj, elm_widget_focus_get(obj));
1146 _elm_win_smart_event(Evas_Object *obj,
1147 Evas_Object *src __UNUSED__,
1148 Evas_Callback_Type type,
1151 Evas_Event_Key_Down *ev = event_info;
1152 Evas_Object *current_focused;
1154 if (elm_widget_disabled_get(obj)) return EINA_FALSE;
1156 if (type != EVAS_CALLBACK_KEY_DOWN)
1159 current_focused = elm_widget_focused_object_get(obj);
1160 if ((!strcmp(ev->keyname, "Tab")) ||
1161 (!strcmp(ev->keyname, "ISO_Left_Tab")))
1163 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
1164 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
1166 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1170 else if ((!strcmp(ev->keyname, "Left")) ||
1171 ((!strcmp(ev->keyname, "KP_Left")) && (!ev->string)))
1173 if (current_focused == obj)
1174 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1176 elm_widget_focus_direction_go(obj, 270.0);
1180 else if ((!strcmp(ev->keyname, "Right")) ||
1181 ((!strcmp(ev->keyname, "KP_Right")) && (!ev->string)))
1183 if (current_focused == obj)
1184 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1186 elm_widget_focus_direction_go(obj, 90.0);
1190 else if ((!strcmp(ev->keyname, "Up")) ||
1191 ((!strcmp(ev->keyname, "KP_Up")) && (!ev->string)))
1193 if (current_focused == obj)
1194 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1196 elm_widget_focus_direction_go(obj, 0.0);
1200 else if ((!strcmp(ev->keyname, "Down")) ||
1201 ((!strcmp(ev->keyname, "KP_Down")) && (!ev->string)))
1203 if (current_focused == obj)
1204 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1206 elm_widget_focus_direction_go(obj, 180.0);
1214 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1219 _deferred_ecore_evas_free(void *data)
1221 ecore_evas_free(data);
1222 _elm_win_deferred_free--;
1228 _elm_win_smart_show(Evas_Object *obj)
1230 ELM_WIN_DATA_GET(obj, sd);
1232 if (!evas_object_visible_get(obj))
1233 _elm_win_state_eval_queue();
1234 _elm_win_parent_sc->base.show(obj);
1238 if (sd->shot.info) _shot_handle(sd);
1242 _elm_win_smart_hide(Evas_Object *obj)
1244 ELM_WIN_DATA_GET(obj, sd);
1246 if (evas_object_visible_get(obj))
1247 _elm_win_state_eval_queue();
1248 _elm_win_parent_sc->base.hide(obj);
1254 evas_object_hide(sd->frame_obj);
1258 evas_object_hide(sd->img_obj);
1260 if (sd->pointer.obj)
1262 evas_object_hide(sd->pointer.obj);
1263 ecore_evas_hide(sd->pointer.ee);
1268 _elm_win_on_parent_del(void *data,
1271 void *event_info __UNUSED__)
1273 Elm_Win_Smart_Data *sd = data;
1275 if (obj == sd->parent) sd->parent = NULL;
1279 _elm_win_focus_target_move(void *data,
1281 Evas_Object *obj __UNUSED__,
1282 void *event_info __UNUSED__)
1284 Elm_Win_Smart_Data *sd = data;
1286 sd->focus_highlight.geometry_changed = EINA_TRUE;
1287 _elm_win_focus_highlight_reconfigure_job_start(sd);
1291 _elm_win_focus_target_resize(void *data,
1293 Evas_Object *obj __UNUSED__,
1294 void *event_info __UNUSED__)
1296 Elm_Win_Smart_Data *sd = data;
1298 sd->focus_highlight.geometry_changed = EINA_TRUE;
1299 _elm_win_focus_highlight_reconfigure_job_start(sd);
1303 _elm_win_focus_target_del(void *data,
1305 Evas_Object *obj __UNUSED__,
1306 void *event_info __UNUSED__)
1308 Elm_Win_Smart_Data *sd = data;
1310 sd->focus_highlight.cur.target = NULL;
1312 _elm_win_focus_highlight_reconfigure_job_start(sd);
1315 static Evas_Object *
1316 _elm_win_focus_target_get(Evas_Object *obj)
1318 Evas_Object *o = obj;
1322 if (elm_widget_is(o))
1324 if (!elm_widget_highlight_ignore_get(o))
1326 o = elm_widget_parent_get(o);
1328 o = evas_object_smart_parent_get(o);
1332 o = elm_widget_parent_widget_get(o);
1334 o = evas_object_smart_parent_get(o);
1343 _elm_win_focus_target_callbacks_add(Elm_Win_Smart_Data *sd)
1345 Evas_Object *obj = sd->focus_highlight.cur.target;
1347 evas_object_event_callback_add
1348 (obj, EVAS_CALLBACK_MOVE, _elm_win_focus_target_move, sd);
1349 evas_object_event_callback_add
1350 (obj, EVAS_CALLBACK_RESIZE, _elm_win_focus_target_resize, sd);
1351 evas_object_event_callback_add
1352 (obj, EVAS_CALLBACK_DEL, _elm_win_focus_target_del, sd);
1356 _elm_win_focus_target_callbacks_del(Elm_Win_Smart_Data *sd)
1358 Evas_Object *obj = sd->focus_highlight.cur.target;
1360 evas_object_event_callback_del_full
1361 (obj, EVAS_CALLBACK_MOVE, _elm_win_focus_target_move, sd);
1362 evas_object_event_callback_del_full
1363 (obj, EVAS_CALLBACK_RESIZE, _elm_win_focus_target_resize, sd);
1364 evas_object_event_callback_del_full
1365 (obj, EVAS_CALLBACK_DEL, _elm_win_focus_target_del, sd);
1369 _elm_win_object_focus_in(void *data,
1373 Evas_Object *obj = event_info, *target;
1374 Elm_Win_Smart_Data *sd = data;
1376 if (sd->focus_highlight.cur.target == obj)
1379 target = _elm_win_focus_target_get(obj);
1380 sd->focus_highlight.cur.target = target;
1381 if (elm_widget_highlight_in_theme_get(target))
1382 sd->focus_highlight.cur.handled = EINA_TRUE;
1384 _elm_win_focus_target_callbacks_add(sd);
1386 _elm_win_focus_highlight_reconfigure_job_start(sd);
1390 _elm_win_object_focus_out(void *data,
1392 void *event_info __UNUSED__)
1394 Elm_Win_Smart_Data *sd = data;
1396 if (!sd->focus_highlight.cur.target)
1399 if (!sd->focus_highlight.cur.handled)
1400 _elm_win_focus_target_callbacks_del(sd);
1402 sd->focus_highlight.cur.target = NULL;
1403 sd->focus_highlight.cur.handled = EINA_FALSE;
1405 _elm_win_focus_highlight_reconfigure_job_start(sd);
1409 _elm_win_focus_highlight_shutdown(Elm_Win_Smart_Data *sd)
1411 _elm_win_focus_highlight_reconfigure_job_stop(sd);
1412 if (sd->focus_highlight.cur.target)
1414 _elm_win_focus_target_callbacks_del(sd);
1415 sd->focus_highlight.cur.target = NULL;
1417 if (sd->focus_highlight.top)
1419 evas_object_del(sd->focus_highlight.top);
1420 sd->focus_highlight.top = NULL;
1423 evas_event_callback_del_full
1424 (sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1425 _elm_win_object_focus_in, sd);
1426 evas_event_callback_del_full
1427 (sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1428 _elm_win_object_focus_out, sd);
1432 _elm_win_on_img_obj_del(void *data,
1434 Evas_Object *obj __UNUSED__,
1435 void *event_info __UNUSED__)
1437 Elm_Win_Smart_Data *sd = data;
1442 _elm_win_resize_objects_eval(Evas_Object *obj)
1445 const Evas_Object *child;
1447 ELM_WIN_DATA_GET(obj, sd);
1448 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
1452 EINA_LIST_FOREACH(sd->resize_objs, l, child)
1454 evas_object_size_hint_weight_get(child, &wx, &wy);
1455 if (wx == 0.0) xx = 0;
1456 if (wy == 0.0) xy = 0;
1458 evas_object_size_hint_min_get(child, &w, &h);
1461 if (w > minw) minw = w;
1462 if (h > minh) minh = h;
1464 evas_object_size_hint_max_get(child, &w, &h);
1467 if (maxw == -1) maxw = w;
1468 else if ((w > 0) && (w < maxw))
1470 if (maxh == -1) maxh = h;
1471 else if ((h > 0) && (h < maxh))
1474 if (!xx) maxw = minw;
1476 if (!xy) maxh = minh;
1478 evas_object_size_hint_min_set(obj, minw, minh);
1479 evas_object_size_hint_max_set(obj, maxw, maxh);
1480 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1481 if (w < minw) w = minw;
1482 if (h < minh) h = minh;
1483 if ((maxw >= 0) && (w > maxw)) w = maxw;
1484 if ((maxh >= 0) && (h > maxh)) h = maxh;
1485 evas_object_resize(obj, w, h);
1489 _elm_win_on_resize_obj_del(void *data,
1491 Evas_Object *obj __UNUSED__,
1492 void *event_info __UNUSED__)
1494 ELM_WIN_DATA_GET(data, sd);
1496 sd->resize_objs = eina_list_remove(sd->resize_objs, obj);
1498 _elm_win_resize_objects_eval(data);
1502 _elm_win_on_resize_obj_changed_size_hints(void *data,
1504 Evas_Object *obj __UNUSED__,
1505 void *event_info __UNUSED__)
1507 _elm_win_resize_objects_eval(data);
1511 _elm_win_smart_del(Evas_Object *obj)
1515 const Evas_Object *child;
1517 ELM_WIN_DATA_GET(obj, sd);
1519 /* NB: child deletion handled by parent's smart del */
1521 if ((trap) && (trap->del))
1522 trap->del(sd->trap_data, obj);
1526 evas_object_event_callback_del_full
1527 (sd->parent, EVAS_CALLBACK_DEL, _elm_win_on_parent_del, sd);
1531 EINA_LIST_FOREACH(sd->resize_objs, l, child)
1533 evas_object_event_callback_del_full
1534 (child, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1535 _elm_win_on_resize_obj_changed_size_hints, obj);
1536 evas_object_event_callback_del_full
1537 (child, EVAS_CALLBACK_DEL, _elm_win_on_resize_obj_del, obj);
1540 if (sd->autodel_clear) *(sd->autodel_clear) = -1;
1542 _elm_win_list = eina_list_remove(_elm_win_list, obj);
1544 _elm_win_state_eval_queue();
1548 ecore_evas_callback_delete_request_set(sd->ee, NULL);
1549 ecore_evas_callback_resize_set(sd->ee, NULL);
1551 if (sd->deferred_resize_job) ecore_job_del(sd->deferred_resize_job);
1552 if (sd->deferred_child_eval_job) ecore_job_del(sd->deferred_child_eval_job);
1553 if (sd->shot.info) eina_stringshare_del(sd->shot.info);
1554 if (sd->shot.timer) ecore_timer_del(sd->shot.timer);
1556 #ifdef HAVE_ELEMENTARY_X
1557 if (sd->x.client_message_handler)
1558 ecore_event_handler_del(sd->x.client_message_handler);
1559 if (sd->x.property_handler)
1560 ecore_event_handler_del(sd->x.property_handler);
1565 evas_object_event_callback_del_full
1566 (sd->img_obj, EVAS_CALLBACK_DEL, _elm_win_on_img_obj_del, sd);
1573 ecore_job_add(_deferred_ecore_evas_free, sd->ee);
1574 _elm_win_deferred_free++;
1578 _elm_win_focus_highlight_shutdown(sd);
1579 eina_stringshare_del(sd->focus_highlight.style);
1581 if (sd->title) eina_stringshare_del(sd->title);
1582 if (sd->icon_name) eina_stringshare_del(sd->icon_name);
1583 if (sd->role) eina_stringshare_del(sd->role);
1584 if (sd->icon) evas_object_del(sd->icon);
1586 EINA_LIST_FREE(sd->profile.names, str) eina_stringshare_del(str);
1587 if (sd->profile.name) eina_stringshare_del(sd->profile.name);
1588 if (sd->profile.timer) ecore_timer_del(sd->profile.timer);
1590 if (sd->wm_rot.rots) free(sd->wm_rot.rots);
1591 sd->wm_rot.rots = NULL;
1593 /* Don't let callback in the air that point to sd */
1594 ecore_evas_callback_delete_request_set(sd->ee, NULL);
1595 ecore_evas_callback_resize_set(sd->ee, NULL);
1596 ecore_evas_callback_mouse_in_set(sd->ee, NULL);
1597 ecore_evas_callback_focus_in_set(sd->ee, NULL);
1598 ecore_evas_callback_focus_out_set(sd->ee, NULL);
1599 ecore_evas_callback_move_set(sd->ee, NULL);
1600 ecore_evas_callback_state_change_set(sd->ee, NULL);
1602 _elm_win_parent_sc->base.del(obj); /* handles freeing sd */
1604 if ((!_elm_win_list) &&
1605 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
1607 edje_file_cache_flush();
1608 edje_collection_cache_flush();
1609 evas_image_cache_flush(evas_object_evas_get(obj));
1610 evas_font_cache_flush(evas_object_evas_get(obj));
1617 _elm_win_smart_move(Evas_Object *obj,
1621 ELM_WIN_DATA_GET(obj, sd);
1625 if ((x != sd->screen.x) || (y != sd->screen.y))
1629 evas_object_smart_callback_call(obj, SIG_MOVED, NULL);
1635 TRAP(sd, move, x, y);
1636 if (!ecore_evas_override_get(sd->ee)) return;
1639 _elm_win_parent_sc->base.move(obj, x, y);
1641 if (ecore_evas_override_get(sd->ee))
1645 evas_object_smart_callback_call(obj, SIG_MOVED, NULL);
1649 /* FIXME: We should update ecore_wl_window_location here !! */
1661 _elm_win_smart_resize(Evas_Object *obj,
1665 ELM_WIN_DATA_GET(obj, sd);
1667 _elm_win_parent_sc->base.resize(obj, w, h);
1675 ecore_evas_screen_geometry_get(sd->ee, NULL, NULL, &sw, &sh);
1682 evas_object_image_size_set(sd->img_obj, w, h);
1685 TRAP(sd, resize, w, h);
1689 _elm_win_delete_request(Ecore_Evas *ee)
1691 Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
1694 EINA_SAFETY_ON_NULL_RETURN(sd);
1696 obj = ELM_WIDGET_DATA(sd)->obj;
1698 int autodel = sd->autodel;
1699 sd->autodel_clear = &autodel;
1700 evas_object_ref(obj);
1701 evas_object_smart_callback_call(obj, SIG_DELETE_REQUEST, NULL);
1702 // FIXME: if above callback deletes - then the below will be invalid
1703 if (autodel) evas_object_del(obj);
1704 else sd->autodel_clear = NULL;
1705 evas_object_unref(obj);
1709 _elm_ee_xwin_get(const Ecore_Evas *ee)
1711 #ifdef HAVE_ELEMENTARY_X
1712 Ecore_X_Window xwin = 0;
1715 if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_X11))
1717 if (ee) xwin = ecore_evas_software_x11_window_get(ee);
1719 else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_FB) ||
1720 EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_16_WINCE) ||
1721 EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_SDL) ||
1722 EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_16_SDL) ||
1723 EE_ENGINE_COMPARE(ee, ELM_OPENGL_SDL) ||
1724 EE_ENGINE_COMPARE(ee, ELM_OPENGL_COCOA))
1727 else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_16_X11))
1729 if (ee) xwin = ecore_evas_software_x11_16_window_get(ee);
1731 else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_8_X11))
1733 if (ee) xwin = ecore_evas_software_x11_8_window_get(ee);
1735 else if (EE_ENGINE_COMPARE(ee, ELM_OPENGL_X11))
1737 if (ee) xwin = ecore_evas_gl_x11_window_get(ee);
1739 else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_WIN32))
1741 if (ee) xwin = (long)ecore_evas_win32_window_get(ee);
1749 #ifdef HAVE_ELEMENTARY_X
1751 _elm_win_xwindow_get(Elm_Win_Smart_Data *sd)
1753 sd->x.xwin = _elm_ee_xwin_get(sd->ee);
1758 #ifdef HAVE_ELEMENTARY_X
1760 _elm_win_xwin_update(Elm_Win_Smart_Data *sd)
1764 _elm_win_xwindow_get(sd);
1767 ELM_WIN_DATA_GET(sd->parent, sdp);
1771 ecore_x_icccm_transient_for_set(sd->x.xwin, sdp->x.xwin);
1775 if (!sd->x.xwin) return; /* nothing more to do */
1778 if (!s) s = _elm_appname;
1780 if (sd->icon_name) s = sd->icon_name;
1781 ecore_x_icccm_icon_name_set(sd->x.xwin, s);
1782 ecore_x_netwm_icon_name_set(sd->x.xwin, s);
1785 if (s) ecore_x_icccm_window_role_set(sd->x.xwin, s);
1792 data = evas_object_image_data_get(sd->icon, EINA_FALSE);
1796 int w = 0, h = 0, stride, x, y;
1800 evas_object_image_size_get(sd->icon, &w, &h);
1801 stride = evas_object_image_stride_get(sd->icon);
1802 if ((w > 0) && (h > 0) &&
1803 (stride >= (int)(w * sizeof(unsigned int))))
1807 ic.data = malloc(w * h * sizeof(unsigned int));
1811 p = (unsigned char *)data;
1812 p2 = (unsigned int *)ic.data;
1813 for (y = 0; y < h; y++)
1815 for (x = 0; x < w; x++)
1817 *p2 = *((unsigned int *)p);
1818 p += sizeof(unsigned int);
1821 p += (stride - (w * sizeof(unsigned int)));
1823 ecore_x_netwm_icons_set(sd->x.xwin, &ic, 1);
1827 evas_object_image_data_set(sd->icon, data);
1831 ecore_x_e_virtual_keyboard_state_set
1832 (sd->x.xwin, (Ecore_X_Virtual_Keyboard_State)sd->kbdmode);
1833 if (sd->indmode == ELM_WIN_INDICATOR_SHOW)
1834 ecore_x_e_illume_indicator_state_set
1835 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1836 else if (sd->indmode == ELM_WIN_INDICATOR_HIDE)
1837 ecore_x_e_illume_indicator_state_set
1838 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1842 __elm_win_xwin_type_set(Elm_Win_Smart_Data *sd)
1844 _elm_win_xwindow_get(sd);
1845 if (!sd->x.xwin) return; /* nothing more to do */
1850 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_NORMAL);
1853 case ELM_WIN_DIALOG_BASIC:
1854 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_DIALOG);
1857 case ELM_WIN_DESKTOP:
1858 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1862 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_DOCK);
1865 case ELM_WIN_TOOLBAR:
1866 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1870 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_MENU);
1873 case ELM_WIN_UTILITY:
1874 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1877 case ELM_WIN_SPLASH:
1878 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1881 case ELM_WIN_DROPDOWN_MENU:
1882 ecore_x_netwm_window_type_set
1883 (sd->x.xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1886 case ELM_WIN_POPUP_MENU:
1887 ecore_x_netwm_window_type_set
1888 (sd->x.xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1891 case ELM_WIN_TOOLTIP:
1892 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1895 case ELM_WIN_NOTIFICATION:
1896 ecore_x_netwm_window_type_set
1897 (sd->x.xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1901 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_COMBO);
1905 ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_DND);
1918 _elm_win_shutdown(void)
1920 while (_elm_win_list) evas_object_del(_elm_win_list->data);
1921 if (_elm_win_state_eval_job)
1923 ecore_job_del(_elm_win_state_eval_job);
1924 _elm_win_state_eval_job = NULL;
1929 _elm_win_rescale(Elm_Theme *th,
1930 Eina_Bool use_theme)
1937 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1938 elm_widget_theme(obj);
1942 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1943 elm_widget_theme_specific(obj, th, EINA_FALSE);
1948 _elm_win_access(Eina_Bool is_access)
1953 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1954 elm_widget_access(obj, is_access);
1958 _elm_win_translate(void)
1963 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1964 elm_widget_translate(obj);
1967 #ifdef HAVE_ELEMENTARY_X
1969 _elm_win_client_message(void *data,
1970 int type __UNUSED__,
1973 Elm_Access_Action_Info *a;
1974 Ecore_X_Atom atom_scroll, atom_back, atom_control_panel_open;
1975 Elm_Win_Smart_Data *sd = data;
1976 Ecore_X_Event_Client_Message *e = event;
1978 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1979 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1981 if ((unsigned int)e->data.l[0] == sd->x.xwin)
1983 Evas *evas = evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj);
1986 edje_file_cache_flush();
1987 edje_collection_cache_flush();
1988 evas_image_cache_flush(evas);
1989 evas_font_cache_flush(evas);
1993 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1995 if ((unsigned int)e->data.l[0] == sd->x.xwin)
1997 Evas *evas = evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj);
2000 edje_file_cache_flush();
2001 edje_collection_cache_flush();
2002 evas_image_cache_flush(evas);
2003 evas_font_cache_flush(evas);
2004 evas_render_dump(evas);
2008 else if (e->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
2010 if ((unsigned int)e->data.l[0] == sd->x.xwin)
2012 atom_scroll = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_SCROLL_");
2013 atom_back = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_BACK_");
2014 atom_control_panel_open = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_CONTROL_PANEL_OPEN_");
2016 if ((unsigned int)e->data.l[1] ==
2017 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
2019 // XXX: call right access func
2021 else if ((unsigned int)e->data.l[1] ==
2022 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
2024 // XXX: call right access func
2026 else if ((unsigned int)e->data.l[1] ==
2027 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
2029 _elm_access_highlight_object_activate
2030 (ELM_WIDGET_DATA(sd)->obj, ELM_ACTIVATE_DEFAULT);
2032 else if ((unsigned int)e->data.l[1] ==
2033 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
2035 /* there would be better way to read highlight object */
2037 evas = evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj);
2038 if (!evas) return ECORE_CALLBACK_PASS_ON;
2040 a = calloc(1, sizeof(Elm_Access_Action_Info));
2041 a->x = e->data.l[2];
2042 a->y = e->data.l[3];
2043 elm_access_action(ELM_WIDGET_DATA(sd)->obj, ELM_ACCESS_ACTION_HIGHLIGHT, a);
2046 else if ((unsigned int)e->data.l[1] ==
2047 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
2049 _elm_access_highlight_cycle(ELM_WIDGET_DATA(sd)->obj, ELM_FOCUS_NEXT);
2051 else if ((unsigned int)e->data.l[1] ==
2052 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
2054 _elm_access_highlight_cycle(ELM_WIDGET_DATA(sd)->obj, ELM_FOCUS_PREVIOUS);
2056 else if ((unsigned int)e->data.l[1] ==
2057 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
2059 _elm_access_highlight_object_activate
2060 (ELM_WIDGET_DATA(sd)->obj, ELM_ACTIVATE_UP);
2062 else if ((unsigned int)e->data.l[1] ==
2063 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
2065 _elm_access_highlight_object_activate
2066 (ELM_WIDGET_DATA(sd)->obj, ELM_ACTIVATE_DOWN);
2068 else if ((unsigned int)e->data.l[1] == atom_scroll)
2070 _elm_access_highlight_object_scroll(ELM_WIDGET_DATA(sd)->obj,
2071 e->data.l[2], e->data.l[3], e->data.l[4]);
2073 else if ((unsigned int)e->data.l[1] == atom_back)
2075 _elm_access_highlight_object_activate
2076 (ELM_WIDGET_DATA(sd)->obj, ELM_ACTIVATE_BACK);
2078 else if ((unsigned int)e->data.l[1] == atom_control_panel_open)
2083 return ECORE_CALLBACK_PASS_ON;
2087 _elm_win_property_change(void *data,
2088 int type __UNUSED__,
2091 Elm_Win_Smart_Data *sd = data;
2092 Ecore_X_Event_Window_Property *e = event;
2094 if (e->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE)
2096 if (e->win == sd->x.xwin)
2098 sd->indmode = ecore_x_e_illume_indicator_state_get(e->win);
2099 evas_object_smart_callback_call(ELM_WIDGET_DATA(sd)->obj, SIG_INDICATOR_PROP_CHANGED, NULL);
2102 if (e->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
2104 if (e->win == sd->x.xwin)
2106 sd->kbdmode = ecore_x_e_virtual_keyboard_state_get(e->win);
2109 return ECORE_CALLBACK_PASS_ON;
2114 _elm_win_focus_highlight_hide(void *data __UNUSED__,
2116 const char *emission __UNUSED__,
2117 const char *source __UNUSED__)
2119 evas_object_hide(obj);
2123 _elm_win_focus_highlight_anim_end(void *data,
2125 const char *emission __UNUSED__,
2126 const char *source __UNUSED__)
2128 Elm_Win_Smart_Data *sd = data;
2130 _elm_win_focus_highlight_simple_setup(sd, obj);
2134 _elm_win_focus_highlight_init(Elm_Win_Smart_Data *sd)
2136 evas_event_callback_add(sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
2137 _elm_win_object_focus_in, sd);
2138 evas_event_callback_add(sd->evas,
2139 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
2140 _elm_win_object_focus_out, sd);
2142 sd->focus_highlight.cur.target = evas_focus_get(sd->evas);
2144 sd->focus_highlight.top = edje_object_add(sd->evas);
2145 sd->focus_highlight.changed_theme = EINA_TRUE;
2146 edje_object_signal_callback_add(sd->focus_highlight.top,
2147 "elm,action,focus,hide,end", "",
2148 _elm_win_focus_highlight_hide, NULL);
2149 edje_object_signal_callback_add(sd->focus_highlight.top,
2150 "elm,action,focus,anim,end", "",
2151 _elm_win_focus_highlight_anim_end, sd);
2152 _elm_win_focus_highlight_reconfigure_job_start(sd);
2156 _elm_win_frame_cb_move_start(void *data,
2157 Evas_Object *obj __UNUSED__,
2158 const char *sig __UNUSED__,
2159 const char *source __UNUSED__)
2161 Elm_Win_Smart_Data *sd;
2163 if (!(sd = data)) return;
2164 /* FIXME: Change mouse pointer */
2166 /* NB: Wayland handles moving surfaces by itself so we cannot
2167 * specify a specific x/y we want. Instead, we will pass in the
2168 * existing x/y values so they can be recorded as 'previous'
2169 * position. The new position will get updated automatically when
2170 * the move is finished */
2172 ecore_evas_wayland_move(sd->ee, sd->screen.x, sd->screen.y);
2176 _elm_win_frame_cb_resize_show(void *data,
2177 Evas_Object *obj __UNUSED__,
2178 const char *sig __UNUSED__,
2181 Elm_Win_Smart_Data *sd;
2183 if (!(sd = data)) return;
2184 if (sd->resizing) return;
2186 #ifdef HAVE_ELEMENTARY_WAYLAND
2187 if (!strcmp(source, "elm.event.resize.t"))
2188 ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_TOP_SIDE);
2189 else if (!strcmp(source, "elm.event.resize.b"))
2190 ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_BOTTOM_SIDE);
2191 else if (!strcmp(source, "elm.event.resize.l"))
2192 ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_LEFT_SIDE);
2193 else if (!strcmp(source, "elm.event.resize.r"))
2194 ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_RIGHT_SIDE);
2195 else if (!strcmp(source, "elm.event.resize.tl"))
2196 ecore_wl_window_cursor_from_name_set(sd->wl.win,
2197 ELM_CURSOR_TOP_LEFT_CORNER);
2198 else if (!strcmp(source, "elm.event.resize.tr"))
2199 ecore_wl_window_cursor_from_name_set(sd->wl.win,
2200 ELM_CURSOR_TOP_RIGHT_CORNER);
2201 else if (!strcmp(source, "elm.event.resize.bl"))
2202 ecore_wl_window_cursor_from_name_set(sd->wl.win,
2203 ELM_CURSOR_BOTTOM_LEFT_CORNER);
2204 else if (!strcmp(source, "elm.event.resize.br"))
2205 ecore_wl_window_cursor_from_name_set(sd->wl.win,
2206 ELM_CURSOR_BOTTOM_RIGHT_CORNER);
2208 ecore_wl_window_cursor_default_restore(sd->wl.win);
2215 _elm_win_frame_cb_resize_hide(void *data,
2216 Evas_Object *obj __UNUSED__,
2217 const char *sig __UNUSED__,
2218 const char *source __UNUSED__)
2220 Elm_Win_Smart_Data *sd;
2222 if (!(sd = data)) return;
2223 if (sd->resizing) return;
2225 #ifdef HAVE_ELEMENTARY_WAYLAND
2226 ecore_wl_window_cursor_default_restore(sd->wl.win);
2231 _elm_win_frame_cb_resize_start(void *data,
2232 Evas_Object *obj __UNUSED__,
2233 const char *sig __UNUSED__,
2236 Elm_Win_Smart_Data *sd;
2238 if (!(sd = data)) return;
2239 if (sd->resizing) return;
2241 sd->resizing = EINA_TRUE;
2243 if (!strcmp(source, "elm.event.resize.t"))
2244 sd->resize_location = 1;
2245 else if (!strcmp(source, "elm.event.resize.b"))
2246 sd->resize_location = 2;
2247 else if (!strcmp(source, "elm.event.resize.l"))
2248 sd->resize_location = 4;
2249 else if (!strcmp(source, "elm.event.resize.r"))
2250 sd->resize_location = 8;
2251 else if (!strcmp(source, "elm.event.resize.tl"))
2252 sd->resize_location = 5;
2253 else if (!strcmp(source, "elm.event.resize.tr"))
2254 sd->resize_location = 9;
2255 else if (!strcmp(source, "elm.event.resize.bl"))
2256 sd->resize_location = 6;
2257 else if (!strcmp(source, "elm.event.resize.br"))
2258 sd->resize_location = 10;
2260 sd->resize_location = 0;
2262 if (sd->resize_location > 0)
2263 ecore_evas_wayland_resize(sd->ee, sd->resize_location);
2267 _elm_win_frame_cb_minimize(void *data,
2268 Evas_Object *obj __UNUSED__,
2269 const char *sig __UNUSED__,
2270 const char *source __UNUSED__)
2272 Elm_Win_Smart_Data *sd;
2274 if (!(sd = data)) return;
2275 // sd->iconified = EINA_TRUE;
2276 TRAP(sd, iconified_set, EINA_TRUE);
2280 _elm_win_frame_cb_maximize(void *data,
2281 Evas_Object *obj __UNUSED__,
2282 const char *sig __UNUSED__,
2283 const char *source __UNUSED__)
2285 Elm_Win_Smart_Data *sd;
2287 if (!(sd = data)) return;
2288 if (sd->maximized) sd->maximized = EINA_FALSE;
2289 else sd->maximized = EINA_TRUE;
2290 TRAP(sd, maximized_set, sd->maximized);
2294 _elm_win_frame_cb_close(void *data,
2295 Evas_Object *obj __UNUSED__,
2296 const char *sig __UNUSED__,
2297 const char *source __UNUSED__)
2299 Elm_Win_Smart_Data *sd;
2302 /* FIXME: After the current freeze, this should be handled differently.
2304 * Ideally, we would want to mimic the X11 backend and use something
2305 * like ECORE_WL_EVENT_WINDOW_DELETE and handle the delete_request
2306 * inside of ecore_evas. That would be the 'proper' way, but since we are
2307 * in a freeze right now, I cannot add a new event value, or a new
2308 * event structure to ecore_wayland.
2310 * So yes, this is a temporary 'stop-gap' solution which will be fixed
2311 * when the freeze is over, but it does fix a trac bug for now, and in a
2312 * way which does not break API or the freeze. - dh
2315 if (!(sd = data)) return;
2317 win = ELM_WIDGET_DATA(sd)->obj;
2319 int autodel = sd->autodel;
2320 sd->autodel_clear = &autodel;
2321 evas_object_ref(win);
2322 evas_object_smart_callback_call(win, SIG_DELETE_REQUEST, NULL);
2323 // FIXME: if above callback deletes - then the below will be invalid
2324 if (autodel) evas_object_del(win);
2325 else sd->autodel_clear = NULL;
2326 evas_object_unref(win);
2330 _elm_win_frame_add(Elm_Win_Smart_Data *sd,
2333 evas_output_framespace_set(sd->evas, 0, 22, 0, 26);
2335 sd->frame_obj = edje_object_add(sd->evas);
2336 elm_widget_theme_object_set
2337 (ELM_WIDGET_DATA(sd)->obj, sd->frame_obj, "border", "base", style);
2339 evas_object_is_frame_object_set(sd->frame_obj, EINA_TRUE);
2340 evas_object_move(sd->frame_obj, 0, 0);
2341 evas_object_resize(sd->frame_obj, 1, 1);
2343 edje_object_signal_callback_add
2344 (sd->frame_obj, "elm,action,move,start", "elm",
2345 _elm_win_frame_cb_move_start, sd);
2346 edje_object_signal_callback_add
2347 (sd->frame_obj, "elm,action,resize,show", "*",
2348 _elm_win_frame_cb_resize_show, sd);
2349 edje_object_signal_callback_add
2350 (sd->frame_obj, "elm,action,resize,hide", "*",
2351 _elm_win_frame_cb_resize_hide, sd);
2352 edje_object_signal_callback_add
2353 (sd->frame_obj, "elm,action,resize,start", "*",
2354 _elm_win_frame_cb_resize_start, sd);
2355 edje_object_signal_callback_add
2356 (sd->frame_obj, "elm,action,minimize", "elm",
2357 _elm_win_frame_cb_minimize, sd);
2358 edje_object_signal_callback_add
2359 (sd->frame_obj, "elm,action,maximize", "elm",
2360 _elm_win_frame_cb_maximize, sd);
2361 edje_object_signal_callback_add
2362 (sd->frame_obj, "elm,action,close", "elm", _elm_win_frame_cb_close, sd);
2366 edje_object_part_text_escaped_set
2367 (sd->frame_obj, "elm.text.title", sd->title);
2372 _elm_win_frame_del(Elm_Win_Smart_Data *sd)
2376 edje_object_signal_callback_del
2377 (sd->frame_obj, "elm,action,move,start", "elm",
2378 _elm_win_frame_cb_move_start);
2379 edje_object_signal_callback_del
2380 (sd->frame_obj, "elm,action,resize,show", "*",
2381 _elm_win_frame_cb_resize_show);
2382 edje_object_signal_callback_del
2383 (sd->frame_obj, "elm,action,resize,hide", "*",
2384 _elm_win_frame_cb_resize_hide);
2385 edje_object_signal_callback_del
2386 (sd->frame_obj, "elm,action,resize,start", "*",
2387 _elm_win_frame_cb_resize_start);
2388 edje_object_signal_callback_del
2389 (sd->frame_obj, "elm,action,minimize", "elm",
2390 _elm_win_frame_cb_minimize);
2391 edje_object_signal_callback_del
2392 (sd->frame_obj, "elm,action,maximize", "elm",
2393 _elm_win_frame_cb_maximize);
2394 edje_object_signal_callback_del
2395 (sd->frame_obj, "elm,action,close", "elm",
2396 _elm_win_frame_cb_close);
2398 evas_object_del(sd->frame_obj);
2399 sd->frame_obj = NULL;
2402 evas_output_framespace_set(sd->evas, 0, 0, 0, 0);
2407 _debug_key_down(void *data __UNUSED__,
2412 Evas_Event_Key_Down *ev = event_info;
2414 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
2417 if ((strcmp(ev->keyname, "F12")) ||
2418 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
2421 printf("Tree graph generated.\n");
2422 elm_object_tree_dot_dump(obj, "./dump.dot");
2428 _win_img_hide(void *data,
2430 Evas_Object *obj __UNUSED__,
2431 void *event_info __UNUSED__)
2433 Elm_Win_Smart_Data *sd = data;
2435 elm_widget_focus_hide_handle(ELM_WIDGET_DATA(sd)->obj);
2439 _win_img_mouse_up(void *data,
2441 Evas_Object *obj __UNUSED__,
2444 Elm_Win_Smart_Data *sd = data;
2445 Evas_Event_Mouse_Up *ev = event_info;
2446 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
2447 elm_widget_focus_mouse_up_handle(ELM_WIDGET_DATA(sd)->obj);
2451 _win_img_focus_in(void *data,
2453 Evas_Object *obj __UNUSED__,
2454 void *event_info __UNUSED__)
2456 Elm_Win_Smart_Data *sd = data;
2457 elm_widget_focus_steal(ELM_WIDGET_DATA(sd)->obj);
2461 _win_img_focus_out(void *data,
2463 Evas_Object *obj __UNUSED__,
2464 void *event_info __UNUSED__)
2466 Elm_Win_Smart_Data *sd = data;
2467 elm_widget_focused_object_clear(ELM_WIDGET_DATA(sd)->obj);
2471 _win_inlined_image_set(Elm_Win_Smart_Data *sd)
2473 evas_object_image_alpha_set(sd->img_obj, EINA_FALSE);
2474 evas_object_image_filled_set(sd->img_obj, EINA_TRUE);
2476 evas_object_event_callback_add
2477 (sd->img_obj, EVAS_CALLBACK_DEL, _elm_win_on_img_obj_del, sd);
2478 evas_object_event_callback_add
2479 (sd->img_obj, EVAS_CALLBACK_HIDE, _win_img_hide, sd);
2480 evas_object_event_callback_add
2481 (sd->img_obj, EVAS_CALLBACK_MOUSE_UP, _win_img_mouse_up, sd);
2482 evas_object_event_callback_add
2483 (sd->img_obj, EVAS_CALLBACK_FOCUS_IN, _win_img_focus_in, sd);
2484 evas_object_event_callback_add
2485 (sd->img_obj, EVAS_CALLBACK_FOCUS_OUT, _win_img_focus_out, sd);
2489 _elm_win_on_icon_del(void *data,
2492 void *event_info __UNUSED__)
2494 Elm_Win_Smart_Data *sd = data;
2496 if (sd->icon == obj) sd->icon = NULL;
2500 _elm_win_smart_add(Evas_Object *obj)
2502 EVAS_SMART_DATA_ALLOC(obj, Elm_Win_Smart_Data);
2504 _elm_win_parent_sc->base.add(obj);
2506 elm_widget_can_focus_set(obj, EINA_TRUE);
2508 elm_widget_highlight_ignore_set(obj, EINA_TRUE);
2512 _elm_win_smart_set_user(Elm_Widget_Smart_Class *sc)
2514 sc->base.add = _elm_win_smart_add;
2515 sc->base.del = _elm_win_smart_del;
2516 sc->base.show = _elm_win_smart_show;
2517 sc->base.hide = _elm_win_smart_hide;
2518 sc->base.move = _elm_win_smart_move;
2519 sc->base.resize = _elm_win_smart_resize;
2521 sc->focus_next = _elm_win_smart_focus_next;
2522 sc->focus_direction = _elm_win_smart_focus_direction;
2523 sc->on_focus = _elm_win_smart_on_focus;
2524 sc->event = _elm_win_smart_event;
2527 #ifdef HAVE_ELEMENTARY_X
2529 _elm_x_io_err(void *data __UNUSED__)
2534 EINA_LIST_FOREACH(_elm_win_list, l, obj)
2535 evas_object_smart_callback_call(obj, SIG_IOERR, NULL);
2541 _elm_win_cb_hide(void *data __UNUSED__,
2543 Evas_Object *obj __UNUSED__,
2544 void *event_info __UNUSED__)
2546 _elm_win_state_eval_queue();
2550 _elm_win_cb_show(void *data __UNUSED__,
2552 Evas_Object *obj __UNUSED__,
2553 void *event_info __UNUSED__)
2555 _elm_win_state_eval_queue();
2559 elm_win_add(Evas_Object *parent,
2566 const char *fontpath, *fallback = NULL;
2568 Elm_Win_Smart_Data tmp_sd;
2570 /* just to store some data while trying out to create a canvas */
2571 memset(&tmp_sd, 0, sizeof(Elm_Win_Smart_Data));
2573 #define FALLBACK_TRY(engine) \
2575 CRITICAL(engine " engine creation failed. Trying default."); \
2576 tmp_sd.ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
2578 elm_config_preferred_engine_set(ecore_evas_engine_name_get(tmp_sd.ee)); \
2580 #define FALLBACK_STORE(engine) \
2583 CRITICAL(engine "Fallback to %s successful.", engine); \
2584 fallback = engine; \
2589 case ELM_WIN_INLINED_IMAGE:
2592 e = evas_object_evas_get(parent);
2597 ee = ecore_evas_ecore_evas_get(e);
2600 tmp_sd.img_obj = ecore_evas_object_image_new(ee);
2601 if (!tmp_sd.img_obj) break;
2603 tmp_sd.ee = ecore_evas_object_ecore_evas_get(tmp_sd.img_obj);
2606 evas_object_del(tmp_sd.img_obj);
2607 tmp_sd.img_obj = NULL;
2612 case ELM_WIN_SOCKET_IMAGE:
2613 tmp_sd.ee = ecore_evas_extn_socket_new(1, 1);
2617 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
2619 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2620 FALLBACK_TRY("Software X11");
2623 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2624 FALLBACK_STORE("Software FB");
2627 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2629 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2630 FALLBACK_TRY("Software FB");
2633 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2634 FALLBACK_STORE("Software X11");
2637 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
2639 tmp_sd.ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
2640 FALLBACK_TRY("Software DirectFB");
2643 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2644 FALLBACK_STORE("Software X11");
2647 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2648 FALLBACK_STORE("Software FB");
2652 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
2654 tmp_sd.ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
2655 FALLBACK_TRY("Software-16");
2658 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2659 FALLBACK_STORE("Software X11");
2662 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2663 FALLBACK_STORE("Software FB");
2667 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
2669 tmp_sd.ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
2670 FALLBACK_TRY("Software-8");
2673 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2674 FALLBACK_STORE("Software X11");
2677 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2678 FALLBACK_STORE("Software FB");
2682 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
2687 if (_elm_config->vsync)
2689 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
2696 tmp_sd.ee = ecore_evas_gl_x11_options_new
2697 (NULL, 0, 0, 0, 1, 1, opt);
2699 tmp_sd.ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
2700 FALLBACK_TRY("OpenGL");
2703 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2704 FALLBACK_STORE("Software X11");
2707 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2708 FALLBACK_STORE("Software FB");
2712 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
2714 tmp_sd.ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
2715 FALLBACK_TRY("Software Win32");
2717 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2719 tmp_sd.ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
2720 FALLBACK_TRY("Software-16-WinCE");
2722 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
2724 tmp_sd.ee = ecore_evas_psl1ght_new(NULL, 1, 1);
2725 FALLBACK_TRY("PSL1GHT");
2727 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
2729 tmp_sd.ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
2730 FALLBACK_TRY("Software SDL");
2733 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2734 FALLBACK_STORE("Software X11");
2737 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2738 FALLBACK_STORE("Software FB");
2742 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
2744 tmp_sd.ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
2745 FALLBACK_TRY("Software-16-SDL");
2748 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2749 FALLBACK_STORE("Software X11");
2752 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2753 FALLBACK_STORE("Software FB");
2757 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
2759 tmp_sd.ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
2760 FALLBACK_TRY("OpenGL SDL");
2763 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2764 FALLBACK_STORE("Software X11");
2767 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2768 FALLBACK_STORE("Software FB");
2772 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
2774 tmp_sd.ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
2775 FALLBACK_TRY("OpenGL Cocoa");
2777 else if (ENGINE_COMPARE(ELM_BUFFER))
2779 tmp_sd.ee = ecore_evas_buffer_new(1, 1);
2781 else if (ENGINE_COMPARE(ELM_EWS))
2783 tmp_sd.ee = ecore_evas_ews_new(0, 0, 1, 1);
2785 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
2787 tmp_sd.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
2789 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
2791 tmp_sd.ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
2793 else if (!strncmp(ENGINE_GET(), "shot:", 5))
2795 tmp_sd.ee = ecore_evas_buffer_new(1, 1);
2796 ecore_evas_manual_render_set(tmp_sd.ee, EINA_TRUE);
2797 tmp_sd.shot.info = eina_stringshare_add
2806 ERR("Cannot create window.");
2810 obj = evas_object_smart_add
2811 (ecore_evas_get(tmp_sd.ee), _elm_win_smart_class_new());
2813 ELM_WIN_DATA_GET(obj, sd);
2815 /* copying possibly altered fields back */
2816 #define SD_CPY(_field) \
2819 sd->_field = tmp_sd._field; \
2827 if ((trap) && (trap->add))
2828 sd->trap_data = trap->add(obj);
2830 /* complementary actions, which depend on final smart data
2832 if (type == ELM_WIN_INLINED_IMAGE)
2833 _win_inlined_image_set(sd);
2835 #ifdef HAVE_ELEMENTARY_X
2836 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2837 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2838 ENGINE_COMPARE(ELM_SOFTWARE_8_X11) ||
2839 ENGINE_COMPARE(ELM_OPENGL_X11))
2841 sd->x.client_message_handler = ecore_event_handler_add
2842 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, sd);
2843 sd->x.property_handler = ecore_event_handler_add
2844 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, sd);
2848 else if (!strncmp(ENGINE_GET(), "shot:", 5))
2851 sd->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
2852 sd->indmode = ELM_WIN_INDICATOR_UNKNOWN;
2854 #ifdef HAVE_ELEMENTARY_X
2855 _elm_win_xwindow_get(sd);
2858 ecore_x_io_error_handler_set(_elm_x_io_err, NULL);
2862 #ifdef HAVE_ELEMENTARY_WAYLAND
2863 sd->wl.win = ecore_evas_wayland_window_get(sd->ee);
2866 if ((_elm_config->bgpixmap)
2867 #ifdef HAVE_ELEMENTARY_X
2869 (((sd->x.xwin) && (!ecore_x_screen_is_composited(0))) ||
2873 TRAP(sd, avoid_damage_set, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
2874 // bg pixmap done by x - has other issues like can be redrawn by x before it
2875 // is filled/ready by app
2876 // TRAP(sd, avoid_damage_set, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
2879 sd->parent = parent;
2882 evas_object_event_callback_add
2883 (sd->parent, EVAS_CALLBACK_DEL, _elm_win_on_parent_del, sd);
2885 sd->evas = ecore_evas_get(sd->ee);
2887 evas_object_color_set(obj, 0, 0, 0, 0);
2888 evas_object_move(obj, 0, 0);
2889 evas_object_resize(obj, 1, 1);
2890 evas_object_layer_set(obj, 50);
2891 evas_object_pass_events_set(obj, EINA_TRUE);
2893 if (type == ELM_WIN_INLINED_IMAGE)
2894 elm_widget_parent2_set(obj, parent);
2896 /* use own version of ecore_evas_object_associate() that does TRAP() */
2897 ecore_evas_data_set(sd->ee, "elm_win", sd);
2899 evas_object_event_callback_add
2900 (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2901 _elm_win_obj_callback_changed_size_hints, sd);
2903 evas_object_intercept_raise_callback_add
2904 (obj, _elm_win_obj_intercept_raise, sd);
2905 evas_object_intercept_lower_callback_add
2906 (obj, _elm_win_obj_intercept_lower, sd);
2907 evas_object_intercept_stack_above_callback_add
2908 (obj, _elm_win_obj_intercept_stack_above, sd);
2909 evas_object_intercept_stack_below_callback_add
2910 (obj, _elm_win_obj_intercept_stack_below, sd);
2911 evas_object_intercept_layer_set_callback_add
2912 (obj, _elm_win_obj_intercept_layer_set, sd);
2913 evas_object_intercept_show_callback_add
2914 (obj, _elm_win_obj_intercept_show, sd);
2915 evas_object_intercept_move_callback_add
2916 (obj, _ecore_evas_move_, sd);
2918 TRAP(sd, name_class_set, name, _elm_appname);
2919 ecore_evas_callback_delete_request_set(sd->ee, _elm_win_delete_request);
2920 ecore_evas_callback_resize_set(sd->ee, _elm_win_resize);
2921 ecore_evas_callback_mouse_in_set(sd->ee, _elm_win_mouse_in);
2922 ecore_evas_callback_focus_in_set(sd->ee, _elm_win_focus_in);
2923 ecore_evas_callback_focus_out_set(sd->ee, _elm_win_focus_out);
2924 ecore_evas_callback_move_set(sd->ee, _elm_win_move);
2925 ecore_evas_callback_state_change_set(sd->ee, _elm_win_state_change);
2926 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_win_cb_hide, sd);
2927 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _elm_win_cb_show, sd);
2929 evas_image_cache_set(sd->evas, (_elm_config->image_cache * 1024));
2930 evas_font_cache_set(sd->evas, (_elm_config->font_cache * 1024));
2932 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2933 evas_font_path_append(sd->evas, fontpath);
2935 if (!_elm_config->font_hinting)
2936 evas_font_hinting_set(sd->evas, EVAS_FONT_HINTING_NONE);
2937 else if (_elm_config->font_hinting == 1)
2938 evas_font_hinting_set(sd->evas, EVAS_FONT_HINTING_AUTO);
2939 else if (_elm_config->font_hinting == 2)
2940 evas_font_hinting_set(sd->evas, EVAS_FONT_HINTING_BYTECODE);
2942 #ifdef HAVE_ELEMENTARY_X
2943 _elm_win_xwin_type_set(sd);
2944 _elm_win_xwin_update(sd);
2947 _elm_win_list = eina_list_append(_elm_win_list, obj);
2950 if (((fallback) && (!strcmp(fallback, "Software FB"))) ||
2951 ((!fallback) && (ENGINE_COMPARE(ELM_SOFTWARE_FB))))
2953 TRAP(sd, fullscreen_set, 1);
2955 else if ((type != ELM_WIN_INLINED_IMAGE) &&
2956 (ENGINE_COMPARE(ELM_WAYLAND_SHM) ||
2957 ENGINE_COMPARE(ELM_WAYLAND_EGL)))
2958 _elm_win_frame_add(sd, "default");
2960 if (_elm_config->focus_highlight_enable)
2961 elm_win_focus_highlight_enabled_set(obj, EINA_TRUE);
2964 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(sd->evas, "Control");
2965 evas_object_event_callback_add
2966 (obj, EVAS_CALLBACK_KEY_DOWN, _debug_key_down, sd);
2968 if (evas_object_key_grab(obj, "F12", mask, 0, EINA_TRUE))
2969 INF("Ctrl+F12 key combination exclusive for dot tree generation\n");
2971 ERR("failed to grab F12 key to elm widgets (dot) tree generation");
2974 if ((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_ON) ||
2975 ((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_AUTO) &&
2976 (((fallback) && (!strcmp(fallback, "Software FB"))) ||
2977 ((!fallback) && (ENGINE_COMPARE(ELM_SOFTWARE_FB))))))
2980 Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0;
2982 sd->pointer.obj = o = edje_object_add(ecore_evas_get(tmp_sd.ee));
2983 _elm_theme_object_set(obj, o, "pointer", "base", "default");
2984 edje_object_size_min_calc(o, &mw, &mh);
2985 evas_object_resize(o, mw, mh);
2986 edje_object_part_geometry_get(o, "elm.swallow.hotspot",
2987 &hx, &hy, NULL, NULL);
2988 sd->pointer.hot_x = hx;
2989 sd->pointer.hot_y = hy;
2990 evas_object_show(o);
2991 ecore_evas_object_cursor_set(tmp_sd.ee, o, EVAS_LAYER_MAX, hx, hy);
2993 else if (_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_OFF)
2998 sd->wm_rot.wm_supported = ecore_evas_wm_rotation_supported_get(sd->ee);
2999 sd->wm_rot.preferred_rot = -1; // it means that elm_win doesn't use preferred rotation.
3005 elm_win_util_standard_add(const char *name,
3008 Evas_Object *win, *bg;
3010 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
3011 if (!win) return NULL;
3013 elm_win_title_set(win, title);
3014 bg = elm_bg_add(win);
3017 evas_object_del(win);
3020 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3021 elm_win_resize_object_add(win, bg);
3022 evas_object_show(bg);
3028 elm_win_resize_object_add(Evas_Object *obj,
3029 Evas_Object *subobj)
3034 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3036 if (eina_list_data_find(sd->resize_objs, subobj)) return;
3038 if (!ELM_WIDGET_DATA(sd)->api->sub_object_add(obj, subobj))
3039 ERR("could not add %p as sub object of %p", subobj, obj);
3041 sd->resize_objs = eina_list_append(sd->resize_objs, subobj);
3043 evas_object_event_callback_add
3044 (subobj, EVAS_CALLBACK_DEL, _elm_win_on_resize_obj_del, obj);
3045 evas_object_event_callback_add
3046 (subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3047 _elm_win_on_resize_obj_changed_size_hints, obj);
3049 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
3050 evas_object_move(subobj, 0, 0);
3051 evas_object_resize(subobj, w, h);
3053 _elm_win_resize_objects_eval(obj);
3057 elm_win_resize_object_del(Evas_Object *obj,
3058 Evas_Object *subobj)
3061 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3063 if (!ELM_WIDGET_DATA(sd)->api->sub_object_del(obj, subobj))
3064 ERR("could not remove sub object %p from %p", subobj, obj);
3066 sd->resize_objs = eina_list_remove(sd->resize_objs, subobj);
3068 evas_object_event_callback_del_full
3069 (subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3070 _elm_win_on_resize_obj_changed_size_hints, obj);
3071 evas_object_event_callback_del_full
3072 (subobj, EVAS_CALLBACK_DEL, _elm_win_on_resize_obj_del, obj);
3074 _elm_win_resize_objects_eval(obj);
3078 elm_win_title_set(Evas_Object *obj,
3082 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3085 eina_stringshare_replace(&(sd->title), title);
3086 TRAP(sd, title_set, sd->title);
3088 edje_object_part_text_escaped_set
3089 (sd->frame_obj, "elm.text.title", sd->title);
3093 elm_win_title_get(const Evas_Object *obj)
3095 ELM_WIN_CHECK(obj) NULL;
3096 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3102 elm_win_icon_name_set(Evas_Object *obj,
3103 const char *icon_name)
3106 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3108 if (!icon_name) return;
3109 eina_stringshare_replace(&(sd->icon_name), icon_name);
3110 #ifdef HAVE_ELEMENTARY_X
3111 _elm_win_xwin_update(sd);
3116 elm_win_icon_name_get(const Evas_Object *obj)
3118 ELM_WIN_CHECK(obj) NULL;
3119 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3121 return sd->icon_name;
3125 elm_win_role_set(Evas_Object *obj, const char *role)
3128 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3131 eina_stringshare_replace(&(sd->role), role);
3132 #ifdef HAVE_ELEMENTARY_X
3133 _elm_win_xwin_update(sd);
3138 elm_win_role_get(const Evas_Object *obj)
3140 ELM_WIN_CHECK(obj) NULL;
3141 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3147 elm_win_icon_object_set(Evas_Object *obj,
3151 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3154 evas_object_event_callback_del_full
3155 (sd->icon, EVAS_CALLBACK_DEL, _elm_win_on_icon_del, sd);
3158 evas_object_event_callback_add
3159 (sd->icon, EVAS_CALLBACK_DEL, _elm_win_on_icon_del, sd);
3160 #ifdef HAVE_ELEMENTARY_X
3161 _elm_win_xwin_update(sd);
3165 EAPI const Evas_Object *
3166 elm_win_icon_object_get(const Evas_Object *obj)
3168 ELM_WIN_CHECK(obj) NULL;
3169 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3175 elm_win_autodel_set(Evas_Object *obj,
3179 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3181 sd->autodel = autodel;
3185 elm_win_autodel_get(const Evas_Object *obj)
3187 ELM_WIN_CHECK(obj) EINA_FALSE;
3188 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3194 elm_win_activate(Evas_Object *obj)
3197 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3203 elm_win_lower(Evas_Object *obj)
3206 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3212 elm_win_raise(Evas_Object *obj)
3215 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3221 elm_win_center(Evas_Object *obj,
3225 int win_w, win_h, screen_w, screen_h, nx, ny;
3228 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3230 if ((trap) && (trap->center) && (!trap->center(sd->trap_data, obj)))
3233 ecore_evas_screen_geometry_get(sd->ee, NULL, NULL, &screen_w, &screen_h);
3234 if ((!screen_w) || (!screen_h)) return;
3236 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
3237 if ((!win_w) || (!win_h)) return;
3239 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
3240 else nx = sd->screen.x;
3241 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
3242 else ny = sd->screen.y;
3246 evas_object_move(obj, nx, ny);
3250 elm_win_borderless_set(Evas_Object *obj,
3251 Eina_Bool borderless)
3254 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3256 TRAP(sd, borderless_set, borderless);
3257 #ifdef HAVE_ELEMENTARY_X
3258 _elm_win_xwin_update(sd);
3263 elm_win_borderless_get(const Evas_Object *obj)
3265 ELM_WIN_CHECK(obj) EINA_FALSE;
3266 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3268 return ecore_evas_borderless_get(sd->ee);
3272 elm_win_shaped_set(Evas_Object *obj,
3276 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3278 TRAP(sd, shaped_set, shaped);
3279 #ifdef HAVE_ELEMENTARY_X
3280 _elm_win_xwin_update(sd);
3285 elm_win_shaped_get(const Evas_Object *obj)
3287 ELM_WIN_CHECK(obj) EINA_FALSE;
3288 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3290 return ecore_evas_shaped_get(sd->ee);
3294 elm_win_alpha_set(Evas_Object *obj,
3298 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3302 evas_object_image_alpha_set(sd->img_obj, alpha);
3303 ecore_evas_alpha_set(sd->ee, alpha);
3307 #ifdef HAVE_ELEMENTARY_X
3312 if (!ecore_x_screen_is_composited(0))
3313 elm_win_shaped_set(obj, alpha);
3315 TRAP(sd, alpha_set, alpha);
3318 TRAP(sd, alpha_set, alpha);
3319 _elm_win_xwin_update(sd);
3323 TRAP(sd, alpha_set, alpha);
3328 elm_win_alpha_get(const Evas_Object *obj)
3330 ELM_WIN_CHECK(obj) EINA_FALSE;
3331 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3335 return evas_object_image_alpha_get(sd->img_obj);
3338 return ecore_evas_alpha_get(sd->ee);
3342 elm_win_override_set(Evas_Object *obj,
3346 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3348 TRAP(sd, override_set, override);
3349 #ifdef HAVE_ELEMENTARY_X
3350 _elm_win_xwin_update(sd);
3355 elm_win_override_get(const Evas_Object *obj)
3357 ELM_WIN_CHECK(obj) EINA_FALSE;
3358 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3360 return ecore_evas_override_get(sd->ee);
3364 elm_win_fullscreen_set(Evas_Object *obj,
3365 Eina_Bool fullscreen)
3368 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3369 // YYY: handle if sd->img_obj
3370 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
3371 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
3373 // these engines... can ONLY be fullscreen
3378 // sd->fullscreen = fullscreen;
3382 if (ENGINE_COMPARE(ELM_WAYLAND_SHM) ||
3383 ENGINE_COMPARE(ELM_WAYLAND_EGL))
3384 _elm_win_frame_del(sd);
3388 if (ENGINE_COMPARE(ELM_WAYLAND_SHM) ||
3389 ENGINE_COMPARE(ELM_WAYLAND_EGL))
3390 _elm_win_frame_add(sd, "default");
3392 evas_object_show(sd->frame_obj);
3395 TRAP(sd, fullscreen_set, fullscreen);
3396 #ifdef HAVE_ELEMENTARY_X
3397 _elm_win_xwin_update(sd);
3403 elm_win_fullscreen_get(const Evas_Object *obj)
3405 ELM_WIN_CHECK(obj) EINA_FALSE;
3406 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3408 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
3409 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
3411 // these engines... can ONLY be fullscreen
3416 return sd->fullscreen;
3421 elm_win_maximized_set(Evas_Object *obj,
3422 Eina_Bool maximized)
3425 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3427 // sd->maximized = maximized;
3428 // YYY: handle if sd->img_obj
3429 TRAP(sd, maximized_set, maximized);
3430 #ifdef HAVE_ELEMENTARY_X
3431 _elm_win_xwin_update(sd);
3436 elm_win_maximized_get(const Evas_Object *obj)
3438 ELM_WIN_CHECK(obj) EINA_FALSE;
3439 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3441 return sd->maximized;
3445 elm_win_iconified_set(Evas_Object *obj,
3446 Eina_Bool iconified)
3449 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3451 // sd->iconified = iconified;
3452 TRAP(sd, iconified_set, iconified);
3453 #ifdef HAVE_ELEMENTARY_X
3454 _elm_win_xwin_update(sd);
3459 elm_win_iconified_get(const Evas_Object *obj)
3461 ELM_WIN_CHECK(obj) EINA_FALSE;
3462 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3464 return sd->iconified;
3468 elm_win_withdrawn_set(Evas_Object *obj,
3469 Eina_Bool withdrawn)
3472 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3474 // sd->withdrawn = withdrawn;
3475 TRAP(sd, withdrawn_set, withdrawn);
3476 #ifdef HAVE_ELEMENTARY_X
3477 _elm_win_xwin_update(sd);
3482 elm_win_withdrawn_get(const Evas_Object *obj)
3484 ELM_WIN_CHECK(obj) EINA_FALSE;
3485 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3487 return sd->withdrawn;
3491 elm_win_profiles_set(Evas_Object *obj,
3492 const char **profiles,
3493 unsigned int num_profiles)
3495 char **profiles_int;
3497 unsigned int i, num;
3501 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3503 if (!profiles) return;
3505 if (sd->profile.timer) ecore_timer_del(sd->profile.timer);
3506 sd->profile.timer = ecore_timer_add(0.1, _elm_win_profile_change_delay, sd);
3507 EINA_LIST_FREE(sd->profile.names, str) eina_stringshare_del(str);
3509 for (i = 0; i < num_profiles; i++)
3511 if ((profiles[i]) &&
3512 _elm_config_profile_exists(profiles[i]))
3514 str = eina_stringshare_add(profiles[i]);
3515 sd->profile.names = eina_list_append(sd->profile.names, str);
3519 num = eina_list_count(sd->profile.names);
3520 profiles_int = alloca(num * sizeof(char *));
3525 EINA_LIST_FOREACH(sd->profile.names, l, str)
3528 profiles_int[i] = strdup(str);
3530 profiles_int[i] = NULL;
3533 ecore_evas_profiles_set(sd->ee, (const char **)profiles_int, i);
3534 for (i = 0; i < num; i++)
3536 if (profiles_int[i]) free(profiles_int[i]);
3540 ecore_evas_profiles_set(sd->ee, profiles, num_profiles);
3544 elm_win_profile_get(const Evas_Object *obj)
3546 ELM_WIN_CHECK(obj) NULL;
3547 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3549 return sd->profile.name;
3553 elm_win_urgent_set(Evas_Object *obj,
3557 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3559 sd->urgent = urgent;
3560 TRAP(sd, urgent_set, urgent);
3561 #ifdef HAVE_ELEMENTARY_X
3562 _elm_win_xwin_update(sd);
3567 elm_win_urgent_get(const Evas_Object *obj)
3569 ELM_WIN_CHECK(obj) EINA_FALSE;
3570 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3576 elm_win_demand_attention_set(Evas_Object *obj,
3577 Eina_Bool demand_attention)
3580 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3582 sd->demand_attention = demand_attention;
3583 TRAP(sd, demand_attention_set, demand_attention);
3584 #ifdef HAVE_ELEMENTARY_X
3585 _elm_win_xwin_update(sd);
3590 elm_win_demand_attention_get(const Evas_Object *obj)
3592 ELM_WIN_CHECK(obj) EINA_FALSE;
3593 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3595 return sd->demand_attention;
3599 elm_win_modal_set(Evas_Object *obj,
3603 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3606 TRAP(sd, modal_set, modal);
3607 #ifdef HAVE_ELEMENTARY_X
3608 _elm_win_xwin_update(sd);
3613 elm_win_modal_get(const Evas_Object *obj)
3615 ELM_WIN_CHECK(obj) EINA_FALSE;
3616 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3622 elm_win_aspect_set(Evas_Object *obj,
3626 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3628 sd->aspect = aspect;
3629 TRAP(sd, aspect_set, aspect);
3630 #ifdef HAVE_ELEMENTARY_X
3631 _elm_win_xwin_update(sd);
3636 elm_win_aspect_get(const Evas_Object *obj)
3638 ELM_WIN_CHECK(obj) 0.0;
3639 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, 0.0);
3645 elm_win_size_base_set(Evas_Object *obj, int w, int h)
3648 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3649 sd->size_base_w = w;
3650 sd->size_base_h = h;
3651 TRAP(sd, size_base_set, w, h);
3652 #ifdef HAVE_ELEMENTARY_X
3653 _elm_win_xwin_update(sd);
3658 elm_win_size_base_get(Evas_Object *obj, int *w, int *h)
3661 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3662 if (w) *w = sd->size_base_w;
3663 if (w) *h = sd->size_base_h;
3667 elm_win_size_step_set(Evas_Object *obj, int w, int h)
3670 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3671 sd->size_step_w = w;
3672 sd->size_step_h = h;
3673 TRAP(sd, size_step_set, w, h);
3674 #ifdef HAVE_ELEMENTARY_X
3675 _elm_win_xwin_update(sd);
3680 elm_win_size_step_get(Evas_Object *obj, int *w, int *h)
3683 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3684 if (w) *w = sd->size_step_w;
3685 if (w) *h = sd->size_step_h;
3689 elm_win_layer_set(Evas_Object *obj,
3693 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3695 TRAP(sd, layer_set, layer);
3696 #ifdef HAVE_ELEMENTARY_X
3697 _elm_win_xwin_update(sd);
3702 elm_win_layer_get(const Evas_Object *obj)
3704 ELM_WIN_CHECK(obj) - 1;
3705 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
3707 return ecore_evas_layer_get(sd->ee);
3711 elm_win_norender_push(Evas_Object *obj)
3714 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3717 if (sd->norender == 1) ecore_evas_manual_render_set(sd->ee, EINA_TRUE);
3721 elm_win_norender_pop(Evas_Object *obj)
3724 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3726 if (sd->norender <= 0) return;
3728 if (sd->norender == 0) ecore_evas_manual_render_set(sd->ee, EINA_FALSE);
3732 elm_win_norender_get(Evas_Object *obj)
3734 ELM_WIN_CHECK(obj) - 1;
3735 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
3736 return sd->norender;
3740 elm_win_render(Evas_Object *obj)
3743 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3744 ecore_evas_manual_render(sd->ee);
3748 _win_rotation_degree_check(int rotation)
3750 if ((rotation > 360) || (rotation < 0))
3752 WRN("Rotation degree should be 0 ~ 360 (passed degree: %d)", rotation);
3754 if (rotation < 0) rotation += 360;
3760 _win_rotate(Evas_Object *obj, Elm_Win_Smart_Data *sd, int rotation, Eina_Bool resize)
3762 rotation = _win_rotation_degree_check(rotation);
3763 if (sd->rot == rotation) return;
3765 if (resize) TRAP(sd, rotation_with_resize_set, rotation);
3766 else TRAP(sd, rotation_set, rotation);
3767 evas_object_size_hint_min_set(obj, -1, -1);
3768 evas_object_size_hint_max_set(obj, -1, -1);
3769 _elm_win_resize_objects_eval(obj);
3770 #ifdef HAVE_ELEMENTARY_X
3771 _elm_win_xwin_update(sd);
3773 elm_widget_orientation_set(obj, rotation);
3774 evas_object_smart_callback_call(obj, SIG_ROTATION_CHANGED, NULL);
3778 elm_win_rotation_set(Evas_Object *obj,
3782 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3783 _win_rotate(obj, sd, rotation, EINA_FALSE);
3787 elm_win_rotation_with_resize_set(Evas_Object *obj,
3791 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3792 _win_rotate(obj, sd, rotation, EINA_TRUE);
3796 elm_win_rotation_get(const Evas_Object *obj)
3798 ELM_WIN_CHECK(obj) - 1;
3799 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
3805 elm_win_wm_rotation_supported_get(const Evas_Object *obj)
3807 ELM_WIN_CHECK(obj) EINA_FALSE;
3808 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3809 return sd->wm_rot.wm_supported;
3812 /* This will unset a preferred rotation, if given preferred rotation is '-1'.
3815 elm_win_wm_rotation_preferred_rotation_set(Evas_Object *obj,
3821 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3823 if (!sd->wm_rot.use)
3824 sd->wm_rot.use = EINA_TRUE;
3826 // '-1' means that elm_win doesn't use preferred rotation.
3830 rot = _win_rotation_degree_check(rotation);
3832 if (sd->wm_rot.preferred_rot == rot) return;
3833 sd->wm_rot.preferred_rot = rot;
3835 ecore_evas_wm_rotation_preferred_rotation_set(sd->ee, rot);
3839 elm_win_wm_rotation_preferred_rotation_get(const Evas_Object *obj)
3841 ELM_WIN_CHECK(obj) -1;
3842 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
3843 if (!sd->wm_rot.use) return -1;
3844 return sd->wm_rot.preferred_rot;
3848 elm_win_wm_rotation_available_rotations_set(Evas_Object *obj,
3849 const int *rotations,
3856 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3858 if (!sd->wm_rot.use)
3859 sd->wm_rot.use = EINA_TRUE;
3861 if (sd->wm_rot.rots) free(sd->wm_rot.rots);
3863 sd->wm_rot.rots = NULL;
3864 sd->wm_rot.count = 0;
3868 sd->wm_rot.rots = calloc(count, sizeof(int));
3869 if (!sd->wm_rot.rots) return;
3870 for (i = 0; i < count; i++)
3872 r = _win_rotation_degree_check(rotations[i]);
3873 sd->wm_rot.rots[i] = r;
3877 sd->wm_rot.count = count;
3879 ecore_evas_wm_rotation_available_rotations_set(sd->ee,
3885 elm_win_wm_rotation_available_rotations_get(const Evas_Object *obj,
3887 unsigned int *count)
3889 ELM_WIN_CHECK(obj) EINA_FALSE;
3890 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3891 if (!sd->wm_rot.use) return EINA_FALSE;
3893 if (sd->wm_rot.count > 0)
3895 if ((rotations) && (*rotations))
3897 *rotations = calloc(sd->wm_rot.count, sizeof(int));
3902 sizeof(int) * sd->wm_rot.count);
3907 if (count) *count = sd->wm_rot.count;
3913 elm_win_sticky_set(Evas_Object *obj,
3917 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3919 // sd->sticky = sticky;
3920 TRAP(sd, sticky_set, sticky);
3921 #ifdef HAVE_ELEMENTARY_X
3922 _elm_win_xwin_update(sd);
3927 elm_win_sticky_get(const Evas_Object *obj)
3929 ELM_WIN_CHECK(obj) EINA_FALSE;
3930 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3936 elm_win_keyboard_mode_set(Evas_Object *obj,
3937 Elm_Win_Keyboard_Mode mode)
3940 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3942 if (mode == sd->kbdmode) return;
3943 #ifdef HAVE_ELEMENTARY_X
3944 _elm_win_xwindow_get(sd);
3947 #ifdef HAVE_ELEMENTARY_X
3949 ecore_x_e_virtual_keyboard_state_set
3950 (sd->x.xwin, (Ecore_X_Virtual_Keyboard_State)sd->kbdmode);
3954 EAPI Elm_Win_Keyboard_Mode
3955 elm_win_keyboard_mode_get(const Evas_Object *obj)
3957 ELM_WIN_CHECK(obj) ELM_WIN_KEYBOARD_UNKNOWN;
3958 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, ELM_WIN_KEYBOARD_UNKNOWN);
3964 elm_win_keyboard_win_set(Evas_Object *obj,
3965 Eina_Bool is_keyboard)
3968 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3970 #ifdef HAVE_ELEMENTARY_X
3971 _elm_win_xwindow_get(sd);
3973 ecore_x_e_virtual_keyboard_set(sd->x.xwin, is_keyboard);
3980 elm_win_keyboard_win_get(const Evas_Object *obj)
3982 ELM_WIN_CHECK(obj) EINA_FALSE;
3983 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3985 #ifdef HAVE_ELEMENTARY_X
3986 _elm_win_xwindow_get(sd);
3988 return ecore_x_e_virtual_keyboard_get(sd->x.xwin);
3994 elm_win_indicator_mode_set(Evas_Object *obj,
3995 Elm_Win_Indicator_Mode mode)
3998 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4000 if (mode == sd->indmode) return;
4001 #ifdef HAVE_ELEMENTARY_X
4002 _elm_win_xwindow_get(sd);
4005 #ifdef HAVE_ELEMENTARY_X
4008 if (sd->indmode == ELM_WIN_INDICATOR_SHOW)
4009 ecore_x_e_illume_indicator_state_set
4010 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
4011 else if (sd->indmode == ELM_WIN_INDICATOR_HIDE)
4012 ecore_x_e_illume_indicator_state_set
4013 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
4016 evas_object_smart_callback_call(obj, SIG_INDICATOR_PROP_CHANGED, NULL);
4019 EAPI Elm_Win_Indicator_Mode
4020 elm_win_indicator_mode_get(const Evas_Object *obj)
4022 ELM_WIN_CHECK(obj) ELM_WIN_INDICATOR_UNKNOWN;
4023 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, ELM_WIN_INDICATOR_UNKNOWN);
4029 elm_win_indicator_opacity_set(Evas_Object *obj,
4030 Elm_Win_Indicator_Opacity_Mode mode)
4033 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4035 if (mode == sd->ind_o_mode) return;
4036 sd->ind_o_mode = mode;
4037 #ifdef HAVE_ELEMENTARY_X
4038 _elm_win_xwindow_get(sd);
4041 if (sd->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
4042 ecore_x_e_illume_indicator_opacity_set
4043 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
4044 else if (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
4045 ecore_x_e_illume_indicator_opacity_set
4046 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
4047 else if (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
4048 ecore_x_e_illume_indicator_opacity_set
4049 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
4052 evas_object_smart_callback_call(obj, SIG_INDICATOR_PROP_CHANGED, NULL);
4055 EAPI Elm_Win_Indicator_Opacity_Mode
4056 elm_win_indicator_opacity_get(const Evas_Object *obj)
4058 ELM_WIN_CHECK(obj) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
4059 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, ELM_WIN_INDICATOR_OPACITY_UNKNOWN);
4061 return sd->ind_o_mode;
4065 elm_win_indicator_type_set(Evas_Object *obj,
4066 Elm_Win_Indicator_Type_Mode mode)
4069 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4071 if (mode == sd->ind_t_mode) return;
4072 sd->ind_t_mode = mode;
4073 #ifdef HAVE_ELEMENTARY_X
4074 _elm_win_xwindow_get(sd);
4077 if (sd->ind_t_mode == ELM_WIN_INDICATOR_TYPE_1)
4078 ecore_x_e_illume_indicator_type_set
4079 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TYPE_1);
4080 else if (sd->ind_t_mode == ELM_WIN_INDICATOR_TYPE_2)
4081 ecore_x_e_illume_indicator_type_set
4082 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TYPE_2);
4085 //evas_object_smart_callback_call(obj, SIG_INDICATOR_PROP_CHANGED, NULL);
4088 EAPI Elm_Win_Indicator_Type_Mode
4089 elm_win_indicator_type_get(const Evas_Object *obj)
4091 ELM_WIN_CHECK(obj) ELM_WIN_INDICATOR_TYPE_UNKNOWN;
4092 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, ELM_WIN_INDICATOR_TYPE_UNKNOWN);
4094 return sd->ind_t_mode;
4097 elm_win_screen_position_get(const Evas_Object *obj,
4102 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4104 if (x) *x = sd->screen.x;
4105 if (y) *y = sd->screen.y;
4109 elm_win_focus_get(const Evas_Object *obj)
4111 ELM_WIN_CHECK(obj) EINA_FALSE;
4112 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4114 return ecore_evas_focus_get(sd->ee);
4118 elm_win_screen_constrain_set(Evas_Object *obj,
4119 Eina_Bool constrain)
4122 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4124 sd->constrain = !!constrain;
4128 elm_win_screen_constrain_get(Evas_Object *obj)
4130 ELM_WIN_CHECK(obj) EINA_FALSE;
4131 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4133 return sd->constrain;
4137 elm_win_screen_size_get(const Evas_Object *obj,
4144 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4146 ecore_evas_screen_geometry_get(sd->ee, x, y, w, h);
4150 elm_win_screen_dpi_get(const Evas_Object *obj,
4155 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4157 ecore_evas_screen_dpi_get(sd->ee, xdpi, ydpi);
4161 elm_win_conformant_set(Evas_Object *obj,
4162 Eina_Bool conformant)
4165 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4167 #ifdef HAVE_ELEMENTARY_X
4168 _elm_win_xwindow_get(sd);
4170 ecore_x_e_illume_conformant_set(sd->x.xwin, conformant);
4177 elm_win_conformant_get(const Evas_Object *obj)
4179 ELM_WIN_CHECK(obj) EINA_FALSE;
4180 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4182 #ifdef HAVE_ELEMENTARY_X
4183 _elm_win_xwindow_get(sd);
4185 return ecore_x_e_illume_conformant_get(sd->x.xwin);
4191 elm_win_quickpanel_set(Evas_Object *obj,
4192 Eina_Bool quickpanel)
4195 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4196 #ifdef HAVE_ELEMENTARY_X
4197 _elm_win_xwindow_get(sd);
4200 ecore_x_e_illume_quickpanel_set(sd->x.xwin, quickpanel);
4203 Ecore_X_Window_State states[2];
4205 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
4206 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
4207 ecore_x_netwm_window_state_set(sd->x.xwin, states, 2);
4208 ecore_x_icccm_hints_set(sd->x.xwin, 0, 0, 0, 0, 0, 0, 0);
4217 elm_win_quickpanel_get(const Evas_Object *obj)
4219 ELM_WIN_CHECK(obj) EINA_FALSE;
4220 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4222 #ifdef HAVE_ELEMENTARY_X
4223 _elm_win_xwindow_get(sd);
4225 return ecore_x_e_illume_quickpanel_get(sd->x.xwin);
4231 elm_win_quickpanel_priority_major_set(Evas_Object *obj,
4235 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4237 #ifdef HAVE_ELEMENTARY_X
4238 _elm_win_xwindow_get(sd);
4240 ecore_x_e_illume_quickpanel_priority_major_set(sd->x.xwin, priority);
4247 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
4249 ELM_WIN_CHECK(obj) - 1;
4250 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
4252 #ifdef HAVE_ELEMENTARY_X
4253 _elm_win_xwindow_get(sd);
4255 return ecore_x_e_illume_quickpanel_priority_major_get(sd->x.xwin);
4261 elm_win_quickpanel_priority_minor_set(Evas_Object *obj,
4265 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4267 #ifdef HAVE_ELEMENTARY_X
4268 _elm_win_xwindow_get(sd);
4270 ecore_x_e_illume_quickpanel_priority_minor_set(sd->x.xwin, priority);
4277 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
4279 ELM_WIN_CHECK(obj) - 1;
4280 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
4282 #ifdef HAVE_ELEMENTARY_X
4283 _elm_win_xwindow_get(sd);
4285 return ecore_x_e_illume_quickpanel_priority_minor_get(sd->x.xwin);
4291 elm_win_quickpanel_zone_set(Evas_Object *obj,
4295 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4297 #ifdef HAVE_ELEMENTARY_X
4298 _elm_win_xwindow_get(sd);
4300 ecore_x_e_illume_quickpanel_zone_set(sd->x.xwin, zone);
4307 elm_win_quickpanel_zone_get(const Evas_Object *obj)
4309 ELM_WIN_CHECK(obj) 0;
4310 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, 0);
4312 #ifdef HAVE_ELEMENTARY_X
4313 _elm_win_xwindow_get(sd);
4315 return ecore_x_e_illume_quickpanel_zone_get(sd->x.xwin);
4321 elm_win_prop_focus_skip_set(Evas_Object *obj,
4325 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4327 sd->skip_focus = skip;
4328 TRAP(sd, focus_skip_set, skip);
4332 elm_win_illume_command_send(Evas_Object *obj,
4333 Elm_Illume_Command command,
4334 void *params __UNUSED__)
4337 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4339 #ifdef HAVE_ELEMENTARY_X
4340 _elm_win_xwindow_get(sd);
4345 case ELM_ILLUME_COMMAND_FOCUS_BACK:
4346 ecore_x_e_illume_focus_back_send(sd->x.xwin);
4349 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
4350 ecore_x_e_illume_focus_forward_send(sd->x.xwin);
4353 case ELM_ILLUME_COMMAND_FOCUS_HOME:
4354 ecore_x_e_illume_focus_home_send(sd->x.xwin);
4357 case ELM_ILLUME_COMMAND_CLOSE:
4358 ecore_x_e_illume_close_send(sd->x.xwin);
4371 elm_win_inlined_image_object_get(Evas_Object *obj)
4373 ELM_WIN_CHECK(obj) NULL;
4374 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
4380 elm_win_focus_highlight_enabled_set(Evas_Object *obj,
4384 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4386 enabled = !!enabled;
4387 if (sd->focus_highlight.enabled == enabled)
4390 sd->focus_highlight.enabled = enabled;
4392 if (sd->focus_highlight.enabled)
4393 _elm_win_focus_highlight_init(sd);
4395 _elm_win_focus_highlight_shutdown(sd);
4399 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
4401 ELM_WIN_CHECK(obj) EINA_FALSE;
4402 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4404 return sd->focus_highlight.enabled;
4408 elm_win_focus_highlight_style_set(Evas_Object *obj,
4412 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4414 eina_stringshare_replace(&sd->focus_highlight.style, style);
4415 sd->focus_highlight.changed_theme = EINA_TRUE;
4416 _elm_win_focus_highlight_reconfigure_job_start(sd);
4420 elm_win_focus_highlight_style_get(const Evas_Object *obj)
4422 ELM_WIN_CHECK(obj) NULL;
4423 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
4425 return sd->focus_highlight.style;
4429 elm_win_socket_listen(Evas_Object *obj,
4430 const char *svcname,
4434 ELM_WIN_CHECK(obj) EINA_FALSE;
4435 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4437 if (!sd->ee) return EINA_FALSE;
4439 if (!ecore_evas_extn_socket_listen(sd->ee, svcname, svcnum, svcsys))
4445 /* windowing specific calls - shall we do this differently? */
4448 elm_win_xwindow_get(const Evas_Object *obj)
4452 if (!evas_object_smart_type_check_ptr(obj, WIN_SMART_NAME))
4454 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
4455 return _elm_ee_xwin_get(ee);
4458 ELM_WIN_CHECK(obj) 0;
4459 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, 0);
4461 #ifdef HAVE_ELEMENTARY_X
4462 if (sd->x.xwin) return sd->x.xwin;
4463 if (sd->parent) return elm_win_xwindow_get(sd->parent);
4468 EAPI Ecore_Wl_Window *
4469 elm_win_wl_window_get(const Evas_Object *obj)
4471 if (!obj) return NULL;
4473 if (!evas_object_smart_type_check_ptr(obj, WIN_SMART_NAME))
4475 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
4476 return ecore_evas_wayland_window_get(ee);
4479 ELM_WIN_CHECK(obj) NULL;
4480 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
4481 #if HAVE_ELEMENTARY_WAYLAND
4482 if (sd->wl.win) return sd->wl.win;
4483 if (sd->parent) return elm_win_wl_window_get(sd->parent);
4489 elm_win_trap_set(const Elm_Win_Trap *t)
4491 DBG("old %p, new %p", trap, t);
4493 if ((t) && (t->version != ELM_WIN_TRAP_VERSION))
4495 CRITICAL("trying to set a trap version %lu while %lu was expected!",
4496 t->version, ELM_WIN_TRAP_VERSION);
4505 elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool floating)
4508 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4510 if (floating == sd->floating) return;
4511 sd->floating = floating;
4512 #ifdef HAVE_ELEMENTARY_X
4513 _elm_win_xwindow_get(sd);
4517 ecore_x_e_illume_window_state_set
4518 (sd->x.xwin, ECORE_X_ILLUME_WINDOW_STATE_FLOATING);
4520 ecore_x_e_illume_window_state_set
4521 (sd->x.xwin, ECORE_X_ILLUME_WINDOW_STATE_NORMAL);
4527 elm_win_floating_mode_get(const Evas_Object *obj)
4529 ELM_WIN_CHECK(obj) EINA_FALSE;
4530 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4532 return sd->floating;