On Thu, Jul 30, 2009 at 10:28 PM, Carsten Haitzler <ras...@rasterman.com>wrote:
> On Thu, 30 Jul 2009 22:24:14 -0300 Thiago <bol...@gmail.com> said:
>
> > On Thu, Jul 30, 2009 at 12:37 PM, Carsten Haitzler
> > <ras...@rasterman.com>wrote:
> >
> > > On Sat, 11 Jul 2009 15:35:56 -0300 Thiago <bol...@gmail.com> said:
> > >
> > > elm_widget_type_get() :) this checks if its a elm_widget smart type (if
> not
> > > returns "") and if so... returns the type. this is really whats should
> be
> > > added
> > > to checks everywhere:
> > >
> > > if (elm_widget_type_get()[0]) {
> > > it's an elm widget!
> > > }
> > >
> >
> > You're right! I'll fix it and send it again. I didn't notice that
> function
> > xD
> >
>
Here it goes. I fixed it. If you could commit this asap it would be nice,
because my GSoC project is depending on this patch.
Thanks!
>
> >
> > >
> > > nb - also you are assuming its an ecore_evas too to get the win too. so
> > > basically you aleady re-implemented the magic stuff that evas does :)
> > > (elm_widget_type_get() is using it).
> > >
> >
> > What about this last part:
> >
> > 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;
> > }
> >
> > Is it ok?
>
> that's also assuming an ecore_evas. in your case thats ok. normal case for
> elm
> too. it should probably handle non-x targets too - from memory, so i think
> its
> ok.
>
> > > > Hi guys,
> > > >
> > > > I'm currently working on an IM client plugin for Canola in GSoC. This
> is
> > > my
> > > > first proposed patch for enlightenment.
> > > >
> > > > The problem begun when I tried to embed a elm widget inside canola.
> Every
> > > > time I created a widget, with a Edje smart object as parent, I got
> > > > segfaults. So I started investigating why it happaned inside the
> binding.
> > > > Nothing was wrong with it. Then I looked inside the code for
> elementary.
> > > > There I found it. All widgets suppose their top father is an evas
> smart
> > > > object containing a Elm_Win structure as the data field. Thats not
> true
> > > in
> > > > my case. So the patch changes the function elm_win_xwindow_get()
> inside
> > > > elm_win.c in a way that it get the xwindow reference from the evas of
> the
> > > > object, avoiding the corruption of data done by calling
> > > > _elm_win_xwindow_get(). See code for more details. That fixed the
> first
> > > > problem.
> > > >
> > > > But I kept getting segfaults when I used an entry widget, after I
> gave it
> > > > the focus. Problem was _on_focus_hook() (elm_entry.c) calling
> > > > elm_win_keyboard_mode_set(). This would also currupt a non-Elm_Win
> > > structure
> > > > pointed by data. So I proposed the creation of a magic field inside
> > > Elm_Win
> > > > to be tested before doing any operations that needs the smart object
> to
> > > be
> > > > attached to Elm_Win.
> > > >
> > > > The patch is working with tests and everything is working for me! I
> don't
> > > > know if this is the best solution, but at least it is one.
> > > >
> > > > Waiting on comments!
> > > >
> > > > Thanks.
> > > >
> > > > --
> > > > Thiago 'bolaum' Borges Abdnur
> > > > ----------------------------------
> > > > "Trust no one..."
> > > > - Deep Throat (The X-Files)
> > > >
> > >
> > >
> > > --
> > > ------------- Codito, ergo sum - "I code, therefore I am"
> --------------
> > > The Rasterman (Carsten Haitzler) ras...@rasterman.com
> > >
> > >
> >
> >
> > --
> > Thiago 'bolaum' Borges Abdnur
> > ----------------------------------
> > "Trust no one..."
> > - Deep Throat (The X-Files)
> >
> ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> > trial. Simplify your report design, integration and deployment - and
> focus on
> > what you do best, core application coding. Discover what's new with
> > Crystal Reports now. http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > enlightenment-devel mailing list
> > enlightenment-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> >
>
>
> --
> ------------- Codito, ergo sum - "I code, therefore I am" --------------
> The Rasterman (Carsten Haitzler) ras...@rasterman.com
>
>
--
Thiago 'bolaum' Borges Abdnur
----------------------------------
"Trust no one..."
- Deep Throat (The X-Files)
Index: src/lib/elm_win.c
===================================================================
--- src/lib/elm_win.c (revision 41637)
+++ src/lib/elm_win.c (working copy)
@@ -37,7 +37,10 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
}
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel