Merge branch 'master' into devs/hermet/lottie

This commit is contained in:
Hermet Park 2019-04-24 11:30:54 +09:00
commit f954a2315e
87 changed files with 1613 additions and 1294 deletions

View File

@ -12,15 +12,13 @@
{{/inheritance}}
<div class="level{{level}}"><span class="xref"><b>{{fullName.0.value}}</b></span></div>
{{#derivedClasses}}
<div class="level{{index}}">{{{specName.0.value}}}</div>
<div class="level{{index}}"><xref uid="{{uid}}" text="{{fullName.0.value}}"/></div>
{{/derivedClasses}}
</div>
</div>
{{/inClass}}
{{#inheritedMembers.0}}
<h6><strong>{{__global.namespace}}</strong>: {{{namespace.specName.0.value}}}</h6>
<h6><strong>{{__global.assembly}}</strong>: {{assemblies.0}}.dll</h6>
<h5 id="{{id}}_syntax">{{__global.syntax}}</h5>
<div class="codewrapper">
<pre><code class="lang-{{_lang}} hljs">{{syntax.content.0.value}}</code></pre>

View File

@ -0,0 +1,43 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
{{#isNamespace}}
Namespace {{fullName.0.value}}
{{/isNamespace}}
{{#inClass}}
Class {{fullName.0.value}}
{{/inClass}}
{{#inStruct}}
Struct {{fullName.0.value}}
{{/inStruct}}
{{#inInterface}}
Interface {{fullName.0.value}}
{{/inInterface}}
{{#inEnum}}
Enum {{fullName.0.value}}
{{/inEnum}}
{{#inDelegate}}
Delegate {{fullName.0.value}}
{{/inDelegate}}
{{#inConstructor}}
Constructor {{fullName.0.value}}
{{/inConstructor}}
{{#inField}}
Field {{fullName.0.value}}
{{/inField}}
{{#inProperty}}
Property {{fullName.0.value}}
{{/inProperty}}
{{#inMethod}}
Method {{fullName.0.value}}
{{/inMethod}}
{{#inEvent}}
Event {{fullName.0.value}}
{{/inEvent}}
{{#inOperator}}
Operator {{fullName.0.value}}
{{/inOperator}}
{{#inEii}}
Explict Interface Implementation {{fullName.0.value}}
{{/inEii}}
{{#inPackage}}
Package {{fullName.0.value}}
{{/inPackage}}

View File

@ -1,6 +1,6 @@
apiRules:
- exclude:
uidRegex: ^.*NativeInherit$
uidRegex: ^.*NativeMethods$
- exclude:
uidRegex: ^.*NativeStruct$
- include:

View File

@ -22,5 +22,19 @@ for f in `ls api/*.yml`; do
sed -e 's/\(<xref href=\\"[^\\]*\)\\"/\1?displayProperty=fullName\\"/g' -i $f
done;
# Add missing references to derived classes, so they can be rendered with
# their full name.
# https://github.com/dotnet/docfx/issues/3769#issuecomment-485616064
for f in `grep -l derivedClasses api/*.yml`; do
sed "1,/^ derivedClasses:$/d" $f > /tmp/efl_docfx_gendoc
sed -i "/^ [^-]/,$ d" /tmp/efl_docfx_gendoc
sed -i "/^[^ ]/,$ d" /tmp/efl_docfx_gendoc
while read dash class
do
sed -i "s/^references:$/references:\n- uid: $class\n fullName: $class/g" $f
done <<< "$(cat /tmp/efl_docfx_gendoc)"
done;
rm -rf /tmp/efl_docfx_gendoc
# DocFX Step 2: Generate HTML files
mono bin/docfx.exe build docfx.json && echo "Docs ready in the _site folder!"

View File

@ -248,6 +248,27 @@ boot_strap_eolian = [
['eolian' ,[] , false, true, true, false, false, false, ['eina'], []],
]
evas_lib = ['evas' ,[], false, true, false, false, true, true, ['eina', 'efl', 'eo'], ['vg_common', 'libunibreak']]
evas_img_modules = ['evas' ,[], true, false, false, false, false, false, ['eina', 'efl', 'eo'], ['vg_common', 'libunibreak']]
evas_engines = [join_paths('evas', 'engines'),[], true, false, false, false, false, false, [], []]
evas_goal = ['evas_goal' ,[], false, true, false, false, false, false, ['eina', 'efl', 'eo'], []]
if get_option('evas-modules') == 'static'
evas_settings = [
evas_lib,
evas_img_modules,
evas_engines,
evas_goal,
]
else
evas_settings = [
evas_lib,
evas_img_modules,
evas_goal,
evas_engines,
]
endif
subprojects = [
# name | option | mod | lib | bin | bench | tests | examples | pkg-config options | name of static libs
['evil' ,[] , false, true, false, false, false, false, [], []],
@ -275,9 +296,7 @@ subprojects = [
['ector' ,[] , false, true, false, false, true, false, ['eina', 'efl'], ['draw', 'triangulator', 'freetype']],
['elput' ,['drm'] , false, true, false, false, true, false, ['eina', 'eldbus'], []],
['ecore_drm2' ,['drm'] , false, true, false, false, false, false, ['ecore'], ['libdrm']],
['ecore_cocoa' ,['cocoa'] , false, true, false, false, false, false, ['eina'], []],
['evas' ,[] , true, true, false, false, true, true, ['eina', 'efl', 'eo'], ['vg_common', 'libunibreak']],
['evas_goal' ,[] , false, true, false, false, false, false, ['eina', 'efl', 'eo'], []],
['ecore_cocoa' ,['cocoa'] , false, true, false, false, false, false, ['eina'], []]] + evas_settings +[
['ecore_input_evas' ,[] , false, true, false, false, false, false, ['eina', 'evas'], []],
['ecore_evas' ,[] , true, true, true, false, false, false, ['evas', 'ector'], []],
['ecore_imf' ,[] , true, true, false, false, false, false, ['eina'], []],
@ -323,7 +342,7 @@ foreach package : subprojects
]
automatic_pkgfile = true
if package[1].length() == 0 or get_option(package[1][0])
config_h.set('HAVE_'+package_name.to_upper(), '1')
config_h.set('HAVE_'+package_name.to_upper().underscorify(), '1')
dir_package_include = join_paths(dir_include, package_version_name)
dir_package_modules = join_paths(dir_lib, package_name, 'modules')
@ -376,7 +395,7 @@ foreach package : subprojects
example_dirs += [package_name]
endif
set_variable('build_'+package_name, true)
set_variable('build_'+package_name.underscorify(), true)
# generate automatic pc files for libraries
if automatic_pkgfile == true and package[3]

View File

@ -4,4 +4,4 @@
# as meson's library() call can't track files other than the generated
# efl_mono.dll
cp $1 $2
cp "$1" "$DESTDIR$2"

View File

@ -588,6 +588,7 @@ lib/evas/common/evas_map_image_internal.c \
lib/evas/common/evas_map_image_core.c \
lib/evas/common/evas_map_image_loop.c \
lib/evas/common/evas_map_image_aa.c \
lib/evas/common/evas_map_image_internal_high.c \
lib/evas/common/evas_scale_smooth_scaler.c \
lib/evas/common/evas_scale_smooth_scaler_down.c \
lib/evas/common/evas_scale_smooth_scaler_downx.c \
@ -2237,6 +2238,7 @@ modules_evas_image_loaders_tgv_module_la_CPPFLAGS = \
-I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/static_libs/rg_etc \
-I$(top_srcdir)/src/lib/evas/ \
-I$(top_srcdir)/src/lib/evas/include \
-DEFL_BUILD \
@EVAS_CFLAGS@ \
@NEON_CFLAGS@
@ -2274,6 +2276,7 @@ modules_evas_image_savers_tgv_module_la_CPPFLAGS = \
-I$(top_builddir)/src/lib/efl \
-I$(top_srcdir)/src/static_libs/rg_etc \
-I$(top_srcdir)/src/lib/evas/ \
-I$(top_srcdir)/src/lib/evas/include \
-DEFL_BUILD \
@EVAS_CFLAGS@

View File

@ -35,17 +35,18 @@ struct alias_definition_generator
std::string const alias_name = utils::remove_all(alias.eolian_name, '_');
if (!as_generator(
"public struct " << alias_name << " {\n"
"public struct " << alias_name << "\n"
<< "{\n"
<< scope_tab << "private " << type << " payload;\n"
<< scope_tab << "public static implicit operator " << alias_name << "(" << type << " x)\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "return new " << alias_name << "{payload=x};\n"
<< scope_tab << "}\n"
<< scope_tab << "}\n\n"
<< scope_tab << "public static implicit operator " << type << "(" << alias_name << " x)\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "return x.payload;\n"
<< scope_tab << "}\n"
<< "}\n"
<< scope_tab << "}\n\n"
<< "}\n\n"
).generate(sink, std::make_tuple(alias.base_type, alias.base_type, alias.base_type), context))
return false;

View File

@ -55,7 +55,7 @@ struct async_function_declaration_generator
if (!as_generator(
scope_tab << "System.Threading.Tasks.Task<Eina.Value> " << name_helpers::managed_async_method_name(f) << "(" << *(parameter << ",") <<
" System.Threading.CancellationToken token=default(System.Threading.CancellationToken));\n"
" System.Threading.CancellationToken token = default(System.Threading.CancellationToken));\n"
).generate(sink, f.parameters, context))
return false;
@ -89,7 +89,7 @@ struct async_function_definition_generator
std::transform(f.parameters.begin(), f.parameters.end(), std::back_inserter(param_forwarding), parameter_forwarding);
if(!as_generator(
scope_tab << "public System.Threading.Tasks.Task<Eina.Value> " << name_helpers::managed_async_method_name(f) << "(" << *(parameter << ",") << " System.Threading.CancellationToken token=default(System.Threading.CancellationToken))\n"
scope_tab << "public System.Threading.Tasks.Task<Eina.Value> " << name_helpers::managed_async_method_name(f) << "(" << *(parameter << ",") << " System.Threading.CancellationToken token = default(System.Threading.CancellationToken))\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "Eina.Future future = " << name_helpers::managed_method_name(f) << "(" << (string % ",") << ");\n"
<< scope_tab << scope_tab << "return Efl.Eo.Globals.WrapAsync(future, token);\n"

View File

@ -74,8 +74,7 @@ struct documentation_generator
if (blacklist::is_function_blacklisted(
::eolian_function_full_c_name_get(function, ftype))) return "";
name += ".";
name += name_helpers::managed_method_name(
::eolian_object_short_name_get(klass), eo_name);
name += name_helpers::managed_method_name({function, ftype, NULL, eolian_object_unit_get(EOLIAN_OBJECT(function))});
break;
case ::EOLIAN_PROP_SET:
name += ".Set";
@ -118,7 +117,7 @@ struct documentation_generator
case attributes::function_type::prop_get:
if (blacklist::is_function_blacklisted(func.c_name))return "";
if (!name.empty()) name += ".";
name += name_helpers::managed_method_name(func.klass.eolian_name, func.name);
name += name_helpers::managed_method_name(func);
break;
default:
// No need to deal with property as function_defs are converted to get/set when building a given klass_def.
@ -285,6 +284,9 @@ struct documentation_generator
template<typename OutputIterator, typename Context>
bool generate_tag(OutputIterator sink, std::string const& tag, std::string const &text, Context const& context, std::string tag_params = "") const
{
if (text == "")
return true;
if (!as_generator(scope_tab(scope_size) << "/// ").generate(sink, attributes::unused, context)) return false;
if (!generate_opening_tag(sink, tag, context, tag_params)) return false;
if (!generate_escaped_content(sink, text, context)) return false;
@ -429,7 +431,7 @@ struct documentation_generator
return generate_all_tag_examples(sink,
name_helpers::klass_full_concrete_or_interface_name(func.klass),
name_helpers::managed_method_name(func.klass.eolian_name, func.name),
name_helpers::managed_method_name(func),
context);
}
@ -448,7 +450,7 @@ struct documentation_generator
return generate_all_tag_examples(sink,
name_helpers::klass_full_concrete_or_interface_name(func.klass),
name_helpers::managed_method_name(func.klass.eolian_name, func.name),
name_helpers::managed_method_name(func),
context);
}
@ -485,7 +487,7 @@ struct documentation_generator
for (auto &&param : ctor.function.parameters)
{
if (!as_generator(
scope_tab << "///<param name=\"" << constructor_parameter_name(ctor) << "\">" << summary << " See <see cref=\"" << function_conversion(func) << "\"/></param>\n"
scope_tab << "/// <param name=\"" << constructor_parameter_name(ctor) << "\">" << summary << " See <see cref=\"" << function_conversion(func) << "\"/></param>\n"
).generate(sink, param, context))
return false;
}

View File

@ -44,7 +44,7 @@ struct enum_definition_generator
return false;
}
if(!as_generator("}\n").generate(sink, attributes::unused, context)) return false;
if(!as_generator("}\n\n").generate(sink, attributes::unused, context)) return false;
if(!name_helpers::close_namespaces(sink, enum_.namespaces, context))
return false;

View File

@ -34,12 +34,14 @@ struct native_function_definition_generator
EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "native_function_definition_generator: " << f.c_name << std::endl;
if(blacklist::is_function_blacklisted(f, context))
return true;
else
{
auto const& indent = current_indentation(context);
// Delegate for the C# method we will export to EO as a method implementation.
if(!as_generator
("\n\n" << scope_tab
<< eolian_mono::marshall_annotation(true)
<< " private delegate "
(
indent << eolian_mono::marshall_annotation(true) << "\n"
<< indent << "private delegate "
<< eolian_mono::marshall_type(true)
<< " "
<< string
@ -49,14 +51,15 @@ struct native_function_definition_generator
(
(marshall_annotation << " " << marshall_parameter)
) % ", ")
<< ");\n")
<< ");\n\n")
.generate(sink, std::make_tuple(f.return_type, f.return_type, f.c_name, f.parameters), context))
return false;
// API delegate is the wrapper for the Eo methods exported from C that we will use from C#.
if(!as_generator
("\n\n" << scope_tab
<< eolian_mono::marshall_annotation(true)
<< " public delegate "
(
indent << eolian_mono::marshall_annotation(true) << "\n"
<< indent << "public delegate "
<< eolian_mono::marshall_type(true)
<< " "
<< string << "_api_delegate(" << (f.is_static ? "" : "System.IntPtr obj")
@ -65,17 +68,18 @@ struct native_function_definition_generator
(
(marshall_annotation << " " << marshall_parameter)
) % ", ")
<< ");\n")
<< ");\n\n")
.generate(sink, std::make_tuple(f.return_type, f.return_type, f.c_name, f.parameters), context))
return false;
// Delegate holder (so it can't be collected).
if(!as_generator
(scope_tab
<< " public static Efl.Eo.FunctionWrapper<" << string << "_api_delegate> " << string << "_ptr = new Efl.Eo.FunctionWrapper<"
<< string << "_api_delegate>(_Module, \"" << string << "\");\n")
(indent << "public static Efl.Eo.FunctionWrapper<" << string << "_api_delegate> " << string << "_ptr = new Efl.Eo.FunctionWrapper<"
<< string << "_api_delegate>(Module, \"" << string << "\");\n\n")
.generate(sink, std::make_tuple(f.c_name, f.c_name, f.c_name, f.c_name), context))
return false;
// Actual method implementation to be called from C.
std::string return_type;
if(!as_generator(eolian_mono::type(true)).generate(std::back_inserter(return_type), f.return_type, context))
return false;
@ -92,34 +96,37 @@ struct native_function_definition_generator
self = "";
if(!as_generator
(scope_tab
<< " private static "
(indent << "private static "
<< eolian_mono::marshall_type(true) << " "
<< string
<< "(System.IntPtr obj, System.IntPtr pd"
<< *(", " << marshall_parameter)
<< ")\n"
<< scope_tab << "{\n"
/****/
<< scope_tab << scope_tab << "Eina.Log.Debug(\"function " << string << " was called\");\n"
/****/
<< scope_tab << scope_tab << "Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);\n"
<< scope_tab << scope_tab << "if(wrapper != null) {\n"
<< scope_tab << scope_tab << scope_tab << eolian_mono::native_function_definition_preamble()
<< scope_tab << scope_tab << scope_tab << "try {\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << (return_type != "void" ? "_ret_var = " : "")
<< indent << "{\n"
<< indent << scope_tab << "Eina.Log.Debug(\"function " << string << " was called\");\n"
<< indent << scope_tab << "Efl.Eo.IWrapper wrapper = Efl.Eo.Globals.PrivateDataGet(pd);\n"
<< indent << scope_tab << "if (wrapper != null)\n"
<< indent << scope_tab << "{\n"
<< eolian_mono::native_function_definition_preamble()
<< indent << scope_tab << scope_tab << "try\n"
<< indent << scope_tab << scope_tab << "{\n"
<< indent << scope_tab << scope_tab << scope_tab << (return_type != "void" ? "_ret_var = " : "")
<< (f.is_static ? "" : "((") << klass_cast_name << (f.is_static ? "." : ")wrapper).") << string
<< "(" << (native_argument_invocation % ", ") << ");\n"
<< scope_tab << scope_tab << scope_tab << "} catch (Exception e) {\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "Eina.Log.Warning($\"Callback error: {e.ToString()}\");\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);\n"
<< scope_tab << scope_tab << scope_tab << "}\n"
<< eolian_mono::native_function_definition_epilogue(*klass)
<< scope_tab << scope_tab << "} else {\n"
<< scope_tab << scope_tab << scope_tab << (return_type != "void" ? "return " : "") << string
<< indent << scope_tab << scope_tab << "}\n"
<< indent << scope_tab << scope_tab << "catch (Exception e)\n"
<< indent << scope_tab << scope_tab << "{\n"
<< indent << scope_tab << scope_tab << scope_tab << "Eina.Log.Warning($\"Callback error: {e.ToString()}\");\n"
<< indent << scope_tab << scope_tab << scope_tab << "Eina.Error.Set(Eina.Error.UNHANDLED_EXCEPTION);\n"
<< indent << scope_tab << scope_tab << "}\n\n"
<< eolian_mono::native_function_definition_epilogue(*klass) << "\n"
<< indent << scope_tab << "}\n"
<< indent << scope_tab << "else\n"
<< indent << scope_tab << "{\n"
<< indent << scope_tab << scope_tab << (return_type != "void" ? "return " : "") << string
<< "_ptr.Value.Delegate(" << self << ((!f.is_static && f.parameters.size() > 0) ? ", " : "") << (argument % ", ") << ");\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << "}\n"
<< indent << scope_tab << "}\n"
<< indent << "}\n\n"
)
.generate(sink, std::make_tuple(f.return_type, escape_keyword(f.name), f.parameters
, /***/f.c_name/***/
@ -139,11 +146,11 @@ struct native_function_definition_generator
// This is the delegate that will be passed to Eo to be called from C.
if(!as_generator(
scope_tab << "private static " << f.c_name << "_delegate " << f.c_name << "_static_delegate;\n"
indent << "private static " << f.c_name << "_delegate " << f.c_name << "_static_delegate;\n\n"
).generate(sink, attributes::unused, context))
return false;
return true;
}
}
};

View File

@ -30,35 +30,34 @@ struct function_registration_generator
bool generate(OutputIterator sink, attributes::function_def const& f, Context const& context) const
{
EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "function_registration_generator: " << f.name << std::endl;
auto const& indent = current_indentation(context);
if(blacklist::is_function_blacklisted(f, context) || f.is_static) // Static methods aren't overrideable
return true;
else
{
// auto index = index_generator();
if(!as_generator(
scope_tab << scope_tab << "if (" << f.c_name << "_static_delegate == null)\n"
<< scope_tab << scope_tab << scope_tab << f.c_name << "_static_delegate = new " << f.c_name << "_delegate(" <<
escape_keyword(f.name) << ");\n"
indent << "if (" << f.c_name << "_static_delegate == null)\n"
<< indent << "{\n"
<< indent << scope_tab << f.c_name << "_static_delegate = new " << f.c_name << "_delegate(" << escape_keyword(f.name) << ");\n"
<< indent << "}\n\n"
).generate(sink, attributes::unused, context))
return false;
if(!as_generator
(scope_tab << scope_tab
<< "if (methods.FirstOrDefault(m => m.Name == \"" << string << "\") != null)\n"
<< scope_tab << scope_tab << scope_tab
<< "descs.Add(new Efl_Op_Description() {"
if(!as_generator(
indent << "if (methods.FirstOrDefault(m => m.Name == \"" << string << "\") != null)\n"
<< indent << "{\n"
<< indent << scope_tab << "descs.Add(new Efl_Op_Description() {"
#ifdef _WIN32
<< "api_func = Marshal.StringToHGlobalAnsi(\"" << string << "\")"
#else
<< "api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, \"" << string << "\")"
<< "api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, \"" << string << "\")"
#endif
<< ", func = Marshal.GetFunctionPointerForDelegate(" << string << "_static_delegate)});\n"
<< ", func = Marshal.GetFunctionPointerForDelegate(" << string << "_static_delegate) });\n"
<< indent << "}\n\n"
)
.generate(sink, std::make_tuple(name_helpers::managed_method_name(f), f.c_name, f.c_name), context))
return false;
return true;
}
}
};

View File

@ -35,24 +35,30 @@ template <typename OutputIterator, typename Context>
static bool generate_equals_method(OutputIterator sink, Context const &context)
{
return as_generator(
scope_tab << "///<summary>Verifies if the given object is equal to this one.</summary>\n"
<< scope_tab << "public override bool Equals(object obj)\n"
scope_tab << "/// <summary>Verifies if the given object is equal to this one.</summary>\n"
<< scope_tab << "/// <param name=\"instance\">The object to compare to.</param>\n"
<< scope_tab << "/// <returns>True if both objects point to the same native object.</returns>\n"
<< scope_tab << "public override bool Equals(object instance)\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "var other = obj as Efl.Object;\n"
<< scope_tab << scope_tab << "var other = instance as Efl.Object;\n"
<< scope_tab << scope_tab << "if (other == null)\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << "return false;\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << scope_tab << "return this.NativeHandle == other.NativeHandle;\n"
<< scope_tab << "}\n"
<< scope_tab << "///<summary>Gets the hash code for this object based on the native pointer it points to.</summary>\n"
<< scope_tab << "}\n\n"
<< scope_tab << "/// <summary>Gets the hash code for this object based on the native pointer it points to.</summary>\n"
<< scope_tab << "/// <returns>The value of the pointer, to be used as the hash code of this object.</returns>\n"
<< scope_tab << "public override int GetHashCode()\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "return this.NativeHandle.ToInt32();\n"
<< scope_tab << "}\n"
<< scope_tab << "///<summary>Turns the native pointer into a string representation.</summary>\n"
<< scope_tab << "}\n\n"
<< scope_tab << "/// <summary>Turns the native pointer into a string representation.</summary>\n"
<< scope_tab << "/// <returns>A string with the type and the native pointer for this object.</returns>\n"
<< scope_tab << "public override String ToString()\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "return $\"{this.GetType().Name}@[{this.NativeHandle.ToInt32():x}]\";\n"
<< scope_tab << "}\n"
<< scope_tab << "}\n\n"
).generate(sink, nullptr, context);
}
@ -82,6 +88,8 @@ struct klass
{
EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "klass_generator: " << cls.eolian_name << std::endl;
auto const& indent = current_indentation(context);
if (blacklist::is_class_blacklisted(cls, context))
{
EINA_CXX_DOM_LOG_DBG(eolian_mono::domain) << "class " << cls.eolian_name << " is blacklisted. Skipping." << std::endl;
@ -125,7 +133,7 @@ struct klass
return false;
// Mark the interface with the proper native Efl_Class* getter
if(!as_generator(lit("[") << name_helpers::klass_native_inherit_name(cls) << "]\n")
if(!as_generator(lit("[") << name_helpers::klass_full_native_inherit_name(cls) << "]\n")
.generate(sink, attributes::unused, iface_cxt))
return false;
@ -203,10 +211,12 @@ struct klass
auto concrete_name = name_helpers::klass_concrete_name(cls);
auto interface_name = name_helpers::klass_interface_name(cls);
// We can't make these internal yet as they have methods that are used by
// other classes that implement the interface.
if(!as_generator
(
documentation
<< "sealed internal class " << concrete_name << " : " << "\n"
<< "sealed public class " << concrete_name << " : " << "\n"
<< (klass_full_concrete_or_interface_name % ",") << "\n"
<< (inherit_classes.size() > 0 ? ", " : "" ) << interface_name << "\n"
<< scope_tab << *(", " << name_helpers::klass_full_concrete_or_interface_name) << "\n"
@ -223,7 +233,8 @@ struct klass
scope_tab << "[System.Runtime.InteropServices.DllImport(" << context_find_tag<library_context>(concrete_cxt).actual_library_name(cls.filename)
<< ")] internal static extern System.IntPtr\n"
<< scope_tab << scope_tab << name_helpers::klass_get_name(cls) << "();\n"
<< scope_tab << "///<summary>Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>\n"
<< scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << interface_name << "\"/> class.\n"
<< scope_tab << "/// Internal usage: This is used when interacting with C code and should not be used directly.</summary>\n"
<< scope_tab << "private " << concrete_name << "(System.IntPtr raw)" << (root ? "" : " : base(raw)") << "\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << (root ? "handle = raw;\n" : "")
@ -274,6 +285,8 @@ struct klass
).generate(sink, attributes::unused, concrete_cxt))
return false;
if(!generate_native_inherit_class(sink, cls, change_indentation(indent.inc(), context)))
return true;
if(!as_generator("}\n").generate(sink, attributes::unused, concrete_cxt)) return false;
}
@ -289,7 +302,7 @@ struct klass
if(!as_generator
(
documentation
<< "[" << name_helpers::klass_native_inherit_name(cls) << "]\n"
<< "[" << name_helpers::klass_full_native_inherit_name(cls) << "]\n"
<< "public " << class_type << " " << name_helpers::klass_concrete_name(cls) << " : "
<< (klass_full_concrete_or_interface_name % ",") // classes
<< (inherit_classes.empty() ? "" : ",")
@ -351,11 +364,24 @@ struct klass
).generate(sink, attributes::unused, inherit_cxt))
return false;
if(!generate_native_inherit_class(sink, cls, change_indentation(indent.inc(), context)))
return true;
if(!as_generator("}\n").generate(sink, attributes::unused, inherit_cxt)) return false;
}
// Native Inherit class
//if(class_type == "class")
if(!name_helpers::close_namespaces(sink, cls.namespaces, context))
return false;
return true;
}
// NativeInherit class. Contains function pointers for the native Eo methods and delegates that are registered in Eo as virtual method implementations
// These delegates are called from C to C#, checking whether the C# subclass reimplemented it.
template <typename OutputIterator, typename Context>
bool generate_native_inherit_class(OutputIterator sink, attributes::klass_def const& cls, Context const& context) const
{
{
auto inative_cxt = context_add_tag(class_context{class_context::inherit_native,
name_helpers::klass_full_concrete_or_interface_name(cls)},
@ -363,6 +389,9 @@ struct klass
auto native_inherit_name = name_helpers::klass_native_inherit_name(cls);
auto inherit_name = name_helpers::klass_inherit_name(cls);
auto implementable_methods = helpers::get_all_implementable_methods(cls);
bool root = !helpers::has_regular_ancestor(cls);
auto const& indent = current_indentation(inative_cxt);
std::string base_name;
if(!root)
{
@ -372,12 +401,28 @@ struct klass
if(!as_generator
(
"public class " << native_inherit_name << " " << (root ? " : Efl.Eo.NativeClass" : (": " + base_name)) <<"{\n"
<< scope_tab << "public " << (root ? "" : "new ") << " static Efl.Eo.NativeModule _Module = new Efl.Eo.NativeModule("
<< context_find_tag<library_context>(context).actual_library_name(cls.filename) << ");\n"
<< scope_tab << "public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "var descs = new System.Collections.Generic.List<Efl_Op_Description>();\n"
indent << lit("/// <summary>Wrapper for native methods and virtual method delegates.\n")
<< indent << "/// For internal use by generated code only.</summary>\n"
<< indent << "public " << (root ? "" : "new " ) << "class " << native_inherit_name << " " << (root ? " : Efl.Eo.NativeClass" : (": " + base_name)) <<"\n"
<< indent << "{\n"
).generate(sink, attributes::unused, inative_cxt))
return false;
if(implementable_methods.size() >= 1)
{
if(!as_generator(
indent << scope_tab << "private static Efl.Eo.NativeModule Module = new Efl.Eo.NativeModule("
<< indent << context_find_tag<library_context>(context).actual_library_name(cls.filename) << ");\n"
).generate(sink, attributes::unused, inative_cxt))
return false;
}
if(!as_generator(
indent << scope_tab << "/// <summary>Gets the list of Eo operations to override.</summary>\n"
<< indent << scope_tab << "/// <returns>The list of Eo operations to be overload.</returns>\n"
<< indent << scope_tab << "public override System.Collections.Generic.List<Efl_Op_Description> GetEoOps(System.Type type)\n"
<< indent << scope_tab << "{\n"
<< indent << scope_tab << scope_tab << "var descs = new System.Collections.Generic.List<Efl_Op_Description>();\n"
)
.generate(sink, attributes::unused, inative_cxt))
return false;
@ -387,54 +432,46 @@ struct klass
// only non-registrable methods like class functions, leading to unused `methods` variable.
std::string tmp_registration;
if(!as_generator(*(function_registration(cls)))
.generate(std::back_inserter(tmp_registration), implementable_methods, inative_cxt))
.generate(std::back_inserter(tmp_registration), implementable_methods, change_indentation(indent.inc(2), inative_cxt)))
return false;
if (tmp_registration.find("methods") != std::string::npos)
if (!as_generator(
scope_tab << scope_tab << "var methods = Efl.Eo.Globals.GetUserMethods(type);\n"
indent << scope_tab << scope_tab << "var methods = Efl.Eo.Globals.GetUserMethods(type);\n\n"
<< tmp_registration
).generate(sink, attributes::unused, inative_cxt))
return false;
if(!root)
if(!as_generator(scope_tab << scope_tab << "descs.AddRange(base.GetEoOps(type));\n").generate(sink, attributes::unused, inative_cxt))
if(!as_generator(indent << scope_tab << scope_tab << "descs.AddRange(base.GetEoOps(type));\n").generate(sink, attributes::unused, inative_cxt))
return false;
if(!as_generator(
scope_tab << scope_tab << "return descs;\n"
<< scope_tab << "}\n"
indent << scope_tab << scope_tab << "return descs;\n"
<< indent << scope_tab << "}\n"
).generate(sink, attributes::unused, inative_cxt))
return false;
// Attribute getter of the native 'Efl_Class *' handle (for proper inheritance from additional explicit interfaces)
if(!as_generator(
scope_tab << "public override IntPtr GetEflClass()\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
<< scope_tab << "}\n"
).generate(sink, attributes::unused, inative_cxt))
return false;
if(!as_generator(
scope_tab << "public static " << (root ? "" : "new ") << " IntPtr GetEflClassStatic()\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
<< scope_tab << "}\n"
indent << scope_tab << "/// <summary>Returns the Eo class for the native methods of this class.</summary>\n"
<< indent << scope_tab << "/// <returns>The native class pointer.</returns>\n"
<< indent << scope_tab << "public override IntPtr GetEflClass()\n"
<< indent << scope_tab << "{\n"
<< indent << scope_tab << scope_tab << "return " << name_helpers::klass_get_full_name(cls) << "();\n"
<< indent << scope_tab << "}\n\n"
).generate(sink, attributes::unused, inative_cxt))
return false;
// Native method definitions
if(!as_generator(*(native_function_definition(cls)))
.generate(sink, implementable_methods, inative_cxt)) return false;
if(!as_generator(
indent << scope_tab << "#pragma warning disable CA1707, SA1300, SA1600\n\n"
<< *(native_function_definition(cls))
<< indent << scope_tab << "#pragma warning restore CA1707, SA1300, SA1600\n\n")
.generate(sink, implementable_methods, change_indentation(indent.inc(), inative_cxt))) return false;
if(!as_generator("}\n").generate(sink, attributes::unused, inative_cxt)) return false;
}
if(!name_helpers::close_namespaces(sink, cls.namespaces, context))
return false;
return true;
}
@ -457,14 +494,20 @@ struct klass
if(!as_generator(
scope_tab << "///<summary>Pointer to the native class description.</summary>\n"
<< scope_tab << "public " << raw_klass_modifier << "System.IntPtr NativeClass {\n"
<< scope_tab << scope_tab << "get {\n"
<< scope_tab << scope_tab << scope_tab << "if (((object)this).GetType() == typeof (" << inherit_name << "))\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "return " << native_inherit_full_name << ".GetEflClassStatic();\n"
<< scope_tab << "public " << raw_klass_modifier << "System.IntPtr NativeClass\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "get\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << "if (((object)this).GetType() == typeof(" << inherit_name << "))\n"
<< scope_tab << scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "return GetEflClassStatic();\n"
<< scope_tab << scope_tab << scope_tab << "}\n"
<< scope_tab << scope_tab << scope_tab << "else\n"
<< scope_tab << scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "return Efl.Eo.ClassRegister.klassFromType[((object)this).GetType()];\n"
<< scope_tab << scope_tab << scope_tab << "}\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << "}\n"
<< scope_tab << "}\n\n"
).generate(sink, attributes::unused, context))
return false;
@ -489,9 +532,10 @@ struct klass
return as_generator(
scope_tab << visibility << " System.IntPtr handle;\n"
<< scope_tab << "///<summary>Pointer to the native instance.</summary>\n"
<< scope_tab << "public System.IntPtr NativeHandle {\n"
<< scope_tab << "public System.IntPtr NativeHandle\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "get { return handle; }\n"
<< scope_tab << "}\n"
<< scope_tab << "}\n\n"
).generate(sink, attributes::unused, context);
}
@ -500,7 +544,6 @@ struct klass
{
bool root = !helpers::has_regular_ancestor(cls);
auto inherit_name = name_helpers::klass_concrete_name(cls);
auto native_inherit_name = name_helpers::klass_native_inherit_name(cls);
if(!as_generator(
scope_tab << "[System.Runtime.InteropServices.DllImport(" << context_find_tag<library_context>(context).actual_library_name(cls.filename)
@ -518,22 +561,24 @@ struct klass
// Public (API) constructors
if (!as_generator(
scope_tab << "///<summary>Creates a new instance.</summary>\n"
<< scope_tab << "///<param name=\"parent\">Parent instance.</param>\n"
scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.</summary>\n"
<< scope_tab << "/// <param name=\"parent\">Parent instance.</param>\n"
<< *(documentation)
// For constructors with arguments, the parent is also required, as optional parameters can't come before non-optional paramenters.
<< scope_tab << "public " << inherit_name << "(Efl.Object parent" << ((constructors.size() > 0) ? "" : "= null") << "\n"
<< scope_tab << scope_tab << scope_tab << *(", " << constructor_param ) << ") :\n"
<< scope_tab << scope_tab << (root ? "this" : "base") << "(" << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent)\n"
<< scope_tab << scope_tab << scope_tab << *(", " << constructor_param ) << ") : "
<< (root ? "this" : "base") << "(" << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent)\n"
<< scope_tab << "{\n"
<< *(scope_tab << scope_tab << constructor_invocation << "\n" )
<< (*(scope_tab << scope_tab << constructor_invocation << "\n"))
<< scope_tab << scope_tab << "FinishInstantiation();\n"
<< scope_tab << "}\n"
<< scope_tab << "///<summary>Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>\n"
<< scope_tab << "}\n\n"
<< scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
<< scope_tab << "/// Internal usage: Constructs an instance from a native pointer. This is used when interacting with C code and should not be used directly.</summary>\n"
<< scope_tab << "/// <param name=\"raw\">The native pointer to be wrapped.</param>\n"
<< scope_tab << "protected " << inherit_name << "(System.IntPtr raw)" << (root ? "" : " : base(raw)") << "\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << (root ? "handle = raw;\n" : "")
<< scope_tab << "}\n"
<< scope_tab << "}\n\n"
).generate(sink, std::make_tuple(constructors, constructors, constructors), context))
return false;
@ -558,8 +603,14 @@ struct klass
if (!root)
{
return as_generator(
scope_tab << "///<summary>Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>\n"
<< scope_tab << "protected " << inherit_name << "(IntPtr base_klass, System.Type managed_type, Efl.Object parent) : base(base_klass, managed_type, parent) {}\n"
scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
<< scope_tab << "/// Internal usage: Constructor to forward the wrapper initialization to the root class that interfaces with native code. Should not be used directly.</summary>\n"
<< scope_tab << "/// <param name=\"baseKlass\">The pointer to the base native Eo class.</param>\n"
<< scope_tab << "/// <param name=\"managedType\">The managed type of the public constructor that originated this call.</param>\n"
<< scope_tab << "/// <param name=\"parent\">The Efl.Object parent of this instance.</param>\n"
<< scope_tab << "protected " << inherit_name << "(IntPtr baseKlass, System.Type managedType, Efl.Object parent) : base(baseKlass, managedType, parent)\n"
<< scope_tab << "{\n"
<< scope_tab << "}\n\n"
).generate(sink, attributes::unused, context);
}
@ -567,25 +618,34 @@ struct klass
// Detailed constructors go only in root classes.
return as_generator(
/// Actual root costructor that creates class and instantiates
scope_tab << "protected " << inherit_name << "(IntPtr base_klass, System.Type managed_type, Efl.Object parent)\n"
scope_tab << "/// <summary>Initializes a new instance of the <see cref=\"" << inherit_name << "\"/> class.\n"
<< scope_tab << "/// Internal usage: Constructor to actually call the native library constructors. C# subclasses\n"
<< scope_tab << "/// must use the public constructor only.</summary>\n"
<< scope_tab << "/// <param name=\"baseKlass\">The pointer to the base native Eo class.</param>\n"
<< scope_tab << "/// <param name=\"managedType\">The managed type of the public constructor that originated this call.</param>\n"
<< scope_tab << "/// <param name=\"parent\">The Efl.Object parent of this instance.</param>\n"
<< scope_tab << "protected " << inherit_name << "(IntPtr baseKlass, System.Type managedType, Efl.Object parent)\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "inherited = ((object)this).GetType() != managed_type;\n"
<< scope_tab << scope_tab << "IntPtr actual_klass = base_klass;\n"
<< scope_tab << scope_tab << "if (inherited) {\n"
<< scope_tab << scope_tab << scope_tab << "actual_klass = Efl.Eo.ClassRegister.GetInheritKlassOrRegister(base_klass, ((object)this).GetType());\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << scope_tab << "inherited = ((object)this).GetType() != managedType;\n"
<< scope_tab << scope_tab << "IntPtr actual_klass = baseKlass;\n"
<< scope_tab << scope_tab << "if (inherited)\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << "actual_klass = Efl.Eo.ClassRegister.GetInheritKlassOrRegister(baseKlass, ((object)this).GetType());\n"
<< scope_tab << scope_tab << "}\n\n"
<< scope_tab << scope_tab << "handle = Efl.Eo.Globals.instantiate_start(actual_klass, parent);\n"
<< scope_tab << scope_tab << "if (inherited)\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << "Efl.Eo.Globals.PrivateDataSet(this);\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << "}\n"
<< scope_tab << "}\n\n"
<< scope_tab << "/// <summary>Finishes instantiating this object.\n"
<< scope_tab << "/// Internal usage by generated code.</summary>\n"
<< scope_tab << "protected void FinishInstantiation()\n"
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "handle = Efl.Eo.Globals.instantiate_end(handle);\n"
<< scope_tab << scope_tab << "Eina.Error.RaiseIfUnhandledException();\n"
<< scope_tab << "}\n"
<< scope_tab << "}\n\n"
).generate(sink, attributes::unused, context);
}
@ -597,7 +657,7 @@ struct klass
if (helpers::has_regular_ancestor(cls))
return true;
std::string visibility = is_inherit_context(context) ? "protected virtual " : "";
std::string visibility = is_inherit_context(context) ? "protected virtual " : "private ";
auto inherit_name = name_helpers::klass_concrete_name(cls);
@ -647,7 +707,7 @@ struct klass
<< scope_tab << scope_tab << scope_tab << scope_tab << "}\n\n"
<< scope_tab << scope_tab << scope_tab << scope_tab << "Monitor.Exit(Efl.All.InitLock);\n"
<< scope_tab << scope_tab << scope_tab << "}\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << scope_tab << "}\n\n"
<< scope_tab << "}\n\n"
<< scope_tab << "///<summary>Releases the underlying native instance.</summary>\n"
@ -734,7 +794,7 @@ struct klass
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << "Eina.Log.Error($\"Trying to remove proxy for event {key} when it is nothing registered.\");\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << "}\n"
<< scope_tab << "}\n\n"
)
.generate(sink, NULL, context))
return false;

View File

@ -51,71 +51,71 @@ struct marshall_annotation_visitor_generate
match const parameter_match_table[] =
{
// signed primitives
{"bool", nullptr, [&] { return " [MarshalAs(UnmanagedType.U1)]"; }},
{"bool", nullptr, [&] { return "[MarshalAs(UnmanagedType.U1)]"; }},
{"string", true, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
}},
{"string", false, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
}},
{"mstring", true, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
}},
{"mstring", false, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
}},
{"stringshare", true, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringsharePassOwnershipMarshaler))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringsharePassOwnershipMarshaler))]";
}},
{"stringshare", false, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringshareKeepOwnershipMarshaler))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringshareKeepOwnershipMarshaler))]";
}},
{"any_value_ptr", true, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]";
}},
{"any_value_ptr", false, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]";
}},
{"strbuf", true, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufPassOwnershipMarshaler))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufPassOwnershipMarshaler))]";
}},
{"strbuf", false, [&] {
return " [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))]";
return "[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))]";
}},
};
match const return_match_table[] =
{
// signed primitives
{"bool", nullptr, [&] { return " [return: MarshalAs(UnmanagedType.U1)]"; }},
{"bool", nullptr, [&] { return "[return: MarshalAs(UnmanagedType.U1)]"; }},
{"string", true, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
}},
{"string", nullptr, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
}},
{"mstring", true, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringPassOwnershipMarshaler))]";
}},
{"mstring", false, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringKeepOwnershipMarshaler))]";
}},
{"stringshare", true, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringsharePassOwnershipMarshaler))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringsharePassOwnershipMarshaler))]";
}},
{"stringshare", false, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringshareKeepOwnershipMarshaler))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringshareKeepOwnershipMarshaler))]";
}},
{"any_value_ptr", true, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshalerOwn))]";
}},
{"any_value_ptr", false, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Eina.ValueMarshaler))]";
}},
{"strbuf", true, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufPassOwnershipMarshaler))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufPassOwnershipMarshaler))]";
}},
{"strbuf", false, [&] {
return " [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))]";
return "[return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StrbufKeepOwnershipMarshaler))]";
}},
};

