Those methods are not in Mono.Cairo, and are not necessary for Gtk#, so
I'm assuming they are not really needed.
The idea is to have the same API as Mono.Cairo shipped with mono, so if
you need those methods, get them first in Mono.Cairo available at
https://github.com/mono/mono
Also move the HasCurrentPoint property to its logical place in the
source, next to CurrentPoint.
Potentially all these IDisposable classes could be used after being
disposed, which would result in native crashes. We now do an explicit
check and throw an exception in managed land when the object has been
disposed.
This is particularly useful because:
a/ the native crashes are quite obscure, there no indication that
you're using a disposed object
b/ Gtk# is passing Context instances to user methods, and disposes them
when the method returns. So if the user code keeps a reference to the
Context, there a good chance it will try to use it after it's disposed.
Other changes in this patch include:
* Renaming a parameter to be more consistent with the other subsequent
ctor called.
* Replacing implementation of some [Obsolete()] methods with the call
to the methods they were replaced with, to avoid redundancy and the
need for more CheckDisposed() calls than necessary.
* Throw ArgumentException when receiving an IntPtr.Zero as a handle,
as a way to protect ourselves from wrapping invalid native pointers,
and throwing ObjectDisposedExceptions because the object was invalid in
the first place.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
When the finalizer calls Dispose(), disposing is false, it means that
CairoDebug traces should be printed, but the reference count on the
native context should still be decreased. Otherwise a real leak
would appear, as the native context would never be freed when the
managed object is GCed.
Also:
* improving naming consistency
* obsolete old/broken stuff
* clean up tabs/space mix
NOTE: this removes the wrapper caches for Pattern and Surface as
there was no reliable way to clear them.
This is a merge from changes in Mono.Cairo in mono 3.2.
The third and fourth parameters of the Rectangle constructor are width
and height, but cairo_stroke_extents and cairo_fill_extents give right
and bottom coordinates.
Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
* cairo/Context.cs: add ctor (IntPtr, bool owned)
* cairo/cairo-api.xml: expose cairo_t as new ownable symbol type
* generator/HandleBase.cs: implement IOwnable
* generator/IOwnable.cs: new interface for wrapping ownable types
* generator/Makefile.am: add new files to build
* generator/OwnableGen.cs: SimpleBase subclass to expose IOwnable
* generator/Parameters.cs: use IOwnable.FromNative instead of HandleBase
* generator/Parser.cs: parse ownable symbol type
* generator/ReturnValue.cs: use IOwnable.FromNative instead of HandleBase
* cairo/Context.cs: use Pattern.Handle
* cairo/Pattern.cs: expose Lookup method, Obsolete the Pointer prop and
add a new Handle prop for API consistency.
* cairo/cairo-api.xml: add Pattern symbol.
* cairo/*: merge changes to Mono.Cairo since we split back in Oct 2008.
Not much changed. Scrubbed the doc index and updated NativeMethods
to match. Commented with DONTCARE the ones we will ignore. Implemented
a few of them, including an initial Device binding. Still some work
to do, and some discovery to be done to see what happened to Xcb, Glitz,
and DirectFB surfaces and whether we need to remove those classes.