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)
1954 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1956 elm_widget_access(obj, is_access);
1959 evas = evas_object_evas_get(obj);
1960 if (evas) _elm_access_object_hilight_disable(evas);
1966 _elm_win_translate(void)
1971 EINA_LIST_FOREACH(_elm_win_list, l, obj)
1972 elm_widget_translate(obj);
1975 #ifdef HAVE_ELEMENTARY_X
1977 _elm_win_client_message(void *data,
1978 int type __UNUSED__,
1981 Elm_Access_Action_Info *a;
1982 Ecore_X_Atom atom_scroll, atom_back, atom_control_panel_open;
1983 Elm_Win_Smart_Data *sd = data;
1984 Ecore_X_Event_Client_Message *e = event;
1986 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1987 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1989 if ((unsigned int)e->data.l[0] == sd->x.xwin)
1991 Evas *evas = evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj);
1994 edje_file_cache_flush();
1995 edje_collection_cache_flush();
1996 evas_image_cache_flush(evas);
1997 evas_font_cache_flush(evas);
2001 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
2003 if ((unsigned int)e->data.l[0] == sd->x.xwin)
2005 Evas *evas = evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj);
2008 edje_file_cache_flush();
2009 edje_collection_cache_flush();
2010 evas_image_cache_flush(evas);
2011 evas_font_cache_flush(evas);
2012 evas_render_dump(evas);
2016 else if (e->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
2018 if ((unsigned int)e->data.l[0] == sd->x.xwin)
2020 atom_scroll = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_SCROLL_");
2021 atom_back = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_BACK_");
2022 atom_control_panel_open = ecore_x_atom_get("_E_MOD_SCREEN_READER_ACTION_CONTROL_PANEL_OPEN_");
2024 if ((unsigned int)e->data.l[1] ==
2025 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
2027 // XXX: call right access func
2029 else if ((unsigned int)e->data.l[1] ==
2030 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
2032 // XXX: call right access func
2034 else if ((unsigned int)e->data.l[1] ==
2035 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
2037 _elm_access_highlight_object_activate
2038 (ELM_WIDGET_DATA(sd)->obj, ELM_ACTIVATE_DEFAULT);
2040 else if ((unsigned int)e->data.l[1] ==
2041 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
2043 /* there would be better way to read highlight object */
2045 evas = evas_object_evas_get(ELM_WIDGET_DATA(sd)->obj);
2046 if (!evas) return ECORE_CALLBACK_PASS_ON;
2048 a = calloc(1, sizeof(Elm_Access_Action_Info));
2049 a->x = e->data.l[2];
2050 a->y = e->data.l[3];
2051 elm_access_action(ELM_WIDGET_DATA(sd)->obj, ELM_ACCESS_ACTION_HIGHLIGHT, a);
2054 else if ((unsigned int)e->data.l[1] ==
2055 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
2057 _elm_access_highlight_cycle(ELM_WIDGET_DATA(sd)->obj, ELM_FOCUS_NEXT);
2059 else if ((unsigned int)e->data.l[1] ==
2060 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
2062 _elm_access_highlight_cycle(ELM_WIDGET_DATA(sd)->obj, ELM_FOCUS_PREVIOUS);
2064 else if ((unsigned int)e->data.l[1] ==
2065 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
2067 _elm_access_highlight_object_activate
2068 (ELM_WIDGET_DATA(sd)->obj, ELM_ACTIVATE_UP);
2070 else if ((unsigned int)e->data.l[1] ==
2071 ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
2073 _elm_access_highlight_object_activate
2074 (ELM_WIDGET_DATA(sd)->obj, ELM_ACTIVATE_DOWN);
2076 else if ((unsigned int)e->data.l[1] == atom_scroll)
2078 _elm_access_highlight_object_scroll(ELM_WIDGET_DATA(sd)->obj,
2079 e->data.l[2], e->data.l[3], e->data.l[4]);
2081 else if ((unsigned int)e->data.l[1] == atom_back)
2083 _elm_access_highlight_object_activate
2084 (ELM_WIDGET_DATA(sd)->obj, ELM_ACTIVATE_BACK);
2086 else if ((unsigned int)e->data.l[1] == atom_control_panel_open)
2091 return ECORE_CALLBACK_PASS_ON;
2095 _elm_win_property_change(void *data,
2096 int type __UNUSED__,
2099 Elm_Win_Smart_Data *sd = data;
2100 Ecore_X_Event_Window_Property *e = event;
2102 if (e->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE)
2104 if (e->win == sd->x.xwin)
2106 sd->indmode = ecore_x_e_illume_indicator_state_get(e->win);
2107 evas_object_smart_callback_call(ELM_WIDGET_DATA(sd)->obj, SIG_INDICATOR_PROP_CHANGED, NULL);
2110 if (e->atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE)
2112 if (e->win == sd->x.xwin)
2114 sd->kbdmode = ecore_x_e_virtual_keyboard_state_get(e->win);
2117 return ECORE_CALLBACK_PASS_ON;
2122 _elm_win_focus_highlight_hide(void *data __UNUSED__,
2124 const char *emission __UNUSED__,
2125 const char *source __UNUSED__)
2127 evas_object_hide(obj);
2131 _elm_win_focus_highlight_anim_end(void *data,
2133 const char *emission __UNUSED__,
2134 const char *source __UNUSED__)
2136 Elm_Win_Smart_Data *sd = data;
2138 _elm_win_focus_highlight_simple_setup(sd, obj);
2142 _elm_win_focus_highlight_init(Elm_Win_Smart_Data *sd)
2144 evas_event_callback_add(sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
2145 _elm_win_object_focus_in, sd);
2146 evas_event_callback_add(sd->evas,
2147 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
2148 _elm_win_object_focus_out, sd);
2150 sd->focus_highlight.cur.target = evas_focus_get(sd->evas);
2152 sd->focus_highlight.top = edje_object_add(sd->evas);
2153 sd->focus_highlight.changed_theme = EINA_TRUE;
2154 edje_object_signal_callback_add(sd->focus_highlight.top,
2155 "elm,action,focus,hide,end", "",
2156 _elm_win_focus_highlight_hide, NULL);
2157 edje_object_signal_callback_add(sd->focus_highlight.top,
2158 "elm,action,focus,anim,end", "",
2159 _elm_win_focus_highlight_anim_end, sd);
2160 _elm_win_focus_highlight_reconfigure_job_start(sd);
2164 _elm_win_frame_cb_move_start(void *data,
2165 Evas_Object *obj __UNUSED__,
2166 const char *sig __UNUSED__,
2167 const char *source __UNUSED__)
2169 Elm_Win_Smart_Data *sd;
2171 if (!(sd = data)) return;
2172 /* FIXME: Change mouse pointer */
2174 /* NB: Wayland handles moving surfaces by itself so we cannot
2175 * specify a specific x/y we want. Instead, we will pass in the
2176 * existing x/y values so they can be recorded as 'previous'
2177 * position. The new position will get updated automatically when
2178 * the move is finished */
2180 ecore_evas_wayland_move(sd->ee, sd->screen.x, sd->screen.y);
2184 _elm_win_frame_cb_resize_show(void *data,
2185 Evas_Object *obj __UNUSED__,
2186 const char *sig __UNUSED__,
2189 Elm_Win_Smart_Data *sd;
2191 if (!(sd = data)) return;
2192 if (sd->resizing) return;
2194 #ifdef HAVE_ELEMENTARY_WAYLAND
2195 if (!strcmp(source, "elm.event.resize.t"))
2196 ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_TOP_SIDE);
2197 else if (!strcmp(source, "elm.event.resize.b"))
2198 ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_BOTTOM_SIDE);
2199 else if (!strcmp(source, "elm.event.resize.l"))
2200 ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_LEFT_SIDE);
2201 else if (!strcmp(source, "elm.event.resize.r"))
2202 ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_RIGHT_SIDE);
2203 else if (!strcmp(source, "elm.event.resize.tl"))
2204 ecore_wl_window_cursor_from_name_set(sd->wl.win,
2205 ELM_CURSOR_TOP_LEFT_CORNER);
2206 else if (!strcmp(source, "elm.event.resize.tr"))
2207 ecore_wl_window_cursor_from_name_set(sd->wl.win,
2208 ELM_CURSOR_TOP_RIGHT_CORNER);
2209 else if (!strcmp(source, "elm.event.resize.bl"))
2210 ecore_wl_window_cursor_from_name_set(sd->wl.win,
2211 ELM_CURSOR_BOTTOM_LEFT_CORNER);
2212 else if (!strcmp(source, "elm.event.resize.br"))
2213 ecore_wl_window_cursor_from_name_set(sd->wl.win,
2214 ELM_CURSOR_BOTTOM_RIGHT_CORNER);
2216 ecore_wl_window_cursor_default_restore(sd->wl.win);
2223 _elm_win_frame_cb_resize_hide(void *data,
2224 Evas_Object *obj __UNUSED__,
2225 const char *sig __UNUSED__,
2226 const char *source __UNUSED__)
2228 Elm_Win_Smart_Data *sd;
2230 if (!(sd = data)) return;
2231 if (sd->resizing) return;
2233 #ifdef HAVE_ELEMENTARY_WAYLAND
2234 ecore_wl_window_cursor_default_restore(sd->wl.win);
2239 _elm_win_frame_cb_resize_start(void *data,
2240 Evas_Object *obj __UNUSED__,
2241 const char *sig __UNUSED__,
2244 Elm_Win_Smart_Data *sd;
2246 if (!(sd = data)) return;
2247 if (sd->resizing) return;
2249 sd->resizing = EINA_TRUE;
2251 if (!strcmp(source, "elm.event.resize.t"))
2252 sd->resize_location = 1;
2253 else if (!strcmp(source, "elm.event.resize.b"))
2254 sd->resize_location = 2;
2255 else if (!strcmp(source, "elm.event.resize.l"))
2256 sd->resize_location = 4;
2257 else if (!strcmp(source, "elm.event.resize.r"))
2258 sd->resize_location = 8;
2259 else if (!strcmp(source, "elm.event.resize.tl"))
2260 sd->resize_location = 5;
2261 else if (!strcmp(source, "elm.event.resize.tr"))
2262 sd->resize_location = 9;
2263 else if (!strcmp(source, "elm.event.resize.bl"))
2264 sd->resize_location = 6;
2265 else if (!strcmp(source, "elm.event.resize.br"))
2266 sd->resize_location = 10;
2268 sd->resize_location = 0;
2270 if (sd->resize_location > 0)
2271 ecore_evas_wayland_resize(sd->ee, sd->resize_location);
2275 _elm_win_frame_cb_minimize(void *data,
2276 Evas_Object *obj __UNUSED__,
2277 const char *sig __UNUSED__,
2278 const char *source __UNUSED__)
2280 Elm_Win_Smart_Data *sd;
2282 if (!(sd = data)) return;
2283 // sd->iconified = EINA_TRUE;
2284 TRAP(sd, iconified_set, EINA_TRUE);
2288 _elm_win_frame_cb_maximize(void *data,
2289 Evas_Object *obj __UNUSED__,
2290 const char *sig __UNUSED__,
2291 const char *source __UNUSED__)
2293 Elm_Win_Smart_Data *sd;
2295 if (!(sd = data)) return;
2296 if (sd->maximized) sd->maximized = EINA_FALSE;
2297 else sd->maximized = EINA_TRUE;
2298 TRAP(sd, maximized_set, sd->maximized);
2302 _elm_win_frame_cb_close(void *data,
2303 Evas_Object *obj __UNUSED__,
2304 const char *sig __UNUSED__,
2305 const char *source __UNUSED__)
2307 Elm_Win_Smart_Data *sd;
2310 /* FIXME: After the current freeze, this should be handled differently.
2312 * Ideally, we would want to mimic the X11 backend and use something
2313 * like ECORE_WL_EVENT_WINDOW_DELETE and handle the delete_request
2314 * inside of ecore_evas. That would be the 'proper' way, but since we are
2315 * in a freeze right now, I cannot add a new event value, or a new
2316 * event structure to ecore_wayland.
2318 * So yes, this is a temporary 'stop-gap' solution which will be fixed
2319 * when the freeze is over, but it does fix a trac bug for now, and in a
2320 * way which does not break API or the freeze. - dh
2323 if (!(sd = data)) return;
2325 win = ELM_WIDGET_DATA(sd)->obj;
2327 int autodel = sd->autodel;
2328 sd->autodel_clear = &autodel;
2329 evas_object_ref(win);
2330 evas_object_smart_callback_call(win, SIG_DELETE_REQUEST, NULL);
2331 // FIXME: if above callback deletes - then the below will be invalid
2332 if (autodel) evas_object_del(win);
2333 else sd->autodel_clear = NULL;
2334 evas_object_unref(win);
2338 _elm_win_frame_add(Elm_Win_Smart_Data *sd,
2341 evas_output_framespace_set(sd->evas, 0, 22, 0, 26);
2343 sd->frame_obj = edje_object_add(sd->evas);
2344 elm_widget_theme_object_set
2345 (ELM_WIDGET_DATA(sd)->obj, sd->frame_obj, "border", "base", style);
2347 evas_object_is_frame_object_set(sd->frame_obj, EINA_TRUE);
2348 evas_object_move(sd->frame_obj, 0, 0);
2349 evas_object_resize(sd->frame_obj, 1, 1);
2351 edje_object_signal_callback_add
2352 (sd->frame_obj, "elm,action,move,start", "elm",
2353 _elm_win_frame_cb_move_start, sd);
2354 edje_object_signal_callback_add
2355 (sd->frame_obj, "elm,action,resize,show", "*",
2356 _elm_win_frame_cb_resize_show, sd);
2357 edje_object_signal_callback_add
2358 (sd->frame_obj, "elm,action,resize,hide", "*",
2359 _elm_win_frame_cb_resize_hide, sd);
2360 edje_object_signal_callback_add
2361 (sd->frame_obj, "elm,action,resize,start", "*",
2362 _elm_win_frame_cb_resize_start, sd);
2363 edje_object_signal_callback_add
2364 (sd->frame_obj, "elm,action,minimize", "elm",
2365 _elm_win_frame_cb_minimize, sd);
2366 edje_object_signal_callback_add
2367 (sd->frame_obj, "elm,action,maximize", "elm",
2368 _elm_win_frame_cb_maximize, sd);
2369 edje_object_signal_callback_add
2370 (sd->frame_obj, "elm,action,close", "elm", _elm_win_frame_cb_close, sd);
2374 edje_object_part_text_escaped_set
2375 (sd->frame_obj, "elm.text.title", sd->title);
2380 _elm_win_frame_del(Elm_Win_Smart_Data *sd)
2384 edje_object_signal_callback_del
2385 (sd->frame_obj, "elm,action,move,start", "elm",
2386 _elm_win_frame_cb_move_start);
2387 edje_object_signal_callback_del
2388 (sd->frame_obj, "elm,action,resize,show", "*",
2389 _elm_win_frame_cb_resize_show);
2390 edje_object_signal_callback_del
2391 (sd->frame_obj, "elm,action,resize,hide", "*",
2392 _elm_win_frame_cb_resize_hide);
2393 edje_object_signal_callback_del
2394 (sd->frame_obj, "elm,action,resize,start", "*",
2395 _elm_win_frame_cb_resize_start);
2396 edje_object_signal_callback_del
2397 (sd->frame_obj, "elm,action,minimize", "elm",
2398 _elm_win_frame_cb_minimize);
2399 edje_object_signal_callback_del
2400 (sd->frame_obj, "elm,action,maximize", "elm",
2401 _elm_win_frame_cb_maximize);
2402 edje_object_signal_callback_del
2403 (sd->frame_obj, "elm,action,close", "elm",
2404 _elm_win_frame_cb_close);
2406 evas_object_del(sd->frame_obj);
2407 sd->frame_obj = NULL;
2410 evas_output_framespace_set(sd->evas, 0, 0, 0, 0);
2415 _debug_key_down(void *data __UNUSED__,
2420 Evas_Event_Key_Down *ev = event_info;
2422 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
2425 if ((strcmp(ev->keyname, "F12")) ||
2426 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
2429 printf("Tree graph generated.\n");
2430 elm_object_tree_dot_dump(obj, "./dump.dot");
2436 _win_img_hide(void *data,
2438 Evas_Object *obj __UNUSED__,
2439 void *event_info __UNUSED__)
2441 Elm_Win_Smart_Data *sd = data;
2443 elm_widget_focus_hide_handle(ELM_WIDGET_DATA(sd)->obj);
2447 _win_img_mouse_up(void *data,
2449 Evas_Object *obj __UNUSED__,
2452 Elm_Win_Smart_Data *sd = data;
2453 Evas_Event_Mouse_Up *ev = event_info;
2454 if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
2455 elm_widget_focus_mouse_up_handle(ELM_WIDGET_DATA(sd)->obj);
2459 _win_img_focus_in(void *data,
2461 Evas_Object *obj __UNUSED__,
2462 void *event_info __UNUSED__)
2464 Elm_Win_Smart_Data *sd = data;
2465 elm_widget_focus_steal(ELM_WIDGET_DATA(sd)->obj);
2469 _win_img_focus_out(void *data,
2471 Evas_Object *obj __UNUSED__,
2472 void *event_info __UNUSED__)
2474 Elm_Win_Smart_Data *sd = data;
2475 elm_widget_focused_object_clear(ELM_WIDGET_DATA(sd)->obj);
2479 _win_inlined_image_set(Elm_Win_Smart_Data *sd)
2481 evas_object_image_alpha_set(sd->img_obj, EINA_FALSE);
2482 evas_object_image_filled_set(sd->img_obj, EINA_TRUE);
2484 evas_object_event_callback_add
2485 (sd->img_obj, EVAS_CALLBACK_DEL, _elm_win_on_img_obj_del, sd);
2486 evas_object_event_callback_add
2487 (sd->img_obj, EVAS_CALLBACK_HIDE, _win_img_hide, sd);
2488 evas_object_event_callback_add
2489 (sd->img_obj, EVAS_CALLBACK_MOUSE_UP, _win_img_mouse_up, sd);
2490 evas_object_event_callback_add
2491 (sd->img_obj, EVAS_CALLBACK_FOCUS_IN, _win_img_focus_in, sd);
2492 evas_object_event_callback_add
2493 (sd->img_obj, EVAS_CALLBACK_FOCUS_OUT, _win_img_focus_out, sd);
2497 _elm_win_on_icon_del(void *data,
2500 void *event_info __UNUSED__)
2502 Elm_Win_Smart_Data *sd = data;
2504 if (sd->icon == obj) sd->icon = NULL;
2508 _elm_win_smart_add(Evas_Object *obj)
2510 EVAS_SMART_DATA_ALLOC(obj, Elm_Win_Smart_Data);
2512 _elm_win_parent_sc->base.add(obj);
2514 elm_widget_can_focus_set(obj, EINA_TRUE);
2516 elm_widget_highlight_ignore_set(obj, EINA_TRUE);
2520 _elm_win_smart_set_user(Elm_Widget_Smart_Class *sc)
2522 sc->base.add = _elm_win_smart_add;
2523 sc->base.del = _elm_win_smart_del;
2524 sc->base.show = _elm_win_smart_show;
2525 sc->base.hide = _elm_win_smart_hide;
2526 sc->base.move = _elm_win_smart_move;
2527 sc->base.resize = _elm_win_smart_resize;
2529 sc->focus_next = _elm_win_smart_focus_next;
2530 sc->focus_direction = _elm_win_smart_focus_direction;
2531 sc->on_focus = _elm_win_smart_on_focus;
2532 sc->event = _elm_win_smart_event;
2535 #ifdef HAVE_ELEMENTARY_X
2537 _elm_x_io_err(void *data __UNUSED__)
2542 EINA_LIST_FOREACH(_elm_win_list, l, obj)
2543 evas_object_smart_callback_call(obj, SIG_IOERR, NULL);
2549 _elm_win_cb_hide(void *data __UNUSED__,
2551 Evas_Object *obj __UNUSED__,
2552 void *event_info __UNUSED__)
2554 _elm_win_state_eval_queue();
2558 _elm_win_cb_show(void *data __UNUSED__,
2560 Evas_Object *obj __UNUSED__,
2561 void *event_info __UNUSED__)
2563 _elm_win_state_eval_queue();
2567 elm_win_add(Evas_Object *parent,
2574 const char *fontpath, *fallback = NULL;
2576 Elm_Win_Smart_Data tmp_sd;
2578 /* just to store some data while trying out to create a canvas */
2579 memset(&tmp_sd, 0, sizeof(Elm_Win_Smart_Data));
2581 #define FALLBACK_TRY(engine) \
2583 CRITICAL(engine " engine creation failed. Trying default."); \
2584 tmp_sd.ee = ecore_evas_new(NULL, 0, 0, 1, 1, NULL); \
2586 elm_config_preferred_engine_set(ecore_evas_engine_name_get(tmp_sd.ee)); \
2588 #define FALLBACK_STORE(engine) \
2591 CRITICAL(engine "Fallback to %s successful.", engine); \
2592 fallback = engine; \
2597 case ELM_WIN_INLINED_IMAGE:
2600 e = evas_object_evas_get(parent);
2605 ee = ecore_evas_ecore_evas_get(e);
2608 tmp_sd.img_obj = ecore_evas_object_image_new(ee);
2609 if (!tmp_sd.img_obj) break;
2611 tmp_sd.ee = ecore_evas_object_ecore_evas_get(tmp_sd.img_obj);
2614 evas_object_del(tmp_sd.img_obj);
2615 tmp_sd.img_obj = NULL;
2620 case ELM_WIN_SOCKET_IMAGE:
2621 tmp_sd.ee = ecore_evas_extn_socket_new(1, 1);
2625 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
2627 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2628 FALLBACK_TRY("Software X11");
2631 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2632 FALLBACK_STORE("Software FB");
2635 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2637 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2638 FALLBACK_TRY("Software FB");
2641 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2642 FALLBACK_STORE("Software X11");
2645 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
2647 tmp_sd.ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
2648 FALLBACK_TRY("Software DirectFB");
2651 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2652 FALLBACK_STORE("Software X11");
2655 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2656 FALLBACK_STORE("Software FB");
2660 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
2662 tmp_sd.ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
2663 FALLBACK_TRY("Software-16");
2666 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2667 FALLBACK_STORE("Software X11");
2670 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2671 FALLBACK_STORE("Software FB");
2675 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
2677 tmp_sd.ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
2678 FALLBACK_TRY("Software-8");
2681 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2682 FALLBACK_STORE("Software X11");
2685 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2686 FALLBACK_STORE("Software FB");
2690 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
2695 if (_elm_config->vsync)
2697 opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
2704 tmp_sd.ee = ecore_evas_gl_x11_options_new
2705 (NULL, 0, 0, 0, 1, 1, opt);
2707 tmp_sd.ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
2708 FALLBACK_TRY("OpenGL");
2711 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2712 FALLBACK_STORE("Software X11");
2715 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2716 FALLBACK_STORE("Software FB");
2720 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
2722 tmp_sd.ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
2723 FALLBACK_TRY("Software Win32");
2725 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
2727 tmp_sd.ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
2728 FALLBACK_TRY("Software-16-WinCE");
2730 else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
2732 tmp_sd.ee = ecore_evas_psl1ght_new(NULL, 1, 1);
2733 FALLBACK_TRY("PSL1GHT");
2735 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
2737 tmp_sd.ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
2738 FALLBACK_TRY("Software SDL");
2741 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2742 FALLBACK_STORE("Software X11");
2745 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2746 FALLBACK_STORE("Software FB");
2750 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
2752 tmp_sd.ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
2753 FALLBACK_TRY("Software-16-SDL");
2756 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2757 FALLBACK_STORE("Software X11");
2760 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2761 FALLBACK_STORE("Software FB");
2765 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
2767 tmp_sd.ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
2768 FALLBACK_TRY("OpenGL SDL");
2771 tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2772 FALLBACK_STORE("Software X11");
2775 tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2776 FALLBACK_STORE("Software FB");
2780 else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
2782 tmp_sd.ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
2783 FALLBACK_TRY("OpenGL Cocoa");
2785 else if (ENGINE_COMPARE(ELM_BUFFER))
2787 tmp_sd.ee = ecore_evas_buffer_new(1, 1);
2789 else if (ENGINE_COMPARE(ELM_EWS))
2791 tmp_sd.ee = ecore_evas_ews_new(0, 0, 1, 1);
2793 else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
2795 tmp_sd.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
2797 else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
2799 tmp_sd.ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
2801 else if (!strncmp(ENGINE_GET(), "shot:", 5))
2803 tmp_sd.ee = ecore_evas_buffer_new(1, 1);
2804 ecore_evas_manual_render_set(tmp_sd.ee, EINA_TRUE);
2805 tmp_sd.shot.info = eina_stringshare_add
2814 ERR("Cannot create window.");
2818 obj = evas_object_smart_add
2819 (ecore_evas_get(tmp_sd.ee), _elm_win_smart_class_new());
2821 ELM_WIN_DATA_GET(obj, sd);
2823 /* copying possibly altered fields back */
2824 #define SD_CPY(_field) \
2827 sd->_field = tmp_sd._field; \
2835 if ((trap) && (trap->add))
2836 sd->trap_data = trap->add(obj);
2838 /* complementary actions, which depend on final smart data
2840 if (type == ELM_WIN_INLINED_IMAGE)
2841 _win_inlined_image_set(sd);
2843 #ifdef HAVE_ELEMENTARY_X
2844 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
2845 ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
2846 ENGINE_COMPARE(ELM_SOFTWARE_8_X11) ||
2847 ENGINE_COMPARE(ELM_OPENGL_X11))
2849 sd->x.client_message_handler = ecore_event_handler_add
2850 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, sd);
2851 sd->x.property_handler = ecore_event_handler_add
2852 (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, sd);
2856 else if (!strncmp(ENGINE_GET(), "shot:", 5))
2859 sd->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
2860 sd->indmode = ELM_WIN_INDICATOR_UNKNOWN;
2862 #ifdef HAVE_ELEMENTARY_X
2863 _elm_win_xwindow_get(sd);
2866 ecore_x_io_error_handler_set(_elm_x_io_err, NULL);
2870 #ifdef HAVE_ELEMENTARY_WAYLAND
2871 sd->wl.win = ecore_evas_wayland_window_get(sd->ee);
2874 if ((_elm_config->bgpixmap)
2875 #ifdef HAVE_ELEMENTARY_X
2877 (((sd->x.xwin) && (!ecore_x_screen_is_composited(0))) ||
2881 TRAP(sd, avoid_damage_set, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
2882 // bg pixmap done by x - has other issues like can be redrawn by x before it
2883 // is filled/ready by app
2884 // TRAP(sd, avoid_damage_set, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
2887 sd->parent = parent;
2890 evas_object_event_callback_add
2891 (sd->parent, EVAS_CALLBACK_DEL, _elm_win_on_parent_del, sd);
2893 sd->evas = ecore_evas_get(sd->ee);
2895 evas_object_color_set(obj, 0, 0, 0, 0);
2896 evas_object_move(obj, 0, 0);
2897 evas_object_resize(obj, 1, 1);
2898 evas_object_layer_set(obj, 50);
2899 evas_object_pass_events_set(obj, EINA_TRUE);
2901 if (type == ELM_WIN_INLINED_IMAGE)
2902 elm_widget_parent2_set(obj, parent);
2904 /* use own version of ecore_evas_object_associate() that does TRAP() */
2905 ecore_evas_data_set(sd->ee, "elm_win", sd);
2907 evas_object_event_callback_add
2908 (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2909 _elm_win_obj_callback_changed_size_hints, sd);
2911 evas_object_intercept_raise_callback_add
2912 (obj, _elm_win_obj_intercept_raise, sd);
2913 evas_object_intercept_lower_callback_add
2914 (obj, _elm_win_obj_intercept_lower, sd);
2915 evas_object_intercept_stack_above_callback_add
2916 (obj, _elm_win_obj_intercept_stack_above, sd);
2917 evas_object_intercept_stack_below_callback_add
2918 (obj, _elm_win_obj_intercept_stack_below, sd);
2919 evas_object_intercept_layer_set_callback_add
2920 (obj, _elm_win_obj_intercept_layer_set, sd);
2921 evas_object_intercept_show_callback_add
2922 (obj, _elm_win_obj_intercept_show, sd);
2923 evas_object_intercept_move_callback_add
2924 (obj, _ecore_evas_move_, sd);
2926 TRAP(sd, name_class_set, name, _elm_appname);
2927 ecore_evas_callback_delete_request_set(sd->ee, _elm_win_delete_request);
2928 ecore_evas_callback_resize_set(sd->ee, _elm_win_resize);
2929 ecore_evas_callback_mouse_in_set(sd->ee, _elm_win_mouse_in);
2930 ecore_evas_callback_focus_in_set(sd->ee, _elm_win_focus_in);
2931 ecore_evas_callback_focus_out_set(sd->ee, _elm_win_focus_out);
2932 ecore_evas_callback_move_set(sd->ee, _elm_win_move);
2933 ecore_evas_callback_state_change_set(sd->ee, _elm_win_state_change);
2934 evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_win_cb_hide, sd);
2935 evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _elm_win_cb_show, sd);
2937 evas_image_cache_set(sd->evas, (_elm_config->image_cache * 1024));
2938 evas_font_cache_set(sd->evas, (_elm_config->font_cache * 1024));
2940 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
2941 evas_font_path_append(sd->evas, fontpath);
2943 if (!_elm_config->font_hinting)
2944 evas_font_hinting_set(sd->evas, EVAS_FONT_HINTING_NONE);
2945 else if (_elm_config->font_hinting == 1)
2946 evas_font_hinting_set(sd->evas, EVAS_FONT_HINTING_AUTO);
2947 else if (_elm_config->font_hinting == 2)
2948 evas_font_hinting_set(sd->evas, EVAS_FONT_HINTING_BYTECODE);
2950 #ifdef HAVE_ELEMENTARY_X
2951 _elm_win_xwin_type_set(sd);
2952 _elm_win_xwin_update(sd);
2955 _elm_win_list = eina_list_append(_elm_win_list, obj);
2958 if (((fallback) && (!strcmp(fallback, "Software FB"))) ||
2959 ((!fallback) && (ENGINE_COMPARE(ELM_SOFTWARE_FB))))
2961 TRAP(sd, fullscreen_set, 1);
2963 else if ((type != ELM_WIN_INLINED_IMAGE) &&
2964 (ENGINE_COMPARE(ELM_WAYLAND_SHM) ||
2965 ENGINE_COMPARE(ELM_WAYLAND_EGL)))
2966 _elm_win_frame_add(sd, "default");
2968 if (_elm_config->focus_highlight_enable)
2969 elm_win_focus_highlight_enabled_set(obj, EINA_TRUE);
2972 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(sd->evas, "Control");
2973 evas_object_event_callback_add
2974 (obj, EVAS_CALLBACK_KEY_DOWN, _debug_key_down, sd);
2976 if (evas_object_key_grab(obj, "F12", mask, 0, EINA_TRUE))
2977 INF("Ctrl+F12 key combination exclusive for dot tree generation\n");
2979 ERR("failed to grab F12 key to elm widgets (dot) tree generation");
2982 if ((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_ON) ||
2983 ((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_AUTO) &&
2984 (((fallback) && (!strcmp(fallback, "Software FB"))) ||
2985 ((!fallback) && (ENGINE_COMPARE(ELM_SOFTWARE_FB))))))
2988 Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0;
2990 sd->pointer.obj = o = edje_object_add(ecore_evas_get(tmp_sd.ee));
2991 _elm_theme_object_set(obj, o, "pointer", "base", "default");
2992 edje_object_size_min_calc(o, &mw, &mh);
2993 evas_object_resize(o, mw, mh);
2994 edje_object_part_geometry_get(o, "elm.swallow.hotspot",
2995 &hx, &hy, NULL, NULL);
2996 sd->pointer.hot_x = hx;
2997 sd->pointer.hot_y = hy;
2998 evas_object_show(o);
2999 ecore_evas_object_cursor_set(tmp_sd.ee, o, EVAS_LAYER_MAX, hx, hy);
3001 else if (_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_OFF)
3006 sd->wm_rot.wm_supported = ecore_evas_wm_rotation_supported_get(sd->ee);
3007 sd->wm_rot.preferred_rot = -1; // it means that elm_win doesn't use preferred rotation.
3013 elm_win_util_standard_add(const char *name,
3016 Evas_Object *win, *bg;
3018 win = elm_win_add(NULL, name, ELM_WIN_BASIC);
3019 if (!win) return NULL;
3021 elm_win_title_set(win, title);
3022 bg = elm_bg_add(win);
3025 evas_object_del(win);
3028 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3029 elm_win_resize_object_add(win, bg);
3030 evas_object_show(bg);
3036 elm_win_resize_object_add(Evas_Object *obj,
3037 Evas_Object *subobj)
3042 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3044 if (eina_list_data_find(sd->resize_objs, subobj)) return;
3046 if (!ELM_WIDGET_DATA(sd)->api->sub_object_add(obj, subobj))
3047 ERR("could not add %p as sub object of %p", subobj, obj);
3049 sd->resize_objs = eina_list_append(sd->resize_objs, subobj);
3051 evas_object_event_callback_add
3052 (subobj, EVAS_CALLBACK_DEL, _elm_win_on_resize_obj_del, obj);
3053 evas_object_event_callback_add
3054 (subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3055 _elm_win_on_resize_obj_changed_size_hints, obj);
3057 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
3058 evas_object_move(subobj, 0, 0);
3059 evas_object_resize(subobj, w, h);
3061 _elm_win_resize_objects_eval(obj);
3065 elm_win_resize_object_del(Evas_Object *obj,
3066 Evas_Object *subobj)
3069 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3071 if (!ELM_WIDGET_DATA(sd)->api->sub_object_del(obj, subobj))
3072 ERR("could not remove sub object %p from %p", subobj, obj);
3074 sd->resize_objs = eina_list_remove(sd->resize_objs, subobj);
3076 evas_object_event_callback_del_full
3077 (subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3078 _elm_win_on_resize_obj_changed_size_hints, obj);
3079 evas_object_event_callback_del_full
3080 (subobj, EVAS_CALLBACK_DEL, _elm_win_on_resize_obj_del, obj);
3082 _elm_win_resize_objects_eval(obj);
3086 elm_win_title_set(Evas_Object *obj,
3090 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3093 eina_stringshare_replace(&(sd->title), title);
3094 TRAP(sd, title_set, sd->title);
3096 edje_object_part_text_escaped_set
3097 (sd->frame_obj, "elm.text.title", sd->title);
3101 elm_win_title_get(const Evas_Object *obj)
3103 ELM_WIN_CHECK(obj) NULL;
3104 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3110 elm_win_icon_name_set(Evas_Object *obj,
3111 const char *icon_name)
3114 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3116 if (!icon_name) return;
3117 eina_stringshare_replace(&(sd->icon_name), icon_name);
3118 #ifdef HAVE_ELEMENTARY_X
3119 _elm_win_xwin_update(sd);
3124 elm_win_icon_name_get(const Evas_Object *obj)
3126 ELM_WIN_CHECK(obj) NULL;
3127 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3129 return sd->icon_name;
3133 elm_win_role_set(Evas_Object *obj, const char *role)
3136 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3139 eina_stringshare_replace(&(sd->role), role);
3140 #ifdef HAVE_ELEMENTARY_X
3141 _elm_win_xwin_update(sd);
3146 elm_win_role_get(const Evas_Object *obj)
3148 ELM_WIN_CHECK(obj) NULL;
3149 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3155 elm_win_icon_object_set(Evas_Object *obj,
3159 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3162 evas_object_event_callback_del_full
3163 (sd->icon, EVAS_CALLBACK_DEL, _elm_win_on_icon_del, sd);
3166 evas_object_event_callback_add
3167 (sd->icon, EVAS_CALLBACK_DEL, _elm_win_on_icon_del, sd);
3168 #ifdef HAVE_ELEMENTARY_X
3169 _elm_win_xwin_update(sd);
3173 EAPI const Evas_Object *
3174 elm_win_icon_object_get(const Evas_Object *obj)
3176 ELM_WIN_CHECK(obj) NULL;
3177 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3183 elm_win_autodel_set(Evas_Object *obj,
3187 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3189 sd->autodel = autodel;
3193 elm_win_autodel_get(const Evas_Object *obj)
3195 ELM_WIN_CHECK(obj) EINA_FALSE;
3196 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3202 elm_win_activate(Evas_Object *obj)
3205 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3211 elm_win_lower(Evas_Object *obj)
3214 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3220 elm_win_raise(Evas_Object *obj)
3223 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3229 elm_win_center(Evas_Object *obj,
3233 int win_w, win_h, screen_w, screen_h, nx, ny;
3236 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3238 if ((trap) && (trap->center) && (!trap->center(sd->trap_data, obj)))
3241 ecore_evas_screen_geometry_get(sd->ee, NULL, NULL, &screen_w, &screen_h);
3242 if ((!screen_w) || (!screen_h)) return;
3244 evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
3245 if ((!win_w) || (!win_h)) return;
3247 if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
3248 else nx = sd->screen.x;
3249 if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
3250 else ny = sd->screen.y;
3254 evas_object_move(obj, nx, ny);
3258 elm_win_borderless_set(Evas_Object *obj,
3259 Eina_Bool borderless)
3262 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3264 TRAP(sd, borderless_set, borderless);
3265 #ifdef HAVE_ELEMENTARY_X
3266 _elm_win_xwin_update(sd);
3271 elm_win_borderless_get(const Evas_Object *obj)
3273 ELM_WIN_CHECK(obj) EINA_FALSE;
3274 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3276 return ecore_evas_borderless_get(sd->ee);
3280 elm_win_shaped_set(Evas_Object *obj,
3284 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3286 TRAP(sd, shaped_set, shaped);
3287 #ifdef HAVE_ELEMENTARY_X
3288 _elm_win_xwin_update(sd);
3293 elm_win_shaped_get(const Evas_Object *obj)
3295 ELM_WIN_CHECK(obj) EINA_FALSE;
3296 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3298 return ecore_evas_shaped_get(sd->ee);
3302 elm_win_alpha_set(Evas_Object *obj,
3306 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3310 evas_object_image_alpha_set(sd->img_obj, alpha);
3311 ecore_evas_alpha_set(sd->ee, alpha);
3315 #ifdef HAVE_ELEMENTARY_X
3320 if (!ecore_x_screen_is_composited(0))
3321 elm_win_shaped_set(obj, alpha);
3323 TRAP(sd, alpha_set, alpha);
3326 TRAP(sd, alpha_set, alpha);
3327 _elm_win_xwin_type_set(sd);
3328 _elm_win_xwin_update(sd);
3332 TRAP(sd, alpha_set, alpha);
3337 elm_win_alpha_get(const Evas_Object *obj)
3339 ELM_WIN_CHECK(obj) EINA_FALSE;
3340 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3344 return evas_object_image_alpha_get(sd->img_obj);
3347 return ecore_evas_alpha_get(sd->ee);
3351 elm_win_override_set(Evas_Object *obj,
3355 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3357 TRAP(sd, override_set, override);
3358 #ifdef HAVE_ELEMENTARY_X
3359 _elm_win_xwin_update(sd);
3364 elm_win_override_get(const Evas_Object *obj)
3366 ELM_WIN_CHECK(obj) EINA_FALSE;
3367 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3369 return ecore_evas_override_get(sd->ee);
3373 elm_win_fullscreen_set(Evas_Object *obj,
3374 Eina_Bool fullscreen)
3377 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3378 // YYY: handle if sd->img_obj
3379 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
3380 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
3382 // these engines... can ONLY be fullscreen
3387 // sd->fullscreen = fullscreen;
3391 if (ENGINE_COMPARE(ELM_WAYLAND_SHM) ||
3392 ENGINE_COMPARE(ELM_WAYLAND_EGL))
3393 _elm_win_frame_del(sd);
3397 if (ENGINE_COMPARE(ELM_WAYLAND_SHM) ||
3398 ENGINE_COMPARE(ELM_WAYLAND_EGL))
3399 _elm_win_frame_add(sd, "default");
3401 evas_object_show(sd->frame_obj);
3404 TRAP(sd, fullscreen_set, fullscreen);
3405 #ifdef HAVE_ELEMENTARY_X
3406 _elm_win_xwin_update(sd);
3412 elm_win_fullscreen_get(const Evas_Object *obj)
3414 ELM_WIN_CHECK(obj) EINA_FALSE;
3415 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3417 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
3418 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
3420 // these engines... can ONLY be fullscreen
3425 return sd->fullscreen;
3430 elm_win_maximized_set(Evas_Object *obj,
3431 Eina_Bool maximized)
3434 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3436 // sd->maximized = maximized;
3437 // YYY: handle if sd->img_obj
3438 TRAP(sd, maximized_set, maximized);
3439 #ifdef HAVE_ELEMENTARY_X
3440 _elm_win_xwin_update(sd);
3445 elm_win_maximized_get(const Evas_Object *obj)
3447 ELM_WIN_CHECK(obj) EINA_FALSE;
3448 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3450 return sd->maximized;
3454 elm_win_iconified_set(Evas_Object *obj,
3455 Eina_Bool iconified)
3458 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3460 // sd->iconified = iconified;
3461 TRAP(sd, iconified_set, iconified);
3462 #ifdef HAVE_ELEMENTARY_X
3463 _elm_win_xwin_update(sd);
3468 elm_win_iconified_get(const Evas_Object *obj)
3470 ELM_WIN_CHECK(obj) EINA_FALSE;
3471 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3473 return sd->iconified;
3477 elm_win_withdrawn_set(Evas_Object *obj,
3478 Eina_Bool withdrawn)
3481 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3483 // sd->withdrawn = withdrawn;
3484 TRAP(sd, withdrawn_set, withdrawn);
3485 #ifdef HAVE_ELEMENTARY_X
3486 _elm_win_xwin_update(sd);
3491 elm_win_withdrawn_get(const Evas_Object *obj)
3493 ELM_WIN_CHECK(obj) EINA_FALSE;
3494 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3496 return sd->withdrawn;
3500 elm_win_profiles_set(Evas_Object *obj,
3501 const char **profiles,
3502 unsigned int num_profiles)
3504 char **profiles_int;
3506 unsigned int i, num;
3510 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3512 if (!profiles) return;
3514 if (sd->profile.timer) ecore_timer_del(sd->profile.timer);
3515 sd->profile.timer = ecore_timer_add(0.1, _elm_win_profile_change_delay, sd);
3516 EINA_LIST_FREE(sd->profile.names, str) eina_stringshare_del(str);
3518 for (i = 0; i < num_profiles; i++)
3520 if ((profiles[i]) &&
3521 _elm_config_profile_exists(profiles[i]))
3523 str = eina_stringshare_add(profiles[i]);
3524 sd->profile.names = eina_list_append(sd->profile.names, str);
3528 num = eina_list_count(sd->profile.names);
3529 profiles_int = alloca(num * sizeof(char *));
3534 EINA_LIST_FOREACH(sd->profile.names, l, str)
3537 profiles_int[i] = strdup(str);
3539 profiles_int[i] = NULL;
3542 ecore_evas_profiles_set(sd->ee, (const char **)profiles_int, i);
3543 for (i = 0; i < num; i++)
3545 if (profiles_int[i]) free(profiles_int[i]);
3549 ecore_evas_profiles_set(sd->ee, profiles, num_profiles);
3553 elm_win_profile_get(const Evas_Object *obj)
3555 ELM_WIN_CHECK(obj) NULL;
3556 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
3558 return sd->profile.name;
3562 elm_win_urgent_set(Evas_Object *obj,
3566 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3568 sd->urgent = urgent;
3569 TRAP(sd, urgent_set, urgent);
3570 #ifdef HAVE_ELEMENTARY_X
3571 _elm_win_xwin_update(sd);
3576 elm_win_urgent_get(const Evas_Object *obj)
3578 ELM_WIN_CHECK(obj) EINA_FALSE;
3579 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3585 elm_win_demand_attention_set(Evas_Object *obj,
3586 Eina_Bool demand_attention)
3589 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3591 sd->demand_attention = demand_attention;
3592 TRAP(sd, demand_attention_set, demand_attention);
3593 #ifdef HAVE_ELEMENTARY_X
3594 _elm_win_xwin_update(sd);
3599 elm_win_demand_attention_get(const Evas_Object *obj)
3601 ELM_WIN_CHECK(obj) EINA_FALSE;
3602 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3604 return sd->demand_attention;
3608 elm_win_modal_set(Evas_Object *obj,
3612 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3615 TRAP(sd, modal_set, modal);
3616 #ifdef HAVE_ELEMENTARY_X
3617 _elm_win_xwin_update(sd);
3622 elm_win_modal_get(const Evas_Object *obj)
3624 ELM_WIN_CHECK(obj) EINA_FALSE;
3625 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3631 elm_win_aspect_set(Evas_Object *obj,
3635 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3637 sd->aspect = aspect;
3638 TRAP(sd, aspect_set, aspect);
3639 #ifdef HAVE_ELEMENTARY_X
3640 _elm_win_xwin_update(sd);
3645 elm_win_aspect_get(const Evas_Object *obj)
3647 ELM_WIN_CHECK(obj) 0.0;
3648 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, 0.0);
3654 elm_win_size_base_set(Evas_Object *obj, int w, int h)
3657 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3658 sd->size_base_w = w;
3659 sd->size_base_h = h;
3660 TRAP(sd, size_base_set, w, h);
3661 #ifdef HAVE_ELEMENTARY_X
3662 _elm_win_xwin_update(sd);
3667 elm_win_size_base_get(Evas_Object *obj, int *w, int *h)
3670 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3671 if (w) *w = sd->size_base_w;
3672 if (w) *h = sd->size_base_h;
3676 elm_win_size_step_set(Evas_Object *obj, int w, int h)
3679 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3680 sd->size_step_w = w;
3681 sd->size_step_h = h;
3682 TRAP(sd, size_step_set, w, h);
3683 #ifdef HAVE_ELEMENTARY_X
3684 _elm_win_xwin_update(sd);
3689 elm_win_size_step_get(Evas_Object *obj, int *w, int *h)
3692 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3693 if (w) *w = sd->size_step_w;
3694 if (w) *h = sd->size_step_h;
3698 elm_win_layer_set(Evas_Object *obj,
3702 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3704 TRAP(sd, layer_set, layer);
3705 #ifdef HAVE_ELEMENTARY_X
3706 _elm_win_xwin_update(sd);
3711 elm_win_layer_get(const Evas_Object *obj)
3713 ELM_WIN_CHECK(obj) - 1;
3714 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
3716 return ecore_evas_layer_get(sd->ee);
3720 elm_win_norender_push(Evas_Object *obj)
3723 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3726 if (sd->norender == 1) ecore_evas_manual_render_set(sd->ee, EINA_TRUE);
3730 elm_win_norender_pop(Evas_Object *obj)
3733 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3735 if (sd->norender <= 0) return;
3737 if (sd->norender == 0) ecore_evas_manual_render_set(sd->ee, EINA_FALSE);
3741 elm_win_norender_get(Evas_Object *obj)
3743 ELM_WIN_CHECK(obj) - 1;
3744 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
3745 return sd->norender;
3749 elm_win_render(Evas_Object *obj)
3752 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3753 ecore_evas_manual_render(sd->ee);
3757 _win_rotation_degree_check(int rotation)
3759 if ((rotation > 360) || (rotation < 0))
3761 WRN("Rotation degree should be 0 ~ 360 (passed degree: %d)", rotation);
3763 if (rotation < 0) rotation += 360;
3769 _win_rotate(Evas_Object *obj, Elm_Win_Smart_Data *sd, int rotation, Eina_Bool resize)
3771 rotation = _win_rotation_degree_check(rotation);
3772 if (sd->rot == rotation) return;
3774 if (resize) TRAP(sd, rotation_with_resize_set, rotation);
3775 else TRAP(sd, rotation_set, rotation);
3776 evas_object_size_hint_min_set(obj, -1, -1);
3777 evas_object_size_hint_max_set(obj, -1, -1);
3778 _elm_win_resize_objects_eval(obj);
3779 #ifdef HAVE_ELEMENTARY_X
3780 _elm_win_xwin_update(sd);
3782 elm_widget_orientation_set(obj, rotation);
3783 evas_object_smart_callback_call(obj, SIG_ROTATION_CHANGED, NULL);
3787 elm_win_rotation_set(Evas_Object *obj,
3791 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3792 _win_rotate(obj, sd, rotation, EINA_FALSE);
3796 elm_win_rotation_with_resize_set(Evas_Object *obj,
3800 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3801 _win_rotate(obj, sd, rotation, EINA_TRUE);
3805 elm_win_rotation_get(const Evas_Object *obj)
3807 ELM_WIN_CHECK(obj) - 1;
3808 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
3814 elm_win_wm_rotation_supported_get(const Evas_Object *obj)
3816 ELM_WIN_CHECK(obj) EINA_FALSE;
3817 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3818 return sd->wm_rot.wm_supported;
3821 /* This will unset a preferred rotation, if given preferred rotation is '-1'.
3824 elm_win_wm_rotation_preferred_rotation_set(Evas_Object *obj,
3830 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3832 if (!sd->wm_rot.use)
3833 sd->wm_rot.use = EINA_TRUE;
3835 // '-1' means that elm_win doesn't use preferred rotation.
3839 rot = _win_rotation_degree_check(rotation);
3841 if (sd->wm_rot.preferred_rot == rot) return;
3842 sd->wm_rot.preferred_rot = rot;
3844 ecore_evas_wm_rotation_preferred_rotation_set(sd->ee, rot);
3848 elm_win_wm_rotation_preferred_rotation_get(const Evas_Object *obj)
3850 ELM_WIN_CHECK(obj) -1;
3851 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
3852 if (!sd->wm_rot.use) return -1;
3853 return sd->wm_rot.preferred_rot;
3857 elm_win_wm_rotation_available_rotations_set(Evas_Object *obj,
3858 const int *rotations,
3865 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3867 if (!sd->wm_rot.use)
3868 sd->wm_rot.use = EINA_TRUE;
3870 if (sd->wm_rot.rots) free(sd->wm_rot.rots);
3872 sd->wm_rot.rots = NULL;
3873 sd->wm_rot.count = 0;
3877 sd->wm_rot.rots = calloc(count, sizeof(int));
3878 if (!sd->wm_rot.rots) return;
3879 for (i = 0; i < count; i++)
3881 r = _win_rotation_degree_check(rotations[i]);
3882 sd->wm_rot.rots[i] = r;
3886 sd->wm_rot.count = count;
3888 ecore_evas_wm_rotation_available_rotations_set(sd->ee,
3894 elm_win_wm_rotation_available_rotations_get(const Evas_Object *obj,
3896 unsigned int *count)
3898 ELM_WIN_CHECK(obj) EINA_FALSE;
3899 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3900 if (!sd->wm_rot.use) return EINA_FALSE;
3902 if (sd->wm_rot.count > 0)
3904 if ((rotations) && (*rotations))
3906 *rotations = calloc(sd->wm_rot.count, sizeof(int));
3911 sizeof(int) * sd->wm_rot.count);
3916 if (count) *count = sd->wm_rot.count;
3922 elm_win_sticky_set(Evas_Object *obj,
3926 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3928 // sd->sticky = sticky;
3929 TRAP(sd, sticky_set, sticky);
3930 #ifdef HAVE_ELEMENTARY_X
3931 _elm_win_xwin_update(sd);
3936 elm_win_sticky_get(const Evas_Object *obj)
3938 ELM_WIN_CHECK(obj) EINA_FALSE;
3939 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3945 elm_win_keyboard_mode_set(Evas_Object *obj,
3946 Elm_Win_Keyboard_Mode mode)
3949 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3951 if (mode == sd->kbdmode) return;
3952 #ifdef HAVE_ELEMENTARY_X
3953 _elm_win_xwindow_get(sd);
3956 #ifdef HAVE_ELEMENTARY_X
3958 ecore_x_e_virtual_keyboard_state_set
3959 (sd->x.xwin, (Ecore_X_Virtual_Keyboard_State)sd->kbdmode);
3963 EAPI Elm_Win_Keyboard_Mode
3964 elm_win_keyboard_mode_get(const Evas_Object *obj)
3966 ELM_WIN_CHECK(obj) ELM_WIN_KEYBOARD_UNKNOWN;
3967 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, ELM_WIN_KEYBOARD_UNKNOWN);
3973 elm_win_keyboard_win_set(Evas_Object *obj,
3974 Eina_Bool is_keyboard)
3977 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
3979 #ifdef HAVE_ELEMENTARY_X
3980 _elm_win_xwindow_get(sd);
3982 ecore_x_e_virtual_keyboard_set(sd->x.xwin, is_keyboard);
3989 elm_win_keyboard_win_get(const Evas_Object *obj)
3991 ELM_WIN_CHECK(obj) EINA_FALSE;
3992 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
3994 #ifdef HAVE_ELEMENTARY_X
3995 _elm_win_xwindow_get(sd);
3997 return ecore_x_e_virtual_keyboard_get(sd->x.xwin);
4003 elm_win_indicator_mode_set(Evas_Object *obj,
4004 Elm_Win_Indicator_Mode mode)
4007 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4009 if (mode == sd->indmode) return;
4010 #ifdef HAVE_ELEMENTARY_X
4011 _elm_win_xwindow_get(sd);
4014 #ifdef HAVE_ELEMENTARY_X
4017 if (sd->indmode == ELM_WIN_INDICATOR_SHOW)
4018 ecore_x_e_illume_indicator_state_set
4019 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
4020 else if (sd->indmode == ELM_WIN_INDICATOR_HIDE)
4021 ecore_x_e_illume_indicator_state_set
4022 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
4025 evas_object_smart_callback_call(obj, SIG_INDICATOR_PROP_CHANGED, NULL);
4028 EAPI Elm_Win_Indicator_Mode
4029 elm_win_indicator_mode_get(const Evas_Object *obj)
4031 ELM_WIN_CHECK(obj) ELM_WIN_INDICATOR_UNKNOWN;
4032 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, ELM_WIN_INDICATOR_UNKNOWN);
4038 elm_win_indicator_opacity_set(Evas_Object *obj,
4039 Elm_Win_Indicator_Opacity_Mode mode)
4042 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4044 if (mode == sd->ind_o_mode) return;
4045 sd->ind_o_mode = mode;
4046 #ifdef HAVE_ELEMENTARY_X
4047 _elm_win_xwindow_get(sd);
4050 if (sd->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
4051 ecore_x_e_illume_indicator_opacity_set
4052 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
4053 else if (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
4054 ecore_x_e_illume_indicator_opacity_set
4055 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
4056 else if (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
4057 ecore_x_e_illume_indicator_opacity_set
4058 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
4061 evas_object_smart_callback_call(obj, SIG_INDICATOR_PROP_CHANGED, NULL);
4064 EAPI Elm_Win_Indicator_Opacity_Mode
4065 elm_win_indicator_opacity_get(const Evas_Object *obj)
4067 ELM_WIN_CHECK(obj) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
4068 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, ELM_WIN_INDICATOR_OPACITY_UNKNOWN);
4070 return sd->ind_o_mode;
4074 elm_win_indicator_type_set(Evas_Object *obj,
4075 Elm_Win_Indicator_Type_Mode mode)
4078 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4080 if (mode == sd->ind_t_mode) return;
4081 sd->ind_t_mode = mode;
4082 #ifdef HAVE_ELEMENTARY_X
4083 _elm_win_xwindow_get(sd);
4086 if (sd->ind_t_mode == ELM_WIN_INDICATOR_TYPE_1)
4087 ecore_x_e_illume_indicator_type_set
4088 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TYPE_1);
4089 else if (sd->ind_t_mode == ELM_WIN_INDICATOR_TYPE_2)
4090 ecore_x_e_illume_indicator_type_set
4091 (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TYPE_2);
4094 //evas_object_smart_callback_call(obj, SIG_INDICATOR_PROP_CHANGED, NULL);
4097 EAPI Elm_Win_Indicator_Type_Mode
4098 elm_win_indicator_type_get(const Evas_Object *obj)
4100 ELM_WIN_CHECK(obj) ELM_WIN_INDICATOR_TYPE_UNKNOWN;
4101 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, ELM_WIN_INDICATOR_TYPE_UNKNOWN);
4103 return sd->ind_t_mode;
4106 elm_win_screen_position_get(const Evas_Object *obj,
4111 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4113 if (x) *x = sd->screen.x;
4114 if (y) *y = sd->screen.y;
4118 elm_win_focus_get(const Evas_Object *obj)
4120 ELM_WIN_CHECK(obj) EINA_FALSE;
4121 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4123 return ecore_evas_focus_get(sd->ee);
4127 elm_win_screen_constrain_set(Evas_Object *obj,
4128 Eina_Bool constrain)
4131 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4133 sd->constrain = !!constrain;
4137 elm_win_screen_constrain_get(Evas_Object *obj)
4139 ELM_WIN_CHECK(obj) EINA_FALSE;
4140 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4142 return sd->constrain;
4146 elm_win_screen_size_get(const Evas_Object *obj,
4153 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4155 ecore_evas_screen_geometry_get(sd->ee, x, y, w, h);
4159 elm_win_screen_dpi_get(const Evas_Object *obj,
4164 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4166 ecore_evas_screen_dpi_get(sd->ee, xdpi, ydpi);
4170 elm_win_conformant_set(Evas_Object *obj,
4171 Eina_Bool conformant)
4174 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4176 #ifdef HAVE_ELEMENTARY_X
4177 _elm_win_xwindow_get(sd);
4179 ecore_x_e_illume_conformant_set(sd->x.xwin, conformant);
4186 elm_win_conformant_get(const Evas_Object *obj)
4188 ELM_WIN_CHECK(obj) EINA_FALSE;
4189 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4191 #ifdef HAVE_ELEMENTARY_X
4192 _elm_win_xwindow_get(sd);
4194 return ecore_x_e_illume_conformant_get(sd->x.xwin);
4200 elm_win_quickpanel_set(Evas_Object *obj,
4201 Eina_Bool quickpanel)
4204 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4205 #ifdef HAVE_ELEMENTARY_X
4206 _elm_win_xwindow_get(sd);
4209 ecore_x_e_illume_quickpanel_set(sd->x.xwin, quickpanel);
4212 Ecore_X_Window_State states[2];
4214 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
4215 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
4216 ecore_x_netwm_window_state_set(sd->x.xwin, states, 2);
4217 ecore_x_icccm_hints_set(sd->x.xwin, 0, 0, 0, 0, 0, 0, 0);
4226 elm_win_quickpanel_get(const Evas_Object *obj)
4228 ELM_WIN_CHECK(obj) EINA_FALSE;
4229 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4231 #ifdef HAVE_ELEMENTARY_X
4232 _elm_win_xwindow_get(sd);
4234 return ecore_x_e_illume_quickpanel_get(sd->x.xwin);
4240 elm_win_quickpanel_priority_major_set(Evas_Object *obj,
4244 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4246 #ifdef HAVE_ELEMENTARY_X
4247 _elm_win_xwindow_get(sd);
4249 ecore_x_e_illume_quickpanel_priority_major_set(sd->x.xwin, priority);
4256 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
4258 ELM_WIN_CHECK(obj) - 1;
4259 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
4261 #ifdef HAVE_ELEMENTARY_X
4262 _elm_win_xwindow_get(sd);
4264 return ecore_x_e_illume_quickpanel_priority_major_get(sd->x.xwin);
4270 elm_win_quickpanel_priority_minor_set(Evas_Object *obj,
4274 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4276 #ifdef HAVE_ELEMENTARY_X
4277 _elm_win_xwindow_get(sd);
4279 ecore_x_e_illume_quickpanel_priority_minor_set(sd->x.xwin, priority);
4286 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
4288 ELM_WIN_CHECK(obj) - 1;
4289 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
4291 #ifdef HAVE_ELEMENTARY_X
4292 _elm_win_xwindow_get(sd);
4294 return ecore_x_e_illume_quickpanel_priority_minor_get(sd->x.xwin);
4300 elm_win_quickpanel_zone_set(Evas_Object *obj,
4304 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4306 #ifdef HAVE_ELEMENTARY_X
4307 _elm_win_xwindow_get(sd);
4309 ecore_x_e_illume_quickpanel_zone_set(sd->x.xwin, zone);
4316 elm_win_quickpanel_zone_get(const Evas_Object *obj)
4318 ELM_WIN_CHECK(obj) 0;
4319 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, 0);
4321 #ifdef HAVE_ELEMENTARY_X
4322 _elm_win_xwindow_get(sd);
4324 return ecore_x_e_illume_quickpanel_zone_get(sd->x.xwin);
4330 elm_win_prop_focus_skip_set(Evas_Object *obj,
4334 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4336 sd->skip_focus = skip;
4337 TRAP(sd, focus_skip_set, skip);
4341 elm_win_illume_command_send(Evas_Object *obj,
4342 Elm_Illume_Command command,
4343 void *params __UNUSED__)
4346 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4348 #ifdef HAVE_ELEMENTARY_X
4349 _elm_win_xwindow_get(sd);
4354 case ELM_ILLUME_COMMAND_FOCUS_BACK:
4355 ecore_x_e_illume_focus_back_send(sd->x.xwin);
4358 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
4359 ecore_x_e_illume_focus_forward_send(sd->x.xwin);
4362 case ELM_ILLUME_COMMAND_FOCUS_HOME:
4363 ecore_x_e_illume_focus_home_send(sd->x.xwin);
4366 case ELM_ILLUME_COMMAND_CLOSE:
4367 ecore_x_e_illume_close_send(sd->x.xwin);
4380 elm_win_inlined_image_object_get(Evas_Object *obj)
4382 ELM_WIN_CHECK(obj) NULL;
4383 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
4389 elm_win_focus_highlight_enabled_set(Evas_Object *obj,
4393 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4395 enabled = !!enabled;
4396 if (sd->focus_highlight.enabled == enabled)
4399 sd->focus_highlight.enabled = enabled;
4401 if (sd->focus_highlight.enabled)
4402 _elm_win_focus_highlight_init(sd);
4404 _elm_win_focus_highlight_shutdown(sd);
4408 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
4410 ELM_WIN_CHECK(obj) EINA_FALSE;
4411 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4413 return sd->focus_highlight.enabled;
4417 elm_win_focus_highlight_style_set(Evas_Object *obj,
4421 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4423 eina_stringshare_replace(&sd->focus_highlight.style, style);
4424 sd->focus_highlight.changed_theme = EINA_TRUE;
4425 _elm_win_focus_highlight_reconfigure_job_start(sd);
4429 elm_win_focus_highlight_style_get(const Evas_Object *obj)
4431 ELM_WIN_CHECK(obj) NULL;
4432 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
4434 return sd->focus_highlight.style;
4438 elm_win_socket_listen(Evas_Object *obj,
4439 const char *svcname,
4443 ELM_WIN_CHECK(obj) EINA_FALSE;
4444 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4446 if (!sd->ee) return EINA_FALSE;
4448 if (!ecore_evas_extn_socket_listen(sd->ee, svcname, svcnum, svcsys))
4454 /* windowing specific calls - shall we do this differently? */
4457 elm_win_xwindow_get(const Evas_Object *obj)
4461 if (!evas_object_smart_type_check_ptr(obj, WIN_SMART_NAME))
4463 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
4464 return _elm_ee_xwin_get(ee);
4467 ELM_WIN_CHECK(obj) 0;
4468 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, 0);
4470 #ifdef HAVE_ELEMENTARY_X
4471 if (sd->x.xwin) return sd->x.xwin;
4472 if (sd->parent) return elm_win_xwindow_get(sd->parent);
4477 EAPI Ecore_Wl_Window *
4478 elm_win_wl_window_get(const Evas_Object *obj)
4480 if (!obj) return NULL;
4482 if (!evas_object_smart_type_check_ptr(obj, WIN_SMART_NAME))
4484 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
4485 return ecore_evas_wayland_window_get(ee);
4488 ELM_WIN_CHECK(obj) NULL;
4489 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
4490 #if HAVE_ELEMENTARY_WAYLAND
4491 if (sd->wl.win) return sd->wl.win;
4492 if (sd->parent) return elm_win_wl_window_get(sd->parent);
4498 elm_win_trap_set(const Elm_Win_Trap *t)
4500 DBG("old %p, new %p", trap, t);
4502 if ((t) && (t->version != ELM_WIN_TRAP_VERSION))
4504 CRITICAL("trying to set a trap version %lu while %lu was expected!",
4505 t->version, ELM_WIN_TRAP_VERSION);
4514 elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool floating)
4517 ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4519 if (floating == sd->floating) return;
4520 sd->floating = floating;
4521 #ifdef HAVE_ELEMENTARY_X
4522 _elm_win_xwindow_get(sd);
4526 ecore_x_e_illume_window_state_set
4527 (sd->x.xwin, ECORE_X_ILLUME_WINDOW_STATE_FLOATING);
4529 ecore_x_e_illume_window_state_set
4530 (sd->x.xwin, ECORE_X_ILLUME_WINDOW_STATE_NORMAL);
4536 elm_win_floating_mode_get(const Evas_Object *obj)
4538 ELM_WIN_CHECK(obj) EINA_FALSE;
4539 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
4541 return sd->floating;