Commit graph

629 commits

Author SHA1 Message Date
Harol Alfonso Reina Herrera
16310b15a0 Update csproj TargetFrameworkVersion 2015-10-29 09:24:44 -05:00
Antonius Riha
d98f6c3421 csproj ToolsVersion to 4.0 2015-10-29 08:48:49 -05:00
Mikkel Kruse Johnsen
120b3ce9cd Merge remote-tracking branch 'upstream/master' 2015-07-24 07:42:55 +02:00
Bertrand Lorentz
5422daaabc Convert some source files to Unix line endings
No real code change in this commit.
2015-05-25 16:57:08 +02:00
Mikkel Kruse Johnsen
4c4e2a8754 Remove utf8 variant. Not used anymore on windows 2014-11-05 08:49:52 +01:00
Mikkel Kruse Johnsen
5fc657a39c Generator problems in GtkWidgetClass 2014-11-03 15:50:20 +01:00
Stephan Sundermann
8e0de299e4 generator: Set Owned to false when ownership of a parameter changes
This fixes an issue where unref would get called too often because the
ownership has changed when passing an instance to the native side.

See https://github.com/mono/gtk-sharp/pull/112 for more details.
2014-08-10 18:35:19 +02:00
Stephan Sundermann
961b9ef348 glib: Add binding for GBytes
This patch adds bindings for GBytes https://developer.gnome.org/glib/stable/glib-Byte-Arrays.html

The code was first generated using gobject-introspection and then
refactored. The new type is also added to the generator SymbolTable.
2014-08-10 18:20:32 +02:00
Stephan Sundermann
016891bb7a generator: Fix generation of SetGValue method
Some types need special methods to convert an object to a GLib.Value.
The type system will look for a SetGValue method with a "ref GLib.Value"
parameter and invoke it.

A special case in the generation is needed because this is a non-static
method with the Handle being passed as the second parameter and the
GLib.Value as the first. Without this fix, the generator would generate
the Handle for the first parameter and then the GLib.Value.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2014-04-27 15:15:15 +02:00
Stephan Sundermann
40b90d2407 generator: Add new keyword to GType property if it hides parent
If the parent already has a GType property, add a "new" keywords to hide
it.

This eliminates a lot of warnings when using classes derived from
Opaque. Closes issue #100.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2014-04-21 20:50:18 +02:00
Stephan Sundermann
0563af1c25 generator: Fix handle being passed when type is a struct
A static getter method would always generate a Handle parameter even
though some types do not have a Handle, for example structs.

Closes issue #99.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2014-04-21 18:23:48 +02:00
Stephan Sundermann
06b966beef generator: Add support for fixed length arrays as method parameters
Fixed length arrays are available in gobject introspection and are
already converted by the bindinator tool. The array_len attribute was
only used in structs.

This adds support for them as method parameters, generating the correct
code for them. Fixes issue #98.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2014-04-21 17:23:32 +02:00
Stephan Sundermann
a74534e835 generator: Create a directory for each namespace
When dealing with several namespaces there might be classes with the same name
(especially Global which is autogenerated in g-i based bindings). On generation
the file would be overriden by the last occurence in the xml. To encounter
this every namespace has it's own directory now. This also improves structure
a lot when dealing with big libraries.

