Merge branch 'master' into devs/hermet/lottie

This commit is contained in:
Hermet Park 2019-10-15 10:20:30 +09:00
commit ee1d9553b0
35 changed files with 1026 additions and 241 deletions

View File

@ -12,13 +12,15 @@ namespace Efl {
/// <summary>Represents a bindable property as used by <see cref="Efl.Ui.ItemFactory&lt;T&gt;" /> instances.
///
/// <para>It is internally instantiated and returned by generated extension methods.</para>
///
/// Since EFL 1.23.
/// </summary>
public class BindableProperty<T>
{
/// <summary>Creates a new bindable property with the source name <c>name</c>.</summary>
/// <summary>Creates a new bindable property with the source name
/// <c>name</c>.
/// </summary>
/// <param name="name">The property name of the bind.</param>
/// <param name="binder">The binder that will be used to bind the properties.</param>
public BindableProperty(string name, Efl.Ui.IPropertyBind binder)
{
this.propertyName = name;
@ -26,7 +28,11 @@ public class BindableProperty<T>
this.binder = binder;
}
/// <summary>Creates a new bindable property for part <c>part</c>.</summary>
/// <summary>Creates a new bindable property for part <c>part</c>.
/// </summary>
/// <param name="partName">The name of the part this instance wraps.</param>
/// <param name="partProperty">The property name of the bind.</param>
/// <param name="binder">Yhe binder that will be used to bind the properties.</param>
public BindableProperty(string partName, string partProperty, Efl.Ui.IPropertyBind binder)
{
this.partName = partName;
@ -34,7 +40,10 @@ public class BindableProperty<T>
this.binder = binder;
}
/// <summary>Binds the model property <c>modelProperty</c> to the property <c>name</c> set in the constructor.</summary>
/// <summary>Binds the model property <c>modelProperty</c> to the property
/// <c>name</c> set in the constructor.
/// </summary>
/// <param name="modelProperty">The model property</param>
public Eina.Error Bind(string modelProperty)
{
if (this.partName == null)
@ -70,52 +79,69 @@ public class BindableProperty<T>
}
}
/// <summary>
/// The property name of the bind.
/// </summary>
string propertyName;
/// <summary>
/// The name of the part this instance wraps.
/// </summary>
string partName;
/// <summary>
/// The binder that will be used to bind the properties.
/// </summary>
Efl.Ui.IPropertyBind binder;
}
/// <summary>Represents bindable parts as used by <see cref="Efl.Ui.ItemFactory&lt;T&gt;" /> instances.
///
/// <para>It is internally instantiated and returned by generated extension methods.</para>
///
/// Since EFL 1.23.
/// </summary>
public class BindablePart<T>
{
/// <summary>Creates a new bindable property with the binder <c>binder</c>.</summary>
/// <summary>Creates a new bindable property with the binder <c>binder</c>.
///</summary>
/// <param name="partName">The name of the part this instance wraps.</param>
/// <param name="binder">Yhe binder that will be used to bind the properties.</param>
public BindablePart(string partName, Efl.Ui.IPropertyBind binder)
{
this.PartName = partName;
this.Binder = binder;
}
/// <summary>The name of the part this instance wraps.</summary>
/// <summary>The name of the part this instance wraps.
/// </summary>
public string PartName { get; private set; }
/// <summary>The binder that will be used to bind the properties.</summary>
/// <summary>The binder that will be used to bind the properties.
/// </summary>
public Efl.Ui.IPropertyBind Binder { get; private set; }
}
/// <summary>Represents bindable factory parts as used by <see cref="Efl.Ui.ItemFactory&lt;T&gt;" /> instances.
///
/// Since EFL 1.23.
/// </summary>
public class BindableFactoryPart<T>
{
/// <summary>Creates a new bindable factory part with the binder <c>binder</c>.</summary>
/// <summary>Creates a new bindable factory part with the binder <c>binder</c>.
/// </summary>
/// <param name="partName">The name of the part this instance wraps.</param>
/// <param name="binder">Yhe binder that will be used to bind the properties.</param>
public BindableFactoryPart(string partName, Efl.Ui.IFactoryBind binder)
{
this.PartName = partName;
this.Binder = binder;
}
/// <summary>The name of the part this instance wraps.</summary>
/// <summary>The name of the part this instance wraps.
/// </summary>
public string PartName { get; private set; }
/// <summary>The binder that will be used to bind the properties.</summary>
/// <summary>The binder that will be used to bind the properties.
/// </summary>
public Efl.Ui.IFactoryBind Binder { get; private set; }
/// <summary>Binds the given factory to this part.</summary>
/// <summary>Binds the given factory to this part.
/// </summary>
/// <param name="factory">The factory to be used.</param>
public Eina.Error BindFactory(Efl.Ui.IFactory factory)
{
return this.Binder.BindFactory(this.PartName, factory);
@ -128,6 +154,7 @@ namespace Csharp
/// <summary>Helper class to differentiate between factory extension methods.
///
/// For internal use only.</summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public class ExtensionTag<TBase, TInherited>
where TInherited : TBase
{

View File

@ -14,13 +14,12 @@ namespace Efl { namespace Ui {
/// var factory = Efl.Ui.Factory&lt;Efl.Ui.Button&gt;();
/// factory.Style().Bind("Name"); // The factory Style property is bound to the Name property for the given model.
/// </code>
///
/// Since EFL 1.23.
///
/// </summary>
public class ItemFactory<T> : Efl.Ui.LayoutFactory, IDisposable
{
/// <summary>Creates a new factory.</summary>
/// <summary>Creates a new factory.
/// </summary>
/// <param name="parent">The parent of the factory.</param>
public ItemFactory(Efl.Object parent = null)
: base (parent, typeof(T))
{

View File

@ -15,8 +15,6 @@ namespace Efl {
/// <para>It provides an expanded API like async helpers to get children.</para>
///
/// <para>For MVVM-based models, <see cref="Efl.UserModel&lt;T&gt;" /> provides a simpler API.</para>
///
/// <para>Since EFL 1.24.</para>
/// </summary>
/// <typeparam name="T">The type of the child model. It is the type used when adding/removing/getting items to this
/// model.</typeparam>
@ -25,6 +23,8 @@ public class GenericModel<T> : Efl.Object, Efl.IModel, IDisposable
private Efl.IModel model;
/// <summary>Creates a new model wrapping <c>model</c>.</summary>
/// <param name="model">The model to be wrapped.</param>
/// <param name="parent">The parent of the model.</param>
public GenericModel (Efl.IModel model, Efl.Object parent = null) : base(parent)
{
this.model = model;
@ -43,42 +43,57 @@ public class GenericModel<T> : Efl.Object, Efl.IModel, IDisposable
}
/// <summary>The list of properties available in the wrapped model.</summary>
/// <returns>The list of properties in the model.</returns>
public Eina.Iterator<System.String> GetProperties()
{
return model.GetProperties();
}
/// <summary>Gets the value of the given property in the wrapped model.</summary>
/// <param name="property">The property of the model.</param>
/// <returns>The value of the property.</returns>
public Eina.Value GetProperty( System.String property)
{
return model.GetProperty(property);
}
/// <summary>Sets the value of the given property in the given model.</summary>
/// <param name="property">The property of the model.</param>
/// <param name="value">The value of the property.</param>
/// <returns>An <see cref="Eina.Future" /> that resolves when the property has
/// been set or reports an error if it could not be set.</returns>
public Eina.Future SetProperty( System.String property, Eina.Value value)
{
return model.SetProperty(property, value);
}
/// <summary>Returns the number of children in the wrapped model.</summary>
/// <returns>The number of children.</returns>
public uint GetChildrenCount()
{
return model.GetChildrenCount();
}
/// <summary>Returns an <see cref="Eina.Future" /> that will resolve when the property is ready to be read.</summary>
/// <param name="property">The property of the model.</param>
/// <returns>An <see cref="Eina.Future" /> that resolves when the property is ready.</returns>
public Eina.Future GetPropertyReady( System.String property)
{
return model.GetPropertyReady(property);
}
/// <summary>Gets a number of children from the wrapped model.</summary>
/// <param name="start">The start of the range.</param>
/// <param name="count">The size of the range.</param>
/// <returns>An <see cref="Eina.Future" /> that resolves to an
/// <see cref="Eina.Array" /> of children models.</returns>
public Eina.Future GetChildrenSlice( uint start, uint count)
{
return model.GetChildrenSlice(start, count);
}
/// <summary>Adds a new object to the wrapper model.</summary>
/// <param name="o">The object to get the properties from.</param>
public void Add(T o)
{
Efl.IModel child = (Efl.IModel)this.AddChild();
@ -86,18 +101,22 @@ public class GenericModel<T> : Efl.Object, Efl.IModel, IDisposable
}
/// <summary>Adds a new child to the model and returns it.</summary>
/// <returns>The object to be wrapped.</returns>
public Efl.Object AddChild()
{
return model.AddChild();
}
/// <summary>Deletes the given <c>child</c> from the wrapped model.</summary>
/// <param name="child">The child to be deleted.</param>
public void DelChild( Efl.Object child)
{
model.DelChild(child);
}
/// <summary>Gets the element at the specified <c>index</c>.</summary>
/// <param name="index">The position of the element.</param>
/// <returns>Token to notify the async operation of external request to cancel.</returns>
async public System.Threading.Tasks.Task<T> GetAtAsync(uint index)
{
using (Eina.Value v = await GetChildrenSliceAsync(index, 1))
@ -117,18 +136,32 @@ public class GenericModel<T> : Efl.Object, Efl.IModel, IDisposable
}
/// <summary>Async wrapper around <see cref="SetProperty(System.String, Eina.Value)" />.</summary>
/// <param name="property">The property to be added.</param>
/// <param name="value">The value of the property.</param>
/// <param name="token">The token for the task's cancellation.</param>
/// <returns>Task that resolves when the property has been set or could not
/// be set.</returns>
public System.Threading.Tasks.Task<Eina.Value> SetPropertyAsync( System.String property, Eina.Value value, System.Threading.CancellationToken token=default(System.Threading.CancellationToken))
{
return model.SetPropertyAsync(property, value, token);
}
/// <summary>Async wrapper around <see cref="GetPropertyReady(System.String)" />.</summary>
/// <param name="property">The property of the model.</param>
/// <param name="token">The token for the task's cancellation.</param>
/// <returns>Task that resolves when the given property is ready to be
/// read.</returns>
public System.Threading.Tasks.Task<Eina.Value> GetPropertyReadyAsync( System.String property, System.Threading.CancellationToken token=default(System.Threading.CancellationToken))
{
return model.GetPropertyReadyAsync(property, token);
}
/// <summary>Async wrapper around <see cref="GetChildrenSlice(uint, uint)" />.</summary>
/// <param name="start">The start of the range.</param>
/// <param name="count">The size of the range.</param>
/// <param name="token">Token to notify the async operation of external request to cancel.</param>
/// <returns>Task that resolves when the desired <see cref="Eina.Array" /> of
/// children models is ready.</returns>
public System.Threading.Tasks.Task<Eina.Value> GetChildrenSliceAsync( uint start, uint count, System.Threading.CancellationToken token=default(System.Threading.CancellationToken))
{
return model.GetChildrenSliceAsync(start, count, token);

View File

@ -3,6 +3,7 @@
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.ComponentModel;
using static Eina.TraitFunctions;
using static Eina.ArrayNativeFunctions;
@ -10,6 +11,7 @@ using static Eina.ArrayNativeFunctions;
namespace Eina
{
[EditorBrowsable(EditorBrowsableState.Never)]
public static class ArrayNativeFunctions
{
[DllImport(efl.Libs.Eina)] public static extern IntPtr
@ -46,20 +48,27 @@ public static class ArrayNativeFunctions
}
/// <summary>A container of contiguous allocated elements.
///
/// Since EFL 1.23.
/// <para>Since EFL 1.23.</para>
/// </summary>
public class Array<T> : IEnumerable<T>, IDisposable
{
public static uint DefaultStep = 32;
/// <summary>Pointer to the native buffer.</summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public IntPtr Handle {get;set;} = IntPtr.Zero;
///<summary>Whether this wrapper owns the native buffer.</summary>
/// <summary>Whether this wrapper owns the native buffer.
/// <para>Since EFL 1.23.</para>
/// </summary>
public bool Own {get;set;}
/// <summary>Who is in charge of releasing the resources wrapped by this instance.</summary>
/// <summary>Who is in charge of releasing the resources wrapped by
/// this instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
public bool OwnContent {get;set;}
/// <summary> Length of the array.</summary>
/// <summary> Length of the array.
/// <para>Since EFL 1.23.</para>
/// </summary>
public int Length
{
get { return Count(); }
@ -98,6 +107,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Create a new array.
/// <para>Since EFL 1.23.</para>
/// </summary>
public Array()
{
@ -106,6 +116,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Create a new array.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="step">Step size of the array.</param>
public Array(uint step)
@ -118,6 +129,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// </summary>
/// <param name="handle">The native handle to be wrapped.</param>
/// <param name="own">Whether this wrapper owns the native handle.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public Array(IntPtr handle, bool own)
{
if (handle == IntPtr.Zero)
@ -131,11 +143,12 @@ public class Array<T> : IEnumerable<T>, IDisposable
}
/// <summary>
/// Create a new array
/// Create a new array.
/// </summary>
/// <param name="handle">The native array to be wrapped.</param>
/// <param name="own">Whether this wrapper owns the native array.</param>
/// <param name="ownContent">For compatibility with other EFL# containers.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
public Array(IntPtr handle, bool own, bool ownContent)
{
if (handle == IntPtr.Zero)
@ -150,12 +163,15 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Finalizer to be called from the Garbage Collector.
/// <para>Since EFL 1.23.</para>
/// </summary>
~Array()
{
Dispose(false);
}
/// <summary>Disposes of this wrapper, releasing the native array if owned.</summary>
/// <summary>Disposes of this wrapper, releasing the native array if owned.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="disposing">True if this was called from <see cref="Dispose()"/> public method. False if
/// called from the C# finalizer.</param>
protected virtual void Dispose(bool disposing)
@ -189,14 +205,18 @@ public class Array<T> : IEnumerable<T>, IDisposable
}
}
/// <summary>Releases the native resources held by this instance.</summary>
/// <summary>Releases the native resources held by this instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Releases the native resources held by this instance.</summary>
/// <summary>Releases the native resources held by this instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Free()
{
Dispose();
@ -204,6 +224,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Releases the native array.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The native array.</returns>
public IntPtr Release()
@ -227,6 +248,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Clears an array's elements and deallocates the memory.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Clean()
{
@ -245,6 +267,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Returns the number of elements in an array.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The number of elements.</returns>
public int Count()
@ -266,6 +289,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Inserts the element of the array at the end.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="val">The value of the element to be inserted.</param>
public bool Push(T val)
@ -291,6 +315,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Returns the element of the array at the end.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The element at the end position.</returns>
public T Pop()
@ -307,6 +332,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Returns the element of the array at the specified position.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="idx">The position of the desired element.</param>
/// <returns>The element at the specified position</returns>
@ -318,6 +344,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Returns the element of the array at the specified position.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="idx">The position of the desired element.</param>
/// <returns>The element at the specified position</returns>
@ -328,6 +355,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Replaces the element at the specified position.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="idx">The position of the desired element.</param>
/// <param name="val">The value of the element to be inserted.</param>
@ -343,6 +371,10 @@ public class Array<T> : IEnumerable<T>, IDisposable
InternalDataSet(idx, ele);
}
/// <summary>
/// Accessor by index to the elements of this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
public T this[int idx]
{
get
@ -357,6 +389,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Returns a array containing all of the elements in proper sequence.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>A array</returns>
public T[] ToArray()
@ -373,6 +406,7 @@ public class Array<T> : IEnumerable<T>, IDisposable
/// <summary>
/// Appends all elements at the end of array.
/// <para>Since EFL 1.23.</para>
/// </summary>
public bool Append(T[] values)
{
@ -388,13 +422,17 @@ public class Array<T> : IEnumerable<T>, IDisposable
}
/// <summary> Gets an Iterator for this Array.</summary>
/// <summary> Gets an Iterator for this Array.
/// <para>Since EFL 1.23.</para>
/// </summary>
public Eina.Iterator<T> GetIterator()
{
return new Eina.Iterator<T>(eina_array_iterator_new(Handle), true);
}
/// <summary> Gets an Enumerator for this Array.</summary>
/// <summary> Gets an Enumerator for this Array.
/// <para>Since EFL 1.23.</para>
/// </summary>
public IEnumerator<T> GetEnumerator()
{
int len = Length;
@ -404,13 +442,17 @@ public class Array<T> : IEnumerable<T>, IDisposable
}
}
/// <summary> Gets an Enumerator for this Array.</summary>
/// <summary> Gets an Enumerator for this Array.
/// <para>Since EFL 1.23.</para>
/// </summary>
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary> Gets an Accessor for this Array.</summary>
/// <summary> Gets an Accessor for this Array.
/// <para>Since EFL 1.23.</para>
/// </summary>
public Eina.Accessor<T> GetAccessor()
{
return new Eina.Accessor<T>(eina_array_accessor_new(Handle), Ownership.Managed);

View File

@ -364,7 +364,7 @@ public class Binbuf : IDisposable
/// Gets a slice of the buffer's contents.
/// <para>Since EFL 1.23.</para>
/// </summary>
Eina.Slice GetSlice()
public Eina.Slice GetSlice()
{
return eina_binbuf_slice_get(Handle);
}

View File

@ -3,6 +3,7 @@
using System;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace Eina
{
@ -11,7 +12,7 @@ namespace Callbacks
{
internal delegate int EinaCompareCb(IntPtr data1, IntPtr data2);
public delegate void EinaFreeCb(IntPtr data);
internal delegate void EinaFreeCb(IntPtr data);
}
@ -42,9 +43,9 @@ internal static class NativeCustomExportFunctions
}
/// <summary>Wrapper around native memory DllImport'd functions.
///
/// Since EFL 1.23.
/// <para>Since EFL 1.23.</para>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class MemoryNative
{
public static void Free(IntPtr ptr)
@ -78,6 +79,13 @@ public static class MemoryNative
return NativeCustomExportFunctions.efl_mono_native_strdup(str);
}
/// <summary>
/// Retrieves an instance of a string for use in program.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="str"> The NULL-terminated string to retrieve an instance of.</param>
/// <returns> A pointer to an instance of the string on success,
/// on failure a exception is raised.</returns>
public static IntPtr AddStringshare(string str)
{
IntPtr nativeStr = StringConversion.ManagedStringToNativeUtf8Alloc(str);
@ -92,6 +100,10 @@ public static class MemoryNative
}
}
/// <summary>
/// Notes that the given string has lost an instance.
/// </summary>
/// <param name="str">the given string</param>
public static void DelStringshare(IntPtr str)
{
NativeMethods.eina_stringshare_del(str);
@ -131,9 +143,9 @@ public static class MemoryNative
/// <summary>
/// Conversor of raw pointer to a type and type to raw pointer
///
/// Since EFL 1.23.
/// <para>Since EFL 1.23.</para>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class PrimitiveConversion
{
public static T PointerToManaged<T>(IntPtr nat)
@ -158,9 +170,9 @@ public static class PrimitiveConversion
/// <summary>
/// Conversor of string to native string and native string to string.
///
/// Since EFL 1.23.
/// <para>Since EFL 1.23.</para>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static class StringConversion
{
public static IntPtr ManagedStringToNativeUtf8Alloc(string managedString)
@ -204,7 +216,10 @@ public static class StringConversion
}
}
/// <summary>Enum to handle resource ownership between managed and unmanaged code.</summary>
/// <summary>Enum to handle resource ownership between managed and unmanaged code.
/// <para>Since EFL 1.23.</para>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public enum Ownership
{
/// <summary> The resource is owned by the managed code. It should free the handle on disposal.</summary>

View File

@ -2,20 +2,24 @@
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace Eina
{
/// <summary>
/// Manage the initialization and cleanup for eina.
///
/// Since EFL 1.23.
/// <para>Since EFL 1.23.</para>
/// </summary>
public class Config
{
[DllImport(efl.Libs.Eina)] private static extern int eina_init();
[DllImport(efl.Libs.Eina)] private static extern int eina_shutdown();
/// <summary>
/// Initialize the Eina library.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static void Init()
{
if (eina_init() == 0)
@ -24,6 +28,10 @@ public class Config
}
}
/// <summary>
/// Finalize the Eina library.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static int Shutdown()
{
return eina_shutdown();
@ -33,29 +41,41 @@ public class Config
/// <summary>
/// Wrapper class for pointers that need some cleanup afterwards like strings
///
/// Since EFL 1.23.
/// <para>Since EFL 1.23.</para>
/// </summary>
public class DisposableIntPtr : IDisposable
{
[EditorBrowsable(EditorBrowsableState.Never)]
public IntPtr Handle { get; set; }
private bool ShouldFree;
private bool Disposed;
/// <summary>Wraps a new ptr what will be freed based on the
/// value of shouldFree</summary>
/// value of shouldFree
/// <para>Since EFL 1.23.</para>
/// </summary>
public DisposableIntPtr(IntPtr ptr, bool shouldFree = false)
{
Handle = ptr;
ShouldFree = shouldFree;
}
/// <summary>Release the native resources held by this instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Disposes of this wrapper, releasing the native handle if
/// owned.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="disposing">True if this was called from <see cref="Dispose()"/> public method. False if
/// called from the C# finalizer.</param>
protected virtual void Dispose(bool disposing)
{
if (!Disposed && ShouldFree)
@ -66,6 +86,10 @@ public class DisposableIntPtr : IDisposable
Disposed = true;
}
/// <summary>Release the native resources held by this instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
~DisposableIntPtr()
{
Dispose(false);

View File

@ -5,6 +5,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Reflection;
using System.ComponentModel;
using Eina.Callbacks;
using static Eina.HashNativeFunctions;
@ -15,6 +16,7 @@ using static Eina.NativeCustomExportFunctions;
namespace Eina
{
[EditorBrowsable(EditorBrowsableState.Never)]
public enum ElementType
{
NumericType,
@ -23,6 +25,7 @@ public enum ElementType
ObjectType
};
[EditorBrowsable(EditorBrowsableState.Never)]
[StructLayout(LayoutKind.Sequential)]
public struct InlistMem
{
@ -31,6 +34,7 @@ public struct InlistMem
public IntPtr last {get;set;}
}
[EditorBrowsable(EditorBrowsableState.Never)]
[StructLayout(LayoutKind.Sequential)]
public struct InlistNode<T>
{
@ -38,6 +42,7 @@ public struct InlistNode<T>
public T Val {get;set;}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public interface IBaseElementTraits<T>
{
IntPtr ManagedToNativeAlloc(T man);
@ -58,6 +63,7 @@ public interface IBaseElementTraits<T>
IntPtr EinaHashIteratorKeyNew(IntPtr hash);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class StringElementTraits : IBaseElementTraits<string>
{
public StringElementTraits()
@ -196,6 +202,7 @@ public class StringElementTraits : IBaseElementTraits<string>
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class StringshareElementTraits : IBaseElementTraits<Eina.Stringshare>
{
public StringshareElementTraits()
@ -335,6 +342,7 @@ public class StringshareElementTraits : IBaseElementTraits<Eina.Stringshare>
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class EflObjectElementTraits<T> : IBaseElementTraits<T>
{
public IntPtr ManagedToNativeAlloc(T man)
@ -492,6 +500,7 @@ public class EflObjectElementTraits<T> : IBaseElementTraits<T>
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public abstract class PrimitiveElementTraits<T>
{
private Eina.Callbacks.EinaCompareCb dlgt = null;
@ -593,6 +602,7 @@ public abstract class PrimitiveElementTraits<T>
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
abstract public class Primitive32ElementTraits<T> : PrimitiveElementTraits<T>, IBaseElementTraits<T>
{
private static IBaseElementTraits<Int32> int32Traits = null;
@ -631,6 +641,7 @@ abstract public class Primitive32ElementTraits<T> : PrimitiveElementTraits<T>, I
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
abstract public class Primitive64ElementTraits<T> : PrimitiveElementTraits<T>, IBaseElementTraits<T>
{
private static IBaseElementTraits<Int64> int64Traits = null;
@ -669,6 +680,7 @@ abstract public class Primitive64ElementTraits<T> : PrimitiveElementTraits<T>, I
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class IntElementTraits : Primitive32ElementTraits<int>, IBaseElementTraits<int>
{
override public void ManagedToNativeCopyTo(int man, IntPtr mem)
@ -693,6 +705,7 @@ public class IntElementTraits : Primitive32ElementTraits<int>, IBaseElementTrait
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class CharElementTraits : Primitive32ElementTraits<char>, IBaseElementTraits<char>
{
override public void ManagedToNativeCopyTo(char man, IntPtr mem)
@ -717,6 +730,7 @@ public class CharElementTraits : Primitive32ElementTraits<char>, IBaseElementTra
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class LongElementTraits : Primitive64ElementTraits<long>, IBaseElementTraits<long>
{
override public void ManagedToNativeCopyTo(long man, IntPtr mem)
@ -741,6 +755,7 @@ public class LongElementTraits : Primitive64ElementTraits<long>, IBaseElementTra
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class ShortElementTraits : Primitive32ElementTraits<short>, IBaseElementTraits<short>
{
override public void ManagedToNativeCopyTo(short man, IntPtr mem)
@ -765,6 +780,7 @@ public class ShortElementTraits : Primitive32ElementTraits<short>, IBaseElementT
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class FloatElementTraits : Primitive32ElementTraits<float>, IBaseElementTraits<float>
{
override public void ManagedToNativeCopyTo(float man, IntPtr mem)
@ -789,6 +805,7 @@ public class FloatElementTraits : Primitive32ElementTraits<float>, IBaseElementT
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class DoubleElementTraits : Primitive64ElementTraits<double>, IBaseElementTraits<double>
{
override public void ManagedToNativeCopyTo(double man, IntPtr mem)
@ -813,6 +830,7 @@ public class DoubleElementTraits : Primitive64ElementTraits<double>, IBaseElemen
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public class ByteElementTraits : Primitive32ElementTraits<byte>, IBaseElementTraits<byte>
{
override public void ManagedToNativeCopyTo(byte man, IntPtr mem)
@ -837,6 +855,7 @@ public class ByteElementTraits : Primitive32ElementTraits<byte>, IBaseElementTra
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public static class TraitFunctions
{
public static bool IsEflObject(System.Type type)

View File

@ -7,45 +7,94 @@ namespace Eina
{
/// <summary>Error codes from native Eina methods.
///
/// Since EFL 1.23.
/// <para>Since EFL 1.23.</para>
/// </summary>
public struct Error : IComparable<Error>
{
int code;
/// <summary>
/// The error's message.
/// <para>Since EFL 1.23.</para>
/// </summary>
public string Message
{
get { return MsgGet(this); }
}
/// <summary>
/// Unhandled Exception error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error UNHANDLED_EXCEPTION;
/// <summary>
/// No error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error NO_ERROR = new Error(0);
/// <summary>
/// Permission error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error EPERM = new Error(1);
/// <summary>
/// No entity error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error ENOENT = new Error(2);
/// <summary>
/// Cancelled error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static Error ECANCELED = new Error(125);
/// <summary>
/// Constructor.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="value">The value of the error.</param>
public Error(int value)
{
code = value;
}
/// <summary>
/// Error identifier conversion from int.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="val">Value to be converted to Error</param>
static public implicit operator Error(int val)
{
return new Error(val);
}
/// <summary>
/// Int conversion from Error.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="error">Error identifier to be converted to int</param>
static public implicit operator int(Error error)
{
return error.code;
}
/// <summary>
/// Compare two Errors.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="err">Error to be compared with</param>
/// <returns>True with the Errors is equal, False otherwise.</returns>
public int CompareTo(Error err)
{
return code.CompareTo(err.code);
}
/// <summary>
/// Transform the object to a string representing the object.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The string representing the value of this.</returns>
public override string ToString()
{
return "Eina.Error(" + code + ")";
@ -61,16 +110,32 @@ public struct Error : IComparable<Error>
[DllImport(efl.Libs.Eina)] static extern void eina_error_set(Error error);
[DllImport(efl.Libs.Eina)] static extern IntPtr eina_error_msg_get(Error error);
/// <summary>
/// Sets the last error.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="error">The error identifier.</param>
public static void Set(Error error)
{
eina_error_set(error);
}
/// <summary>
/// Returns the last set error.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The last error or NO_ERROR identifier.</returns>
public static Error Get()
{
return eina_error_get();
}
/// <summary>
/// Returns the description of the given error identifier.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="error">Error identifier.</param>
/// <returns>The description of the error.</returns>
public static String MsgGet(Error error)
{
IntPtr cstr = eina_error_msg_get(error);
@ -78,7 +143,9 @@ public struct Error : IComparable<Error>
}
/// <summary>Raises an exception if an unhandled exception occurred before switching
/// back to the native code. For example, in an event handler.</summary>
/// back to the native code. For example, in an event handler.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static void RaiseIfUnhandledException()
{
Error e = Get();
@ -89,6 +156,10 @@ public struct Error : IComparable<Error>
}
}
/// <summary>
/// Raises an exception.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static void Raise(Error e)
{
if (e != 0)
@ -97,11 +168,21 @@ public struct Error : IComparable<Error>
}
}
/// <summary>
/// Set identifier to a NO_ERROR.
/// <para>Since EFL 1.23.</para>
/// </summary>
public static void Clear()
{
Set(0);
}
/// <summary>
/// Registers a new error type.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="msg"> The description of the error.</param>
/// <returns>The unique number identifier for this error.</returns>
public static Error Register(string msg)
{
return eina_error_msg_register(msg);

View File

@ -3,6 +3,7 @@
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.ComponentModel;
using static Eina.TraitFunctions;
using static Eina.IteratorNativeFunctions;
@ -13,6 +14,7 @@ namespace Eina
{
[StructLayout(LayoutKind.Sequential)]
[EditorBrowsable(EditorBrowsableState.Never)]
public struct HashTupleNative
{
public IntPtr key;
@ -20,6 +22,7 @@ public struct HashTupleNative
public uint key_length;
}
[EditorBrowsable(EditorBrowsableState.Never)]
public static class HashNativeFunctions
{
[DllImport(efl.Libs.Eina)] public static extern IntPtr
@ -136,11 +139,24 @@ public static class HashNativeFunctions
/// </summary>
public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDisposable
{
[EditorBrowsable(EditorBrowsableState.Never)]
public IntPtr Handle {get; set;} = IntPtr.Zero;
/// <summary>Whether this wrapper owns the native hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
public bool Own {get; set;}
/// <summary>Whether this wrapper owns the key.
/// <para>Since EFL 1.23.</para>
/// </summary>
public bool OwnKey {get; set;}
/// <summary>Whether this wrapper owns the value.
/// <para>Since EFL 1.23.</para>
/// </summary>
public bool OwnValue {get; set;}
/// <summary>Quantity of elements in the hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
public int Count
{
get
@ -158,28 +174,42 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
SetOwnValue(true);
}
/// <summary>Default constructor.
/// <para>Since EFL 1.23.</para>
/// </summary>
public Hash()
{
InitNew();
}
[EditorBrowsable(EditorBrowsableState.Never)]
public Hash(IntPtr handle, bool own)
{
Handle = handle;
SetOwnership(own);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public Hash(IntPtr handle, bool own, bool ownKey, bool ownValue)
{
Handle = handle;
SetOwnership(own, ownKey, ownValue);
}
/// <summary>Default destructor.
/// <para>Since EFL 1.23.</para>
/// </summary>
~Hash()
{
Dispose(false);
}
/// <summary>Disposes of this wrapper, releasing the native accessor if
/// owned.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="disposing">True if this was called from <see cref="Dispose()"/> public method. False if
/// called from the C# finalizer.</param>
protected virtual void Dispose(bool disposing)
{
IntPtr h = Handle;
@ -202,17 +232,27 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
}
}
/// <summary>Release the native resources held by this instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Release the native resources held by this instance.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Free()
{
Dispose();
}
/// <summary>Release the pointer.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The instance.</returns>
public IntPtr Release()
{
IntPtr h = Handle;
@ -220,16 +260,28 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
return h;
}
/// <summary>Sets ownership.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="own">If the hash own the object.</param>
public void SetOwn(bool own)
{
Own = own;
}
/// <summary>Sets key's ownership.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="ownKey">If the hash own the key's object.</param>
public void SetOwnKey(bool ownKey)
{
OwnKey = ownKey;
}
/// <summary>Sets value's ownership.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="ownValue">If the hash own the value's object.</param>
public void SetOwnValue(bool ownValue)
{
OwnValue = ownValue;
@ -240,6 +292,10 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
}
}
/// <summary>Sets all ownership.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="ownAll">If the hash own for all ownerships.</param>
public void SetOwnership(bool ownAll)
{
SetOwn(ownAll);
@ -247,6 +303,12 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
SetOwnValue(ownAll);
}
/// <summary>Sets own individually.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="own">If the hash own the object.</param>
/// <param name="ownKey">If the hash own the key's object.</param>
/// <param name="ownValue">If the hash own the value's object.</param>
public void SetOwnership(bool own, bool ownKey, bool ownValue)
{
SetOwn(own);
@ -254,11 +316,22 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
SetOwnValue(ownValue);
}
/// <summary>
/// Cleanup for the hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void UnSetFreeCb()
{
eina_hash_free_cb_set(Handle, IntPtr.Zero);
}
/// <summary>
/// Adds an entry to the hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key">A unique key.</param>
/// <param name="val">The value to associate with the key.</param>
/// <returns> false if an error occurred, true otherwise.</returns>
public bool AddNew(TKey key, TValue val)
{
IntPtr gchnk = CopyNativeObject(key, ForceRefKey<TKey>());
@ -271,11 +344,22 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
return r;
}
/// <summary>
/// Modifies the entry at the specified key.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key">The key of the entry to modify.</param>
/// <param name="val">The value to replace the previous entry.</param>
public void Add(TKey key, TValue val)
{
Set(key, val);
}
/// <summary>
/// Removes the entry identified by a key from the hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key">The key.</param>
public bool DelByKey(TKey key)
{
IntPtr gchnk = CopyNativeObject(key, ForceRefKey<TKey>());
@ -285,7 +369,11 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
return r;
}
/// <summary>Searches this hash for <c>val</c> and deletes it from the hash, also deleting it.</summary>
/// <summary>Searches this hash for <c>val</c> and deletes it from the hash,
/// also deleting it.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="val">The value to be deleted.</param>
/// <returns><c>true</c> if the value was found and deleted, false if it was <c>null</c> or not found.</returns>
public bool DelByValue(TValue val)
{
@ -309,11 +397,22 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
}
/// <summary>
/// Removes the entry identified by a key from the hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key">The key.</param>
public void Remove(TKey key)
{
DelByKey(key);
}
/// <summary>
/// Retrieves a specific entry in the hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key">The key of the entry to find.</param>
/// <returns>The value of the entry.</returns>
public TValue Find(TKey key)
{
var gchnk = CopyNativeObject<TKey>(key, ForceRefKey<TKey>());
@ -329,6 +428,13 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
return NativeToManaged<TValue>(IndirectNative<TValue>(found, false));
}
/// <summary>
/// Check if key is present. if not, a default value is setted.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key">The key to be checked.</param>
/// <param name="val">[out] The value of the entry.</param>
/// <returns>true if key exists, false otherwise.</returns>
public bool TryGetValue(TKey key, out TValue val)
{
var gchnk = CopyNativeObject<TKey>(key, ForceRefKey<TKey>());
@ -345,6 +451,12 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
return true;
}
/// <summary>
/// Check if key is present.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key">The key to be checked.</param>
/// <returns>true if key exists, false otherwise.</returns>
public bool ContainsKey(TKey key)
{
var gchnk = CopyNativeObject<TKey>(key, ForceRefKey<TKey>());
@ -356,6 +468,13 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
return found != IntPtr.Zero;
}
/// <summary>
/// Modifies the speficied key if exists.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key">The key to modify.</param>
/// <param name="val"> The new value.</param>
/// <returns>False if key do not exists, true otherwise.</returns>
public bool Modify(TKey key, TValue val)
{
var gchnk = CopyNativeObject<TKey>(key, ForceRefKey<TKey>());
@ -449,6 +568,13 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
}
}
/// <summary>
/// Modifies the entry at the specified key. Adds if key is not found.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key">The key to modify.</param>
/// <param name="val">The value to replace the previous entry.</param>
public void Set(TKey key, TValue val)
{
IntPtr gchnk = CopyNativeObject(key, ForceRefKey<TKey>());
@ -465,6 +591,10 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
}
}
/// <summary>
/// Accessor by key to the hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
public TValue this[TKey key]
{
get
@ -477,6 +607,13 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
}
}
/// <summary>
/// Changes the keys of an entry in the hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="key_old">The current key with data.</param>
/// <param name="key_new">The new key with data.</param>
/// <returns>false in any case but success, true on success.</returns>
public bool Move(TKey key_old, TKey key_new)
{
IntPtr gchnko = CopyNativeObject(key_old, ForceRefKey<TKey>());
@ -493,26 +630,47 @@ public class Hash<TKey, TValue> : IEnumerable<KeyValuePair<TKey,TValue>>, IDi
return r;
}
/// <summary>
/// Frees the hash buckets.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void FreeBuckets()
{
eina_hash_free_buckets(Handle);
}
/// <summary>
/// Returns the number of entries in the hash.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The number of entries, 0 on error.</returns>
public int Population()
{
return eina_hash_population(Handle);
}
/// <summary>
/// Gets an Iterator for keys.
/// <para>Since EFL 1.23.</para>
/// </summary>
public Eina.Iterator<TKey> Keys()
{
return new Eina.Iterator<TKey>(EinaHashIteratorKeyNew<TKey>(Handle), true);
}
/// <summary>
/// Gets An Iterator for values.
/// <para>Since EFL 1.23.</para>
/// </summary>
public Eina.Iterator<TValue> Values()
{
return new Eina.Iterator<TValue>(eina_hash_iterator_data_new(Handle), true);
}
/// <summary>
/// Gets an Iterator for hask.
/// <para>Since EFL 1.23.</para>
/// </summary>
public IEnumerator<KeyValuePair<TKey,TValue>> GetEnumerator()
{
IntPtr itr = eina_hash_iterator_tuple_new(Handle);

View File

@ -107,24 +107,33 @@ public static class ListNativeFunctions
}
/// <summary>Native wrapper around a linked list of items.
///
/// Since EFL 1.23.
/// <para>Since EFL 1.23.</para>
/// </summary>
public class List<T> : IEnumerable<T>, IDisposable
{
[EditorBrowsable(EditorBrowsableState.Never)]
public IntPtr Handle {get;set;} = IntPtr.Zero;
/// <summary>Whether this managed list owns the native one.</summary>
/// <summary>Whether this managed list owns the native one.
/// <para>Since EFL 1.23.</para>
/// </summary>
public bool Own {get;set;}
/// <summary>Whether the native list wrapped owns the content it points to.</summary>
/// <summary>Whether the native list wrapped owns the content it points to.
/// <para>Since EFL 1.23.</para>
///</summary>
public bool OwnContent {get;set;}
/// <summary>Delegate for comparing two elements of this list.</summary>
/// <summary>Delegate for comparing two elements of this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="a">First element.</param>
/// <param name="b">Second element.</param>
/// <returns>-1, 0 or 1 for respectively smaller, equal or larger.</returns>
public delegate int Compare(T a, T b);
/// <summary>The number of elements on this list.</summary>
/// <summary>The number of elements on this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
public int Length
{
get { return Count(); }
@ -164,7 +173,9 @@ public class List<T> : IEnumerable<T>, IDisposable
}
/// <summary>Creates a new empty list.</summary>
/// <summary>Creates a new empty list.
/// <para>Since EFL 1.23.</para>
/// </summary>
public List()
{
InitNew();
@ -188,13 +199,17 @@ public class List<T> : IEnumerable<T>, IDisposable
OwnContent = ownContent;
}
/// <summary>Finalizes this list.</summary>
/// <summary>Finalizes this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
~List()
{
Dispose(false);
}
/// <summary>Disposes of this list.</summary>
/// <summary>Disposes of this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="disposing">Whether this was called from the finalizer (<c>false</c>) or from the
/// <see cref="Dispose()"/> method.</param>
protected virtual void Dispose(bool disposing)
@ -227,20 +242,26 @@ public class List<T> : IEnumerable<T>, IDisposable
}
}
/// <summary>Disposes of this list.</summary>
/// <summary>Disposes of this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>Disposes of this list.</summary>
/// <summary>Disposes of this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Free()
{
Dispose();
}
/// <summary>Relinquishes of the native list.</summary>
/// <summary>Relinquishes of the native list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The previously wrapped native list handle.</returns>
public IntPtr Release()
{
@ -249,27 +270,40 @@ public class List<T> : IEnumerable<T>, IDisposable
return h;
}
/// <summary>Sets whether this wrapper should own the native list or not.</summary>
/// <summary>Sets whether this wrapper should own the native list or not.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="ownAll">If the hash own for all ownerships.</param>
public void SetOwnership(bool ownAll)
{
Own = ownAll;
OwnContent = ownAll;
}
/// <summary>Sets whether this wrapper should own the native list and its content or not.</summary>
/// <summary>Sets whether this wrapper should own the native list and
/// its content or not.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="own">If own the object.</param>
/// <param name="ownContent">If own the content's object.</param>
public void SetOwnership(bool own, bool ownContent)
{
Own = own;
OwnContent = ownContent;
}
/// <summary>Returns the number of elements in this list.</summary>
/// <summary>Returns the number of elements in this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The number of elements.</returns>
public int Count()
{
return (int)eina_list_count_custom_export_mono(Handle);
}
/// <summary>Appends <c>val</c> to the list.</summary>
/// <summary>Appends <c>val</c> to the list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="val">The item to be appended.</param>
public void Append(T val)
{
@ -277,7 +311,9 @@ public class List<T> : IEnumerable<T>, IDisposable
Handle = eina_list_append(Handle, ele);
}
/// <summary>Prepends <c>val</c> to the list.</summary>
/// <summary>Prepends <c>val</c> to the list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="val">The item to be prepended.</param>
public void Prepend(T val)
{
@ -285,7 +321,10 @@ public class List<T> : IEnumerable<T>, IDisposable
Handle = eina_list_prepend(Handle, ele);
}
/// <summary>Inserts <c>val</c> in the list in a sorted manner. It presumes the list is already sorted.</summary>
/// <summary>Inserts <c>val</c> in the list in a sorted manner.
/// It presumes the list is already sorted.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="val">The item to be inserted.</param>
public void SortedInsert(T val)
{
@ -293,8 +332,11 @@ public class List<T> : IEnumerable<T>, IDisposable
Handle = eina_list_sorted_insert(Handle, EinaCompareCb<T>(), ele);
}
/// <summary>Inserts <c>val</c> in the list in a sorted manner with the given <c>compareCb</c> for element comparison.
/// It presumes the list is already sorted.</summary>
/// <summary>Inserts <c>val</c> in the list in a sorted manner with the
/// given <c>compareCb</c> for element comparison.
/// It presumes the list is already sorted.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="compareCb">The function to compare two elements of the list.</param>
/// <param name="val">The item to be inserted.</param>
public void SortedInsert(Compare compareCb, T val)
@ -303,21 +345,27 @@ public class List<T> : IEnumerable<T>, IDisposable
Handle = eina_list_sorted_insert(Handle, Marshal.GetFunctionPointerForDelegate(GetNativeCompareCb(compareCb)), ele);
}
/// <summary>Sorts <c>limit</c> elements in this list inplace.</summary>
/// <summary>Sorts <c>limit</c> elements in this list inplace.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="limit">The max number of elements to be sorted.</param>
public void Sort(int limit = 0)
{
Handle = eina_list_sort(Handle, (uint)limit, EinaCompareCb<T>());
}
/// <summary>Sorts all elements in this list inplace.</summary>
/// <summary>Sorts all elements in this list inplace.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="compareCb">The function to compare two elements of the list.</param>
public void Sort(Compare compareCb)
{
Handle = eina_list_sort(Handle, 0, Marshal.GetFunctionPointerForDelegate(GetNativeCompareCb(compareCb)));
}
/// <summary>Sorts <c>limit</c> elements in this list inplace.</summary>
/// <summary>Sorts <c>limit</c> elements in this list inplace.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="limit">The max number of elements to be sorted.</param>
/// <param name="compareCb">The function to compare two elements of the list.</param>
public void Sort(int limit, Compare compareCb)
@ -333,8 +381,11 @@ public class List<T> : IEnumerable<T>, IDisposable
}
/// <summary>Returns the <c>n</c>th element of this list. Due to marshalling details, the returned element
/// may be a different C# object from the one you used to append.</summary>
/// may be a different C# object from the one you used to append.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="n">The 0-based index to be retrieved.</param>
/// <returns>The value in the specified element.</returns>
public T Nth(int n)
{
// TODO: check bounds ???
@ -342,7 +393,9 @@ public class List<T> : IEnumerable<T>, IDisposable
return NativeToManaged<T>(ele);
}
/// <summary>Sets the data at the <c>idx</c> position.</summary>
/// <summary>Sets the data at the <c>idx</c> position.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="idx">The 0-based index to be set.</param>
/// <param name="val">The value to be inserted.</param>
public void DataSet(int idx, T val)
@ -362,7 +415,9 @@ public class List<T> : IEnumerable<T>, IDisposable
InternalDataSet(pos, ele);
}
/// <summary>Accessor for the data at the <c>idx</c> position.</summary>
/// <summary>Accessor for the data at the <c>idx</c> position.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="idx">The 0-based index to be get/set.</param>
public T this[int idx]
{
@ -376,7 +431,9 @@ public class List<T> : IEnumerable<T>, IDisposable
}
}
/// <summary>Returns the data at the last list element.</summary>
/// <summary>Returns the data at the last list element.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The value contained in the last list position.</returns>
public T LastDataGet()
{
@ -384,7 +441,9 @@ public class List<T> : IEnumerable<T>, IDisposable
return NativeToManaged<T>(ele);
}
/// <summary>Reverses this list in place.</summary>
/// <summary>Reverses this list in place.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>A reference to this object.</returns>
public List<T> Reverse()
{
@ -392,13 +451,17 @@ public class List<T> : IEnumerable<T>, IDisposable
return this;
}
/// <summary>Randomly shuffles this list in place.</summary>
/// <summary>Randomly shuffles this list in place.
/// <para>Since EFL 1.23.</para>
/// </summary>
public void Shuffle()
{
Handle = eina_list_shuffle(Handle, IntPtr.Zero);
}
/// <summary>Gets a C# array of the elements in this list.</summary>
/// <summary>Gets a C# array of the elements in this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>A managed array of the elements.</returns>
public T[] ToArray()
{
@ -412,7 +475,9 @@ public class List<T> : IEnumerable<T>, IDisposable
return managed;
}
/// <summary>Appends the given array of elements to this list.</summary>
/// <summary>Appends the given array of elements to this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="values">The values to be appended.</param>
public void AppendArray(T[] values)
{
@ -423,21 +488,27 @@ public class List<T> : IEnumerable<T>, IDisposable
}
/// <summary>Gets an iterator that iterates this list in normal order.</summary>
/// <summary>Gets an iterator that iterates this list in normal order.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The iterator.</returns>
public Eina.Iterator<T> GetIterator()
{
return new Eina.Iterator<T>(eina_list_iterator_new(Handle), true);
}
/// <summary>Gets an iterator that iterates this list in reverse order.</summary>
/// <summary>Gets an iterator that iterates this list in reverse order.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The iterator.</returns>
public Eina.Iterator<T> GetReversedIterator()
{
return new Eina.Iterator<T>(eina_list_iterator_reversed_new(Handle), true);
}
/// <summary>Gets an enumerator into this list.</summary>
/// <summary>Gets an enumerator into this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The enumerator.</returns>
public IEnumerator<T> GetEnumerator()
{
@ -447,14 +518,18 @@ public class List<T> : IEnumerable<T>, IDisposable
}
}
/// <summary>Gets an enumerator into this list.</summary>
/// <summary>Gets an enumerator into this list.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The enumerator.</returns>
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
/// <summary> Gets an Accessor for this List.</summary>
/// <summary> Gets an Accessor for this List.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The accessor.</returns>
public Eina.Accessor<T> GetAccessor()
{

View File

@ -10,8 +10,7 @@ namespace Eina
// Manual wrappers around eina functions
/// <summary>EFL Logging facilities.
///
/// Since EFL 1.23.
/// <para>Since EFL 1.23.</para>
/// </summary>
public class Log
{
@ -31,55 +30,97 @@ public class Log
[DllImport(efl.Libs.Eina)] private static extern Level eina_log_level_get();
/// <summary>The levels of logging.</summary>
/// <summary>The levels of logging.
/// <para>Since EFL 1.23.</para>
/// </summary>
public enum Level
{
/// <summary>Critical events.</summary>
/// <summary>Critical events.
/// <para>Since EFL 1.23.</para>
/// </summary>
Critical,
/// <summary>Error events.</summary>
/// <summary>Error events.
/// <para>Since EFL 1.23.</para>
/// </summary>
Error,
/// <summary>Warning events.</summary>
/// <summary>Warning events.
/// <para>Since EFL 1.23.</para>
/// </summary>
Warning,
/// <summary>Informative events.</summary>
/// <summary>Informative events.
/// <para>Since EFL 1.23.</para>
/// </summary>
Info,
/// <summary>Debugging messages.</summary>
/// <summary>Debugging messages.
/// <para>Since EFL 1.23.</para>
/// </summary>
Debug,
/// <summary>Unknown events.</summary>
/// <summary>Unknown events.
/// <para>Since EFL 1.23.</para>
/// </summary>
Unkown = (-2147483647 - 1)
}
/// <summary>The colors to be used by the logging system.</summary>
/// <summary>The colors to be used by the logging system.
/// <para>Since EFL 1.23.</para>
/// </summary>
public class Color
{
/// <summary>Light red</summary>
/// <summary>Light red
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string LIGHTRED = "\033[31;1m";
/// <summary>Red</summary>
/// <summary>Red
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string RED = "\033[31m";
/// <summary>Light blue</summary>
/// <summary>Light blue
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string LIGHTBLUE = "\033[34;1m";
/// <summary>Blue</summary>
/// <summary>Blue
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string BLUE = "\033[34m";
/// <summary>Green</summary>
/// <summary>Green
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string GREEN = "\033[32;1m";
/// <summary>Yellow</summary>
/// <summary>Yellow
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string YELLOW = "\033[33;1m";
/// <summary>Orange</summary>
/// <summary>Orange
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string ORANGE = "\033[0;33m";
/// <summary>White</summary>
/// <summary>White
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string WHITE = "\033[37;1m";
/// <summary>Light cyan</summary>
/// <summary>Light cyan
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string LIGHTCYAN = "\033[36;1m";
/// <summary>Cyan</summary>
/// <summary>Cyan
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string CYAN = "\033[36m";
/// <summary>Reset</summary>
/// <summary>Reset
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string RESET = "\033[0m";
/// <summary>Bold</summary>
/// <summary>Bold
/// <para>Since EFL 1.23.</para>
/// </summary>
public static string HIGH = "\033[1m";
}
private static int domain = -1;
/// <summary>Static class initializer.</summary>
/// <summary>Static class initializer.
/// <para>Since EFL 1.23.</para>
/// </summary>
static Log()
{
const String name = "mono";
@ -105,7 +146,10 @@ public class Log
}
}
/// <summary>Prints a critical message with context info. This context is filled automatically by the C# compiler.</summary>
/// <summary>Prints a critical message with context info. This context is
/// filled automatically by the C# compiler.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="message">The message to be printed.</param>
/// <param name="line">The line number this method was called from.</param>
/// <param name="file">The file this method was called from.</param>
@ -116,7 +160,10 @@ public class Log
eina_log_print(domain, Level.Critical, file, member, line, message);
}
/// <summary>Prints an error message with context info. This context is filled automatically by the C# compiler.</summary>
/// <summary>Prints an error message with context info. This context is
/// filled automatically by the C# compiler.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="message">The message to be printed.</param>
/// <param name="line">The line number this method was called from.</param>
/// <param name="file">The file this method was called from.</param>
@ -127,7 +174,10 @@ public class Log
eina_log_print(domain, Level.Error, file, member, line, message);
}
/// <summary>Prints a warning message with context info. This context is filled automatically by the C# compiler.</summary>
/// <summary>Prints a warning message with context info. This context is
/// filled automatically by the C# compiler.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="message">The message to be printed.</param>
/// <param name="line">The line number this method was called from.</param>
/// <param name="file">The file this method was called from.</param>
@ -138,7 +188,10 @@ public class Log
eina_log_print(domain, Level.Warning, file, member, line, message);
}
/// <summary>Prints an informative message with context info. This context is filled automatically by the C# compiler.</summary>
/// <summary>Prints an informative message with context info. This context
/// is filled automatically by the C# compiler.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="message">The message to be printed.</param>
/// <param name="line">The line number this method was called from.</param>
/// <param name="file">The file this method was called from.</param>
@ -149,7 +202,10 @@ public class Log
eina_log_print(domain, Level.Info, file, member, line, message);
}
/// <summary>Prints a debug message with context info. This context is filled automatically by the C# compiler.</summary>
/// <summary>Prints a debug message with context info. This context is
/// filled automatically by the C# compiler.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="message">The message to be printed.</param>
/// <param name="line">The line number this method was called from.</param>
/// <param name="file">The file this method was called from.</param>
@ -160,14 +216,19 @@ public class Log
eina_log_print(domain, Level.Debug, file, member, line, message);
}
/// <summary>Sets the highest level log messages should be printed. Values larger than this one are ignored.</summary>
/// <summary>Sets the highest level log messages should be printed. Values
/// larger than this one are ignored.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <param name="level">The global message level.</param>
public static void GlobalLevelSet(Level level)
{
eina_log_level_set(level);
}
/// <summary>Gets the lowest level of messages that are not ignored.</summary>
/// <summary>Gets the lowest level of messages that are not ignored.
/// <para>Since EFL 1.23.</para>
/// </summary>
/// <returns>The current message level.</returns>
public static Level GlobalLevelGet()
{

View File

@ -528,9 +528,10 @@ _ecore_main_idlers_exist(Efl_Loop_Data *pd)
}
static void
_ecore_main_idler_all_call(Eo *loop)
_ecore_main_idler_all_call(Eo *loop, Efl_Loop_Data *pd)
{
efl_event_callback_call(loop, EFL_LOOP_EVENT_IDLE, NULL);
if (pd->idlers)
efl_event_callback_call(loop, EFL_LOOP_EVENT_IDLE, NULL);
// just spin in an idler until the free queue is empty freeing 84 items
// from the free queue each time.for now this seems like an ok balance
// between going in and out of a reduce func with mutexes around it
@ -803,7 +804,7 @@ _ecore_main_gsource_dispatch(GSource *source EINA_UNUSED,
if (ecore_idling)
{
_ecore_main_idler_all_call(obj);
_ecore_main_idler_all_call(obj, pd);
events_ready = pd->message_queue ? 1 : 0;
@ -2236,7 +2237,7 @@ _ecore_main_loop_uv_prepare(uv_prepare_t *handle EINA_UNUSED)
if (_ecore_main_uv_idling)
{
_ecore_main_idler_all_call(obj);
_ecore_main_idler_all_call(obj, pd);
DBG("called idles");
if (_ecore_main_idlers_exist(pd) || (pd->message_queue)) t = 0.0;
}
@ -2300,7 +2301,7 @@ _ecore_main_loop_spin_core(Eo *obj, Efl_Loop_Data *pd)
// as we are spinning we need to update loop time per spin
_update_loop_time(pd);
// call all idlers
_ecore_main_idler_all_call(obj);
_ecore_main_idler_all_call(obj, pd);
// which returns false if no more idelrs exist
if (!_ecore_main_idlers_exist(pd)) return SPIN_RESTART;
// sneaky - drop through or if checks - the first one to succeed

View File

@ -159,7 +159,7 @@ struct _Ecore_Con_Url
#define ECORE_CON_URL_CHECK_RETURN(u, ...) \
do \
{ \
if (!ECORE_MAGIC_CHECK(u, ECORE_MAGIC_CON_URL)) \
if (!EINA_MAGIC_CHECK(u, ECORE_MAGIC_CON_URL)) \
{ \
ECORE_MAGIC_FAIL(u, ECORE_MAGIC_CON_URL, __FUNCTION__); \
return __VA_ARGS__; \

View File

@ -736,6 +736,18 @@ EAPI const char *ecore_wl2_display_name_get(const Ecore_Wl2_Display *display);
*/
EAPI Ecore_Wl2_Window *ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x, int y, int w, int h);
/**
* Set a callback to be caleld just before the window is closed and freed
*
* @param window The window to listen to for a xdg toplevel close callback
* @param cb The callback function to call being passed data and window
* @param data The Data pointer to pass as data to the callback
*
* @ingroup Ecore_Wl2_Window_Group
* @since 1.24
*/
EAPI void ecore_wl2_window_close_callback_set(Ecore_Wl2_Window *window, void (*cb) (void *data, Ecore_Wl2_Window *win), void *data);
/**
* Get the wl_surface which belongs to this window
*

View File

@ -191,6 +191,9 @@ struct _Ecore_Wl2_Window
struct zxdg_toplevel_v6 *zxdg_toplevel;
struct zxdg_popup_v6 *zxdg_popup;
void (*cb_close) (void *data, Ecore_Wl2_Window *win);
void *cb_close_data;
Eina_Stringshare *uuid;
void (*xdg_configure_ack)(struct xdg_surface *surface, uint32_t serial);

View File

@ -264,7 +264,11 @@ _xdg_toplevel_cb_close(void *data, struct xdg_toplevel *xdg_toplevel EINA_UNUSED
win = data;
if (!win) return;
if (win->cb_close)
{
win->cb_close(win->cb_close_data, win);
win->cb_close = NULL;
}
ecore_wl2_window_free(win);
}
@ -568,6 +572,14 @@ ecore_wl2_window_new(Ecore_Wl2_Display *display, Ecore_Wl2_Window *parent, int x
return win;
}
EAPI void
ecore_wl2_window_close_callback_set(Ecore_Wl2_Window *window, void (*cb) (void *data, Ecore_Wl2_Window *win), void *data)
{
EINA_SAFETY_ON_NULL_RETURN(window);
window->cb_close = cb;
window->cb_close_data = data;
}
EAPI struct wl_surface *
ecore_wl2_window_surface_get(Ecore_Wl2_Window *window)
{

View File

@ -1043,7 +1043,7 @@ _edje_recalc_do(Edje *ed)
#endif
if (!ed->calc_only)
{
if (ed->recalc_call)
if (ed->recalc_call && ed->has_recalc_event_cb)
efl_event_callback_legacy_call(ed->obj, EFL_LAYOUT_EVENT_RECALC, NULL);
}
else

View File

@ -1812,6 +1812,7 @@ struct _Edje
Eina_Bool need_map_update : 1;
Eina_Bool canvas_animator : 1;
Eina_Bool has_state_clip : 1;
Eina_Bool has_recalc_event_cb : 1;
};
struct _Edje_Calc_Params_Map

View File

@ -601,9 +601,33 @@ _efl_canvas_layout_efl_player_playback_speed_get(const Eo *obj EINA_UNUSED, Edje
}
/* Internal EO APIs and hidden overrides */
EOLIAN static Eina_Bool
_efl_canvas_layout_efl_object_event_callback_priority_add(Eo *obj, Edje *pd, const Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb func, const void *user_data)
{
if (desc == EFL_LAYOUT_EVENT_RECALC)
{
pd->has_recalc_event_cb = EINA_TRUE;
}
return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
}
EOLIAN static Eina_Bool
_efl_canvas_layout_efl_object_event_callback_array_priority_add(Eo *obj, Edje *pd, const Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, const void *user_data)
{
for (int i = 0; array[i].desc; ++i)
{
if (array[i].desc == EFL_LAYOUT_EVENT_RECALC)
{
pd->has_recalc_event_cb = EINA_TRUE;
}
}
return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
}
#define EFL_CANVAS_LAYOUT_EXTRA_OPS \
EFL_CANVAS_GROUP_ADD_DEL_OPS(efl_canvas_layout), \
EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_canvas_layout_efl_object_event_callback_priority_add), \
EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_canvas_layout_efl_object_event_callback_array_priority_add), \
EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_canvas_layout_efl_object_dbg_info_get)
#include "efl_canvas_layout.eo.c"

View File

@ -2283,11 +2283,11 @@ eet_data_read_cipher(Eet_File *ef,
return NULL;
}
eet_dictionary_lock_read(ed); // XXX: get manual eet_dictionary lock
if (ed) eet_dictionary_lock_read(ed); // XXX: get manual eet_dictionary lock
eet_free_context_init(&context);
data_dec = _eet_data_descriptor_decode(&context, ed, edd, data, size, NULL, 0);
eet_free_context_shutdown(&context);
eet_dictionary_unlock(ed); // XXX: release manual eet_dictionary lock
if (ed) eet_dictionary_unlock(ed); // XXX: release manual eet_dictionary lock
if (required_free)
free((void *)data);
@ -2324,11 +2324,11 @@ eet_data_read_cipher_buffer(Eet_File *ef,
return NULL;
}
eet_dictionary_lock_read(ed); // XXX: get manual eet_dictionary lock
if (ed) eet_dictionary_lock_read(ed); // XXX: get manual eet_dictionary lock
eet_free_context_init(&context);
data_dec = _eet_data_descriptor_decode(&context, ed, edd, data, size, buffer, buffer_size);
eet_free_context_shutdown(&context);
eet_dictionary_unlock(ed); // XXX: release manual eet_dictionary lock
if (ed) eet_dictionary_unlock(ed); // XXX: release manual eet_dictionary lock
if (required_free)
free((void *)data);
@ -2361,11 +2361,11 @@ eet_data_node_read_cipher(Eet_File *ef,
return NULL;
}
eet_dictionary_lock_read(ed); // XXX: get manual eet_dictionary lock
if (ed) eet_dictionary_lock_read(ed); // XXX: get manual eet_dictionary lock
eet_free_context_init(&context);
result = _eet_data_descriptor_decode(&context, ed, NULL, data, size, NULL, 0);
eet_free_context_shutdown(&context);
eet_dictionary_unlock(ed); // XXX: release manual eet_dictionary lock
if (ed) eet_dictionary_unlock(ed); // XXX: release manual eet_dictionary lock
if (required_free)
free((void *)data);
@ -4839,11 +4839,11 @@ eet_data_dump_cipher(Eet_File *ef,
return 0;
}
eet_dictionary_lock_read(ed); // XXX: get manual eet_dictionary lock
if (ed) eet_dictionary_lock_read(ed); // XXX: get manual eet_dictionary lock
eet_free_context_init(&context);
result = _eet_data_descriptor_decode(&context, ed, NULL, data, size, NULL, 0);
eet_free_context_shutdown(&context);
eet_dictionary_unlock(ed); // XXX: release manual eet_dictionary lock
if (ed) eet_dictionary_unlock(ed); // XXX: release manual eet_dictionary lock
eet_node_dump(result, 0, dumpfunc, dumpdata);

View File

@ -175,6 +175,7 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld)
ELM_WIDGET_DATA_GET_OR_RETURN(sd->obj, wd);
if (!efl_alive_get(obj)) return;
if (ld) ld->in_calc = EINA_TRUE;
if (sd->calc_subobjs && !evas_smart_objects_calculating_get(evas_object_evas_get(obj)))
{
@ -186,7 +187,7 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld)
}
elm_coords_finger_size_adjust(sd->finger_size_multiplier_x, &rest_w,
sd->finger_size_multiplier_y, &rest_h);
if (ld)
if (ld && ld->user_min_sz)
sz = efl_gfx_hint_size_combined_min_get(obj);
else
sz = efl_gfx_hint_size_min_get(obj);
@ -218,7 +219,7 @@ _sizing_eval(Evas_Object *obj, Efl_Ui_Layout_Data *sd, Elm_Layout_Data *ld)
efl_gfx_hint_size_restricted_min_set(obj, EINA_SIZE2D(minw, minh));
if (ld)
ld->restricted_calc_w = ld->restricted_calc_h = EINA_FALSE;
ld->in_calc = ld->restricted_calc_w = ld->restricted_calc_h = EINA_FALSE;
}
void
@ -537,7 +538,10 @@ _efl_ui_layout_theme_internal(Eo *obj, Efl_Ui_Layout_Data *sd, Elm_Widget_Smart_
}
if (ret != EFL_UI_THEME_APPLY_ERROR_GENERIC)
efl_event_callback_legacy_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL);
{
if (sd->cb_theme_changed)
efl_event_callback_legacy_call(obj, EFL_UI_LAYOUT_EVENT_THEME_CHANGED, NULL);
}
if (!_visuals_refresh(obj, sd))
ret = EFL_UI_THEME_APPLY_ERROR_GENERIC;
@ -1915,6 +1919,19 @@ _elm_layout_efl_canvas_group_change(Eo *obj, Elm_Layout_Data *ld)
efl_canvas_group_change(efl_super(obj, ELM_LAYOUT_MIXIN));
}
EOLIAN static void
_elm_layout_efl_gfx_hint_size_restricted_min_set(Eo *obj, Elm_Layout_Data *ld, Eina_Size2D sz)
{
/* correctly handle legacy case where the user has set a min size hint on the object:
* in legacy code, only restricted_min existed, which resulted in conflicts between
* internal sizing and user-expected sizing. we attempt to simulate this now in a more controlled
* manner by only checking this hint during sizing calcs if the user has set it
*/
if (!ld->in_calc)
ld->user_min_sz = (sz.w > 0) || (sz.h > 0);
efl_gfx_hint_size_restricted_min_set(efl_super(obj, ELM_LAYOUT_MIXIN), sz);
}
/* layout's sizing evaluation is deferred. evaluation requests are
* queued up and only flag the object as 'changed'. when it comes to
* Evas's rendering phase, it will be addressed, finally (see
@ -2955,6 +2972,29 @@ _efl_ui_layout_base_theme_rotation_apply(Eo *obj, Efl_Ui_Layout_Data *pd EINA_UN
/* Internal EO APIs and hidden overrides */
EOLIAN static Eina_Bool
_efl_ui_layout_base_efl_object_event_callback_priority_add(Eo *obj, Efl_Ui_Layout_Data *pd, const Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb func, const void *user_data)
{
if (desc == EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED)
{
pd->cb_theme_changed = EINA_TRUE;
}
return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
}
EOLIAN static Eina_Bool
_efl_ui_layout_base_efl_object_event_callback_array_priority_add(Eo *obj, Efl_Ui_Layout_Data *pd, const Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, const void *user_data)
{
for (int i = 0; array[i].desc; ++i)
{
if (array[i].desc == EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED)
{
pd->cb_theme_changed = EINA_TRUE;
}
}
return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
}
EFL_FUNC_BODY_CONST(efl_ui_layout_text_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL)
EFL_FUNC_BODY_CONST(efl_ui_layout_content_aliases_get, const Elm_Layout_Part_Alias_Description *, NULL)
@ -2968,6 +3008,8 @@ EFL_UI_LAYOUT_TEXT_ALIASES_IMPLEMENT(MY_CLASS_PFX)
ELM_PART_TEXT_DEFAULT_OPS(efl_ui_layout_base), \
EFL_UI_LAYOUT_CONTENT_ALIASES_OPS(MY_CLASS_PFX), \
EFL_UI_LAYOUT_TEXT_ALIASES_OPS(MY_CLASS_PFX), \
EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_ui_layout_base_efl_object_event_callback_priority_add), \
EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_ui_layout_base_efl_object_event_callback_array_priority_add), \
EFL_OBJECT_OP_FUNC(efl_dbg_info_get, _efl_ui_layout_base_efl_object_dbg_info_get)

View File

@ -50,6 +50,7 @@ _elm_layout_class_initializer(Efl_Class *klass)
EFL_OPS_DEFINE(ops,
EFL_OBJECT_OP_FUNC(elm_layout_sizing_eval, _elm_layout_sizing_eval),
EFL_OBJECT_OP_FUNC(efl_canvas_group_change, _elm_layout_efl_canvas_group_change),
EFL_OBJECT_OP_FUNC(efl_gfx_hint_size_restricted_min_set, _elm_layout_efl_gfx_hint_size_restricted_min_set),
ELM_LAYOUT_EXTRA_OPS
);
opsp = &ops;

View File

@ -74,6 +74,7 @@ typedef struct _Efl_Ui_Layout_Data
Eina_Bool model_bound : 1; /**< Set to true once we are watching over a model*/
Eina_Bool model_watch : 1; /**< Set to true once we do watch for model change*/
Eina_Bool calc_subobjs : 1; /**< Set to true if group_calc should also handle subobjs during manual calc */
Eina_Bool cb_theme_changed : 1; /**< if theme,changed event subscriber has been added */
} Efl_Ui_Layout_Data;
typedef struct _Elm_Layout_Data
@ -81,6 +82,8 @@ typedef struct _Elm_Layout_Data
Eina_Bool needs_size_calc : 1; /**< This flag is set true when the layout sizing eval is already requested. This defers sizing evaluation until smart calculation to avoid unnecessary calculation. */
Eina_Bool restricted_calc_w : 1; /**< This is a flag to support edje restricted_calc in w axis. */
Eina_Bool restricted_calc_h : 1; /**< This is a flag to support edje restricted_calc in y axis. */
Eina_Bool in_calc : 1; /**< object is currently in group_calc */
Eina_Bool user_min_sz : 1; /**< min size was set by user (legacy only has restricted min) */
} Elm_Layout_Data;
/**

View File

@ -61,6 +61,7 @@ struct _Efl_Object_Data
unsigned short event_cb_efl_event_callback_del_count;
unsigned short event_cb_efl_event_del_count;
unsigned short event_cb_efl_event_noref_count;
unsigned short event_cb_efl_event_invalidate_count;
Eina_Bool callback_stopped : 1;
Eina_Bool need_cleaning : 1;
Eina_Bool allow_parent_unref : 1; // Allows unref to zero even with a parent
@ -1228,6 +1229,8 @@ _special_event_count_inc(Eo *obj_id, Efl_Object_Data *pd, const Efl_Callback_Arr
CB_COUNT_INC(pd->event_cb_efl_event_noref_count);
}
else if (it->desc == EFL_EVENT_INVALIDATE)
CB_COUNT_INC(pd->event_cb_efl_event_invalidate_count);
else if (it->desc == EFL_EVENT_DESTRUCT)
pd->has_destroyed_event_cb = EINA_TRUE;
else if (it->desc == EFL_EVENT_OWNERSHIP_SHARED || it->desc == EFL_EVENT_OWNERSHIP_UNIQUE)
@ -1247,6 +1250,8 @@ _special_event_count_dec(Eo *obj_id, Efl_Object_Data *pd, const Efl_Callback_Arr
CB_COUNT_DEC(pd->event_cb_efl_event_callback_del_count);
else if (it->desc == EFL_EVENT_DEL)
CB_COUNT_DEC(pd->event_cb_efl_event_del_count);
else if (it->desc == EFL_EVENT_INVALIDATE)
CB_COUNT_DEC(pd->event_cb_efl_event_invalidate_count);
else if (it->desc == EFL_EVENT_NOREF)
{
CB_COUNT_DEC(pd->event_cb_efl_event_noref_count);
@ -1685,6 +1690,8 @@ _event_callback_call(Eo *obj_id, Efl_Object_Data *pd,
(pd->event_cb_efl_event_callback_del_count == 0)) return EINA_FALSE;
else if ((desc == EFL_EVENT_DEL) &&
(pd->event_cb_efl_event_del_count == 0)) return EINA_FALSE;
else if ((desc == EFL_EVENT_INVALIDATE) &&
(pd->event_cb_efl_event_invalidate_count == 0)) return EINA_FALSE;
else if ((desc == EFL_EVENT_NOREF) &&
(pd->event_cb_efl_event_noref_count == 0)) return EINA_FALSE;

View File

@ -10,6 +10,7 @@ EVAS_MEMPOOL(_mp_pc);
extern Eina_Hash* signals_hash_table;
/* Legacy events, do not use anywhere */
void _evas_object_smart_callback_call_internal(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc);
static const Efl_Event_Description _EVAS_OBJECT_EVENT_FREE = EFL_EVENT_DESCRIPTION("free");
static const Efl_Event_Description _EVAS_OBJECT_EVENT_DEL = EFL_EVENT_DESCRIPTION("del");
#define EVAS_OBJECT_EVENT_FREE (&(_EVAS_OBJECT_EVENT_FREE))
@ -350,14 +351,8 @@ evas_event_callback_call(Evas *eo_e, Evas_Callback_Type type, void *event_info)
static void
_evas_callback_legacy_smart_compatibility_do_it(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc, void *event_info)
{
if (efl_event_desc == EFL_GFX_ENTITY_EVENT_POSITION_CHANGED)
evas_object_smart_callback_call(eo_obj, "move", NULL);
else if (efl_event_desc == EFL_GFX_ENTITY_EVENT_SIZE_CHANGED)
evas_object_smart_callback_call(eo_obj, "resize", NULL);
else if (efl_event_desc == EFL_GFX_ENTITY_EVENT_STACKING_CHANGED)
evas_object_smart_callback_call(eo_obj, "restack", NULL);
/* this is inverted: the base call is the legacy compat and this is the new event */
else if ((efl_event_desc == EFL_GFX_ENTITY_EVENT_SHOW) || (efl_event_desc == EFL_GFX_ENTITY_EVENT_HIDE))
if ((efl_event_desc == EFL_GFX_ENTITY_EVENT_SHOW) || (efl_event_desc == EFL_GFX_ENTITY_EVENT_HIDE))
efl_event_callback_call(eo_obj, EFL_GFX_ENTITY_EVENT_VISIBILITY_CHANGED, event_info);
else if ((efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD) || (efl_event_desc == EFL_GFX_IMAGE_EVENT_IMAGE_UNLOAD))
efl_event_callback_call(eo_obj, EFL_GFX_IMAGE_EVENT_IMAGE_PRELOAD_STATE_CHANGED, event_info);
@ -403,6 +398,9 @@ evas_object_event_callback_call(Evas_Object *eo_obj, Evas_Object_Protected_Data
type == EVAS_CALLBACK_MULTI_UP)
_efl_canvas_gesture_manager_filter_event(e->gesture_manager, eo_obj, event_info);
if (obj->is_smart)
_evas_object_smart_callback_call_internal(eo_obj, efl_event_desc);
if (!_evas_object_callback_has_by_type(obj, type))
goto nothing_here;

View File

@ -2014,5 +2014,41 @@ EWAPI const Efl_Event_Description _EVAS_CANVAS_EVENT_AXIS_UPDATE =
EWAPI const Efl_Event_Description _EVAS_CANVAS_EVENT_VIEWPORT_RESIZE =
EFL_EVENT_DESCRIPTION("viewport,resize");
#define CHECK_ADD(var, ev, member) \
if ((var) == (ev)) \
{ \
e->member = EINA_TRUE; \
}
EOLIAN static Eina_Bool
_evas_canvas_efl_object_event_callback_priority_add(Eo *obj, Evas_Public_Data *e, const Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb func, const void *user_data)
{
CHECK_ADD(desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE, cb_render_flush_pre)
else CHECK_ADD(desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_POST, cb_render_flush_post)
else CHECK_ADD(desc, EFL_CANVAS_SCENE_EVENT_RENDER_PRE, cb_render_pre)
else CHECK_ADD(desc, EFL_CANVAS_SCENE_EVENT_RENDER_POST, cb_render_post)
return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
}
EOLIAN static Eina_Bool
_evas_canvas_efl_object_event_callback_array_priority_add(Eo *obj, Evas_Public_Data *e, const Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, const void *user_data)
{
for (int i = 0; array[i].desc; ++i)
{
CHECK_ADD(array[i].desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_PRE, cb_render_flush_pre)
else CHECK_ADD(array[i].desc, EVAS_CANVAS_EVENT_RENDER_FLUSH_POST, cb_render_flush_post)
else CHECK_ADD(array[i].desc, EFL_CANVAS_SCENE_EVENT_RENDER_PRE, cb_render_pre)
else CHECK_ADD(array[i].desc, EFL_CANVAS_SCENE_EVENT_RENDER_POST, cb_render_post)
}
return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
}
#undef CHECK_ADD
#define EVAS_CANVAS_EXTRA_OPS \
EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _evas_canvas_efl_object_event_callback_priority_add), \
EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _evas_canvas_efl_object_event_callback_array_priority_add)
#include "evas_stack.x"
#include "canvas/evas_canvas_eo.c"

View File

@ -11,7 +11,7 @@
#define EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj, ...) \
Evas_Smart_Data *o = efl_data_scope_safe_get(eo_obj, MY_CLASS); \
do { if (!o) { MAGIC_CHECK_FAILED(eo_obj,0,MAGIC_SMART) return __VA_ARGS__; } } while (0)
do { if (!o) { ERR("calling smart object API on non-smart object!"); return __VA_ARGS__; } } while (0)
extern Eina_Hash* signals_hash_table;
@ -51,6 +51,11 @@ struct _Evas_Smart_Data
Eina_Bool clipped : 1; /* If true, smart clipped */
Eina_Bool data_nofree : 1; /* If true, do NOT free the data */
Eina_Bool constructed : 1; /* constructor finished */
Eina_Bool cb_move : 1; /* has "move" cb added */
Eina_Bool cb_resize : 1; /* has "resize" cb added */
Eina_Bool cb_restack : 1; /* has "restack" cb added */
Eina_Bool cb_member_added : 1; /* has "member,added" cb added */
Eina_Bool cb_member_removed : 1; /* has "member,removed" cb added */
};
typedef struct
@ -330,7 +335,8 @@ _efl_canvas_group_group_member_add(Eo *smart_obj, Evas_Smart_Data *o, Evas_Objec
if (smart->smart.smart && smart->smart.smart->smart_class->member_add)
smart->smart.smart->smart_class->member_add(smart_obj, eo_obj);
evas_object_update_bounding_box(eo_obj, obj, member_o);
efl_event_callback_call(smart_obj, EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED, eo_obj);
if (o->cb_member_added)
efl_event_callback_call(smart_obj, EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED, eo_obj);
}
EAPI void
@ -347,7 +353,7 @@ evas_object_smart_member_del(Evas_Object *eo_obj)
}
EOLIAN static void
_efl_canvas_group_group_member_remove(Eo *smart_obj, Evas_Smart_Data *_pd EINA_UNUSED, Evas_Object *eo_obj)
_efl_canvas_group_group_member_remove(Eo *smart_obj, Evas_Smart_Data *sd, Evas_Object *eo_obj)
{
Evas_Object_Protected_Data *obj = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
Evas_Object_Protected_Data *smart;
@ -357,7 +363,8 @@ _efl_canvas_group_group_member_remove(Eo *smart_obj, Evas_Smart_Data *_pd EINA_U
evas_object_async_block(obj);
efl_event_callback_call(smart_obj, EFL_CANVAS_GROUP_EVENT_MEMBER_REMOVED, eo_obj);
if (sd->cb_member_removed)
efl_event_callback_call(smart_obj, EFL_CANVAS_GROUP_EVENT_MEMBER_REMOVED, eo_obj);
smart = efl_data_scope_get(smart_obj, EFL_CANVAS_OBJECT_CLASS);
if (smart->smart.smart && smart->smart.smart->smart_class->member_del)
@ -983,6 +990,35 @@ evas_object_smart_callback_add(Evas_Object *eo_obj, const char *event, Evas_Smar
EVAS_CALLBACK_PRIORITY_DEFAULT, func, data);
}
static void
_smart_cb_check(Evas_Smart_Data *o, const char *event)
{
if (!o->cb_move)
{
if (eina_streq(event, "move"))
{
o->cb_move = EINA_TRUE;
return;
}
}
if (!o->cb_resize)
{
if (eina_streq(event, "resize"))
{
o->cb_resize = EINA_TRUE;
return;
}
}
if (!o->cb_restack)
{
if (eina_streq(event, "restack"))
{
o->cb_restack = EINA_TRUE;
return;
}
}
}
EAPI void
evas_object_smart_callback_priority_add(Evas_Object *eo_obj, const char *event, Evas_Callback_Priority priority, Evas_Smart_Cb func, const void *data)
{
@ -996,6 +1032,7 @@ evas_object_smart_callback_priority_add(Evas_Object *eo_obj, const char *event,
cb_info->func = func;
cb_info->data = (void *)data;
cb_info->event = eo_desc;
_smart_cb_check(o, event);
o->callbacks = eina_inlist_append(o->callbacks,
EINA_INLIST_GET(cb_info));
@ -1069,6 +1106,33 @@ evas_object_smart_callback_call(Evas_Object *eo_obj, const char *event, void *ev
efl_event_callback_legacy_call(eo_obj, eo_desc, event_info);
}
void
_evas_object_smart_callback_call_internal(Evas_Object *eo_obj, const Efl_Event_Description *efl_event_desc)
{
const char *event = NULL;
EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj);
if (efl_event_desc == EFL_GFX_ENTITY_EVENT_POSITION_CHANGED)
{
if (!o->cb_move) return;
event = "move";
}
else if (efl_event_desc == EFL_GFX_ENTITY_EVENT_SIZE_CHANGED)
{
if (!o->cb_resize) return;
event = "resize";
}
else if (efl_event_desc == EFL_GFX_ENTITY_EVENT_STACKING_CHANGED)
{
if (!o->cb_restack) return;
event = "restack";
}
else //invalidate
return;
const Efl_Event_Description *eo_desc = efl_object_legacy_only_event_description_get(event);
efl_event_callback_legacy_call(eo_obj, eo_desc, NULL);
}
EAPI Eina_Bool
evas_object_smart_callbacks_descriptions_set(Eo *eo_obj, const Evas_Smart_Cb_Description *descriptions)
{
@ -1555,7 +1619,7 @@ evas_object_smart_cleanup(Evas_Object *eo_obj)
}
evas_smart_cb_descriptions_resize(&o->callbacks_descriptions, 0);
evas_object_smart_data_set(eo_obj, NULL);
if (o->data) evas_object_smart_data_set(eo_obj, NULL);
}
obj->smart.parent = NULL;
@ -1860,7 +1924,37 @@ _efl_canvas_group_group_clipped_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *sd,
}
/* Internal EO APIs */
EOLIAN static Eina_Bool
_efl_canvas_group_efl_object_event_callback_priority_add(Eo *obj, Evas_Smart_Data *sd, const Efl_Event_Description *desc, Efl_Callback_Priority priority, Efl_Event_Cb func, const void *user_data)
{
if (desc == EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED)
{
sd->cb_member_added = EINA_TRUE;
}
else if (desc == EFL_CANVAS_GROUP_EVENT_MEMBER_REMOVED)
{
sd->cb_member_added = EINA_TRUE;
}
return efl_event_callback_priority_add(efl_super(obj, MY_CLASS), desc, priority, func, user_data);
}
EOLIAN static Eina_Bool
_efl_canvas_group_efl_object_event_callback_array_priority_add(Eo *obj, Evas_Smart_Data *sd, const Efl_Callback_Array_Item *array, Efl_Callback_Priority priority, const void *user_data)
{
for (int i = 0; array[i].desc; ++i)
{
if (array[i].desc == EFL_CANVAS_GROUP_EVENT_MEMBER_ADDED)
{
sd->cb_member_added = EINA_TRUE;
}
else if (array[i].desc == EFL_CANVAS_GROUP_EVENT_MEMBER_REMOVED)
{
sd->cb_member_removed = EINA_TRUE;
}
}
return efl_event_callback_array_priority_add(efl_super(obj, MY_CLASS), array, priority, user_data);
}
EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_add)
EOAPI EFL_VOID_FUNC_BODY(efl_canvas_group_del)
EOAPI EFL_VOID_FUNC_BODYV(efl_canvas_group_clipped_set, EFL_FUNC_CALL(enable), Eina_Bool enable)
@ -1868,6 +1962,8 @@ EOAPI EFL_VOID_FUNC_BODYV(efl_canvas_group_clipped_set, EFL_FUNC_CALL(enable), E
#define EFL_CANVAS_GROUP_EXTRA_OPS \
EFL_OBJECT_OP_FUNC(efl_canvas_group_add, _efl_canvas_group_group_add), \
EFL_OBJECT_OP_FUNC(efl_canvas_group_del, _efl_canvas_group_group_del), \
EFL_OBJECT_OP_FUNC(efl_event_callback_priority_add, _efl_canvas_group_efl_object_event_callback_priority_add), \
EFL_OBJECT_OP_FUNC(efl_event_callback_array_priority_add, _efl_canvas_group_efl_object_event_callback_array_priority_add), \
EFL_OBJECT_OP_FUNC(efl_canvas_group_clipped_set, _efl_canvas_group_group_clipped_set)
#include "canvas/efl_canvas_group.eo.c"

View File

@ -2762,10 +2762,26 @@ _drop_image_cache_ref(const void *container EINA_UNUSED, void *data, void *fdata
}
static void
_cb_always_call(Evas *eo_e, Evas_Callback_Type type, void *event_info)
_cb_always_call(Evas *eo_e, Evas_Public_Data *e, Evas_Callback_Type type, void *event_info)
{
int freeze_num = 0, i;
switch (type)
{
case EVAS_CALLBACK_RENDER_PRE:
if (!e->cb_render_pre) return;
break;
case EVAS_CALLBACK_RENDER_POST:
if (!e->cb_render_post) return;
break;
case EVAS_CALLBACK_RENDER_FLUSH_PRE:
if (!e->cb_render_flush_pre) return;
break;
case EVAS_CALLBACK_RENDER_FLUSH_POST:
if (!e->cb_render_flush_post) return;
break;
default: break;
}
freeze_num = efl_event_freeze_count_get(eo_e);
for (i = 0; i < freeze_num; i++) efl_event_thaw(eo_e);
evas_event_callback_call(eo_e, type, event_info);
@ -3277,7 +3293,7 @@ evas_render_updates_internal(Evas *eo_e,
RD(0, "[--- RENDER EVAS (size: %ix%i): %p (eo %p)\n", e->viewport.w, e->viewport.h, e, eo_e);
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_PRE, NULL);
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_PRE, NULL);
/* Check if the modified object mean recalculating every thing */
if (!e->invalidate)
@ -3596,7 +3612,7 @@ evas_render_updates_internal(Evas *eo_e,
efl_ref(eo_e);
_rendering_evases = eina_list_prepend(_rendering_evases, e);
e->rendering = _rendering_evases;
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
evas_thread_queue_flush((Evas_Thread_Command_Cb)evas_render_pipe_wakeup, e);
eina_evlog("-render_output_async_flush", eo_e, 0.0, NULL);
}
@ -3607,11 +3623,11 @@ evas_render_updates_internal(Evas *eo_e,
{
_evas_object_image_video_overlay_do(eo_obj);
}
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_FLUSH_PRE, NULL);
EINA_LIST_FOREACH(e->outputs, l, out)
if (out->output)
ENFN->output_flush(ENC, out->output, EVAS_RENDER_MODE_SYNC);
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
_deferred_callbacks_process(eo_e, evas);
eina_evlog("-render_output_flush", eo_e, 0.0, NULL);
}
@ -3766,7 +3782,7 @@ evas_render_updates_internal(Evas *eo_e,
}
eina_spinlock_take(&(e->render.lock));
e->inside_post_render = EINA_TRUE;
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_POST, &post);
_cb_always_call(eo_e, e, EVAS_CALLBACK_RENDER_POST, &post);
e->inside_post_render = EINA_FALSE;
eina_spinlock_release(&(e->render.lock));
if (post.updated_area) eina_list_free(post.updated_area);
@ -3835,7 +3851,7 @@ evas_render_wakeup(Evas *eo_e)
{
_evas_object_image_video_overlay_do(eo_obj);
}
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
_cb_always_call(eo_e, evas, EVAS_CALLBACK_RENDER_FLUSH_POST, NULL);
}
/* clear redraws */
@ -3878,7 +3894,7 @@ evas_render_wakeup(Evas *eo_e)
evas->rendering = NULL;
post.updated_area = ret_updates;
_cb_always_call(eo_e, EVAS_CALLBACK_RENDER_POST, &post);
_cb_always_call(eo_e, evas, EVAS_CALLBACK_RENDER_POST, &post);
evas->inside_post_render = EINA_FALSE;
_deferred_callbacks_process(eo_e, evas);

View File

@ -912,6 +912,11 @@ struct _Evas_Public_Data
Eina_Bool is_frozen : 1;
Eina_Bool inside_post_render : 1;
Eina_Bool devices_modified : 1;
Eina_Bool cb_render_pre : 1;
Eina_Bool cb_render_post : 1;
Eina_Bool cb_render_flush_pre : 1;
Eina_Bool cb_render_flush_post : 1;
};
struct _Evas_Layer

View File

@ -1438,7 +1438,12 @@ _ecore_evas_wl_common_free(Ecore_Evas *ee)
if (wdata->frame) ecore_wl2_window_frame_callback_del(wdata->frame);
wdata->frame = NULL;
ecore_event_handler_del(wdata->sync_handler);
if (wdata->win) ecore_wl2_window_free(wdata->win);
if (wdata->win)
{
ecore_wl2_window_close_callback_set(wdata->win, NULL, NULL);
ecore_wl2_window_free(wdata->win);
wdata->win = NULL;
}
ecore_wl2_display_disconnect(wdata->display);
EINA_LIST_FREE(wdata->devices_list, device)
@ -2466,6 +2471,17 @@ static Ecore_Evas_Engine_Func _ecore_wl_engine_func =
NULL, //fn_last_tick_get
};
static void
_ecore_evas_wl_common_win_close(void *data, Ecore_Wl2_Window *win EINA_UNUSED)
{
Ecore_Evas *ee = data;
Ecore_Evas_Engine_Wl_Data *wdata = ee->engine.data;
if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee);
wdata->win = NULL;
}
Ecore_Evas *
_ecore_evas_wl_common_new_internal(const char *disp_name, Ecore_Window parent, int x, int y, int w, int h, Eina_Bool frame, const int *opt, const char *engine_name)
{
@ -2553,6 +2569,7 @@ _ecore_evas_wl_common_new_internal(const char *disp_name, Ecore_Window parent, i
wdata->display = ewd;
wdata->win = ecore_wl2_window_new(ewd, p, x, y, w, h);
ecore_wl2_window_close_callback_set(wdata->win, _ecore_evas_wl_common_win_close, ee);
ee->prop.window = (Ecore_Window)wdata->win;
ee->prop.aux_hint.supported_list = ecore_wl2_window_aux_hints_supported_get(wdata->win);
ecore_evas_aux_hint_add(ee, "wm.policy.win.msg.use", "1");

View File

@ -323,7 +323,7 @@ class TestEinaSlice
var binbuf = new Eina.Binbuf(base_seq);
Test.Assert(binbuf.Handle != IntPtr.Zero);
Eina.Slice slc = Eina.Binbuf.eina_binbuf_slice_get(binbuf.Handle);
Eina.Slice slc = binbuf.GetSlice();
Test.Assert(slc.GetBytes().SequenceEqual(base_seq));
Test.Assert(base_seq.Length == (int)(slc.Len));

View File

@ -16,31 +16,6 @@ public static class EldbusTestUtil
public const string DBusPath = "/org/freedesktop/DBus";
[return: MarshalAs(UnmanagedType.U1)] public delegate bool Ecore_Task_Cb(IntPtr data);
public static Ecore_Task_Cb GetEcoreLoopClose()
{
if (_ecore_loop_close == null)
_ecore_loop_close = new Ecore_Task_Cb(_ecore_loop_close_impl);
return _ecore_loop_close;
}
[DllImport(efl.Libs.Ecore)] public static extern IntPtr
ecore_timer_add(double _in, Ecore_Task_Cb func, IntPtr data);
[DllImport(efl.Libs.Ecore)] public static extern IntPtr
ecore_timer_del(IntPtr timer);
[DllImport(efl.Libs.Ecore)] public static extern void
ecore_main_loop_begin();
[DllImport(efl.Libs.Ecore)] public static extern void
ecore_main_loop_quit();
static private bool _ecore_loop_close_impl(IntPtr data)
{
ecore_main_loop_quit();
return false;
}
static private Ecore_Task_Cb _ecore_loop_close = null;
}
namespace TestSuite
@ -84,6 +59,7 @@ class TestEldbusObject
{
public static void utc_eldbus_object_send_info_get_p()
{
var app = Efl.App.AppMain;
var conn = new eldbus.Connection(eldbus.Connection.Type.Session);
var obj = new eldbus.Object(conn, DBusBus, DBusPath);
@ -105,7 +81,6 @@ class TestEldbusObject
connectionFromObj.Dispose();
}
IntPtr timeout = IntPtr.Zero;
int messageCapture = 0;
bool isSuccess = false;
@ -113,12 +88,6 @@ class TestEldbusObject
{
try
{
if (timeout != IntPtr.Zero)
{
ecore_timer_del(timeout);
timeout = IntPtr.Zero;
}
string errname;
string errmsg;
@ -137,7 +106,7 @@ class TestEldbusObject
}
finally
{
ecore_main_loop_quit();
app.Quit(0);
}
};
@ -148,15 +117,18 @@ class TestEldbusObject
AssertEquals(pending.GetMethod(), methodName);
timeout = ecore_timer_add(2.0, GetEcoreLoopClose(), IntPtr.Zero);
Assert(timeout != IntPtr.Zero);
var timer = new Efl.LoopTimer(app, 2.0);
timer.TimerTickEvent += (object sender, EventArgs e) => {
app.Quit(0);
};
messageCapture = 5;
ecore_main_loop_begin();
app.Begin();
Assert(isSuccess, $"Method {methodName} is not call");
timer.Dispose();
message.Dispose();
obj.Dispose();
conn.Dispose();
@ -164,11 +136,11 @@ class TestEldbusObject
public static void utc_eldbus_introspect_p()
{
var app = Efl.App.AppMain;
var conn = new eldbus.Connection(eldbus.Connection.Type.Session);
var obj = new eldbus.Object(conn, DBusBus, DBusPath);
IntPtr timeout = IntPtr.Zero;
int messageCapture = 0;
bool isSuccess = false;
@ -176,12 +148,6 @@ class TestEldbusObject
{
try
{
if (timeout != IntPtr.Zero)
{
ecore_timer_del(timeout);
timeout = IntPtr.Zero;
}
string errname;
string errmsg;
@ -200,7 +166,7 @@ class TestEldbusObject
}
finally
{
ecore_main_loop_quit();
app.Quit(0);
}
};
@ -208,15 +174,18 @@ class TestEldbusObject
AssertEquals(pending.GetMethod(), "Introspect");
timeout = ecore_timer_add(2.0, GetEcoreLoopClose(), IntPtr.Zero);
Assert(timeout != IntPtr.Zero);
var timer = new Efl.LoopTimer(app, 2.0);
timer.TimerTickEvent += (object sender, EventArgs e) => {
app.Quit(0);
};
messageCapture = 5;
ecore_main_loop_begin();
app.Begin();
Assert(isSuccess, "Method Introspect is not call");
timer.Dispose();
obj.Dispose();
conn.Dispose();
}
@ -224,7 +193,6 @@ class TestEldbusObject
class TestEldbusMessage
{
private static IntPtr timeout = IntPtr.Zero;
private static bool isSuccess = false;
@ -232,19 +200,23 @@ class TestEldbusMessage
{
isSuccess = false;
var app = Efl.App.AppMain;
var conn = new eldbus.Connection(eldbus.Connection.Type.Session);
eldbus.Pending pending = conn.ActivatableList(messageCb);
AssertEquals(pending.GetMethod(), "ListActivatableNames");
timeout = ecore_timer_add(2.0, GetEcoreLoopClose(), IntPtr.Zero);
Assert(timeout != IntPtr.Zero);
var timer = new Efl.LoopTimer(app, 2.0);
timer.TimerTickEvent += (object sender, EventArgs e) => {
app.Quit(0);
};
ecore_main_loop_begin();
app.Begin();
Assert(isSuccess, "Method ListActivatableNames is not call");
timer.Dispose();
conn.Dispose();
}
@ -254,12 +226,6 @@ class TestEldbusMessage
{
try
{
if (timeout != IntPtr.Zero)
{
ecore_timer_del(timeout);
timeout = IntPtr.Zero;
}
string errname, errmsg;
if (msg.GetError(out errname, out errmsg))
{
@ -293,7 +259,7 @@ class TestEldbusMessage
}
finally
{
ecore_main_loop_quit();
Efl.App.AppMain.Quit(0);
}
};
@ -304,6 +270,7 @@ class TestEldbusMessage
{
isSuccess = false;
var app = Efl.App.AppMain;
var conn = new eldbus.Connection(eldbus.Connection.Type.Session);
string methodName = "GetId";
@ -322,12 +289,6 @@ class TestEldbusMessage
{
try
{
if (timeout != IntPtr.Zero)
{
ecore_timer_del(timeout);
timeout = IntPtr.Zero;
}
string errname, errmsg;
if (!m.GetError(out errname, out errmsg))
{
@ -347,7 +308,7 @@ class TestEldbusMessage
}
finally
{
ecore_main_loop_quit();
app.Quit(0);
}
};
@ -356,13 +317,16 @@ class TestEldbusMessage
AssertEquals(pending.GetMethod(), methodName);
timeout = ecore_timer_add(2.0, GetEcoreLoopClose(), IntPtr.Zero);
Assert(timeout != IntPtr.Zero);
var timer = new Efl.LoopTimer(app, 2.0);
timer.TimerTickEvent += (object sender, EventArgs e) => {
app.Quit(0);
};
ecore_main_loop_begin();
app.Begin();
Assert(isSuccess, $"Method {methodName} is not call");
timer.Dispose();
msg.Dispose();
conn.Dispose();
}
@ -392,12 +356,6 @@ class TestEldbusMessage
{
try
{
if (timeout != IntPtr.Zero)
{
ecore_timer_del(timeout);
timeout = IntPtr.Zero;
}
string errname, errmsg;
if (msg.GetError(out errname, out errmsg))
{
@ -431,7 +389,7 @@ class TestEldbusMessage
}
finally
{
ecore_main_loop_quit();
Efl.App.AppMain.Quit(0);
}
};
ActivatableList(activatableListResponseCb);

View File

@ -99,9 +99,6 @@ class TestInheritance
parentWRef = new WeakReference(parent);
childWRef = new WeakReference(child);
Console.WriteLine($"Parent [{parent.ToString()}] has {Efl.Eo.Globals.efl_ref_count(parent.NativeHandle)} refs");
Console.WriteLine($"Child [{child.ToString()}] has {Efl.Eo.Globals.efl_ref_count(child.NativeHandle)} refs");
child = null;
System.GC.Collect(System.GC.MaxGeneration, GCCollectionMode.Forced, true, true);
@ -115,9 +112,6 @@ class TestInheritance
Test.AssertEquals(false, parent.disposed);
Test.AssertEquals(false, parent.childDisposed);
Console.WriteLine($"Parent [{parent.ToString()}] has {Efl.Eo.Globals.efl_ref_count(parent.NativeHandle)} refs");
Console.WriteLine($"Child [{child.ToString()}] has {Efl.Eo.Globals.efl_ref_count(child.NativeHandle)} refs");
parent = null;
child = null;
}

View File

@ -145,8 +145,33 @@ EFL_START_TEST(evas_event_callbacks_priority)
}
EFL_END_TEST
static void
_smart_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
int *called = data;
(*called)++;
}
EFL_START_TEST(evas_event_callbacks_smart)
{
int called = 0;
Eo *box;
START_CALLBACK_TEST();
box = evas_object_box_add(evas);
evas_object_smart_callback_add(box, "move", _smart_cb, &called);
evas_object_smart_callback_add(box, "resize", _smart_cb, &called);
evas_object_smart_callback_add(box, "restack", _smart_cb, &called);
evas_object_geometry_set(box, 1, 1, 10, 10);
evas_object_layer_set(box, 10);
ck_assert_int_eq(called, 3);
END_CALLBACK_TEST();
}
EFL_END_TEST
void evas_test_callbacks(TCase *tc)
{
tcase_add_test(tc, evas_object_event_callbacks_priority);
tcase_add_test(tc, evas_event_callbacks_priority);
tcase_add_test(tc, evas_event_callbacks_smart);
}