GNOME Bugzilla – Bug 623222
[cairo] Bind cairo_rectangle_int_t
Last modified: 2016-01-24 22:59:26 UTC
see patch
Created attachment 164977 [details] [review] [cairo] Bind cairo_rectangle_int_t This is a new type added in cairo 1.9 that replaces GdkRectangle in GTK3. We need to bind it with exactly the same API as exported by GdkRectangle (namely, x/y/width/height) properties.
Created attachment 165066 [details] [review] Bind cairo_rectangle_int_t Summary of differences from Colin's version: - Memory management fixes - Doesn't try to allow ownership transfer of cairo_rectangle_int_t; just throws. - Struct-style constructor (new Cairo.RectangleInt({ x: 100, ... }); we need to be able to create GdkRectangle, not just consume it - Uses property getters and setters rather than setting JS properties to shadow the C object - Working setters - Configure check so things still build with Cairo - Minimal test case
Review of attachment 165066 [details] [review]: This looks good to me.
Review of attachment 165066 [details] [review]: This looks pretty good, code styling is a bit inconsistent "foo ()" vs "foo()". Lacks tests property setter tests and maybe g-i/foreign support. ::: modules/cairo-rectangle-int.c @@ +67,3 @@ + + if (value == JSVAL_VOID) { + gjs_throw(context, "rectangle has no %s property", name); Javascript usually return undefined here, but okay. @@ +73,3 @@ + if (!JS_ValueToInt32(context, value, (gint32*) &tmp)) { + JS_ClearPendingException(context); /* to throw a more useful exception */ + gjs_throw(context, "%s of rectangle can't be converted to an integer", name); %s property
Comment on attachment 165066 [details] [review] Bind cairo_rectangle_int_t Two years later, we have grown Cairo.RectangleInt in the gi based cairo bindings. If this patch ever goes in, it needs to use that. (This review is mostly to get off the acn list)
Since 3.18 we now eschew Cairo.RectangleInt in favor of Gdk.Rectangle. I believe this can be closed.