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