summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Torri <vincent dot torri at gmail dot com>2015-10-15 23:13:42 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-12-03 11:36:50 -0800
commitec89b9675334b9a2cfe3753f16a25be7bebc3e51 (patch)
tree07bd47df724ba26a5f7426189da887c2e75ca53d
parent3808637283efafd6c70a9fcf35d962cab2bbd8e1 (diff)
cnp: add Copy & Paste support for Windows
It needs the clipboard management in Ecore_Win32 @feature Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/lib/elm_cnp.c339
-rw-r--r--src/lib/elm_config.c5
-rw-r--r--src/lib/elm_priv.h3
-rw-r--r--src/lib/elm_win.c84
-rw-r--r--src/lib/elm_win.eo10
-rw-r--r--src/lib/elm_win_legacy.h17
6 files changed, 457 insertions, 1 deletions
diff --git a/src/lib/elm_cnp.c b/src/lib/elm_cnp.c
index ed6f3a1a3..f1d0fb70c 100644
--- a/src/lib/elm_cnp.c
+++ b/src/lib/elm_cnp.c
@@ -3969,6 +3969,320 @@ _local_elm_selection_selection_has_owner(Evas_Object *obj EINA_UNUSED)
3969} 3969}
3970#endif 3970#endif
3971 3971
3972// win32 specific stuff
3973////////////////////////////////////////////////////////////////////////////
3974#ifdef HAVE_ELEMENTARY_WIN32
3975
3976typedef struct _Win32_Cnp_Selection Win32_Cnp_Selection;
3977
3978struct _Win32_Cnp_Selection
3979{
3980 const char *debug;
3981 Evas_Object *widget;
3982 char *selbuf;
3983 Evas_Object *requestwidget;
3984 void *udata;
3985 Elm_Sel_Format requestformat;
3986 Elm_Drop_Cb datacb;
3987 Eina_Bool (*set)(const Ecore_Win32_Window *window, const void *data, int size);
3988 Eina_Bool (*clear)(const Ecore_Win32_Window *window);
3989 Eina_Bool (*get)(const Ecore_Win32_Window *window , void **data, int *size);
3990 Elm_Selection_Loss_Cb loss_cb;
3991 void *loss_data;
3992
3993 Elm_Sel_Format format;
3994 Ecore_Win32_Selection ecore_sel;
3995 Ecore_Win32_Window *win;
3996 Elm_Xdnd_Action action;
3997
3998 Eina_Bool active : 1;
3999};
4000
4001#define ARRAYINIT(foo) [foo] =
4002
4003static Win32_Cnp_Selection _win32_selections[ELM_SEL_TYPE_CLIPBOARD + 1] =
4004{
4005 ARRAYINIT(ELM_SEL_TYPE_PRIMARY)
4006 {
4007 .debug = "Primary",
4008 .ecore_sel = ECORE_WIN32_SELECTION_PRIMARY,
4009 .set = ecore_win32_clipboard_set,
4010 .clear = ecore_win32_clipboard_clear,
4011 .get = ecore_win32_clipboard_get,
4012 },
4013 ARRAYINIT(ELM_SEL_TYPE_SECONDARY)
4014 {
4015 .debug = "Secondary",
4016 .ecore_sel = ECORE_WIN32_SELECTION_OTHER,
4017 },
4018 ARRAYINIT(ELM_SEL_TYPE_XDND)
4019 {
4020 .debug = "XDnD",
4021 .ecore_sel = ECORE_WIN32_SELECTION_OTHER,
4022 },
4023 ARRAYINIT(ELM_SEL_TYPE_CLIPBOARD)
4024 {
4025 .debug = "Clipboard",
4026 .ecore_sel = ECORE_WIN32_SELECTION_CLIPBOARD,
4027 .set = ecore_win32_clipboard_set,
4028 .clear = ecore_win32_clipboard_clear,
4029 .get = ecore_win32_clipboard_get,
4030 }
4031};
4032
4033
4034static void
4035_win32_sel_obj_del(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
4036{
4037 Win32_Cnp_Selection *sel = data;
4038 if (sel->widget == obj) sel->widget = NULL;
4039 if (dragwidget == obj) dragwidget = NULL;
4040}
4041
4042static void
4043_win32_sel_obj_del2(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
4044{
4045 Win32_Cnp_Selection *sel = data;
4046 if (sel->requestwidget == obj) sel->requestwidget = NULL;
4047}
4048
4049static Eina_Bool
4050_win32_elm_cnp_init(void)
4051{
4052 static int _init_count = 0;
4053
4054 if (_init_count > 0) return EINA_TRUE;
4055 _init_count++;
4056 return EINA_TRUE;
4057}
4058
4059static Ecore_Win32_Window *
4060_win32_elm_widget_window_get(const Evas_Object *obj)
4061{
4062 Evas_Object *top;
4063 Ecore_Win32_Window *win = NULL;
4064
4065 if (elm_widget_is(obj))
4066 {
4067 top = elm_widget_top_get(obj);
4068 if (!top)
4069 {
4070 Evas_Object *par;
4071 par = elm_widget_parent_widget_get(obj);
4072 if (par) top = elm_widget_top_get(par);
4073 }
4074 if (top && (eo_isa(top, ELM_WIN_CLASS)))
4075 win = elm_win_win32_window_get(top);
4076 }
4077
4078 if (!win)
4079 {
4080 Ecore_Evas *ee;
4081 Evas *evas;
4082 const char *engine_name;
4083
4084 evas = evas_object_evas_get(obj);
4085 if (!evas) return NULL;
4086
4087 ee = ecore_evas_ecore_evas_get(evas);
4088 if (!ee) return NULL;
4089
4090 engine_name = ecore_evas_engine_name_get(ee);
4091 if (!strcmp(engine_name, ELM_BUFFER))
4092 {
4093 ee = ecore_evas_buffer_ecore_evas_parent_get(ee);
4094 if (!ee) return NULL;
4095 win = ecore_evas_win32_window_get(ee);
4096 }
4097 else
4098 {
4099 if ((strcmp(engine_name, ELM_SOFTWARE_WIN32) == 0) ||
4100 (strcmp(engine_name, ELM_SOFTWARE_DDRAW) == 0))
4101 return ecore_evas_win32_window_get(ee);
4102 }
4103 }
4104
4105 return win;
4106}
4107
4108static Eina_Bool
4109_win32_elm_cnp_selection_set(Ecore_Win32_Window *win, Evas_Object *obj, Elm_Sel_Type selection, Elm_Sel_Format format, const void *selbuf, size_t buflen)
4110{
4111 Win32_Cnp_Selection *sel;
4112
4113 if (selection != ELM_SEL_TYPE_CLIPBOARD)
4114 return EINA_FALSE;
4115
4116 _win32_elm_cnp_init();
4117 if ((!selbuf) && (format != ELM_SEL_FORMAT_IMAGE))
4118 return elm_object_cnp_selection_clear(obj, selection);
4119
4120 sel = _win32_selections + selection;
4121 if (sel->widget != obj && sel->loss_cb) sel->loss_cb(sel->loss_data, selection);
4122 if (sel->widget)
4123 evas_object_event_callback_del_full(sel->widget, EVAS_CALLBACK_DEL,
4124 _win32_sel_obj_del, sel);
4125 sel->active = EINA_TRUE;
4126 sel->widget = obj;
4127 sel->win = win;
4128 if (sel->set) sel->set(win, selbuf, buflen);
4129 sel->format = format;
4130 sel->loss_cb = NULL;
4131 sel->loss_data = NULL;
4132
4133 evas_object_event_callback_add
4134 (sel->widget, EVAS_CALLBACK_DEL, _win32_sel_obj_del, sel);
4135
4136 ELM_SAFE_FREE(sel->selbuf, free);
4137 if (selbuf)
4138 {
4139 if (format == ELM_SEL_FORMAT_IMAGE)
4140 {
4141 // selbuf is actual image data, not text/string
4142 sel->selbuf = malloc(buflen + 1);
4143 if (!sel->selbuf)
4144 {
4145 elm_object_cnp_selection_clear(obj, selection);
4146 return EINA_FALSE;
4147 }
4148 memcpy(sel->selbuf, selbuf, buflen);
4149 sel->selbuf[buflen] = 0;
4150 }
4151 else
4152 sel->selbuf = strdup((char*)selbuf);
4153 }
4154
4155 return EINA_TRUE;
4156}
4157
4158static void
4159_win32_elm_cnp_selection_loss_callback_set(Evas_Object *obj EINA_UNUSED, Elm_Sel_Type selection, Elm_Selection_Loss_Cb func, const void *data)
4160{
4161 Win32_Cnp_Selection *sel;
4162
4163 if (selection != ELM_SEL_TYPE_CLIPBOARD)
4164 return;
4165
4166 _win32_elm_cnp_init();
4167 sel = _win32_selections + selection;
4168 sel->loss_cb = func;
4169 sel->loss_data = (void *)data;
4170}
4171
4172static Eina_Bool
4173_win32_elm_object_cnp_selection_clear(Ecore_Win32_Window *win, Evas_Object *obj, Elm_Sel_Type selection)
4174{
4175 Win32_Cnp_Selection *sel;
4176
4177 if (selection != ELM_SEL_TYPE_CLIPBOARD)
4178 return EINA_FALSE;
4179
4180 _win32_elm_cnp_init();
4181
4182 sel = _win32_selections + selection;
4183
4184 /* No longer this selection: Consider it gone! */
4185 if ((!sel->active) || (sel->widget != obj))
4186 return EINA_TRUE;
4187
4188 if (sel->widget)
4189 evas_object_event_callback_del_full(sel->widget, EVAS_CALLBACK_DEL,
4190 _win32_sel_obj_del, sel);
4191 if (sel->requestwidget)
4192 evas_object_event_callback_del_full(sel->requestwidget, EVAS_CALLBACK_DEL,
4193 _win32_sel_obj_del2, sel);
4194 sel->widget = NULL;
4195 sel->requestwidget = NULL;
4196 sel->loss_cb = NULL;
4197 sel->loss_data = NULL;
4198
4199 sel->active = EINA_FALSE;
4200 ELM_SAFE_FREE(sel->selbuf, free);
4201 /* sel->clear(win); */
4202
4203 return EINA_TRUE;
4204}
4205
4206static Eina_Bool
4207_win32_elm_cnp_selection_get(Ecore_Win32_Window *win,
4208 const Evas_Object *obj,
4209 Elm_Sel_Type selection,
4210 Elm_Sel_Format format,
4211 Elm_Drop_Cb datacb,
4212 void *udata)
4213{
4214 Win32_Cnp_Selection *sel;
4215 void *data;
4216 int size;
4217
4218 if (selection != ELM_SEL_TYPE_CLIPBOARD)
4219 return EINA_FALSE;
4220
4221 _win32_elm_cnp_init();
4222
4223 sel = _win32_selections + selection;
4224
4225 if (sel->requestwidget)
4226 evas_object_event_callback_del_full(sel->requestwidget, EVAS_CALLBACK_DEL,
4227 _win32_sel_obj_del2, sel);
4228 sel->requestformat = format;
4229 sel->requestwidget = (Evas_Object *)obj;
4230 sel->win = win;
4231 sel->get(win, &data, &size);
4232 sel->datacb = datacb;
4233 sel->udata = udata;
4234
4235 if (!data || (size <= 0))
4236 goto cb_add;
4237
4238 if ((sel->format & ELM_SEL_FORMAT_MARKUP) ||
4239 (sel->format & ELM_SEL_FORMAT_HTML))
4240 {
4241 char *str;
4242
4243 str = (char *)malloc(size + 1);
4244 if (str)
4245 {
4246 memcpy(str, data, size);
4247 str[size] = '\0';
4248 data = _elm_util_mkup_to_text(str);
4249 free(str);
4250 if (data)
4251 size = strlen(data);
4252 else
4253 size = 0;
4254 }
4255 else
4256 {
4257 free(data);
4258 data = NULL;
4259 }
4260 }
4261
4262 if (sel->datacb && data && (size > 0))
4263 {
4264 Elm_Selection_Data sdata;
4265
4266 sdata.x = sdata.y = 0;
4267 sdata.format = ELM_SEL_FORMAT_TEXT;
4268 sdata.data = data;
4269 sdata.len = size;
4270 sdata.action = sel->action;
4271 sel->datacb(sel->udata, sel->requestwidget, &sdata);
4272 }
4273
4274 if (data)
4275 free(data);
4276
4277 cb_add:
4278 evas_object_event_callback_add
4279 (sel->requestwidget, EVAS_CALLBACK_DEL, _win32_sel_obj_del2, sel);
4280
4281 return EINA_TRUE;
4282}
4283
4284#endif /* HAVE_ELEMENTARY_WIN32 */
4285
3972// common internal funcs 4286// common internal funcs
3973//////////////////////////////////////////////////////////////////////////// 4287////////////////////////////////////////////////////////////////////////////
3974static Eina_Bool 4288static Eina_Bool
@@ -4114,6 +4428,13 @@ elm_cnp_selection_set(Evas_Object *obj, Elm_Sel_Type selection,
4114 if (win) 4428 if (win)
4115 return _cocoa_elm_cnp_selection_set(win, obj, selection, format, selbuf, buflen); 4429 return _cocoa_elm_cnp_selection_set(win, obj, selection, format, selbuf, buflen);
4116#endif 4430#endif
4431#ifdef HAVE_ELEMENTARY_WIN32
4432 Ecore_Win32_Window *win;
4433
4434 win = _win32_elm_widget_window_get(obj);
4435 if (win)
4436 return _win32_elm_cnp_selection_set(win, obj, selection, format, selbuf, buflen);
4437#endif
4117 return _local_elm_cnp_selection_set(obj, selection, format, selbuf, buflen); 4438 return _local_elm_cnp_selection_set(obj, selection, format, selbuf, buflen);
4118} 4439}
4119 4440
@@ -4136,6 +4457,10 @@ elm_cnp_selection_loss_callback_set(Evas_Object *obj, Elm_Sel_Type selection,
4136 if (_cocoa_elm_widget_cocoa_window_get(obj)) 4457 if (_cocoa_elm_widget_cocoa_window_get(obj))
4137 _cocoa_elm_cnp_selection_loss_callback_set(obj, selection, func, data); 4458 _cocoa_elm_cnp_selection_loss_callback_set(obj, selection, func, data);
4138#endif 4459#endif
4460#ifdef HAVE_ELEMENTARY_WIN32
4461 if (_win32_elm_widget_window_get(obj))
4462 _win32_elm_cnp_selection_loss_callback_set(obj, selection, func, data);
4463#endif
4139 _local_elm_cnp_selection_loss_callback_set(obj, selection, func, data); 4464 _local_elm_cnp_selection_loss_callback_set(obj, selection, func, data);
4140} 4465}
4141 4466
@@ -4156,6 +4481,13 @@ elm_object_cnp_selection_clear(Evas_Object *obj, Elm_Sel_Type selection)
4156 if (_cocoa_elm_widget_cocoa_window_get(obj)) 4481 if (_cocoa_elm_widget_cocoa_window_get(obj))
4157 return _cocoa_elm_cnp_selection_clear(obj, selection); 4482 return _cocoa_elm_cnp_selection_clear(obj, selection);
4158#endif 4483#endif
4484#ifdef HAVE_ELEMENTARY_WIN32
4485 Ecore_Win32_Window *win;
4486
4487 win = _win32_elm_widget_window_get(obj);
4488 if (win)
4489 return _win32_elm_object_cnp_selection_clear(win, obj, selection);
4490#endif
4159 return _local_elm_object_cnp_selection_clear(obj, selection); 4491 return _local_elm_object_cnp_selection_clear(obj, selection);
4160} 4492}
4161 4493
@@ -4179,6 +4511,13 @@ elm_cnp_selection_get(const Evas_Object *obj, Elm_Sel_Type selection,
4179 if (win) 4511 if (win)
4180 return _cocoa_elm_cnp_selection_get(obj, win, selection, format, datacb, udata); 4512 return _cocoa_elm_cnp_selection_get(obj, win, selection, format, datacb, udata);
4181#endif 4513#endif
4514#ifdef HAVE_ELEMENTARY_WIN32
4515 Ecore_Win32_Window *win;
4516
4517 win = _win32_elm_widget_window_get(obj);
4518 if (win)
4519 return _win32_elm_cnp_selection_get(win, obj, selection, format, datacb, udata);
4520#endif
4182 return _local_elm_cnp_selection_get(obj, selection, format, datacb, udata); 4521 return _local_elm_cnp_selection_get(obj, selection, format, datacb, udata);
4183} 4522}
4184 4523
diff --git a/src/lib/elm_config.c b/src/lib/elm_config.c
index 30032fcf5..e427fe594 100644
--- a/src/lib/elm_config.c
+++ b/src/lib/elm_config.c
@@ -3364,7 +3364,7 @@ _elm_config_file_monitor_cb(void *data EINA_UNUSED,
3364void 3364void
3365_elm_config_sub_init(void) 3365_elm_config_sub_init(void)
3366{ 3366{
3367#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WL2) 3367#if defined(HAVE_ELEMENTARY_X) || defined(HAVE_ELEMENTARY_WL2) || defined(HAVE_ELEMENTARY_WIN32)
3368 const char *ev = getenv("ELM_DISPLAY"); 3368 const char *ev = getenv("ELM_DISPLAY");
3369#endif 3369#endif
3370 3370
@@ -3443,6 +3443,9 @@ _elm_config_sub_init(void)
3443#ifdef HAVE_ELEMENTARY_COCOA 3443#ifdef HAVE_ELEMENTARY_COCOA
3444 ecore_cocoa_init(); 3444 ecore_cocoa_init();
3445#endif 3445#endif
3446#ifdef HAVE_ELEMENTARY_WIN32
3447 ecore_win32_init();
3448#endif
3446 char buf[PATH_MAX]; 3449 char buf[PATH_MAX];
3447 size_t len; 3450 size_t len;
3448 int ok = 0; 3451 int ok = 0;
diff --git a/src/lib/elm_priv.h b/src/lib/elm_priv.h
index 1afc2fc6d..61c06a8bd 100644
--- a/src/lib/elm_priv.h
+++ b/src/lib/elm_priv.h
@@ -20,6 +20,9 @@
20#endif 20#endif
21# include <Ecore_Cocoa.h> 21# include <Ecore_Cocoa.h>
22#endif 22#endif
23#ifdef HAVE_ELEMENTARY_WIN32
24#include <Ecore_Win32.h>
25#endif
23 26
24#include <Eio.h> 27#include <Eio.h>
25 28
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 2bf97e28a..3fbe2bf6a 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -123,6 +123,12 @@ struct _Elm_Win_Data
123 Ecore_Cocoa_Window *win; 123 Ecore_Cocoa_Window *win;
124 } cocoa; 124 } cocoa;
125#endif 125#endif
126#ifdef HAVE_ELEMENTARY_WIN32
127 struct
128 {
129 Ecore_Win32_Window *win;
130 } win32;
131#endif
126 132
127 Ecore_Job *deferred_resize_job; 133 Ecore_Job *deferred_resize_job;
128 Ecore_Job *deferred_child_eval_job; 134 Ecore_Job *deferred_child_eval_job;
@@ -2193,6 +2199,28 @@ _elm_ee_cocoa_win_get(const Ecore_Evas *ee)
2193 engine_name = ecore_evas_engine_name_get(ee); 2199 engine_name = ecore_evas_engine_name_get(ee);
2194 if (EINA_UNLIKELY(!engine_name)) return NULL; 2200 if (EINA_UNLIKELY(!engine_name)) return NULL;
2195 2201
2202 if ((!strcmp(engine_name, ELM_SOFTWARE_WIN32)) ||
2203 (!strcmp(engine_name, ELM_SOFTWARE_DDRAW)))
2204 {
2205 return ecore_evas_win32_window_get(ee);
2206 }
2207#else
2208 (void)ee;
2209#endif
2210 return NULL;
2211}
2212
2213Ecore_Win32_Window *
2214_elm_ee_win32win_get(const Ecore_Evas *ee)
2215{
2216#ifdef HAVE_ELEMENTARY_WIN32
2217 const char *engine_name;
2218
2219 if (!ee) return NULL;
2220
2221 engine_name = ecore_evas_engine_name_get(ee);
2222 if (EINA_UNLIKELY(!engine_name)) return NULL;
2223
2196 if (!strcmp(engine_name, "opengl_cocoa") || 2224 if (!strcmp(engine_name, "opengl_cocoa") ||
2197 !strcmp(engine_name, "gl_cocoa")) 2225 !strcmp(engine_name, "gl_cocoa"))
2198 return ecore_evas_cocoa_window_get(ee); 2226 return ecore_evas_cocoa_window_get(ee);
@@ -2210,6 +2238,14 @@ _elm_win_cocoawindow_get(Elm_Win_Data *sd)
2210} 2238}
2211#endif 2239#endif
2212 2240
2241#ifdef HAVE_ELEMENTARY_WIN32
2242static void
2243_internal_elm_win_win32window_get(Elm_Win_Data *sd)
2244{
2245 sd->win32.win = _elm_ee_win32win_get(sd->ee);
2246}
2247#endif
2248
2213#ifdef HAVE_ELEMENTARY_X 2249#ifdef HAVE_ELEMENTARY_X
2214static void 2250static void
2215_elm_win_xwin_update(Elm_Win_Data *sd) 2251_elm_win_xwin_update(Elm_Win_Data *sd)
@@ -3756,6 +3792,9 @@ _elm_win_finalize_internal(Eo *obj, Elm_Win_Data *sd, const char *name, Elm_Win_
3756#ifdef HAVE_ELEMENTARY_COCOA 3792#ifdef HAVE_ELEMENTARY_COCOA
3757 _elm_win_cocoawindow_get(sd); 3793 _elm_win_cocoawindow_get(sd);
3758#endif 3794#endif
3795#ifdef HAVE_ELEMENTARY_WIN32
3796 _internal_elm_win_win32window_get(sd);
3797#endif
3759 3798
3760 if ((_elm_config->bgpixmap) 3799 if ((_elm_config->bgpixmap)
3761#ifdef HAVE_ELEMENTARY_X 3800#ifdef HAVE_ELEMENTARY_X
@@ -5472,6 +5511,41 @@ _elm_win_wl_window_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
5472 return NULL; 5511 return NULL;
5473} 5512}
5474 5513
5514EAPI Ecore_Win32_Window *
5515elm_win_win32_window_get(const Evas_Object *obj)
5516{
5517 ELM_WIN_CHECK(obj) NULL;
5518 ELM_WIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
5519 const char *engine_name = ecore_evas_engine_name_get(sd->ee);
5520
5521 if (!(engine_name &&
5522 ((!strcmp(engine_name, ELM_SOFTWARE_WIN32)) ||
5523 (!strcmp(engine_name, ELM_SOFTWARE_DDRAW)))))
5524 return NULL;
5525
5526 if (!evas_object_smart_type_check_ptr(obj, MY_CLASS_NAME_LEGACY))
5527 {
5528 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
5529 return _elm_ee_win32win_get(ee);
5530 }
5531
5532 Ecore_Win32_Window *ret = NULL;
5533 eo_do((Eo *) obj, ret = elm_obj_win_win32_window_get());
5534 return ret;
5535}
5536
5537EOLIAN static Ecore_Win32_Window *
5538_elm_win_win32_window_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
5539{
5540#if HAVE_ELEMENTARY_WIN32
5541 if (sd->win32.win) return sd->win32.win;
5542 if (sd->parent) return elm_win_win32_window_get(sd->parent);
5543#else
5544 (void)sd;
5545#endif
5546 return NULL;
5547}
5548
5475EAPI Eina_Bool 5549EAPI Eina_Bool
5476elm_win_trap_set(const Elm_Win_Trap *t) 5550elm_win_trap_set(const Elm_Win_Trap *t)
5477{ 5551{
@@ -5567,6 +5641,16 @@ _elm_win_window_id_get(Eo *obj EINA_UNUSED, Elm_Win_Data *sd)
5567 } 5641 }
5568#endif 5642#endif
5569 } 5643 }
5644 else if ((engine_name &&
5645 ((!strcmp(engine_name, ELM_SOFTWARE_WIN32)) ||
5646 (!strcmp(engine_name, ELM_SOFTWARE_DDRAW)))))
5647 {
5648#ifdef HAVE_ELEMENTARY_WIN32
5649 _internal_elm_win_win32window_get(sd);
5650 if (sd->win32.win) return (Ecore_Window)sd->win32.win;
5651 if (sd->parent) return (Ecore_Window)elm_win_win32_window_get(sd->parent);
5652#endif
5653 }
5570 5654
5571 return 0; 5655 return 0;
5572} 5656}
diff --git a/src/lib/elm_win.eo b/src/lib/elm_win.eo
index f641c7615..97fb151e5 100644
--- a/src/lib/elm_win.eo
+++ b/src/lib/elm_win.eo
@@ -965,6 +965,16 @@ class Elm.Win (Elm.Widget, Elm_Interface_Atspi_Window,
965 get { 965 get {
966 [[Get the Ecore_Cocoa_Window of an Evas.Object.]] 966 [[Get the Ecore_Cocoa_Window of an Evas.Object.]]
967 return: Ecore_Cocoa_Window *; [[The Ecore_Cocoa_Window of $obj.]] 967 return: Ecore_Cocoa_Window *; [[The Ecore_Cocoa_Window of $obj.]]
968 }
969 }
970 @property win32_window {
971 get {
972 [[Get the Ecore_Win32_Window of an Evas_Object
973
974 @since 1.16
975 ]]
976 return: Ecore_Win32_Window *; [[The Ecore_Win32_Window of $obj.]]
977 legacy: null;
968 } 978 }
969 } 979 }
970 @property window_id { 980 @property window_id {
diff --git a/src/lib/elm_win_legacy.h b/src/lib/elm_win_legacy.h
index 22b0fec11..2362ac68b 100644
--- a/src/lib/elm_win_legacy.h
+++ b/src/lib/elm_win_legacy.h
@@ -197,6 +197,23 @@ EAPI void elm_win_render(Evas_Object *obj);
197 */ 197 */
198EAPI Ecore_Wl2_Window *elm_win_wl_window_get(const Evas_Object *obj); 198EAPI Ecore_Wl2_Window *elm_win_wl_window_get(const Evas_Object *obj);
199 199
200/* Windows specific call - returns NULL on non-Windows engines */
201/**
202 * Get the Ecore_Win32_Window of an Evas_Object
203 *
204 * Do not use this function if you'd like your application/library be portable.
205 * You have been warned.
206 *
207 * @param obj the object
208 *
209 * @return The Ecore_Win32_Window of @p obj
210 *
211 * @ingroup Win
212 *
213 * @since 1.16
214 */
215EAPI Ecore_Win32_Window *elm_win_win32_window_get(const Evas_Object *obj);
216
200/** 217/**
201 * Set the preferred rotation value. 218 * Set the preferred rotation value.
202 * 219 *