forked from enlightenment/efl
proper check of elm_win object types.
This allows using elm stuff inside regular evas windows not created with elm_win and possible mistakes using elm_win api, now it checks for elm type before continuing. By: Thiago 'bolaum' Borges Abdnur. SVN revision: 41651
This commit is contained in:
parent
bc5f30b199
commit
5af0125a30
|
@ -37,7 +37,10 @@ static Eina_List *_elm_win_list = NULL;
|
|||
static void
|
||||
_elm_win_resize(Ecore_Evas *ee)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(ecore_evas_object_associate_get(ee));
|
||||
Evas_Object *obj = ecore_evas_object_associate_get(ee);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
|
||||
win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
|
||||
|
@ -46,7 +49,10 @@ _elm_win_resize(Ecore_Evas *ee)
|
|||
static void
|
||||
_elm_win_focus_in(Ecore_Evas *ee)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(ecore_evas_object_associate_get(ee));
|
||||
Evas_Object *obj = ecore_evas_object_associate_get(ee);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
evas_object_smart_callback_call(win->win_obj, "focus-in", NULL);
|
||||
}
|
||||
|
@ -54,7 +60,10 @@ _elm_win_focus_in(Ecore_Evas *ee)
|
|||
static void
|
||||
_elm_win_focus_out(Ecore_Evas *ee)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(ecore_evas_object_associate_get(ee));
|
||||
Evas_Object *obj = ecore_evas_object_associate_get(ee);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
evas_object_smart_callback_call(win->win_obj, "focus-out", NULL);
|
||||
}
|
||||
|
@ -101,7 +110,10 @@ _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_inf
|
|||
static void
|
||||
_elm_win_delete_request(Ecore_Evas *ee)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(ecore_evas_object_associate_get(ee));
|
||||
Evas_Object *obj = ecore_evas_object_associate_get(ee);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
int autodel = win->autodel;
|
||||
win->autodel_clear = &autodel;
|
||||
|
@ -393,8 +405,10 @@ elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
|
|||
EAPI void
|
||||
elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Evas_Coord w, h;
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
win->subobjs = eina_list_append(win->subobjs, subobj);
|
||||
elm_widget_sub_object_add(obj, subobj);
|
||||
|
@ -409,7 +423,9 @@ elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
|
|||
EAPI void
|
||||
elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
evas_object_event_callback_del(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _elm_win_subobj_callback_changed_size_hints);
|
||||
evas_object_event_callback_del(subobj, EVAS_CALLBACK_DEL, _elm_win_subobj_callback_del);
|
||||
|
@ -421,7 +437,9 @@ elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
|
|||
EAPI void
|
||||
elm_win_title_set(Evas_Object *obj, const char *title)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_title_set(win->ee, title);
|
||||
}
|
||||
|
@ -429,7 +447,9 @@ elm_win_title_set(Evas_Object *obj, const char *title)
|
|||
EAPI void
|
||||
elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
win->autodel = autodel;
|
||||
}
|
||||
|
@ -437,7 +457,9 @@ elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
|
|||
EAPI void
|
||||
elm_win_activate(Evas_Object *obj)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_activate(win->ee);
|
||||
}
|
||||
|
@ -445,7 +467,9 @@ elm_win_activate(Evas_Object *obj)
|
|||
EAPI void
|
||||
elm_win_lower(Evas_Object *obj)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_lower(win->ee);
|
||||
}
|
||||
|
@ -453,7 +477,9 @@ elm_win_lower(Evas_Object *obj)
|
|||
EAPI void
|
||||
elm_win_raise(Evas_Object *obj)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_raise(win->ee);
|
||||
}
|
||||
|
@ -461,7 +487,9 @@ elm_win_raise(Evas_Object *obj)
|
|||
EAPI void
|
||||
elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_borderless_set(win->ee, borderless);
|
||||
_elm_win_xwin_update(win);
|
||||
|
@ -470,7 +498,9 @@ elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
|
|||
EAPI void
|
||||
elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_shaped_set(win->ee, shaped);
|
||||
_elm_win_xwin_update(win);
|
||||
|
@ -479,7 +509,9 @@ elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
|
|||
EAPI void
|
||||
elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
if (win->xwin)
|
||||
{
|
||||
|
@ -501,7 +533,9 @@ elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
|
|||
EAPI void
|
||||
elm_win_override_set(Evas_Object *obj, Eina_Bool override)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_override_set(win->ee, override);
|
||||
_elm_win_xwin_update(win);
|
||||
|
@ -510,7 +544,9 @@ elm_win_override_set(Evas_Object *obj, Eina_Bool override)
|
|||
EAPI void
|
||||
elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
switch (_elm_config->engine)
|
||||
{
|
||||
|
@ -528,7 +564,9 @@ elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
|
|||
EAPI void
|
||||
elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_maximized_set(win->ee, maximized);
|
||||
_elm_win_xwin_update(win);
|
||||
|
@ -537,7 +575,9 @@ elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
|
|||
EAPI void
|
||||
elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_iconified_set(win->ee, iconified);
|
||||
_elm_win_xwin_update(win);
|
||||
|
@ -546,7 +586,9 @@ elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
|
|||
EAPI void
|
||||
elm_win_layer_set(Evas_Object *obj, int layer)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_layer_set(win->ee, layer);
|
||||
_elm_win_xwin_update(win);
|
||||
|
@ -555,7 +597,9 @@ elm_win_layer_set(Evas_Object *obj, int layer)
|
|||
EAPI void
|
||||
elm_win_rotation_set(Evas_Object *obj, int rotation)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
if (win->rot == rotation) return;
|
||||
win->rot = rotation;
|
||||
|
@ -569,7 +613,9 @@ elm_win_rotation_set(Evas_Object *obj, int rotation)
|
|||
EAPI void
|
||||
elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
ecore_evas_sticky_set(win->ee, sticky);
|
||||
_elm_win_xwin_update(win);
|
||||
|
@ -578,7 +624,9 @@ elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
|
|||
EAPI void
|
||||
elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
if (mode == win->kbdmode) return;
|
||||
_elm_win_xwindow_get(win);
|
||||
|
@ -593,7 +641,9 @@ elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
|
|||
EAPI void
|
||||
elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return;
|
||||
_elm_win_xwindow_get(win);
|
||||
#ifdef HAVE_ELEMENTARY_X
|
||||
|
@ -671,9 +721,11 @@ _sub_del(void *data, Evas_Object *obj, void *event_info)
|
|||
EAPI Evas_Object *
|
||||
elm_win_inwin_add(Evas_Object *obj)
|
||||
{
|
||||
Elm_Win *win = elm_widget_data_get(obj);
|
||||
Elm_Win *win;
|
||||
Evas_Object *obj2;
|
||||
Widget_Data *wd;
|
||||
if(strcmp(elm_widget_type_get(obj), "win")) return;
|
||||
win = elm_widget_data_get(obj);
|
||||
if (!win) return NULL;
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
obj2 = elm_widget_add(win->evas);
|
||||
|
@ -734,8 +786,11 @@ elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
|
|||
EAPI Ecore_X_Window
|
||||
elm_win_xwindow_get(const Evas_Object *obj)
|
||||
{
|
||||
Elm_Win *win = (Elm_Win *)elm_widget_data_get(obj);
|
||||
if (!win) return 0;
|
||||
_elm_win_xwindow_get(win);
|
||||
return win->xwin;
|
||||
Ecore_X_Window xwin = 0;
|
||||
Ecore_Evas *ee = NULL;
|
||||
|
||||
ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
|
||||
if (ee) xwin = (Ecore_X_Window)ecore_evas_window_get(ee);
|
||||
|
||||
return xwin;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue