Commit graph

3843 commits

Author SHA1 Message Date
Bertrand Lorentz 30f758d984 gdk: Fix dll name and use a const for all DllImports in custom code
In Windows builds of GTK+ 3.x, the dll filename for GDK is
libgdk-3-0.dll.

We use this opportunity to use a common const in the DllImport for all
custom code.
2014-05-04 17:30:26 +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
Marcin Kolny dee590926a build: Add a pkg-config file for gdk-sharp-3.0
This allows consumers to specifically require gdk-sharp-3.0 without
having to pull in the full gtk-sharp-3.0.

Closes issue #101.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2014-04-21 21:36:57 +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
Bertrand Lorentz 87275786b7 gapi.xsd: Fix type of array_len attribute in fieldType 2014-04-21 17:22:54 +02:00
Gankov Andrey 1da92bdd62 gtk: Add ListStore.SetValue overload for long type
Without that change, using ListStore.SetValue with a long would use the
float overload, which might not be expected and cause some issues.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2014-04-21 16:50:21 +02:00
Bertrand Lorentz 80485a464d build: Fix Makefile of valtest and opaquetest samples
Some parts were not taking into account the fact that the generated code
is now in a subfolder.
2014-04-21 16:24:08 +02:00
Bertrand Lorentz e3b5fa22a4 doc: Remove reference to Dbus class, it was renamed to DBus 2014-04-19 20:53:45 +02:00
Bertrand Lorentz a5bf8f2aaf doc: Remove empty namespaces from en/index.xml 2014-04-19 20:50:52 +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 8885fa98af build: Fix references to AssemblyInfo.cs in makefiles on Windows
On Windows with MinGW, csc.exe is confused by paths like
"../AssemblyInfo.cs", so we need some trickery to have something that
works on both Linux and Windows.

This isn't pretty, but it's the best solution I could find right now.
The other approach would have been to go back to copying AssemblyInfo.cs
around, but that has it's own set of issues.
2014-02-23 19:17:05 +01:00
Bertrand Lorentz 398dc4aaf7 build: Tell .NET compiler to target the generated assemblies to 32-bit
The default value for the "platform" parameter is anycpu, which allows
the runtime to use the 64-bit mode on x86_64. This means that any
P/Invoke will only work with 64-bit native libraries.

The recommended version of native Windows binaries provided by the GTK+
project are 32-bit, so a Gtk# app running on 64-bit Windows will fail to
load them, causing a BadImageFormatException at runtime.

Using "-platform:x86" instructs the csc compiler to set a flag in the
generated assembly that instructs the runtime to use only 32-bit mode.

Please note that there are 64-bit GTK+ Windows binaries, but they are
marked as experimental, and we probably don't want explore this right
now.

Also pass the "nologo" parameter so that it doesn't output several
useless line when it is invoked.
2014-02-23 17:53:07 +01:00
Bertrand Lorentz a531510431 build: Rework handling of missing C# compiler in configure.ac
Only print the error in one place. Also add some comments.
2014-02-23 17:32:11 +01:00
Bertrand Lorentz 85443823e9 build: Enclose gacutil calls in double quotes
On Windows, gacutil.exe is often installed in a path with spaces, like
"C:\Program Files...". This causes problem when trying to call it during
"make install". Enclosing in double quotes fixes this, and has no impact
on Linux.
2014-02-23 17:07:10 +01:00
Bertrand Lorentz bfc89a1555 build: Only check the mono prefix when using mono
This avoids strange message at the end of configure with .Net
2014-02-23 16:59:50 +01:00
Bertrand Lorentz 84993d237f build: Remove obsolete gcc flag when building on Windows
The -mno-cygwin parameter has been obsolete for quite some time. It is
now gone in recent gcc version, causing an error when you try to use it.

My understanding that gcc now does the right thing automatically.
2014-02-23 16:41:07 +01:00
Bertrand Lorentz 2fcd276b9c build: Fix compiler parameters in gio and gtk-gio samples
Having parameters starting with a forward slash seems to break when
building with MinGW on Windows. So we use a dash to be consistent with
other Makefiles.

Also use the CSFLAGS variable in the sample/gio Makefile, instead of
hardcoding the debug flag.
2014-02-23 16:36:03 +01:00
Bertrand Lorentz 49295c119b build: Only build gui-thread-check profiler module on mono
The profiler module will only work with mono, so we don't need to build
it on Windows with the .Net framework.
2014-02-23 16:18:28 +01:00
Bertrand Lorentz 8a9f49e2b0 Add *.pdb to .gitignore 2014-02-23 16:09:14 +01:00
Bertrand Lorentz 691de4e606 gtk: Fix dll name and use a const for all DllImports in custom code
In Windows builds of GTK+ 3.x, the dll filename is libgtk-3-0.dll.