View File

@ -176,22 +176,22 @@ inline std::string managed_namespace(std::string const& ns)
return escape_keyword(utils::remove_all(ns, '_'));
}
inline std::string managed_method_name(std::string const& klass, std::string const& name)
inline std::string managed_method_name(attributes::function_def const& f)
{
std::vector<std::string> names = utils::split(name, '_');
std::vector<std::string> names = utils::split(f.name, '_');
name_helpers::reorder_verb(names);
std::string candidate = escape_keyword(utils::to_pascal_case(names));
// Some eolian methods have the same name as their parent class
if (candidate == klass)
if (candidate == klass_concrete_or_interface_name(f.klass))
candidate = "Do" + candidate;
// Avoid clashing with System.Object.GetType
if (candidate == "GetType" || candidate == "SetType")
{
candidate.insert(3, klass);
candidate.insert(3, f.klass.eolian_name);
}
return candidate;
@ -203,11 +203,6 @@ inline std::string managed_name(std::string const& name, char separator='_')
return utils::to_pascal_case(tokens);
}
inline std::string managed_method_name(attributes::function_def const& f)
{
return managed_method_name(f.klass.eolian_name, f.name);
}
inline std::string alias_full_eolian_name(attributes::alias_def const& alias)
{
@ -398,29 +393,15 @@ inline std::string klass_inherit_name(T const& klass)
}
template<typename T>
inline std::string klass_native_inherit_name(T const& klass)
inline std::string klass_native_inherit_name(EINA_UNUSED T const& klass)
{
switch(klass.type)
{
case attributes::class_type::abstract_:
case attributes::class_type::regular:
return klass_concrete_name(klass) + "NativeInherit";
default:
return klass_interface_name(klass) + "NativeInherit";
}
return "NativeMethods";
}
template<typename T>
inline std::string klass_full_native_inherit_name(T const& klass)
{
switch(klass.type)
{
case attributes::class_type::abstract_:
case attributes::class_type::regular:
return klass_full_concrete_name(klass) + "NativeInherit";
default:
return klass_full_interface_name(klass) + "NativeInherit";
}
return klass_full_concrete_name(klass) + "." + klass_native_inherit_name(klass);
}
template<typename T>
@ -465,14 +446,14 @@ bool open_namespaces(OutputIterator sink, std::vector<std::string> namespaces, C
{
std::transform(namespaces.begin(), namespaces.end(), namespaces.begin(), managed_namespace);
auto open_namespace = *("namespace " << string << " { ") << "\n";
auto open_namespace = *("namespace " << string << " {\n\n");
return as_generator(open_namespace).generate(sink, namespaces, context);
}
template<typename OutputIterator, typename Context>
bool close_namespaces(OutputIterator sink, std::vector<std::string> const& namespaces, Context const& context)
{
auto close_namespace = *(lit("} ")) << "\n";
auto close_namespace = (lit("}") % "\n\n" ) << "\n\n";
return as_generator(close_namespace).generate(sink, namespaces, context);
}

View File

@ -389,22 +389,22 @@ inline std::string direction_modifier(attributes::parameter_def const& param)
{
if (param.direction == attributes::parameter_direction::inout)
{
return " ref ";
return "ref ";
}
else if (param.direction != attributes::parameter_direction::in)
{
if (param.type.c_type == "Eina_Slice" || param.type.c_type == "Eina_Rw_Slice")
return " ref ";
return "ref ";
else
return " out ";
return "out ";
}
else if (param.direction == attributes::parameter_direction::in && param.type.is_ptr)
{
auto regular = efl::eina::get<attributes::regular_type_def>(&param.type.original_type);
if (helpers::need_struct_conversion(regular))
return " ref "; // Don't add ref on Marshal if it is ptr
return "ref "; // Don't add ref on Marshal if it is ptr
}
return " ";
return "";
}
std::string marshall_direction_modifier(attributes::parameter_def const& param)
@ -1477,7 +1477,8 @@ struct constructor_invocation_generator
if (!as_generator(
"if (" <<
(efl::eolian::grammar::attribute_reorder<-1>
("Efl.Eo.Globals.ParamHelperCheck(" << constructor_parameter_name(ctor) << ")") % "||") << ")\n"
("Efl.Eo.Globals.ParamHelperCheck(" << constructor_parameter_name(ctor) << ")") % " || ") << ")\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << name_helpers::managed_method_name(ctor.function) << "("
).generate(sink, params, context))
return false;
@ -1493,7 +1494,9 @@ struct constructor_invocation_generator
return false;
}
if (!as_generator(");").generate(sink, attributes::unused, context))
if (!as_generator(
");\n"
<< scope_tab << scope_tab << "}\n").generate(sink, attributes::unused, context))
return false;
return true;
}