Also do the necessary adaption for the build and the csproj files.
2014-03-01 21:16:54 +01:00
Bertrand Lorentz
ee8499483e generator: Fix signature of static method overloads
For method with optional parameters, when generating the overload
without the optional parameters, mark the overload as static if the
original method is static.
2014-01-05 17:28:30 +01:00
Bertrand Lorentz
51f102bc34 generator: Dispose ownable parameters in signal callbacks (bxc#237)
A similar situation to what is described in commit e48ac63d54 also
happens with signal callbacks: some signals are passed a native object
that is wrapped in an IDisposable managed object, which is then passed
as an argument to the signal handler. We need to dispose those objects
when the signal handler is done.

Those parameters will now be disposed in a finally {...} block, after
the signal handler has returned. This means that handlers should not
keep a reference to such a parameter, as it will be disposed right after
they return.

This change only affects the Cairo.Context parameter of the Widget.Drawn
signal, but it was badly needed, as shown by the Pixbuf demo in the
GtkDemo sample, which was leaking tens of MBs of memory.
2013-11-17 19:10:24 +01:00
Bertrand Lorentz
b7df1d2e13 generator: Fix indentation in Signal.cs
Only whitespace changes, no real code change.
2013-11-17 17:17:57 +01:00
Bertrand Lorentz
c2f9035625 generator: Fix small typo in a comment in LPUGen.cs 2013-11-17 13:32:03 +01:00
Bertrand Lorentz
e48ac63d54 generator: Dispose ownable method parameters in VM callback (bxc#237)
Some virtual methods are passed a native object that is wrapped in an
IDisposable managed object, which is then passed on to the managed
overrides. We need to dispose those objects as soon as possible,
otherwise their native counterpart will not be freed until the next
garbage collection. Requiring the overrides to dispose them would be
cumbersome and error-prone.

Those parameters will now be disposed in a finally {...} block, after
the virtual method has returned. This means that overrides should not
keep a reference to such a parameter outside of the scope of the method,
as it will be diposed when the method returns.

This change only affects Cairo.Context parameter for now, but it was
particularly needed for them, as they could happily hold on to tens of
MBs of memory until the next garbage collection.
2013-11-09 16:26:17 +01:00
Bertrand Lorentz
21ef50ec48 Merge pull request #83 from knocte/msbuild_tweaks
Various tweaks and updates to the .csproj files
2013-10-22 12:55:30 -07:00
Andrés G. Aragoneses
f9f654a06a generator: add reference to System.Core in the MSBuild csproj
Extension methods (such as the one we have in XmlElementExtensions.cs)
need to link to System.Runtime.CompilerServices.ExtensionAttribute
class in order to compile. In .NET 3.5, this was part of System.Core
(not mscorlib like in .NET 4.5) [1], so we need to link to it in order
to compile via MSBuild.

[1] http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.extensionattribute%28v=vs.90%29.aspx
2013-10-22 12:17:50 +02:00
Andrés G. Aragoneses
077836a227 generator: fix AssemblyName in MSBuild csproj
To be the same as what is generated via Makefiles.
2013-10-22 12:17:44 +02:00
Andrés G. Aragoneses
516fc1d9f0 generator: leverage framework's String.IsNullOrEmpty() call
This makes the code a bit more readable and it is a
micro-optimization.
2013-10-21 17:13:31 +02:00
Andrés G. Aragoneses
fcc775d658 generator: drop unneeded parameter in WriteLine() call 2013-10-21 17:10:11 +02:00
Andrés G. Aragoneses
b13d51a32d generator: simplify bool logic in Method class
There are two elements repeated in this expression:

(( ((A) || (B)) || (B)) && C)

We can simplify "(A || B) || B" to simply "A || B",
so the result is a bit more readable this way:

(A || B) && C
2013-10-21 17:09:40 +02:00
Andrés G. Aragoneses
8b998861e1 Convert some dynamic casts to static casts
There is no null check after these casts so if they fail they would
generate a NullReferenceException. By changing them to static casts
we would get a InvalidCastException which are much less misleading.
2013-10-13 19:10:03 +02:00
Bertrand Lorentz
b2fb84d14b Clean up .gitignore files 2013-10-13 18:38:33 +02:00
Andrés G. Aragoneses
b15f2eede1 generator: provide a GType static property for adapters
In the same way all GLib.Object-derived classes provided by the
generator have a GType static property (i.e. Gtk.Widget), we need
the same for the *Adapter classes, to access their GType without having
an instance of it. (The first use case would be GStreamerSharp's
Gst.Bin.IterateAllByInterface ().)

For this, we cannot simply add the property to all adapter classes
and be done, because it would clash with a property which is already
there, but is non-static, that has the same name and same value
(this property is needed for complying GInterfaceAdapter abstract
class), so we rename this property to GInterfaceGType because
using this name for the static one would not be consistent with the
rest of the classes generated which already provide the static one
with the name "GType".
2013-10-13 17:45:09 +02:00
Andrés G. Aragoneses
ea07082952 generator: avoid another Implementor suffix hardcode
This "Implementor" suffix was refactored recently (in commit
6cb03440c1) to be accessed via the ImplementorName property. So we
eliminate now the last occurrence of it in hardcoded form.
2013-10-13 17:20:37 +02:00
Andrés G. Aragoneses
634f9e5f27 generator: add a link to the README from the project
This way people who work on the generator using an IDE will see the file
2013-10-13 17:05:41 +02:00
Bertrand Lorentz
2d83fb3073 Move the fixup tool from the parser to the generator folder
The parser will be going away at some point in the future, but we
will still need the fixup step. And the fixup step is really more
of a preliminary step for the generator anyway.
2013-10-13 17:04:56 +02:00
Stephan Sundermann
72b51cc712 generator: Implement attribute to hide method parameters
A hidden parameter is dropped from the signature and the default value is filled in.
2013-10-11 23:36:20 +02:00
Stephan Sundermann
8e307d8eaa generator: Remove redundant class name from method name
If you move a global method to a class, you often end up with something
like Tag.TagExists(). This will now be automatically renamed to
Tag.Exists().
2013-10-11 23:03:53 +02:00
Bertrand Lorentz
9b9512a3ce generator: Remove unused variables in NativeStructGen 2013-10-10 23:47:12 +02:00
Bertrand Lorentz
741360020c generator: Remove unused variable in FieldBase class 2013-10-10 23:44:24 +02:00
Bertrand Lorentz
46068e7add generator: Remove unused field in Constant class 2013-10-10 23:43:55 +02:00
Bertrand Lorentz
57938c321e generator: Add missing copyright headers in files added by Stephan 2013-10-10 23:38:03 +02:00
Bertrand Lorentz
bc498ff650 generator: Add support for suppressing the Equals(T) method in structs
Similarly to what exists for GetHashCode, add a noequals attribute to
indicate we don't want the default Equals implementation.
2013-10-10 16:27:13 +02:00
Stephan Sundermann
587f0f56e7 generator: NativeStructGen needs to be partial 2013-10-09 20:49:09 +02:00
Stephan Sundermann
50f07d17ad generator: removed redundant allocation 2013-10-09 20:48:24 +02:00
Stephan Sundermann
21c9c9ff8c generator: remove bitfields from Equals/GetHashCode 2013-10-09 20:47:26 +02:00
Stephan Sundermann
f6fef3a402 generator: fixed NativeStructGen's formatting 2013-10-09 20:44:28 +02:00
Stephan Sundermann
c5b04cb70e generator: fixed native struct parent 2013-10-09 20:43:44 +02:00
Stephan Sundermann
edc339baf5 generator: redundant method in NativeStructGen 2013-10-09 20:43:12 +02:00
Stephan Sundermann
0f79e9af06 generator: fixicate NativeStructGen
Made NativeStructGen more consistent with the way Gdk.Event
and Pango.Attribute are handled. Also increases performance
because reflection is not needed anymore to marshal these
kind of structs.
2013-10-09 20:42:03 +02:00
Stephan Sundermann
31e2c02e94 generator: public accessor in method overloads 2013-10-09 20:37:18 +02:00
Stephan Sundermann
53312d5fc0 generator: fixed optional array parameters 2013-10-09 20:35:02 +02:00
Stephan Sundermann
2152f4626e generator: use default value for optional generation 2013-10-09 20:30:14 +02:00
Stephan Sundermann
5f271e04fa generator: ignore private structs completely
Don't spam the log with these messages for private structs
(and don't count this in the statistics), as there are too
many. These kind of types are just empty structs marked as
hidden and private.
2013-10-09 20:28:38 +02:00
Stephan Sundermann
c3f7b8e32b generator: fixed optional array parameters 2013-10-09 20:05:03 +02:00
Stephan Sundermann
5eea00f705 generator: new --gapidir flag to search for xml files 2013-10-09 20:00:14 +02:00