We use this opportunity to use a common const in the DllImport
statement for all custom code.
2014-02-23 15:12:20 +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 3ea36f5746 build: Post-release version bump to 2.99.3 2013-12-04 22:28:23 +01:00
Bertrand Lorentz 73834cb7cb release: Small adjustments to NEWS for 2.99.2 2013-12-04 21:58:18 +01:00
Bertrand Lorentz 1c081cc728 doc: Remove the GLib/Dbus.xml file, it's replaced by GLib/DBus.xml
The class was renamed some time ago, but the automatic update of the
docs didn't catch the removal of the old file.
2013-12-04 21:54:01 +01:00
Bertrand Lorentz b519e50a99 doc: Remove obsolete gen-finalize-docs.cs tool
It was used to automatically document the Finalize methods, which do not
exist anymore. We are now using the standard Dispose pattern, and the
Dispose methods only appear in a few places, so they can be documented
manually.
2013-12-04 21:42:27 +01:00
Bertrand Lorentz 087659639a doc: Auto-fill docs for virtual methods using gen-vm-docs tool 2013-12-04 21:28:00 +01:00
Bertrand Lorentz a9a9c407a9 doc: Auto-fill docs for IntPtr constructors using gen-intptr-ctor-docs
The gen-intptr-ctor-docs automatically fills in the boilerplate
documentation for the IntPtr constructors.
2013-12-04 21:23:25 +01:00
Bertrand Lorentz 621b35002d doc: Auto-fill docs for GType properties using gen-gtype-docs tool
The gen-gtype-docs automatically fills in the documentation for all
GType properties.
2013-12-04 21:19:59 +01:00
Bertrand Lorentz d562727254 doc: Remove obsolete gen-gtype-ctor-docs tool
It was used to document obsolete constructors with a GType parameter.
Those are gone now, so we don't need the tool anymore.
2013-12-04 21:14:44 +01:00
Bertrand Lorentz bd36de9300 doc: Auto-fill docs for event handler using gen-handlerargs-docs tool
Compiling gen-handlerargs-docs.cs and running it on all assemblies
automatically fills in some documentation for event handlers.
2013-12-04 21:05:03 +01:00
Bertrand Lorentz 4593870178 doc: Add a bit of documentation for Widget.OnDrawn 2013-12-04 20:42:05 +01:00
Bertrand Lorentz 49f1bb86aa release: Update NEWS for upcoming 2.99.2 release 2013-12-01 17:06:26 +01:00
Bertrand Lorentz cf7aa5222e sample: Fix leak in Scribble sample when resizing the window 2013-12-01 16:06:50 +01:00
Bertrand Lorentz bc309f3093 doc: Run the automatic documentation updater 2013-11-30 16:01:53 +01:00
Andrés G. Aragoneses 8aaed84e5e cairo: Fix remaining leaks when finalizer gets called
Apply same finalizer leak fix to the rest of IDisposable-ownership
cairo classes as the one recently committed for Cairo.Context[1].

[1] https://github.com/mono/gtk-sharp/commit/41eeecbf9a6d8
2013-11-30 15:34:29 +01:00
Bertrand Lorentz 694357cc5b build: Fix typo in sample/Makefile.am 2013-11-24 16:46:13 +01:00
Andrés G. Aragoneses 70d1827058 cairo: Throw ObjectDisposedException after an object has been disposed
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>
2013-11-24 15:56:26 +01:00
Bertrand Lorentz 21b081b6a9 sample: Add sample that uses only cairo and writes image files
The sample writes the same PNG file over and over, with some pauses in
between iterations. Some indicative numbers are written to the console,
to help track performance and memory usage.

Feel free to add more elaborate drawing to this sample, to exercise more
of the cairo API.
2013-11-24 15:22:05 +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 2d48906523 glib: Use Marshaller methods in Argv for g_malloc and g_free 2013-11-17 16:27:39 +01:00
Bertrand Lorentz ced6f5e677 glib: Avoid unnecessary qualifier in Marshaller.PtrToStringArrayGFree 2013-11-17 16:26:02 +01:00
Bertrand Lorentz 32d10bd319 Use GLib.Marshaller.Free instead of calling g_free directly
Using the GLib.Marshaller.Free method means we don't need to have the
g_free function definition duplicated all over the place.
2013-11-17 16:20:02 +01:00
Bertrand Lorentz f067f5112d glib: Remove obsolete Argv-related methods in Marshaller
The ArgvToArrayPtr and ArrayPtrToArgv have been marked obsolete since
2004, and removing them allows us to remove some more code.
2013-11-17 15:05:36 +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 ee06530b52 glib: Avoid doing the same cast twice in KeyFile.ToData
The cast from UIntPtr to int can fail at runtime, but if your config
file is more than 2^31 bytes, you probably have bigger problems...
2013-11-17 13:27:04 +01:00
Andrés G. Aragoneses f1005da47c glib: Make all DllImports in custom code use a common const
This way there's less redundancy, and if the library name changes in the
future, it will be changed only in one place.

Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
2013-11-17 13:05:12 +01:00
Bertrand Lorentz d6f06860fb Merge pull request #90 from knocte/embedded
gtk: fix Application to be more robust when embedding mono
2013-11-09 08:10:06 -08:00