View File

@ -27,7 +27,7 @@ struct part_definition_generator
<< scope_tab << "{\n"
<< scope_tab << scope_tab << "get\n"
<< scope_tab << scope_tab << "{\n"
<< scope_tab << scope_tab << scope_tab << "return Efl.IPartNativeInherit.efl_part_get_ptr.Value.Delegate(NativeHandle, \"" << part.name << "\") as " << part_klass_name << ";\n"
<< scope_tab << scope_tab << scope_tab << "return GetPart(\"" << part.name << "\") as " << part_klass_name << ";\n"
<< scope_tab << scope_tab << "}\n"
<< scope_tab << "}\n"
).generate(sink, part.documentation, context);

View File

@ -18,7 +18,7 @@ struct field_argument_default_generator
template<typename OutputIterator, typename Context>
bool generate(OutputIterator sink, attributes::struct_field_def const& field, Context const& context) const
{
if (!as_generator(type << " " << string << "=default(" << type << ")")
if (!as_generator(type << " " << string << " = default(" << type << ")")
.generate(sink, std::make_tuple(field.type, name_helpers::to_field_name(field.name), field.type), context))
return false;
return true;

View File

@ -34,7 +34,7 @@ struct constant_definition_generator
if (!name_helpers::open_namespaces(sink, constant.namespaces, context))
return false;
if (!as_generator("public partial class Constants {\n").generate(sink, attributes::unused, context))
if (!as_generator("public partial class Constants\n{\n").generate(sink, attributes::unused, context))
return false;
std::string literal;

View File

@ -87,10 +87,10 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
);
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS);
efl_ui_property_bind(factory, "signal/efl,state,%v", "odd_style");
efl_ui_property_bind(factory, "signal/efl,state,%{selected;unselected}", "selected");
efl_ui_property_bind(factory, "efl.text", "name");
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
li = efl_add(EFL_UI_LIST_VIEW_CLASS, win
, efl_ui_list_view_layout_factory_set(efl_added, factory)

View File

@ -33,8 +33,8 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
model = efl_add(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname));
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS);
efl_ui_property_bind(factory, "efl.text", "filename");
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
li = efl_add(EFL_UI_LIST_VIEW_CLASS, win);
efl_ui_list_view_layout_factory_set(li, factory);

View File

@ -223,7 +223,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
priv->model = _make_model();
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
efl_ui_property_bind(factory, "efl.text", "filename");
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS);
priv->list1 = efl_add(EFL_UI_LIST_VIEW_CLASS, win, efl_ui_view_model_set(efl_added, priv->model));
efl_event_callback_add(priv->list1, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_1_cb, priv);
@ -235,7 +235,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
factory = efl_add(EFL_UI_LAYOUT_FACTORY_CLASS, win);
efl_ui_property_bind(factory, "efl.text", "filename");
efl_ui_property_bind(factory, "signal/efl,state,%v", "selected");
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
efl_ui_widget_factory_item_class_set(factory, EFL_UI_LIST_DEFAULT_ITEM_CLASS);
priv->list2 = efl_add(EFL_UI_LIST_VIEW_CLASS, win, efl_ui_view_model_set(efl_added, priv->model));
efl_event_callback_add(priv->list2, EFL_UI_LIST_VIEW_EVENT_ITEM_REALIZED, _realized_2_cb, priv->list2);
evas_object_size_hint_weight_set(priv->list2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);

View File

