Commit graph

3654 commits

Author SHA1 Message Date
Andres G. Aragoneses
6cb03440c1 generator: generate all interfaces with the "I" prefix (.NET convention)
To be able to do this, Name property of GenBase class is now virtual, so
that it can be overriden in InterfaceGen with the new name.

Adapters, however, are still classes and then need special care as such
(cannot use the 'Name' property anymore), but this improves a bit the
readability of some parts of the code as the *Implementor and *Adapter
suffixes are now concentrated in just two new properties of GenBase and
not repeated all over the place.
2013-07-23 12:05:24 -05:00
Bertrand Lorentz
214532f684 Merge pull request #62 from knocte/automake_warnings
build: fix automake warning about preprocessor C flags
2013-07-23 09:37:18 -07:00
Bertrand Lorentz
a7c335c4c4 Merge pull request #63 from knocte/class_init
glib: avoid a delegate to be GCed which could cause a NRE (bxc#13113)
2013-07-23 08:39:45 -07:00
Andrés G. Aragoneses
6d626a24a7 glib: avoid a delegate to be GCed which caused a NRE (bxc#13113)
What seemed to be a race condition (because of not happenning 100% of
the times) ended up being an early garbage collection of a delegate that
was still referenced by an unmanaged struct without having a managed
counterpart [1].

The consequence of this was a NullReferenceException happening in a line
which didn't have a dereference of a null object. The way to reproduce it
deterministically 100% of the times was setting the env var MONO_NO_SMP.

[1] http://www.mono-project.com/Interop_with_Native_Libraries#Memory_Boundaries
2013-07-17 14:24:02 +02:00
Andrés G. Aragoneses
10d3293d3f build: fix automake warning about preprocessor C flags
With automake version 1.13.2 (which comes in debian testing/jessie),
we were starting to get these warnings by default:

...
Running automake --foreign  ...
atk/glue/Makefile.am:16: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
gio/glue/Makefile.am:11: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
gtk/glue/Makefile.am:18: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
gtk/gui-thread-check/profiler/Makefile.am:8: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
pango/glue/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
sample/opaquetest/Makefile.am:18: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
sample/valtest/Makefile.am:18: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
Running autoconf ...
...

We simply follow the warning's recommendation of using AM_CPPFLAGS instead
(CPP meaning C PreProcessor, not C Plus Plus), as explained in
http://www.gnu.org/software/automake/manual/html_node/Program-Variables.html

The deprecation of INCLUDES has been very long there already (since 2002,
therefore Automake 1.7), and we already depend on automake 1.10.
2013-06-17 10:59:28 +02:00
Bertrand Lorentz
e8f4eca14e Merge pull request #61 from knocte/class_init
glib: install interfaces earlier, override properties in class_init
2013-05-20 08:51:03 -07:00
Bertrand Lorentz
05f67db2ee gdk: Hide Global.TextPropertyToUtf8ListForDisplay method
It is implemented manually in TextProperty.ToStringListForDisplay.
2013-04-21 16:54:48 +02:00
Bertrand Lorentz
5e3b720408 gdk: Remove invalid method and P/Invoke in TextProperty
The native functions gdk_free_text_list and
gdk_text_property_to_utf8_list are gone, and we now need to use StrFreeV
to free the native string list.
2013-04-21 16:50:37 +02:00
Bertrand Lorentz
bc0aee1328 gdk: Remove invalid Global.DevicesList method
The native function gdk_devices_list is gone, device handling is now
handled through DeviceManager.
2013-04-21 16:42:18 +02:00
Bertrand Lorentz
2d34ed8351 gtk: Remove unused P/Invoke in IconTheme
Now that it uses the Marshaller, IconTheme doesn't call g_strfreev
directly anymore.
2013-04-21 16:39:52 +02:00
Bertrand Lorentz
7160437532 gtk: Remove invalid FileChooserDialog constructor
The ..._new_with_backend native function has been removed, so the
corresponding constructor must be removed.
2013-04-21 16:19:10 +02:00
Bertrand Lorentz
f14eee3eb6 gtk: Fixup AccelMap.LookupEntry to have key as an out param (bxc#11367) 2013-04-21 14:39:18 +02:00
Bertrand Lorentz
eb5e9c7b74 gtk: Remove TreeViewColumn.CellRenderers property (bxc#8593)
The corresponding native function is gone in GTK 3, replaced by
gtk_cell_layout_get_cells.
2013-04-21 13:50:48 +02:00
Andres G. Aragoneses
cb4c7d95ea glib: move some GLib.Object private methods to ClassInitializer class
Refactoring: moving these methods from GLib.Object to ClassInitializer
brings some benefits:
* We can mark OverrideHandlers as private instead of internal.
* We reduce the number of parameters to zero by making them use fields.
* We can make the god GLib.Object class a bit smaller.
* We can make the ClassInitializer.Idx counter private instead of internal.
2013-04-07 08:17:44 +01:00
Andres G. Aragoneses
9ff7ec8b2c glib: install interfaces earlier, override properties in class_init
GObject upstream has started disabling support for installing interfaces
in GTypes after they have already been initialized (class_init) [1], so
we need to add GInterfaces a bit earlier (*before* class_init starts).

As GLib.Object.OverrideProperty() cannot to be called before class_init
(because it receives a GObjectClass, not a GType) or after (because
otherwise class_init would complain about properties of an interface not
being defined), then we need to call it during class_init.

[1] http://bugzilla.gnome.org/687659

A good side-effect of this fix is that we no longer use the hacky uint
field 'idx' to track the properties count for each class; now it gets
moved to the ClassInitializer class, and thus can be non-static, which
makes a bit more sense (we leave the old OverrideProperty overload for
backwards compatibility).

Simplest way to test this is launching the sample/treemodeldemo.exe and
sample/custom-scrollable.exe in Ubuntu 13.04 beta (which has GLib 2.36).
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=11510
2013-04-07 07:51:30 +01:00
Andres G. Aragoneses
1a1300c762 gio: Add fix-ups for GSettings.GetStrv and SetStrv values
The values handled by those two methods are null-terminated arrays of
strings, owned by the caller, so mark them as such.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2013-04-01 11:41:43 +02:00
Bertrand Lorentz
2b03787ac0 audit: Add a README file 2013-03-29 19:17:54 +01:00
Bertrand Lorentz
7da6eb1fa4 Add audit/data to .gitignore
If you generate audit data that does not belong in source control, put
it in audit/data, it will be ignored by git.
2013-03-29 18:58:23 +01:00
Bertrand Lorentz
00aaa79ec1 build: Output a message when configure checks if we're on Windows 2013-03-29 18:30:12 +01:00
Bertrand Lorentz
f4a1672c87 audit: Use dmcs as a compiler for the audit tools
This is what works for me, but you might want to change this for your
system.
2013-03-29 18:18:28 +01:00
Bertrand Lorentz
0830c50604 Add an audit.csproj to the MonoDevelop solution 2013-03-29 17:57:34 +01:00
Bertrand Lorentz
2a7d26a8b0 audit: Add gen-apidiff-html tool to generate apidiff reports
The gen-apidiff-html tool takes all apidiff files in a directory, merges
them and then applies mono-api.xsl to produce a nice HTML page that
shows the information about the API changes.

The various resources needed by the HTML page (images, CSS, javascript)
are added in the html/ directory.

This is all adapted from an older version of the tools in Mono git
master, under mcs/tools/corcompare.
2013-03-29 17:50:07 +01:00
Bertrand Lorentz
1eb786c735 audit: Refresh utilities using code from Mono git master
Copy latest versions of mono-api-info.cs and mono-api-diff.cs from Mono
git master, along with associated classes. As a consequence,
mono-api-info.cs now depends on Mono.Cecil.

Do the necessary adaptation for our use case: we do API comparison
between version of our assemblies.
2013-03-29 17:35:07 +01:00
Andres G. Aragoneses
88bb31bfa7 glib: Use GTHREAD preprocessor flag with old versions of glib
We switch the logic from DISABLE_GTHREAD_CHECK to ENABLE_GTHREAD_INIT
to make the define clearer, and so that it is actually needed when using
older versions of glib, not newer.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2013-03-24 11:37:22 +01:00
Bertrand Lorentz
a0203691a4 gapi.xsd: Reorder attribute definitions so that the name comes first
This improves the readibility of the schema, but does not really change
it.
2013-03-24 11:18:25 +01:00
Bertrand Lorentz
7180011c22 Add and use gapi.xsd to validate GAPI XML files
The structure of a GAPI XML file is now defined by the XML schema in
gapi.xsd.

This XSD is now used by the generator to do a first sanity check on an
XML file before trying to generate code from it. Each generatable object
still does its own validation.

The XSD can also be seen as a documentation of the GAPI XML format, and
can be used by third-parties that produce GAPI XML to validate their
output.
2013-02-23 14:32:04 +01:00
Bertrand Lorentz
a406b87c26 pango: Remove invalid fix-up for pango_layout_get_lines_readonly
This fix-up applies the element_type attribute to the method itself,
which is invalid. The correct fix-up that applies it to the return-type
is already there.
2013-02-23 13:41:50 +01:00
Bertrand Lorentz
253da2e05c Remove obsolete fix-ups for needs_ref attribute
The needs_ref attribute hasn't been used by the generator for quite some
time now.
2013-02-23 13:41:50 +01:00
Bertrand Lorentz
99cb57e7aa generator: Add option to validate GAPI XML against an XSD schema
With a new --schema option, you can specify the path to an XSD file, and
all GAPI XML files will be validated against this schema, including the
files given through the --include option.
2013-02-23 13:41:50 +01:00
Cameron White
57c82a89c7 cairo: Fix rectangles returned by StrokeExtents and FillExtents methods
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>
2012-12-27 15:26:42 +01:00
Bertrand Lorentz
629a34aa4f generator: Improve handling of command-line parameters
Bundle Options.cs from the Mono source tree, and use it to parse the
command-line options for gapi-codegen. This gives us clearer code,
descriptions for each option, and a nice "--help" output.

This does not change the options syntax, except that -I|--include needs
to specified for each file to include. Two Makefiles in sample/ are
updated for that change.
2012-11-25 15:05:17 +01:00
Bertrand Lorentz
ab61fbccbd glib: Fix crash when freeing lists with elements typed as interfaces
If a GList or a GSList had its element type set to a GInterface, and if
the elements were marked as owned, it would end up freeing those
elements with g_free(), which would lead to a crash.

They need to be unreffed with g_object_unref, but the criteria for that
was whether the element type is assignable to GLib.Object. This is not
true for GInterface types.

We now first check if the element type is an opaque. If not, and if it's
assignable to GLib.IWrapper, we then use g_object_unref.

From what I can see, all GLib.IWrapper subclasses that not opaque can be
unreffed with g_object_unref.
2012-11-18 16:06:34 +01:00
Bertrand Lorentz
91474fe1f1 gtk: Mark the whole Style class as obsolete 2012-11-18 15:55:03 +01:00
Bertrand Lorentz
b312fcbc8c gio: Rename the DBus.Address* methods
Fix-ups to improve the DBus.Address* method names.

For example, DBus.GetStream(string address ...) is clear enough and
better than DBus.AddressGetStream(string address ...).
2012-11-18 12:22:17 +01:00
Bertrand Lorentz
14c0a84fdb gio: Rename the Dbus class to DBus
An uppercase B in DBus make the class name consistent with all the other
DBus* classes.
2012-11-18 12:20:20 +01:00
Bertrand Lorentz
fab58ea99d gio: Hide GioGlobal.RegistryBackendGetType method
It's Windows-specific, and probably doesn't need to be called directly
by anyone.
2012-11-18 11:55:28 +01:00
Bertrand Lorentz
722ec40812 gio: Move static methods from Simple to SimpleAsyncResult class
Static methods corresponding to g_simple_async_report_* functions were
automatically grouped into the badly-named Simple class.

Add fix-ups to hide this Simple class, move the methods to
SimpleAsyncResult and rename them accordingly.
2012-11-18 11:35:35 +01:00
Bertrand Lorentz
f0f998ccf3 generator: Fix compilation warning in some generated interface adapters
Don't generate a static field if it's not going to be used.

This fixes a compilation warning on the generated code for interfaces
that don't have virtual methods.
2012-11-18 11:10:18 +01:00
Bertrand Lorentz
0bc9ab9fd4 Merge pull request #55 from meebey/master
Replace top-level COPYING with LGPL2-only license
2012-11-18 01:42:19 -08:00
Mirco Bauer
9998c40f8e Replaced COPYING with LGPL2-only license
There is not a single file in gtk-sharp that has a LGPL2.1+ header but
LGPL2-only instead.
2012-11-17 23:24:56 +01:00
Bertrand Lorentz
de6b6029ec sample: Fix crashes in TreeModelDemo 2012-11-17 17:53:40 +01:00
Bertrand Lorentz
306f422c38 Fix a crash during initialization of interfaces (bxc#8447)
GInterfaceInfo.Data was automatically set to be a GCHandle on the
interface adapter. But the generated GInterfaceInitHandlers were
not using it, just free'ing it.

But for the GInterface property support, the Data field is now used to
pass the class pointer, so casting it to a GCHandle to free it would
cause an exception.

We now don't assume anything about GInterfaceInfo.Data.
2012-11-17 17:34:50 +01:00
Bertrand Lorentz
05fb2e2f3a Update top-level COPYING with current version of the LGPL v2.1
Apparently it needs to have an up-to-date address for the FSF.
2012-11-15 21:32:30 +01:00
Bertrand Lorentz
761cb09260 gui-thread-check: Replace COPYING with the correct license
As indicated in the source code, and confirmed by the original author,
the gui-thread-check is licensed under the GPL v2.
2012-11-15 21:14:45 +01:00
Bertrand Lorentz
f20970258e generator: Update the documentation in generator/DESIGN 2012-11-15 19:31:28 +01:00
Bertrand Lorentz
3b37e81b05 gtk: Fix-ups to set the scope of a few callbacks 2012-11-15 18:18:37 +01:00
Bertrand Lorentz
fdd1b201f7 generator: Fix misleading warning for callbacks in virtual methods
Wen generating a virtual method, the current member was not set in the
GenerationInfo. That caused the warning message about the callback scope
to refer to a wrong method name.
2012-11-15 15:06:07 +01:00
Bertrand Lorentz
3cce546661 gtk: Fix return types for IterList* methods in WidgetPath 2012-11-15 14:07:35 +01:00
Bertrand Lorentz
6809865526 gtk: Make the Group property for Radio* widgets a properly typed array
The Group property for all the Radio* classes (RadioAction, RadioButton,
RadioMenuItem and RadioToolButton) was exposed as a GLib.SList,
with its elements untyped.

We now hide the various Group properties and have custom code to handle
them correctly.
2012-11-15 12:05:45 +01:00
Bertrand Lorentz
d8aa4ab275 gtk: Fix-up return type for some methods returning lists 2012-11-15 11:58:18 +01:00