unbreak wayland elm build more - use get_surface_id api
[platform/upstream/elementary.git] / src / lib / elm_win.c
1 #ifdef HAVE_CONFIG_H
2 # include "elementary_config.h"
3 #endif
4
5 #include <Elementary.h>
6 #include <Elementary_Cursor.h>
7
8 #include "elm_priv.h"
9 #include "elm_widget_menu.h"
10
11 EAPI Eo_Op ELM_OBJ_WIN_BASE_ID = EO_NOOP;
12
13 #define MY_CLASS ELM_OBJ_WIN_CLASS
14
15 #define MY_CLASS_NAME "elm_win"
16
17 static const Elm_Win_Trap *trap = NULL;
18
19 #define TRAP(sd, name, ...)                                             \
20   do                                                                    \
21     {                                                                   \
22        if ((!trap) || (!trap->name) ||                                  \
23            ((trap->name) &&                                             \
24             (trap->name(sd->trap_data, sd->obj, ## __VA_ARGS__)))) \
25          ecore_evas_##name(sd->ee, ##__VA_ARGS__);                      \
26     }                                                                   \
27   while (0)
28
29 #define ELM_WIN_DATA_GET(o, sd) \
30   Elm_Win_Smart_Data * sd = eo_data_scope_get(o, MY_CLASS)
31
32 #define ELM_WIN_DATA_GET_OR_RETURN(o, ptr)           \
33   ELM_WIN_DATA_GET(o, ptr);                          \
34   if (!ptr)                                          \
35     {                                                \
36        CRITICAL("No widget data for object %p (%s)", \
37                 o, evas_object_type_get(o));         \
38        return;                                       \
39     }
40
41 #define ELM_WIN_DATA_GET_OR_RETURN_VAL(o, ptr, val)  \
42   ELM_WIN_DATA_GET(o, ptr);                          \
43   if (!ptr)                                          \
44     {                                                \
45        CRITICAL("No widget data for object %p (%s)", \
46                 o, evas_object_type_get(o));         \
47        return val;                                   \
48     }
49
50 #define ELM_WIN_CHECK(obj)                                             \
51   if (!obj || !eo_isa(obj, MY_CLASS)) \
52     return
53
54 #define ENGINE_GET() (_elm_preferred_engine ? _elm_preferred_engine : (_elm_config->engine ? _elm_config->engine : ""))
55 #define ENGINE_COMPARE(name) (!strcmp(ENGINE_GET(), name))
56 #define EE_ENGINE_COMPARE(ee, name) (!strcmp(ecore_evas_engine_name_get(ee), name))
57
58 typedef struct _Elm_Win_Smart_Data Elm_Win_Smart_Data;
59
60 struct _Elm_Win_Smart_Data
61 {
62    Ecore_Evas           *ee;
63    Evas                 *evas;
64    Evas_Object          *parent; /* parent *window* object*/
65    Evas_Object          *img_obj, *frame_obj;
66    Evas_Object          *client_obj; /* rect representing the client */
67    Evas_Object          *spacer_obj;
68    Eo                   *layout;
69    Eo                   *box;
70    Evas_Object          *obj; /* The object itself */
71 #ifdef HAVE_ELEMENTARY_X
72    struct
73    {
74       Ecore_X_Window       xwin;
75       Ecore_Event_Handler *client_message_handler;
76       Ecore_Event_Handler *property_handler;
77    } x;
78 #endif
79 #ifdef HAVE_ELEMENTARY_WAYLAND
80    struct
81    {
82       Ecore_Wl_Window *win;
83    } wl;
84 #endif
85
86    Ecore_Job                     *deferred_resize_job;
87    Ecore_Job                     *deferred_child_eval_job;
88
89    Elm_Win_Type                   type;
90    Elm_Win_Keyboard_Mode          kbdmode;
91    Elm_Win_Indicator_Mode         indmode;
92    Elm_Win_Indicator_Opacity_Mode ind_o_mode;
93    struct
94    {
95       const char  *info;
96       Ecore_Timer *timer;
97       int          repeat_count;
98       int          shot_counter;
99    } shot;
100    int                            resize_location;
101    int                           *autodel_clear, rot;
102    struct
103    {
104       int x, y;
105    } screen;
106    struct
107    {
108       Ecore_Evas  *ee;
109       Evas        *evas;
110       Evas_Object *obj, *hot_obj;
111       int          hot_x, hot_y;
112    } pointer;
113    struct
114    {
115       Evas_Object *fobj; /* focus highlight edje object */
116
117       struct
118       {
119          Evas_Object *target;
120          Eina_Bool    visible : 1;
121          Eina_Bool    handled : 1;
122       } cur, prev;
123
124       const char  *style;
125       Ecore_Job   *reconf_job;
126
127       Eina_Bool    enabled : 1;
128       Eina_Bool    theme_changed : 1; /* set true when the focus theme is changed */
129       Eina_Bool    animate : 1; /* set true when the focus highlight animate is enabled */
130       Eina_Bool    animate_supported : 1; /* set true when the focus highlight animate is supported by theme */
131       Eina_Bool    geometry_changed : 1;
132    } focus_highlight;
133
134    Evas_Object *icon;
135    const char  *title;
136    const char  *icon_name;
137    const char  *role;
138
139    Evas_Object *main_menu;
140
141    struct
142    {
143       const char  *name;
144       const char **available_list;
145       unsigned int count;
146    } profile;
147
148    void *trap_data;
149
150    double       aspect;
151    int          size_base_w, size_base_h;
152    int          size_step_w, size_step_h;
153    int          norender;
154    Eina_Bool    urgent : 1;
155    Eina_Bool    modal : 1;
156    Eina_Bool    demand_attention : 1;
157    Eina_Bool    autodel : 1;
158    Eina_Bool    constrain : 1;
159    Eina_Bool    resizing : 1;
160    Eina_Bool    iconified : 1;
161    Eina_Bool    withdrawn : 1;
162    Eina_Bool    sticky : 1;
163    Eina_Bool    fullscreen : 1;
164    Eina_Bool    maximized : 1;
165    Eina_Bool    skip_focus : 1;
166    Eina_Bool    floating : 1;
167 };
168
169 static const char SIG_DELETE_REQUEST[] = "delete,request";
170 static const char SIG_FOCUS_OUT[] = "focus,out"; // deprecated. use "focused" instead.
171 static const char SIG_FOCUS_IN[] = "focus,in"; // deprecated. use "unfocused" instead.
172 static const char SIG_MOVED[] = "moved";
173 static const char SIG_WITHDRAWN[] = "withdrawn";
174 static const char SIG_ICONIFIED[] = "iconified";
175 static const char SIG_NORMAL[] = "normal";
176 static const char SIG_STICK[] = "stick";
177 static const char SIG_UNSTICK[] = "unstick";
178 static const char SIG_FULLSCREEN[] = "fullscreen";
179 static const char SIG_UNFULLSCREEN[] = "unfullscreen";
180 static const char SIG_MAXIMIZED[] = "maximized";
181 static const char SIG_UNMAXIMIZED[] = "unmaximized";
182 static const char SIG_IOERR[] = "ioerr";
183 static const char SIG_INDICATOR_PROP_CHANGED[] = "indicator,prop,changed";
184 static const char SIG_ROTATION_CHANGED[] = "rotation,changed";
185 static const char SIG_PROFILE_CHANGED[] = "profile,changed";
186 static const char SIG_FOCUSED[] = "focused";
187 static const char SIG_UNFOCUSED[] = "unfocused";
188
189 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
190    {SIG_DELETE_REQUEST, ""},
191    {SIG_FOCUS_OUT, ""},
192    {SIG_FOCUS_IN, ""},
193    {SIG_MOVED, ""},
194    {SIG_WITHDRAWN, ""},
195    {SIG_ICONIFIED, ""},
196    {SIG_NORMAL, ""},
197    {SIG_STICK, ""},
198    {SIG_UNSTICK, ""},
199    {SIG_FULLSCREEN, ""},
200    {SIG_UNFULLSCREEN, ""},
201    {SIG_MAXIMIZED, ""},
202    {SIG_UNMAXIMIZED, ""},
203    {SIG_IOERR, ""},
204    {SIG_INDICATOR_PROP_CHANGED, ""},
205    {SIG_ROTATION_CHANGED, ""},
206    {SIG_PROFILE_CHANGED, ""},
207    {SIG_FOCUSED, ""},
208    {SIG_UNFOCUSED, ""},
209    {NULL, NULL}
210 };
211
212 Eina_List *_elm_win_list = NULL;
213 int _elm_win_deferred_free = 0;
214
215 static int _elm_win_count = 0;
216
217 static Eina_Bool _elm_win_auto_throttled = EINA_FALSE;
218
219 static Ecore_Job *_elm_win_state_eval_job = NULL;
220
221 static void
222 _elm_win_on_resize_obj_changed_size_hints(void *data,
223                                           Evas *e,
224                                           Evas_Object *obj,
225                                           void *event_info);
226
227 EAPI double _elm_startup_time = 0;
228
229 static void
230 _elm_win_first_frame_do(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
231 {
232    double end = ecore_time_unix_get();
233    char *first = data;
234
235    switch (*first)
236      {
237       case 'A': abort();
238       case 'E':
239       case 'D': exit(-1);
240       case 'T': fprintf(stderr, "Startup time: '%f' - '%f' = '%f' sec\n", end, _elm_startup_time, end - _elm_startup_time);
241                 break;
242      }
243
244    evas_event_callback_del_full(e, EVAS_CALLBACK_RENDER_POST, _elm_win_first_frame_do, data);
245 }
246
247 static void
248 _elm_win_state_eval(void *data __UNUSED__)
249 {
250    Eina_List *l;
251    Evas_Object *obj;
252    int _elm_win_count_shown = 0;
253    int _elm_win_count_iconified = 0;
254    int _elm_win_count_withdrawn = 0;
255
256    _elm_win_state_eval_job = NULL;
257
258    if (_elm_config->auto_norender_withdrawn)
259      {
260         EINA_LIST_FOREACH(_elm_win_list, l, obj)
261           {
262              if ((elm_win_withdrawn_get(obj)) ||
263                  ((elm_win_iconified_get(obj) &&
264                    (_elm_config->auto_norender_iconified_same_as_withdrawn))))
265                {
266                   if (!evas_object_data_get(obj, "__win_auto_norender"))
267                     {
268                        Evas *evas = evas_object_evas_get(obj);
269
270                        elm_win_norender_push(obj);
271                        evas_object_data_set(obj, "__win_auto_norender", obj);
272
273                        if (_elm_config->auto_flush_withdrawn)
274                          {
275                             edje_file_cache_flush();
276                             edje_collection_cache_flush();
277                             evas_image_cache_flush(evas);
278                             evas_font_cache_flush(evas);
279                          }
280                        if (_elm_config->auto_dump_withdrawn)
281                          {
282                             evas_render_dump(evas);
283                          }
284                     }
285                }
286              else
287                {
288                   if (evas_object_data_get(obj, "__win_auto_norender"))
289                     {
290                        elm_win_norender_pop(obj);
291                        evas_object_data_del(obj, "__win_auto_norender");
292                     }
293                }
294           }
295      }
296    if (((_elm_config->auto_throttle) &&
297         (elm_policy_get(ELM_POLICY_THROTTLE) != ELM_POLICY_THROTTLE_NEVER)) ||
298         (elm_policy_get(ELM_POLICY_THROTTLE) == ELM_POLICY_THROTTLE_HIDDEN_ALWAYS))
299      {
300         if (_elm_win_count == 0)
301           {
302              if (_elm_win_auto_throttled)
303                {
304                   ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
305                   _elm_win_auto_throttled = EINA_FALSE;
306                }
307           }
308         else
309           {
310              EINA_LIST_FOREACH(_elm_win_list, l, obj)
311                {
312                   if (elm_win_withdrawn_get(obj))
313                     _elm_win_count_withdrawn++;
314                   else if (elm_win_iconified_get(obj))
315                     _elm_win_count_iconified++;
316                   else if (evas_object_visible_get(obj))
317                     _elm_win_count_shown++;
318                }
319              if (_elm_win_count_shown <= 0)
320                {
321                   if (!_elm_win_auto_throttled)
322                     {
323                        ecore_throttle_adjust(_elm_config->auto_throttle_amount);
324                        _elm_win_auto_throttled = EINA_TRUE;
325                     }
326                }
327              else
328                {
329                   if (_elm_win_auto_throttled)
330                     {
331                        ecore_throttle_adjust(-_elm_config->auto_throttle_amount);
332                        _elm_win_auto_throttled = EINA_FALSE;
333                     }
334                }
335           }
336      }
337 }
338
339 static void
340 _elm_win_state_eval_queue(void)
341 {
342    if (_elm_win_state_eval_job) ecore_job_del(_elm_win_state_eval_job);
343    _elm_win_state_eval_job = ecore_job_add(_elm_win_state_eval, NULL);
344 }
345
346 // example shot spec (wait 0.1 sec then save as my-window.png):
347 // ELM_ENGINE="shot:delay=0.1:file=my-window.png"
348
349 static double
350 _shot_delay_get(Elm_Win_Smart_Data *sd)
351 {
352    char *p, *pd;
353    char *d = strdup(sd->shot.info);
354
355    if (!d) return 0.5;
356    for (p = (char *)sd->shot.info; *p; p++)
357      {
358         if (!strncmp(p, "delay=", 6))
359           {
360              double v;
361
362              for (pd = d, p += 6; (*p) && (*p != ':'); p++, pd++)
363                {
364                   *pd = *p;
365                }
366              *pd = 0;
367              v = _elm_atof(d);
368              free(d);
369              return v;
370           }
371      }
372    free(d);
373
374    return 0.5;
375 }
376
377 static char *
378 _shot_file_get(Elm_Win_Smart_Data *sd)
379 {
380    char *p;
381    char *tmp = strdup(sd->shot.info);
382    char *repname = NULL;
383
384    if (!tmp) return NULL;
385
386    for (p = (char *)sd->shot.info; *p; p++)
387      {
388         if (!strncmp(p, "file=", 5))
389           {
390              strcpy(tmp, p + 5);
391              if (!sd->shot.repeat_count) return tmp;
392              else
393                {
394                   char *dotptr = strrchr(tmp, '.');
395                   if (dotptr)
396                     {
397                        size_t size = sizeof(char) * (strlen(tmp) + 16);
398                        repname = malloc(size);
399                        strncpy(repname, tmp, dotptr - tmp);
400                        snprintf(repname + (dotptr - tmp), size -
401                                 (dotptr - tmp), "%03i",
402                                 sd->shot.shot_counter + 1);
403                        strcat(repname, dotptr);
404                        free(tmp);
405                        return repname;
406                     }
407                }
408           }
409      }
410    free(tmp);
411    if (!sd->shot.repeat_count) return strdup("out.png");
412
413    repname = malloc(sizeof(char) * 24);
414    snprintf(repname, sizeof(char) * 24, "out%03i.png",
415             sd->shot.shot_counter + 1);
416
417    return repname;
418 }
419
420 static int
421 _shot_repeat_count_get(Elm_Win_Smart_Data *sd)
422 {
423    char *p, *pd;
424    char *d = strdup(sd->shot.info);
425
426    if (!d) return 0;
427    for (p = (char *)sd->shot.info; *p; p++)
428      {
429         if (!strncmp(p, "repeat=", 7))
430           {
431              int v;
432
433              for (pd = d, p += 7; (*p) && (*p != ':'); p++, pd++)
434                {
435                   *pd = *p;
436                }
437              *pd = 0;
438              v = atoi(d);
439              if (v < 0) v = 0;
440              if (v > 1000) v = 999;
441              free(d);
442              return v;
443           }
444      }
445    free(d);
446
447    return 0;
448 }
449
450 static char *
451 _shot_key_get(Elm_Win_Smart_Data *sd __UNUSED__)
452 {
453    return NULL;
454 }
455
456 static char *
457 _shot_flags_get(Elm_Win_Smart_Data *sd __UNUSED__)
458 {
459    return NULL;
460 }
461
462 static void
463 _shot_do(Elm_Win_Smart_Data *sd)
464 {
465    Ecore_Evas *ee;
466    Evas_Object *o;
467    unsigned int *pixels;
468    int w, h;
469    char *file, *key, *flags;
470
471    ecore_evas_manual_render(sd->ee);
472    pixels = (void *)ecore_evas_buffer_pixels_get(sd->ee);
473    if (!pixels) return;
474
475    ecore_evas_geometry_get(sd->ee, NULL, NULL, &w, &h);
476    if ((w < 1) || (h < 1)) return;
477
478    file = _shot_file_get(sd);
479    if (!file) return;
480
481    key = _shot_key_get(sd);
482    flags = _shot_flags_get(sd);
483    ee = ecore_evas_buffer_new(1, 1);
484    o = evas_object_image_add(ecore_evas_get(ee));
485    evas_object_image_alpha_set(o, ecore_evas_alpha_get(sd->ee));
486    evas_object_image_size_set(o, w, h);
487    evas_object_image_data_set(o, pixels);
488    if (!evas_object_image_save(o, file, key, flags))
489      {
490         ERR("Cannot save window to '%s' (key '%s', flags '%s')",
491             file, key, flags);
492      }
493    free(file);
494    if (key) free(key);
495    if (flags) free(flags);
496    ecore_evas_free(ee);
497    if (sd->shot.repeat_count) sd->shot.shot_counter++;
498 }
499
500 static Eina_Bool
501 _shot_delay(void *data)
502 {
503    ELM_WIN_DATA_GET(data, sd);
504
505    _shot_do(sd);
506    if (sd->shot.repeat_count)
507      {
508         int remainshot = (sd->shot.repeat_count - sd->shot.shot_counter);
509         if (remainshot > 0) return EINA_TRUE;
510      }
511    sd->shot.timer = NULL;
512    elm_exit();
513
514    return EINA_FALSE;
515 }
516
517 static void
518 _shot_init(Elm_Win_Smart_Data *sd)
519 {
520    if (!sd->shot.info) return;
521
522    sd->shot.repeat_count = _shot_repeat_count_get(sd);
523    sd->shot.shot_counter = 0;
524 }
525
526 static void
527 _shot_handle(Elm_Win_Smart_Data *sd)
528 {
529    if (!sd->shot.info) return;
530
531    if (!sd->shot.timer)
532      sd->shot.timer = ecore_timer_add(_shot_delay_get(sd), _shot_delay,
533                                       sd->obj);
534 }
535
536 /* elm-win specific associate, does the trap while ecore_evas_object_associate()
537  * does not.
538  */
539 static Elm_Win_Smart_Data *
540 _elm_win_associate_get(const Ecore_Evas *ee)
541 {
542    ELM_WIN_DATA_GET(ecore_evas_data_get(ee, "elm_win"), sd);
543    return sd;
544 }
545
546 /* Interceptors Callbacks */
547 static void
548 _elm_win_obj_intercept_raise(void *data, Evas_Object *obj __UNUSED__)
549 {
550    ELM_WIN_DATA_GET(data, sd);
551    TRAP(sd, raise);
552 }
553
554 static void
555 _elm_win_obj_intercept_lower(void *data, Evas_Object *obj __UNUSED__)
556 {
557    ELM_WIN_DATA_GET(data, sd);
558    TRAP(sd, lower);
559 }
560
561 static void
562 _elm_win_obj_intercept_stack_above(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *above __UNUSED__)
563 {
564    INF("TODO: %s", __FUNCTION__);
565 }
566
567 static void
568 _elm_win_obj_intercept_stack_below(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *below __UNUSED__)
569 {
570    INF("TODO: %s", __FUNCTION__);
571 }
572
573 static void
574 _elm_win_obj_intercept_layer_set(void *data, Evas_Object *obj __UNUSED__, int l)
575 {
576    ELM_WIN_DATA_GET(data, sd);
577    TRAP(sd, layer_set, l);
578 }
579
580 /* Event Callbacks */
581
582 static void
583 _elm_win_obj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
584 {
585    ELM_WIN_DATA_GET(data, sd);
586    Evas_Coord w, h;
587
588    evas_object_size_hint_min_get(obj, &w, &h);
589    TRAP(sd, size_min_set, w, h);
590
591    evas_object_size_hint_max_get(obj, &w, &h);
592    if (w < 1) w = -1;
593    if (h < 1) h = -1;
594    TRAP(sd, size_max_set, w, h);
595 }
596 /* end of elm-win specific associate */
597
598 static void
599 _elm_win_move(Ecore_Evas *ee)
600 {
601    Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
602    int x, y;
603
604    EINA_SAFETY_ON_NULL_RETURN(sd);
605
606    ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
607    sd->screen.x = x;
608    sd->screen.y = y;
609    evas_object_smart_callback_call(sd->obj, SIG_MOVED, NULL);
610 }
611
612 static void
613 _elm_win_resize_job(void *data)
614 {
615    ELM_WIN_DATA_GET(data, sd);
616    int w, h;
617
618    sd->deferred_resize_job = NULL;
619    ecore_evas_request_geometry_get(sd->ee, NULL, NULL, &w, &h);
620    if (sd->constrain)
621      {
622         int sw, sh;
623         ecore_evas_screen_geometry_get(sd->ee, NULL, NULL, &sw, &sh);
624         w = MIN(w, sw);
625         h = MIN(h, sh);
626      }
627
628    if (sd->frame_obj)
629      {
630         int fx, fy, fw, fh;
631
632         evas_output_framespace_get(sd->evas, &fx, &fy, &fw, &fh);
633         evas_object_move(sd->frame_obj, -fx, -fy);
634         evas_object_resize(sd->frame_obj, w + fw, h + fh);
635      }
636
637    evas_object_resize(sd->obj, w, h);
638    evas_object_resize(sd->layout, w, h);
639 }
640
641 static void
642 _elm_win_resize(Ecore_Evas *ee)
643 {
644    Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
645    EINA_SAFETY_ON_NULL_RETURN(sd);
646
647    if (sd->deferred_resize_job) ecore_job_del(sd->deferred_resize_job);
648    sd->deferred_resize_job = ecore_job_add(_elm_win_resize_job, sd->obj);
649 }
650
651 static void
652 _elm_win_mouse_in(Ecore_Evas *ee)
653 {
654    Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
655    EINA_SAFETY_ON_NULL_RETURN(sd);
656
657    if (sd->resizing) sd->resizing = EINA_FALSE;
658 }
659
660 static void
661 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win_Smart_Data *sd)
662 {
663    ELM_SAFE_FREE(sd->focus_highlight.reconf_job, ecore_job_del);
664 }
665
666 static void
667 _elm_win_focus_highlight_visible_set(Elm_Win_Smart_Data *sd,
668                                      Eina_Bool visible)
669 {
670    Evas_Object *fobj = sd->focus_highlight.fobj;
671    if (!fobj) return;
672
673    if (visible)
674      {
675         evas_object_show(fobj);
676         edje_object_signal_emit(fobj, "elm,action,focus,show", "elm");
677      }
678    else
679      {
680         edje_object_signal_emit(fobj, "elm,action,focus,hide", "elm");
681      }
682 }
683
684 static void
685 _elm_win_focus_highlight_anim_setup(Elm_Win_Smart_Data *sd,
686                                     Evas_Object *obj)
687 {
688    Evas_Coord tx, ty, tw, th;
689    Evas_Coord w, h, px, py, pw, ph;
690    Edje_Message_Int_Set *m;
691    Evas_Object *previous = sd->focus_highlight.prev.target;
692    Evas_Object *target = sd->focus_highlight.cur.target;
693
694    evas_object_geometry_get(sd->obj, NULL, NULL, &w, &h);
695    evas_object_geometry_get(target, &tx, &ty, &tw, &th);
696    evas_object_geometry_get(previous, &px, &py, &pw, &ph);
697    evas_object_move(obj, tx, ty);
698    evas_object_resize(obj, tw, th);
699    evas_object_clip_unset(obj);
700
701    m = alloca(sizeof(*m) + (sizeof(int) * 8));
702    m->count = 8;
703    m->val[0] = px - tx;
704    m->val[1] = py - ty;
705    m->val[2] = pw;
706    m->val[3] = ph;
707    m->val[4] = 0;
708    m->val[5] = 0;
709    m->val[6] = tw;
710    m->val[7] = th;
711    edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
712 }
713
714 static void
715 _elm_win_focus_highlight_simple_setup(Elm_Win_Smart_Data *sd,
716                                       Evas_Object *obj)
717 {
718    Evas_Object *clip, *target = sd->focus_highlight.cur.target;
719    Evas_Coord x, y, w, h;
720
721    clip = evas_object_clip_get(target);
722    evas_object_geometry_get(target, &x, &y, &w, &h);
723
724    evas_object_move(obj, x, y);
725    evas_object_resize(obj, w, h);
726    evas_object_clip_set(obj, clip);
727 }
728
729 static void
730 _elm_win_focus_highlight_reconfigure(Elm_Win_Smart_Data *sd)
731 {
732    Evas_Object *target = sd->focus_highlight.cur.target;
733    Evas_Object *previous = sd->focus_highlight.prev.target;
734    Evas_Object *fobj = sd->focus_highlight.fobj;
735    Eina_Bool visible_changed;
736    Eina_Bool common_visible;
737    const char *sig = NULL;
738
739    _elm_win_focus_highlight_reconfigure_job_stop(sd);
740
741    visible_changed = (sd->focus_highlight.cur.visible !=
742                       sd->focus_highlight.prev.visible);
743
744    if ((target == previous) && (!visible_changed) &&
745        (!sd->focus_highlight.geometry_changed) &&
746        (!sd->focus_highlight.theme_changed))
747      return;
748
749    if ((previous) && (sd->focus_highlight.prev.handled))
750      elm_widget_signal_emit
751        (previous, "elm,action,focus_highlight,hide", "elm");
752
753    if (!target)
754      common_visible = EINA_FALSE;
755    else if (sd->focus_highlight.cur.handled)
756      {
757         common_visible = EINA_FALSE;
758         if (sd->focus_highlight.cur.visible)
759           sig = "elm,action,focus_highlight,show";
760         else
761           sig = "elm,action,focus_highlight,hide";
762      }
763    else
764      common_visible = sd->focus_highlight.cur.visible;
765
766    _elm_win_focus_highlight_visible_set(sd, common_visible);
767    if (sig)
768      elm_widget_signal_emit(target, sig, "elm");
769
770    if ((!target) || (!common_visible) || (sd->focus_highlight.cur.handled))
771      goto the_end;
772
773    if (sd->focus_highlight.theme_changed)
774      {
775         const char *str;
776         if (sd->focus_highlight.style)
777           str = sd->focus_highlight.style;
778         else
779           str = "default";
780         elm_widget_theme_object_set
781           (sd->obj, fobj, "focus_highlight", "top", str);
782         sd->focus_highlight.theme_changed = EINA_FALSE;
783
784         if (sd->focus_highlight.animate)
785           {
786              str = edje_object_data_get(sd->focus_highlight.fobj, "animate");
787              sd->focus_highlight.animate_supported = ((str) && (!strcmp(str, "on")));
788           }
789         else
790           sd->focus_highlight.animate_supported = EINA_FALSE;
791      }
792
793    if ((sd->focus_highlight.animate_supported) && (previous) &&
794        (!sd->focus_highlight.prev.handled))
795      _elm_win_focus_highlight_anim_setup(sd, fobj);
796    else
797      _elm_win_focus_highlight_simple_setup(sd, fobj);
798    evas_object_raise(fobj);
799
800 the_end:
801    sd->focus_highlight.geometry_changed = EINA_FALSE;
802    sd->focus_highlight.prev = sd->focus_highlight.cur;
803 }
804
805 static void
806 _elm_win_focus_highlight_reconfigure_job(void *data)
807 {
808    ELM_WIN_DATA_GET(data, sd);
809    _elm_win_focus_highlight_reconfigure(sd);
810 }
811
812 static void
813 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win_Smart_Data *sd)
814 {
815    if (sd->focus_highlight.reconf_job)
816      ecore_job_del(sd->focus_highlight.reconf_job);
817
818    sd->focus_highlight.reconf_job = ecore_job_add(
819        _elm_win_focus_highlight_reconfigure_job, sd->obj);
820 }
821
822 static void
823 _elm_win_focus_in(Ecore_Evas *ee)
824 {
825    Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
826    Evas_Object *obj;
827    unsigned int order = 0;
828
829    EINA_SAFETY_ON_NULL_RETURN(sd);
830
831    obj = sd->obj;
832
833    _elm_widget_top_win_focused_set(obj, EINA_TRUE);
834    if (!elm_widget_focus_order_get(obj)
835        || (obj == elm_widget_newest_focus_order_get(obj, &order, EINA_TRUE)))
836      {
837         elm_widget_focus_steal(obj);
838      }
839    else
840      elm_widget_focus_restore(obj);
841    evas_object_smart_callback_call(obj, SIG_FOCUS_IN, NULL);
842    evas_object_smart_callback_call(obj, SIG_FOCUSED, NULL);
843    sd->focus_highlight.cur.visible = EINA_TRUE;
844    _elm_win_focus_highlight_reconfigure_job_start(sd);
845    if (sd->frame_obj)
846      {
847         edje_object_signal_emit(sd->frame_obj, "elm,action,focus", "elm");
848      }
849
850    /* do nothing */
851    /* else if (sd->img_obj) */
852    /*   { */
853    /*   } */
854 }
855
856 static void
857 _elm_win_focus_out(Ecore_Evas *ee)
858 {
859    Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
860    Evas_Object *obj;
861
862    EINA_SAFETY_ON_NULL_RETURN(sd);
863
864    obj = sd->obj;
865
866    elm_object_focus_set(obj, EINA_FALSE);
867    _elm_widget_top_win_focused_set(obj, EINA_FALSE);
868    evas_object_smart_callback_call(obj, SIG_FOCUS_OUT, NULL);
869    evas_object_smart_callback_call(obj, SIG_UNFOCUSED, NULL);
870    sd->focus_highlight.cur.visible = EINA_FALSE;
871    _elm_win_focus_highlight_reconfigure_job_start(sd);
872    if (sd->frame_obj)
873      {
874         edje_object_signal_emit(sd->frame_obj, "elm,action,unfocus", "elm");
875      }
876
877    /* access */
878    _elm_access_object_highlight_disable(evas_object_evas_get(obj));
879
880    /* do nothing */
881    /* if (sd->img_obj) */
882    /*   { */
883    /*   } */
884 }
885
886 static void
887 _elm_win_available_profiles_del(Elm_Win_Smart_Data *sd)
888 {
889    if (!sd->profile.available_list) return;
890
891    unsigned int i;
892    for (i = 0; i < sd->profile.count; i++)
893      ELM_SAFE_FREE(sd->profile.available_list[i], eina_stringshare_del);
894    sd->profile.count = 0;
895    ELM_SAFE_FREE(sd->profile.available_list, free);
896 }
897
898 static void
899 _elm_win_profile_del(Elm_Win_Smart_Data *sd)
900 {
901    ELM_SAFE_FREE(sd->profile.name, eina_stringshare_del);
902 }
903
904 static Eina_Bool
905 _elm_win_profile_set(Elm_Win_Smart_Data *sd, const char *profile)
906 {
907    Eina_Bool changed = EINA_FALSE;
908    if (profile)
909      {
910         if (sd->profile.name)
911           {
912              if (strcmp(sd->profile.name, profile) != 0)
913                {
914                   eina_stringshare_replace(&(sd->profile.name), profile);
915                   changed = EINA_TRUE;
916                }
917           }
918         else
919           {
920              sd->profile.name = eina_stringshare_add(profile);
921              changed = EINA_TRUE;
922           }
923      }
924    else
925      _elm_win_profile_del(sd);
926
927    return changed;
928 }
929
930 static void
931 _elm_win_profile_update(Elm_Win_Smart_Data *sd)
932 {
933    if (sd->profile.available_list)
934      {
935         Eina_Bool found = EINA_FALSE;
936         if (sd->profile.name)
937           {
938              unsigned int i;
939              for (i = 0; i < sd->profile.count; i++)
940                {
941                   if (!strcmp(sd->profile.name,
942                               sd->profile.available_list[i]))
943                     {
944                        found = EINA_TRUE;
945                        break;
946                     }
947                }
948           }
949
950         /* If current profile is not present in an available profiles,
951          * change current profile to the 1st element of an array.
952          */
953         if (!found)
954           _elm_win_profile_set(sd, sd->profile.available_list[0]);
955      }
956
957    _elm_config_profile_set(sd->profile.name);
958
959    /* update sub ee */
960    Ecore_Evas *ee2;
961    Eina_List *sub, *l = NULL;
962
963    sub = ecore_evas_sub_ecore_evas_list_get(sd->ee);
964    EINA_LIST_FOREACH(sub, l, ee2)
965      ecore_evas_window_profile_set(ee2, sd->profile.name);
966
967    evas_object_smart_callback_call(sd->obj, SIG_PROFILE_CHANGED, NULL);
968 }
969
970 static void
971 _elm_win_state_change(Ecore_Evas *ee)
972 {
973    Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
974    Evas_Object *obj;
975    Eina_Bool ch_withdrawn = EINA_FALSE;
976    Eina_Bool ch_sticky = EINA_FALSE;
977    Eina_Bool ch_iconified = EINA_FALSE;
978    Eina_Bool ch_fullscreen = EINA_FALSE;
979    Eina_Bool ch_maximized = EINA_FALSE;
980    Eina_Bool ch_profile = EINA_FALSE;
981    const char *profile;
982
983    EINA_SAFETY_ON_NULL_RETURN(sd);
984
985    obj = sd->obj;
986
987    if (sd->withdrawn != ecore_evas_withdrawn_get(sd->ee))
988      {
989         sd->withdrawn = ecore_evas_withdrawn_get(sd->ee);
990         ch_withdrawn = EINA_TRUE;
991      }
992    if (sd->sticky != ecore_evas_sticky_get(sd->ee))
993      {
994         sd->sticky = ecore_evas_sticky_get(sd->ee);
995         ch_sticky = EINA_TRUE;
996      }
997    if (sd->iconified != ecore_evas_iconified_get(sd->ee))
998      {
999         sd->iconified = ecore_evas_iconified_get(sd->ee);
1000         ch_iconified = EINA_TRUE;
1001      }
1002    if (sd->fullscreen != ecore_evas_fullscreen_get(sd->ee))
1003      {
1004         sd->fullscreen = ecore_evas_fullscreen_get(sd->ee);
1005         ch_fullscreen = EINA_TRUE;
1006      }
1007    if (sd->maximized != ecore_evas_maximized_get(sd->ee))
1008      {
1009         sd->maximized = ecore_evas_maximized_get(sd->ee);
1010         ch_maximized = EINA_TRUE;
1011      }
1012
1013
1014    profile = ecore_evas_window_profile_get(sd->ee);
1015    ch_profile = _elm_win_profile_set(sd, profile);
1016
1017    _elm_win_state_eval_queue();
1018
1019    if ((ch_withdrawn) || (ch_iconified))
1020      {
1021         if (sd->withdrawn)
1022           evas_object_smart_callback_call(obj, SIG_WITHDRAWN, NULL);
1023         else if (sd->iconified)
1024           evas_object_smart_callback_call(obj, SIG_ICONIFIED, NULL);
1025         else
1026           evas_object_smart_callback_call(obj, SIG_NORMAL, NULL);
1027      }
1028    if (ch_sticky)
1029      {
1030         if (sd->sticky)
1031           evas_object_smart_callback_call(obj, SIG_STICK, NULL);
1032         else
1033           evas_object_smart_callback_call(obj, SIG_UNSTICK, NULL);
1034      }
1035    if (ch_fullscreen)
1036      {
1037         if (sd->fullscreen)
1038           evas_object_smart_callback_call(obj, SIG_FULLSCREEN, NULL);
1039         else
1040           evas_object_smart_callback_call(obj, SIG_UNFULLSCREEN, NULL);
1041      }
1042    if (ch_maximized)
1043      {
1044         if (sd->maximized)
1045           evas_object_smart_callback_call(obj, SIG_MAXIMIZED, NULL);
1046         else
1047           evas_object_smart_callback_call(obj, SIG_UNMAXIMIZED, NULL);
1048      }
1049    if (ch_profile)
1050      {
1051         _elm_win_profile_update(sd);
1052      }
1053 }
1054
1055 static void
1056 _elm_win_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
1057 {
1058    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1059    *ret = EINA_TRUE;
1060 }
1061
1062 static void
1063 _elm_win_smart_focus_next(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
1064 {
1065    Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction);
1066    Evas_Object **next = va_arg(*list, Evas_Object **);
1067    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1068    if (ret) *ret = EINA_FALSE;
1069
1070    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1071
1072    const Eina_List *items;
1073    void *(*list_data_get)(const Eina_List *list);
1074
1075    /* Focus chain */
1076    if (wd->subobjs)
1077      {
1078         if (!(items = elm_widget_focus_custom_chain_get(obj)))
1079           {
1080              items = wd->subobjs;
1081              if (!items)
1082                return;
1083           }
1084         list_data_get = eina_list_data_get;
1085
1086         elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
1087
1088         if (*next)
1089           {
1090              if (ret) *ret = EINA_TRUE;
1091              return;
1092           }
1093      }
1094    *next = (Evas_Object *)obj;
1095    return;
1096 }
1097
1098 static void
1099 _elm_win_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
1100 {
1101    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1102    *ret = EINA_TRUE;
1103 }
1104
1105 static void
1106 _elm_win_smart_focus_direction(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
1107 {
1108    const Evas_Object *base = va_arg(*list, Evas_Object *);
1109    double degree = va_arg(*list, double);
1110    Evas_Object **direction = va_arg(*list, Evas_Object **);
1111    double *weight = va_arg(*list, double *);
1112    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1113    if (ret) *ret = EINA_FALSE;
1114    Eina_Bool int_ret = EINA_FALSE;
1115
1116    const Eina_List *items;
1117    void *(*list_data_get)(const Eina_List *list);
1118
1119    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
1120
1121    /* Focus chain */
1122    if (wd->subobjs)
1123      {
1124         if (!(items = elm_widget_focus_custom_chain_get(obj)))
1125           items = wd->subobjs;
1126
1127         list_data_get = eina_list_data_get;
1128
1129         int_ret = elm_widget_focus_list_direction_get
1130                  (obj, base, items, list_data_get, degree, direction, weight);
1131         if (ret) *ret = int_ret;
1132      }
1133 }
1134
1135 static void
1136 _elm_win_smart_on_focus(Eo *obj, void *_pd, va_list *list)
1137 {
1138    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1139    if (ret) *ret = EINA_TRUE;
1140    Elm_Win_Smart_Data *sd = _pd;
1141    Eina_Bool int_ret = EINA_FALSE;
1142
1143    eo_do_super(obj, MY_CLASS, elm_wdg_on_focus(&int_ret));
1144    if (!int_ret) return;
1145
1146    if (sd->img_obj)
1147      evas_object_focus_set(sd->img_obj, elm_widget_focus_get(obj));
1148    else
1149      evas_object_focus_set(obj, elm_widget_focus_get(obj));
1150 }
1151
1152 static void
1153 _elm_win_smart_event(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
1154 {
1155    Evas_Object *src = va_arg(*list, Evas_Object *);
1156    Evas_Callback_Type type = va_arg(*list, Evas_Callback_Type);
1157    Evas_Event_Key_Down *ev = va_arg(*list, void *);
1158    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
1159
1160    if (ret) *ret = EINA_FALSE;
1161    (void) src;
1162
1163    if (elm_widget_disabled_get(obj)) return;
1164    if (type != EVAS_CALLBACK_KEY_DOWN) return;
1165
1166    if ((!strcmp(ev->key, "Tab")) ||
1167        (!strcmp(ev->key, "ISO_Left_Tab")))
1168      {
1169         if (evas_key_modifier_is_set(ev->modifiers, "Control") ||
1170             evas_key_modifier_is_set(ev->modifiers, "Alt"))
1171           return;
1172         if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
1173           elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
1174         else
1175           elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
1176
1177         goto success;
1178      }
1179    else if ((!strcmp(ev->key, "Left")) ||
1180             ((!strcmp(ev->key, "KP_Left")) && (!ev->string)))
1181      {
1182         elm_widget_focus_cycle(obj, ELM_FOCUS_LEFT);
1183
1184         goto success;
1185      }
1186    else if ((!strcmp(ev->key, "Right")) ||
1187             ((!strcmp(ev->key, "KP_Right")) && (!ev->string)))
1188      {
1189         elm_widget_focus_cycle(obj, ELM_FOCUS_RIGHT);
1190
1191         goto success;
1192      }
1193    else if ((!strcmp(ev->key, "Up")) ||
1194             ((!strcmp(ev->key, "KP_Up")) && (!ev->string)))
1195      {
1196         elm_widget_focus_cycle(obj, ELM_FOCUS_UP);
1197
1198         goto success;
1199      }
1200    else if ((!strcmp(ev->key, "Down")) ||
1201             ((!strcmp(ev->key, "KP_Down")) && (!ev->string)))
1202      {
1203         elm_widget_focus_cycle(obj, ELM_FOCUS_DOWN);
1204
1205         goto success;
1206      }
1207
1208    return;
1209
1210 success:
1211    ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
1212    if (ret) *ret = EINA_TRUE;
1213 }
1214
1215 static void
1216 _deferred_ecore_evas_free(void *data)
1217 {
1218    ecore_evas_free(data);
1219    _elm_win_deferred_free--;
1220 }
1221
1222 static void
1223 _elm_win_smart_show(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1224 {
1225    Elm_Win_Smart_Data *sd = _pd;
1226
1227    if (!evas_object_visible_get(obj))
1228      _elm_win_state_eval_queue();
1229    eo_do_super(obj, MY_CLASS, evas_obj_smart_show());
1230
1231    TRAP(sd, show);
1232
1233    if (sd->shot.info) _shot_handle(sd);
1234 }
1235
1236 static void
1237 _elm_win_smart_hide(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1238 {
1239    Elm_Win_Smart_Data *sd = _pd;
1240
1241    if (evas_object_visible_get(obj))
1242      _elm_win_state_eval_queue();
1243    eo_do_super(obj, MY_CLASS, evas_obj_smart_hide());
1244
1245    TRAP(sd, hide);
1246
1247    if (sd->frame_obj)
1248      {
1249         evas_object_hide(sd->frame_obj);
1250      }
1251    if (sd->img_obj)
1252      {
1253         evas_object_hide(sd->img_obj);
1254      }
1255    if (sd->pointer.obj)
1256      {
1257         evas_object_hide(sd->pointer.obj);
1258         ecore_evas_hide(sd->pointer.ee);
1259      }
1260 }
1261
1262 static void
1263 _elm_win_on_parent_del(void *data,
1264                        Evas *e __UNUSED__,
1265                        Evas_Object *obj,
1266                        void *event_info __UNUSED__)
1267 {
1268    ELM_WIN_DATA_GET(data, sd);
1269
1270    if (obj == sd->parent) sd->parent = NULL;
1271 }
1272
1273 static void
1274 _elm_win_focus_target_move(void *data,
1275                            Evas *e __UNUSED__,
1276                            Evas_Object *obj __UNUSED__,
1277                            void *event_info __UNUSED__)
1278 {
1279    ELM_WIN_DATA_GET(data, sd);
1280
1281    sd->focus_highlight.geometry_changed = EINA_TRUE;
1282    _elm_win_focus_highlight_reconfigure_job_start(sd);
1283 }
1284
1285 static void
1286 _elm_win_focus_target_resize(void *data,
1287                              Evas *e __UNUSED__,
1288                              Evas_Object *obj __UNUSED__,
1289                              void *event_info __UNUSED__)
1290 {
1291    ELM_WIN_DATA_GET(data, sd);
1292
1293    sd->focus_highlight.geometry_changed = EINA_TRUE;
1294    _elm_win_focus_highlight_reconfigure_job_start(sd);
1295 }
1296
1297 static void
1298 _elm_win_focus_target_del(void *data,
1299                           Evas *e __UNUSED__,
1300                           Evas_Object *obj __UNUSED__,
1301                           void *event_info __UNUSED__)
1302 {
1303    ELM_WIN_DATA_GET(data, sd);
1304
1305    sd->focus_highlight.cur.target = NULL;
1306
1307    _elm_win_focus_highlight_reconfigure_job_start(sd);
1308 }
1309
1310 static Evas_Object *
1311 _elm_win_focus_target_get(Evas_Object *obj)
1312 {
1313    Evas_Object *o = obj;
1314
1315    do
1316      {
1317         if (elm_widget_is(o))
1318           {
1319              if (!elm_widget_highlight_ignore_get(o))
1320                break;
1321              o = elm_widget_parent_get(o);
1322              if (!o)
1323                o = evas_object_smart_parent_get(o);
1324           }
1325         else
1326           {
1327              o = elm_widget_parent_widget_get(o);
1328              if (!o)
1329                o = evas_object_smart_parent_get(o);
1330           }
1331      }
1332    while (o);
1333
1334    return o;
1335 }
1336
1337 static void
1338 _elm_win_focus_target_callbacks_add(Elm_Win_Smart_Data *sd)
1339 {
1340    Evas_Object *obj = sd->focus_highlight.cur.target;
1341    if (!obj) return;
1342
1343    evas_object_event_callback_add
1344      (obj, EVAS_CALLBACK_MOVE, _elm_win_focus_target_move, sd->obj);
1345    evas_object_event_callback_add
1346      (obj, EVAS_CALLBACK_RESIZE, _elm_win_focus_target_resize, sd->obj);
1347    evas_object_event_callback_add
1348      (obj, EVAS_CALLBACK_DEL, _elm_win_focus_target_del, sd->obj);
1349 }
1350
1351 static void
1352 _elm_win_focus_target_callbacks_del(Elm_Win_Smart_Data *sd)
1353 {
1354    Evas_Object *obj = sd->focus_highlight.cur.target;
1355
1356    evas_object_event_callback_del_full
1357      (obj, EVAS_CALLBACK_MOVE, _elm_win_focus_target_move, sd->obj);
1358    evas_object_event_callback_del_full
1359      (obj, EVAS_CALLBACK_RESIZE, _elm_win_focus_target_resize, sd->obj);
1360    evas_object_event_callback_del_full
1361      (obj, EVAS_CALLBACK_DEL, _elm_win_focus_target_del, sd->obj);
1362 }
1363
1364 static void
1365 _elm_win_object_focus_in(void *data,
1366                          Evas *e __UNUSED__,
1367                          void *event_info)
1368 {
1369    Evas_Object *obj = event_info, *target;
1370    ELM_WIN_DATA_GET(data, sd);
1371
1372    if (sd->focus_highlight.cur.target == obj)
1373      return;
1374
1375    target = _elm_win_focus_target_get(obj);
1376    sd->focus_highlight.cur.target = target;
1377    if (elm_widget_highlight_in_theme_get(target))
1378      sd->focus_highlight.cur.handled = EINA_TRUE;
1379    else
1380      _elm_win_focus_target_callbacks_add(sd);
1381
1382    _elm_win_focus_highlight_reconfigure_job_start(sd);
1383 }
1384
1385 static void
1386 _elm_win_object_focus_out(void *data,
1387                           Evas *e __UNUSED__,
1388                           void *event_info __UNUSED__)
1389 {
1390    ELM_WIN_DATA_GET(data, sd);
1391
1392    if (!sd->focus_highlight.cur.target)
1393      return;
1394
1395    if (!sd->focus_highlight.cur.handled)
1396      _elm_win_focus_target_callbacks_del(sd);
1397
1398    sd->focus_highlight.cur.target = NULL;
1399    sd->focus_highlight.cur.handled = EINA_FALSE;
1400
1401    _elm_win_focus_highlight_reconfigure_job_start(sd);
1402 }
1403
1404 static void
1405 _elm_win_focus_highlight_shutdown(Elm_Win_Smart_Data *sd)
1406 {
1407    _elm_win_focus_highlight_reconfigure_job_stop(sd);
1408    if (sd->focus_highlight.cur.target)
1409      {
1410         elm_widget_signal_emit(sd->focus_highlight.cur.target,
1411                                "elm,action,focus_highlight,hide", "elm");
1412         _elm_win_focus_target_callbacks_del(sd);
1413         sd->focus_highlight.cur.target = NULL;
1414      }
1415    ELM_SAFE_FREE(sd->focus_highlight.fobj, evas_object_del);
1416
1417    evas_event_callback_del_full
1418      (sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
1419      _elm_win_object_focus_in, sd->obj);
1420    evas_event_callback_del_full
1421      (sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
1422      _elm_win_object_focus_out, sd->obj);
1423 }
1424
1425 static void
1426 _elm_win_on_img_obj_del(void *data,
1427                         Evas *e __UNUSED__,
1428                         Evas_Object *obj __UNUSED__,
1429                         void *event_info __UNUSED__)
1430 {
1431    ELM_WIN_DATA_GET(data, sd);
1432    sd->img_obj = NULL;
1433 }
1434
1435 static void
1436 _elm_win_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
1437 {
1438    Elm_Win_Smart_Data *sd = _pd;
1439
1440    evas_object_event_callback_del_full(sd->layout,
1441                                        EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1442                                        _elm_win_on_resize_obj_changed_size_hints,
1443                                        obj);
1444    evas_object_del(sd->box);
1445    evas_object_del(sd->layout);
1446
1447    /* NB: child deletion handled by parent's smart del */
1448
1449    if ((trap) && (trap->del))
1450      trap->del(sd->trap_data, obj);
1451
1452    if (sd->parent)
1453      {
1454         evas_object_event_callback_del_full
1455           (sd->parent, EVAS_CALLBACK_DEL, _elm_win_on_parent_del, obj);
1456         sd->parent = NULL;
1457      }
1458
1459    if (sd->autodel_clear) *(sd->autodel_clear) = -1;
1460
1461    _elm_win_list = eina_list_remove(_elm_win_list, obj);
1462    _elm_win_count--;
1463    _elm_win_state_eval_queue();
1464
1465    if (sd->ee)
1466      {
1467         ecore_evas_callback_delete_request_set(sd->ee, NULL);
1468         ecore_evas_callback_resize_set(sd->ee, NULL);
1469      }
1470
1471    if (sd->deferred_resize_job) ecore_job_del(sd->deferred_resize_job);
1472    if (sd->deferred_child_eval_job) ecore_job_del(sd->deferred_child_eval_job);
1473    if (sd->shot.info) eina_stringshare_del(sd->shot.info);
1474    if (sd->shot.timer) ecore_timer_del(sd->shot.timer);
1475
1476 #ifdef HAVE_ELEMENTARY_X
1477    if (sd->x.client_message_handler)
1478      ecore_event_handler_del(sd->x.client_message_handler);
1479    if (sd->x.property_handler)
1480      ecore_event_handler_del(sd->x.property_handler);
1481 #endif
1482
1483    if (sd->img_obj)
1484      {
1485         evas_object_event_callback_del_full
1486            (sd->img_obj, EVAS_CALLBACK_DEL, _elm_win_on_img_obj_del, obj);
1487         sd->img_obj = NULL;
1488      }
1489    else
1490      {
1491         if (sd->ee)
1492           {
1493              ecore_job_add(_deferred_ecore_evas_free, sd->ee);
1494              _elm_win_deferred_free++;
1495           }
1496      }
1497
1498    _elm_win_focus_highlight_shutdown(sd);
1499    eina_stringshare_del(sd->focus_highlight.style);
1500
1501    if (sd->title) eina_stringshare_del(sd->title);
1502    if (sd->icon_name) eina_stringshare_del(sd->icon_name);
1503    if (sd->role) eina_stringshare_del(sd->role);
1504    if (sd->icon) evas_object_del(sd->icon);
1505
1506    if (sd->main_menu) evas_object_del(sd->main_menu);
1507
1508    _elm_win_profile_del(sd);
1509    _elm_win_available_profiles_del(sd);
1510
1511    /* Don't let callback in the air that point to sd */
1512    ecore_evas_callback_delete_request_set(sd->ee, NULL);
1513    ecore_evas_callback_resize_set(sd->ee, NULL);
1514    ecore_evas_callback_mouse_in_set(sd->ee, NULL);
1515    ecore_evas_callback_focus_in_set(sd->ee, NULL);
1516    ecore_evas_callback_focus_out_set(sd->ee, NULL);
1517    ecore_evas_callback_move_set(sd->ee, NULL);
1518    ecore_evas_callback_state_change_set(sd->ee, NULL);
1519
1520    eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
1521
1522    if ((!_elm_win_list) &&
1523        (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
1524      {
1525         edje_file_cache_flush();
1526         edje_collection_cache_flush();
1527         evas_image_cache_flush(evas_object_evas_get(obj));
1528         evas_font_cache_flush(evas_object_evas_get(obj));
1529         elm_exit();
1530      }
1531 }
1532
1533 static void
1534 _elm_win_obj_intercept_show(void *data,
1535                             Evas_Object *obj)
1536 {
1537    ELM_WIN_DATA_GET(data, sd);
1538
1539    // this is called to make sure all smart containers have calculated their
1540    // sizes BEFORE we show the window to make sure it initially appears at
1541    // our desired size (ie min size is known first)
1542    evas_smart_objects_calculate(evas_object_evas_get(obj));
1543    if (sd->frame_obj)
1544      {
1545         evas_object_show(sd->frame_obj);
1546      }
1547    if (sd->img_obj)
1548      {
1549         evas_object_show(sd->img_obj);
1550      }
1551    if (sd->pointer.obj)
1552      {
1553         ecore_evas_show(sd->pointer.ee);
1554         evas_object_show(sd->pointer.obj);
1555      }
1556    evas_object_show(obj);
1557 }
1558
1559 static void
1560 _elm_win_smart_move(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
1561 {
1562    Evas_Coord x = va_arg(*list, Evas_Coord);
1563    Evas_Coord y = va_arg(*list, Evas_Coord);
1564    Elm_Win_Smart_Data *sd = _pd;
1565
1566    if (sd->img_obj)
1567      {
1568         if ((x != sd->screen.x) || (y != sd->screen.y))
1569           {
1570              sd->screen.x = x;
1571              sd->screen.y = y;
1572              evas_object_smart_callback_call(obj, SIG_MOVED, NULL);
1573           }
1574         return;
1575      }
1576    else
1577      {
1578         TRAP(sd, move, x, y);
1579         if (!ecore_evas_override_get(sd->ee))  return;
1580      }
1581
1582    eo_do_super(obj, MY_CLASS, evas_obj_smart_move(x, y));
1583
1584    if (ecore_evas_override_get(sd->ee))
1585      {
1586         sd->screen.x = x;
1587         sd->screen.y = y;
1588         evas_object_smart_callback_call(obj, SIG_MOVED, NULL);
1589      }
1590    if (sd->frame_obj)
1591      {
1592         /* FIXME: We should update ecore_wl_window_location here !! */
1593         sd->screen.x = x;
1594         sd->screen.y = y;
1595      }
1596    if (sd->img_obj)
1597      {
1598         sd->screen.x = x;
1599         sd->screen.y = y;
1600      }
1601 }
1602
1603 static void
1604 _elm_win_smart_resize(Eo *obj, void *_pd, va_list *list)
1605 {
1606    Evas_Coord w = va_arg(*list, Evas_Coord);
1607    Evas_Coord h = va_arg(*list, Evas_Coord);
1608
1609    Elm_Win_Smart_Data *sd = _pd;
1610
1611    eo_do_super(obj, MY_CLASS, evas_obj_smart_resize(w, h));
1612
1613    if (sd->img_obj)
1614      {
1615         if (sd->constrain)
1616           {
1617              int sw, sh;
1618
1619              ecore_evas_screen_geometry_get(sd->ee, NULL, NULL, &sw, &sh);
1620              w = MIN(w, sw);
1621              h = MIN(h, sh);
1622           }
1623         if (w < 1) w = 1;
1624         if (h < 1) h = 1;
1625
1626         evas_object_image_size_set(sd->img_obj, w, h);
1627      }
1628
1629    TRAP(sd, resize, w, h);
1630 }
1631
1632 static void
1633 _elm_win_delete_request(Ecore_Evas *ee)
1634 {
1635    Elm_Win_Smart_Data *sd = _elm_win_associate_get(ee);
1636    Evas_Object *obj;
1637
1638    EINA_SAFETY_ON_NULL_RETURN(sd);
1639
1640    obj = sd->obj;
1641
1642    int autodel = sd->autodel;
1643    sd->autodel_clear = &autodel;
1644    evas_object_ref(obj);
1645    evas_object_smart_callback_call(obj, SIG_DELETE_REQUEST, NULL);
1646    // FIXME: if above callback deletes - then the below will be invalid
1647    if (autodel) evas_object_del(obj);
1648    else sd->autodel_clear = NULL;
1649    evas_object_unref(obj);
1650 }
1651
1652 Ecore_X_Window
1653 _elm_ee_xwin_get(const Ecore_Evas *ee)
1654 {
1655 #ifdef HAVE_ELEMENTARY_X
1656    Ecore_X_Window xwin = 0;
1657
1658    if (!ee) return 0;
1659    if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_X11))
1660      {
1661         if (ee) xwin = ecore_evas_software_x11_window_get(ee);
1662      }
1663    else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_FB) ||
1664             EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_16_WINCE) ||
1665             EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_SDL) ||
1666             EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_16_SDL) ||
1667             EE_ENGINE_COMPARE(ee, ELM_OPENGL_SDL) ||
1668             EE_ENGINE_COMPARE(ee, ELM_OPENGL_COCOA))
1669      {
1670      }
1671    else if (EE_ENGINE_COMPARE(ee, ELM_OPENGL_X11))
1672      {
1673         if (ee) xwin = ecore_evas_gl_x11_window_get(ee);
1674      }
1675    else if (EE_ENGINE_COMPARE(ee, ELM_SOFTWARE_WIN32))
1676      {
1677         if (ee) xwin = (long)ecore_evas_win32_window_get(ee);
1678      }
1679    return xwin;
1680
1681 #endif
1682    return 0;
1683 }
1684
1685 #ifdef HAVE_ELEMENTARY_X
1686 static void
1687 _elm_win_xwindow_get(Elm_Win_Smart_Data *sd)
1688 {
1689    sd->x.xwin = _elm_ee_xwin_get(sd->ee);
1690 }
1691 #endif
1692
1693 #ifdef HAVE_ELEMENTARY_X
1694 static void
1695 _elm_win_xwin_update(Elm_Win_Smart_Data *sd)
1696 {
1697    const char *s;
1698
1699    _elm_win_xwindow_get(sd);
1700    if (sd->parent)
1701      {
1702         ELM_WIN_DATA_GET(sd->parent, sdp);
1703         if (sdp)
1704           {
1705              if (sd->x.xwin)
1706                ecore_x_icccm_transient_for_set(sd->x.xwin, sdp->x.xwin);
1707           }
1708      }
1709
1710    if (!sd->x.xwin) return;  /* nothing more to do */
1711
1712    s = sd->title;
1713    if (!s) s = _elm_appname;
1714    if (!s) s = "";
1715    if (sd->icon_name) s = sd->icon_name;
1716    ecore_x_icccm_icon_name_set(sd->x.xwin, s);
1717    ecore_x_netwm_icon_name_set(sd->x.xwin, s);
1718
1719    s = sd->role;
1720    if (s) ecore_x_icccm_window_role_set(sd->x.xwin, s);
1721
1722    // set window icon
1723    if (sd->icon)
1724      {
1725         void *data;
1726
1727         data = evas_object_image_data_get(sd->icon, EINA_FALSE);
1728         if (data)
1729           {
1730              Ecore_X_Icon ic;
1731              int w = 0, h = 0, stride, x, y;
1732              unsigned char *p;
1733              unsigned int *p2;
1734
1735              evas_object_image_size_get(sd->icon, &w, &h);
1736              stride = evas_object_image_stride_get(sd->icon);
1737              if ((w > 0) && (h > 0) &&
1738                  (stride >= (int)(w * sizeof(unsigned int))))
1739                {
1740                   ic.width = w;
1741                   ic.height = h;
1742                   ic.data = malloc(w * h * sizeof(unsigned int));
1743
1744                   if (ic.data)
1745                     {
1746                        p = (unsigned char *)data;
1747                        p2 = (unsigned int *)ic.data;
1748                        for (y = 0; y < h; y++)
1749                          {
1750                             for (x = 0; x < w; x++)
1751                               {
1752                                  *p2 = *((unsigned int *)p);
1753                                  p += sizeof(unsigned int);
1754                                  p2++;
1755                               }
1756                             p += (stride - (w * sizeof(unsigned int)));
1757                          }
1758                        ecore_x_netwm_icons_set(sd->x.xwin, &ic, 1);
1759                        free(ic.data);
1760                     }
1761                }
1762              evas_object_image_data_set(sd->icon, data);
1763           }
1764      }
1765
1766    switch (sd->type)
1767      {
1768       case ELM_WIN_BASIC:
1769         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_NORMAL);
1770         break;
1771
1772       case ELM_WIN_DIALOG_BASIC:
1773         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_DIALOG);
1774         break;
1775
1776       case ELM_WIN_DESKTOP:
1777         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
1778         break;
1779
1780       case ELM_WIN_DOCK:
1781         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_DOCK);
1782         break;
1783
1784       case ELM_WIN_TOOLBAR:
1785         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
1786         break;
1787
1788       case ELM_WIN_MENU:
1789         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_MENU);
1790         break;
1791
1792       case ELM_WIN_UTILITY:
1793         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_UTILITY);
1794         break;
1795
1796       case ELM_WIN_SPLASH:
1797         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_SPLASH);
1798         break;
1799
1800       case ELM_WIN_DROPDOWN_MENU:
1801         ecore_x_netwm_window_type_set
1802           (sd->x.xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
1803         break;
1804
1805       case ELM_WIN_POPUP_MENU:
1806         ecore_x_netwm_window_type_set
1807           (sd->x.xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
1808         break;
1809
1810       case ELM_WIN_TOOLTIP:
1811         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
1812         break;
1813
1814       case ELM_WIN_NOTIFICATION:
1815         ecore_x_netwm_window_type_set
1816           (sd->x.xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
1817         break;
1818
1819       case ELM_WIN_COMBO:
1820         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_COMBO);
1821         break;
1822
1823       case ELM_WIN_DND:
1824         ecore_x_netwm_window_type_set(sd->x.xwin, ECORE_X_WINDOW_TYPE_DND);
1825         break;
1826
1827       default:
1828         break;
1829      }
1830    ecore_x_e_virtual_keyboard_state_set
1831      (sd->x.xwin, (Ecore_X_Virtual_Keyboard_State)sd->kbdmode);
1832    if (sd->indmode == ELM_WIN_INDICATOR_SHOW)
1833      ecore_x_e_illume_indicator_state_set
1834        (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
1835    else if (sd->indmode == ELM_WIN_INDICATOR_HIDE)
1836      ecore_x_e_illume_indicator_state_set
1837        (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
1838 }
1839
1840 #endif
1841
1842 /**
1843   * @internal
1844   *
1845   * Resize the window according to window layout's min and weight.
1846   * If the window layout's weight is 0.0, the window max is limited to layout's
1847   * min size.
1848   *
1849   * This is called when the window layout's weight hint is changed or when the
1850   * window is rotated.
1851   *
1852   * @param obj window object
1853   */
1854 static void
1855 _elm_win_resize_objects_eval(Evas_Object *obj)
1856 {
1857    ELM_WIN_DATA_GET(obj, sd);
1858    Evas_Coord w, h, minw, minh, maxw, maxh;
1859    double wx, wy;
1860
1861    evas_object_size_hint_min_get(sd->layout, &minw, &minh);
1862    if (minw < 1) minw = 1;
1863    if (minh < 1) minh = 1;
1864
1865    evas_object_size_hint_weight_get(sd->layout, &wx, &wy);
1866    if (!wx) maxw = minw;
1867    else maxw = 32767;
1868    if (!wy) maxh = minh;
1869    else maxh = 32767;
1870
1871    evas_object_size_hint_min_set(obj, minw, minh);
1872    evas_object_size_hint_max_set(obj, maxw, maxh);
1873    evas_object_geometry_get(obj, NULL, NULL, &w, &h);
1874    if (w < minw) w = minw;
1875    if (h < minh) h = minh;
1876    if (w > maxw) w = maxw;
1877    if (h > maxh) h = maxh;
1878    evas_object_move(obj, 0, 0);
1879    evas_object_resize(obj, w, h);
1880 }
1881
1882 static void
1883 _elm_win_on_resize_obj_changed_size_hints(void *data,
1884                                           Evas *e __UNUSED__,
1885                                           Evas_Object *obj __UNUSED__,
1886                                           void *event_info __UNUSED__)
1887 {
1888    _elm_win_resize_objects_eval(data);
1889 }
1890
1891 void
1892 _elm_win_shutdown(void)
1893 {
1894    while (_elm_win_list) evas_object_del(_elm_win_list->data);
1895    ELM_SAFE_FREE(_elm_win_state_eval_job, ecore_job_del);
1896 }
1897
1898 void
1899 _elm_win_rescale(Elm_Theme *th,
1900                  Eina_Bool use_theme)
1901 {
1902    const Eina_List *l;
1903    Evas_Object *obj;
1904
1905    if (!use_theme)
1906      {
1907         EINA_LIST_FOREACH(_elm_win_list, l, obj)
1908           elm_widget_theme(obj);
1909      }
1910    else
1911      {
1912         EINA_LIST_FOREACH(_elm_win_list, l, obj)
1913           elm_widget_theme_specific(obj, th, EINA_FALSE);
1914      }
1915 }
1916
1917 void
1918 _elm_win_access(Eina_Bool is_access)
1919 {
1920    Evas *evas;
1921    const Eina_List *l;
1922    Evas_Object *obj;
1923    Evas_Object *fobj;
1924
1925    EINA_LIST_FOREACH(_elm_win_list, l, obj)
1926      {
1927         elm_widget_access(obj, is_access);
1928
1929          /* floating orphan object. if there are A, B, C objects and user does
1930             as below, then there would be floating orphan objects.
1931
1932               1. elm_object_content_set(layout, A);
1933               2. elm_object_content_set(layout, B);
1934               3. elm_object_content_set(layout, C);
1935
1936             now, the object A and B are floating orphan objects */
1937
1938         fobj = obj;
1939         for (;;)
1940           {
1941              fobj = evas_object_below_get(fobj);
1942              if (!fobj) break;
1943
1944              if (elm_widget_is(fobj) && !elm_widget_parent_get(fobj))
1945                {
1946                   elm_widget_access(fobj, is_access);
1947                }
1948           }
1949
1950         if (!is_access)
1951           {
1952              evas = evas_object_evas_get(obj);
1953             if (evas) _elm_access_object_highlight_disable(evas);
1954           }
1955      }
1956 }
1957
1958 void
1959 _elm_win_translate(void)
1960 {
1961    const Eina_List *l;
1962    Evas_Object *obj;
1963
1964    EINA_LIST_FOREACH(_elm_win_list, l, obj)
1965      elm_widget_translate(obj);
1966 }
1967
1968 #ifdef HAVE_ELEMENTARY_X
1969 static Eina_Bool
1970 _elm_win_client_message(void *data,
1971                         int type __UNUSED__,
1972                         void *event)
1973 {
1974    ELM_WIN_DATA_GET(data, sd);
1975    Ecore_X_Event_Client_Message *e = event;
1976
1977    if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
1978    if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
1979      {
1980         if ((unsigned int)e->data.l[0] == sd->x.xwin)
1981           {
1982              Evas *evas = evas_object_evas_get(sd->obj);
1983              if (evas)
1984                {
1985                   edje_file_cache_flush();
1986                   edje_collection_cache_flush();
1987                   evas_image_cache_flush(evas);
1988                   evas_font_cache_flush(evas);
1989                }
1990           }
1991      }
1992    else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
1993      {
1994         if ((unsigned int)e->data.l[0] == sd->x.xwin)
1995           {
1996              Evas *evas = evas_object_evas_get(sd->obj);
1997              if (evas)
1998                {
1999                   edje_file_cache_flush();
2000                   edje_collection_cache_flush();
2001                   evas_image_cache_flush(evas);
2002                   evas_font_cache_flush(evas);
2003                   evas_render_dump(evas);
2004                }
2005           }
2006      }
2007    else if (e->message_type == ECORE_X_ATOM_E_ILLUME_ACCESS_CONTROL)
2008      {
2009         if ((unsigned int)e->data.l[0] == sd->x.xwin)
2010           {
2011              if ((unsigned int)e->data.l[1] ==
2012                  ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_NEXT)
2013                {
2014                   // XXX: call right access func
2015                }
2016              else if ((unsigned int)e->data.l[1] ==
2017                       ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_PREV)
2018                {
2019                   // XXX: call right access func
2020                }
2021              else if ((unsigned int)e->data.l[1] ==
2022                       ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_ACTIVATE)
2023                {
2024                   _elm_access_highlight_object_activate
2025                     (sd->obj, ELM_ACTIVATE_DEFAULT);
2026                }
2027              else if ((unsigned int)e->data.l[1] ==
2028                       ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ)
2029                {
2030                   /* there would be better way to read highlight object */
2031                   Evas *evas;
2032                   evas = evas_object_evas_get(sd->obj);
2033                   if (!evas) return ECORE_CALLBACK_PASS_ON;
2034
2035                   _elm_access_mouse_event_enabled_set(EINA_TRUE);
2036
2037                   evas_event_feed_mouse_in(evas, 0, NULL);
2038                   evas_event_feed_mouse_move
2039                     (evas, e->data.l[2], e->data.l[3], 0, NULL);
2040
2041                   _elm_access_mouse_event_enabled_set(EINA_FALSE);
2042                }
2043              else if ((unsigned int)e->data.l[1] ==
2044                       ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_NEXT)
2045                {
2046                   _elm_access_highlight_cycle(sd->obj, ELM_FOCUS_NEXT);
2047                }
2048              else if ((unsigned int)e->data.l[1] ==
2049                       ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_READ_PREV)
2050                {
2051                   _elm_access_highlight_cycle(sd->obj, ELM_FOCUS_PREVIOUS);
2052                }
2053              else if ((unsigned int)e->data.l[1] ==
2054                       ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_UP)
2055                {
2056                   _elm_access_highlight_object_activate
2057                     (sd->obj, ELM_ACTIVATE_UP);
2058                }
2059              else if ((unsigned int)e->data.l[1] ==
2060                       ECORE_X_ATOM_E_ILLUME_ACCESS_ACTION_DOWN)
2061                {
2062                   _elm_access_highlight_object_activate
2063                     (sd->obj, ELM_ACTIVATE_DOWN);
2064                }
2065           }
2066      }
2067    return ECORE_CALLBACK_PASS_ON;
2068 }
2069
2070 static Eina_Bool
2071 _elm_win_property_change(void *data,
2072                          int type __UNUSED__,
2073                          void *event)
2074 {
2075    ELM_WIN_DATA_GET(data, sd);
2076    Ecore_X_Event_Window_Property *e = event;
2077
2078    if (e->atom == ECORE_X_ATOM_E_ILLUME_INDICATOR_STATE)
2079      {
2080         if (e->win == sd->x.xwin)
2081           {
2082              sd->indmode = (Elm_Win_Indicator_Mode)ecore_x_e_illume_indicator_state_get(e->win);
2083              evas_object_smart_callback_call(sd->obj, SIG_INDICATOR_PROP_CHANGED, NULL);
2084           }
2085      }
2086    return ECORE_CALLBACK_PASS_ON;
2087 }
2088 #endif
2089
2090 static void
2091 _elm_win_focus_highlight_hide(void *data __UNUSED__,
2092                               Evas_Object *obj,
2093                               const char *emission __UNUSED__,
2094                               const char *source __UNUSED__)
2095 {
2096    evas_object_hide(obj);
2097 }
2098
2099 static void
2100 _elm_win_focus_highlight_anim_end(void *data,
2101                                   Evas_Object *obj,
2102                                   const char *emission __UNUSED__,
2103                                   const char *source __UNUSED__)
2104 {
2105    ELM_WIN_DATA_GET(data, sd);
2106
2107    _elm_win_focus_highlight_simple_setup(sd, obj);
2108 }
2109
2110 static void
2111 _elm_win_focus_highlight_init(Elm_Win_Smart_Data *sd)
2112 {
2113    evas_event_callback_add(sd->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
2114                            _elm_win_object_focus_in, sd->obj);
2115    evas_event_callback_add(sd->evas,
2116                            EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
2117                            _elm_win_object_focus_out, sd->obj);
2118
2119    sd->focus_highlight.cur.target = evas_focus_get(sd->evas);
2120    sd->focus_highlight.fobj = edje_object_add(sd->evas);
2121    sd->focus_highlight.theme_changed = EINA_TRUE;
2122
2123    edje_object_signal_callback_add(sd->focus_highlight.fobj,
2124                                    "elm,action,focus,hide,end", "*",
2125                                    _elm_win_focus_highlight_hide, NULL);
2126    edje_object_signal_callback_add(sd->focus_highlight.fobj,
2127                                    "elm,action,focus,anim,end", "*",
2128                                    _elm_win_focus_highlight_anim_end, sd->obj);
2129    _elm_win_focus_highlight_reconfigure_job_start(sd);
2130 }
2131
2132 static void
2133 _elm_win_frame_cb_move_start(void *data,
2134                              Evas_Object *obj __UNUSED__,
2135                              const char *sig __UNUSED__,
2136                              const char *source)
2137 {
2138    ELM_WIN_DATA_GET(data, sd);
2139
2140    if (!sd) return;
2141
2142 #ifdef HAVE_ELEMENTARY_WAYLAND
2143    if (!strcmp(source, "elm"))
2144      ecore_wl_window_cursor_from_name_set(sd->wl.win, ELM_CURSOR_HAND1);
2145    else
2146      ecore_wl_window_cursor_default_restore(sd->wl.win);
2147 #else
2148    (void)source;
2149 #endif
2150
2151    /* FIXME: Change mouse pointer */
2152
2153    /* NB: Wayland handles moving surfaces by itself so we cannot
2154     * specify a specific x/y we want. Instead, we will pass in the
2155     * existing x/y values so they can be recorded as 'previous'
2156     * position. The new position will get updated automatically when
2157     * the move is finished */
2158
2159    ecore_evas_wayland_move(sd->ee, sd->screen.x, sd->screen.y);
2160 }
2161
2162 static void
2163 _elm_win_frame_cb_move_stop(void *data,
2164                             Evas_Object *obj __UNUSED__,
2165                             const char *sig __UNUSED__,
2166                             const char *source __UNUSED__)
2167 {
2168    ELM_WIN_DATA_GET(data, sd);
2169
2170    if (!sd) return;
2171
2172 #ifdef HAVE_ELEMENTARY_WAYLAND
2173    ecore_wl_window_cursor_default_restore(sd->wl.win);
2174 #endif
2175 }
2176
2177 #ifdef HAVE_ELEMENTARY_WAYLAND
2178 struct _resize_info
2179 {
2180    const char *name;
2181    int location;
2182 };
2183
2184 static struct _resize_info _border_side[4] =
2185 {
2186      { ELM_CURSOR_TOP_SIDE, 1 },
2187      { ELM_CURSOR_LEFT_SIDE, 4 },
2188      { ELM_CURSOR_BOTTOM_SIDE, 2 },
2189      { ELM_CURSOR_RIGHT_SIDE, 8 },
2190 };
2191
2192 static struct _resize_info _border_corner[4] =
2193 {
2194      { ELM_CURSOR_TOP_LEFT_CORNER, 5 },
2195      { ELM_CURSOR_BOTTOM_LEFT_CORNER, 6 },
2196      { ELM_CURSOR_BOTTOM_RIGHT_CORNER, 10 },
2197      { ELM_CURSOR_TOP_RIGHT_CORNER, 9 },
2198 };
2199 #endif
2200
2201 static void
2202 _elm_win_frame_obj_update(Elm_Win_Smart_Data *sd)
2203 {
2204    int fx, fy, fw, fh;
2205    int ox, oy, ow, oh;
2206    int sx, sy, sw, sh;
2207    int x, y, w, h;
2208    evas_object_geometry_get(sd->frame_obj, &fx, &fy, &fw, &fh);
2209    evas_object_geometry_get(sd->client_obj, &ox, &oy, &ow, &oh);
2210    evas_object_geometry_get(sd->spacer_obj, &sx, &sy, &sw, &sh);
2211
2212    evas_output_framespace_get(sd->evas, &x, &y, &w, &h);
2213
2214    if ((x != (ox - fx)) || (y != (oy - fy)) ||
2215        (w != (fw - ow)) || (h != (fh - oh)))
2216      {
2217         evas_output_framespace_set(sd->evas, (ox - fx), (oy - fy),
2218                                    (fw - ow), (fh - oh));
2219      }
2220
2221 #ifdef HAVE_ELEMENTARY_WAYLAND
2222    ecore_wl_window_opaque_region_set(sd->wl.win, -fx, -(fy - sy), sw, sh);
2223 #endif
2224 }
2225
2226 static void
2227 _elm_win_frame_obj_move(void *data,
2228                         Evas *e __UNUSED__,
2229                         Evas_Object *obj __UNUSED__,
2230                         void *event_info __UNUSED__)
2231 {
2232    Elm_Win_Smart_Data *sd;
2233
2234    if (!(sd = data)) return;
2235    if (!sd->client_obj) return;
2236
2237    _elm_win_frame_obj_update(sd);
2238 }
2239
2240 static void
2241 _elm_win_frame_obj_resize(void *data,
2242                           Evas *e __UNUSED__,
2243                           Evas_Object *obj __UNUSED__,
2244                           void *event_info __UNUSED__)
2245 {
2246    Elm_Win_Smart_Data *sd;
2247
2248    if (!(sd = data)) return;
2249    if (!sd->client_obj) return;
2250
2251    _elm_win_frame_obj_update(sd);
2252 }
2253
2254 static void
2255 _elm_win_frame_cb_resize_show(void *data,
2256                               Evas_Object *obj __UNUSED__,
2257                               const char *sig __UNUSED__,
2258                               const char *source)
2259 {
2260    ELM_WIN_DATA_GET(data, sd);
2261
2262    if (!sd) return;
2263    if (sd->resizing) return;
2264
2265 #ifdef HAVE_ELEMENTARY_WAYLAND
2266    int i;
2267    i = sd->rot / 90;
2268    if (!strcmp(source, "elm.event.resize.t"))
2269      ecore_wl_window_cursor_from_name_set(sd->wl.win,
2270                                           _border_side[(0 + i) % 4].name);
2271    else if (!strcmp(source, "elm.event.resize.b"))
2272      ecore_wl_window_cursor_from_name_set(sd->wl.win,
2273                                           _border_side[(2 + i) % 4].name);
2274    else if (!strcmp(source, "elm.event.resize.l"))
2275      ecore_wl_window_cursor_from_name_set(sd->wl.win,
2276                                           _border_side[(1 + i) % 4].name);
2277    else if (!strcmp(source, "elm.event.resize.r"))
2278      ecore_wl_window_cursor_from_name_set(sd->wl.win,
2279                                           _border_side[(3 + i) % 4].name);
2280    else if (!strcmp(source, "elm.event.resize.tl"))
2281      ecore_wl_window_cursor_from_name_set(sd->wl.win,
2282                                           _border_corner[(0 + i) % 4].name);
2283    else if (!strcmp(source, "elm.event.resize.tr"))
2284      ecore_wl_window_cursor_from_name_set(sd->wl.win,
2285                                           _border_corner[(3 + i) % 4].name);
2286    else if (!strcmp(source, "elm.event.resize.bl"))
2287      ecore_wl_window_cursor_from_name_set(sd->wl.win,
2288                                           _border_corner[(1 + i) % 4].name);
2289    else if (!strcmp(source, "elm.event.resize.br"))
2290      ecore_wl_window_cursor_from_name_set(sd->wl.win,
2291                                           _border_corner[(2 + i) % 4].name);
2292    else
2293      ecore_wl_window_cursor_default_restore(sd->wl.win);
2294 #else
2295    (void)source;
2296 #endif
2297 }
2298
2299 static void
2300 _elm_win_frame_cb_resize_hide(void *data,
2301                               Evas_Object *obj __UNUSED__,
2302                               const char *sig __UNUSED__,
2303                               const char *source __UNUSED__)
2304 {
2305    ELM_WIN_DATA_GET(data, sd);
2306
2307    if (!sd) return;
2308    if (sd->resizing) return;
2309
2310 #ifdef HAVE_ELEMENTARY_WAYLAND
2311    ecore_wl_window_cursor_default_restore(sd->wl.win);
2312 #endif
2313 }
2314
2315 static void
2316 _elm_win_frame_cb_resize_start(void *data,
2317                                Evas_Object *obj __UNUSED__,
2318                                const char *sig __UNUSED__,
2319                                const char *source)
2320 {
2321 #ifdef HAVE_ELEMENTARY_WAYLAND
2322    ELM_WIN_DATA_GET(data, sd);
2323    int i;
2324
2325    if (!sd) return;
2326    if (sd->resizing) return;
2327
2328    sd->resizing = EINA_TRUE;
2329    i = sd->rot / 90;
2330    if (!strcmp(source, "elm.event.resize.t"))
2331      sd->resize_location = _border_side[(0 + i) % 4].location;
2332    else if (!strcmp(source, "elm.event.resize.b"))
2333      sd->resize_location = _border_side[(2 + i) % 4].location;
2334    else if (!strcmp(source, "elm.event.resize.l"))
2335      sd->resize_location = _border_side[(1 + i) % 4].location;
2336    else if (!strcmp(source, "elm.event.resize.r"))
2337      sd->resize_location = _border_side[(3 + i) % 4].location;
2338    else if (!strcmp(source, "elm.event.resize.tl"))
2339      sd->resize_location = _border_corner[(0 + i) % 4].location;
2340    else if (!strcmp(source, "elm.event.resize.tr"))
2341      sd->resize_location = _border_corner[(3 + i) % 4].location;
2342    else if (!strcmp(source, "elm.event.resize.bl"))
2343      sd->resize_location = _border_corner[(1 + i) % 4].location;
2344    else if (!strcmp(source, "elm.event.resize.br"))
2345      sd->resize_location = _border_corner[(2 + i) % 4].location;
2346    else
2347      sd->resize_location = 0;
2348
2349    if (sd->resize_location > 0)
2350      ecore_evas_wayland_resize(sd->ee, sd->resize_location);
2351 #else
2352    (void)data;
2353    (void)source;
2354 #endif
2355 }
2356
2357 static void
2358 _elm_win_frame_cb_minimize(void *data,
2359                            Evas_Object *obj __UNUSED__,
2360                            const char *sig __UNUSED__,
2361                            const char *source __UNUSED__)
2362 {
2363    ELM_WIN_DATA_GET(data, sd);
2364
2365    if (!sd) return;
2366 //   sd->iconified = EINA_TRUE;
2367    TRAP(sd, iconified_set, EINA_TRUE);
2368 }
2369
2370 static void
2371 _elm_win_frame_maximized_state_update(Elm_Win_Smart_Data *sd, Eina_Bool maximized)
2372 {
2373    const char *emission;
2374
2375    if (maximized)
2376      emission = "elm,state,maximized";
2377    else
2378      emission = "elm,state,unmaximized";
2379
2380    edje_object_signal_emit(sd->frame_obj, emission, "elm");
2381    edje_object_message_signal_process(sd->frame_obj);
2382    evas_object_smart_calculate(sd->frame_obj);
2383
2384    _elm_win_frame_obj_update(sd);
2385 }
2386
2387 static void
2388 _elm_win_frame_cb_maximize(void *data,
2389                            Evas_Object *obj __UNUSED__,
2390                            const char *sig __UNUSED__,
2391                            const char *source __UNUSED__)
2392 {
2393    Eina_Bool value;
2394    ELM_WIN_DATA_GET(data, sd);
2395
2396    if (!sd) return;
2397    if (sd->maximized) value = EINA_FALSE;
2398    else value = EINA_TRUE;
2399
2400    _elm_win_frame_maximized_state_update(sd, value);
2401
2402    TRAP(sd, maximized_set, value);
2403 }
2404
2405 static void
2406 _elm_win_frame_cb_close(void *data,
2407                         Evas_Object *obj __UNUSED__,
2408                         const char *sig __UNUSED__,
2409                         const char *source __UNUSED__)
2410 {
2411    ELM_WIN_DATA_GET(data, sd);
2412    Evas_Object *win;
2413
2414    /* FIXME: After the current freeze, this should be handled differently.
2415     *
2416     * Ideally, we would want to mimic the X11 backend and use something
2417     * like ECORE_WL_EVENT_WINDOW_DELETE and handle the delete_request
2418     * inside of ecore_evas. That would be the 'proper' way, but since we are
2419     * in a freeze right now, I cannot add a new event value, or a new
2420     * event structure to ecore_wayland.
2421     *
2422     * So yes, this is a temporary 'stop-gap' solution which will be fixed
2423     * when the freeze is over, but it does fix a trac bug for now, and in a
2424     * way which does not break API or the freeze. - dh
2425     */
2426
2427    if (!sd) return;
2428
2429    win = sd->obj;
2430
2431    int autodel = sd->autodel;
2432    sd->autodel_clear = &autodel;
2433    evas_object_ref(win);
2434    evas_object_smart_callback_call(win, SIG_DELETE_REQUEST, NULL);
2435    // FIXME: if above callback deletes - then the below will be invalid
2436    if (autodel) evas_object_del(win);
2437    else sd->autodel_clear = NULL;
2438    evas_object_unref(win);
2439 }
2440
2441 static void
2442 _elm_win_frame_add(Elm_Win_Smart_Data *sd,
2443                    const char *style)
2444 {
2445    Evas_Object *obj = sd->obj;
2446    int w, h, mw, mh;
2447    short layer;
2448
2449    sd->frame_obj = edje_object_add(sd->evas);
2450    layer = evas_object_layer_get(obj);
2451    evas_object_layer_set(sd->frame_obj, layer + 1);
2452    if (!elm_widget_theme_object_set
2453        (sd->obj, sd->frame_obj, "border", "base", style))
2454      {
2455         evas_object_del(sd->frame_obj);
2456         sd->frame_obj = NULL;
2457         return;
2458      }
2459
2460    sd->spacer_obj = evas_object_rectangle_add(sd->evas);
2461    evas_object_color_set(sd->spacer_obj, 0, 0, 0, 0);
2462    evas_object_repeat_events_set(sd->spacer_obj, EINA_TRUE);
2463    edje_object_part_swallow(sd->frame_obj, "elm.swallow.frame_spacer",
2464                             sd->spacer_obj);
2465
2466    sd->client_obj = evas_object_rectangle_add(sd->evas);
2467    evas_object_color_set(sd->client_obj, 0, 0, 0, 0);
2468    /* NB: Tried pass_events here, but that fails to send events */
2469    evas_object_repeat_events_set(sd->client_obj, EINA_TRUE);
2470    edje_object_part_swallow(sd->frame_obj, "elm.swallow.client",
2471                             sd->client_obj);
2472
2473    evas_object_is_frame_object_set(sd->frame_obj, EINA_TRUE);
2474
2475    evas_object_event_callback_add
2476      (sd->frame_obj, EVAS_CALLBACK_MOVE, _elm_win_frame_obj_move, sd);
2477    evas_object_event_callback_add
2478      (sd->frame_obj, EVAS_CALLBACK_RESIZE, _elm_win_frame_obj_resize, sd);
2479
2480    /* NB: Do NOT remove these calls !! Needed to calculate proper
2481     * framespace on inital show of the window */
2482    edje_object_size_min_calc(sd->frame_obj, &mw, &mh);
2483    evas_object_move(sd->frame_obj, 0, 0);
2484    evas_object_resize(sd->frame_obj, mw, mh);
2485    evas_object_smart_calculate(sd->frame_obj);
2486
2487    edje_object_signal_callback_add
2488      (sd->frame_obj, "elm,action,move,start", "elm",
2489      _elm_win_frame_cb_move_start, obj);
2490    edje_object_signal_callback_add
2491      (sd->frame_obj, "elm,action,move,stop", "elm",
2492      _elm_win_frame_cb_move_stop, obj);
2493    edje_object_signal_callback_add
2494      (sd->frame_obj, "elm,action,resize,show", "*",
2495      _elm_win_frame_cb_resize_show, obj);
2496    edje_object_signal_callback_add
2497      (sd->frame_obj, "elm,action,resize,hide", "*",
2498      _elm_win_frame_cb_resize_hide, obj);
2499    edje_object_signal_callback_add
2500      (sd->frame_obj, "elm,action,resize,start", "*",
2501      _elm_win_frame_cb_resize_start, obj);
2502    edje_object_signal_callback_add
2503      (sd->frame_obj, "elm,action,minimize", "elm",
2504      _elm_win_frame_cb_minimize, obj);
2505    edje_object_signal_callback_add
2506      (sd->frame_obj, "elm,action,maximize", "elm",
2507      _elm_win_frame_cb_maximize, obj);
2508    edje_object_signal_callback_add
2509      (sd->frame_obj, "elm,action,close", "elm", _elm_win_frame_cb_close, obj);
2510
2511    if (sd->title)
2512      {
2513         edje_object_part_text_escaped_set
2514           (sd->frame_obj, "elm.text.title", sd->title);
2515      }
2516
2517    ecore_evas_geometry_get(sd->ee, NULL, NULL, &w, &h);
2518    ecore_evas_resize(sd->ee, w, h);
2519 }
2520
2521 static void
2522 _elm_win_frame_del(Elm_Win_Smart_Data *sd)
2523 {
2524    int w, h;
2525
2526    if (sd->client_obj)
2527      {
2528         evas_object_del(sd->client_obj);
2529         sd->client_obj = NULL;
2530      }
2531
2532    if (sd->frame_obj)
2533      {
2534         evas_object_event_callback_del_full
2535           (sd->frame_obj, EVAS_CALLBACK_MOVE, _elm_win_frame_obj_move, sd);
2536         evas_object_event_callback_del_full
2537           (sd->frame_obj, EVAS_CALLBACK_RESIZE, _elm_win_frame_obj_resize, sd);
2538
2539         edje_object_signal_callback_del
2540           (sd->frame_obj, "elm,action,move,start", "elm",
2541               _elm_win_frame_cb_move_start);
2542         edje_object_signal_callback_del
2543           (sd->frame_obj, "elm,action,move,stop", "elm",
2544               _elm_win_frame_cb_move_stop);
2545         edje_object_signal_callback_del
2546           (sd->frame_obj, "elm,action,resize,show", "*",
2547               _elm_win_frame_cb_resize_show);
2548         edje_object_signal_callback_del
2549           (sd->frame_obj, "elm,action,resize,hide", "*",
2550               _elm_win_frame_cb_resize_hide);
2551         edje_object_signal_callback_del
2552           (sd->frame_obj, "elm,action,resize,start", "*",
2553               _elm_win_frame_cb_resize_start);
2554         edje_object_signal_callback_del
2555           (sd->frame_obj, "elm,action,minimize", "elm",
2556               _elm_win_frame_cb_minimize);
2557         edje_object_signal_callback_del
2558           (sd->frame_obj, "elm,action,maximize", "elm",
2559               _elm_win_frame_cb_maximize);
2560         edje_object_signal_callback_del
2561           (sd->frame_obj, "elm,action,close", "elm",
2562               _elm_win_frame_cb_close);
2563
2564         evas_object_del(sd->frame_obj);
2565         sd->frame_obj = NULL;
2566      }
2567
2568    evas_output_framespace_set(sd->evas, 0, 0, 0, 0);
2569    ecore_evas_geometry_get(sd->ee, NULL, NULL, &w, &h);
2570    ecore_evas_resize(sd->ee, w, h);
2571 }
2572
2573 #ifdef ELM_DEBUG
2574 static void
2575 _debug_key_down(void *data __UNUSED__,
2576                 Evas *e __UNUSED__,
2577                 Evas_Object *obj,
2578                 void *event_info)
2579 {
2580    Evas_Event_Key_Down *ev = event_info;
2581
2582    if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
2583      return;
2584
2585    if ((strcmp(ev->key, "F12")) ||
2586        (!evas_key_modifier_is_set(ev->modifiers, "Control")))
2587      return;
2588
2589    INF("Tree graph generated.");
2590    elm_object_tree_dot_dump(obj, "./dump.dot");
2591 }
2592
2593 #endif
2594
2595 static void
2596 _win_img_hide(void *data,
2597               Evas *e __UNUSED__,
2598               Evas_Object *obj __UNUSED__,
2599               void *event_info __UNUSED__)
2600 {
2601    elm_widget_focus_hide_handle(data);
2602 }
2603
2604 static void
2605 _win_img_mouse_up(void *data,
2606                   Evas *e __UNUSED__,
2607                   Evas_Object *obj __UNUSED__,
2608                   void *event_info)
2609 {
2610    Evas_Event_Mouse_Up *ev = event_info;
2611    if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
2612      elm_widget_focus_mouse_up_handle(data);
2613 }
2614
2615 static void
2616 _win_img_focus_in(void *data,
2617                   Evas *e __UNUSED__,
2618                   Evas_Object *obj __UNUSED__,
2619                   void *event_info __UNUSED__)
2620 {
2621    elm_widget_focus_steal(data);
2622 }
2623
2624 static void
2625 _win_img_focus_out(void *data,
2626                    Evas *e __UNUSED__,
2627                    Evas_Object *obj __UNUSED__,
2628                    void *event_info __UNUSED__)
2629 {
2630    elm_widget_focused_object_clear(data);
2631 }
2632
2633 static void
2634 _win_inlined_image_set(Elm_Win_Smart_Data *sd)
2635 {
2636    evas_object_image_alpha_set(sd->img_obj, EINA_FALSE);
2637    evas_object_image_filled_set(sd->img_obj, EINA_TRUE);
2638
2639    evas_object_event_callback_add
2640      (sd->img_obj, EVAS_CALLBACK_DEL, _elm_win_on_img_obj_del, sd->obj);
2641    evas_object_event_callback_add
2642      (sd->img_obj, EVAS_CALLBACK_HIDE, _win_img_hide, sd->obj);
2643    evas_object_event_callback_add
2644      (sd->img_obj, EVAS_CALLBACK_MOUSE_UP, _win_img_mouse_up, sd->obj);
2645    evas_object_event_callback_add
2646      (sd->img_obj, EVAS_CALLBACK_FOCUS_IN, _win_img_focus_in, sd->obj);
2647    evas_object_event_callback_add
2648      (sd->img_obj, EVAS_CALLBACK_FOCUS_OUT, _win_img_focus_out, sd->obj);
2649 }
2650
2651 static void
2652 _elm_win_on_icon_del(void *data,
2653                      Evas *e __UNUSED__,
2654                      Evas_Object *obj,
2655                      void *event_info __UNUSED__)
2656 {
2657    ELM_WIN_DATA_GET(data, sd);
2658
2659    if (sd->icon == obj) sd->icon = NULL;
2660 }
2661
2662 static void
2663 _elm_win_smart_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
2664 {
2665    eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
2666
2667    elm_widget_can_focus_set(obj, EINA_TRUE);
2668
2669    elm_widget_highlight_ignore_set(obj, EINA_TRUE);
2670 }
2671
2672 #ifdef HAVE_ELEMENTARY_X
2673 static void
2674 _elm_x_io_err(void *data __UNUSED__)
2675 {
2676    Eina_List *l;
2677    Evas_Object *obj;
2678
2679    EINA_LIST_FOREACH(_elm_win_list, l, obj)
2680      evas_object_smart_callback_call(obj, SIG_IOERR, NULL);
2681    elm_exit();
2682 }
2683 #endif
2684
2685 EAPI Evas_Object *
2686 elm_win_add(Evas_Object *parent,
2687             const char *name,
2688             Elm_Win_Type type)
2689 {
2690    Evas_Object *obj = eo_add_custom(MY_CLASS, parent, elm_obj_win_constructor(name, type));
2691    eo_unref(obj);
2692    return obj;
2693 }
2694
2695 static void
2696 _elm_win_cb_hide(void *data __UNUSED__,
2697                  Evas *e __UNUSED__,
2698                  Evas_Object *obj __UNUSED__,
2699                  void *event_info __UNUSED__)
2700 {
2701    _elm_win_state_eval_queue();
2702 }
2703
2704 static void
2705 _elm_win_cb_show(void *data __UNUSED__,
2706                  Evas *e __UNUSED__,
2707                  Evas_Object *obj __UNUSED__,
2708                  void *event_info __UNUSED__)
2709 {
2710    _elm_win_state_eval_queue();
2711 }
2712
2713 /**
2714   * @internal
2715   *
2716   * Recalculate the size of window considering its resize objects' weight and
2717   * min size. If any of its resize objects' weight equals to 0.0, window
2718   * layout's weight will be set to 0.0.
2719   *
2720   * @param o box object
2721   * @param p box's private data
2722   * @param data window object
2723   */
2724 static void
2725 _window_layout_stack(Evas_Object *o, Evas_Object_Box_Data *p, void *data)
2726 {
2727    const Eina_List *l;
2728    Evas_Object *child;
2729    Evas_Object_Box_Option *opt;
2730    Evas_Coord x, y, w, h;
2731    double wx, wy;
2732    Evas_Coord minw = -1, minh = -1;
2733    double weight_x = EVAS_HINT_EXPAND;
2734    double weight_y = EVAS_HINT_EXPAND;
2735
2736    EINA_LIST_FOREACH(p->children, l, opt)
2737      {
2738         child = opt->obj;
2739         evas_object_size_hint_weight_get(child, &wx, &wy);
2740         if (wx == 0.0) weight_x = 0;
2741         if (wy == 0.0) weight_y = 0;
2742
2743         evas_object_size_hint_min_get(child, &w, &h);
2744         if (w > minw) minw = w;
2745         if (h > minh) minh = h;
2746      }
2747
2748    evas_object_size_hint_min_set(o, minw, minh);
2749    evas_object_geometry_get(o, &x, &y, &w, &h);
2750    if (w < minw) w = minw;
2751    if (h < minh) h = minh;
2752    evas_object_resize(o, w, h);
2753
2754    EINA_LIST_FOREACH(p->children, l, opt)
2755      {
2756         child = opt->obj;
2757         evas_object_move(child, x, y);
2758         evas_object_resize(child, w, h);
2759      }
2760
2761    ELM_WIN_DATA_GET(data, sd);
2762    evas_object_size_hint_weight_set(sd->layout, weight_x, weight_y);
2763    evas_object_smart_changed(sd->layout);
2764 }
2765
2766 static void
2767 _win_constructor(Eo *obj, void *_pd, va_list *list)
2768 {
2769    Elm_Win_Smart_Data *sd = _pd;
2770    sd->obj = obj; // in ctor
2771
2772    const char *name = va_arg(*list, const char *);
2773    Elm_Win_Type type = va_arg(*list, Elm_Win_Type);
2774    Evas_Object *parent;
2775    Evas *e;
2776    const Eina_List *l;
2777    const char *fontpath, *fallback = NULL;
2778
2779    Elm_Win_Smart_Data tmp_sd;
2780
2781    eo_do(obj, eo_parent_get(&parent));
2782
2783    /* just to store some data while trying out to create a canvas */
2784    memset(&tmp_sd, 0, sizeof(Elm_Win_Smart_Data));
2785
2786 #define FALLBACK_TRY(engine)                                      \
2787   if (!tmp_sd.ee) {                                               \
2788      CRITICAL(engine " engine creation failed. Trying default."); \
2789   } while (0)
2790 #define FALLBACK_STORE(engine)                               \
2791    if (tmp_sd.ee)                                            \
2792    {                                                         \
2793       CRITICAL(engine "Fallback to %s successful.", engine); \
2794       fallback = engine;                                     \
2795    }
2796
2797    switch (type)
2798      {
2799       case ELM_WIN_INLINED_IMAGE:
2800         if (!parent) break;
2801         {
2802            e = evas_object_evas_get(parent);
2803            Ecore_Evas *ee;
2804
2805            if (!e) break;
2806
2807            ee = ecore_evas_ecore_evas_get(e);
2808            if (!ee) break;
2809
2810            tmp_sd.img_obj = ecore_evas_object_image_new(ee);
2811            if (!tmp_sd.img_obj) break;
2812
2813            tmp_sd.ee = ecore_evas_object_ecore_evas_get(tmp_sd.img_obj);
2814            if (!tmp_sd.ee)
2815              {
2816                 evas_object_del(tmp_sd.img_obj);
2817                 tmp_sd.img_obj = NULL;
2818              }
2819         }
2820         break;
2821
2822       case ELM_WIN_SOCKET_IMAGE:
2823         tmp_sd.ee = ecore_evas_extn_socket_new(1, 1);
2824         break;
2825
2826       default:
2827         if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
2828           {
2829              tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2830              FALLBACK_TRY("Software X11");
2831              if (!tmp_sd.ee)
2832                {
2833                   tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2834                   FALLBACK_STORE("Software FB");
2835                }
2836           }
2837         else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
2838           {
2839              tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2840              FALLBACK_TRY("Software FB");
2841              if (!tmp_sd.ee)
2842                {
2843                   tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2844                   FALLBACK_STORE("Software X11");
2845                }
2846           }
2847         else if (ENGINE_COMPARE(ELM_OPENGL_X11))
2848           {
2849              int opt[10];
2850              int opt_i = 0;
2851
2852              if (_elm_config->vsync)
2853                {
2854                   opt[opt_i] = ECORE_EVAS_GL_X11_OPT_VSYNC;
2855                   opt_i++;
2856                   opt[opt_i] = 1;
2857                   opt_i++;
2858                   opt[opt_i] = 0;
2859                }
2860              if (opt_i > 0)
2861                tmp_sd.ee = ecore_evas_gl_x11_options_new
2862                    (NULL, 0, 0, 0, 1, 1, opt);
2863              else
2864                tmp_sd.ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
2865              FALLBACK_TRY("OpenGL");
2866              if (!tmp_sd.ee)
2867                {
2868                   tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2869                   FALLBACK_STORE("Software X11");
2870                   if (!tmp_sd.ee)
2871                     {
2872                        tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2873                        FALLBACK_STORE("Software FB");
2874                     }
2875                }
2876           }
2877         else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
2878           {
2879              tmp_sd.ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
2880              FALLBACK_TRY("Software Win32");
2881           }
2882         else if (ENGINE_COMPARE(ELM_SOFTWARE_PSL1GHT))
2883           {
2884              tmp_sd.ee = ecore_evas_psl1ght_new(NULL, 1, 1);
2885              FALLBACK_TRY("PSL1GHT");
2886           }
2887         else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
2888           {
2889              tmp_sd.ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
2890              FALLBACK_TRY("Software SDL");
2891              if (!tmp_sd.ee)
2892                {
2893                   tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2894                   FALLBACK_STORE("Software X11");
2895                   if (!tmp_sd.ee)
2896                     {
2897                        tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2898                        FALLBACK_STORE("Software FB");
2899                     }
2900                }
2901           }
2902         else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
2903           {
2904              tmp_sd.ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
2905              FALLBACK_TRY("Software-16-SDL");
2906              if (!tmp_sd.ee)
2907                {
2908                   tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2909                   FALLBACK_STORE("Software X11");
2910                   if (!tmp_sd.ee)
2911                     {
2912                        tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2913                        FALLBACK_STORE("Software FB");
2914                     }
2915                }
2916           }
2917         else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
2918           {
2919              tmp_sd.ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
2920              FALLBACK_TRY("OpenGL SDL");
2921              if (!tmp_sd.ee)
2922                {
2923                   tmp_sd.ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
2924                   FALLBACK_STORE("Software X11");
2925                   if (!tmp_sd.ee)
2926                     {
2927                        tmp_sd.ee = ecore_evas_fb_new(NULL, 0, 1, 1);
2928                        FALLBACK_STORE("Software FB");
2929                     }
2930                }
2931           }
2932         else if (ENGINE_COMPARE(ELM_OPENGL_COCOA))
2933           {
2934              tmp_sd.ee = ecore_evas_cocoa_new(NULL, 1, 1, 0, 0);
2935              FALLBACK_TRY("OpenGL Cocoa");
2936           }
2937         else if (ENGINE_COMPARE(ELM_BUFFER))
2938           {
2939              tmp_sd.ee = ecore_evas_buffer_new(1, 1);
2940           }
2941         else if (ENGINE_COMPARE(ELM_EWS))
2942           {
2943              tmp_sd.ee = ecore_evas_ews_new(0, 0, 1, 1);
2944           }
2945         else if (ENGINE_COMPARE(ELM_WAYLAND_SHM))
2946           {
2947              tmp_sd.ee = ecore_evas_wayland_shm_new(NULL, 0, 0, 0, 1, 1, 0);
2948           }
2949         else if (ENGINE_COMPARE(ELM_WAYLAND_EGL))
2950           {
2951              tmp_sd.ee = ecore_evas_wayland_egl_new(NULL, 0, 0, 0, 1, 1, 0);
2952           }
2953         else if (!strncmp(ENGINE_GET(), "shot:", 5))
2954           {
2955              tmp_sd.ee = ecore_evas_buffer_new(1, 1);
2956              ecore_evas_manual_render_set(tmp_sd.ee, EINA_TRUE);
2957              tmp_sd.shot.info = eina_stringshare_add
2958                  (ENGINE_GET() + 5);
2959           }
2960 #undef FALLBACK_TRY
2961         break;
2962      }
2963
2964    if (!tmp_sd.ee)
2965      {
2966         ERR("Cannot create window.");
2967         eo_error_set(obj);
2968         return;
2969      }
2970
2971    eo_do(obj, eo_parent_set(ecore_evas_get(tmp_sd.ee)));
2972    eo_do_super(obj, MY_CLASS, eo_constructor());
2973    eo_do(obj,
2974          evas_obj_type_set(MY_CLASS_NAME),
2975          evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL));
2976
2977    if (getenv("ELM_FIRST_FRAME"))
2978      evas_event_callback_add(ecore_evas_get(tmp_sd.ee), EVAS_CALLBACK_RENDER_POST,
2979                              _elm_win_first_frame_do, getenv("ELM_FIRST_FRAME"));
2980
2981    /* copying possibly altered fields back */
2982 #define SD_CPY(_field)             \
2983   do                               \
2984     {                              \
2985        sd->_field = tmp_sd._field; \
2986     } while (0)
2987
2988    SD_CPY(ee);
2989    SD_CPY(img_obj);
2990    SD_CPY(shot.info);
2991 #undef SD_CPY
2992
2993    if ((trap) && (trap->add))
2994      sd->trap_data = trap->add(obj);
2995
2996    /* complementary actions, which depend on final smart data
2997     * pointer */
2998    if (type == ELM_WIN_INLINED_IMAGE)
2999      _win_inlined_image_set(sd);
3000
3001 #ifdef HAVE_ELEMENTARY_X
3002    else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
3003             ENGINE_COMPARE(ELM_SOFTWARE_16_X11) ||
3004             ENGINE_COMPARE(ELM_SOFTWARE_8_X11) ||
3005             ENGINE_COMPARE(ELM_OPENGL_X11))
3006      {
3007         sd->x.client_message_handler = ecore_event_handler_add
3008             (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, obj);
3009         sd->x.property_handler = ecore_event_handler_add
3010             (ECORE_X_EVENT_WINDOW_PROPERTY, _elm_win_property_change, obj);
3011      }
3012 #endif
3013
3014    else if (!strncmp(ENGINE_GET(), "shot:", 5))
3015      _shot_init(sd);
3016
3017    sd->kbdmode = ELM_WIN_KEYBOARD_UNKNOWN;
3018    sd->indmode = ELM_WIN_INDICATOR_UNKNOWN;
3019
3020 #ifdef HAVE_ELEMENTARY_X
3021    _elm_win_xwindow_get(sd);
3022    if (sd->x.xwin)
3023      {
3024         ecore_x_io_error_handler_set(_elm_x_io_err, NULL);
3025      }
3026 #endif
3027
3028 #ifdef HAVE_ELEMENTARY_WAYLAND
3029    if ((ENGINE_COMPARE(ELM_WAYLAND_SHM)) || (ENGINE_COMPARE(ELM_WAYLAND_EGL)))
3030      sd->wl.win = ecore_evas_wayland_window_get(sd->ee);
3031 #endif
3032
3033    if ((_elm_config->bgpixmap)
3034 #ifdef HAVE_ELEMENTARY_X
3035        &&
3036        (((sd->x.xwin) && (!ecore_x_screen_is_composited(0))) ||
3037            (!sd->x.xwin)))
3038 #else
3039       )
3040 #endif
3041      TRAP(sd, avoid_damage_set, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
3042    // bg pixmap done by x - has other issues like can be redrawn by x before it
3043    // is filled/ready by app
3044    //     TRAP(sd, avoid_damage_set, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
3045
3046    sd->type = type;
3047    sd->parent = parent;
3048
3049    if (sd->parent)
3050      evas_object_event_callback_add
3051        (sd->parent, EVAS_CALLBACK_DEL, _elm_win_on_parent_del, obj);
3052
3053    sd->evas = ecore_evas_get(sd->ee);
3054
3055    evas_object_color_set(obj, 0, 0, 0, 0);
3056    evas_object_move(obj, 0, 0);
3057    evas_object_resize(obj, 1, 1);
3058    evas_object_layer_set(obj, 50);
3059    evas_object_pass_events_set(obj, EINA_TRUE);
3060
3061    if (type == ELM_WIN_INLINED_IMAGE)
3062      elm_widget_parent2_set(obj, parent);
3063
3064    /* use own version of ecore_evas_object_associate() that does TRAP() */
3065    ecore_evas_data_set(sd->ee, "elm_win", obj);
3066
3067    evas_object_event_callback_add
3068      (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3069       _elm_win_obj_callback_changed_size_hints, obj);
3070
3071    evas_object_intercept_raise_callback_add
3072      (obj, _elm_win_obj_intercept_raise, obj);
3073    evas_object_intercept_lower_callback_add
3074      (obj, _elm_win_obj_intercept_lower, obj);
3075    evas_object_intercept_stack_above_callback_add
3076      (obj, _elm_win_obj_intercept_stack_above, obj);
3077    evas_object_intercept_stack_below_callback_add
3078      (obj, _elm_win_obj_intercept_stack_below, obj);
3079    evas_object_intercept_layer_set_callback_add
3080      (obj, _elm_win_obj_intercept_layer_set, obj);
3081    evas_object_intercept_show_callback_add
3082      (obj, _elm_win_obj_intercept_show, obj);
3083
3084    TRAP(sd, name_class_set, name, _elm_appname);
3085    ecore_evas_callback_delete_request_set(sd->ee, _elm_win_delete_request);
3086    ecore_evas_callback_resize_set(sd->ee, _elm_win_resize);
3087    ecore_evas_callback_mouse_in_set(sd->ee, _elm_win_mouse_in);
3088    ecore_evas_callback_focus_in_set(sd->ee, _elm_win_focus_in);
3089    ecore_evas_callback_focus_out_set(sd->ee, _elm_win_focus_out);
3090    ecore_evas_callback_move_set(sd->ee, _elm_win_move);
3091    ecore_evas_callback_state_change_set(sd->ee, _elm_win_state_change);
3092    evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _elm_win_cb_hide, NULL);
3093    evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _elm_win_cb_show, NULL);
3094
3095    evas_image_cache_set(sd->evas, (_elm_config->image_cache * 1024));
3096    evas_font_cache_set(sd->evas, (_elm_config->font_cache * 1024));
3097
3098    EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
3099      evas_font_path_append(sd->evas, fontpath);
3100
3101    if (!_elm_config->font_hinting)
3102      evas_font_hinting_set(sd->evas, EVAS_FONT_HINTING_NONE);
3103    else if (_elm_config->font_hinting == 1)
3104      evas_font_hinting_set(sd->evas, EVAS_FONT_HINTING_AUTO);
3105    else if (_elm_config->font_hinting == 2)
3106      evas_font_hinting_set(sd->evas, EVAS_FONT_HINTING_BYTECODE);
3107
3108 #ifdef HAVE_ELEMENTARY_X
3109    _elm_win_xwin_update(sd);
3110 #endif
3111
3112    _elm_win_list = eina_list_append(_elm_win_list, obj);
3113    _elm_win_count++;
3114
3115    if (((fallback) && (!strcmp(fallback, "Software FB"))) ||
3116        ((!fallback) && (ENGINE_COMPARE(ELM_SOFTWARE_FB))))
3117      {
3118         TRAP(sd, fullscreen_set, 1);
3119      }
3120    else if ((type != ELM_WIN_INLINED_IMAGE) &&
3121             (ENGINE_COMPARE(ELM_WAYLAND_SHM) ||
3122              ENGINE_COMPARE(ELM_WAYLAND_EGL)))
3123      _elm_win_frame_add(sd, "default");
3124
3125    if (_elm_config->focus_highlight_enable)
3126      elm_win_focus_highlight_enabled_set(obj, EINA_TRUE);
3127    if (_elm_config->focus_highlight_animate)
3128      elm_win_focus_highlight_animate_set(obj, EINA_TRUE);
3129
3130 #ifdef ELM_DEBUG
3131    Evas_Modifier_Mask mask = evas_key_modifier_mask_get(sd->evas, "Control");
3132    evas_object_event_callback_add
3133      (obj, EVAS_CALLBACK_KEY_DOWN, _debug_key_down, NULL);
3134
3135    if (evas_object_key_grab(obj, "F12", mask, 0, EINA_TRUE))
3136      INF("Ctrl+F12 key combination exclusive for dot tree generation\n");
3137    else
3138      ERR("failed to grab F12 key to elm widgets (dot) tree generation");
3139 #endif
3140
3141    if ((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_ON) ||
3142        ((_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_AUTO) &&
3143            (((fallback) && (!strcmp(fallback, "Software FB"))) ||
3144                ((!fallback) && (ENGINE_COMPARE(ELM_SOFTWARE_FB))))))
3145      {
3146         Evas_Object *o;
3147         Evas_Coord mw = 1, mh = 1, hx = 0, hy = 0;
3148
3149         sd->pointer.obj = o = edje_object_add(ecore_evas_get(tmp_sd.ee));
3150         _elm_theme_object_set(obj, o, "pointer", "base", "default");
3151         edje_object_size_min_calc(o, &mw, &mh);
3152         evas_object_resize(o, mw, mh);
3153         edje_object_part_geometry_get(o, "elm.swallow.hotspot",
3154                                       &hx, &hy, NULL, NULL);
3155         sd->pointer.hot_x = hx;
3156         sd->pointer.hot_y = hy;
3157         evas_object_show(o);
3158         ecore_evas_object_cursor_set(tmp_sd.ee, o, EVAS_LAYER_MAX, hx, hy);
3159      }
3160    else if (_elm_config->softcursor_mode == ELM_SOFTCURSOR_MODE_OFF)
3161      {
3162         // do nothing
3163      }
3164
3165    sd->layout = edje_object_add(sd->evas);
3166    _elm_theme_object_set(obj, sd->layout, "win", "base", "default");
3167    sd->box = evas_object_box_add(sd->evas);
3168    evas_object_box_layout_set(sd->box, _window_layout_stack, obj, NULL);
3169    edje_object_part_swallow(sd->layout, "elm.swallow.contents", sd->box);
3170    evas_object_move(sd->layout, 0, 0);
3171    evas_object_resize(sd->layout, 1, 1);
3172    edje_object_update_hints_set(sd->layout, EINA_TRUE);
3173    evas_object_event_callback_add(sd->layout, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
3174                                   _elm_win_on_resize_obj_changed_size_hints, obj);
3175    evas_object_show(sd->layout);
3176 }
3177
3178 static void
3179 _constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
3180 {
3181    eo_error_set(obj);
3182    ERR("only custom constructor can be used with '%s' class", MY_CLASS_NAME);
3183 }
3184
3185 EAPI Evas_Object *
3186 elm_win_util_standard_add(const char *name,
3187                           const char *title)
3188 {
3189    Evas_Object *win, *bg;
3190
3191    win = elm_win_add(NULL, name, ELM_WIN_BASIC);
3192    if (!win) return NULL;
3193
3194    elm_win_title_set(win, title);
3195    bg = elm_bg_add(win);
3196    if (!bg)
3197      {
3198         evas_object_del(win);
3199         return NULL;
3200      }
3201    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
3202    elm_win_resize_object_add(win, bg);
3203    evas_object_show(bg);
3204
3205    return win;
3206 }
3207
3208 EAPI void
3209 elm_win_resize_object_add(Evas_Object *obj,
3210                           Evas_Object *subobj)
3211 {
3212    ELM_WIN_CHECK(obj);
3213    eo_do(obj, elm_obj_win_resize_object_add(subobj));
3214 }
3215
3216 static void
3217 _resize_object_add(Eo *obj, void *_pd, va_list *list)
3218 {
3219    Evas_Object *subobj = va_arg(*list, Evas_Object *);
3220
3221    Elm_Win_Smart_Data *sd = _pd;
3222
3223    elm_widget_sub_object_add(obj, subobj);
3224
3225    if (!evas_object_box_append(sd->box, subobj))
3226      ERR("could not append %p to box", subobj);
3227 }
3228
3229 EAPI void
3230 elm_win_resize_object_del(Evas_Object *obj,
3231                           Evas_Object *subobj)
3232 {
3233    ELM_WIN_CHECK(obj);
3234    eo_do(obj, elm_obj_win_resize_object_del(subobj));
3235 }
3236
3237 static void
3238 _resize_object_del(Eo *obj, void *_pd, va_list *list)
3239 {
3240    Evas_Object *subobj = va_arg(*list, Evas_Object *);
3241    Elm_Win_Smart_Data *sd = _pd;
3242
3243    if (!elm_widget_sub_object_del(obj, subobj))
3244      ERR("could not remove sub object %p from %p", subobj, obj);
3245
3246    evas_object_box_remove(sd->box, subobj);
3247 }
3248
3249 EAPI void
3250 elm_win_title_set(Evas_Object *obj,
3251                   const char *title)
3252 {
3253    ELM_WIN_CHECK(obj);
3254    eo_do(obj, elm_obj_win_title_set(title));
3255 }
3256
3257 static void
3258 _title_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3259 {
3260    const char *title = va_arg(*list, const char *);
3261    Elm_Win_Smart_Data *sd = _pd;
3262
3263    if (!title) return;
3264    eina_stringshare_replace(&(sd->title), title);
3265    TRAP(sd, title_set, sd->title);
3266    if (sd->frame_obj)
3267      edje_object_part_text_escaped_set
3268        (sd->frame_obj, "elm.text.title", sd->title);
3269 }
3270
3271 EAPI const char *
3272 elm_win_title_get(const Evas_Object *obj)
3273 {
3274    ELM_WIN_CHECK(obj) NULL;
3275    const char *ret = NULL;
3276    eo_do((Eo *) obj, elm_obj_win_title_get(&ret));
3277    return ret;
3278 }
3279
3280 static void
3281 _title_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3282 {
3283    const char **ret = va_arg(*list, const char **);
3284    Elm_Win_Smart_Data *sd = _pd;
3285    *ret = sd->title;
3286 }
3287
3288 EAPI void
3289 elm_win_icon_name_set(Evas_Object *obj,
3290                       const char *icon_name)
3291 {
3292    ELM_WIN_CHECK(obj);
3293    eo_do(obj, elm_obj_win_icon_name_set(icon_name));
3294 }
3295
3296 static void
3297 _icon_name_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3298 {
3299    const char *icon_name = va_arg(*list, const char *);
3300    Elm_Win_Smart_Data *sd = _pd;
3301
3302    if (!icon_name) return;
3303    eina_stringshare_replace(&(sd->icon_name), icon_name);
3304 #ifdef HAVE_ELEMENTARY_X
3305    _elm_win_xwin_update(sd);
3306 #endif
3307 }
3308
3309 EAPI const char *
3310 elm_win_icon_name_get(const Evas_Object *obj)
3311 {
3312    ELM_WIN_CHECK(obj) NULL;
3313    const char *ret = NULL;
3314    eo_do((Eo *) obj, elm_obj_win_icon_name_get(&ret));
3315    return ret;
3316 }
3317
3318 static void
3319 _icon_name_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3320 {
3321    const char **ret = va_arg(*list, const char **);
3322    Elm_Win_Smart_Data *sd = _pd;
3323    *ret = sd->icon_name;
3324 }
3325
3326 EAPI void
3327 elm_win_role_set(Evas_Object *obj, const char *role)
3328 {
3329    ELM_WIN_CHECK(obj);
3330    eo_do(obj, elm_obj_win_role_set(role));
3331 }
3332
3333 static void
3334 _role_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3335 {
3336    const char *role = va_arg(*list, const char *);
3337    Elm_Win_Smart_Data *sd = _pd;
3338
3339    if (!role) return;
3340    eina_stringshare_replace(&(sd->role), role);
3341 #ifdef HAVE_ELEMENTARY_X
3342    _elm_win_xwin_update(sd);
3343 #endif
3344 }
3345
3346 EAPI const char *
3347 elm_win_role_get(const Evas_Object *obj)
3348 {
3349    ELM_WIN_CHECK(obj) NULL;
3350    const char *ret = NULL;
3351    eo_do((Eo *) obj, elm_obj_win_role_get(&ret));
3352    return ret;
3353 }
3354
3355 static void
3356 _role_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3357 {
3358    const char **ret = va_arg(*list, const char **);
3359    Elm_Win_Smart_Data *sd = _pd;
3360    *ret = sd->role;
3361 }
3362
3363 EAPI void
3364 elm_win_icon_object_set(Evas_Object *obj,
3365                         Evas_Object *icon)
3366 {
3367    ELM_WIN_CHECK(obj);
3368    eo_do(obj, elm_obj_win_icon_object_set(icon));
3369 }
3370
3371 static void
3372 _icon_object_set(Eo *obj, void *_pd, va_list *list)
3373 {
3374    Evas_Object *icon = va_arg(*list, Evas_Object *);
3375    Elm_Win_Smart_Data *sd = _pd;
3376
3377    if (sd->icon)
3378      evas_object_event_callback_del_full
3379        (sd->icon, EVAS_CALLBACK_DEL, _elm_win_on_icon_del, obj);
3380    sd->icon = icon;
3381    if (sd->icon)
3382      evas_object_event_callback_add
3383        (sd->icon, EVAS_CALLBACK_DEL, _elm_win_on_icon_del, obj);
3384 #ifdef HAVE_ELEMENTARY_X
3385    _elm_win_xwin_update(sd);
3386 #endif
3387 }
3388
3389 EAPI const Evas_Object *
3390 elm_win_icon_object_get(const Evas_Object *obj)
3391 {
3392    ELM_WIN_CHECK(obj) NULL;
3393    const Evas_Object *ret = NULL;
3394    eo_do((Eo *) obj, elm_obj_win_icon_object_get(&ret));
3395    return ret;
3396 }
3397
3398 static void
3399 _icon_object_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3400 {
3401    const Evas_Object **ret = va_arg(*list, const Evas_Object **);
3402    Elm_Win_Smart_Data *sd = _pd;
3403    *ret = sd->icon;
3404 }
3405
3406 EAPI void
3407 elm_win_autodel_set(Evas_Object *obj,
3408                     Eina_Bool autodel)
3409 {
3410    ELM_WIN_CHECK(obj);
3411    eo_do(obj, elm_obj_win_autodel_set(autodel));
3412 }
3413
3414 static void
3415 _autodel_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3416 {
3417    Eina_Bool autodel = va_arg(*list, int);
3418    Elm_Win_Smart_Data *sd = _pd;
3419    sd->autodel = autodel;
3420 }
3421
3422 EAPI Eina_Bool
3423 elm_win_autodel_get(const Evas_Object *obj)
3424 {
3425    ELM_WIN_CHECK(obj) EINA_FALSE;
3426    Eina_Bool ret = EINA_FALSE;
3427    eo_do((Eo *) obj, elm_obj_win_autodel_get(&ret));
3428    return ret;
3429 }
3430
3431 static void
3432 _autodel_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3433 {
3434    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
3435    Elm_Win_Smart_Data *sd = _pd;
3436    *ret = sd->autodel;
3437 }
3438
3439 EAPI void
3440 elm_win_activate(Evas_Object *obj)
3441 {
3442    ELM_WIN_CHECK(obj);
3443    eo_do(obj, elm_obj_win_activate());
3444 }
3445
3446 static void
3447 _activate(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
3448 {
3449    Elm_Win_Smart_Data *sd = _pd;
3450    TRAP(sd, activate);
3451 }
3452
3453 EAPI void
3454 elm_win_lower(Evas_Object *obj)
3455 {
3456    ELM_WIN_CHECK(obj);
3457    eo_do(obj, elm_obj_win_lower());
3458 }
3459
3460 static void
3461 _lower(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
3462 {
3463    Elm_Win_Smart_Data *sd = _pd;
3464    TRAP(sd, lower);
3465 }
3466
3467 EAPI void
3468 elm_win_raise(Evas_Object *obj)
3469 {
3470    ELM_WIN_CHECK(obj);
3471    eo_do(obj, elm_obj_win_raise());
3472 }
3473
3474 static void
3475 _raise(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
3476 {
3477    Elm_Win_Smart_Data *sd = _pd;
3478    TRAP(sd, raise);
3479 }
3480
3481 EAPI void
3482 elm_win_center(Evas_Object *obj,
3483                Eina_Bool h,
3484                Eina_Bool v)
3485 {
3486    ELM_WIN_CHECK(obj);
3487    eo_do(obj, elm_obj_win_center(h, v));
3488 }
3489
3490 static void
3491 _center(Eo *obj, void *_pd, va_list *list)
3492 {
3493    Eina_Bool h = va_arg(*list, int);
3494    Eina_Bool v = va_arg(*list, int);
3495    int win_w, win_h, screen_w, screen_h, nx, ny;
3496
3497    Elm_Win_Smart_Data *sd = _pd;
3498
3499    if ((trap) && (trap->center) && (!trap->center(sd->trap_data, obj)))
3500      return;
3501
3502    ecore_evas_screen_geometry_get(sd->ee, NULL, NULL, &screen_w, &screen_h);
3503    if ((!screen_w) || (!screen_h)) return;
3504
3505    evas_object_geometry_get(obj, NULL, NULL, &win_w, &win_h);
3506    if ((!win_w) || (!win_h)) return;
3507
3508    if (h) nx = win_w >= screen_w ? 0 : (screen_w / 2) - (win_w / 2);
3509    else nx = sd->screen.x;
3510    if (v) ny = win_h >= screen_h ? 0 : (screen_h / 2) - (win_h / 2);
3511    else ny = sd->screen.y;
3512    if (nx < 0) nx = 0;
3513    if (ny < 0) ny = 0;
3514
3515    evas_object_move(obj, nx, ny);
3516 }
3517
3518 EAPI void
3519 elm_win_borderless_set(Evas_Object *obj,
3520                        Eina_Bool borderless)
3521 {
3522    ELM_WIN_CHECK(obj);
3523    eo_do(obj, elm_obj_win_borderless_set(borderless));
3524 }
3525
3526 static void
3527 _borderless_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3528 {
3529    Eina_Bool borderless = va_arg(*list, int);
3530    Elm_Win_Smart_Data *sd = _pd;
3531
3532    if (borderless)
3533      {
3534         if (EE_ENGINE_COMPARE(sd->ee, ELM_WAYLAND_SHM) ||
3535             EE_ENGINE_COMPARE(sd->ee, ELM_WAYLAND_EGL))
3536           _elm_win_frame_del(sd);
3537      }
3538    else
3539      {
3540         if (EE_ENGINE_COMPARE(sd->ee, ELM_WAYLAND_SHM) ||
3541             EE_ENGINE_COMPARE(sd->ee, ELM_WAYLAND_EGL))
3542           _elm_win_frame_add(sd, "default");
3543
3544         if (sd->frame_obj)
3545           evas_object_show(sd->frame_obj);
3546      }
3547
3548    TRAP(sd, borderless_set, borderless);
3549 #ifdef HAVE_ELEMENTARY_X
3550    _elm_win_xwin_update(sd);
3551 #endif
3552 }
3553
3554 EAPI Eina_Bool
3555 elm_win_borderless_get(const Evas_Object *obj)
3556 {
3557    ELM_WIN_CHECK(obj) EINA_FALSE;
3558    Eina_Bool ret = EINA_FALSE;
3559    eo_do((Eo *) obj, elm_obj_win_borderless_get(&ret));
3560    return ret;
3561 }
3562
3563 static void
3564 _borderless_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3565 {
3566    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
3567    Elm_Win_Smart_Data *sd = _pd;
3568    *ret = ecore_evas_borderless_get(sd->ee);
3569 }
3570
3571 EAPI void
3572 elm_win_shaped_set(Evas_Object *obj,
3573                    Eina_Bool shaped)
3574 {
3575    ELM_WIN_CHECK(obj);
3576    eo_do(obj, elm_obj_win_shaped_set(shaped));
3577 }
3578
3579 static void
3580 _shaped_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3581 {
3582    Eina_Bool shaped = va_arg(*list, int);
3583    Elm_Win_Smart_Data *sd = _pd;
3584
3585    TRAP(sd, shaped_set, shaped);
3586 #ifdef HAVE_ELEMENTARY_X
3587    _elm_win_xwin_update(sd);
3588 #endif
3589 }
3590
3591 EAPI Eina_Bool
3592 elm_win_shaped_get(const Evas_Object *obj)
3593 {
3594    ELM_WIN_CHECK(obj) EINA_FALSE;
3595    Eina_Bool ret = EINA_FALSE;
3596    eo_do((Eo *) obj, elm_obj_win_shaped_get(&ret));
3597    return ret;
3598 }
3599
3600 static void
3601 _shaped_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3602 {
3603    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
3604    Elm_Win_Smart_Data *sd = _pd;
3605    *ret = ecore_evas_shaped_get(sd->ee);
3606 }
3607
3608 EAPI void
3609 elm_win_alpha_set(Evas_Object *obj,
3610                   Eina_Bool enabled)
3611 {
3612    ELM_WIN_CHECK(obj);
3613    eo_do(obj, elm_obj_win_alpha_set(enabled));
3614 }
3615
3616 static void
3617 _alpha_set(Eo *obj, void *_pd, va_list *list)
3618 {
3619    Eina_Bool enabled = va_arg(*list, int);
3620    Elm_Win_Smart_Data *sd = _pd;
3621
3622    if (sd->img_obj)
3623      {
3624         evas_object_image_alpha_set(sd->img_obj, enabled);
3625         ecore_evas_alpha_set(sd->ee, enabled);
3626      }
3627    else
3628      {
3629 #ifdef HAVE_ELEMENTARY_X
3630         if (sd->x.xwin)
3631           {
3632              if (enabled)
3633                {
3634                   if (!ecore_x_screen_is_composited(0))
3635                     elm_win_shaped_set(obj, enabled);
3636                   else
3637                     TRAP(sd, alpha_set, enabled);
3638                }
3639              else
3640                TRAP(sd, alpha_set, enabled);
3641              _elm_win_xwin_update(sd);
3642           }
3643         else
3644 #endif
3645           TRAP(sd, alpha_set, enabled);
3646      }
3647 }
3648
3649 EAPI Eina_Bool
3650 elm_win_alpha_get(const Evas_Object *obj)
3651 {
3652    ELM_WIN_CHECK(obj) EINA_FALSE;
3653    Eina_Bool ret = EINA_FALSE;
3654    eo_do((Eo *) obj, elm_obj_win_alpha_get(&ret));
3655    return ret;
3656 }
3657
3658 static void
3659 _alpha_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3660 {
3661    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
3662    Elm_Win_Smart_Data *sd = _pd;
3663
3664    if (sd->img_obj)
3665      {
3666         *ret = evas_object_image_alpha_get(sd->img_obj);
3667      }
3668    else
3669      {
3670         *ret = ecore_evas_alpha_get(sd->ee);
3671      }
3672 }
3673
3674 EAPI void
3675 elm_win_override_set(Evas_Object *obj,
3676                      Eina_Bool override)
3677 {
3678    ELM_WIN_CHECK(obj);
3679    eo_do(obj, elm_obj_win_override_set(override));
3680 }
3681
3682 static void
3683 _override_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3684 {
3685    Eina_Bool override = va_arg(*list, int);
3686    Elm_Win_Smart_Data *sd = _pd;
3687
3688    TRAP(sd, override_set, override);
3689 #ifdef HAVE_ELEMENTARY_X
3690    _elm_win_xwin_update(sd);
3691 #endif
3692 }
3693
3694 EAPI Eina_Bool
3695 elm_win_override_get(const Evas_Object *obj)
3696 {
3697    ELM_WIN_CHECK(obj) EINA_FALSE;
3698    Eina_Bool ret = EINA_FALSE;
3699    eo_do((Eo *) obj, elm_obj_win_override_get(&ret));
3700    return ret;
3701 }
3702
3703 static void
3704 _override_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3705 {
3706    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
3707    Elm_Win_Smart_Data *sd = _pd;
3708    *ret = ecore_evas_override_get(sd->ee);
3709 }
3710
3711 EAPI void
3712 elm_win_fullscreen_set(Evas_Object *obj,
3713                        Eina_Bool fullscreen)
3714 {
3715    ELM_WIN_CHECK(obj);
3716    eo_do(obj, elm_obj_win_fullscreen_set(fullscreen));
3717 }
3718
3719 static void
3720 _fullscreen_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3721 {
3722    Eina_Bool fullscreen = va_arg(*list, int);
3723    Elm_Win_Smart_Data *sd = _pd;
3724    // YYY: handle if sd->img_obj
3725    if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
3726        ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
3727      {
3728         // these engines... can ONLY be fullscreen
3729         return;
3730      }
3731    else
3732      {
3733 //        sd->fullscreen = fullscreen;
3734
3735         TRAP(sd, fullscreen_set, fullscreen);
3736
3737         if (fullscreen)
3738           {
3739              if (EE_ENGINE_COMPARE(sd->ee, ELM_WAYLAND_SHM) ||
3740                  EE_ENGINE_COMPARE(sd->ee, ELM_WAYLAND_EGL))
3741                _elm_win_frame_del(sd);
3742           }
3743         else
3744           {
3745              if (EE_ENGINE_COMPARE(sd->ee, ELM_WAYLAND_SHM) ||
3746                  EE_ENGINE_COMPARE(sd->ee, ELM_WAYLAND_EGL))
3747                _elm_win_frame_add(sd, "default");
3748
3749              if (sd->frame_obj)
3750                evas_object_show(sd->frame_obj);
3751           }
3752 #ifdef HAVE_ELEMENTARY_X
3753         _elm_win_xwin_update(sd);
3754 #endif
3755      }
3756 }
3757
3758 EAPI Eina_Bool
3759 elm_win_fullscreen_get(const Evas_Object *obj)
3760 {
3761    ELM_WIN_CHECK(obj) EINA_FALSE;
3762    Eina_Bool ret = EINA_FALSE;
3763    eo_do((Eo *) obj, elm_obj_win_fullscreen_get(&ret));
3764    return ret;
3765 }
3766
3767 static void
3768 _fullscreen_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3769 {
3770    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
3771    Elm_Win_Smart_Data *sd = _pd;
3772
3773    if (EE_ENGINE_COMPARE(sd->ee, ELM_SOFTWARE_FB) ||
3774        EE_ENGINE_COMPARE(sd->ee, ELM_SOFTWARE_16_WINCE))
3775      {
3776         // these engines... can ONLY be fullscreen
3777         *ret = EINA_TRUE;
3778      }
3779    else
3780      {
3781         *ret = sd->fullscreen;
3782      }
3783 }
3784
3785 EAPI Evas_Object *
3786 elm_win_main_menu_get(const Evas_Object *obj)
3787 {
3788    ELM_WIN_CHECK(obj) NULL;
3789    Evas_Object *ret;
3790    eo_do((Eo *) obj, elm_obj_win_main_menu_get(&ret));
3791    return ret;
3792 }
3793
3794 static void
3795 _dbus_menu_set(Eina_Bool dbus_connect, void *data)
3796 {
3797    ELM_WIN_DATA_GET_OR_RETURN(data, sd);
3798
3799    if (dbus_connect)
3800      {
3801         DBG("Setting menu to D-Bus");
3802         edje_object_part_unswallow(sd->layout, sd->main_menu);
3803         edje_object_signal_emit(sd->layout, "elm,action,hide_menu", "elm");
3804         _elm_menu_menu_bar_hide(sd->main_menu);
3805      }
3806    else
3807      {
3808         DBG("Setting menu to local mode");
3809         edje_object_part_swallow(sd->layout, "elm.swallow.menu", sd->main_menu);
3810         edje_object_signal_emit(sd->layout, "elm,action,show_menu", "elm");
3811         evas_object_show(sd->main_menu);
3812      }
3813 }
3814
3815 static void
3816 _main_menu_get(Eo *obj, void *_pd, va_list *list)
3817 {
3818    Eo **ret = va_arg(*list, Eo **);
3819    Elm_Win_Smart_Data *sd = _pd;
3820    Eina_Bool use_dbus = EINA_FALSE;
3821
3822    if (sd->main_menu) goto end;
3823
3824    sd->main_menu = elm_menu_add(obj);
3825    _elm_menu_menu_bar_set(sd->main_menu, EINA_TRUE);
3826
3827 #ifdef HAVE_ELEMENTARY_X
3828    if (!_elm_config->disable_external_menu && sd->x.xwin) use_dbus = EINA_TRUE;
3829 #endif
3830
3831 #ifdef HAVE_ELEMENTARY_X
3832    if (use_dbus && _elm_dbus_menu_register(sd->main_menu))
3833      {
3834         _elm_dbus_menu_app_menu_register(sd->x.xwin, sd->main_menu,
3835                                          _dbus_menu_set, obj);
3836      }
3837    else
3838 #endif
3839      _dbus_menu_set(EINA_FALSE, obj);
3840
3841 end:
3842    *ret = sd->main_menu;
3843 }
3844
3845 EAPI void
3846 elm_win_maximized_set(Evas_Object *obj,
3847                       Eina_Bool maximized)
3848 {
3849    ELM_WIN_CHECK(obj);
3850    eo_do(obj, elm_obj_win_maximized_set(maximized));
3851 }
3852
3853 static void
3854 _maximized_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3855 {
3856    Eina_Bool maximized = va_arg(*list, int);
3857    Elm_Win_Smart_Data *sd = _pd;
3858
3859    _elm_win_frame_maximized_state_update(sd, maximized);
3860    // YYY: handle if sd->img_obj
3861    TRAP(sd, maximized_set, maximized);
3862 #ifdef HAVE_ELEMENTARY_X
3863    _elm_win_xwin_update(sd);
3864 #endif
3865 }
3866
3867 EAPI Eina_Bool
3868 elm_win_maximized_get(const Evas_Object *obj)
3869 {
3870    ELM_WIN_CHECK(obj) EINA_FALSE;
3871    Eina_Bool ret = EINA_FALSE;
3872    eo_do((Eo *) obj, elm_obj_win_maximized_get(&ret));
3873    return ret;
3874 }
3875
3876 static void
3877 _maximized_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3878 {
3879    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
3880    Elm_Win_Smart_Data *sd = _pd;
3881    *ret = sd->maximized;
3882 }
3883
3884 EAPI void
3885 elm_win_iconified_set(Evas_Object *obj,
3886                       Eina_Bool iconified)
3887 {
3888    ELM_WIN_CHECK(obj);
3889    eo_do(obj, elm_obj_win_iconified_set(iconified));
3890 }
3891
3892 static void
3893 _iconified_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3894 {
3895    Eina_Bool iconified = va_arg(*list, int);
3896    Elm_Win_Smart_Data *sd = _pd;
3897
3898 //   sd->iconified = iconified;
3899    TRAP(sd, iconified_set, iconified);
3900 #ifdef HAVE_ELEMENTARY_X
3901    _elm_win_xwin_update(sd);
3902 #endif
3903 }
3904
3905 EAPI Eina_Bool
3906 elm_win_iconified_get(const Evas_Object *obj)
3907 {
3908    ELM_WIN_CHECK(obj) EINA_FALSE;
3909    Eina_Bool ret = EINA_FALSE;
3910    eo_do((Eo *) obj, elm_obj_win_iconified_get(&ret));
3911    return ret;
3912 }
3913
3914 static void
3915 _iconified_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3916 {
3917    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
3918    Elm_Win_Smart_Data *sd = _pd;
3919    *ret = sd->iconified;
3920 }
3921
3922 EAPI void
3923 elm_win_withdrawn_set(Evas_Object *obj,
3924                       Eina_Bool withdrawn)
3925 {
3926    ELM_WIN_CHECK(obj);
3927    eo_do(obj, elm_obj_win_withdrawn_set(withdrawn));
3928 }
3929
3930 static void
3931 _withdrawn_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3932 {
3933    Eina_Bool withdrawn = va_arg(*list, int);
3934    Elm_Win_Smart_Data *sd = _pd;
3935
3936 //   sd->withdrawn = withdrawn;
3937    TRAP(sd, withdrawn_set, withdrawn);
3938 #ifdef HAVE_ELEMENTARY_X
3939    _elm_win_xwin_update(sd);
3940 #endif
3941 }
3942
3943 EAPI Eina_Bool
3944 elm_win_withdrawn_get(const Evas_Object *obj)
3945 {
3946    ELM_WIN_CHECK(obj) EINA_FALSE;
3947    Eina_Bool ret = EINA_FALSE;
3948    eo_do((Eo *) obj, elm_obj_win_withdrawn_get(&ret));
3949    return ret;
3950 }
3951
3952 static void
3953 _withdrawn_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3954 {
3955    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
3956    Elm_Win_Smart_Data *sd = _pd;
3957    *ret = sd->withdrawn;
3958 }
3959
3960 EAPI void
3961 elm_win_available_profiles_set(Evas_Object  *obj,
3962                                const char  **profiles,
3963                                unsigned int  count)
3964 {
3965    ELM_WIN_CHECK(obj);
3966    eo_do((Eo *) obj, elm_obj_win_available_profiles_set(profiles, count));
3967 }
3968
3969 static void
3970 _available_profiles_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
3971 {
3972    const char **profiles = va_arg(*list, const char **);
3973    unsigned int count = va_arg(*list, unsigned int);
3974    Elm_Win_Smart_Data *sd = _pd;
3975    Eina_Bool found = EINA_FALSE;
3976
3977    _elm_win_available_profiles_del(sd);
3978    if ((profiles) && (count >= 1))
3979      {
3980         sd->profile.available_list = calloc(count, sizeof(char *));
3981         if (sd->profile.available_list)
3982           {
3983              if (!sd->profile.name) found = EINA_TRUE;
3984
3985              unsigned int i;
3986              for (i = 0; i < count; i++)
3987                {
3988                   sd->profile.available_list[i] = eina_stringshare_add(profiles[i]);
3989
3990                   /* check to see if a given array has a current profile of elm_win */
3991                   if ((sd->profile.name) &&
3992                       (!strcmp(sd->profile.name, profiles[i])))
3993                     {
3994                        found = EINA_TRUE;
3995                     }
3996                }
3997              sd->profile.count = count;
3998           }
3999      }
4000
4001    if (ecore_evas_window_profile_supported_get(sd->ee))
4002      {
4003         ecore_evas_window_available_profiles_set(sd->ee,
4004                                                  sd->profile.available_list,
4005                                                  sd->profile.count);
4006
4007         /* current profile of elm_win is wrong, change profile */
4008         if ((sd->profile.available_list) && (!found))
4009           {
4010              eina_stringshare_replace(&(sd->profile.name),
4011                                       sd->profile.available_list[0]);
4012              ecore_evas_window_profile_set(sd->ee, sd->profile.name);
4013           }
4014
4015      }
4016    else
4017      {
4018         if (sd->profile.available_list)
4019           _elm_win_profile_update(sd);
4020      }
4021 }
4022
4023 EAPI Eina_Bool
4024 elm_win_available_profiles_get(Evas_Object   *obj,
4025                                char        ***profiles,
4026                                unsigned int  *count)
4027 {
4028    ELM_WIN_CHECK(obj) EINA_FALSE;
4029    Eina_Bool ret = EINA_FALSE;
4030    eo_do((Eo *) obj, elm_obj_win_available_profiles_get(&ret, profiles, count));
4031    return ret;
4032 }
4033
4034 static void
4035 _available_profiles_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4036 {
4037    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4038    char ***profiles = va_arg(*list, char ***);
4039    unsigned int *count = va_arg(*list, unsigned int *);
4040    Elm_Win_Smart_Data *sd = _pd;
4041    Eina_Bool res;
4042
4043    if (ecore_evas_window_profile_supported_get(sd->ee))
4044      {
4045         res = ecore_evas_window_available_profiles_get(sd->ee,
4046                                                        profiles,
4047                                                        count);
4048      }
4049    else
4050      {
4051         if (profiles) *profiles = (char **)sd->profile.available_list;
4052         if (count) *count = sd->profile.count;
4053         res = EINA_TRUE;
4054      }
4055    *ret = res;
4056 }
4057
4058 EAPI void
4059 elm_win_profile_set(Evas_Object *obj,
4060                     const char *profile)
4061 {
4062    ELM_WIN_CHECK(obj);
4063    eo_do((Eo *) obj, elm_obj_win_profile_set(profile));
4064 }
4065
4066 static void
4067 _profile_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4068 {
4069    const char *profile = va_arg(*list, const char *);
4070    Elm_Win_Smart_Data *sd = _pd;
4071
4072    /* check to see if a given profile is present in an available profiles */
4073    if ((profile) && (sd->profile.available_list))
4074      {
4075         Eina_Bool found = EINA_FALSE;
4076         unsigned int i;
4077         for (i = 0; i < sd->profile.count; i++)
4078           {
4079              if (!strcmp(profile,
4080                          sd->profile.available_list[i]))
4081                {
4082                   found = EINA_TRUE;
4083                   break;
4084                }
4085           }
4086         if (!found) return;
4087      }
4088
4089    if (ecore_evas_window_profile_supported_get(sd->ee))
4090      {
4091         if (!profile) _elm_win_profile_del(sd);
4092         ecore_evas_window_profile_set(sd->ee, profile);
4093      }
4094    else
4095      {
4096         if (_elm_win_profile_set(sd, profile))
4097           _elm_win_profile_update(sd);
4098      }
4099 }
4100
4101 EAPI const char *
4102 elm_win_profile_get(const Evas_Object *obj)
4103 {
4104    ELM_WIN_CHECK(obj) NULL;
4105    const char *ret = NULL;
4106    eo_do((Eo *) obj, elm_obj_win_profile_get(&ret));
4107    return ret;
4108 }
4109
4110 static void
4111 _profile_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4112 {
4113    const char **ret = va_arg(*list, const char **);
4114    Elm_Win_Smart_Data *sd = _pd;
4115    *ret = sd->profile.name;
4116 }
4117
4118 EAPI void
4119 elm_win_urgent_set(Evas_Object *obj,
4120                    Eina_Bool urgent)
4121 {
4122    ELM_WIN_CHECK(obj);
4123    eo_do(obj, elm_obj_win_urgent_set(urgent));
4124 }
4125
4126 static void
4127 _urgent_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4128 {
4129    Eina_Bool urgent = va_arg(*list, int);
4130    Elm_Win_Smart_Data *sd = _pd;
4131
4132    sd->urgent = urgent;
4133    TRAP(sd, urgent_set, urgent);
4134 #ifdef HAVE_ELEMENTARY_X
4135    _elm_win_xwin_update(sd);
4136 #endif
4137 }
4138
4139 EAPI Eina_Bool
4140 elm_win_urgent_get(const Evas_Object *obj)
4141 {
4142    ELM_WIN_CHECK(obj) EINA_FALSE;
4143    Eina_Bool ret = EINA_FALSE;
4144    eo_do((Eo *) obj, elm_obj_win_urgent_get(&ret));
4145    return ret;
4146 }
4147
4148 static void
4149 _urgent_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4150 {
4151    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4152    Elm_Win_Smart_Data *sd = _pd;
4153    *ret = sd->urgent;
4154 }
4155
4156 EAPI void
4157 elm_win_demand_attention_set(Evas_Object *obj,
4158                              Eina_Bool demand_attention)
4159 {
4160    ELM_WIN_CHECK(obj);
4161    eo_do(obj, elm_obj_win_demand_attention_set(demand_attention));
4162 }
4163
4164 static void
4165 _demand_attention_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4166 {
4167    Eina_Bool demand_attention = va_arg(*list, int);
4168    Elm_Win_Smart_Data *sd = _pd;
4169
4170    sd->demand_attention = demand_attention;
4171    TRAP(sd, demand_attention_set, demand_attention);
4172 #ifdef HAVE_ELEMENTARY_X
4173    _elm_win_xwin_update(sd);
4174 #endif
4175 }
4176
4177 EAPI Eina_Bool
4178 elm_win_demand_attention_get(const Evas_Object *obj)
4179 {
4180    ELM_WIN_CHECK(obj) EINA_FALSE;
4181    Eina_Bool ret = EINA_FALSE;
4182    eo_do((Eo *) obj, elm_obj_win_demand_attention_get(&ret));
4183    return ret;
4184 }
4185
4186 static void
4187 _demand_attention_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4188 {
4189    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4190    Elm_Win_Smart_Data *sd = _pd;
4191    *ret = sd->demand_attention;
4192 }
4193
4194 EAPI void
4195 elm_win_modal_set(Evas_Object *obj,
4196                   Eina_Bool modal)
4197 {
4198    ELM_WIN_CHECK(obj);
4199    eo_do(obj, elm_obj_win_modal_set(modal));
4200 }
4201
4202 static void
4203 _modal_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4204 {
4205    Eina_Bool modal = va_arg(*list, int);
4206    Elm_Win_Smart_Data *sd = _pd;
4207
4208    sd->modal = modal;
4209    TRAP(sd, modal_set, modal);
4210 #ifdef HAVE_ELEMENTARY_X
4211    _elm_win_xwin_update(sd);
4212 #endif
4213 }
4214
4215 EAPI Eina_Bool
4216 elm_win_modal_get(const Evas_Object *obj)
4217 {
4218    ELM_WIN_CHECK(obj) EINA_FALSE;
4219    Eina_Bool ret = EINA_FALSE;
4220    eo_do((Eo *) obj, elm_obj_win_modal_get(&ret));
4221    return ret;
4222 }
4223
4224 static void
4225 _modal_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4226 {
4227    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4228    Elm_Win_Smart_Data *sd = _pd;
4229    *ret = sd->modal;
4230 }
4231
4232 EAPI void
4233 elm_win_aspect_set(Evas_Object *obj,
4234                    double aspect)
4235 {
4236    ELM_WIN_CHECK(obj);
4237    eo_do(obj, elm_obj_win_aspect_set(aspect));
4238 }
4239
4240 static void
4241 _aspect_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4242 {
4243    double aspect = va_arg(*list, double);
4244    Elm_Win_Smart_Data *sd = _pd;
4245
4246    sd->aspect = aspect;
4247    TRAP(sd, aspect_set, aspect);
4248 #ifdef HAVE_ELEMENTARY_X
4249    _elm_win_xwin_update(sd);
4250 #endif
4251 }
4252
4253 EAPI double
4254 elm_win_aspect_get(const Evas_Object *obj)
4255 {
4256    ELM_WIN_CHECK(obj) 0.0;
4257    double ret = 0.0;
4258    eo_do((Eo *) obj, elm_obj_win_aspect_get(&ret));
4259    return ret;
4260 }
4261
4262 static void
4263 _aspect_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4264 {
4265    double *ret = va_arg(*list, double *);
4266    Elm_Win_Smart_Data *sd = _pd;
4267    *ret = sd->aspect;
4268 }
4269
4270 EAPI void
4271 elm_win_size_base_set(Evas_Object *obj, int w, int h)
4272 {
4273    ELM_WIN_CHECK(obj);
4274    eo_do(obj, elm_obj_win_size_base_set(w, h));
4275 }
4276
4277 static void
4278 _size_base_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4279 {
4280    int w = va_arg(*list, int);
4281    int h = va_arg(*list, int);
4282    Elm_Win_Smart_Data *sd = _pd;
4283    sd->size_base_w = w;
4284    sd->size_base_h = h;
4285    TRAP(sd, size_base_set, w, h);
4286 #ifdef HAVE_ELEMENTARY_X
4287    _elm_win_xwin_update(sd);
4288 #endif
4289 }
4290
4291 EAPI void
4292 elm_win_size_base_get(Evas_Object *obj, int *w, int *h)
4293 {
4294    ELM_WIN_CHECK(obj);
4295    eo_do(obj, elm_obj_win_size_base_get(w, h));
4296 }
4297
4298 static void
4299 _size_base_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4300 {
4301    int *w = va_arg(*list, int *);
4302    int *h = va_arg(*list, int *);
4303
4304    Elm_Win_Smart_Data *sd = _pd;
4305    if (w) *w = sd->size_base_w;
4306    if (w) *h = sd->size_base_h;
4307 }
4308
4309 EAPI void
4310 elm_win_size_step_set(Evas_Object *obj, int w, int h)
4311 {
4312    ELM_WIN_CHECK(obj);
4313    eo_do(obj, elm_obj_win_size_step_set(w, h));
4314 }
4315
4316 static void
4317 _size_step_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4318 {
4319    int w = va_arg(*list, int);
4320    int h = va_arg(*list, int);
4321    Elm_Win_Smart_Data *sd = _pd;
4322    sd->size_step_w = w;
4323    sd->size_step_h = h;
4324    TRAP(sd, size_step_set, w, h);
4325 #ifdef HAVE_ELEMENTARY_X
4326    _elm_win_xwin_update(sd);
4327 #endif
4328 }
4329
4330 EAPI void
4331 elm_win_size_step_get(Evas_Object *obj, int *w, int *h)
4332 {
4333    ELM_WIN_CHECK(obj);
4334    eo_do(obj, elm_obj_win_size_step_get(w, h));
4335 }
4336
4337 static void
4338 _size_step_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4339 {
4340    int *w = va_arg(*list, int *);
4341    int *h = va_arg(*list, int *);
4342    Elm_Win_Smart_Data *sd = _pd;
4343    if (w) *w = sd->size_step_w;
4344    if (w) *h = sd->size_step_h;
4345 }
4346
4347 EAPI void
4348 elm_win_layer_set(Evas_Object *obj,
4349                   int layer)
4350 {
4351    ELM_WIN_CHECK(obj);
4352    eo_do(obj, elm_obj_win_layer_set(layer));
4353 }
4354
4355 static void
4356 _layer_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4357 {
4358    int layer = va_arg(*list, int);
4359    Elm_Win_Smart_Data *sd = _pd;
4360
4361    TRAP(sd, layer_set, layer);
4362 #ifdef HAVE_ELEMENTARY_X
4363    _elm_win_xwin_update(sd);
4364 #endif
4365 }
4366
4367 EAPI int
4368 elm_win_layer_get(const Evas_Object *obj)
4369 {
4370    ELM_WIN_CHECK(obj) - 1;
4371    int ret = - 1;
4372    eo_do((Eo *) obj, elm_obj_win_layer_get(&ret));
4373    return ret;
4374 }
4375
4376 static void
4377 _layer_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4378 {
4379    int *ret = va_arg(*list, int *);
4380    Elm_Win_Smart_Data *sd = _pd;
4381    *ret = ecore_evas_layer_get(sd->ee);
4382 }
4383
4384 EAPI void
4385 elm_win_norender_push(Evas_Object *obj)
4386 {
4387    ELM_WIN_CHECK(obj);
4388    ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4389
4390    sd->norender++;
4391    if (sd->norender == 1) ecore_evas_manual_render_set(sd->ee, EINA_TRUE);
4392 }
4393
4394 EAPI void
4395 elm_win_norender_pop(Evas_Object *obj)
4396 {
4397    ELM_WIN_CHECK(obj);
4398    ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4399
4400    if (sd->norender <= 0) return;
4401    sd->norender--;
4402    if (sd->norender == 0) ecore_evas_manual_render_set(sd->ee, EINA_FALSE);
4403 }
4404
4405 EAPI int
4406 elm_win_norender_get(Evas_Object *obj)
4407 {
4408    ELM_WIN_CHECK(obj) - 1;
4409    ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, -1);
4410    return sd->norender;
4411 }
4412
4413 EAPI void
4414 elm_win_render(Evas_Object *obj)
4415 {
4416    ELM_WIN_CHECK(obj);
4417    ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
4418    ecore_evas_manual_render(sd->ee);
4419 }
4420
4421 static int
4422 _win_rotation_degree_check(int rotation)
4423 {
4424    if ((rotation > 360) || (rotation < 0))
4425      {
4426         WRN("Rotation degree should be 0 ~ 360 (passed degree: %d)", rotation);
4427         rotation %= 360;
4428         if (rotation < 0) rotation += 360;
4429      }
4430    return rotation;
4431 }
4432
4433 EAPI void
4434 elm_win_rotation_set(Evas_Object *obj,
4435                      int rotation)
4436 {
4437    ELM_WIN_CHECK(obj);
4438    eo_do(obj, elm_obj_win_rotation_set(rotation));
4439 }
4440
4441 static void
4442 _win_rotate(Evas_Object *obj, Elm_Win_Smart_Data *sd, int rotation, Eina_Bool resize)
4443 {
4444    rotation = _win_rotation_degree_check(rotation);
4445    if (sd->rot == rotation) return;
4446    sd->rot = rotation;
4447    if (resize) TRAP(sd, rotation_with_resize_set, rotation);
4448    else TRAP(sd, rotation_set, rotation);
4449    evas_object_size_hint_min_set(obj, -1, -1);
4450    evas_object_size_hint_max_set(obj, -1, -1);
4451    _elm_win_resize_objects_eval(obj);
4452 #ifdef HAVE_ELEMENTARY_X
4453    _elm_win_xwin_update(sd);
4454 #endif
4455    elm_widget_orientation_set(obj, rotation);
4456    evas_object_smart_callback_call(obj, SIG_ROTATION_CHANGED, NULL);
4457 }
4458
4459 static void
4460 _rotation_set(Eo *obj, void *_pd, va_list *list)
4461 {
4462    int rotation = va_arg(*list, int);
4463    Elm_Win_Smart_Data *sd = _pd;
4464    _win_rotate(obj, sd, rotation, EINA_FALSE);
4465 }
4466
4467 EAPI void
4468 elm_win_rotation_with_resize_set(Evas_Object *obj,
4469                                  int rotation)
4470 {
4471    ELM_WIN_CHECK(obj);
4472    eo_do(obj, elm_obj_win_rotation_with_resize_set(rotation));
4473 }
4474
4475 static void
4476 _rotation_with_resize_set(Eo *obj, void *_pd, va_list *list)
4477 {
4478    int rotation = va_arg(*list, int);
4479    Elm_Win_Smart_Data *sd = _pd;
4480    _win_rotate(obj, sd, rotation, EINA_TRUE);
4481 }
4482
4483 EAPI int
4484 elm_win_rotation_get(const Evas_Object *obj)
4485 {
4486    ELM_WIN_CHECK(obj) - 1;
4487    int ret = - 1;
4488    eo_do((Eo *) obj, elm_obj_win_rotation_get(&ret));
4489    return ret;
4490 }
4491
4492 static void
4493 _rotation_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4494 {
4495    int *ret = va_arg(*list, int *);
4496    Elm_Win_Smart_Data *sd = _pd;
4497    *ret = sd->rot;
4498 }
4499
4500 EAPI void
4501 elm_win_sticky_set(Evas_Object *obj,
4502                    Eina_Bool sticky)
4503 {
4504    ELM_WIN_CHECK(obj);
4505    eo_do(obj, elm_obj_win_sticky_set(sticky));
4506 }
4507
4508 static void
4509 _sticky_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4510 {
4511    Eina_Bool sticky = va_arg(*list, int);
4512    Elm_Win_Smart_Data *sd = _pd;
4513
4514 //   sd->sticky = sticky;
4515    TRAP(sd, sticky_set, sticky);
4516 #ifdef HAVE_ELEMENTARY_X
4517    _elm_win_xwin_update(sd);
4518 #endif
4519 }
4520
4521 EAPI Eina_Bool
4522 elm_win_sticky_get(const Evas_Object *obj)
4523 {
4524    ELM_WIN_CHECK(obj) EINA_FALSE;
4525    Eina_Bool ret = EINA_FALSE;
4526    eo_do((Eo *) obj, elm_obj_win_sticky_get(&ret));
4527    return ret;
4528 }
4529
4530 static void
4531 _sticky_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4532 {
4533    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4534    Elm_Win_Smart_Data *sd = _pd;
4535    *ret = sd->sticky;
4536 }
4537
4538 EAPI void
4539 elm_win_keyboard_mode_set(Evas_Object *obj,
4540                           Elm_Win_Keyboard_Mode mode)
4541 {
4542    ELM_WIN_CHECK(obj);
4543    eo_do(obj, elm_obj_win_keyboard_mode_set(mode));
4544 }
4545
4546 static void
4547 _keyboard_mode_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4548 {
4549    Elm_Win_Keyboard_Mode mode = va_arg(*list, Elm_Win_Keyboard_Mode);
4550    Elm_Win_Smart_Data *sd = _pd;
4551
4552    if (mode == sd->kbdmode) return;
4553 #ifdef HAVE_ELEMENTARY_X
4554    _elm_win_xwindow_get(sd);
4555 #endif
4556    sd->kbdmode = mode;
4557 #ifdef HAVE_ELEMENTARY_X
4558    if (sd->x.xwin)
4559      ecore_x_e_virtual_keyboard_state_set
4560        (sd->x.xwin, (Ecore_X_Virtual_Keyboard_State)sd->kbdmode);
4561 #endif
4562 }
4563
4564 EAPI Elm_Win_Keyboard_Mode
4565 elm_win_keyboard_mode_get(const Evas_Object *obj)
4566 {
4567    ELM_WIN_CHECK(obj) ELM_WIN_KEYBOARD_UNKNOWN;
4568    Elm_Win_Keyboard_Mode ret = ELM_WIN_KEYBOARD_UNKNOWN;
4569    eo_do((Eo *) obj, elm_obj_win_keyboard_mode_get(&ret));
4570    return ret;
4571 }
4572
4573 static void
4574 _keyboard_mode_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4575 {
4576    Elm_Win_Keyboard_Mode *ret = va_arg(*list, Elm_Win_Keyboard_Mode *);
4577    Elm_Win_Smart_Data *sd = _pd;
4578    *ret = sd->kbdmode;
4579 }
4580
4581 EAPI void
4582 elm_win_keyboard_win_set(Evas_Object *obj,
4583                          Eina_Bool is_keyboard)
4584 {
4585    ELM_WIN_CHECK(obj);
4586    eo_do(obj, elm_obj_win_keyboard_win_set(is_keyboard));
4587 }
4588
4589 static void
4590 _keyboard_win_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4591 {
4592    Eina_Bool is_keyboard = va_arg(*list, int);
4593    Elm_Win_Smart_Data *sd = _pd;
4594
4595 #ifdef HAVE_ELEMENTARY_X
4596    _elm_win_xwindow_get(sd);
4597    if (sd->x.xwin)
4598      ecore_x_e_virtual_keyboard_set(sd->x.xwin, is_keyboard);
4599 #else
4600    (void)is_keyboard;
4601 #endif
4602 }
4603
4604 EAPI Eina_Bool
4605 elm_win_keyboard_win_get(const Evas_Object *obj)
4606 {
4607    ELM_WIN_CHECK(obj) EINA_FALSE;
4608    Eina_Bool ret = EINA_FALSE;
4609    eo_do((Eo *) obj, elm_obj_win_keyboard_win_get(&ret));
4610    return ret;
4611 }
4612
4613 static void
4614 _keyboard_win_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4615 {
4616    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4617    Elm_Win_Smart_Data *sd = _pd;
4618
4619 #ifdef HAVE_ELEMENTARY_X
4620    _elm_win_xwindow_get(sd);
4621    if (sd->x.xwin)
4622      {
4623         *ret = ecore_x_e_virtual_keyboard_get(sd->x.xwin);
4624         return;
4625      }
4626 #endif
4627    *ret = EINA_FALSE;
4628 }
4629
4630 EAPI void
4631 elm_win_indicator_mode_set(Evas_Object *obj,
4632       Elm_Win_Indicator_Mode mode)
4633 {
4634    ELM_WIN_CHECK(obj);
4635    eo_do(obj, elm_obj_win_indicator_mode_set(mode));
4636 }
4637
4638 static void
4639 _indicator_mode_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4640 {
4641    Elm_Win_Indicator_Mode mode = va_arg(*list, Elm_Win_Indicator_Mode);
4642    Elm_Win_Smart_Data *sd = _pd;
4643
4644    if (mode == sd->indmode) return;
4645 #ifdef HAVE_ELEMENTARY_X
4646    _elm_win_xwindow_get(sd);
4647 #endif
4648    sd->indmode = mode;
4649 #ifdef HAVE_ELEMENTARY_X
4650    if (sd->x.xwin)
4651      {
4652         if (sd->indmode == ELM_WIN_INDICATOR_SHOW)
4653           ecore_x_e_illume_indicator_state_set
4654             (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_ON);
4655         else if (sd->indmode == ELM_WIN_INDICATOR_HIDE)
4656           ecore_x_e_illume_indicator_state_set
4657             (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_STATE_OFF);
4658      }
4659 #endif
4660    evas_object_smart_callback_call(obj, SIG_INDICATOR_PROP_CHANGED, NULL);
4661 }
4662
4663 EAPI Elm_Win_Indicator_Mode
4664 elm_win_indicator_mode_get(const Evas_Object *obj)
4665 {
4666    ELM_WIN_CHECK(obj) ELM_WIN_INDICATOR_UNKNOWN;
4667    Elm_Win_Indicator_Mode ret = ELM_WIN_INDICATOR_UNKNOWN;
4668    eo_do((Eo *) obj, elm_obj_win_indicator_mode_get(&ret));
4669    return ret;
4670 }
4671
4672 static void
4673 _indicator_mode_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4674 {
4675    Elm_Win_Indicator_Mode *ret = va_arg(*list, Elm_Win_Indicator_Mode *);
4676    Elm_Win_Smart_Data *sd = _pd;
4677    *ret = sd->indmode;
4678 }
4679
4680 EAPI void
4681 elm_win_indicator_opacity_set(Evas_Object *obj,
4682                               Elm_Win_Indicator_Opacity_Mode mode)
4683 {
4684    ELM_WIN_CHECK(obj);
4685    eo_do(obj, elm_obj_win_indicator_opacity_set(mode));
4686 }
4687
4688 static void
4689 _indicator_opacity_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4690 {
4691    Elm_Win_Indicator_Opacity_Mode mode = va_arg(*list, Elm_Win_Indicator_Opacity_Mode);
4692    Elm_Win_Smart_Data *sd = _pd;
4693
4694    if (mode == sd->ind_o_mode) return;
4695    sd->ind_o_mode = mode;
4696 #ifdef HAVE_ELEMENTARY_X
4697    _elm_win_xwindow_get(sd);
4698    if (sd->x.xwin)
4699      {
4700         if (sd->ind_o_mode == ELM_WIN_INDICATOR_OPAQUE)
4701           ecore_x_e_illume_indicator_opacity_set
4702             (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_OPAQUE);
4703         else if (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSLUCENT)
4704           ecore_x_e_illume_indicator_opacity_set
4705             (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TRANSLUCENT);
4706         else if (sd->ind_o_mode == ELM_WIN_INDICATOR_TRANSPARENT)
4707           ecore_x_e_illume_indicator_opacity_set
4708             (sd->x.xwin, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
4709      }
4710 #endif
4711    evas_object_smart_callback_call(obj, SIG_INDICATOR_PROP_CHANGED, NULL);
4712 }
4713
4714 EAPI Elm_Win_Indicator_Opacity_Mode
4715 elm_win_indicator_opacity_get(const Evas_Object *obj)
4716 {
4717    ELM_WIN_CHECK(obj) ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
4718    Elm_Win_Indicator_Opacity_Mode ret = ELM_WIN_INDICATOR_OPACITY_UNKNOWN;
4719    eo_do((Eo *) obj, elm_obj_win_indicator_opacity_get(&ret));
4720    return ret;
4721 }
4722
4723 static void
4724 _indicator_opacity_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4725 {
4726    Elm_Win_Indicator_Opacity_Mode *ret = va_arg(*list, Elm_Win_Indicator_Opacity_Mode *);
4727    Elm_Win_Smart_Data *sd = _pd;
4728    *ret = sd->ind_o_mode;
4729 }
4730
4731 EAPI void
4732 elm_win_screen_position_get(const Evas_Object *obj,
4733                             int *x,
4734                             int *y)
4735 {
4736    ELM_WIN_CHECK(obj);
4737    eo_do((Eo *) obj, elm_obj_win_screen_position_get(x, y));
4738 }
4739
4740 static void
4741 _screen_position_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4742 {
4743    int *x = va_arg(*list, int *);
4744    int *y = va_arg(*list, int *);
4745    Elm_Win_Smart_Data *sd = _pd;
4746
4747    if (x) *x = sd->screen.x;
4748    if (y) *y = sd->screen.y;
4749 }
4750
4751 EAPI Eina_Bool
4752 elm_win_focus_get(const Evas_Object *obj)
4753 {
4754    ELM_WIN_CHECK(obj) EINA_FALSE;
4755    Eina_Bool ret = EINA_FALSE;
4756    eo_do((Eo *) obj, elm_obj_win_focus_get(&ret));
4757    return ret;
4758 }
4759
4760 static void
4761 _focus_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4762 {
4763    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4764    Elm_Win_Smart_Data *sd = _pd;
4765    *ret = ecore_evas_focus_get(sd->ee);
4766 }
4767
4768 EAPI void
4769 elm_win_screen_constrain_set(Evas_Object *obj,
4770                              Eina_Bool constrain)
4771 {
4772    ELM_WIN_CHECK(obj);
4773    eo_do(obj, elm_obj_win_screen_constrain_set(constrain));
4774 }
4775
4776 static void
4777 _screen_constrain_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4778 {
4779    Eina_Bool constrain = va_arg(*list, int);
4780    Elm_Win_Smart_Data *sd = _pd;
4781    sd->constrain = !!constrain;
4782 }
4783
4784 EAPI Eina_Bool
4785 elm_win_screen_constrain_get(Evas_Object *obj)
4786 {
4787    ELM_WIN_CHECK(obj) EINA_FALSE;
4788    Eina_Bool ret = EINA_FALSE;
4789    eo_do(obj, elm_obj_win_screen_constrain_get(&ret));
4790    return ret;
4791 }
4792
4793 static void
4794 _screen_constrain_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4795 {
4796    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4797    Elm_Win_Smart_Data *sd = _pd;
4798    *ret = sd->constrain;
4799 }
4800
4801 EAPI void
4802 elm_win_screen_size_get(const Evas_Object *obj,
4803                         int *x,
4804                         int *y,
4805                         int *w,
4806                         int *h)
4807 {
4808    ELM_WIN_CHECK(obj);
4809    eo_do((Eo *) obj, elm_obj_win_screen_size_get(x, y, w, h));
4810 }
4811
4812 static void
4813 _screen_size_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4814 {
4815    int *x = va_arg(*list, int *);
4816    int *y = va_arg(*list, int *);
4817    int *w = va_arg(*list, int *);
4818    int *h = va_arg(*list, int *);
4819    Elm_Win_Smart_Data *sd = _pd;
4820
4821    ecore_evas_screen_geometry_get(sd->ee, x, y, w, h);
4822 }
4823
4824 EAPI void
4825 elm_win_screen_dpi_get(const Evas_Object *obj,
4826                        int *xdpi,
4827                        int *ydpi)
4828 {
4829    ELM_WIN_CHECK(obj);
4830    eo_do((Eo *) obj, elm_obj_win_screen_dpi_get(xdpi, ydpi));
4831 }
4832
4833 static void
4834 _screen_dpi_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4835 {
4836    int *xdpi = va_arg(*list, int *);
4837    int *ydpi = va_arg(*list, int *);
4838    Elm_Win_Smart_Data *sd = _pd;
4839
4840    ecore_evas_screen_dpi_get(sd->ee, xdpi, ydpi);
4841 }
4842
4843 EAPI void
4844 elm_win_conformant_set(Evas_Object *obj,
4845                        Eina_Bool conformant)
4846 {
4847    ELM_WIN_CHECK(obj);
4848    eo_do(obj, elm_obj_win_conformant_set(conformant));
4849 }
4850
4851 static void
4852 _conformant_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4853 {
4854    Eina_Bool conformant = va_arg(*list, int);
4855    Elm_Win_Smart_Data *sd = _pd;
4856
4857 #ifdef HAVE_ELEMENTARY_X
4858    _elm_win_xwindow_get(sd);
4859    if (sd->x.xwin)
4860      ecore_x_e_illume_conformant_set(sd->x.xwin, conformant);
4861 #else
4862    (void)conformant;
4863 #endif
4864 }
4865
4866 EAPI Eina_Bool
4867 elm_win_conformant_get(const Evas_Object *obj)
4868 {
4869    ELM_WIN_CHECK(obj) EINA_FALSE;
4870    Eina_Bool ret = EINA_FALSE;
4871    eo_do((Eo *) obj, elm_obj_win_conformant_get(&ret));
4872    return ret;
4873 }
4874
4875 static void
4876 _conformant_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4877 {
4878    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4879    Elm_Win_Smart_Data *sd = _pd;
4880    *ret = EINA_FALSE;
4881
4882 #ifdef HAVE_ELEMENTARY_X
4883    _elm_win_xwindow_get(sd);
4884    if (sd->x.xwin)
4885      *ret = ecore_x_e_illume_conformant_get(sd->x.xwin);
4886 #endif
4887 }
4888
4889 EAPI void
4890 elm_win_quickpanel_set(Evas_Object *obj,
4891                        Eina_Bool quickpanel)
4892 {
4893    ELM_WIN_CHECK(obj);
4894    eo_do(obj, elm_obj_win_quickpanel_set(quickpanel));
4895 }
4896
4897 static void
4898 _quickpanel_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4899 {
4900    Eina_Bool quickpanel = va_arg(*list, int);
4901    Elm_Win_Smart_Data *sd = _pd;
4902 #ifdef HAVE_ELEMENTARY_X
4903    _elm_win_xwindow_get(sd);
4904    if (sd->x.xwin)
4905      {
4906         ecore_x_e_illume_quickpanel_set(sd->x.xwin, quickpanel);
4907         if (quickpanel)
4908           {
4909              Ecore_X_Window_State states[2];
4910
4911              states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
4912              states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
4913              ecore_x_netwm_window_state_set(sd->x.xwin, states, 2);
4914              ecore_x_icccm_hints_set(sd->x.xwin, 0, 0, 0, 0, 0, 0, 0);
4915           }
4916      }
4917 #else
4918    (void)quickpanel;
4919 #endif
4920 }
4921
4922 EAPI Eina_Bool
4923 elm_win_quickpanel_get(const Evas_Object *obj)
4924 {
4925    ELM_WIN_CHECK(obj) EINA_FALSE;
4926    Eina_Bool ret = EINA_FALSE;
4927    eo_do((Eo *) obj, elm_obj_win_quickpanel_get(&ret));
4928    return ret;
4929 }
4930
4931 static void
4932 _quickpanel_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4933 {
4934    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
4935    Elm_Win_Smart_Data *sd = _pd;
4936    *ret = EINA_FALSE;
4937
4938 #ifdef HAVE_ELEMENTARY_X
4939    _elm_win_xwindow_get(sd);
4940    if (sd->x.xwin)
4941      *ret = ecore_x_e_illume_quickpanel_get(sd->x.xwin);
4942 #endif
4943 }
4944
4945 EAPI void
4946 elm_win_quickpanel_priority_major_set(Evas_Object *obj,
4947                                       int priority)
4948 {
4949    ELM_WIN_CHECK(obj);
4950    eo_do(obj, elm_obj_win_quickpanel_priority_major_set(priority));
4951 }
4952
4953 static void
4954 _quickpanel_priority_major_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4955 {
4956    int priority = va_arg(*list, int);
4957    Elm_Win_Smart_Data *sd = _pd;
4958
4959 #ifdef HAVE_ELEMENTARY_X
4960    _elm_win_xwindow_get(sd);
4961    if (sd->x.xwin)
4962      ecore_x_e_illume_quickpanel_priority_major_set(sd->x.xwin, priority);
4963 #else
4964    (void)priority;
4965 #endif
4966 }
4967
4968 EAPI int
4969 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
4970 {
4971    ELM_WIN_CHECK(obj) - 1;
4972    int ret = - 1;
4973    eo_do((Eo *) obj, elm_obj_win_quickpanel_priority_major_get(&ret));
4974    return ret;
4975 }
4976
4977 static void
4978 _quickpanel_priority_major_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
4979 {
4980    int *ret = va_arg(*list, int *);
4981    Elm_Win_Smart_Data *sd = _pd;
4982    *ret = -1;
4983
4984 #ifdef HAVE_ELEMENTARY_X
4985    _elm_win_xwindow_get(sd);
4986    if (sd->x.xwin)
4987      *ret = ecore_x_e_illume_quickpanel_priority_major_get(sd->x.xwin);
4988 #endif
4989 }
4990
4991 EAPI void
4992 elm_win_quickpanel_priority_minor_set(Evas_Object *obj,
4993                                       int priority)
4994 {
4995    ELM_WIN_CHECK(obj);
4996    eo_do(obj, elm_obj_win_quickpanel_priority_minor_set(priority));
4997 }
4998
4999 static void
5000 _quickpanel_priority_minor_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5001 {
5002    int priority = va_arg(*list, int);
5003    Elm_Win_Smart_Data *sd = _pd;
5004
5005 #ifdef HAVE_ELEMENTARY_X
5006    _elm_win_xwindow_get(sd);
5007    if (sd->x.xwin)
5008      ecore_x_e_illume_quickpanel_priority_minor_set(sd->x.xwin, priority);
5009 #else
5010    (void)priority;
5011 #endif
5012 }
5013
5014 EAPI int
5015 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
5016 {
5017    ELM_WIN_CHECK(obj) - 1;
5018    int ret = - 1;
5019    eo_do((Eo *) obj, elm_obj_win_quickpanel_priority_minor_get(&ret));
5020    return ret;
5021 }
5022
5023 static void
5024 _quickpanel_priority_minor_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5025 {
5026    int *ret = va_arg(*list, int *);
5027    Elm_Win_Smart_Data *sd = _pd;
5028    *ret = -1;
5029
5030 #ifdef HAVE_ELEMENTARY_X
5031    _elm_win_xwindow_get(sd);
5032    if (sd->x.xwin)
5033      *ret = ecore_x_e_illume_quickpanel_priority_minor_get(sd->x.xwin);
5034 #endif
5035 }
5036
5037 EAPI void
5038 elm_win_quickpanel_zone_set(Evas_Object *obj,
5039                             int zone)
5040 {
5041    ELM_WIN_CHECK(obj);
5042    eo_do(obj, elm_obj_win_quickpanel_zone_set(zone));
5043 }
5044
5045 static void
5046 _quickpanel_zone_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5047 {
5048    int zone = va_arg(*list, int);
5049    Elm_Win_Smart_Data *sd = _pd;
5050
5051 #ifdef HAVE_ELEMENTARY_X
5052    _elm_win_xwindow_get(sd);
5053    if (sd->x.xwin)
5054      ecore_x_e_illume_quickpanel_zone_set(sd->x.xwin, zone);
5055 #else
5056    (void)zone;
5057 #endif
5058 }
5059
5060 EAPI int
5061 elm_win_quickpanel_zone_get(const Evas_Object *obj)
5062 {
5063    ELM_WIN_CHECK(obj) 0;
5064    int ret = 0;
5065    eo_do((Eo *) obj, elm_obj_win_quickpanel_zone_get(&ret));
5066    return ret;
5067 }
5068
5069 static void
5070 _quickpanel_zone_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5071 {
5072    int *ret = va_arg(*list, int *);
5073    Elm_Win_Smart_Data *sd = _pd;
5074    *ret = 0;
5075
5076 #ifdef HAVE_ELEMENTARY_X
5077    _elm_win_xwindow_get(sd);
5078    if (sd->x.xwin)
5079      *ret = ecore_x_e_illume_quickpanel_zone_get(sd->x.xwin);
5080 #endif
5081 }
5082
5083 EAPI void
5084 elm_win_prop_focus_skip_set(Evas_Object *obj,
5085                             Eina_Bool skip)
5086 {
5087    ELM_WIN_CHECK(obj);
5088    eo_do(obj, elm_obj_win_prop_focus_skip_set(skip));
5089 }
5090
5091 static void
5092 _prop_focus_skip_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5093 {
5094    Eina_Bool skip = va_arg(*list, int);
5095    Elm_Win_Smart_Data *sd = _pd;
5096
5097    sd->skip_focus = skip;
5098    TRAP(sd, focus_skip_set, skip);
5099 }
5100
5101 EAPI void
5102 elm_win_illume_command_send(Evas_Object *obj,
5103                             Elm_Illume_Command command,
5104                             void *params)
5105 {
5106    ELM_WIN_CHECK(obj);
5107    eo_do(obj, elm_obj_win_illume_command_send(command, params));
5108 }
5109
5110 static void
5111 _illume_command_send(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5112 {
5113    Elm_Illume_Command command = va_arg(*list, Elm_Illume_Command);
5114    void *params = va_arg(*list, void *);
5115    (void) params;
5116    Elm_Win_Smart_Data *sd = _pd;
5117
5118 #ifdef HAVE_ELEMENTARY_X
5119    _elm_win_xwindow_get(sd);
5120    if (sd->x.xwin)
5121      {
5122         switch (command)
5123           {
5124            case ELM_ILLUME_COMMAND_FOCUS_BACK:
5125              ecore_x_e_illume_focus_back_send(sd->x.xwin);
5126              break;
5127
5128            case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
5129              ecore_x_e_illume_focus_forward_send(sd->x.xwin);
5130              break;
5131
5132            case ELM_ILLUME_COMMAND_FOCUS_HOME:
5133              ecore_x_e_illume_focus_home_send(sd->x.xwin);
5134              break;
5135
5136            case ELM_ILLUME_COMMAND_CLOSE:
5137              ecore_x_e_illume_close_send(sd->x.xwin);
5138              break;
5139
5140            default:
5141              break;
5142           }
5143      }
5144 #else
5145    (void)command;
5146 #endif
5147 }
5148
5149 EAPI Evas_Object *
5150 elm_win_inlined_image_object_get(Evas_Object *obj)
5151 {
5152    ELM_WIN_CHECK(obj) NULL;
5153    Evas_Object *ret = NULL;
5154    eo_do(obj, elm_obj_win_inlined_image_object_get(&ret));
5155    return ret;
5156 }
5157
5158 static void
5159 _inlined_image_object_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5160 {
5161    Evas_Object **ret = va_arg(*list, Evas_Object **);
5162    Elm_Win_Smart_Data *sd = _pd;
5163    *ret = sd->img_obj;
5164 }
5165
5166 EAPI void
5167 elm_win_focus_highlight_enabled_set(Evas_Object *obj,
5168                                     Eina_Bool enabled)
5169 {
5170    ELM_WIN_CHECK(obj);
5171    eo_do(obj, elm_obj_win_focus_highlight_enabled_set(enabled));
5172 }
5173
5174 static void
5175 _focus_highlight_enabled_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5176 {
5177    Eina_Bool enabled = va_arg(*list, int);
5178    Elm_Win_Smart_Data *sd = _pd;
5179
5180    enabled = !!enabled;
5181    if (sd->focus_highlight.enabled == enabled)
5182      return;
5183
5184    sd->focus_highlight.enabled = enabled;
5185
5186    if (sd->focus_highlight.enabled)
5187      _elm_win_focus_highlight_init(sd);
5188    else
5189      _elm_win_focus_highlight_shutdown(sd);
5190 }
5191
5192 EAPI Eina_Bool
5193 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
5194 {
5195    ELM_WIN_CHECK(obj) EINA_FALSE;
5196    Eina_Bool ret = EINA_FALSE;
5197    eo_do((Eo *) obj, elm_obj_win_focus_highlight_enabled_get(&ret));
5198    return ret;
5199 }
5200
5201 static void
5202 _focus_highlight_enabled_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5203 {
5204    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
5205    Elm_Win_Smart_Data *sd = _pd;
5206    *ret = sd->focus_highlight.enabled;
5207 }
5208
5209 EAPI void
5210 elm_win_focus_highlight_style_set(Evas_Object *obj,
5211                                   const char *style)
5212 {
5213    ELM_WIN_CHECK(obj);
5214    eo_do(obj, elm_obj_win_focus_highlight_style_set(style));
5215 }
5216
5217 static void
5218 _elm_win_smart_theme(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
5219 {
5220    Elm_Win_Smart_Data *sd = _pd;
5221    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
5222    Eina_Bool int_ret = EINA_FALSE;
5223
5224    if (ret) *ret = EINA_TRUE;
5225
5226    eo_do_super(obj, MY_CLASS, elm_wdg_theme(&int_ret));
5227    if (!int_ret) return;
5228
5229    sd->focus_highlight.theme_changed = EINA_TRUE;
5230    _elm_win_focus_highlight_reconfigure_job_start(sd);
5231
5232    if (ret) *ret = EINA_TRUE;
5233 }
5234
5235 static void
5236 _focus_highlight_style_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5237 {
5238    const char *style = va_arg(*list, const char *);
5239    Elm_Win_Smart_Data *sd = _pd;
5240
5241    eina_stringshare_replace(&sd->focus_highlight.style, style);
5242    sd->focus_highlight.theme_changed = EINA_TRUE;
5243    _elm_win_focus_highlight_reconfigure_job_start(sd);
5244 }
5245
5246 EAPI const char *
5247 elm_win_focus_highlight_style_get(const Evas_Object *obj)
5248 {
5249    ELM_WIN_CHECK(obj) NULL;
5250    const char *ret = NULL;
5251    eo_do((Eo *) obj, elm_obj_win_focus_highlight_style_get(&ret));
5252    return ret;
5253 }
5254
5255 static void
5256 _focus_highlight_style_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5257 {
5258    const char **ret = va_arg(*list, const char **);
5259    Elm_Win_Smart_Data *sd = _pd;
5260    *ret = sd->focus_highlight.style;
5261 }
5262
5263 EAPI void
5264 elm_win_focus_highlight_animate_set(Evas_Object *obj,
5265                                     Eina_Bool animate)
5266 {
5267    ELM_WIN_CHECK(obj);
5268    eo_do(obj, elm_obj_win_focus_highlight_animate_set(animate));
5269 }
5270
5271 static void
5272 _focus_highlight_animate_set(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5273 {
5274    Eina_Bool animate = va_arg(*list, int);
5275    Elm_Win_Smart_Data *sd = _pd;
5276
5277    animate = !!animate;
5278    if (sd->focus_highlight.animate == animate)
5279      return;
5280
5281    sd->focus_highlight.animate = animate;
5282    sd->focus_highlight.theme_changed = EINA_TRUE;
5283    _elm_win_focus_highlight_reconfigure_job_start(sd);
5284 }
5285
5286 EAPI Eina_Bool
5287 elm_win_focus_highlight_animate_get(const Evas_Object *obj)
5288 {
5289    ELM_WIN_CHECK(obj) EINA_FALSE;
5290    Eina_Bool ret = EINA_FALSE;
5291    eo_do((Eo *) obj, elm_obj_win_focus_highlight_animate_get(&ret));
5292    return ret;
5293 }
5294
5295 static void
5296 _focus_highlight_animate_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5297 {
5298    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
5299    Elm_Win_Smart_Data *sd = _pd;
5300    *ret = sd->focus_highlight.animate;
5301 }
5302
5303 EAPI Eina_Bool
5304 elm_win_socket_listen(Evas_Object *obj,
5305                       const char *svcname,
5306                       int svcnum,
5307                       Eina_Bool svcsys)
5308 {
5309    ELM_WIN_CHECK(obj) EINA_FALSE;
5310    Eina_Bool ret = EINA_FALSE;
5311    eo_do(obj, elm_obj_win_socket_listen(svcname, svcnum, svcsys, &ret));
5312    return ret;
5313 }
5314
5315 static void
5316 _socket_listen(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5317 {
5318    const char *svcname = va_arg(*list, const char *);
5319    int svcnum = va_arg(*list, int);
5320    Eina_Bool svcsys = va_arg(*list, int);
5321    Eina_Bool *ret = va_arg(*list, Eina_Bool *);
5322    Elm_Win_Smart_Data *sd = _pd;
5323    *ret = EINA_FALSE;
5324
5325    if (!sd->ee) return;
5326
5327    if (!ecore_evas_extn_socket_listen(sd->ee, svcname, svcnum, svcsys))
5328      return;
5329
5330    *ret = EINA_TRUE;
5331 }
5332
5333 /* windowing specific calls - shall we do this differently? */
5334
5335 EAPI Ecore_X_Window
5336 elm_win_xwindow_get(const Evas_Object *obj)
5337 {
5338    if (!obj) return 0;
5339
5340    if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME))
5341      {
5342         Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
5343         return _elm_ee_xwin_get(ee);
5344      }
5345
5346    ELM_WIN_CHECK(obj) 0;
5347    Ecore_X_Window ret = 0;
5348    eo_do((Eo *) obj, elm_obj_win_xwindow_get(&ret));
5349    return ret;
5350 }
5351
5352 static void
5353 _xwindow_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
5354 {
5355    Ecore_X_Window *ret = va_arg(*list, Ecore_X_Window *);
5356    Elm_Win_Smart_Data *sd = _pd;
5357
5358 #ifdef HAVE_ELEMENTARY_X
5359    if (sd->x.xwin)
5360      {
5361         *ret = sd->x.xwin;
5362         return;
5363      }
5364    if (sd->parent)
5365      {
5366         *ret = elm_win_xwindow_get(sd->parent);
5367         return;
5368      }
5369 #endif
5370    *ret = 0;
5371 }
5372
5373 EAPI Ecore_Wl_Window *
5374 elm_win_wl_window_get(const Evas_Object *obj)
5375 {
5376    if (!obj) return NULL;
5377
5378    if ((!ENGINE_COMPARE(ELM_WAYLAND_SHM)) &&
5379        (!ENGINE_COMPARE(ELM_WAYLAND_EGL)))
5380      return NULL;
5381
5382    if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME))
5383      {
5384         Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
5385         return ecore_evas_wayland_window_get(ee);
5386      }
5387
5388    ELM_WIN_CHECK(obj) NULL;
5389    Ecore_Wl_Window *ret = NULL;
5390    eo_do((Eo *) obj, elm_obj_win_wl_window_get(&ret));
5391    return ret;
5392 }
5393
5394 static void
5395 _wl_window_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
5396 {
5397    Ecore_Wl_Window **ret = va_arg(*list, Ecore_Wl_Window **);
5398 #if HAVE_ELEMENTARY_WAYLAND
5399    Elm_Win_Smart_Data *sd = _pd;
5400    if (sd->wl.win)
5401      {
5402         *ret = sd->wl.win;
5403         return;
5404      }
5405    if (sd->parent)
5406      {
5407         *ret = elm_win_wl_window_get(sd->parent);
5408         return;
5409      }
5410 #endif
5411    *ret = NULL;
5412 }
5413
5414 EAPI Eina_Bool
5415 elm_win_trap_set(const Elm_Win_Trap *t)
5416 {
5417    DBG("old %p, new %p", trap, t);
5418
5419    if ((t) && (t->version != ELM_WIN_TRAP_VERSION))
5420      {
5421         CRITICAL("trying to set a trap version %lu while %lu was expected!",
5422                  t->version, ELM_WIN_TRAP_VERSION);
5423         return EINA_FALSE;
5424      }
5425
5426    trap = t;
5427    return EINA_TRUE;
5428 }
5429
5430 EAPI void
5431 elm_win_floating_mode_set(Evas_Object *obj, Eina_Bool floating)
5432 {
5433    ELM_WIN_CHECK(obj);
5434    ELM_WIN_DATA_GET_OR_RETURN(obj, sd);
5435
5436    if (floating == sd->floating) return;
5437    sd->floating = floating;
5438 #ifdef HAVE_ELEMENTARY_X
5439    _elm_win_xwindow_get(sd);
5440    if (sd->x.xwin)
5441      {
5442         if (sd->floating)
5443           ecore_x_e_illume_window_state_set
5444              (sd->x.xwin, ECORE_X_ILLUME_WINDOW_STATE_FLOATING);
5445         else
5446           ecore_x_e_illume_window_state_set
5447              (sd->x.xwin, ECORE_X_ILLUME_WINDOW_STATE_NORMAL);
5448      }
5449 #endif
5450 }
5451
5452 EAPI Eina_Bool
5453 elm_win_floating_mode_get(const Evas_Object *obj)
5454 {
5455    ELM_WIN_CHECK(obj) EINA_FALSE;
5456    ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
5457
5458    return sd->floating;
5459 }
5460
5461 static void
5462 _window_id_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
5463 {
5464    Ecore_Window *ret = va_arg(*list, Ecore_Window *);
5465    Elm_Win_Smart_Data *sd = _pd;
5466
5467    if ((ENGINE_COMPARE(ELM_WAYLAND_SHM)) || (ENGINE_COMPARE(ELM_WAYLAND_EGL)))
5468      {
5469 #if HAVE_ELEMENTARY_WAYLAND
5470         if (sd->wl.win)
5471           {
5472              *ret = (Ecore_Window)ecore_wl_window_surface_id_get(sd->wl.win);
5473              return;
5474           }
5475         if (sd->parent)
5476           {
5477              Ecore_Wl_Window *parent;
5478
5479              parent = elm_win_wl_window_get(sd->parent);
5480              if (parent) *ret = (Ecore_Window)ecore_wl_window_surface_id_get(parent);
5481              return;
5482           }
5483 #endif
5484      }
5485    else
5486      {
5487 #ifdef HAVE_ELEMENTARY_X
5488         _elm_win_xwindow_get(sd);
5489         if (sd->x.xwin)
5490           {
5491              *ret = (Ecore_Window)sd->x.xwin;
5492              return;
5493           }
5494         if (sd->parent)
5495           {
5496              *ret = (Ecore_Window)elm_win_xwindow_get(sd->parent);
5497              return;
5498           }
5499 #endif
5500      }
5501
5502    *ret = 0;
5503 }
5504
5505 EAPI Ecore_Window
5506 elm_win_window_id_get(const Evas_Object *obj)
5507 {
5508    if (!obj) return 0;
5509
5510    if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME))
5511      {
5512         Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
5513         return ecore_evas_window_get(ee);
5514      }
5515
5516    ELM_WIN_CHECK(obj) 0;
5517    Ecore_Window ret = 0;
5518    eo_do((Eo *) obj, elm_obj_win_window_id_get(&ret));
5519    return ret;
5520 }
5521
5522 static void
5523 _class_constructor(Eo_Class *klass)
5524 {
5525    const Eo_Op_Func_Description func_desc[] = {
5526         EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
5527         EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_win_smart_add),
5528         EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_win_smart_del),
5529         EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_RESIZE), _elm_win_smart_resize),
5530         EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_MOVE), _elm_win_smart_move),
5531         EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_SHOW), _elm_win_smart_show),
5532         EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_HIDE), _elm_win_smart_hide),
5533
5534         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ON_FOCUS), _elm_win_smart_on_focus),
5535         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_EVENT), _elm_win_smart_event),
5536         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_win_smart_focus_next_manager_is),
5537         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT), _elm_win_smart_focus_next),
5538         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_win_smart_focus_direction_manager_is),
5539         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION), _elm_win_smart_focus_direction),
5540         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME), _elm_win_smart_theme),
5541
5542         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WIN_CONSTRUCTOR), _win_constructor),
5543         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_RESIZE_OBJECT_ADD), _resize_object_add),
5544         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_RESIZE_OBJECT_DEL), _resize_object_del),
5545         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_TITLE_SET), _title_set),
5546         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_TITLE_GET), _title_get),
5547         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ICON_NAME_SET), _icon_name_set),
5548         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ICON_NAME_GET), _icon_name_get),
5549         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ROLE_SET), _role_set),
5550         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ROLE_GET), _role_get),
5551         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ICON_OBJECT_SET), _icon_object_set),
5552         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ICON_OBJECT_GET), _icon_object_get),
5553         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_AUTODEL_SET), _autodel_set),
5554         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_AUTODEL_GET), _autodel_get),
5555         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ACTIVATE), _activate),
5556         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_LOWER), _lower),
5557         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_RAISE), _raise),
5558         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_CENTER), _center),
5559         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_BORDERLESS_SET), _borderless_set),
5560         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_BORDERLESS_GET), _borderless_get),
5561         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SHAPED_SET), _shaped_set),
5562         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SHAPED_GET), _shaped_get),
5563         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ALPHA_SET), _alpha_set),
5564         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ALPHA_GET), _alpha_get),
5565         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_OVERRIDE_SET), _override_set),
5566         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_OVERRIDE_GET), _override_get),
5567         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FULLSCREEN_SET), _fullscreen_set),
5568         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FULLSCREEN_GET), _fullscreen_get),
5569         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_MAIN_MENU_GET), _main_menu_get),
5570         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_MAXIMIZED_SET), _maximized_set),
5571         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_MAXIMIZED_GET), _maximized_get),
5572         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ICONIFIED_SET), _iconified_set),
5573         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ICONIFIED_GET), _iconified_get),
5574         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WITHDRAWN_SET), _withdrawn_set),
5575         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WITHDRAWN_GET), _withdrawn_get),
5576         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_SET), _available_profiles_set),
5577         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_GET), _available_profiles_get),
5578         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_PROFILE_SET), _profile_set),
5579         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_PROFILE_GET), _profile_get),
5580         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_URGENT_SET), _urgent_set),
5581         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_URGENT_GET), _urgent_get),
5582         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_DEMAND_ATTENTION_SET), _demand_attention_set),
5583         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_DEMAND_ATTENTION_GET), _demand_attention_get),
5584         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_MODAL_SET), _modal_set),
5585         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_MODAL_GET), _modal_get),
5586         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ASPECT_SET), _aspect_set),
5587         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ASPECT_GET), _aspect_get),
5588         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SIZE_BASE_SET), _size_base_set),
5589         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SIZE_BASE_GET), _size_base_get),
5590         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SIZE_STEP_SET), _size_step_set),
5591         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SIZE_STEP_GET), _size_step_get),
5592         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_LAYER_SET), _layer_set),
5593         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_LAYER_GET), _layer_get),
5594         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ROTATION_SET), _rotation_set),
5595         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ROTATION_WITH_RESIZE_SET), _rotation_with_resize_set),
5596         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ROTATION_GET), _rotation_get),
5597         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_STICKY_SET), _sticky_set),
5598         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_STICKY_GET), _sticky_get),
5599         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_KEYBOARD_MODE_SET), _keyboard_mode_set),
5600         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_KEYBOARD_MODE_GET), _keyboard_mode_get),
5601         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_KEYBOARD_WIN_SET), _keyboard_win_set),
5602         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_KEYBOARD_WIN_GET), _keyboard_win_get),
5603         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_INDICATOR_MODE_SET), _indicator_mode_set),
5604         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_INDICATOR_MODE_GET), _indicator_mode_get),
5605         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_INDICATOR_OPACITY_SET), _indicator_opacity_set),
5606         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_INDICATOR_OPACITY_GET), _indicator_opacity_get),
5607         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SCREEN_POSITION_GET), _screen_position_get),
5608         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_GET), _focus_get),
5609         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SCREEN_CONSTRAIN_SET), _screen_constrain_set),
5610         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SCREEN_CONSTRAIN_GET), _screen_constrain_get),
5611         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SCREEN_SIZE_GET), _screen_size_get),
5612         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SCREEN_DPI_GET), _screen_dpi_get),
5613         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_CONFORMANT_SET), _conformant_set),
5614         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_CONFORMANT_GET), _conformant_get),
5615         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_SET), _quickpanel_set),
5616         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_GET), _quickpanel_get),
5617         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_PRIORITY_MAJOR_SET), _quickpanel_priority_major_set),
5618         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_PRIORITY_MAJOR_GET), _quickpanel_priority_major_get),
5619         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_PRIORITY_MINOR_SET), _quickpanel_priority_minor_set),
5620         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_PRIORITY_MINOR_GET), _quickpanel_priority_minor_get),
5621         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_ZONE_SET), _quickpanel_zone_set),
5622         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_ZONE_GET), _quickpanel_zone_get),
5623         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_PROP_FOCUS_SKIP_SET), _prop_focus_skip_set),
5624         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_ILLUME_COMMAND_SEND), _illume_command_send),
5625         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_INLINED_IMAGE_OBJECT_GET), _inlined_image_object_get),
5626         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_SET), _focus_highlight_enabled_set),
5627         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET), _focus_highlight_enabled_get),
5628         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET), _focus_highlight_style_set),
5629         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET), _focus_highlight_style_get),
5630         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_SET), _focus_highlight_animate_set),
5631         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_GET), _focus_highlight_animate_get),
5632         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN), _socket_listen),
5633         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET), _xwindow_get),
5634         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET), _wl_window_get),
5635         EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WINDOW_ID_GET), _window_id_get),
5636         EO_OP_FUNC_SENTINEL
5637    };
5638
5639    eo_class_funcs_set(klass, func_desc);
5640
5641    evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
5642 }
5643
5644 static const Eo_Op_Description op_desc[] = {
5645      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WIN_CONSTRUCTOR, "Adds a window object."),
5646      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_RESIZE_OBJECT_ADD, "Add subobj as a resize object of window obj."),
5647      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_RESIZE_OBJECT_DEL, "Delete subobj as a resize object of window obj."),
5648      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_TITLE_SET, "Set the title of the window."),
5649      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_TITLE_GET, "Get the title of the window."),
5650      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ICON_NAME_SET, "Set the icon name of the window."),
5651      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ICON_NAME_GET, "Get the icon name of the window."),
5652      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ROLE_SET, "Set the role of the window."),
5653      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ROLE_GET, "Get the role of the window."),
5654      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ICON_OBJECT_SET, "Set a window object's icon."),
5655      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ICON_OBJECT_GET, "Get the icon object used for the window."),
5656      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_AUTODEL_SET, "Set the window's autodel state."),
5657      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_AUTODEL_GET, "Get the window's autodel state."),
5658      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ACTIVATE, "Activate a window object."),
5659      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_LOWER, "Lower a window object."),
5660      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_RAISE, "Raise a window object."),
5661      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_CENTER, "Center a window on its screen."),
5662      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_BORDERLESS_SET, "Set the borderless state of a window."),
5663      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_BORDERLESS_GET, "Get the borderless state of a window."),
5664      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SHAPED_SET, "Set the shaped state of a window."),
5665      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SHAPED_GET, "Get the shaped state of a window."),
5666      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ALPHA_SET, "Set the alpha channel state of a window."),
5667      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ALPHA_GET, "Get the alpha channel state of a window."),
5668      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_OVERRIDE_SET, "Set the override state of a window."),
5669      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_OVERRIDE_GET, "Get the override state of a window."),
5670      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FULLSCREEN_SET, "Set the fullscreen state of a window."),
5671      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FULLSCREEN_GET, "Get the fullscreen state of a window."),
5672      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_MAIN_MENU_GET, "Get the Main Menu of a window."),
5673      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_MAXIMIZED_SET, "Set the maximized state of a window."),
5674      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_MAXIMIZED_GET, "Get the maximized state of a window."),
5675      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ICONIFIED_SET, "Set the iconified state of a window."),
5676      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ICONIFIED_GET, "Get the iconified state of a window."),
5677      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WITHDRAWN_SET, "Set the withdrawn state of a window."),
5678      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WITHDRAWN_GET, "Get the withdrawn state of a window."),
5679      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_SET, "Set the array of available profiles to a window."),
5680      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_AVAILABLE_PROFILES_GET, "Get the array of available profiles of a window."),
5681      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_PROFILE_SET, "Set the profile of a window."),
5682      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_PROFILE_GET, "Get the profile of a window."),
5683      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_URGENT_SET, "Set the urgent state of a window."),
5684      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_URGENT_GET, "Get the urgent state of a window."),
5685      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_DEMAND_ATTENTION_SET, "Set the demand_attention state of a window."),
5686      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_DEMAND_ATTENTION_GET, "Get the demand_attention state of a window."),
5687      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_MODAL_SET, "Set the modal state of a window."),
5688      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_MODAL_GET, "Get the modal state of a window."),
5689      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ASPECT_SET, "Set the aspect ratio of a window."),
5690      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ASPECT_GET, "Get the aspect ratio of a window."),
5691      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SIZE_BASE_SET, "Set the base window size used with stepping calculation."),
5692      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SIZE_BASE_GET, "Get the base size of a window."),
5693      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SIZE_STEP_SET, "Set the window stepping used with sizing calculation."),
5694      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SIZE_STEP_GET, "Get the stepping of a window."),
5695      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_LAYER_SET, "Set the layer of the window."),
5696      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_LAYER_GET, "Get the layer of the window."),
5697      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ROTATION_SET, "Set the rotation of the window."),
5698      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ROTATION_WITH_RESIZE_SET, "Rotates the window and resizes it."),
5699      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ROTATION_GET, "Get the rotation of the window."),
5700      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_STICKY_SET, "Set the sticky state of the window."),
5701      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_STICKY_GET, "Get the sticky state of the window."),
5702      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_KEYBOARD_MODE_SET, "Sets the keyboard mode of the window."),
5703      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_KEYBOARD_MODE_GET, "Get the keyboard mode of the window."),
5704      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_KEYBOARD_WIN_SET, "Sets whether the window is a keyboard."),
5705      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_KEYBOARD_WIN_GET, "Get whether the window is a keyboard."),
5706      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_INDICATOR_MODE_SET, "Sets the indicator mode of the window."),
5707      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_INDICATOR_MODE_GET, "Get the indicator mode of the window."),
5708      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_INDICATOR_OPACITY_SET, "Sets the indicator opacity mode of the window."),
5709      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_INDICATOR_OPACITY_GET, "Get the indicator opacity mode of the window."),
5710      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SCREEN_POSITION_GET, "Get the screen position of a window."),
5711      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_GET, "Determine whether a window has focus."),
5712      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SCREEN_CONSTRAIN_SET, "Constrain the maximum width and height of a window to the width and height of its screen."),
5713      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SCREEN_CONSTRAIN_GET, "Retrieve the constraints on the maximum width and height of a window relative to the width and height of its screen."),
5714      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SCREEN_SIZE_GET, "Get screen geometry details for the screen that a window is on."),
5715      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SCREEN_DPI_GET, "Get screen dpi for the screen that a window is on."),
5716      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_CONFORMANT_SET, "Set if this window is an illume conformant window."),
5717      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_CONFORMANT_GET, "Get if this window is an illume conformant window."),
5718      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_SET, "Set a window to be an illume quickpanel window."),
5719      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_GET, "Get if this window is a quickpanel or not."),
5720      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_PRIORITY_MAJOR_SET, "Set the major priority of a quickpanel window."),
5721      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_PRIORITY_MAJOR_GET, "Get the major priority of a quickpanel window."),
5722      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_PRIORITY_MINOR_SET, "Set the minor priority of a quickpanel window."),
5723      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_PRIORITY_MINOR_GET, "Get the minor priority of a quickpanel window."),
5724      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_ZONE_SET, "Set which zone this quickpanel should appear in."),
5725      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_QUICKPANEL_ZONE_GET, "Get which zone this quickpanel should appear in."),
5726      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_PROP_FOCUS_SKIP_SET, "Set the window to be skipped by keyboard focus."),
5727      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_ILLUME_COMMAND_SEND, "Send a command to the windowing environment."),
5728      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_INLINED_IMAGE_OBJECT_GET, "Get the inlined image object handle."),
5729      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_SET, "Set the enabled status for the focus highlight in a window."),
5730      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ENABLED_GET, "Get the enabled value of the focus highlight for this window."),
5731      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_SET, "Set the style for the focus highlight on this window."),
5732      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_STYLE_GET, "Get the style set for the focus highlight object."),
5733      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_SET, "Set the animate status for the focus highlight for this window."),
5734      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_FOCUS_HIGHLIGHT_ANIMATE_GET, "Get the animate status for the focus highlight for this window."),
5735      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_SOCKET_LISTEN, "Create a socket to provide the service for Plug widget."),
5736      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_XWINDOW_GET, "Get the Ecore_X_Window of an Evas_Object."),
5737      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WL_WINDOW_GET, "Get the Ecore_Wl_Window of an Evas_Object."),
5738      EO_OP_DESCRIPTION(ELM_OBJ_WIN_SUB_ID_WINDOW_ID_GET, "Get the Ecore_Window of an Evas_Object."),
5739      EO_OP_DESCRIPTION_SENTINEL
5740 };
5741
5742 static const Eo_Class_Description class_desc = {
5743      EO_VERSION,
5744      MY_CLASS_NAME,
5745      EO_CLASS_TYPE_REGULAR,
5746      EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_WIN_BASE_ID, op_desc, ELM_OBJ_WIN_SUB_ID_LAST),
5747      NULL,
5748      sizeof(Elm_Win_Smart_Data),
5749      _class_constructor,
5750      NULL
5751 };
5752
5753 EO_DEFINE_CLASS(elm_obj_win_class_get, &class_desc, ELM_OBJ_WIDGET_CLASS, NULL);