@ -12,16 +12,13 @@ typedef struct _Ecore_Future_Schedule_Entry
Eina_Future_Schedule_Entry base;
Eina_Future_Scheduler_Cb cb;
Eina_Future *future;
Eo *event;
Eina_Value value;
} Ecore_Future_Schedule_Entry;
//////
// XXX: still using legacy ecore events
//static Ecore_Event_Handler *future_handler = NULL;
static Eina_Bool shutting_down = EINA_FALSE;
static Eina_Mempool *mp_future_schedule_entry = NULL;
//static int ECORE_EV_FUTURE_ID = -1;
//
//////
@ -129,52 +126,47 @@ ecore_event_current_event_get(void)
return ecore_event_message_handler_current_event_get(_event_msg_handler);
}
/* XXX:
static Eina_Bool
ecore_future_dispatched(void *data EINA_UNUSED,
int type EINA_UNUSED,
void *event)
{
Ecore_Future_Schedule_Entry *entry = event;
EINA_SAFETY_ON_NULL_RETURN_VAL(entry, EINA_FALSE);
static void _future_dispatch_cb(void *data, const Efl_Event *ev EINA_UNUSED);
static void _event_del_cb(void *data, const Efl_Event *ev);
entry->event = NULL;
entry->cb(entry->future, entry->value);
return EINA_FALSE;
}
static void
ecore_future_free(void *user_data,
void *func_data EINA_UNUSED)
{
Ecore_Future_Schedule_Entry *entry = user_data;
if (entry->event)
{
eina_future_cancel(entry->future);
eina_value_flush(&entry->value);
}
eina_mempool_free(mp_future_schedule_entry, entry);
}
*/
EFL_CALLBACKS_ARRAY_DEFINE(ecore_future_callbacks,
{ EFL_LOOP_EVENT_IDLE_ENTER, _future_dispatch_cb },
{ EFL_LOOP_EVENT_IDLE, _future_dispatch_cb },
{ EFL_EVENT_DEL, _event_del_cb });
static void
_future_dispatch_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Ecore_Future_Schedule_Entry *entry = data;
entry->event = NULL;
entry->cb(entry->future, entry->value);
Efl_Loop_Future_Scheduler *loopsched = data;
Eina_List *entries = loopsched->future_entries;
Ecore_Future_Schedule_Entry *entry;
loopsched->future_entries = NULL;
efl_event_callback_array_del((Eo *) loopsched->loop, ecore_future_callbacks(), loopsched);
EINA_LIST_FREE(entries, entry)
{
entry->cb(entry->future, entry->value);
eina_mempool_free(mp_future_schedule_entry, entry);
}
}
static void
_event_del_cb(void *data, const Efl_Event *ev)
_event_del_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
Ecore_Future_Schedule_Entry *entry = data;
if ((ev->object == (Eo *) entry->event) && entry->future)
Efl_Loop_Future_Scheduler *loopsched = data;
Eina_List *entries = loopsched->future_entries;
Ecore_Future_Schedule_Entry *entry;
loopsched->future_entries = NULL;
efl_event_callback_array_del((Eo *) loopsched->loop, ecore_future_callbacks(), loopsched);
EINA_LIST_FREE(entries, entry)
{
eina_future_cancel(entry->future);
eina_value_flush(&entry->value);
eina_mempool_free(mp_future_schedule_entry, entry);
}
eina_mempool_free(mp_future_schedule_entry, entry);
}
static Eina_Future_Schedule_Entry *
@ -192,40 +184,35 @@ ecore_future_schedule(Eina_Future_Scheduler *sched,
entry->cb = cb;
entry->future = future;
entry->value = value;
entry->event = efl_loop_message_future_handler_message_type_add
(loopsched->loop_data->future_message_handler);
EINA_SAFETY_ON_NULL_GOTO(entry->event, err);
efl_loop_message_future_data_set(entry->event, entry);
efl_loop_message_handler_message_send
(loopsched->loop_data->future_message_handler, entry->event);
// XXX:
// entry->event = ecore_event_add(ECORE_EV_FUTURE_ID, entry,
// ecore_future_free, entry);
efl_event_callback_add((Eo *)entry->event, EFL_LOOP_MESSAGE_EVENT_MESSAGE,
_future_dispatch_cb, entry);
efl_event_callback_add((Eo *)entry->event, EFL_EVENT_DEL,
_event_del_cb, entry);
return &entry->base;
err:
eina_mempool_free(mp_future_schedule_entry, entry);
return NULL;
if (!loopsched->future_entries)
efl_event_callback_array_add((Eo *) loopsched->loop, ecore_future_callbacks(), loopsched);
loopsched->future_entries = eina_list_append(loopsched->future_entries, entry);
return &entry->base;
}
static void
ecore_future_recall(Eina_Future_Schedule_Entry *s_entry)
{
Eo *msg;
Ecore_Future_Schedule_Entry *entry = (Ecore_Future_Schedule_Entry *)s_entry;
Efl_Loop_Future_Scheduler *loopsched;
Eina_List *lookup;
if (shutting_down) return;
Ecore_Future_Schedule_Entry *entry = (Ecore_Future_Schedule_Entry *)s_entry;
EINA_SAFETY_ON_NULL_RETURN(entry->event);
// XXX:
// ecore_event_del(entry->event);
msg = entry->event;
loopsched = (Efl_Loop_Future_Scheduler *) entry->base.scheduler;
lookup = eina_list_data_find_list(loopsched->future_entries, entry);
if (!lookup) return;
loopsched->future_entries = eina_list_remove_list(loopsched->future_entries, lookup);
if (!loopsched->future_entries)
efl_event_callback_array_del((Eo *) loopsched->loop, ecore_future_callbacks(), loopsched);
eina_value_flush(&entry->value);
entry->event = NULL;
efl_del(msg);
eina_mempool_free(mp_future_schedule_entry, entry);
}
static Eina_Future_Scheduler ecore_future_scheduler = {

View File

@ -109,6 +109,8 @@ struct _Efl_Loop_Future_Scheduler
Eina_Future_Scheduler eina_future_scheduler;
const Eo *loop;
Efl_Loop_Data *loop_data;
Eina_List *future_entries;
};
struct _Efl_Loop_Data

View File

@ -207,4 +207,121 @@ _efl_boolean_model_boolean_del(Eo *obj EINA_UNUSED,
eina_stringshare_del(s);
}
typedef struct _Eina_Iterator_Boolean Eina_Iterator_Boolean;
struct _Eina_Iterator_Boolean
{
Eina_Iterator iterator;
Eo *obj;
Efl_Boolean_Model_Data *pd;
Efl_Boolean_Model_Value *v;
uint64_t index;
uint64_t total;
Eina_Bool request;
};
static inline Eina_Bool
_lookup_next_chunk(uint64_t *index, uint64_t total,
Efl_Boolean_Model_Value *v, unsigned char pattern)
{
uint64_t upidx = *index >> 3;
while (upidx < v->buffer_count &&
v->buffer[upidx] == pattern)
upidx++;
*index = upidx << 3;
if (upidx == v->buffer_count &&
*index >= total) return EINA_FALSE;
return EINA_TRUE;
}
static Eina_Bool
efl_boolean_model_iterator_next(Eina_Iterator_Boolean *it, void **data)
{
uint64_t upidx;
*data = &it->index;
it->index++;
retry:
if (it->index >= it->total) return EINA_FALSE;
if ((it->index >> 3) >= it->v->buffer_count)
{
if (it->v->default_value != it->request)
return EINA_FALSE;
return EINA_TRUE;
}
upidx = it->index >> 3;
while ((it->index >> 3) == upidx)
{
Eina_Bool flag = it->v->buffer[it->index >> 3] &
(((unsigned char)1) << (it->index & 0x7));
if (it->request == !!flag)
break;
it->index++;
}
if ((it->index >> 3) != upidx)
{
if (!_lookup_next_chunk(&it->index, it->total, it->v, it->request ? 0x00 : 0xFF))
return EINA_FALSE;
goto retry;
}
return EINA_TRUE;
}
static Eo *
efl_boolean_model_iterator_get_container(Eina_Iterator_Boolean *it)
{
return it->obj;
}
static void
efl_boolean_model_iterator_free(Eina_Iterator_Boolean *it)
{
efl_unref(it->obj);
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_NONE);
free(it);
}
static Eina_Iterator *
_efl_boolean_model_boolean_iterator_get(Eo *obj, Efl_Boolean_Model_Data *pd, const char *name, Eina_Bool request)
{
Eina_Iterator_Boolean *itb;
Efl_Boolean_Model_Value *v;
Eina_Stringshare *s;
s = eina_stringshare_add(name);
v = eina_hash_find(pd->values, s);
eina_stringshare_del(s);
if (!v) return NULL;
itb = calloc(1, sizeof (Eina_Iterator_Boolean));
if (!itb) return NULL;
itb->obj = efl_ref(obj);
itb->pd = pd;
itb->v = v;
itb->index = 0;
itb->total = efl_model_children_count_get(obj);
itb->request = !!request;
itb->iterator.version = EINA_ITERATOR_VERSION;
itb->iterator.next = FUNC_ITERATOR_NEXT(efl_boolean_model_iterator_next);
itb->iterator.get_container = FUNC_ITERATOR_GET_CONTAINER(efl_boolean_model_iterator_get_container);
itb->iterator.free = FUNC_ITERATOR_FREE(efl_boolean_model_iterator_free);
EINA_MAGIC_SET(&itb->iterator, EINA_MAGIC_ITERATOR);
return &itb->iterator;
}
#include "efl_boolean_model.eo.c"

View File

