After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 627545 - Cannot access Gdk.EventExpose.area field
Cannot access Gdk.EventExpose.area field
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
unspecified
Other All
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks: 627482
 
 
Reported: 2010-08-20 20:51 UTC by jessevdk@gmail.com
Modified: 2010-11-29 20:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
add a foreign type for cairo_rectangle_int_t (2.88 KB, patch)
2010-10-25 22:36 UTC, johnp
none Details | Review
add a foreign type for cairo_rectangle_int_t and allow it to be caller-allocated (4.89 KB, patch)
2010-10-26 18:11 UTC, johnp
none Details | Review

Description jessevdk@gmail.com 2010-08-20 20:51:43 UTC
When trying to access the 'area' field of a Gdk.EventExpose, I get the following error:	TypeError: Couldn't find conversion for foreign struct 'cairo.RectangleInt'
Comment 1 Tomeu Vizoso 2010-08-23 10:00:20 UTC
Should be relatively straightforward to add support for cairo.RectangleInt in http://git.gnome.org/browse/pygobject/tree/gi/pygi-foreign-cairo.c
Comment 2 jessevdk@gmail.com 2010-08-29 21:04:51 UTC
I was going to try to provide a patch for this, but I can't really find anything on cairo.RectangleInt, does it even exist?
Comment 3 Tomeu Vizoso 2010-10-08 08:26:44 UTC
(In reply to comment #2)
> I was going to try to provide a patch for this, but I can't really find
> anything on cairo.RectangleInt, does it even exist?

I guess it needs to be added to py2cairo first :/
Comment 4 jessevdk@gmail.com 2010-10-17 18:15:52 UTC
So, what does it need to get this in? We want to move forward with porting gedit.
Comment 5 Tomeu Vizoso 2010-10-18 10:23:50 UTC
(In reply to comment #4)
> So, what does it need to get this in? We want to move forward with porting
> gedit.

Someone needs to implement a wrapper for cairo_rectangle_int_t in py2cairo.
Comment 6 jessevdk@gmail.com 2010-10-18 10:45:43 UTC
Do you know why actually GdkRectangle is mapped to cairo_rectangle_int_t? Also, who is maintaining py2cairo?
Comment 7 johnp 2010-10-25 22:36:02 UTC
Created attachment 173231 [details] [review]
add a foreign type for cairo_rectangle_int_t

* this is needed because Gdk and Gtk switched from returning a GdkRectangle
  to a CairoRectangleInt structure
* the patch in https://bugs.freedesktop.org/show_bug.cgi?id=31111 is required
  for pycairo (however there is currently no patch for python 2)
* for some reason while this works in pycairo, pygobject is still
  returning its boxed type.  This is most likely due to some annotations
  in either gobject-introspection or Gtk/Gdk itself.  We should most likely
  fix this by giving precedence to foreign types (as well as removing it
  from the libraries)
Comment 8 johnp 2010-10-25 22:38:44 UTC
I want to get this working before I create a patch for py2cairo though that should be trivial.  Most of this work should apply w/ the exception of what is in py3cairo.h.  Also some of the Python 3 isms need to be fixed (e.g. PyLong_FromLong -> PyInt_FromLong)
Comment 9 Tomeu Vizoso 2010-10-26 07:50:55 UTC
(In reply to comment #7)
> * for some reason while this works in pycairo, pygobject is still
>   returning its boxed type.  This is most likely due to some annotations
>   in either gobject-introspection or Gtk/Gdk itself.  We should most likely
>   fix this by giving precedence to foreign types (as well as removing it
>   from the libraries)

Can you extend on this? Is it that cairo_rectangle_int_t isn't marked as foreign in the .gir? or that the typedefs are confusing g-i?
Comment 10 johnp 2010-10-26 14:03:42 UTC
Turns out we just don't support GI signal parameters.  Still I'm getting a memory error if I do this:

from gi.respoitory import cairo
cairo.RectangleInt()

works fine from the actual cairo module.  Must be something wrong with PycairoRectangleIntFromRectangleInt
Comment 11 johnp 2010-10-26 18:11:42 UTC
Created attachment 173281 [details] [review]
add a foreign type for cairo_rectangle_int_t and allow it to be caller-allocated

* this is needed because Gdk and Gtk switched from returning a GdkRectangle
  to a CairoRectangleInt structure
* the patch in https://bugs.freedesktop.org/show_bug.cgi?id=31111 is required
  for pycairo (however there is currently no patch for python 2)
* added fix for foreign types to allow them to be caller allocated
* in order for a type to be caller allocated it must be able to take a NULL
  and create an empty struct in foreign_struct_from_arg and it must be able
  to handle GI_TRANFER_EVERYTHING in foreign_struct_to_arg.
Comment 12 johnp 2010-11-10 04:14:21 UTC
I committed this with conditionals.  So if you don't have the patch in https://bugs.freedesktop.org/show_bug.cgi?id=31111 this still won't work. I'll close this when the patch in pycairo goes upstream but the maintainer has been slow at responding.
Comment 13 johnp 2010-11-22 17:03:42 UTC
ok, so the pycairo maintainer rejected my patch.  I'm going to fix this up to use 4 item sequences instead of a rectangle python object.