@ -15,6 +15,14 @@ class @beta Efl.Boolean_Model extends Efl.Composite_Model
@in name: string;
}
}
boolean_iterator_get {
[[Get an iterator that will quickly find all the index with the requested value for a specific boolean.]]
params {
@in name: string;
@in request: bool;
}
return: iterator<ptr(uint64)>; [[The iterator that is valid until any change is made on the model.]]
}
}
implements {
Efl.Model.properties { get; }

View File

@ -215,6 +215,7 @@ _efl_core_command_line_command_array_set(Eo *obj EINA_UNUSED, Efl_Core_Command_L
{
char *content = eina_array_data_get(array, i);
char *param = calloc(1, strlen(content) + 1);
char *esc;
if (!param)
{
@ -236,7 +237,9 @@ _efl_core_command_line_command_array_set(Eo *obj EINA_UNUSED, Efl_Core_Command_L
//build the command
if (i != 0)
eina_strbuf_append(command, " ");
eina_strbuf_append(command, _escape(content));
esc = _escape(content);
eina_strbuf_append(command, esc);
free(esc);
//convert string to stringshare
strcpy(param, content);
_remove_invalid_chars(param);

View File

@ -125,6 +125,33 @@ _efl_loop_model_volatile_make(Eo *obj, void *pd EINA_UNUSED)
efl_event_callback_add(obj, EFL_EVENT_NOREF, _noref_death, NULL);
}
static Eina_Future *
_efl_loop_model_efl_model_property_set(Eo *obj, void *pd EINA_UNUSED,
const char *property, Eina_Value *value)
{
Eina_Error err;
if (!value) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
err = efl_property_reflection_set(obj, property, *value);
if (err) return efl_loop_future_rejected(obj, err);
return efl_loop_future_resolved(obj, efl_property_reflection_get(obj, property));
}
static Eina_Value *
_efl_loop_model_efl_model_property_get(const Eo *obj, void *pd EINA_UNUSED,
const char *property)
{
Eina_Value *r;
Eina_Value direct;
direct = efl_property_reflection_get(obj, property);
r = eina_value_dup(&direct);
eina_value_flush(&direct);
return r;
}
static void
_efl_loop_model_efl_object_invalidate(Eo *obj, void *pd EINA_UNUSED)
{

View File

@ -14,5 +14,6 @@ abstract @beta Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model
implements {
Efl.Object.invalidate;
Efl.Model.property_ready_get;
Efl.Model.property { get; set; }
}
}

View File

@ -1242,6 +1242,8 @@ _touch_cb_up(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int serial
if ((input->grab.window) && (input->grab.button == BTN_LEFT) &&
(!input->grab.count))
_ecore_wl2_input_ungrab(input);
input->focus.touch = NULL;
}
static void

View File

@ -2397,29 +2397,12 @@ _edje_filter_get(Edje *ed, Edje_Part_Description_Spec_Filter *filter)
static void
_edje_part_pixel_adjust(Edje *ed,
Edje_Real_Part *ep,
Edje_Calc_Params *params,
Eina_Bool round)
Edje_Calc_Params *params)
{
int xw, yh, fxw, fyh;
xw = ABS(params->final.x) + params->final.w;
yh = ABS(params->final.y) + params->final.h;
if (round)
{
fxw = TO_INT_ROUND(ADD(ABS(params->eval.x), params->eval.w));
fyh = TO_INT_ROUND(ADD(ABS(params->eval.y), params->eval.h));
}
else
{
fxw = TO_INT(ADD(ABS(params->eval.x), params->eval.w));
fyh = TO_INT(ADD(ABS(params->eval.y), params->eval.h));
}
/* Adjust rounding to not loose one pixels compared to float
information only when rendering to avoid infinite adjustement
when doing min restricted calc */
if (xw < fxw)
if (ABS(params->final.x) + params->final.w < TO_INT(ADD(ABS(params->eval.x), params->eval.w)))
{
if (!ed->calc_only)
{
@ -2430,7 +2413,7 @@ _edje_part_pixel_adjust(Edje *ed,
ep->invalidate = EINA_TRUE;
}
}
else if (xw > fxw)
else if (ABS(params->final.x) + params->final.w > TO_INT(ADD(ABS(params->eval.x), params->eval.w)))
{
if (!ed->calc_only)
{
@ -2441,8 +2424,7 @@ _edje_part_pixel_adjust(Edje *ed,
ep->invalidate = EINA_TRUE;
}
}
if (yh < fyh)
if (ABS(params->final.y) + params->final.h < TO_INT(ADD(ABS(params->eval.y), params->eval.h)))
{
if (!ed->calc_only)
{
@ -2453,7 +2435,7 @@ _edje_part_pixel_adjust(Edje *ed,
ep->invalidate = EINA_TRUE;
}
}
else if (yh > fyh)
else if (ABS(params->final.y) + params->final.h > TO_INT(ADD(ABS(params->eval.y), params->eval.h)))
{
if (!ed->calc_only)
{
@ -2467,6 +2449,7 @@ _edje_part_pixel_adjust(Edje *ed,
if (params->final.w < 0 || params->final.h < 0)
ERR("The params final size became negative");
}
static void
@ -3011,7 +2994,7 @@ _edje_part_recalc_single(Edje *ed,
params->final.w = TO_INT(params->eval.w);
params->final.h = TO_INT(params->eval.h);
_edje_part_pixel_adjust(ed, ep, params, EINA_FALSE);
_edje_part_pixel_adjust(ed, ep, params);
/* fill */
if (ep->part->type == EDJE_PART_TYPE_IMAGE)
_edje_part_recalc_single_fill(ep, &((Edje_Part_Description_Image *)desc)->image.fill, params);
@ -3614,7 +3597,7 @@ _edje_physics_body_add(Edje *ed, Edje_Real_Part *rp, EPhysics_World *world)
? (_x1) \
: ADD(_x1, MUL(_p, SUB(_x2, _x1))));
#define INTP(_x1, _x2, _p) TO_INT_ROUND(FINTP(_x1, _x2, _p))
#define INTP(_x1, _x2, _p) TO_INT(FINTP(_x1, _x2, _p))
static void
_map_colors_free(Edje_Calc_Params *pf)
@ -4501,7 +4484,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta
p3->req.w = INTP(p1->req.w, p2->req.w, pos);
p3->req.h = INTP(p1->req.h, p2->req.h, pos);
_edje_part_pixel_adjust(ed, ep, p3, EINA_TRUE);
_edje_part_pixel_adjust(ed, ep, p3);
if (ep->part->dragable.x)
{

View File

@ -155,9 +155,7 @@ EAPI extern int _edje_default_log_dom ;
#define FROM_DOUBLE(a) eina_f32p32_double_from(a)
#define FROM_INT(a) eina_f32p32_int_from(a)
#define TO_INT(a) eina_f32p32_int_to(a)
#define TO_INT_ROUND(a) (((a) >= 0.0) \
? eina_f32p32_int_to(ADD(a, FROM_DOUBLE(0.5)) \
: eina_f32p32_int_to(ADD(a, FROM_DOUBLE(-0.5))
#define TO_INT_ROUND(a) eina_f32p32_int_to(ADD(a, FROM_DOUBLE(0.5)))
#define ZERO 0
#define COS(a) eina_f32p32_cos(a)
#define SIN(a) eina_f32p32_sin(a)
@ -180,7 +178,7 @@ EAPI extern int _edje_default_log_dom ;
#define FROM_DOUBLE(a) (a)
#define FROM_INT(a) (double)(a)
#define TO_INT(a) (int)(a)
#define TO_INT_ROUND(a) (((a) >= 0.0) ? (int)(a + 0.5) : (int)(a - 0.5))
#define TO_INT_ROUND(a) (int)(a + 0.5)
#define ZERO 0.0
#define COS(a) cos(a)
#define SIN(a) sin(a)

View File

@ -495,12 +495,6 @@ _property_filename_cb(const Eo *obj, Efl_Io_Model_Data *pd)
return eina_value_error_new(EAGAIN);
}
static Eina_Value *
_property_path_cb(const Eo *obj EINA_UNUSED, Efl_Io_Model_Data *pd)
{
return eina_value_stringshare_new(pd->path);
}
static Eina_Value *
_property_direct_info_cb(const Eo *obj, Efl_Io_Model_Data *pd)
{
@ -620,7 +614,7 @@ static struct {
const char *name;
Eina_Value *(*cb)(const Eo *obj, Efl_Io_Model_Data *pd);
} properties[] = {
PP(filename), PP(path),
PP(filename),
PP(direct_info),
PP(mtime), PP(atime), PP(ctime), PP(is_dir), PP(is_lnk), PP(size),
PP(stat),
@ -649,9 +643,7 @@ _efl_io_model_efl_model_property_get(const Eo *obj, Efl_Io_Model_Data *pd, const
!strcmp(property, properties[i].name))
return properties[i].cb(obj, pd);
ERR("Could not find property '%s'.", property);
// Unknow value request
return eina_value_error_new(EFL_MODEL_ERROR_NOT_SUPPORTED);
return efl_model_property_get(efl_super(obj, EFL_IO_MODEL_CLASS), property);
}
static Eina_Future *

View File

@ -1010,8 +1010,11 @@ _efl_ui_layout_content_set(Eo *obj, Efl_Ui_Layout_Data *sd, const char *part, Ev
if (!strcmp(part, sub_d->part))
{
if (content == sub_d->obj) goto end;
_eo_unparent_helper(sub_d->obj, obj);
evas_object_del(sub_d->obj);
if (efl_alive_get(sub_d->obj))
{
_eo_unparent_helper(sub_d->obj, obj);
evas_object_del(sub_d->obj);
}
break;
}
/* was previously swallowed at another part -- mimic

View File

@ -711,24 +711,36 @@ _efl_ui_panel_efl_ui_widget_widget_input_event_handler(Eo *obj, Efl_Ui_Panel_Dat
return _panel_efl_ui_widget_widget_input_event_handler(obj, pd, eo_event, src);
}
static void
_invalidate_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
efl_content_set(data, NULL);
}
static Eina_Bool
_efl_ui_panel_efl_content_content_set(Eo *obj, Efl_Ui_Panel_Data *sd, Efl_Gfx_Entity *content)
{
if (sd->content == content) return EINA_TRUE;
if (sd->content)
evas_object_box_remove_all(sd->bx, EINA_TRUE);
sd->content = content;
if (content)
{
efl_event_callback_del(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
if (!efl_invalidated_get(sd->content) && !efl_invalidating_get(sd->content))
efl_del(sd->content);
sd->content = NULL;
}
if (content && !elm_widget_sub_object_add(obj, content)) return EINA_FALSE;
sd->content = content;
if (sd->content)
{
efl_event_callback_add(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
evas_object_box_append(sd->bx, sd->content);
evas_object_show(sd->content);
if (sd->scrollable)
elm_widget_sub_object_add(sd->scr_ly, sd->content);
else
elm_widget_sub_object_add(obj, sd->content);
}
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, content);
if (efl_finalized_get(obj))
if (efl_alive_get(obj))
elm_layout_sizing_eval(obj);
return EINA_TRUE;
@ -741,18 +753,10 @@ _efl_ui_panel_efl_content_content_get(const Eo *obj EINA_UNUSED, Efl_Ui_Panel_Da
}
static Efl_Gfx_Entity*
_efl_ui_panel_efl_content_content_unset(Eo *obj EINA_UNUSED, Efl_Ui_Panel_Data *sd)
_efl_ui_panel_efl_content_content_unset(Eo *obj EINA_UNUSED, Efl_Ui_Panel_Data *sd EINA_UNUSED)
{
Efl_Gfx_Entity *ret = NULL;
if (!sd->content) return NULL;
ret = sd->content;
evas_object_box_remove_all(sd->bx, EINA_FALSE);
if (sd->scrollable)
_elm_widget_sub_object_redirect_to_top(sd->scr_ly, sd->content);
sd->content = NULL;
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL);
Efl_Gfx_Entity *ret = efl_content_get(obj);
efl_content_set(obj, NULL);
return ret;
}

View File

@ -112,6 +112,8 @@ _efl_ui_popup_efl_ui_widget_widget_parent_set(Eo *obj, Efl_Ui_Popup_Data *pd EIN
efl_event_callback_add(pd->win_parent, EFL_GFX_ENTITY_EVENT_SIZE_CHANGED, _parent_geom_cb, obj);
efl_event_callback_add(pd->win_parent, EFL_GFX_ENTITY_EVENT_POSITION_CHANGED, _parent_geom_cb, obj);
efl_ui_widget_parent_set(efl_super(obj, MY_CLASS), parent);
}
EOLIAN static void

View File

@ -446,10 +446,9 @@ _hash_child_init_foreach_cb(const Eina_Hash *hash, const void *key EINA_UNUSED,
}
static void
_on_size_hints_changed(void *data EINA_UNUSED, Evas *e EINA_UNUSED,
Evas_Object *obj, void *event_info EINA_UNUSED)
_efl_ui_relative_layout_hints_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
efl_pack_layout_request(obj);
efl_pack_layout_request(ev->object);
}
EOLIAN static void
@ -490,7 +489,8 @@ _efl_ui_relative_layout_efl_gfx_entity_position_set(Eo *obj, Efl_Ui_Relative_Lay
EOLIAN static void
_efl_ui_relative_layout_efl_canvas_group_group_add(Eo *obj, Efl_Ui_Relative_Layout_Data *pd EINA_UNUSED)
{
evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _on_size_hints_changed, NULL);
efl_event_callback_add(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
_efl_ui_relative_layout_hints_changed_cb, NULL);
efl_canvas_group_add(efl_super(obj, MY_CLASS));
elm_widget_highlight_ignore_set(obj, EINA_TRUE);
@ -514,6 +514,8 @@ _efl_ui_relative_layout_efl_object_constructor(Eo *obj, Efl_Ui_Relative_Layout_D
EOLIAN static void
_efl_ui_relative_layout_efl_object_destructor(Eo *obj, Efl_Ui_Relative_Layout_Data *pd)
{
efl_event_callback_del(obj, EFL_GFX_ENTITY_EVENT_HINTS_CHANGED,
_efl_ui_relative_layout_hints_changed_cb, NULL);
eina_hash_free(pd->children);
efl_destructor(efl_super(obj, MY_CLASS));
}

View File

@ -152,11 +152,7 @@ static void
_efl_ui_scroller_content_del_cb(void *data,
const Efl_Event *event EINA_UNUSED)
{
EFL_UI_SCROLLER_DATA_GET_OR_RETURN(data, sd);
sd->content = NULL;
if (!sd->smanager) return;
efl_ui_scrollbar_bar_visibility_update(sd->smanager);
efl_content_unset(data);
}
EOLIAN static Eina_Bool
@ -167,14 +163,23 @@ _efl_ui_scroller_efl_content_content_set(Eo *obj,
if (sd->content)
{
efl_content_set(sd->pan_obj, NULL);
efl_event_callback_del(sd->content, EFL_EVENT_DEL,
efl_event_callback_del(sd->content, EFL_EVENT_INVALIDATE,
_efl_ui_scroller_content_del_cb, obj);
efl_del(sd->content);
sd->content = NULL;
}
if (content && !efl_ui_widget_sub_object_add(obj, content))
{
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL);
return EINA_FALSE;
}
sd->content = content;
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, sd->content);
if (!content) return EINA_TRUE;
efl_event_callback_add(sd->content, EFL_EVENT_DEL,
efl_event_callback_add(sd->content, EFL_EVENT_INVALIDATE,
_efl_ui_scroller_content_del_cb, obj);
efl_content_set(sd->pan_obj, content);
@ -195,7 +200,9 @@ _efl_ui_scroller_efl_content_content_unset(Eo *obj EINA_UNUSED, Efl_Ui_Scroller_
{
Efl_Gfx_Entity *old_content = pd->content;
efl_event_callback_del(pd->content, EFL_EVENT_INVALIDATE, _efl_ui_scroller_content_del_cb, obj);
pd->content = NULL;
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL);
if (pd->smanager)
{
efl_ui_scrollbar_bar_visibility_update(pd->smanager);

View File

@ -11,24 +11,44 @@
#define MY_CLASS EFL_UI_TAB_PAGE_CLASS
static void
_invalidate_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
efl_content_unset(data);
}
EOLIAN static Eina_Bool
_efl_ui_tab_page_efl_content_content_set(Eo *obj, Efl_Ui_Tab_Page_Data *sd, Eo *content)
{
if (sd->content)
{
efl_content_unset(efl_part(obj, "efl.content"));
efl_event_callback_del(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
efl_del(sd->content);
sd->content = NULL;
}
if (content && !efl_ui_widget_sub_object_add(obj, content))
{
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL);
return EINA_FALSE;
}
sd->content = content;
efl_event_callback_add(sd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, content);
efl_content_set(efl_part(obj, "efl.content"), sd->content);
return EINA_TRUE;
}
EOLIAN static Efl_Gfx_Entity*
_efl_ui_tab_page_efl_content_content_unset(Eo *obj, Efl_Ui_Tab_Page_Data *pd EINA_UNUSED)
_efl_ui_tab_page_efl_content_content_unset(Eo *obj, Efl_Ui_Tab_Page_Data *pd)
{
efl_event_callback_del(pd->content, EFL_EVENT_INVALIDATE, _invalidate_cb, obj);
pd->content = NULL;
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL);
return efl_content_unset(efl_part(obj, "efl.content"));
}

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,8 @@ class @beta Efl.Ui.Table extends Efl.Ui.Widget implements Efl.Pack_Table, Efl.Pa
implements {
Efl.Object.constructor;
Efl.Canvas.Group.group_calculate;
Efl.Ui.Widget.theme_apply;
Efl.Gfx.Entity.position { set; }
Efl.Gfx.Entity.size { set; }
Efl.Container.content_iterate;
Efl.Container.content_count;
Efl.Ui.Direction.direction { get; set; }

View File

@ -224,13 +224,14 @@ _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
Table_Item *ti;
Item_Calc *items, *item;
Efl_Ui_Container_Item_Hints *hints;
int id = 0, i = 0, rows, cols;
int id = 0, i = 0, count, rows, cols;
int (*_efl_ui_table_item_pos_get[2])(Table_Calc *, Item_Calc *, Eina_Bool);
int (*_efl_ui_table_item_size_get[2])(Table_Calc *, Item_Calc *, Eina_Bool);
Table_Calc table_calc;
if (!pd->count)
count = pd->count;
if (!count)
{
efl_gfx_hint_size_restricted_min_set(ui_table, EINA_SIZE2D(0, 0));
return;
@ -249,20 +250,21 @@ _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
memset(table_calc.cell_calc[0], 0, cols * sizeof(Cell_Calc));
memset(table_calc.cell_calc[1], 0, rows * sizeof(Cell_Calc));
items = alloca(pd->count * sizeof(*items));
items = alloca(count * sizeof(*items));
#ifdef DEBUG
memset(items, 0, pd->count * sizeof(*items));
memset(items, 0, count * sizeof(*items));
#endif
table_calc.cols = cols;
table_calc.rows = rows;
// scan all items, get their properties, calculate total weight & min size
EINA_INLIST_FOREACH(pd->items, ti)
EINA_INLIST_FOREACH(EINA_INLIST_GET(pd->items), ti)
{
if (((ti->col + ti->col_span) > cols) ||
((ti->row + ti->row_span) > rows))
{
efl_gfx_entity_visible_set(ti->object, EINA_FALSE);
efl_gfx_entity_geometry_set(ti->object, EINA_RECT(9999, 9999, 0, 0));
count--;
continue;
}
@ -343,7 +345,7 @@ _efl_ui_table_custom_layout(Efl_Ui_Table *ui_table, Efl_Ui_Table_Data *pd)
_efl_ui_table_item_size_get[1] = _efl_ui_table_regular_item_size_get;
}
for (i = 0; i < pd->count; i++)
for (i = 0; i < count; i++)
{
Eina_Rect space, item_geom;
item = &items[i];

View File

@ -25,17 +25,17 @@ struct _Table_Item
Efl_Gfx_Entity *object;
int col_span, row_span;
int col, row;
Eina_Bool linear : 1;
};
struct _Efl_Ui_Table_Data
{
Table_Item *items;
Eo *clipper;
int count;
int cols, rows;
int req_cols, req_rows; // requested - 0 means infinite
int last_col, last_row; // only used by linear apis
int last_col, last_row; // only used by pack api
Efl_Ui_Dir dir1, dir2; // must be orthogonal (H,V or V,H)
struct {
double h, v;
@ -44,6 +44,8 @@ struct _Efl_Ui_Table_Data
struct {
double h, v;
} align;
Eina_Bool cols_recalc : 1;
Eina_Bool rows_recalc : 1;
Eina_Bool linear_recalc : 1;
Eina_Bool homogeneoush : 1;
Eina_Bool homogeneousv : 1;
@ -52,9 +54,8 @@ struct _Efl_Ui_Table_Data
struct _Table_Item_Iterator
{
Eina_Iterator iterator;
Eina_Iterator *real_iterator;
Eina_List *list;
Efl_Ui_Table *object;
Efl_Ui_Table *object;
Eina_Inlist *cur;
};
#endif

View File

@ -1968,325 +1968,6 @@ _propagate_event(void *data EINA_UNUSED, const Efl_Event *eo_event)
}
}
double
_elm_widget_focus_direction_weight_get(const Evas_Object *obj1,
const Evas_Object *obj2,
double degree)
{
Evas_Coord obj_x1, obj_y1, w1, h1, obj_x2, obj_y2, w2, h2;
double x1, yy1, x2, yy2, xx1, yyy1, xx2, yyy2;
double ax, ay, cx, cy;
double weight = -1.0, g = 0.0;
if (obj1 == obj2) return 0.0;
degree -= 90.0;
while (degree >= 360.0)
degree -= 360.0;
while (degree < 0.0)
degree += 360.0;
evas_object_geometry_get(obj1, &obj_x1, &obj_y1, &w1, &h1);
cx = obj_x1 + (w1 / 2.0);
cy = obj_y1 + (h1 / 2.0);
evas_object_geometry_get(obj2, &obj_x2, &obj_y2, &w2, &h2);
/* For overlapping cases. */
if (ELM_RECTS_INTERSECT(obj_x1, obj_y1, w1, h1, obj_x2, obj_y2, w2, h2))
return 0.0;
/* Change all points to relative one. */
x1 = obj_x1 - cx;
xx1 = x1 + w1;
yy1 = obj_y1 - cy;
yyy1 = yy1 + h1;
x2 = obj_x2 - cx;
xx2 = x2 + w2;
yy2 = obj_y2 - cy;
yyy2 = yy2 + h2;
/* Get crossing points (ax, ay) between obj1 and a line extending
* to the direction of current degree. */
if (degree == 0.0)
{
ax = xx1;
ay = 0.0;
}
else if (degree == 90.0)
{
ax = 0.0;
ay = yyy1;
}
else if (degree == 180.0)
{
ax = x1;
ay = 0.0;
}
else if (degree == 270.0)
{
ax = 0.0;
ay = yy1;
}
else
{
g = tan(degree * (M_PI / 180.0));
if ((degree > 0.0) && (degree < 90.0))
{
ay = g * xx1;
if (ay <= yyy1) ax = xx1;
else
{
ax = yyy1 / g;
ay = yyy1;
}
}
else if ((degree > 90.0) && (degree < 180.0))
{
ay = g * x1;
if (ay <= yyy1) ax = x1;
else
{
ax = yyy1 / g;
ay = yyy1;
}
}
else if ((degree > 180.0) && (degree < 270.0))
{
ay = g * x1;
if (ay >= yy1) ax = x1;
else
{
ax = yy1 / g;
ay = yy1;
}
}
else
{
ay = g * xx1;
if (ay >= yy1) ax = xx1;
else
{
ax = yy1 / g;
ay = yy1;
}
}
}
/* Filter obj2, if it is not in the specific derection. */
int i = 0;
double rx[4] = {0.0, 0.0, 0.0, 0.0}, ry[4] = {0.0, 0.0, 0.0, 0.0};
double t1, t2, u1, v1, u2, v2;
if ((degree == 45.0) || (degree == 225.0) || (degree == 135.0) ||
(degree == 315.0))
{
u1 = 1.0;
v1 = 0.0;
u2 = 0.0;
v2 = 1.0;
}
else
{
double g2 = tan((degree + 45.0) * (M_PI / 180.0));
u1 = (-1.0 * g2);
u2 = (1.0 / g2);
v1 = v2 = 1.0;
}
t1 = (u1 * ax) + (v1 * ay);
t2 = (u2 * ax) + (v2 * ay);
#define _R(x) (int)((x + 0.05) * 10.0)
if ((_R(t1 * ((u1 * x2) + (v1 * yy2))) > 0) && (_R(t2 * ((u2 * x2) +
(v2 * yy2))) > 0))
{
rx[i] = x2;
ry[i++] = yy2;
}
if ((_R(t1 * ((u1 * x2) + (v1 * yyy2))) > 0) && (_R(t2 * ((u2 * x2) +
(v2 * yyy2))) > 0))
{
rx[i] = x2;
ry[i++] = yyy2;
}
if ((_R(t1 * ((u1 * xx2) + (v1 * yy2))) > 0) && (_R(t2 * ((u2 * xx2) +
(v2 * yy2))) > 0))
{
rx[i] = xx2;
ry[i++] = yy2;
}
if ((_R(t1 * ((u1 * xx2) + (v1 * yyy2))) > 0) &&
(_R(t2 * ((u2 * xx2) + (v2 * yyy2))) > 0))
{
rx[i] = xx2;
ry[i++] = yyy2;
}
if (i == 0)
{
if (degree == 0.0)
{
if ((_R(xx2) < 0) || (_R(yy2) > 0) || (_R(yyy2) < 0)) return 0.0;
}
else if (degree == 90.0)
{
if ((_R(yyy2) < 0) || (_R(x2) > 0) || (_R(xx2) < 0)) return 0.0;
}
else if (degree == 180.0)
{
if ((_R(x2) > 0) || (_R(yy2) > 0) || (_R(yyy2) < 0)) return 0.0;
}
else if (degree == 270.0)
{
if ((_R(yy2) > 0) || (_R(x2) > 0) || (_R(xx2) < 0)) return 0.0;
}
else
{
if ((_R(g * x2) >= _R(yy2)) && (_R((g * x2)) <= _R(yyy2)))
{
if (!((_R(ax * x2) > 0) && (_R(ay * (g * x2)) > 0)))
return 0.0;
}
else if ((_R(g * xx2) >= _R(yy2)) && (_R((g * xx2)) <= _R(yyy2)))
{
if (!((_R(ax * xx2) > 0) && (_R(ay * (g * xx2)) > 0)))
return 0.0;
}
else if ((_R((1.0 / g) * yy2) >= _R(xx2)) && (_R((1.0 / g) * yy2)
<= _R(xx2)))
{
if (!((_R(ax * ((1.0 / g) * yy2)) > 0)
&& (_R(ay * yy2) > 0)))
return 0.0;
}
else if ((_R((1.0 / g) * yyy2) >= _R(xx2)) &&
(_R((1.0 / g) * yyy2) <= _R(xx2)))
{
if (!((_R(ax * ((1.0 / g) * yyy2)) > 0)
&& (_R(ay * yyy2) > 0))) return 0.0;
}
else return 0.0;
}
}
/* Calculate the weight for obj2. */
if (degree == 0.0)
{
if (_R(xx1) > _R(x2)) weight = -1.0;
else if ((_R(yy2) >= _R(yy1)) && (_R(yyy2) <= _R(yyy1)))
weight = (x2 - xx1) * (x2 - xx1);
else if (_R(yy2) > 0)
weight = ((x2 - xx1) * (x2 - xx1)) + (yy2 * yy2);
else if (_R(yyy2) < 0)
weight = ((x2 - xx1) * (x2 - xx1)) + (yyy2 * yyy2);
else weight = (x2 - xx1) * (x2 - xx1);
}
else if (degree == 90.0)
{
if (_R(yyy1) > _R(yy2)) weight = -1.0;
else if ((_R(x2) >= _R(x1)) && (_R(xx2) <= _R(xx1)))
weight = (yy2 - yyy1) * (yy2 - yyy1);
else if (_R(x2) > 0)
weight = (x2 * x2) + ((yy2 - yyy1) * (yy2 - yyy1));
else if (_R(xx2) < 0)
weight = (xx2 * xx2) + ((yy2 - yyy1) * (yy2 - yyy1));
else weight = (yy2 - yyy1) * (yy2 - yyy1);
}
else if (degree == 180.0)
{
if (_R(x1) < _R(xx2)) weight = -1.0;
else if ((_R(yy2) >= _R(yy1)) && (_R(yyy2) <= _R(yyy1)))
weight = (x1 - xx2) * (x1 - xx2);
else if (_R(yy2) > 0)
weight = ((x1 - xx2) * (x1 - xx2)) + (yy2 * yy2);
else if (_R(yyy2) < 0)
weight = ((x1 - xx2) * (x1 - xx2)) + (yyy2 * yyy2);
else weight = (x1 - xx2) * (x1 - xx2);
}
else if (degree == 270.0)
{
if (_R(yy1) < _R(yyy2)) weight = -1.0;
else if ((_R(x2) >= _R(x1)) && (_R(xx2) <= _R(xx1)))
weight = (yy1 - yyy2) * (yy1 - yyy2);
else if (_R(x2) > 0)
weight = (x2 * x2) + ((yy1 - yyy2) * (yy1 - yyy2));
else if (_R(xx2) < 0)
weight = (xx2 * xx2) + ((yy1 - yyy2) * (yy1 - yyy2));
else weight = (yy1 - yyy2) * (yy1 - yyy2);
}
else
{
int j = 0, k = 0;
double sx[4] = {0.0, 0.0, 0.0, 0.0}, sy[4] = {0.0, 0.0, 0.0, 0.0};
double t_weight[4] = {-1.0, -1.0, -1.0, -1.0};
if ((_R(g * x2) >= _R(yy2)) && (_R(g * x2) <= _R(yyy2)))
{
sx[j] = x2;
sy[j] = g * x2;
t_weight[j++] = ((ax - x2) * (ax - x2)) +
((ay - (g * x2)) * (ay - (g * x2)));
}
if ((_R(g * xx2) >= _R(yy2)) && (_R(g * xx2) <= _R(yyy2)))
{
sx[j] = xx2;
sy[j] = g * xx2;
t_weight[j++] = ((ax - xx2) * (ax - xx2)) +
((ay - (g * xx2)) * (ay - (g * xx2)));
}
if ((_R((1.0 / g) * yy2) >= _R(x2)) && (_R((1.0 / g) * yy2) <= _R(xx2)))
{
sx[j] = (1.0 / g) * yy2;
sy[j] = yy2;
t_weight[j++] =
((ax - ((1.0 / g) * yy2)) * (ax - ((1.0 / g) * yy2))) +
((ay - yy2) * (ay - yy2));
}
if ((_R((1.0 / g) * yyy2) >= _R(x2)) && (_R((1.0 / g) * yyy2)
<= _R(xx2)))
{
sx[j] = (1.0 / g) * yyy2;
sy[j] = yyy2;
t_weight[j++] =
((ax - ((1.0 / g) * yyy2)) * (ax - ((1.0 / g) * yyy2))) +
((ay - yyy2) * (ay - yyy2));
}
if ((j > 2) || ((j == 2) && ((_R(sx[0]) != _R(sx[1])) ||
(_R(sy[0]) != _R(sy[1])))))
{
for (; k < j; k++)
{
if (_R(t_weight[k]) == 0) return -1.0;
if ((1 / weight) < (1 / t_weight[k])) weight = t_weight[k];
}
}
else
{
for (; k < i; k++)
{
double ccx, ccy, t1_weight, x_diff, y_diff;
ccx = ((1.0 / g) * rx[k] + ry[k]) / (g + (1.0 / g));
ccy = g * ccx;
x_diff = rx[k] - ccx;
if (x_diff < 0) x_diff *= -1.0;
y_diff = ry[k] - ccy;
if (y_diff < 0) y_diff *= -1.0;
t1_weight =
(((ax - ccx) * (ax - ccx)) + ((ay - ccy) * (ay - ccy))) +
((x_diff * x_diff * x_diff) + (y_diff * y_diff * y_diff));
if ((_R(t1_weight) != 0) && ((1 / weight) < (1 / t1_weight)))
weight = t1_weight;
}
}
}
/* Return the current object's weight. */
if (weight == -1.0) return 0.0;
if (_R(weight) == 0) return -1.0;
#undef _R
return 1.0 / weight;
}
/** @internal */
EAPI void
elm_widget_parent_highlight_set(Eo *obj, Eina_Bool highlighted)

View File

@ -7547,7 +7547,7 @@ _efl_ui_win_content_set(Eo *obj, Efl_Ui_Win_Data *sd, const char *part, Eo *cont
if (eina_streq(part, "content"))
{
if (sd->content == content) return EINA_TRUE;
if (!elm_widget_sub_object_add(obj, content))
if (content && !elm_widget_sub_object_add(obj, content))
goto err;
/* FIXME: Switch to swallow inside the frame
if (!edje_object_part_swallow(sd->frame_obj, "elm.swallow.client", content))

View File

@ -2115,6 +2115,8 @@ _elm_fileselector_path_set_internal(Evas_Object *obj, const char *_path)
EOLIAN static void
_elm_fileselector_efl_ui_view_model_set(Eo *obj, Elm_Fileselector_Data *sd EINA_UNUSED, Efl_Model *model)
{
if (!efl_isa(model, EFL_IO_MODEL_CLASS))
return ;
_populate(obj, model, NULL, NULL);
}

View File

@ -351,6 +351,9 @@ _elm_fileselector_button_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Elm_Filesele
{
char *file = NULL;
if (!efl_isa(model, EFL_IO_MODEL_CLASS))
return ;
efl_replace(&sd->fsd.model, model);
if (model)

View File

@ -94,7 +94,6 @@ _ACTIVATED_fwd(void *data, const Efl_Event *event)
{
const char *file;
Efl_Model *bmodel, *model;
Eina_Value path;
ELM_FILESELECTOR_ENTRY_DATA_GET(data, sd);
@ -103,12 +102,9 @@ _ACTIVATED_fwd(void *data, const Efl_Event *event)
bmodel = efl_ui_view_model_get(sd->button);
if (bmodel)
{
model = efl_add(efl_class_get(bmodel), NULL);
eina_value_setup(&path, EINA_VALUE_TYPE_STRING);
eina_value_set(&path, file);
efl_model_property_set(model, "path", &path);
eina_value_flush(&path);
efl_ui_view_model_set(sd->button, model);
model = efl_add(efl_class_get(bmodel), sd->button,
efl_io_model_path_set(efl_added, file));
efl_ui_view_model_set(sd->button, model);
}
efl_event_callback_legacy_call
@ -406,6 +402,8 @@ _elm_fileselector_entry_path_set_internal(Evas_Object *obj, const char *path)
EOLIAN static void
_elm_fileselector_entry_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd, Efl_Model *model)
{
if (!efl_isa(model, EFL_IO_MODEL_CLASS))
return ;
efl_ui_view_model_set(sd->button, model);
efl_ui_view_model_set(sd->entry, model);
efl_ui_property_bind(sd->entry, "default", "path");
@ -428,10 +426,10 @@ _elm_fileselector_entry_path_get_internal(const Evas_Object *obj)
}
EOLIAN static Efl_Model *
_elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Elm_Fileselector_Entry_Data *sd)
_elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj, Elm_Fileselector_Entry_Data *sd)
{
Efl_Model *bmodel, *ret;
Eina_Value path;
bmodel = efl_ui_view_model_get(sd->button);
if (!bmodel)
{
@ -439,13 +437,16 @@ _elm_fileselector_entry_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Elm_Fil
return NULL;
}
ret = efl_add(efl_class_get(bmodel), NULL);
free(sd->path);
sd->path = elm_entry_markup_to_utf8(elm_object_text_get(sd->entry));
eina_value_setup(&path, EINA_VALUE_TYPE_STRING);
eina_value_set(&path, sd->path);
efl_model_property_set(ret, "path", &path);
eina_value_flush(&path);
if (!strcmp(sd->path, efl_io_model_path_get(bmodel)))
return bmodel;
ret = efl_add_ref(efl_class_get(bmodel), (Eo*) obj,
efl_io_model_path_set(efl_added, sd->path),
efl_loop_model_volatile_make(efl_added));
eina_freeq_ptr_add(postponed_fq, ret, EINA_FREE_CB(efl_unref), sizeof (void*));
return ret;
}

View File

@ -176,7 +176,7 @@ _on_item_clicked(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
ELM_HOVERSEL_DATA_GET(obj2, sd);
if (item->func) item->func((void *)WIDGET_ITEM_DATA_GET(eo_it), obj2, eo_it);
efl_event_callback_legacy_call(obj2, EFL_UI_EVENT_ITEM_SELECTED, eo_it);
evas_object_smart_callback_call(obj2, "selected", eo_it);
evas_object_event_callback_add(sd->hover, EVAS_CALLBACK_DEL, _auto_update, item);

View File

@ -4688,7 +4688,11 @@ _elm_atspi_bridge_key_filter(void *data, void *loop EINA_UNUSED, int type, void
}
ke = _key_event_info_new(type, key_event, bridge);
if (!ke) return EINA_TRUE;
if (!ke)
{
eldbus_message_unref(req);
return EINA_TRUE;
}
iter = eldbus_message_iter_get(req);
_iter_marshall_key_event(iter, ke);

View File

@ -43,6 +43,8 @@ Eina_Bool _use_build_config;
static Elm_Version _version = { VMAJ, VMIN, VMIC, VREV };
EAPI Elm_Version *elm_version = &_version;
Eina_FreeQ *postponed_fq = NULL;
static void
_focus_ev_redirect_cb(void *data, const Efl_Event *ev EINA_UNUSED)
{
@ -755,6 +757,12 @@ elm_quicklaunch_mode_get(void)
return quicklaunch_on;
}
static void
_postpone_cb(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
eina_freeq_clear(postponed_fq);
}
EAPI int
elm_quicklaunch_init(int argc EINA_UNUSED,
char **argv)
@ -766,6 +774,8 @@ elm_quicklaunch_init(int argc EINA_UNUSED,
_elm_log_dom = eina_log_domain_register("elementary", EINA_COLOR_LIGHTBLUE);
EINA_SAFETY_ON_TRUE_GOTO(_elm_log_dom < 0, fail_eina_log);
postponed_fq = eina_freeq_new(EINA_FREEQ_POSTPONED);
EINA_SAFETY_ON_FALSE_GOTO(eet_init(), fail_eet);
EINA_SAFETY_ON_FALSE_GOTO(ecore_init(), fail_ecore);
EINA_SAFETY_ON_FALSE_GOTO(ecore_event_init(), fail_ecore_event);
@ -812,6 +822,8 @@ elm_quicklaunch_init(int argc EINA_UNUSED,
if (!_elm_lib_dir) _elm_lib_dir = eina_stringshare_add("/");
if (!_property_style_ss) _property_style_ss = eina_stringshare_add("style");
efl_event_callback_add(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE_EXIT, _postpone_cb, NULL);
eina_log_timing(_elm_log_dom, EINA_LOG_STATE_STOP, EINA_LOG_STATE_INIT);
if (quicklaunch_on)
@ -946,6 +958,11 @@ elm_quicklaunch_shutdown(void)
emap_shutdown();
#endif
efl_event_callback_del(efl_main_loop_get(), EFL_LOOP_EVENT_IDLE_EXIT, _postpone_cb, NULL);
eina_freeq_free(postponed_fq);
postponed_fq = NULL;
ecore_file_shutdown();
eio_shutdown();
ecore_event_shutdown();

View File

@ -33,10 +33,25 @@ struct _Elm_Part_Data
EFL_OBJECT_OP_FUNC(efl_ui_widget_default_text_part_get, _ ## type ## _default_text_part_get)
#define ELM_PART_CONTENT_DEFAULT_IMPLEMENT(type, typedata) \
static void \
_ ## type ## _invalidated_cb(void *data, const Efl_Event *ev EINA_UNUSED) \
{ \
efl_content_set(data, NULL); \
} \
\
EOLIAN static Eina_Bool \
_ ## type ## _efl_content_content_set(Eo *obj, typedata *sd EINA_UNUSED, Evas_Object *content) \
{ \
return efl_content_set(efl_part(obj, efl_ui_widget_default_content_part_get(obj)), content); \
Eina_Bool result; \
Efl_Ui_Widget *former; \
former = efl_content_get(efl_part(obj, efl_ui_widget_default_content_part_get(obj))); \
if (former) \
efl_event_callback_del(former, EFL_EVENT_INVALIDATE, _ ## type ## _invalidated_cb, obj); \
result = efl_content_set(efl_part(obj, efl_ui_widget_default_content_part_get(obj)), content); \
if (content && result) \
efl_event_callback_add(content, EFL_EVENT_INVALIDATE, _ ## type ## _invalidated_cb, obj); \
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, result ? content : NULL); \
return result; \
} \
\
EOLIAN static Evas_Object* \
@ -48,7 +63,11 @@ struct _Elm_Part_Data
EOLIAN static Evas_Object* \
_ ## type ## _efl_content_content_unset(Eo *obj, typedata *sd EINA_UNUSED) \
{ \
return efl_content_unset(efl_part(obj, efl_ui_widget_default_content_part_get(obj))); \
Eo *result = efl_content_unset(efl_part(obj, efl_ui_widget_default_content_part_get(obj))); \
if (result) \
efl_event_callback_del(result, EFL_EVENT_INVALIDATE, _ ## type ## _invalidated_cb, obj); \
efl_event_callback_call(obj, EFL_CONTENT_EVENT_CONTENT_CHANGED, NULL); \
return result; \
}
static inline Eo *

View File

@ -907,6 +907,8 @@ extern Eina_Stringshare *_property_style_ss;
extern Eina_Bool _config_profile_lock;
extern Eina_FreeQ *postponed_fq;
# ifdef HAVE_ELEMENTARY_WL2
extern Ecore_Wl2_Display *_elm_wl_display;
# endif

View File

@ -41,7 +41,6 @@ _logind_device_pause_complete(Elput_Manager *em, uint32_t major, uint32_t minor)
if (!msg)
{
ERR("Could not create method call for proxy");
eldbus_message_unref(msg);
return;
}

View File

@ -12,16 +12,21 @@
# For now loaders and savers are ALWAYS build statically.
#
rel_evas_modules = join_paths('..', '..', '..', 'modules', 'evas', 'engines', 'software_generic')
evas_deps = [eo, eet, eina, efl, emile, ector, ecore, buildsystem, intl]
pub_eo_file_target = []
priv_eo_files = []
evas_include_directories = []
pub_eo_files = []
pub_evas_eo_files = []
pub_evas_eot_files = []
pub_legacy_eo_files = [
]
evas_src = []
subdir('software_generic')
foreach eo_file : pub_legacy_eo_files
pub_eo_file_target += custom_target('eolian_gen_' + eo_file,
@ -37,15 +42,11 @@ foreach eo_file : pub_legacy_eo_files
'-gchd', '@INPUT@'])
endforeach
pub_eo_files = [
]
foreach eo_file : pub_eo_files
pub_eo_file_target += custom_target('eolian_gen_' + eo_file,
pub_eo_file_target += custom_target('eolian_gen_' + eo_file.underscorify(),
input : eo_file,
output : [eo_file + '.h'],
depfile : eo_file + '.d',
output : [eo_file.underscorify() + '.h'],
depfile : eo_file.underscorify() + '.d',
install : true,
install_dir : dir_package_include,
command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories,
@ -75,6 +76,8 @@ endforeach
eolian_include_directories += ['-I', meson.current_source_dir()]
evas_src += pub_eo_file_target
evas_header_src = [
'Evas.h',
'Evas_Common.h',
@ -84,7 +87,7 @@ evas_header_src = [
'Evas_Loader.h',
]
evas_include_directories = [
evas_include_directories += [
include_directories('.'),
include_directories('common'),
include_directories('common3d'),
@ -94,7 +97,7 @@ evas_include_directories = [
vg_common_inc_dir
]
evas_src = [
evas_src += [
'main.c'
]
@ -165,7 +168,7 @@ if get_option('opengl') != 'none'
endif
evas_pre = declare_dependency(
include_directories: evas_include_directories + [vg_common_inc_dir],
include_directories: evas_include_directories + [vg_common_inc_dir] + [include_directories(join_paths('..', '..', 'modules', 'evas', 'engines', 'buffer'))],
sources : pub_eo_file_target + priv_eo_file_target,
dependencies: [eina, eo, ector, emile, evas_deps, m],
)

View File

@ -1,6 +1,6 @@
engine_include_dir += include_directories('.')
evas_include_directories += include_directories(join_paths('..', rel_evas_modules, 'filters'))
engine_src += files([
raw_evas_src = [
'evas_engine_filter.h',
'evas_filter_blend.c',
'evas_filter_blur.c',
@ -10,4 +10,8 @@ engine_src += files([
'evas_filter_fill.c',
'evas_filter_mask.c',
'evas_filter_transform.c',
])
]
foreach file : raw_evas_src
evas_src += files(join_paths('..', rel_evas_modules, 'filters', file))
endforeach

View File

@ -0,0 +1,36 @@
raw_evas_src = [
'evas_engine.c',
'Evas_Engine_Software_Generic.h',
'Evas_Engine_Software_Shared.h',
'evas_native_tbm.c',
'evas_native_dmabuf.c',
'evas_ector_software_buffer.c',
'evas_native_common.h',
'evas_ector_software.h',
]
gen_src = []
raw_pub_eo_files = [
'evas_ector_software_buffer.eo'
]
foreach eo_file : raw_pub_eo_files
pub_eo_file_target += custom_target('eolian_gen_' + eo_file.underscorify(),
input : join_paths(rel_evas_modules, eo_file),
output : [eo_file + '.h'],
depfile : eo_file + '.d',
install : true,
install_dir : dir_package_include,
command : eolian_gen + [ '-I', join_paths(meson.current_source_dir(), rel_evas_modules), eolian_include_directories,
'-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'),
'-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'),
'-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'),
'-gchd', '@INPUT@'])
endforeach
foreach file : raw_evas_src
evas_src += files(join_paths(rel_evas_modules, file))
endforeach
subdir('filters')

View File

@ -3,7 +3,7 @@ engine_deps = [ecore_input, ecore_ipc]
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, ecore_evas, ecore_input_evas] + engine_deps,
dependencies : [eina, ecore_evas, ecore_input_evas, rt] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -4,7 +4,7 @@ mod_src = files([
'ibus_imcontext.h'
])
mod_deps = [ecore, ecore_imf, ecore_x, dependency('ibus-1.0'), dependency('glib-2.0'), ecore_evas]
mod_deps = [ecore, ecore_imf, ecore_x, ecore_x_deps, dependency('ibus-1.0'), dependency('glib-2.0'), ecore_evas]
shared_module(mod_name,
mod_src,

View File

@ -9,7 +9,7 @@ if not scim_dep.found()
scim_dep = dependency('scim-1.0')
endif
mod_deps = [ecore, ecore_imf, ecore_x, ecore_evas, scim_dep, dependency('glib-2.0')]
mod_deps = [ecore, ecore_imf, ecore_x, ecore_x_deps, ecore_evas, scim_dep, dependency('glib-2.0')]
shared_module(mod_name,
mod_src,

View File

@ -2,7 +2,7 @@ mod_src = files([
'ecore_imf_xim.c',
])
mod_deps = [ecore, ecore_imf, ecore_input, ecore_x, ecore_evas]
mod_deps = [ecore, ecore_imf, ecore_input, ecore_x, ecore_x_deps, ecore_evas]
shared_module(mod_name,
mod_src,

View File

@ -13,10 +13,10 @@ install_headers('Evas_Engine_Buffer.h',
install_dir : dir_package_include,
)
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -7,10 +7,10 @@ engine_src = files([
engine_deps = [ecore_drm2, libdrm]
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -9,10 +9,10 @@ engine_src = files([
engine_deps = [ecore_fb]
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -7,10 +7,10 @@ engine_src = files([
engine_deps = [ecore_cocoa, gl_deps]
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -1,45 +0,0 @@
engine_src = files([
'evas_gl_private.h',
'evas_gl_common.h',
'evas_gl_define.h',
'evas_gl_context.c',
'evas_gl_file_cache.c',
'evas_gl_shader.c',
'evas_gl_rectangle.c',
'evas_gl_texture.c',
'evas_gl_preload.c',
'evas_gl_image.c',
'evas_gl_font.c',
'evas_gl_polygon.c',
'evas_gl_line.c',
'evas_gl_core.c',
'evas_gl_api_ext.h',
'evas_gl_api_ext_def.h',
'evas_gl_core.h',
'evas_gl_core_private.h',
'evas_gl_api.c',
'evas_gl_api_def.h',
'evas_gl_api_gles1.c',
'evas_gl_api_gles3_def.h',
'evas_gl_api_ext.c',
'evas_gl_3d_common.h',
'evas_gl_3d_private.h',
'evas_gl_3d.c',
'evas_gl_3d_renderer.c',
'evas_gl_3d_shader.c',
#join_paths('shader_3d', 'evas_gl_3d_shaders.x'),
#join_paths('shader','evas_gl_shaders.x'),
])
engine_deps = [gl_deps]
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension
)
module_files += join_paths(mod_install_dir, 'lib'+mod_full_name + '.' + sys_mod_extension)
endif

View File

@ -7,10 +7,10 @@ engine_src = files([
engine_deps = [ecore_drm2, libdrm, gl_deps, dependency('gbm')]
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -13,7 +13,40 @@ engine_src = files([
join_paths('filters','gl_filter_fill.c'),
join_paths('filters','gl_filter_mask.c'),
])
common_engine_src = [
'evas_gl_private.h',
'evas_gl_common.h',
'evas_gl_define.h',
'evas_gl_context.c',
'evas_gl_file_cache.c',
'evas_gl_shader.c',
'evas_gl_rectangle.c',
'evas_gl_texture.c',
'evas_gl_preload.c',
'evas_gl_image.c',
'evas_gl_font.c',
'evas_gl_polygon.c',
'evas_gl_line.c',
'evas_gl_core.c',
'evas_gl_api_ext.h',
'evas_gl_api_ext_def.h',
'evas_gl_core.h',
'evas_gl_core_private.h',
'evas_gl_api.c',
'evas_gl_api_def.h',
'evas_gl_api_gles1.c',
'evas_gl_api_gles3_def.h',
'evas_gl_api_ext.c',
'evas_gl_3d_common.h',
'evas_gl_3d_private.h',
'evas_gl_3d.c',
'evas_gl_3d_renderer.c',
'evas_gl_3d_shader.c',
]
foreach src : common_engine_src
engine_src += files(join_paths('..','gl_common', src))
endforeach
pub_eo_files = [
'evas_ector_gl_buffer.eo',
@ -32,14 +65,14 @@ foreach eo_file : pub_eo_files
'-gchd', '@INPUT@'])
endforeach
engine_deps = [gl_common]
engine_deps = [gl_deps]
engine_include_dir = include_directories(join_paths('..','software_generic'))
engine_include_dir = include_directories(join_paths('..','software_generic'), join_paths('..', 'gl_common'))
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps + [software_generic],
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -7,10 +7,10 @@ engine_src = files([
engine_deps = [ecore_x_deps, gl_deps]
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -0,0 +1,72 @@
engines = [
['buffer', []],
['fb', ['fb']],
['drm', ['drm']],
['software_x11', ['x11']],
['wayland_shm', ['wl']],
]
if get_option('opengl') != 'none'
engines += [
['gl_generic', []],
['gl_x11', ['x11']],
['gl_drm', ['drm']],
['gl_cocoa', ['cocoa']],
]
endif
if get_option('opengl') == 'es-egl'
engines += [['wayland_egl', ['wl']]]
endif
foreach engine_conf : engines
engine = engine_conf[0]
build = true
if engine_conf[1].length() > 0
build = get_option(engine_conf[1][0])
endif
if build
engine_include_dir = []
engine_src = []
engine_deps = []
engine_dep = declare_dependency(
include_directories: include_directories(engine),
)
var_name = 'engine_'+engine
set_variable(var_name, engine_dep)
mod_full_name = engine
mod_install_dir = join_paths(dir_package_modules, 'engines', engine, version_name)
subdir(engine)
if get_option('evas-modules') == 'static'
tmp = static_library(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
)
evas_static_list += declare_dependency(
include_directories: [include_directories('.')] + config_dir + [engine_include_dir],
link_with: tmp,
dependencies : [eina, evas_pre] + engine_deps,
sources : engine_src
)
if engine == 'gl_generic'
#special case, see evas_module.c
config_h.set('EVAS_STATIC_BUILD_GL_COMMON', '1')
else
config_h.set('EVAS_STATIC_BUILD_'+engine.to_upper(), '1')
endif
else
#nothing here shared building is handled directly on the engine configuration side
#reason for this is that the .so files have to be placed in the correct directory in order
# to make them discoverable by evas module code
endif
config_h.set('BUILD_ENGINE_'+engine.to_upper(), '1')
endif
endforeach
config_h.set('EVAS_STATIC_BUILD_SOFTWARE_GENERIC', '1')
config_h.set('BUILD_ENGINE_SOFTWARE_GENERIC', '1')

View File

@ -9,10 +9,10 @@ engine_src = files([
engine_deps = []
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -9,10 +9,10 @@ engine_src = files([
engine_deps = []
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -1,45 +0,0 @@
engine_src = files([
'evas_engine.c',
'Evas_Engine_Software_Generic.h',
'Evas_Engine_Software_Shared.h',
'evas_native_tbm.c',
'evas_native_dmabuf.c',
'evas_ector_software_buffer.c',
'evas_native_common.h',
'evas_ector_software.h',
])
gen_src = []
pub_eo_files = [
'evas_ector_software_buffer.eo'
]
subdir('filters')
foreach eo_file : pub_eo_files
gen_src += custom_target('eolian_gen_' + eo_file,
input : eo_file,
output : [eo_file + '.h'],
depfile : eo_file + '.d',
command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories,
'-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'),
'-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'),
'-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'),
'-gchd', '@INPUT@'])
endforeach
engine_src += gen_src
engine_deps = [draw, dl]
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension
)
module_files += join_paths(mod_install_dir, 'lib'+mod_full_name + '.' + sys_mod_extension)
endif

View File

@ -28,10 +28,10 @@ config_h.set('BUILD_ENGINE_SOFTWARE_XLIB', '1')
#it looks weird but is right, gl_deps is needed for evas_x_egl.c
engine_deps = [x11, ecore_x, ecore_x_deps, gl_deps]
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -9,10 +9,10 @@ engine_deps = [ecore_wl2, dependency('wayland-egl'), gl_deps]
engine_include_dir = include_directories(join_paths('..','wayland_common'))
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -8,10 +8,10 @@ engine_deps = [ecore_wl2]
engine_include_dir = include_directories(join_paths('..','wayland_common'))
if get_option('evas-modules') == 'shared' and not evas_force_static.contains(engine)
if get_option('evas-modules') == 'shared'
shared_module(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
dependencies : [eina, evas] + engine_deps,
install : true,
install_dir : mod_install_dir,
name_suffix : sys_mod_extension

View File

@ -73,6 +73,15 @@ evas_image_load_file_head_wbmp(void *loader_data,
position++; /* skipping one byte */
if (read_mb(&w, map, length, &position) < 0) goto bail;
if (read_mb(&h, map, length, &position) < 0) goto bail;
/* Wbmp header identifier is too weak....
Here checks size validation whether it's acutal wbmp or not. */
if ((((w * h) + 7) >> 3) + position != length)
{
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
goto bail;
}
if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
IMG_TOO_BIG(w, h))
{
@ -116,11 +125,20 @@ evas_image_load_file_data_wbmp(void *loader_data,
if (!map) goto bail;
if (read_mb(&type, map, length, &position) < 0) goto bail;
if (type != 0)
{
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
goto bail;
}
position++; /* skipping one byte */
if (read_mb(&w, map, length, &position) < 0) goto bail;
if (read_mb(&h, map, length, &position) < 0) goto bail;
if (type != 0)
/* Wbmp header identifier is too weak....
Here checks size validation whether it's acutal wbmp or not. */
if ((((w * h) + 7) >> 3) + position != length)
{
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
goto bail;
@ -145,7 +163,6 @@ evas_image_load_file_data_wbmp(void *loader_data,
for (y = 0; y < (int)prop->h; y++)
{
if (position + line_length > length) goto bail;
line = ((unsigned char*) map) + position;
position += line_length;
for (x = 0; x < (int)prop->w; x++)

View File

@ -1,30 +1,3 @@
engines = [
['buffer', []],
['software_generic', []],
['fb', ['fb']],
['drm', ['drm']],
['software_x11', ['x11']],
['wayland_shm', ['wl']],
]
if get_option('opengl') != 'none'
engines += [
['gl_common', []],
['gl_generic', []],
['gl_x11', ['x11']],
['gl_drm', ['drm']],
['gl_cocoa', ['cocoa']],
]
endif
if get_option('opengl') == 'es-egl'
engines += [['wayland_egl', ['wl']]]
endif
#there are a few modules that should NEVER be build as a module but rather be build as static lib and linked in later
evas_force_static = ['software_generic', 'gl_common']
evas_static_list = []
#fixed dependencies by efl
png = dependency('libpng')
tiff = dependency('libtiff-4')
@ -32,74 +5,12 @@ giflib = cc.find_library('gif')
json = dependency('rlottie', required: get_option('evas-loaders-disabler').contains('json') == false)
webp = dependency('libwebp', required: get_option('evas-loaders-disabler').contains('webp') == false)
#there are a few modules that should NEVER be build as a module but rather be build as static lib and linked in later
evas_static_list = []
subdir('image_loaders')
subdir('image_savers')
subdir('model_savers')
subdir('model_loaders')
subdir('vg_savers')
subdir('vg_loaders')
foreach engine_conf : engines
engine = engine_conf[0]
build = true
if engine_conf[1].length() > 0
build = get_option(engine_conf[1][0])
endif
if build
engine_include_dir = []
engine_src = []
engine_deps = []
engine_dep = declare_dependency(
include_directories: include_directories(join_paths('engines', engine)),
)
var_name = 'engine_'+engine
set_variable(var_name, engine_dep)
mod_full_name = engine
mod_install_dir = join_paths(dir_package_modules, 'engines', engine, version_name)
subdir(join_paths('engines', engine))
if get_option('evas-modules') == 'static' or evas_force_static.contains(engine)
tmp = static_library(mod_full_name, engine_src,
include_directories : config_dir + [engine_include_dir],
dependencies : [eina, evas_pre] + engine_deps,
)
if engine == 'software_generic'
software_generic = declare_dependency(
include_directories: engine_include_dir,
sources : gen_src,
dependencies : [eina, evas_pre] + engine_deps,
link_with : tmp
)
endif
if engine == 'gl_common'
#gl_common will only be used by gl_generic, NOT by libevas.so, so we work arround the static list
gl_common = declare_dependency(
include_directories : include_directories(join_paths('engines', 'gl_common')),
link_with: tmp,
)
else
evas_static_list += declare_dependency(
include_directories: [include_directories('.')] + config_dir + [engine_include_dir],
link_with: tmp,
dependencies : [eina, evas_pre] + engine_deps,
sources : engine_src
)
if engine == 'gl_generic'
#special case, see evas_module.c
config_h.set('EVAS_STATIC_BUILD_GL_COMMON', '1')
else
config_h.set('EVAS_STATIC_BUILD_'+engine.to_upper(), '1')
endif
endif
else
#nothing here shared building is handled directly on the engine configuration side
#reason for this is that the .so files have to be placed in the correct directory in order
# to make them discoverable by evas module code
endif
config_h.set('BUILD_ENGINE_'+engine.to_upper(), '1')
endif
endforeach

View File

@ -1412,6 +1412,7 @@ class Dummy.Test_Object extends Efl.Object implements Dummy.Test_Iface {
}
implements {
Efl.Object.constructor;
Efl.Object.destructor;
Efl.Object.provider_find;
Dummy.Test_Iface.emit_nonconflicted;
Dummy.Test_Iface.iface_prop { get; set; }

View File

@ -162,6 +162,30 @@ _dummy_test_object_efl_object_constructor(Eo *obj, Dummy_Test_Object_Data *pd)
return obj;
}
static void
_dummy_test_object_efl_object_destructor(Eo *obj, Dummy_Test_Object_Data *pd)
{
if (pd->stored_value)
{
eina_value_free(pd->stored_value);
pd->stored_value = NULL;
}
if (pd->promise)
{
eina_promise_reject(pd->promise, ECANCELED);
pd->promise = NULL;
}
if (pd->list_for_accessor)
{
eina_list_free(pd->list_for_accessor);
pd->list_for_accessor = NULL;
}
efl_destructor(efl_super(obj, DUMMY_TEST_OBJECT_CLASS));
}
Efl_Object *_dummy_test_object_return_object(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
{
return obj;
@ -3700,11 +3724,11 @@ void _dummy_test_object_set_value_ptr_own(EINA_UNUSED Eo *obj, Dummy_Test_Object
void _dummy_test_object_set_value(EINA_UNUSED Eo *obj, Dummy_Test_Object_Data *pd, Eina_Value value)
{
if (pd->stored_value) {
eina_value_free(pd->stored_value);
} else {
pd->stored_value = eina_value_new(EINA_VALUE_TYPE_INT);
}
if (pd->stored_value)
eina_value_free(pd->stored_value);
pd->stored_value = eina_value_new(EINA_VALUE_TYPE_INT);
eina_value_copy(&value, pd->stored_value);
}
@ -3922,7 +3946,6 @@ int _dummy_test_object_dummy_test_iface_iface_prop_get(EINA_UNUSED const Eo *obj
Eo * _dummy_test_object_efl_object_provider_find(EINA_UNUSED const Eo *obj, Dummy_Test_Object_Data *pd, const Efl_Class *klass)
{
EINA_LOG_ERR("klass: %p, NUMBERWRAPPER: %p", klass, DUMMY_NUMBERWRAPPER_CLASS);
if (klass == DUMMY_NUMBERWRAPPER_CLASS)
return pd->provider;
else if (klass == DUMMY_TEST_IFACE_INTERFACE)
@ -3932,13 +3955,11 @@ Eo * _dummy_test_object_efl_object_provider_find(EINA_UNUSED const Eo *obj, Dumm
Efl_Object *_dummy_test_object_call_find_provider(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd, const Efl_Class *type)
{
printf("CALLING FIND PROVIDER FROM C");
return efl_provider_find(obj, type);
}
Efl_Object *_dummy_test_object_call_find_provider_for_iface(Eo *obj, EINA_UNUSED Dummy_Test_Object_Data *pd)
{
printf("CALLING FIND PROVIDER FROM C");
return efl_provider_find(obj, DUMMY_TEST_IFACE_INTERFACE);
}

View File

@ -251,9 +251,7 @@ layout_setup()
{
win = win_add();
layout = efl_add(EFL_UI_TABLE_CLASS, win,
efl_pack_align_set(efl_added, 0.8, 0.2),
efl_ui_direction_set(efl_added, EFL_UI_DIR_VERTICAL));
layout = efl_add(EFL_UI_TABLE_CLASS, win);
}
static void
@ -281,6 +279,9 @@ EFL_START_TEST (efl_ui_table_layout_update)
{
int i, max_index = (sizeof(hints) / sizeof(Hint));
efl_pack_align_set(layout, 0.8, 0.2);
efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL);
Eo *btn = efl_add(EFL_UI_BUTTON_CLASS, layout,
efl_pack_table(layout, efl_added, 0, 0, 1, 1));
@ -297,6 +298,9 @@ EFL_START_TEST (efl_ui_table_layout_update_pack)
int i, max_index2, max_index3;
Eo *btn, *btn2, *btn3;
efl_pack_align_set(layout, 0.8, 0.2);
efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL);
max_index2 = ((sizeof(hints2) / sizeof(Hint)) / 2);
max_index3 = ((sizeof(hints3) / sizeof(Hint)) / 3);
@ -333,6 +337,9 @@ EFL_START_TEST (efl_ui_table_layout_update_matrix)
int i, j, max_index = (sizeof(hints_matrix) / sizeof(Hint));
Eo *btn[9];
efl_pack_align_set(layout, 0.8, 0.2);
efl_ui_direction_set(layout, EFL_UI_DIR_VERTICAL);
efl_gfx_hint_margin_set(layout, 10, 10, 20, 20);
efl_ui_table_homogeneous_set(layout, 0, 1);
efl_pack_padding_set(layout, 10, 5, 0);
@ -419,6 +426,143 @@ EFL_START_TEST (efl_ui_table_size)
}
EFL_END_TEST
EFL_START_TEST (efl_ui_table_pack_table)
{
#define BTN_NUM 3
Eo *o, *btn[BTN_NUM];
Eina_Iterator *itr;
int i, cols, rows;
for (i = 0; i < BTN_NUM; i++)
btn[i] = efl_add(EFL_UI_BUTTON_CLASS, layout);
//pack test
ck_assert(efl_pack(layout, btn[0]));
ck_assert_ptr_eq(efl_pack_table_content_get(layout, 0, 0), btn[0]);
efl_pack_table_size_get(layout, &cols, &rows);
ck_assert_int_eq(cols, 1);
ck_assert_int_eq(rows, 1);
ck_assert(efl_pack_table(layout, btn[1], 6, 0, 1, 1));
ck_assert_ptr_eq(efl_pack_table_content_get(layout, 6, 0), btn[1]);
efl_pack_table_size_get(layout, &cols, &rows);
ck_assert_int_eq(cols, 7);
ck_assert_int_eq(rows, 1);
ck_assert(efl_pack(layout, btn[2]));
ck_assert_ptr_eq(efl_pack_table_content_get(layout, 7, 0), btn[2]);
efl_pack_table_size_get(layout, &cols, &rows);
ck_assert_int_eq(cols, 8);
ck_assert_int_eq(rows, 1);
ck_assert_int_eq(efl_content_count(layout), BTN_NUM);
i = 0;
itr = efl_content_iterate(layout);
EINA_ITERATOR_FOREACH(itr, o)
{
ck_assert_ptr_eq(o, btn[i++]);
}
eina_iterator_free(itr);
//unpack test
ck_assert(efl_pack_unpack(layout, btn[2]));
ck_assert(!efl_pack_unpack(layout, btn[2]));
efl_pack_unpack_all(layout);
ck_assert_int_eq(efl_content_count(layout), 0);
ck_assert(!efl_invalidated_get(btn[0]));
for (i = 0; i < BTN_NUM; i++)
efl_pack(layout, btn[i]);
efl_pack_clear(layout);
ck_assert_int_eq(efl_content_count(layout), 0);
ck_assert(efl_invalidated_get(btn[0]));
#undef BTN_NUM
}
EFL_END_TEST
EFL_START_TEST (efl_ui_table_properties)
{
double h, v;
Eina_Bool b;
Eina_Bool homogeneoush, homogeneousv;
Efl_Ui_Dir dirh, dirv;
//align test
efl_pack_align_get(layout, &h, &v);
ck_assert(EINA_DBL_EQ(h, 0.5));
ck_assert(EINA_DBL_EQ(v, 0.5));
efl_pack_align_set(layout, 0.3, 0.8234);
efl_pack_align_get(layout, &h, &v);
ck_assert(EINA_DBL_EQ(h, 0.3));
ck_assert(EINA_DBL_EQ(v, 0.8234));
efl_pack_align_set(layout, -0.23, 123);
efl_pack_align_get(layout, &h, &v);
ck_assert(EINA_DBL_EQ(h, -1));
ck_assert(EINA_DBL_EQ(v, 1));
//padding test
efl_pack_padding_get(layout, &h, &v, &b);
ck_assert(EINA_DBL_EQ(h, 0.0));
ck_assert(EINA_DBL_EQ(v, 0.0));
ck_assert_int_eq(b, 0);
efl_pack_padding_set(layout, 0.3, 0.8234, 1);
efl_pack_padding_get(layout, &h, &v, &b);
ck_assert(EINA_DBL_EQ(h, 0.3));
ck_assert(EINA_DBL_EQ(v, 0.8234));
ck_assert_int_eq(b, 1);
efl_pack_padding_set(layout, -1.23, 123, 45);
efl_pack_padding_get(layout, &h, &v, &b);
ck_assert(EINA_DBL_EQ(h, 0));
ck_assert(EINA_DBL_EQ(v, 123));
ck_assert_int_eq(b, 1);
//direction test
efl_pack_table_direction_get(layout, &dirh, &dirv);
ck_assert_int_eq(dirh, EFL_UI_DIR_RIGHT);
ck_assert_int_eq(dirv, EFL_UI_DIR_DOWN);
efl_pack_table_direction_set(layout, EFL_UI_DIR_VERTICAL, EFL_UI_DIR_HORIZONTAL);
efl_pack_table_direction_get(layout, &dirh, &dirv);
ck_assert_int_eq(dirh, EFL_UI_DIR_VERTICAL);
ck_assert_int_eq(dirv, EFL_UI_DIR_HORIZONTAL);
efl_pack_table_direction_set(layout, EFL_UI_DIR_RIGHT, EFL_UI_DIR_RIGHT);
efl_pack_table_direction_get(layout, &dirh, &dirv);
ck_assert_int_eq(dirh, EFL_UI_DIR_RIGHT);
ck_assert_int_eq(dirv, EFL_UI_DIR_DOWN);
ck_assert_int_eq(efl_ui_direction_get(layout), EFL_UI_DIR_RIGHT);
efl_ui_direction_set(layout, EFL_UI_DIR_DEFAULT);
ck_assert_int_eq(efl_ui_direction_get(layout), EFL_UI_DIR_RIGHT);
efl_ui_direction_set(layout, EFL_UI_DIR_HORIZONTAL);
ck_assert_int_eq(efl_ui_direction_get(layout), EFL_UI_DIR_HORIZONTAL);
//homogeneous test
efl_ui_table_homogeneous_get(layout, &homogeneoush, &homogeneousv);
ck_assert_int_eq(homogeneoush, 0);
ck_assert_int_eq(homogeneousv, 0);
efl_ui_table_homogeneous_set(layout, 123, -123);
efl_ui_table_homogeneous_get(layout, &homogeneoush, &homogeneousv);
ck_assert_int_eq(homogeneoush, 1);
ck_assert_int_eq(homogeneousv, 1);
efl_ui_table_homogeneous_set(layout, 1, 0);
efl_ui_table_homogeneous_get(layout, &homogeneoush, &homogeneousv);
ck_assert_int_eq(homogeneoush, 1);
ck_assert_int_eq(homogeneousv, 0);
}
EFL_END_TEST
void efl_ui_test_table(TCase *tc)
{
tcase_add_checked_fixture(tc, layout_setup, layout_teardown);
@ -427,4 +571,6 @@ void efl_ui_test_table(TCase *tc)
tcase_add_test(tc, efl_ui_table_layout_update);
tcase_add_test(tc, efl_ui_table_layout_update_pack);
tcase_add_test(tc, efl_ui_table_layout_update_matrix);
tcase_add_test(tc, efl_ui_table_pack_table);
tcase_add_test(tc, efl_ui_table_properties);
}

View File

@ -0,0 +1,114 @@
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif
#include <Efl_Ui.h>
#include "efl_ui_spec_suite.h"
#include "suite_helpers.h"
EFL_START_TEST(content_set_get)
{
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
ck_assert_int_eq(efl_content_set(widget, w), EINA_TRUE);
ck_assert_ptr_eq(efl_ui_widget_parent_get(w), widget);
ck_assert_ptr_eq(efl_content_get(widget), w);
EXPECT_ERROR_START;
ck_assert_int_eq(efl_content_set(widget, (void*)0x1), EINA_FALSE);
EXPECT_ERROR_END;
ck_assert_ptr_eq(efl_content_get(widget), NULL);
}
EFL_END_TEST
EFL_START_TEST(content_set_get2)
{
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
ck_assert_int_eq(efl_content_set(widget, w), EINA_TRUE);
ck_assert_ptr_eq(efl_ui_widget_parent_get(w), widget);
ck_assert_ptr_eq(efl_content_get(widget), w);
ck_assert_int_eq(efl_content_set(widget, NULL), EINA_TRUE);
ck_assert_ptr_eq(efl_content_get(widget), NULL);
}
EFL_END_TEST
EFL_START_TEST(content_unset)
{
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
ck_assert_int_eq(efl_content_set(widget, w), EINA_TRUE);
efl_content_unset(widget);
ck_assert_ptr_eq(efl_content_get(widget), NULL);
}
EFL_END_TEST
EFL_START_TEST(content_lifetime1)
{
Efl_Ui_Widget *w1 = efl_add(WIDGET_CLASS, win);
efl_wref_add(w1, &w1);
ck_assert_int_eq(efl_content_set(widget, w1), EINA_TRUE);
efl_del(widget);
ck_assert_ptr_eq(w1, NULL);
}
EFL_END_TEST
EFL_START_TEST(content_lifetime2)
{
Efl_Ui_Widget *w1 = efl_add(WIDGET_CLASS, win), *w2 = efl_add(WIDGET_CLASS, win);
efl_wref_add(w2, &w2);
efl_wref_add(w1, &w1);
ck_assert_int_eq(efl_content_set(widget, w1), EINA_TRUE);
ck_assert_int_eq(efl_content_set(widget, w2), EINA_TRUE);
ck_assert_ptr_eq(w1, NULL);
efl_del(widget);
ck_assert_ptr_eq(w2, NULL);
}
EFL_END_TEST
EFL_START_TEST(content_lifetime3)
{
Efl_Ui_Widget *w1 = efl_add(WIDGET_CLASS, win);
Eina_Bool content_changed_event = EINA_FALSE;
ck_assert_int_eq(efl_content_set(widget, w1), EINA_TRUE);
efl_test_container_expect_evt_content_added(widget, EFL_CONTENT_EVENT_CONTENT_CHANGED, &content_changed_event, NULL);
efl_del(w1);
ck_assert_int_eq(content_changed_event, EINA_TRUE);
ck_assert_ptr_eq(efl_content_get(widget), NULL);
}
EFL_END_TEST
EFL_START_TEST(content_event)
{
Efl_Ui_Widget *w1 = efl_add(WIDGET_CLASS, win), *w2 = efl_add(WIDGET_CLASS, win);
Eina_Bool content_changed_event;
content_changed_event = EINA_FALSE;
efl_test_container_expect_evt_content_added(widget, EFL_CONTENT_EVENT_CONTENT_CHANGED, &content_changed_event, w1);
ck_assert_int_eq(efl_content_set(widget, w1), EINA_TRUE);
ck_assert_int_eq(content_changed_event, EINA_TRUE);
content_changed_event = EINA_FALSE;
efl_test_container_expect_evt_content_added(widget, EFL_CONTENT_EVENT_CONTENT_CHANGED, &content_changed_event, w2);
ck_assert_int_eq(efl_content_set(widget, w2), EINA_TRUE);
ck_assert_int_eq(content_changed_event, EINA_TRUE);
}
EFL_END_TEST
void
efl_content_behavior_test(TCase *tc)
{
tcase_add_test(tc, content_set_get);
tcase_add_test(tc, content_set_get2);
tcase_add_test(tc, content_lifetime1);
tcase_add_test(tc, content_lifetime2);
tcase_add_test(tc, content_lifetime3);
tcase_add_test(tc, content_unset);
tcase_add_test(tc, content_event);
}

View File

@ -2,6 +2,7 @@
# include "elementary_config.h"
#endif
#include <Elementary.h>
#include <Efl_Ui.h>
#include "efl_ui_spec_suite.h"
#include "suite_helpers.h"

View File

@ -12,7 +12,7 @@ extern Evas_Object *widget;
void efl_pack_behavior_test(TCase *tc);
void efl_pack_linear_behavior_test(TCase *tc);
void efl_content_behavior_test(TCase *tc);
void efl_test_container_content_equal(Efl_Ui_Widget **wid, unsigned int len);
void efl_test_container_expect_evt_content_added(Efl_Ui_Widget *widget, const Efl_Event_Description *ev, Eina_Bool *flag, void *event_data);

View File

@ -3,6 +3,10 @@
tests = [
["Efl.Pack_Linear" , "Efl.Ui.Box"],
["Efl.Pack" , "Efl.Ui.Table"],
["Efl.Content" , "Efl.Ui.Button", "Efl.Ui.Frame", "Efl.Ui.Grid_Default_Item",
"Efl.Ui.List_Default_Item", "Efl.Ui.List_Empty_Item",
"Efl.Ui.Navigation_Layout", "Efl.Ui.Panel", "Efl.Ui.Progressbar",
"Efl.Ui.Radio", "Efl.Ui.Popup", "Efl.Ui.Tab_Page", "Efl.Ui.Scroller"]
]
fixture_gen_template = """

View File

@ -6,6 +6,7 @@ efl_ui_suite_behavior_src = [
'efl_test_pack.c',
'efl_test_pack_linear.c',
'efl_test_container.c',
'efl_test_content.c',
]
test_generator = find_program('generator.py')