forked from enlightenment/efl
Merge branch 'master' into devs/hermet/lottie
This commit is contained in:
commit
cb070a5f96
|
@ -77,7 +77,7 @@ else
|
|||
|
||||
RELEASE_READY_LINUX_COPTS=" --with-profile=release"
|
||||
|
||||
MINGW_COPTS=" --prefix=/root/EFL/ewpi_64 --host=x86_64-w64-mingw32 --with-eolian-gen=/usr/local/bin/eolian_gen \
|
||||
MINGW_COPTS=" --prefix=/ewpi-64-install --host=x86_64-w64-mingw32 --with-eolian-gen=/usr/local/bin/eolian_gen \
|
||||
--with-edje-cc=/usr/local/bin/edje_cc --with-eet-eet=/usr/local/bin/eet \
|
||||
--with-bin-elm-prefs-cc=/usr/local/bin/elm_prefs_cc \
|
||||
--disable-static --with-tests=regular --with-crypto=openssl \
|
||||
|
@ -116,7 +116,7 @@ else
|
|||
if [ "$1" = "mingw" ]; then
|
||||
docker exec $(cat $HOME/cid) sh -c 'rm -f /src/config.cache'
|
||||
docker exec --env MAKEFLAGS="-j5 -rR" --env EIO_MONITOR_POLL=1 --env CFLAGS="-pipe" --env CXXFLAGS="-pipe" \
|
||||
--env CPPFLAGS="-I/root/EFL/ewpi_64/include -DECORE_WIN32_WIP_POZEFLKSD" --env LDFLAGS="-L/root/EFL/ewpi_64/lib/" --env PKG_CONFIG_PATH="/root/EFL/ewpi_64/lib/pkgconfig/" \
|
||||
--env CPPFLAGS="-I/ewpi-64-install/include -DECORE_WIN32_WIP_POZEFLKSD" --env LDFLAGS="-L/ewpi-64-install/lib/" --env PKG_CONFIG_PATH="/ewpi-64-install/lib/pkgconfig/" \
|
||||
$(cat $HOME/cid) sh -c "autoreconf -iv"
|
||||
else
|
||||
docker exec --env MAKEFLAGS="-j5 -rR" --env EIO_MONITOR_POLL=1 --env CC="ccache gcc" \
|
||||
|
@ -127,7 +127,7 @@ else
|
|||
travis_fold configure "configure $OPTS"
|
||||
if [ "$1" = "mingw" ]; then
|
||||
docker exec --env MAKEFLAGS="-j5 -rR" --env EIO_MONITOR_POLL=1 --env CFLAGS="-pipe" --env CXXFLAGS="-pipe" \
|
||||
--env CPPFLAGS="-I/root/EFL/ewpi_64/include -DECORE_WIN32_WIP_POZEFLKSD" --env LDFLAGS="-L/root/EFL/ewpi_64/lib/" --env PKG_CONFIG_PATH="/root/EFL/ewpi_64/lib/pkgconfig/" \
|
||||
--env CPPFLAGS="-I/ewpi-64-install/include -DECORE_WIN32_WIP_POZEFLKSD" --env LDFLAGS="-L/ewpi-64-install/lib/" --env PKG_CONFIG_PATH="/ewpi-64-install/lib/pkgconfig/" \
|
||||
$(cat $HOME/cid) sh -c ".ci/configure.sh $OPTS"
|
||||
else
|
||||
docker exec --env MAKEFLAGS="-j5 -rR" --env EIO_MONITOR_POLL=1 --env CC="ccache gcc" \
|
||||
|
|
|
@ -19,7 +19,7 @@ jobs:
|
|||
- os: osx
|
||||
env: BUILDSYSTEM=ninja
|
||||
- os: linux
|
||||
env: DISTRO=Fedora28-mingw CI_BUILD_TYPE=mingw
|
||||
env: DISTRO=Fedora29-mingw CI_BUILD_TYPE=mingw
|
||||
- os: linux
|
||||
env: DISTRO=Fedora29 CI_BUILD_TYPE=options-enabled
|
||||
- os: linux
|
||||
|
|
|
@ -27,7 +27,7 @@ cmake_src = [
|
|||
]
|
||||
|
||||
cmake_version_src = [
|
||||
'EFL',
|
||||
'Efl',
|
||||
'Elementary',
|
||||
]
|
||||
|
||||
|
|
47
configure.ac
47
configure.ac
|
@ -1117,6 +1117,7 @@ EINA_CONFIG([HAVE_DEBUG_THREADS], [test "x${want_debug_threads}" = "xyes"])
|
|||
EINA_CONFIG([HAVE_POSIX_SPINLOCK], [test "x${efl_have_posix_threads_spinlock}" = "xyes"])
|
||||
EINA_CONFIG([HAVE_OSX_SPINLOCK], [test "x${efl_have_osx_spinlock}" = "xyes"])
|
||||
EINA_CONFIG([HAVE_OSX_SEMAPHORE], [test "x${have_darwin}" = "xyes"])
|
||||
EINA_CONFIG([HAVE_WORDS_BIGENDIAN], [test "x${ac_cv_c_bigendian}" = "xyes"])
|
||||
|
||||
### Modules
|
||||
|
||||
|
@ -5844,52 +5845,52 @@ dbus-services/org.enlightenment.Ethumb.service
|
|||
systemd-services/ethumb.service
|
||||
$po_makefile_in
|
||||
cmakeconfig/EflConfig.cmake
|
||||
cmakeconfig/EflConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EflConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EinaConfig.cmake
|
||||
cmakeconfig/EinaConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EinaConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EioConfig.cmake
|
||||
cmakeconfig/EioConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EioConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EezeConfig.cmake
|
||||
cmakeconfig/EezeConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EezeConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EoConfig.cmake
|
||||
cmakeconfig/EoConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EoConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EolianConfig.cmake
|
||||
cmakeconfig/EolianConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EolianConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EolianHelper.cmake
|
||||
cmakeconfig/EolianCxxConfig.cmake
|
||||
cmakeconfig/EolianCxxConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EolianCxxConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EinaCxxConfig.cmake
|
||||
cmakeconfig/EinaCxxConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EinaCxxConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EoCxxConfig.cmake
|
||||
cmakeconfig/EoCxxConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EoCxxConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EcoreCxxConfig.cmake
|
||||
cmakeconfig/EcoreCxxConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EcoreCxxConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EvasCxxConfig.cmake
|
||||
cmakeconfig/EvasCxxConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EvasCxxConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EetCxxConfig.cmake
|
||||
cmakeconfig/EetCxxConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EetCxxConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EetConfig.cmake
|
||||
cmakeconfig/EetConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EetConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EvasConfig.cmake
|
||||
cmakeconfig/EvasConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EvasConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EcoreConfig.cmake
|
||||
cmakeconfig/EcoreConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EcoreConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EdjeConfig.cmake
|
||||
cmakeconfig/EdjeConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EdjeConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EldbusConfig.cmake
|
||||
cmakeconfig/EldbusConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EldbusConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EfreetConfig.cmake
|
||||
cmakeconfig/EfreetConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EfreetConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EthumbConfig.cmake
|
||||
cmakeconfig/EthumbConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EthumbConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EthumbClientConfig.cmake
|
||||
cmakeconfig/EthumbClientConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EthumbClientConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EmotionConfig.cmake
|
||||
cmakeconfig/EmotionConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EmotionConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EluaConfig.cmake
|
||||
cmakeconfig/EluaConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EluaConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/EmileConfig.cmake
|
||||
cmakeconfig/EmileConfigVersion.cmake:cmakeconfig/EFLConfigVersion.cmake.in
|
||||
cmakeconfig/EmileConfigVersion.cmake:cmakeconfig/EflConfigVersion.cmake.in
|
||||
cmakeconfig/ElementaryConfigVersion.cmake
|
||||
cmakeconfig/ElementaryConfig.cmake
|
||||
])
|
||||
|
|
|
@ -9,5 +9,5 @@ configure_file(
|
|||
input: 'libeo-gdb.py.in',
|
||||
output: 'libeo.so.'+meson.project_version()+'-gdb.py',
|
||||
configuration: configuration,
|
||||
install_dir: join_paths(dir_data, 'gdb', 'autoload', 'usr', 'lib')
|
||||
install_dir: join_paths(dir_data, 'gdb', 'auto-load', 'usr', 'lib')
|
||||
)
|
||||
|
|
|
@ -42,16 +42,14 @@ ecore_eolian_files_public = \
|
|||
lib/ecore/efl_bounce_interpolator.eo \
|
||||
lib/ecore/efl_spring_interpolator.eo \
|
||||
lib/ecore/efl_cubic_bezier_interpolator.eo \
|
||||
lib/ecore/efl_model_loop.eo \
|
||||
lib/ecore/efl_model_item.eo \
|
||||
lib/ecore/efl_model_container.eo \
|
||||
lib/ecore/efl_model_container_item.eo \
|
||||
lib/ecore/efl_model_composite_boolean.eo \
|
||||
lib/ecore/efl_model_composite_boolean_children.eo \
|
||||
lib/ecore/efl_model_composite_selection.eo \
|
||||
lib/ecore/efl_model_composite_selection_children.eo \
|
||||
lib/ecore/efl_model_composite.eo \
|
||||
lib/ecore/efl_model_view.eo
|
||||
lib/ecore/efl_loop_model.eo \
|
||||
lib/ecore/efl_generic_model.eo \
|
||||
lib/ecore/efl_container_model.eo \
|
||||
lib/ecore/efl_container_model_item.eo \
|
||||
lib/ecore/efl_boolean_model.eo \
|
||||
lib/ecore/efl_select_model.eo \
|
||||
lib/ecore/efl_composite_model.eo \
|
||||
lib/ecore/efl_view_model.eo
|
||||
|
||||
ecore_eolian_files = \
|
||||
$(ecore_eolian_files_legacy) \
|
||||
|
@ -120,18 +118,18 @@ lib/ecore/efl_io_stderr.c \
|
|||
lib/ecore/efl_io_file.c \
|
||||
lib/ecore/efl_io_copier.c \
|
||||
lib/ecore/efl_io_buffered_stream.c \
|
||||
lib/ecore/efl_model_loop.c \
|
||||
lib/ecore/efl_model_item.c \
|
||||
lib/ecore/efl_model_container.c \
|
||||
lib/ecore/efl_model_container_item.c \
|
||||
lib/ecore/efl_model_container_private.h \
|
||||
lib/ecore/efl_model_composite.c \
|
||||
lib/ecore/efl_model_composite_boolean.c \
|
||||
lib/ecore/efl_model_composite_selection.c \
|
||||
lib/ecore/efl_model_composite_private.h \
|
||||
lib/ecore/efl_loop_model.c \
|
||||
lib/ecore/efl_generic_model.c \
|
||||
lib/ecore/efl_container_model.c \
|
||||
lib/ecore/efl_container_model_item.c \
|
||||
lib/ecore/efl_container_model_private.h \
|
||||
lib/ecore/efl_composite_model.c \
|
||||
lib/ecore/efl_boolean_model.c \
|
||||
lib/ecore/efl_select_model.c \
|
||||
lib/ecore/efl_composite_model_private.h \
|
||||
lib/ecore/efl_model_accessor_view.c \
|
||||
lib/ecore/efl_model_accessor_view_private.h \
|
||||
lib/ecore/efl_model_view.c \
|
||||
lib/ecore/efl_view_model.c \
|
||||
lib/ecore/efl_linear_interpolator.c \
|
||||
lib/ecore/efl_accelerate_interpolator.c \
|
||||
lib/ecore/efl_decelerate_interpolator.c \
|
||||
|
@ -293,7 +291,7 @@ tests/ecore/ecore_test_args.c \
|
|||
tests/ecore/ecore_test_pipe.c \
|
||||
tests/ecore/ecore_suite.h
|
||||
|
||||
tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||
tests_ecore_ecore_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl -I$(top_builddir)/src/tests/ecore \
|
||||
-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \
|
||||
-DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/ecore\" \
|
||||
-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/ecore\" \
|
||||
|
|
|
@ -23,6 +23,7 @@ efl_eolian_files = \
|
|||
lib/efl/interfaces/efl_control.eo \
|
||||
lib/efl/interfaces/efl_duplicate.eo \
|
||||
lib/efl/interfaces/efl_file.eo \
|
||||
lib/efl/interfaces/efl_file_save.eo \
|
||||
lib/efl/interfaces/efl_gfx_image_load_controller.eo \
|
||||
lib/efl/interfaces/efl_part.eo \
|
||||
lib/efl/interfaces/efl_playable.eo \
|
||||
|
@ -34,6 +35,7 @@ efl_eolian_files = \
|
|||
lib/efl/interfaces/efl_text_cursor.eo \
|
||||
lib/efl/interfaces/efl_text_annotate.eo \
|
||||
lib/efl/interfaces/efl_text_markup.eo \
|
||||
lib/efl/interfaces/efl_text_markup_interactive.eo \
|
||||
lib/efl/interfaces/efl_text_markup_util.eo \
|
||||
lib/efl/interfaces/efl_gfx_stack.eo \
|
||||
lib/efl/interfaces/efl_gfx_view.eo \
|
||||
|
@ -201,9 +203,9 @@ TESTS += tests/efl/efl_suite
|
|||
|
||||
tests_efl_efl_suite_SOURCES = \
|
||||
tests/efl/efl_suite.c \
|
||||
tests/efl/efl_test_model_container.c \
|
||||
tests/efl/efl_test_model_composite.c \
|
||||
tests/efl/efl_test_model_view.c \
|
||||
tests/efl/efl_test_container_model.c \
|
||||
tests/efl/efl_test_composite_model.c \
|
||||
tests/efl/efl_test_view_model.c \
|
||||
tests/efl/efl_suite.h
|
||||
|
||||
tests_efl_efl_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
|
||||
|
|
|
@ -296,7 +296,9 @@ bin_eina_eina_modinfo_eina_modinfo_DEPENDENCIES = @USE_EINA_INTERNAL_LIBS@
|
|||
|
||||
### Script
|
||||
|
||||
bin_SCRIPTS += scripts/eina/eina-bench-cmp
|
||||
# disabled because its a pretty useless script that forces python as a
|
||||
# a dependency and doesn't parse anything efl or test apps produce
|
||||
# bin_SCRIPTS += scripts/eina/eina-bench-cmp
|
||||
|
||||
### Unit tests
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
### Library
|
||||
|
||||
eio_eolian_files = \
|
||||
lib/eio/eio_model.eo \
|
||||
lib/eio/efl_io_model.eo \
|
||||
lib/eio/efl_io_manager.eo \
|
||||
lib/eio/eio_sentry.eo
|
||||
|
||||
|
@ -38,8 +38,8 @@ lib/eio/eio_monitor.c \
|
|||
lib/eio/eio_monitor_poll.c \
|
||||
lib/eio/eio_single.c \
|
||||
lib/eio/eio_xattr.c \
|
||||
lib/eio/eio_model.c \
|
||||
lib/eio/eio_model_private.h \
|
||||
lib/eio/efl_io_model.c \
|
||||
lib/eio/efl_io_model_private.h \
|
||||
lib/eio/eio_private.h \
|
||||
lib/eio/eio_sentry_private.h
|
||||
|
||||
|
@ -74,8 +74,8 @@ TESTS += tests/eio/eio_suite
|
|||
|
||||
tests_eio_eio_suite_SOURCES = \
|
||||
tests/eio/eio_suite.c \
|
||||
tests/eio/eio_model_test_file.c \
|
||||
tests/eio/eio_model_test_monitor_add.c \
|
||||
tests/eio/efl_io_model_test_file.c \
|
||||
tests/eio/efl_io_model_test_monitor_add.c \
|
||||
tests/eio/eio_test_monitor.c \
|
||||
tests/eio/eio_test_sentry.c \
|
||||
tests/eio/eio_test_file.c \
|
||||
|
|
|
@ -133,6 +133,7 @@ elm_public_eolian_files = \
|
|||
lib/elementary/efl_ui_widget_focus_manager.eo \
|
||||
lib/elementary/efl_ui_text_part.eo \
|
||||
lib/elementary/efl_ui_caching_factory.eo \
|
||||
lib/elementary/efl_ui_widget_factory.eo \
|
||||
$(NULL)
|
||||
|
||||
# More public files -- FIXME
|
||||
|
@ -168,13 +169,17 @@ elm_private_eolian_files = \
|
|||
lib/elementary/efl_ui_focus_parent_provider.eo \
|
||||
lib/elementary/efl_ui_focus_parent_provider_standard.eo \
|
||||
lib/elementary/efl_ui_focus_parent_provider_gen.eo \
|
||||
lib/elementary/efl_ui_model_state.eo \
|
||||
lib/elementary/efl_ui_state_model.eo \
|
||||
tests/elementary/focus_test.eo \
|
||||
tests/elementary/focus_test_sub_main.eo \
|
||||
lib/elementary/efl_ui_selection_manager.eo \
|
||||
lib/elementary/efl_datetime_manager.eo \
|
||||
lib/elementary/efl_ui_list_view_relayout.eo \
|
||||
lib/elementary/efl_ui_list_view_precise_layouter.eo \
|
||||
lib/elementary/efl_ui_size_model.eo \
|
||||
lib/elementary/efl_ui_homogeneous_model.eo \
|
||||
lib/elementary/efl_ui_exact_model.eo \
|
||||
lib/elementary/efl_ui_average_model.eo \
|
||||
$(NULL)
|
||||
|
||||
# Legacy classes - not part of public EO API
|
||||
|
@ -891,6 +896,11 @@ lib_elementary_libelementary_la_SOURCES = \
|
|||
lib/elementary/efl_ui_tab_page.c \
|
||||
lib/elementary/efl_ui_widget_focus_manager.c \
|
||||
lib/elementary/efl_ui_caching_factory.c \
|
||||
lib/elementary/efl_ui_widget_factory.c \
|
||||
lib/elementary/efl_ui_size_model.c \
|
||||
lib/elementary/efl_ui_homogeneous_model.c \
|
||||
lib/elementary/efl_ui_exact_model.c \
|
||||
lib/elementary/efl_ui_average_model.c \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
@ -1509,6 +1519,7 @@ check_PROGRAMS += tests/elementary/elm_suite tests/elementary/efl_ui_suite
|
|||
TESTS += tests/elementary/elm_suite tests/elementary/efl_ui_suite
|
||||
|
||||
tests_elementary_elm_suite_SOURCES = \
|
||||
tests/elementary/suite_helpers.c \
|
||||
tests/elementary/elm_suite.c \
|
||||
tests/elementary/elm_test_atspi.c \
|
||||
tests/elementary/elm_test_check.c \
|
||||
|
@ -1587,11 +1598,6 @@ tests_elementary_elm_suite_SOURCES = \
|
|||
tests/elementary/elm_code_test_widget_text.c \
|
||||
tests/elementary/elm_code_test_widget_selection.c \
|
||||
tests/elementary/elm_code_test_widget_undo.c \
|
||||
tests/elementary/elm_test_focus_common.c \
|
||||
tests/elementary/elm_test_focus_common.h \
|
||||
tests/elementary/elm_test_focus.c \
|
||||
tests/elementary/elm_test_focus_sub.c \
|
||||
tests/elementary/efl_ui_test_grid.c \
|
||||
tests/elementary/elm_test_widget_focus.c
|
||||
|
||||
tests_elementary_elm_suite_CPPFLAGS = \
|
||||
|
@ -1612,9 +1618,24 @@ tests_elementary_elm_suite_LDADD = @CHECK_LIBS@ @USE_ELEMENTARY_LIBS@
|
|||
tests_elementary_elm_suite_DEPENDENCIES = @USE_ELEMENTARY_INTERNAL_LIBS@
|
||||
|
||||
tests_elementary_efl_ui_suite_SOURCES = \
|
||||
tests/elementary/efl_ui_suite.c
|
||||
tests/elementary/suite_helpers.c \
|
||||
tests/elementary/suite_helpers.h \
|
||||
tests/elementary/efl_ui_suite.c \
|
||||
tests/elementary/elm_test_init.c \
|
||||
tests/elementary/efl_ui_test_atspi.c \
|
||||
tests/elementary/efl_ui_test_focus_common.c \
|
||||
tests/elementary/efl_ui_test_focus_common.h \
|
||||
tests/elementary/efl_ui_test_focus.c \
|
||||
tests/elementary/efl_ui_test_focus_sub.c \
|
||||
tests/elementary/efl_ui_test_grid.c \
|
||||
tests/elementary/efl_ui_test_image.c \
|
||||
tests/elementary/efl_ui_test_image_zoomable.c \
|
||||
tests/elementary/efl_ui_test_layout.c \
|
||||
tests/elementary/efl_ui_suite.h \
|
||||
tests/elementary/efl_ui_model.c
|
||||
|
||||
tests_elementary_efl_ui_suite_CPPFLAGS = \
|
||||
-DELM_INTERNAL_API_ARGESFSDFEFC=1 \
|
||||
-DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)\" \
|
||||
-DTESTS_BUILD_DIR=\"${top_builddir}/src/tests/elementary\" \
|
||||
-DTESTS_SRC_DIR=\"${top_srcdir}/src/tests/elementary\" \
|
||||
|
|
|
@ -2138,13 +2138,11 @@ static_libs/lz4/lz4hc.c \
|
|||
static_libs/lz4/lz4hc.h
|
||||
endif
|
||||
lib_evas_libevas_la_CPPFLAGS += \
|
||||
-I$(top_srcdir)/src/static_libs/rg_etc \
|
||||
@evas_image_loader_tgv_cflags@
|
||||
-I$(top_srcdir)/src/static_libs/rg_etc
|
||||
if ! ENABLE_LIBLZ4
|
||||
lib_evas_libevas_la_CPPFLAGS += \
|
||||
-I$(top_srcdir)/src/static_libs/lz4
|
||||
endif
|
||||
lib_evas_libevas_la_LIBADD += @evas_image_loader_tgv_libs@
|
||||
endif
|
||||
else
|
||||
loadertgvpkgdir = $(libdir)/evas/modules/image_loaders/tgv/$(MODULE_ARCH)
|
||||
|
@ -2170,15 +2168,13 @@ modules_evas_image_loaders_tgv_module_la_CPPFLAGS = \
|
|||
-I$(top_srcdir)/src/static_libs/rg_etc \
|
||||
-I$(top_srcdir)/src/lib/evas/ \
|
||||
@EVAS_CFLAGS@ \
|
||||
@NEON_CFLAGS@ \
|
||||
@evas_image_loader_tgv_cflags@
|
||||
@NEON_CFLAGS@
|
||||
if ! ENABLE_LIBLZ4
|
||||
modules_evas_image_loaders_tgv_module_la_CPPFLAGS += \
|
||||
-I$(top_srcdir)/src/static_libs/lz4
|
||||
endif
|
||||
modules_evas_image_loaders_tgv_module_la_LIBADD = \
|
||||
@USE_EVAS_LIBS@ \
|
||||
@evas_image_loader_tgv_libs@
|
||||
@USE_EVAS_LIBS@
|
||||
modules_evas_image_loaders_tgv_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@
|
||||
modules_evas_image_loaders_tgv_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@
|
||||
modules_evas_image_loaders_tgv_module_la_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
|
|
@ -15,12 +15,13 @@ enum
|
|||
GEN_H_STUB = 1 << 2,
|
||||
GEN_C = 1 << 3,
|
||||
GEN_C_IMPL = 1 << 4,
|
||||
GEN_D = 1 << 5
|
||||
GEN_D = 1 << 5,
|
||||
GEN_D_FULL = 1 << 6
|
||||
};
|
||||
|
||||
static const char *_dexts[6] =
|
||||
static const char *_dexts[7] =
|
||||
{
|
||||
".h", ".legacy.h", ".stub.h", ".c", ".c", ".d"
|
||||
".h", ".legacy.h", ".stub.h", ".c", ".c", ".d", ".d"
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -51,7 +52,8 @@ _print_usage(const char *progn, FILE *outf)
|
|||
" s: Stub C header file (.eo.stub.h/.eot.stub.h)\n"
|
||||
" c: C source file (.eo.c)\n"
|
||||
" i: Implementation file (.c, merged with existing)\n"
|
||||
" d: Make-style dependencies (.d)\n"
|
||||
" d: Make-style dependencies, only for headers (.d)\n"
|
||||
" D: Like 'd' but for all generated files (.d)\n"
|
||||
"\n"
|
||||
"By default, the 'hc' set is used ('h' for .eot files).\n\n"
|
||||
"The system-wide Eolian directory is scanned for eo files\n"
|
||||
|
@ -103,6 +105,11 @@ _try_set_out(char t, char **outs, const char *val, int *what)
|
|||
case 'd':
|
||||
pos = _get_bit_pos(GEN_D);
|
||||
*what |= GEN_D;
|
||||
break;
|
||||
case 'D':
|
||||
pos = _get_bit_pos(GEN_D_FULL);
|
||||
*what |= GEN_D_FULL;
|
||||
break;
|
||||
}
|
||||
if (pos < 0)
|
||||
return EINA_FALSE;
|
||||
|
@ -471,8 +478,12 @@ _write_deps(const Eolian_State *eos, const char *ofname, const char *ifname,
|
|||
_append_dep_line(buf, dbuf, outs, gen_what, GEN_H);
|
||||
_append_dep_line(buf, dbuf, outs, gen_what, GEN_H_LEGACY);
|
||||
_append_dep_line(buf, dbuf, outs, gen_what, GEN_H_STUB);
|
||||
_append_dep_line(buf, dbuf, outs, gen_what, GEN_C);
|
||||
_append_dep_line(buf, dbuf, outs, gen_what, GEN_C_IMPL);
|
||||
|
||||
if (gen_what & GEN_D_FULL)
|
||||
{
|
||||
_append_dep_line(buf, dbuf, outs, gen_what, GEN_C);
|
||||
_append_dep_line(buf, dbuf, outs, gen_what, GEN_C_IMPL);
|
||||
}
|
||||
|
||||
ret = _write_file(ofname, buf);
|
||||
result:
|
||||
|
@ -486,7 +497,9 @@ main(int argc, char **argv)
|
|||
{
|
||||
int pret = 1;
|
||||
|
||||
char *outs[6] = { NULL, NULL, NULL, NULL, NULL, NULL };
|
||||
char *outs[sizeof(_dexts) / sizeof(void *)] = {
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
char *basen = NULL;
|
||||
Eina_List *includes = NULL;
|
||||
|
||||
|
@ -542,6 +555,9 @@ main(int argc, char **argv)
|
|||
case 'd':
|
||||
gen_what |= GEN_D;
|
||||
break;
|
||||
case 'D':
|
||||
gen_what |= GEN_D_FULL;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "unknown type: '%c'\n", *wstr);
|
||||
goto end;
|
||||
|
@ -639,7 +655,10 @@ main(int argc, char **argv)
|
|||
succ = _write_source(eos, outs[_get_bit_pos(GEN_C)], eobn, !strcmp(ext, ".eot"));
|
||||
if (succ && (gen_what & GEN_C_IMPL))
|
||||
succ = _write_impl(eos, outs[_get_bit_pos(GEN_C_IMPL)], eobn);
|
||||
if (succ && (gen_what & GEN_D))
|
||||
|
||||
if (succ && (gen_what & GEN_D_FULL))
|
||||
succ = _write_deps(eos, outs[_get_bit_pos(GEN_D_FULL)], eobn, outs, gen_what);
|
||||
else if (succ && (gen_what & GEN_D))
|
||||
succ = _write_deps(eos, outs[_get_bit_pos(GEN_D)], eobn, outs, gen_what);
|
||||
|
||||
if (!succ)
|
||||
|
|
|
@ -84,6 +84,29 @@ struct documentation_generator
|
|||
return name;
|
||||
}
|
||||
|
||||
static std::string function_conversion(attributes::function_def const& func)
|
||||
{
|
||||
attributes::klass_def klass(get_klass(func.klass, func.unit), func.unit);
|
||||
std::string name = name_helpers::klass_full_concrete_or_interface_name(klass);
|
||||
switch (func.type)
|
||||
{
|
||||
// managed_method_name takes care of reordering the function name so the get/set goes first
|
||||
// for properties
|
||||
case attributes::function_type::method:
|
||||
case attributes::function_type::prop_set:
|
||||
case attributes::function_type::prop_get:
|
||||
if (blacklist::is_function_blacklisted(func.c_name))return "";
|
||||
name += ".";
|
||||
name += name_helpers::managed_method_name(klass.eolian_name, func.name);
|
||||
break;
|
||||
default:
|
||||
// No need to deal with property as function_defs are converted to get/set when building a given klass_def.
|
||||
break;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
// Turns an Eolian reference like @Efl.Input.Pointer.tool into a <see> tag
|
||||
static std::string ref_conversion(const ::Eolian_Doc_Token *token, const Eolian_State *state, std::string name_tail)
|
||||
{
|
||||
|
@ -299,6 +322,31 @@ struct documentation_generator
|
|||
{
|
||||
return generate_tag_summary(sink, doc.full_text, context);
|
||||
}
|
||||
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::constructor_def const& ctor, Context const& context) const
|
||||
{
|
||||
// Not sure if this is the best way to generate a reference outside the full doc generator.
|
||||
auto unit = (const Eolian_Unit*) context_find_tag<eolian_state_context>(context).state;
|
||||
auto func = ctor.function;
|
||||
auto eolian_klass = get_klass(func.klass, unit);
|
||||
attributes::klass_def klass(eolian_klass, unit);
|
||||
std::string summary;
|
||||
|
||||
if (func.type == attributes::function_type::prop_set)
|
||||
summary = func.property_documentation.summary;
|
||||
else
|
||||
summary = func.documentation.summary;
|
||||
|
||||
for (auto &¶m : ctor.function.parameters)
|
||||
{
|
||||
if (!as_generator(
|
||||
scope_tab << "///<param name=\"" << constructor_parameter_name(ctor) << "\">" << summary << " See <see cref=\"" << function_conversion(func) << "\"/></param>\n"
|
||||
).generate(sink, param, context))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct documentation_terminal
|
||||
|
|
|
@ -221,6 +221,12 @@ inline bool is_unique_event(attributes::event_def const& evt
|
|||
});
|
||||
}
|
||||
|
||||
inline std::vector<attributes::constructor_def> reorder_constructors(std::vector<attributes::constructor_def> constructors)
|
||||
{
|
||||
auto is_required = [](attributes::constructor_def const& ctr) { return !ctr.is_optional; };
|
||||
std::stable_partition(constructors.begin(), constructors.end(), is_required);
|
||||
return constructors;
|
||||
}
|
||||
|
||||
} // namespace helpers
|
||||
|
||||
|
|
|
@ -220,15 +220,16 @@ struct klass
|
|||
if (!generate_fields(sink, cls, concrete_cxt))
|
||||
return false;
|
||||
|
||||
bool root = !helpers::has_regular_ancestor(cls);
|
||||
if (!as_generator
|
||||
(
|
||||
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>Constructs an instance from a native pointer.</summary>\n"
|
||||
<< scope_tab << "public " << concrete_name << "(System.IntPtr raw)\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 << "public " << concrete_name << "(System.IntPtr raw)" << (root ? "" : " : base(raw)") << "\n"
|
||||
<< scope_tab << "{\n"
|
||||
<< scope_tab << scope_tab << "handle = raw;\n"
|
||||
<< scope_tab << scope_tab << (root ? "handle = raw;\n" : "")
|
||||
<< scope_tab << scope_tab << "register_event_proxies();\n"
|
||||
<< scope_tab << "}\n"
|
||||
)
|
||||
|
@ -495,56 +496,50 @@ struct klass
|
|||
auto native_inherit_name = name_helpers::klass_native_inherit_name(cls);
|
||||
|
||||
if(!as_generator(
|
||||
scope_tab << "///<summary>Delegate for function to be called from inside the native constructor.</summary>\n"
|
||||
<< scope_tab << "public" << (root ? "" : " new") << " delegate void ConstructingMethod(" << inherit_name << " obj);\n"
|
||||
<< scope_tab << "[System.Runtime.InteropServices.DllImport(" << context_find_tag<library_context>(context).actual_library_name(cls.filename)
|
||||
scope_tab << "[System.Runtime.InteropServices.DllImport(" << context_find_tag<library_context>(context).actual_library_name(cls.filename)
|
||||
<< ")] internal static extern System.IntPtr\n"
|
||||
<< scope_tab << scope_tab << name_helpers::klass_get_name(cls) << "();\n"
|
||||
).generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
|
||||
auto constructors = helpers::reorder_constructors(cls.get_all_constructors());
|
||||
|
||||
if (!root)
|
||||
{
|
||||
return as_generator(
|
||||
// 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 << "///<param name=\"init_cb\">Delegate to call constructing methods that should be run inside the constructor.</param>\n"
|
||||
<< scope_tab << "public " << inherit_name << "(Efl.Object parent = null, ConstructingMethod init_cb=null) : "
|
||||
"base(\"" << inherit_name << "\", " << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent)\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") << "(\"" << inherit_name << "\", " << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent)\n"
|
||||
<< scope_tab << "{\n"
|
||||
<< scope_tab << scope_tab << "if (init_cb != null) {\n"
|
||||
<< scope_tab << scope_tab << scope_tab << "init_cb(this);\n"
|
||||
<< scope_tab << scope_tab << "}\n"
|
||||
<< *(scope_tab << scope_tab << constructor_invocation << "\n" )
|
||||
<< scope_tab << scope_tab << "FinishInstantiation();\n"
|
||||
<< scope_tab << "}\n"
|
||||
|
||||
<< scope_tab << "///<summary>Internal constructor to forward the wrapper initialization to the root class.</summary>\n"
|
||||
<< scope_tab << "protected " << inherit_name << "(String klass_name, IntPtr base_klass, System.Type managed_type, Efl.Object parent) : base(klass_name, base_klass, managed_type, parent) {}\n"
|
||||
|
||||
<< scope_tab << "///<summary>Constructs an instance from a native pointer.</summary>\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 << "public " << inherit_name << "(System.IntPtr raw)" << (root ? "" : " : base(raw)") << "\n"
|
||||
<< scope_tab << "{\n"
|
||||
<< scope_tab << scope_tab << (root ? "handle = raw;\n" : "")
|
||||
<< scope_tab << scope_tab << "register_event_proxies();\n"
|
||||
<< scope_tab << "}\n"
|
||||
).generate(sink, std::make_tuple(constructors, constructors, constructors), context))
|
||||
return false;
|
||||
|
||||
// Internal constructors
|
||||
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 << "(String klass_name, IntPtr base_klass, System.Type managed_type, Efl.Object parent) : base(klass_name, base_klass, managed_type, parent) {}\n"
|
||||
).generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Detailed constructors go only in root classes.
|
||||
return as_generator(
|
||||
scope_tab << "///<summary>Creates a new instance.</summary>\n"
|
||||
<< scope_tab << "///<param name=\"parent\">Parent instance.</param>\n"
|
||||
<< scope_tab << "///<param name=\"init_cb\">Delegate to call constructing methods that should be run inside the constructor.</param>\n"
|
||||
<< scope_tab << "public " << inherit_name << "(Efl.Object parent = null, ConstructingMethod init_cb=null) : this(\"" << inherit_name << "\", " << name_helpers::klass_get_name(cls) << "(), typeof(" << inherit_name << "), parent)\n"
|
||||
<< scope_tab << "{\n"
|
||||
<< scope_tab << scope_tab << "if (init_cb != null) {\n"
|
||||
<< scope_tab << scope_tab << scope_tab << "init_cb(this);\n"
|
||||
<< scope_tab << scope_tab << "}\n"
|
||||
<< scope_tab << scope_tab << "FinishInstantiation();\n"
|
||||
<< scope_tab << "}\n"
|
||||
|
||||
<< scope_tab << "protected " << inherit_name << "(String klass_name, IntPtr base_klass, System.Type managed_type, Efl.Object parent)\n"
|
||||
/// Actual root costructor that creates class and instantiates
|
||||
scope_tab << "protected " << inherit_name << "(String klass_name, IntPtr base_klass, System.Type managed_type, 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"
|
||||
|
@ -574,12 +569,6 @@ struct klass
|
|||
<< scope_tab << scope_tab << "Eina.Error.RaiseIfUnhandledException();\n"
|
||||
<< scope_tab << "}\n"
|
||||
|
||||
<< scope_tab << "///<summary>Constructs an instance from a native pointer.</summary>\n"
|
||||
<< scope_tab << "public " << inherit_name << "(System.IntPtr raw)\n"
|
||||
<< scope_tab << "{\n"
|
||||
<< scope_tab << scope_tab << "handle = raw;\n"
|
||||
<< scope_tab << scope_tab << "register_event_proxies();\n"
|
||||
<< scope_tab << "}\n"
|
||||
).generate(sink, attributes::unused, context);
|
||||
}
|
||||
|
||||
|
|
|
@ -187,6 +187,12 @@ inline std::string managed_method_name(std::string const& klass, std::string con
|
|||
return candidate;
|
||||
}
|
||||
|
||||
inline std::string managed_name(std::string const& name, char separator='_')
|
||||
{
|
||||
auto tokens = utils::split(name, 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);
|
||||
|
@ -420,7 +426,12 @@ bool close_namespaces(OutputIterator sink, std::vector<std::string> const& names
|
|||
return as_generator(close_namespace).generate(sink, namespaces, context);
|
||||
}
|
||||
|
||||
std::string constructor_managed_name(std::string full_name)
|
||||
{
|
||||
auto tokens = utils::split(full_name, '.');
|
||||
|
||||
return managed_name(tokens.at(tokens.size()-1));
|
||||
}
|
||||
|
||||
} // namespace name_helpers
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "grammar/generator.hpp"
|
||||
#include "grammar/klass_def.hpp"
|
||||
#include "grammar/attribute_reorder.hpp"
|
||||
#include "grammar/case.hpp"
|
||||
#include "helpers.hh"
|
||||
#include "marshall_type.hh"
|
||||
|
@ -34,6 +35,10 @@ namespace eolian_mono {
|
|||
struct native_convert_return_variable_generator;
|
||||
struct convert_function_pointer_generator;
|
||||
struct native_convert_function_pointer_generator;
|
||||
struct constructor_param_generator;
|
||||
struct constructor_invocation_generator;
|
||||
struct constructor_parameter_name_generator;
|
||||
struct constructor_parameter_name_paremeterized;
|
||||
}
|
||||
|
||||
namespace efl { namespace eolian { namespace grammar {
|
||||
|
@ -232,6 +237,38 @@ template <>
|
|||
struct attributes_needed< ::eolian_mono::native_convert_function_pointer_generator> : std::integral_constant<int, 1> {};
|
||||
}
|
||||
|
||||
template <>
|
||||
struct is_eager_generator< ::eolian_mono::constructor_param_generator> : std::true_type {};
|
||||
template <>
|
||||
struct is_generator< ::eolian_mono::constructor_param_generator> : std::true_type {};
|
||||
|
||||
namespace type_traits {
|
||||
template <>
|
||||
struct attributes_needed< ::eolian_mono::constructor_param_generator> : std::integral_constant<int, 1> {};
|
||||
}
|
||||
|
||||
template <>
|
||||
struct is_eager_generator< ::eolian_mono::constructor_invocation_generator> : std::true_type {};
|
||||
template <>
|
||||
struct is_generator< ::eolian_mono::constructor_invocation_generator> : std::true_type {};
|
||||
|
||||
namespace type_traits {
|
||||
template <>
|
||||
struct attributes_needed< ::eolian_mono::constructor_invocation_generator> : std::integral_constant<int, 1> {};
|
||||
}
|
||||
|
||||
template <>
|
||||
struct is_eager_generator< ::eolian_mono::constructor_parameter_name_generator> : std::true_type {};
|
||||
template <>
|
||||
struct is_generator< ::eolian_mono::constructor_parameter_name_generator> : std::true_type {};
|
||||
template <>
|
||||
struct is_generator< ::eolian_mono::constructor_parameter_name_paremeterized> : std::true_type {};
|
||||
|
||||
namespace type_traits {
|
||||
template <>
|
||||
struct attributes_needed< ::eolian_mono::constructor_parameter_name_generator> : std::integral_constant<int, 1> {};
|
||||
}
|
||||
|
||||
} } }
|
||||
|
||||
namespace eolian_mono {
|
||||
|
@ -1436,6 +1473,89 @@ struct native_convert_function_pointer_generator
|
|||
|
||||
} const native_convert_function_pointer {};
|
||||
|
||||
struct constructor_parameter_name_generator
|
||||
{
|
||||
|
||||
template <typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::parameter_def const& param, Context const& context) const
|
||||
{
|
||||
auto target_name = name_helpers::constructor_managed_name(ctor.name);
|
||||
|
||||
// Only multi-valued constructing methods get their actual parameter names
|
||||
if (ctor.function.parameters.size() > 1)
|
||||
target_name += '_' + param.param_name;
|
||||
|
||||
auto name = name_helpers::managed_name(target_name);
|
||||
name[0] = std::tolower(name[0]);
|
||||
|
||||
return as_generator(string).generate(sink, name, context);
|
||||
}
|
||||
|
||||
attributes::constructor_def const& ctor;
|
||||
};
|
||||
|
||||
struct constructor_parameter_name_parameterized
|
||||
{
|
||||
constructor_parameter_name_generator const operator()(attributes::constructor_def const& ctor) const
|
||||
{
|
||||
return {ctor};
|
||||
}
|
||||
} const constructor_parameter_name;
|
||||
|
||||
// Generates the parameters for the given constructor
|
||||
// If the constructor receives multiple parameters, they get the name
|
||||
// of the constructor plus the name of the parameter (e.g. DefineParentData, DefineIndex)
|
||||
struct constructor_param_generator
|
||||
{
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::constructor_def const& ctor, Context context) const
|
||||
{
|
||||
auto params = ctor.function.parameters;
|
||||
|
||||
if (!as_generator(
|
||||
efl::eolian::grammar::attribute_reorder<1, -1>
|
||||
(type(false, ctor.is_optional) << " " << constructor_parameter_name(ctor) << (ctor.is_optional ? " = null" : "")) % ","
|
||||
).generate(sink, params, context))
|
||||
return false;
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
|
||||
} const constructor_param;
|
||||
|
||||
// Generates the invocation of the given parameter
|
||||
struct constructor_invocation_generator
|
||||
{
|
||||
template<typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::constructor_def const& ctor, Context context) const
|
||||
{
|
||||
auto params = ctor.function.parameters;
|
||||
if (!as_generator(
|
||||
"if (" <<
|
||||
(efl::eolian::grammar::attribute_reorder<-1>
|
||||
("Efl.Eo.Globals.ParamHelperCheck(" << constructor_parameter_name(ctor) << ")") % "||") << ")\n"
|
||||
<< scope_tab << scope_tab << scope_tab << name_helpers::managed_method_name(ctor.function) << "("
|
||||
).generate(sink, params, context))
|
||||
return false;
|
||||
|
||||
size_t idx = 0;
|
||||
|
||||
for (auto&& param : params)
|
||||
{
|
||||
idx++;
|
||||
if (!as_generator(
|
||||
"Efl.Eo.Globals.GetParamHelper(" << constructor_parameter_name(ctor) << ")" << ((idx < params.size()) ? ", " : "")
|
||||
).generate(sink, param, context))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!as_generator(");").generate(sink, attributes::unused, context))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
} const constructor_invocation;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -14,29 +14,29 @@ struct visitor_generate;
|
|||
|
||||
struct type_generator
|
||||
{
|
||||
type_generator(bool is_return = false)
|
||||
: is_return(is_return) {}
|
||||
type_generator(bool is_return = false, bool is_optional = false)
|
||||
: is_return(is_return), is_optional(is_optional) {}
|
||||
|
||||
template <typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::type_def const& type, Context const& context) const
|
||||
{
|
||||
return type.original_type.visit(visitor_generate<OutputIterator, Context>{sink, &context, type.c_type, false, is_return, type.is_ptr});
|
||||
return type.original_type.visit(visitor_generate<OutputIterator, Context>{sink, &context, type.c_type, false, is_return, type.is_ptr, is_optional});
|
||||
}
|
||||
template <typename OutputIterator, typename Context>
|
||||
bool generate(OutputIterator sink, attributes::parameter_def const& param, Context const& context) const
|
||||
{
|
||||
return param.type.original_type.visit(visitor_generate<OutputIterator, Context>{sink, &context, param.type.c_type
|
||||
, param.direction != attributes::parameter_direction::in, false, param.type.is_ptr});
|
||||
, param.direction != attributes::parameter_direction::in, false, param.type.is_ptr, is_optional});
|
||||
}
|
||||
|
||||
bool is_return;
|
||||
bool is_return, is_optional;
|
||||
};
|
||||
|
||||
struct type_terminal
|
||||
{
|
||||
type_generator const operator()(bool is_return) const
|
||||
type_generator const operator()(bool is_return, bool is_optional = false) const
|
||||
{
|
||||
return type_generator(is_return);
|
||||
return type_generator(is_return, is_optional);
|
||||
}
|
||||
} const type = {};
|
||||
|
||||
|
|
|
@ -34,6 +34,20 @@ attributes::regular_type_def replace_base_integer(attributes::regular_type_def v
|
|||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
attributes::regular_type_def replace_base_opt_integer(attributes::regular_type_def v)
|
||||
{
|
||||
bool s = std::is_signed<T>::value;
|
||||
switch (sizeof(T))
|
||||
{
|
||||
case 1: return s ? replace_base_type(v, " sbyte?") : replace_base_type(v, " byte?");
|
||||
case 2: return s ? replace_base_type(v, " short?") : replace_base_type(v, " ushort?");
|
||||
case 4: return s ? replace_base_type(v, " int?") : replace_base_type(v, " uint?");
|
||||
case 8: return s ? replace_base_type(v, " long?") : replace_base_type(v, " ulong?");
|
||||
default: return v;
|
||||
}
|
||||
}
|
||||
|
||||
inline
|
||||
attributes::complex_type_def replace_outer(attributes::complex_type_def v, attributes::regular_type_def const& regular)
|
||||
{
|
||||
|
@ -63,6 +77,7 @@ struct visitor_generate
|
|||
bool is_out;
|
||||
bool is_return;
|
||||
bool is_ptr;
|
||||
mutable bool is_optional;
|
||||
|
||||
typedef visitor_generate<OutputIterator, Context> visitor_type;
|
||||
typedef bool result_type;
|
||||
|
@ -76,6 +91,40 @@ struct visitor_generate
|
|||
eina::optional<bool> has_own;
|
||||
std::function<attributes::type_def::variant_type()> function;
|
||||
}
|
||||
const optional_match_table[] =
|
||||
{
|
||||
// signed primitives
|
||||
{"byte", nullptr, [&] { return replace_base_type(regular, " sbyte?"); }}
|
||||
, {"float", nullptr, [&] { return replace_base_type(regular, " float?"); }}
|
||||
, {"double", nullptr, [&] { return replace_base_type(regular, " double?"); }}
|
||||
, {"bool", nullptr, [&] { return replace_base_type(regular, " bool?"); }}
|
||||
, {"short", nullptr, [&] { return replace_base_opt_integer<short>(regular); }}
|
||||
, {"int", nullptr, [&] { return replace_base_opt_integer<int>(regular); }}
|
||||
, {"long", nullptr, [&] { return replace_base_opt_integer<long>(regular); }}
|
||||
, {"llong", nullptr, [&] { return replace_base_opt_integer<long long>(regular); }}
|
||||
, {"int8", nullptr, [&] { return replace_base_type(regular, " sbyte?"); }}
|
||||
, {"int16", nullptr, [&] { return replace_base_type(regular, " short?"); }}
|
||||
, {"int32", nullptr, [&] { return replace_base_type(regular, " int?"); }}
|
||||
, {"int64", nullptr, [&] { return replace_base_type(regular, " long?"); }}
|
||||
, {"ssize", nullptr, [&] { return replace_base_opt_integer<ssize_t>(regular); }}
|
||||
// unsigned primitives
|
||||
, {"ubyte", nullptr, [&] { return replace_base_type(regular, " byte?"); }}
|
||||
, {"ushort", nullptr, [&] { return replace_base_opt_integer<unsigned short>(regular); }}
|
||||
, {"uint", nullptr, [&] { return replace_base_opt_integer<unsigned int>(regular); }}
|
||||
, {"ulong", nullptr, [&] { return replace_base_opt_integer<unsigned long>(regular); }}
|
||||
, {"ullong", nullptr, [&] { return replace_base_opt_integer<unsigned long long>(regular); }}
|
||||
, {"uint8", nullptr, [&] { return replace_base_type(regular, " byte?"); }}
|
||||
, {"uint16", nullptr, [&] { return replace_base_type(regular, " ushort?"); }}
|
||||
, {"uint32", nullptr, [&] { return replace_base_type(regular, " uint?"); }}
|
||||
, {"uint64", nullptr, [&] { return replace_base_type(regular, " ulong?"); }}
|
||||
, {"size", nullptr, [&] { return replace_base_opt_integer<size_t>(regular); }}
|
||||
|
||||
, {"ptrdiff", nullptr, [&] { return replace_base_opt_integer<ptrdiff_t>(regular); }}
|
||||
, {"intptr", nullptr, [&] { return replace_base_type(regular, " System.IntPtr?"); }}
|
||||
, {"uintptr", nullptr, [&] { return replace_base_type(regular, " System.IntPtr?"); }}
|
||||
, {"void_ptr", nullptr, [&] { return replace_base_type(regular, " System.IntPtr?"); }}
|
||||
};
|
||||
struct match
|
||||
const match_table[] =
|
||||
{
|
||||
// signed primitives
|
||||
|
@ -153,6 +202,29 @@ struct visitor_generate
|
|||
};
|
||||
std::string full_type_name = name_helpers::type_full_eolian_name(regular);
|
||||
if(eina::optional<bool> b = call_match
|
||||
(optional_match_table
|
||||
, [&] (match const& m)
|
||||
{
|
||||
return is_optional
|
||||
&& (!m.name || *m.name == regular.base_type || *m.name == full_type_name)
|
||||
&& (!m.has_own || *m.has_own == (bool)(regular.base_qualifier & qualifier_info::is_own))
|
||||
;
|
||||
}
|
||||
, [&] (attributes::type_def::variant_type const& v)
|
||||
{
|
||||
return v.visit(*this); // we want to keep is_out info
|
||||
}))
|
||||
{
|
||||
return *b;
|
||||
}
|
||||
else if (is_optional && (regular.is_struct() || regular.is_enum() || regular.is_struct_opaque()))
|
||||
{
|
||||
attributes::regular_type_def r = regular;
|
||||
r.base_type.push_back('?');
|
||||
is_optional = false;
|
||||
return (*this)(r);
|
||||
}
|
||||
else if(eina::optional<bool> b = call_match
|
||||
(match_table
|
||||
, [&] (match const& m)
|
||||
{
|
||||
|
|
|
@ -707,6 +707,10 @@ inline efl::eina::value_view convert_to_return(Eina_Value* value, tag<Eina_Value
|
|||
{
|
||||
return efl::eina::value_view{value};
|
||||
}
|
||||
inline efl::eina::value_view convert_to_return(Eina_Value const* value, tag<Eina_Value const*, efl::eina::value_view const>)
|
||||
{
|
||||
return efl::eina::value_view{const_cast<Eina_Value*>(value)};
|
||||
}
|
||||
template <typename T, typename U>
|
||||
T convert_to_return(U* value, tag<T, U*>, typename std::enable_if<is_range<T>::value || is_container<T>::value>::type* = 0)
|
||||
{
|
||||
|
|
|
@ -157,6 +157,23 @@ public class Globals {
|
|||
|
||||
public delegate byte class_initializer(IntPtr klass);
|
||||
|
||||
public static T GetParamHelper<T>(Nullable<T> v) where T : struct
|
||||
{
|
||||
return v.Value;
|
||||
}
|
||||
public static U GetParamHelper<U>(U v)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
public static bool ParamHelperCheck<T>(Nullable<T> v) where T : struct
|
||||
{
|
||||
return v.HasValue;
|
||||
}
|
||||
public static bool ParamHelperCheck<U>(U v)
|
||||
{
|
||||
return v != null;
|
||||
}
|
||||
|
||||
public static IntPtr register_class(String class_name, IntPtr base_klass, System.Type type)
|
||||
{
|
||||
ClassDescription description;
|
||||
|
|
|
@ -108,7 +108,7 @@ tcp_connect(void)
|
|||
|
||||
memset(&sa, '\0', sizeof (sa));
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(atoi(PORT));
|
||||
sa.sin_port = eina_htons(atoi(PORT));
|
||||
inet_pton(AF_INET, SERVER, &sa.sin_addr);
|
||||
|
||||
/* connects to server
|
||||
|
|
|
@ -43,13 +43,13 @@ _print_ip_addr_info(const Eo *o)
|
|||
{
|
||||
struct sockaddr_in *a = (struct sockaddr_in *)sa;
|
||||
inet_ntop(sa->sa_family, &a->sin_addr, buf, sizeof(buf));
|
||||
port = ntohs(a->sin_port);
|
||||
port = eina_ntohs(a->sin_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct sockaddr_in6 *a = (struct sockaddr_in6 *)sa;
|
||||
inet_ntop(sa->sa_family, &a->sin6_addr, buf, sizeof(buf));
|
||||
port = ntohs(a->sin6_port);
|
||||
port = eina_ntohs(a->sin6_port);
|
||||
}
|
||||
|
||||
printf("INFO: - sockaddr=%p (%d, '%s', %u)\n",
|
||||
|
|
|
@ -45,11 +45,11 @@ static Efl_Model*
|
|||
_make_model(Evas_Object *win)
|
||||
{
|
||||
Eina_Value vtext;
|
||||
Efl_Model_Item *model, *child;
|
||||
Efl_Generic_Model *model, *child;
|
||||
unsigned int i, s;
|
||||
char buf[256];
|
||||
|
||||
model = efl_add(EFL_MODEL_ITEM_CLASS, win);
|
||||
model = efl_add(EFL_GENERIC_MODEL_CLASS, win);
|
||||
eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
|
||||
|
||||
for (i = 0; i < (NUM_ITEMS); i++)
|
||||
|
@ -74,7 +74,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
Efl_Ui_Factory *factory;
|
||||
Evas_Object *win, *li;
|
||||
Eo *model;
|
||||
Efl_Model_Composite_Selection *selmodel;
|
||||
Efl_Select_Model *selmodel;
|
||||
|
||||
win = elm_win_util_standard_add("list_view", "List_View");
|
||||
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
||||
|
@ -82,7 +82,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
elm_win_autodel_set(win, EINA_TRUE);
|
||||
|
||||
model = _make_model(win);
|
||||
selmodel = efl_add(EFL_MODEL_COMPOSITE_SELECTION_CLASS, efl_main_loop_get()
|
||||
selmodel = efl_add(EFL_SELECT_MODEL_CLASS, efl_main_loop_get()
|
||||
, efl_ui_view_model_set(efl_added, model)
|
||||
);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
if (argv[1] != NULL) dirname = argv[1];
|
||||
else dirname = EFL_MODEL_TEST_FILENAME_PATH;
|
||||
|
||||
model = efl_add(EIO_MODEL_CLASS, win, eio_model_path_set(efl_added, dirname));
|
||||
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_model_connect(factory, "efl.text", "filename");
|
||||
efl_ui_layout_factory_theme_config(factory, "list_item", NULL, "default");
|
||||
|
|
|
@ -70,7 +70,7 @@ _bt_add_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_
|
|||
{
|
||||
Priv_Data *priv = (Priv_Data*)data;
|
||||
Eina_Value vtext, value;
|
||||
Efl_Model_Item *child;
|
||||
Efl_Generic_Model *child;
|
||||
|
||||
eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
|
||||
eina_value_setup(&value, EINA_VALUE_TYPE_UCHAR);
|
||||
|
@ -170,10 +170,10 @@ static Efl_Model*
|
|||
_make_model()
|
||||
{
|
||||
Eina_Value vtext, value;
|
||||
Efl_Model_Item *model, *child;
|
||||
Efl_Generic_Model *model, *child;
|
||||
unsigned int i, len;
|
||||
|
||||
model = efl_add(EFL_MODEL_ITEM_CLASS, efl_main_loop_get());
|
||||
model = efl_add(EFL_GENERIC_MODEL_CLASS, efl_main_loop_get());
|
||||
eina_value_setup(&vtext, EINA_VALUE_TYPE_STRING);
|
||||
eina_value_setup(&value, EINA_VALUE_TYPE_UCHAR);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <Elementary.h>
|
||||
#include <Efl.h>
|
||||
#include <Eio.h>
|
||||
#include <eio_model.eo.h>
|
||||
#include <efl_io_model.eo.h>
|
||||
#include <stdio.h>
|
||||
#include <Eio.h>
|
||||
#include <elm_view_form.h>
|
||||
|
@ -38,7 +38,7 @@ _cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
|
|||
}
|
||||
|
||||
static int
|
||||
_filter_cb(void *data EINA_UNUSED, Eio_Model *model, Eina_File_Direct_Info *info)
|
||||
_filter_cb(void *data EINA_UNUSED, Efl_Io_Model *model, Eina_File_Direct_Info *info)
|
||||
{
|
||||
if (info->type == EINA_FILE_DIR && info->path[info->name_start] != '.') return 1;
|
||||
|
||||
|
@ -124,8 +124,8 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
else dirname = EFL_MODEL_TEST_FILENAME_PATH;
|
||||
|
||||
//treemodel
|
||||
priv.treemodel = efl_add(EIO_MODEL_CLASS, win, eio_model_path_set(efl_added, dirname));
|
||||
eio_model_children_filter_set(priv.treemodel, NULL, _filter_cb, NULL);
|
||||
priv.treemodel = efl_add(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname));
|
||||
efl_io_model_children_filter_set(priv.treemodel, NULL, _filter_cb, NULL);
|
||||
|
||||
//treeview
|
||||
genlist = elm_genlist_add(win);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <Elementary.h>
|
||||
#include <Efl.h>
|
||||
#include <Eio.h>
|
||||
#include <eio_model.eo.h>
|
||||
#include <efl_io_model.eo.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define EFL_MODEL_TEST_FILENAME_PATH "/tmp"
|
||||
|
@ -54,7 +54,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
evas_object_size_hint_weight_set(genlist, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||
evas_object_show(genlist);
|
||||
|
||||
priv.filemodel = efl_add(EIO_MODEL_CLASS, win, eio_model_path_set(efl_added, dirname));
|
||||
priv.filemodel = efl_add(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname));
|
||||
priv.fileview = efl_add(ELM_VIEW_LIST_CLASS, win, elm_view_list_genlist_set(efl_added, genlist, ELM_GENLIST_ITEM_TREE, "double_label"));
|
||||
elm_view_list_model_set(priv.fileview, priv.filemodel);
|
||||
evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, &priv);
|
||||
|
|
|
@ -111,7 +111,7 @@ elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
|
|||
if (argv[1] != NULL) dirname = argv[1];
|
||||
else dirname = EFL_MODEL_TEST_FILENAME_PATH;
|
||||
|
||||
priv->model = efl_add(EIO_MODEL_CLASS, win, eio_model_path_set(efl_added, dirname));
|
||||
priv->model = efl_add(EFL_IO_MODEL_CLASS, win, efl_io_model_path_set(efl_added, dirname));
|
||||
|
||||
genlist = elm_genlist_add(win);
|
||||
priv->fileview = efl_add(ELM_VIEW_LIST_CLASS, win, elm_view_list_genlist_set(efl_added, genlist, ELM_GENLIST_ITEM_NONE, NULL));
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
#include "shmfile.h"
|
||||
#include "timeout.h"
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
@ -142,7 +138,7 @@ read_raw_data()
|
|||
if (image->colors != 3)
|
||||
goto clean_image;
|
||||
#define SWAP(a, b) { a ^= b; a = (b ^=a); }
|
||||
if ((image->bits == 16) && (htons(0x55aa) != 0x55aa))
|
||||
if ((image->bits == 16) && (eina_htons(0x55aa) != 0x55aa))
|
||||
for (count = 0; count < image->data_size; count +=2)
|
||||
SWAP(image->data[count], image->data[count + 1]);
|
||||
#undef SWAP
|
||||
|
|
|
@ -45,14 +45,11 @@
|
|||
Ok, hope this helps with understanding XCF. -- cK.
|
||||
|
||||
*/
|
||||
#include <Eina.h>
|
||||
#include "common.h"
|
||||
#include "shmfile.h"
|
||||
#include "timeout.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h> /* for ntohl() */
|
||||
#endif
|
||||
|
||||
#define FREE(X) { free(X); X = NULL; }
|
||||
|
||||
#define TILE_WIDTH 64
|
||||
|
@ -479,7 +476,7 @@ xcf_read_int32(void *fp,
|
|||
xcf_read_int8(fp, (DATA8*) data, count * 4);
|
||||
while (count--)
|
||||
{
|
||||
*data = (DATA32)ntohl(*data);
|
||||
*data = (DATA32)eina_ntohl(*data);
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,5 @@ generic_src = files([
|
|||
'pixelfuncs.c'
|
||||
])
|
||||
|
||||
generic_deps = [dependency('zlib')]
|
||||
generic_support = ['xcf.gz']
|
||||
generic_deps = [eina, dependency('zlib')]
|
||||
generic_support = ['xcf.gz']
|
||||
|
|
|
@ -109,16 +109,14 @@ EAPI Eo *efl_main_loop_get(void);
|
|||
* @{
|
||||
*/
|
||||
|
||||
#include "efl_model_loop.eo.h"
|
||||
#include "efl_model_item.eo.h"
|
||||
#include "efl_model_container.eo.h"
|
||||
#include "efl_model_container_item.eo.h"
|
||||
#include "efl_model_composite.eo.h"
|
||||
#include "efl_model_composite_boolean.eo.h"
|
||||
#include "efl_model_composite_boolean_children.eo.h"
|
||||
#include "efl_model_composite_selection.eo.h"
|
||||
#include "efl_model_composite_selection_children.eo.h"
|
||||
#include "efl_model_view.eo.h"
|
||||
#include "efl_loop_model.eo.h"
|
||||
#include "efl_generic_model.eo.h"
|
||||
#include "efl_container_model.eo.h"
|
||||
#include "efl_container_model_item.eo.h"
|
||||
#include "efl_composite_model.eo.h"
|
||||
#include "efl_boolean_model.eo.h"
|
||||
#include "efl_select_model.eo.h"
|
||||
#include "efl_view_model.eo.h"
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -247,7 +247,9 @@ _ecore_signal_pipe_init(void)
|
|||
}
|
||||
eina_file_close_on_exec(sig_pipe[0], EINA_TRUE);
|
||||
eina_file_close_on_exec(sig_pipe[1], EINA_TRUE);
|
||||
fcntl(sig_pipe[0], F_SETFL, O_NONBLOCK);
|
||||
if (fcntl(sig_pipe[0], F_SETFL, O_NONBLOCK) < 0)
|
||||
ERR("can't set pipe to NONBLOCK");
|
||||
|
||||
}
|
||||
_signalhandler_setup();
|
||||
if (!sig_pipe_handler)
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Efl_Core.h>
|
||||
|
||||
#include "efl_composite_model_private.h"
|
||||
|
||||
typedef struct _Efl_Boolean_Model_Data Efl_Boolean_Model_Data;
|
||||
typedef struct _Efl_Boolean_Model_Value Efl_Boolean_Model_Value;
|
||||
|
||||
struct _Efl_Boolean_Model_Data
|
||||
{
|
||||
Efl_Boolean_Model_Data *parent;
|
||||
Eina_Hash *values;
|
||||
};
|
||||
|
||||
struct _Efl_Boolean_Model_Value
|
||||
{
|
||||
Eina_Stringshare *property;
|
||||
|
||||
// This is not the best for supporting sparse bitfield with random insertion
|
||||
// but will do for now (Would be best to have a tree of fixed size array
|
||||
// or something along that line).
|
||||
unsigned char *buffer;
|
||||
unsigned int buffer_count;
|
||||
|
||||
Eina_Bool default_value;
|
||||
};
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_boolean_model_efl_model_properties_get(const Eo *obj,
|
||||
Efl_Boolean_Model_Data *pd)
|
||||
{
|
||||
EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props,
|
||||
obj, EFL_BOOLEAN_MODEL_CLASS,
|
||||
eina_hash_iterator_key_new(pd->parent->values));
|
||||
return props;
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_boolean_model_efl_model_property_get(const Eo *obj,
|
||||
Efl_Boolean_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
Efl_Boolean_Model_Value *v;
|
||||
Eina_Stringshare *s;
|
||||
Eina_Bool flag;
|
||||
unsigned int index;
|
||||
|
||||
if (property == NULL) return NULL;
|
||||
|
||||
// If we do not have a parent set that his a BOOLEAN, then we should just forward up the call
|
||||
if (!pd->parent)
|
||||
return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property);
|
||||
|
||||
// Check if this is requesting a defined boolean property
|
||||
// Property are defined and their value are stored on the parent BOOLEAN
|
||||
s = eina_stringshare_add(property);
|
||||
v = eina_hash_find(pd->parent->values, s);
|
||||
eina_stringshare_del(s);
|
||||
|
||||
if (!v) // Not a property handle by this object, forward
|
||||
return efl_model_property_get(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS), property);
|
||||
|
||||
index = efl_composite_model_index_get(obj);
|
||||
|
||||
// As an optimization we do optimistically allocate the boolean array
|
||||
// Better would be to have a sparse boolean array
|
||||
if ((index >> 3) >= v->buffer_count)
|
||||
flag = v->default_value;
|
||||
else
|
||||
flag = v->buffer[index >> 3] & (((unsigned char)1) << (index & 0x7));
|
||||
|
||||
return eina_value_bool_new(!!flag);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_boolean_model_efl_model_property_set(Eo *obj,
|
||||
Efl_Boolean_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Efl_Boolean_Model_Value *v;
|
||||
Eina_Stringshare *s;
|
||||
Eina_Bool flag;
|
||||
unsigned int index;
|
||||
|
||||
if (!property)
|
||||
return efl_loop_future_rejected(obj,
|
||||
EFL_MODEL_ERROR_UNKNOWN);
|
||||
|
||||
// If we do not have a parent set that his a BOOLEAN, then we should just forward up the call
|
||||
if (!pd->parent)
|
||||
return efl_model_property_set(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS),
|
||||
property, value);
|
||||
|
||||
// Check if this is requesting a defined boolean property
|
||||
// Property are defined and their value are stored on the parent BOOLEAN
|
||||
s = eina_stringshare_add(property);
|
||||
v = eina_hash_find(pd->parent->values, s);
|
||||
eina_stringshare_del(s);
|
||||
|
||||
if (!v)
|
||||
return efl_model_property_set(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS),
|
||||
property, value);
|
||||
|
||||
if (!eina_value_bool_convert(value, &flag))
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_UNKNOWN);
|
||||
|
||||
index = efl_composite_model_index_get(obj);
|
||||
|
||||
// We are optimistically allocating the boolean buffer now.
|
||||
// Aligning it on 64bits
|
||||
if (v->buffer_count < (((index) >> 3) | 0x7) + 1)
|
||||
{
|
||||
unsigned int rcount = (((index | 0xF) >> 3) | 0x7) + 1;
|
||||
unsigned char *tmp;
|
||||
|
||||
tmp = realloc(v->buffer, rcount);
|
||||
if (!tmp) return efl_loop_future_rejected(obj, ENOMEM);
|
||||
v->buffer = tmp;
|
||||
memset(v->buffer + v->buffer_count, 0, rcount - v->buffer_count);
|
||||
v->buffer_count = rcount;
|
||||
}
|
||||
|
||||
// It is assumed that during slice get the buffer is properly sized
|
||||
if (flag)
|
||||
v->buffer[index >> 3] |= ((unsigned char)1) << (index & 0x7);
|
||||
else
|
||||
v->buffer[index >> 3] &= ~(((unsigned char)1) << (index & 0x7));
|
||||
|
||||
// Calling "properties,changed" event
|
||||
efl_model_properties_changed(obj, property);
|
||||
|
||||
// Return fulfilled future
|
||||
return efl_loop_future_resolved(obj, eina_value_bool_init(!!flag));
|
||||
}
|
||||
|
||||
static void
|
||||
_boolean_value_free(void *data)
|
||||
{
|
||||
Efl_Boolean_Model_Value *value = data;
|
||||
|
||||
eina_stringshare_del(value->property);
|
||||
value->property = NULL;
|
||||
|
||||
free(value->buffer);
|
||||
value->buffer = NULL;
|
||||
value->buffer_count = 0;
|
||||
|
||||
free(value);
|
||||
}
|
||||
|
||||
static Eo *
|
||||
_efl_boolean_model_efl_object_constructor(Eo *obj, Efl_Boolean_Model_Data *pd)
|
||||
{
|
||||
Eo *parent;
|
||||
obj = efl_constructor(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS));
|
||||
|
||||
if (!obj) return NULL;
|
||||
|
||||
pd->values = eina_hash_stringshared_new(_boolean_value_free);
|
||||
// Only add a reference to the parent if it is actually a BOOLEAN_MODEL_CLASS
|
||||
// The root typically doesn't have any boolean property, only its child do
|
||||
parent = efl_parent_get(obj);
|
||||
if (efl_isa(parent, EFL_BOOLEAN_MODEL_CLASS))
|
||||
pd->parent = efl_data_scope_get(parent, EFL_BOOLEAN_MODEL_CLASS);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_boolean_model_efl_object_destructor(Eo *obj, Efl_Boolean_Model_Data *pd)
|
||||
{
|
||||
eina_hash_free(pd->values);
|
||||
|
||||
efl_destructor(efl_super(obj, EFL_BOOLEAN_MODEL_CLASS));
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_boolean_model_boolean_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Boolean_Model_Data *pd,
|
||||
const char *name, Eina_Bool default_value)
|
||||
{
|
||||
Efl_Boolean_Model_Value *value;
|
||||
|
||||
if (!name) return ;
|
||||
|
||||
value = calloc(1, sizeof (Efl_Boolean_Model_Value));
|
||||
if (!value) return ;
|
||||
|
||||
value->property = eina_stringshare_add(name);
|
||||
value->default_value = default_value;
|
||||
|
||||
eina_hash_direct_add(pd->values, value->property, value);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_boolean_model_boolean_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Boolean_Model_Data *pd,
|
||||
const char *name)
|
||||
{
|
||||
Eina_Stringshare *s;
|
||||
|
||||
s = eina_stringshare_add(name);
|
||||
eina_hash_del(pd->values, s, NULL);
|
||||
eina_stringshare_del(s);
|
||||
}
|
||||
|
||||
#include "efl_boolean_model.eo.c"
|
|
@ -1,6 +1,6 @@
|
|||
class Efl.Model_Composite_Boolean extends Efl.Model_Composite
|
||||
class Efl.Boolean_Model extends Efl.Composite_Model
|
||||
{
|
||||
[[Efl model composite boolean class]]
|
||||
[[Efl boolean model class]]
|
||||
methods {
|
||||
boolean_add {
|
||||
[[Add a new named boolean property with a defined default value.]]
|
||||
|
@ -17,8 +17,9 @@ class Efl.Model_Composite_Boolean extends Efl.Model_Composite
|
|||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Model.properties { get; }
|
||||
Efl.Model.property { get; set; }
|
||||
Efl.Object.constructor;
|
||||
Efl.Object.destructor;
|
||||
Efl.Model.children_slice_get;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,255 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Efl.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
#include "ecore_private.h"
|
||||
|
||||
#include "efl_composite_model.eo.h"
|
||||
|
||||
#define _CHILD_INDEX "child.index"
|
||||
|
||||
typedef struct _Efl_Composite_Model_Data Efl_Composite_Model_Data;
|
||||
|
||||
struct _Efl_Composite_Model_Data
|
||||
{
|
||||
Efl_Model *source;
|
||||
|
||||
unsigned int index;
|
||||
|
||||
Eina_Bool need_index : 1;
|
||||
Eina_Bool set_index : 1;
|
||||
};
|
||||
|
||||
static void
|
||||
_efl_composite_model_efl_object_destructor(Eo *obj, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
if (pd->source)
|
||||
{
|
||||
efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILD_ADDED, obj);
|
||||
efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILD_REMOVED, obj);
|
||||
efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, obj);
|
||||
efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_PROPERTIES_CHANGED, obj);
|
||||
|
||||
efl_unref(pd->source);
|
||||
pd->source = NULL;
|
||||
}
|
||||
|
||||
efl_destructor(efl_super(obj, EFL_COMPOSITE_MODEL_CLASS));
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_composite_model_efl_object_finalize(Eo *obj, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
if (pd->source == NULL)
|
||||
{
|
||||
ERR("Source of the composite model wasn't defined at construction time.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_composite_model_index_set(Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd, unsigned int index)
|
||||
{
|
||||
if (pd->set_index || !pd->source)
|
||||
return ;
|
||||
pd->index = index;
|
||||
pd->set_index = EINA_TRUE;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_composite_model_index_get(const Eo *obj, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
Eina_Value *fetch = NULL;
|
||||
unsigned int r = 0xFFFFFFFF;
|
||||
|
||||
if (pd->set_index)
|
||||
return pd->index;
|
||||
if (pd->need_index)
|
||||
return 0xFFFFFFFF;
|
||||
|
||||
fetch = efl_model_property_get(obj, _CHILD_INDEX);
|
||||
if (!eina_value_uint_convert(fetch, &r))
|
||||
return 0xFFFFFFFF;
|
||||
eina_value_free(fetch);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_composite_model_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd, Efl_Model *model)
|
||||
{
|
||||
Eina_Iterator *properties;
|
||||
const char *property;
|
||||
|
||||
if (pd->source != NULL)
|
||||
{
|
||||
ERR("Source already set for composite model. It can only be set once.");
|
||||
return ;
|
||||
}
|
||||
pd->source = efl_ref(model);
|
||||
|
||||
efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_CHILD_ADDED, EFL_CALLBACK_PRIORITY_BEFORE, obj);
|
||||
efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_CHILD_REMOVED, EFL_CALLBACK_PRIORITY_BEFORE, obj);
|
||||
efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, obj);
|
||||
efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, obj);
|
||||
|
||||
pd->need_index = EINA_TRUE;
|
||||
|
||||
properties = efl_model_properties_get(pd->source);
|
||||
EINA_ITERATOR_FOREACH(properties, property)
|
||||
{
|
||||
if (!strcmp(property, _CHILD_INDEX))
|
||||
{
|
||||
pd->need_index = EINA_FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
eina_iterator_free(properties);
|
||||
}
|
||||
|
||||
static Efl_Model *
|
||||
_efl_composite_model_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
return pd->source;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_composite_model_efl_model_property_set(Eo *obj, Efl_Composite_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
if (pd->need_index && !strcmp(property, _CHILD_INDEX))
|
||||
{
|
||||
if (pd->set_index || !pd->source)
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_READ_ONLY);
|
||||
if (!eina_value_uint_convert(value, &pd->index))
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_UNKNOWN);
|
||||
pd->set_index = EINA_TRUE;
|
||||
return efl_loop_future_resolved(obj, eina_value_uint_init(pd->index));
|
||||
}
|
||||
return efl_model_property_set(pd->source, property, value);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_composite_model_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
if (pd->need_index && !strcmp(property, _CHILD_INDEX))
|
||||
{
|
||||
if (pd->set_index)
|
||||
return eina_value_uint_new(pd->index);
|
||||
return eina_value_error_new(EAGAIN);
|
||||
}
|
||||
return efl_model_property_get(pd->source, property);
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_composite_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
if (pd->need_index)
|
||||
{
|
||||
static const char *composite_properties[] = {
|
||||
_CHILD_INDEX
|
||||
};
|
||||
|
||||
return eina_multi_iterator_new(efl_model_properties_get(pd->source),
|
||||
EINA_C_ARRAY_ITERATOR_NEW(composite_properties));
|
||||
}
|
||||
return efl_model_properties_get(pd->source);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_composite_model_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
return efl_model_children_count_get(pd->source);
|
||||
}
|
||||
|
||||
typedef struct _Efl_Composite_Model_Slice_Request Efl_Composite_Model_Slice_Request;
|
||||
struct _Efl_Composite_Model_Slice_Request
|
||||
{
|
||||
const Efl_Class *self;
|
||||
Eo *parent;
|
||||
unsigned int start;
|
||||
};
|
||||
|
||||
static Eina_Value
|
||||
_efl_composite_model_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v)
|
||||
{
|
||||
Efl_Composite_Model_Slice_Request *req = data;
|
||||
unsigned int i, len;
|
||||
Eina_Value r = EINA_VALUE_EMPTY;
|
||||
Eo *target = NULL;
|
||||
|
||||
eina_value_array_setup(&r, EINA_VALUE_TYPE_OBJECT, 4);
|
||||
|
||||
EINA_VALUE_ARRAY_FOREACH(&v, len, i, target)
|
||||
{
|
||||
Eo *composite;
|
||||
|
||||
// First set the Model to be used as a source so that we the newly object
|
||||
// can know if it needs to retain the information regarding its index.
|
||||
composite = efl_add(req->self, req->parent,
|
||||
efl_ui_view_model_set(efl_added, target),
|
||||
efl_composite_model_index_set(efl_added, req->start + i));
|
||||
|
||||
eina_value_array_append(&r, composite);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_composite_model_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Efl_Composite_Model_Slice_Request *req = data;
|
||||
|
||||
efl_unref(req->parent);
|
||||
free(data);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_composite_model_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Composite_Model_Data *pd,
|
||||
unsigned int start,
|
||||
unsigned int count)
|
||||
{
|
||||
Efl_Composite_Model_Slice_Request *req;
|
||||
Eina_Future *f;
|
||||
|
||||
f = efl_model_children_slice_get(pd->source, start, count);
|
||||
if (!f) return NULL;
|
||||
|
||||
req = malloc(sizeof (Efl_Composite_Model_Slice_Request));
|
||||
if (!req) return efl_loop_future_rejected(obj, ENOMEM);
|
||||
|
||||
req->self = efl_class_get(obj);
|
||||
req->parent = efl_ref(obj);
|
||||
req->start = start;
|
||||
|
||||
return efl_future_then(obj, f, .success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _efl_composite_model_then,
|
||||
.free = _efl_composite_model_clean,
|
||||
.data = req);
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_composite_model_efl_model_child_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Composite_Model_Data *pd)
|
||||
{
|
||||
return efl_model_child_add(pd->source);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_composite_model_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Composite_Model_Data *pd,
|
||||
Efl_Object *child)
|
||||
{
|
||||
efl_model_child_del(pd->source, child);
|
||||
}
|
||||
|
||||
#include "efl_composite_model.eo.c"
|
|
@ -0,0 +1,36 @@
|
|||
class Efl.Composite_Model extends Efl.Loop_Model implements Efl.Ui.View
|
||||
{
|
||||
[[Efl model for all composite class which provide a unified API to set source of data.
|
||||
|
||||
This class also provide an @Efl.Model.property "$child.index" that match the value of @.index.]]
|
||||
methods {
|
||||
@property index {
|
||||
[[Position of this object in the parent model.]]
|
||||
set {
|
||||
[[Set the index. It can only be set before the object is finalized,
|
||||
but after the Model it compose is set and only if that Model does
|
||||
not provide an index already.]]
|
||||
}
|
||||
get {
|
||||
[[Get the index. It will only work after the object has been finalized.]]
|
||||
}
|
||||
values {
|
||||
index: uint; [[Index of the object in the parent model. The index is uniq and start from zero.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Object.destructor;
|
||||
Efl.Object.finalize;
|
||||
Efl.Ui.View.model { set; get; }
|
||||
Efl.Model.property { set; get; }
|
||||
Efl.Model.properties { get; }
|
||||
Efl.Model.children_count { get; }
|
||||
Efl.Model.children_slice_get;
|
||||
Efl.Model.child_add;
|
||||
Efl.Model.child_del;
|
||||
}
|
||||
constructors {
|
||||
.index;
|
||||
}
|
||||
}
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
#define EFL_MODEL_COMPOSITE_PROPERTIES(name, dyn, sta, ...) \
|
||||
EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(name, NULL, NULL, (dyn), sta, ##__VA_ARGS__)
|
||||
#define EFL_COMPOSITE_MODEL_PROPERTIES(name, dyn, sta, ...) \
|
||||
EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, NULL, NULL, (dyn), sta, ##__VA_ARGS__)
|
||||
|
||||
#define EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(name, obj, klass, dyn, ...) \
|
||||
#define EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(name, obj, klass, dyn, ...) \
|
||||
Eina_Iterator *name; \
|
||||
do \
|
||||
{ \
|
||||
static const char *static_props__[] = { \
|
||||
__VA_ARGS__ \
|
||||
}; \
|
||||
name = _efl_model_composite_properties_mix( \
|
||||
name = _efl_composite_model_properties_mix( \
|
||||
((obj) ? efl_model_properties_get(efl_super((obj), (klass))) : NULL), \
|
||||
(dyn), \
|
||||
EINA_C_ARRAY_ITERATOR_NEW(static_props__)); \
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
|
||||
static inline Eina_Iterator *
|
||||
_efl_model_composite_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Eina_Iterator *sta)
|
||||
_efl_composite_model_properties_mix(Eina_Iterator *super, Eina_Iterator *dyn, Eina_Iterator *sta)
|
||||
{
|
||||
Eina_Iterator *its[3];
|
||||
int i = 0;
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
#include "ecore_internal.h"
|
||||
|
||||
#include "efl_model_container_private.h"
|
||||
#include "efl_container_model_private.h"
|
||||
|
||||
#define MY_CLASS EFL_MODEL_CONTAINER_CLASS
|
||||
#define MY_CLASS EFL_CONTAINER_MODEL_CLASS
|
||||
|
||||
void *
|
||||
_value_copy_alloc(void *v, const Eina_Value_Type *type)
|
||||
|
@ -65,8 +65,8 @@ _property_data_free_cb(void *data)
|
|||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_container_efl_object_constructor(Eo *obj,
|
||||
Efl_Model_Container_Data *sd)
|
||||
_efl_container_model_efl_object_constructor(Eo *obj,
|
||||
Efl_Container_Model_Data *sd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
if (!obj)
|
||||
|
@ -79,8 +79,8 @@ _efl_model_container_efl_object_constructor(Eo *obj,
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_container_efl_object_destructor(Eo *obj,
|
||||
Efl_Model_Container_Data *sd)
|
||||
_efl_container_model_efl_object_destructor(Eo *obj,
|
||||
Efl_Container_Model_Data *sd)
|
||||
{
|
||||
Eina_Stringshare *key;
|
||||
Eina_Iterator *it;
|
||||
|
@ -98,8 +98,8 @@ _efl_model_container_efl_object_destructor(Eo *obj,
|
|||
}
|
||||
|
||||
static const Eina_Value_Type *
|
||||
_efl_model_container_child_property_value_type_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Data *sd,
|
||||
_efl_container_model_child_property_value_type_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Data *sd,
|
||||
const char *property)
|
||||
{
|
||||
Child_Property_Data *cpd;
|
||||
|
@ -114,8 +114,8 @@ _efl_model_container_child_property_value_type_get(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_container_child_property_values_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Data *sd,
|
||||
_efl_container_model_child_property_values_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Data *sd,
|
||||
const char *property)
|
||||
{
|
||||
Child_Property_Data *cpd;
|
||||
|
@ -130,8 +130,8 @@ _efl_model_container_child_property_values_get(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_efl_model_container_child_property_add(Eo *obj,
|
||||
Efl_Model_Container_Data *sd,
|
||||
_efl_container_model_child_property_add(Eo *obj,
|
||||
Efl_Container_Model_Data *sd,
|
||||
const char *name,
|
||||
const Eina_Value_Type *type,
|
||||
Eina_Iterator *values)
|
||||
|
@ -198,8 +198,8 @@ _efl_model_container_child_property_add(Eo *obj,
|
|||
Efl_Model_Children_Event cevt = { 0 };
|
||||
Efl_Model *child;
|
||||
|
||||
child = efl_add(EFL_MODEL_CONTAINER_ITEM_CLASS, obj,
|
||||
efl_model_container_item_define(efl_added, sd, i));
|
||||
child = efl_add(EFL_CONTAINER_MODEL_ITEM_CLASS, obj,
|
||||
efl_container_model_item_define(efl_added, sd, i));
|
||||
sd->childrens = eina_list_append(sd->childrens, child);
|
||||
|
||||
cevt.index = i;
|
||||
|
@ -222,14 +222,14 @@ _efl_model_container_child_property_add(Eo *obj,
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_container_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd)
|
||||
_efl_container_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Container_Model_Data *sd)
|
||||
{
|
||||
return eina_hash_iterator_key_new(sd->properties);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_container_efl_model_property_set(Eo *obj,
|
||||
Efl_Model_Container_Data *pd EINA_UNUSED,
|
||||
_efl_container_model_efl_model_property_set(Eo *obj,
|
||||
Efl_Container_Model_Data *pd EINA_UNUSED,
|
||||
const char *property EINA_UNUSED,
|
||||
Eina_Value *value EINA_UNUSED)
|
||||
{
|
||||
|
@ -238,16 +238,16 @@ _efl_model_container_efl_model_property_set(Eo *obj,
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_container_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Data *pd EINA_UNUSED,
|
||||
_efl_container_model_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Data *pd EINA_UNUSED,
|
||||
const char *property EINA_UNUSED)
|
||||
{
|
||||
return eina_value_error_new(EFL_MODEL_ERROR_NOT_FOUND);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_container_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Model_Container_Data *sd,
|
||||
_efl_container_model_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Container_Model_Data *sd,
|
||||
unsigned int start,
|
||||
unsigned int count)
|
||||
{
|
||||
|
@ -258,13 +258,13 @@ _efl_model_container_efl_model_children_slice_get(Eo *obj,
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_model_container_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd)
|
||||
_efl_container_model_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Container_Model_Data *sd)
|
||||
{
|
||||
return eina_list_count(sd->childrens);
|
||||
}
|
||||
|
||||
static Eo *
|
||||
_efl_model_container_efl_model_child_add(Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd EINA_UNUSED)
|
||||
_efl_container_model_efl_model_child_add(Eo *obj EINA_UNUSED, Efl_Container_Model_Data *sd EINA_UNUSED)
|
||||
{
|
||||
EINA_LOG_WARN("child_add not supported by Efl.Model.Container");
|
||||
eina_error_set(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
|
@ -273,10 +273,10 @@ _efl_model_container_efl_model_child_add(Eo *obj EINA_UNUSED, Efl_Model_Containe
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_container_efl_model_child_del(Eo *obj EINA_UNUSED, Efl_Model_Container_Data *sd EINA_UNUSED, Eo *child EINA_UNUSED)
|
||||
_efl_container_model_efl_model_child_del(Eo *obj EINA_UNUSED, Efl_Container_Model_Data *sd EINA_UNUSED, Eo *child EINA_UNUSED)
|
||||
{
|
||||
EINA_LOG_WARN("child_del not supported by Efl.Model.Container");
|
||||
eina_error_set(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
#include "efl_model_container.eo.c"
|
||||
#include "efl_container_model.eo.c"
|
|
@ -1,12 +1,12 @@
|
|||
import eina_types;
|
||||
|
||||
class Efl.Model_Container extends Efl.Model_Loop
|
||||
class Efl.Container_Model extends Efl.Loop_Model
|
||||
{
|
||||
[[
|
||||
Class used to create data models from Eina containers.
|
||||
|
||||
Each container supplied represents a series of property values, each item
|
||||
being the property value for a child object (@Efl.Model_Container_Item).
|
||||
being the property value for a child object (@Efl.Container_Model_Item).
|
||||
|
||||
The data in the given containers are copied and stored internally.
|
||||
|
|
@ -5,19 +5,19 @@
|
|||
#include <Efl.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
#include "efl_model_container_private.h"
|
||||
#include "efl_container_model_private.h"
|
||||
|
||||
#define MY_CLASS EFL_MODEL_CONTAINER_ITEM_CLASS
|
||||
#define MY_CLASS EFL_CONTAINER_MODEL_ITEM_CLASS
|
||||
|
||||
static void
|
||||
_efl_model_container_item_define(Eo *obj EINA_UNUSED, Efl_Model_Container_Item_Data *sd, void *parent_data, unsigned int index)
|
||||
_efl_container_model_item_define(Eo *obj EINA_UNUSED, Efl_Container_Model_Item_Data *sd, void *parent_data, unsigned int index)
|
||||
{
|
||||
sd->parent_data = parent_data;
|
||||
sd->index = index;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_model_container_item_efl_object_invalidate(Eo *obj, Efl_Model_Container_Item_Data *sd)
|
||||
_efl_container_model_item_efl_object_invalidate(Eo *obj, Efl_Container_Model_Item_Data *sd)
|
||||
{
|
||||
efl_invalidate(efl_super(obj, MY_CLASS));
|
||||
|
||||
|
@ -26,14 +26,14 @@ _efl_model_container_item_efl_object_invalidate(Eo *obj, Efl_Model_Container_Ite
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_container_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Container_Item_Data *sd)
|
||||
_efl_container_model_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Container_Model_Item_Data *sd)
|
||||
{
|
||||
// FIXME: Not to sure here, shouldn't we extend a child of the parent actually ?
|
||||
return efl_model_properties_get(sd->parent_data->obj);
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_container_item_efl_object_finalize(Eo *obj, Efl_Model_Container_Item_Data *pd)
|
||||
_efl_container_model_item_efl_object_finalize(Eo *obj, Efl_Container_Model_Item_Data *pd)
|
||||
{
|
||||
if (!pd->parent_data)
|
||||
return NULL;
|
||||
|
@ -42,8 +42,8 @@ _efl_model_container_item_efl_object_finalize(Eo *obj, Efl_Model_Container_Item_
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_container_item_efl_model_property_set(Eo *obj,
|
||||
Efl_Model_Container_Item_Data *sd,
|
||||
_efl_container_model_item_efl_model_property_set(Eo *obj,
|
||||
Efl_Container_Model_Item_Data *sd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Eina_Stringshare *name;
|
||||
|
@ -91,8 +91,8 @@ _efl_model_container_item_efl_model_property_set(Eo *obj,
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_container_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Item_Data *sd,
|
||||
_efl_container_model_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Item_Data *sd,
|
||||
const char *property)
|
||||
{
|
||||
Eina_Stringshare *name;
|
||||
|
@ -127,8 +127,8 @@ _efl_model_container_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Future *
|
||||
_efl_model_container_item_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Model_Container_Item_Data *sd EINA_UNUSED,
|
||||
_efl_container_model_item_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Container_Model_Item_Data *sd EINA_UNUSED,
|
||||
unsigned int start EINA_UNUSED,
|
||||
unsigned int count EINA_UNUSED)
|
||||
{
|
||||
|
@ -136,15 +136,15 @@ _efl_model_container_item_efl_model_children_slice_get(Eo *obj,
|
|||
}
|
||||
|
||||
EOLIAN static unsigned int
|
||||
_efl_model_container_item_efl_model_children_count_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Item_Data *sd EINA_UNUSED)
|
||||
_efl_container_model_item_efl_model_children_count_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Item_Data *sd EINA_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EOLIAN static Eo *
|
||||
_efl_model_container_item_efl_model_child_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Item_Data *sd EINA_UNUSED)
|
||||
_efl_container_model_item_efl_model_child_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Item_Data *sd EINA_UNUSED)
|
||||
{
|
||||
EINA_LOG_WARN("child_add not supported by Efl.Model.Container.Item");
|
||||
eina_error_set(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
|
@ -153,12 +153,12 @@ _efl_model_container_item_efl_model_child_add(Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_model_container_item_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Container_Item_Data *sd EINA_UNUSED,
|
||||
_efl_container_model_item_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Container_Model_Item_Data *sd EINA_UNUSED,
|
||||
Eo *child EINA_UNUSED)
|
||||
{
|
||||
EINA_LOG_WARN("child_del not supported by Efl.Model.Container.Item");
|
||||
eina_error_set(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
#include "efl_model_container_item.eo.c"
|
||||
#include "efl_container_model_item.eo.c"
|
|
@ -1,19 +1,19 @@
|
|||
class Efl.Model_Container_Item extends Efl.Object implements Efl.Model
|
||||
class Efl.Container_Model_Item extends Efl.Object implements Efl.Model
|
||||
{
|
||||
[[
|
||||
Used as a child of @Efl.Model_Container.
|
||||
Used as a child of @Efl.Container_Model.
|
||||
|
||||
Provides the @Efl.Model API for elements of @Efl.Model_Container.
|
||||
Provides the @Efl.Model API for elements of @Efl.Container_Model.
|
||||
Should not be used in another context, so do not manually create objects
|
||||
of this class.
|
||||
]]
|
||||
methods {
|
||||
define {
|
||||
[[Defines @Efl.Model_Container_Item internal data.]]
|
||||
[[Defines @Efl.Container_Model_Item internal data.]]
|
||||
params {
|
||||
parent_data: void_ptr; [[Pointer to the private data of the
|
||||
@Efl.Model_Container parent object.]]
|
||||
index: uint; [[Index of this item within the @Efl.Model_Container
|
||||
@Efl.Container_Model parent object.]]
|
||||
index: uint; [[Index of this item within the @Efl.Container_Model
|
||||
children.]]
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef EFL_MODEL_CONTAINER_PRIVATE_H__
|
||||
#define EFL_MODEL_CONTAINER_PRIVATE_H__
|
||||
#ifndef EFL_CONTAINER_MODEL_PRIVATE_H__
|
||||
#define EFL_CONTAINER_MODEL_PRIVATE_H__
|
||||
|
||||
typedef struct _Child_Property_Data Child_Property_Data;
|
||||
struct _Child_Property_Data
|
||||
|
@ -8,8 +8,8 @@ struct _Child_Property_Data
|
|||
Eina_Array *values;
|
||||
};
|
||||
|
||||
typedef struct _Efl_Model_Container_Data Efl_Model_Container_Data;
|
||||
struct _Efl_Model_Container_Data
|
||||
typedef struct _Efl_Container_Model_Data Efl_Container_Model_Data;
|
||||
struct _Efl_Container_Model_Data
|
||||
{
|
||||
Eo *obj;
|
||||
|
||||
|
@ -19,10 +19,10 @@ struct _Efl_Model_Container_Data
|
|||
};
|
||||
|
||||
|
||||
typedef struct _Efl_Model_Container_Item_Data Efl_Model_Container_Item_Data;
|
||||
struct _Efl_Model_Container_Item_Data
|
||||
typedef struct _Efl_Container_Model_Item_Data Efl_Container_Model_Item_Data;
|
||||
struct _Efl_Container_Model_Item_Data
|
||||
{
|
||||
Efl_Model_Container_Data *parent_data;
|
||||
Efl_Container_Model_Data *parent_data;
|
||||
unsigned int index;
|
||||
};
|
||||
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
#include "ecore_internal.h"
|
||||
|
||||
#define MY_CLASS EFL_MODEL_ITEM_CLASS
|
||||
#define MY_CLASS EFL_GENERIC_MODEL_CLASS
|
||||
|
||||
typedef struct _Efl_Model_Item_Data Efl_Model_Item_Data;
|
||||
struct _Efl_Model_Item_Data
|
||||
typedef struct _Efl_Generic_Model_Data Efl_Generic_Model_Data;
|
||||
struct _Efl_Generic_Model_Data
|
||||
{
|
||||
Eina_Hash *properties;
|
||||
Eina_List *childrens;
|
||||
|
@ -30,7 +30,7 @@ _stringshared_keys_free(const Eina_Hash *hash EINA_UNUSED, const void *key, void
|
|||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_item_efl_object_constructor(Eo *obj, Efl_Model_Item_Data *sd)
|
||||
_efl_generic_model_efl_object_constructor(Eo *obj, Efl_Generic_Model_Data *sd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||
if (!obj)
|
||||
|
@ -42,7 +42,7 @@ _efl_model_item_efl_object_constructor(Eo *obj, Efl_Model_Item_Data *sd)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_item_efl_object_destructor(Eo *obj, Efl_Model_Item_Data *sd)
|
||||
_efl_generic_model_efl_object_destructor(Eo *obj, Efl_Generic_Model_Data *sd)
|
||||
{
|
||||
eina_list_free(sd->childrens);
|
||||
eina_hash_foreach(sd->properties, _stringshared_keys_free, NULL);
|
||||
|
@ -52,13 +52,13 @@ _efl_model_item_efl_object_destructor(Eo *obj, Efl_Model_Item_Data *sd)
|
|||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_item_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Item_Data *pd)
|
||||
_efl_generic_model_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Generic_Model_Data *pd)
|
||||
{
|
||||
return eina_hash_iterator_key_new(pd->properties);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_item_efl_model_property_set(Eo *obj, Efl_Model_Item_Data *pd, const char *property, Eina_Value *value)
|
||||
_efl_generic_model_efl_model_property_set(Eo *obj, Efl_Generic_Model_Data *pd, const char *property, Eina_Value *value)
|
||||
{
|
||||
Eina_Stringshare *prop;
|
||||
Eina_Value *exist;
|
||||
|
@ -110,9 +110,9 @@ _efl_model_item_efl_model_property_set(Eo *obj, Efl_Model_Item_Data *pd, const c
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Item_Data *pd,
|
||||
const char *property)
|
||||
_efl_generic_model_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Generic_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
Eina_Stringshare *prop;
|
||||
Eina_Value *value;
|
||||
|
@ -128,7 +128,7 @@ _efl_model_item_efl_model_property_get(const Eo *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_item_efl_model_children_slice_get(Eo *obj, Efl_Model_Item_Data *pd, unsigned int start, unsigned int count)
|
||||
_efl_generic_model_efl_model_children_slice_get(Eo *obj, Efl_Generic_Model_Data *pd, unsigned int start, unsigned int count)
|
||||
{
|
||||
Eina_Value v;
|
||||
|
||||
|
@ -137,21 +137,21 @@ _efl_model_item_efl_model_children_slice_get(Eo *obj, Efl_Model_Item_Data *pd, u
|
|||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_model_item_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Model_Item_Data *pd)
|
||||
_efl_generic_model_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Generic_Model_Data *pd)
|
||||
{
|
||||
return eina_list_count(pd->childrens);
|
||||
}
|
||||
|
||||
static Eo *
|
||||
_efl_model_item_efl_model_child_add(Eo *obj, Efl_Model_Item_Data *sd)
|
||||
_efl_generic_model_efl_model_child_add(Eo *obj, Efl_Generic_Model_Data *sd)
|
||||
{
|
||||
Efl_Model_Children_Event cevt;
|
||||
Efl_Model *child;
|
||||
|
||||
child = efl_add(EFL_MODEL_ITEM_CLASS, obj);
|
||||
child = efl_add(EFL_GENERIC_MODEL_CLASS, obj);
|
||||
if (!child)
|
||||
{
|
||||
EINA_LOG_ERR("Could not allocate Efl.Model.Item");
|
||||
EINA_LOG_ERR("Could not allocate Efl.Generic_Model");
|
||||
eina_error_set(EFL_MODEL_ERROR_UNKNOWN);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ _efl_model_item_efl_model_child_add(Eo *obj, Efl_Model_Item_Data *sd)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_item_efl_model_child_del(Eo *obj, Efl_Model_Item_Data *sd, Eo *child)
|
||||
_efl_generic_model_efl_model_child_del(Eo *obj, Efl_Generic_Model_Data *sd, Eo *child)
|
||||
{
|
||||
Efl_Model *data;
|
||||
Eina_List *l;
|
||||
|
@ -194,4 +194,4 @@ _efl_model_item_efl_model_child_del(Eo *obj, Efl_Model_Item_Data *sd, Eo *child)
|
|||
}
|
||||
}
|
||||
|
||||
#include "efl_model_item.eo.c"
|
||||
#include "efl_generic_model.eo.c"
|
|
@ -1,4 +1,4 @@
|
|||
class Efl.Model_Item extends Efl.Model_Loop
|
||||
class Efl.Generic_Model extends Efl.Loop_Model
|
||||
{
|
||||
[[
|
||||
Generic model that allows any property to be manually set.
|
|
@ -1,7 +1,7 @@
|
|||
abstract Efl.Loop_Consumer extends Efl.Object
|
||||
{
|
||||
[[An Efl.Loop_Consumer is a class which requires one of the parents to provide
|
||||
an Efl.Loop interface when performing provider_find. It will enforce this by
|
||||
[[An @Efl.Loop_Consumer is a class which requires one of the parents to provide
|
||||
an @Efl.Loop interface when performing @Efl.Object.provider_find. It will enforce this by
|
||||
only allowing parents which provide such an interface or $NULL.]]
|
||||
eo_prefix: efl_loop;
|
||||
methods {
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
#include <Ecore.h>
|
||||
#include "Eo.h"
|
||||
|
||||
#include "efl_model_loop.eo.h"
|
||||
#include "efl_loop_model.eo.h"
|
||||
|
||||
typedef struct _Efl_Model_Loop_Watcher_Data Efl_Model_Loop_Watcher_Data;
|
||||
typedef struct _Efl_Loop_Model_Watcher_Data Efl_Loop_Model_Watcher_Data;
|
||||
|
||||
struct _Efl_Model_Loop_Watcher_Data
|
||||
struct _Efl_Loop_Model_Watcher_Data
|
||||
{
|
||||
const char *property;
|
||||
Eina_Promise *p;
|
||||
|
@ -21,7 +21,7 @@ struct _Efl_Model_Loop_Watcher_Data
|
|||
static void _propagate_future(void *data, const Efl_Event *event);
|
||||
|
||||
static void
|
||||
_efl_model_loop_wathcer_free(Efl_Model_Loop_Watcher_Data *wd)
|
||||
_efl_loop_model_wathcer_free(Efl_Loop_Model_Watcher_Data *wd)
|
||||
{
|
||||
efl_event_callback_del(wd->obj, EFL_MODEL_EVENT_PROPERTIES_CHANGED,
|
||||
_propagate_future, wd);
|
||||
|
@ -36,7 +36,7 @@ _propagate_future(void *data, const Efl_Event *event)
|
|||
const char *property;
|
||||
unsigned int i;
|
||||
Eina_Array_Iterator it;
|
||||
Efl_Model_Loop_Watcher_Data *wd = data;
|
||||
Efl_Loop_Model_Watcher_Data *wd = data;
|
||||
|
||||
EINA_ARRAY_ITER_NEXT(ev->changed_properties, i, property, it)
|
||||
if (property == wd->property || !strcmp(property, wd->property))
|
||||
|
@ -60,7 +60,7 @@ _propagate_future(void *data, const Efl_Event *event)
|
|||
}
|
||||
|
||||
eina_value_free(v);
|
||||
_efl_model_loop_wathcer_free(wd);
|
||||
_efl_loop_model_wathcer_free(wd);
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
@ -68,11 +68,11 @@ _propagate_future(void *data, const Efl_Event *event)
|
|||
static void
|
||||
_event_cancel(void *data, const Eina_Promise *dead_ptr EINA_UNUSED)
|
||||
{
|
||||
_efl_model_loop_wathcer_free(data);
|
||||
_efl_loop_model_wathcer_free(data);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_loop_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, const char *property)
|
||||
_efl_loop_model_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, const char *property)
|
||||
{
|
||||
Eina_Value *value = efl_model_property_get(obj, property);
|
||||
Eina_Future *f;
|
||||
|
@ -86,7 +86,7 @@ _efl_model_loop_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, cons
|
|||
|
||||
if (err == EAGAIN)
|
||||
{
|
||||
Efl_Model_Loop_Watcher_Data *wd = calloc(1, sizeof (Efl_Model_Loop_Watcher_Data));
|
||||
Efl_Loop_Model_Watcher_Data *wd = calloc(1, sizeof (Efl_Loop_Model_Watcher_Data));
|
||||
|
||||
wd->obj = obj;
|
||||
wd->property = eina_stringshare_add(property);
|
||||
|
@ -106,4 +106,4 @@ _efl_model_loop_efl_model_property_ready_get(Eo *obj, void *pd EINA_UNUSED, cons
|
|||
return efl_future_then(obj, f);
|
||||
}
|
||||
|
||||
#include "efl_model_loop.eo.c"
|
||||
#include "efl_loop_model.eo.c"
|
|
@ -1,4 +1,4 @@
|
|||
abstract Efl.Model_Loop extends Efl.Loop_Consumer implements Efl.Model
|
||||
abstract Efl.Loop_Model extends Efl.Loop_Consumer implements Efl.Model
|
||||
{
|
||||
data: null;
|
||||
implements {
|
|
@ -1,121 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Efl.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
#include "ecore_private.h"
|
||||
|
||||
#include "efl_model_composite.eo.h"
|
||||
|
||||
typedef struct _Efl_Model_Composite_Data Efl_Model_Composite_Data;
|
||||
|
||||
struct _Efl_Model_Composite_Data
|
||||
{
|
||||
Efl_Model *source;
|
||||
};
|
||||
|
||||
static void
|
||||
_efl_model_composite_efl_object_destructor(Eo *obj, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
if (pd->source)
|
||||
{
|
||||
efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILD_ADDED, obj);
|
||||
efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILD_REMOVED, obj);
|
||||
efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, obj);
|
||||
efl_event_callback_forwarder_del(pd->source, EFL_MODEL_EVENT_PROPERTIES_CHANGED, obj);
|
||||
|
||||
efl_unref(pd->source);
|
||||
pd->source = NULL;
|
||||
}
|
||||
|
||||
efl_destructor(efl_super(obj, EFL_MODEL_COMPOSITE_CLASS));
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_composite_efl_object_finalize(Eo *obj, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
if (pd->source == NULL)
|
||||
{
|
||||
ERR("Source of the composite model wasn't defined at construction time.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd, Efl_Model *model)
|
||||
{
|
||||
if (pd->source != NULL)
|
||||
{
|
||||
ERR("Source already set for composite model. It can only be set once.");
|
||||
return ;
|
||||
}
|
||||
pd->source = efl_ref(model);
|
||||
|
||||
efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_CHILD_ADDED, EFL_CALLBACK_PRIORITY_BEFORE, obj);
|
||||
efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_CHILD_REMOVED, EFL_CALLBACK_PRIORITY_BEFORE, obj);
|
||||
efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_CHILDREN_COUNT_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, obj);
|
||||
efl_event_callback_forwarder_priority_add(model, EFL_MODEL_EVENT_PROPERTIES_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, obj);
|
||||
}
|
||||
|
||||
static Efl_Model *
|
||||
_efl_model_composite_efl_ui_view_model_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
return pd->source;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_efl_model_property_set(Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
return efl_model_property_set(pd->source, property, value);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_composite_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
return efl_model_property_get(pd->source, property);
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_composite_efl_model_properties_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
return efl_model_properties_get(pd->source);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_model_composite_efl_model_children_count_get(const Eo *obj EINA_UNUSED, Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
return efl_model_children_count_get(pd->source);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_efl_model_children_slice_get(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Data *pd,
|
||||
unsigned int start,
|
||||
unsigned int count)
|
||||
{
|
||||
return efl_model_children_slice_get(pd->source, start, count);
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_composite_efl_model_child_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Data *pd)
|
||||
{
|
||||
return efl_model_child_add(pd->source);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_efl_model_child_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Data *pd,
|
||||
Efl_Object *child)
|
||||
{
|
||||
efl_model_child_del(pd->source, child);
|
||||
}
|
||||
|
||||
#include "efl_model_composite.eo.c"
|
|
@ -1,15 +0,0 @@
|
|||
class Efl.Model_Composite extends Efl.Model_Loop implements Efl.Ui.View
|
||||
{
|
||||
[[Efl model for all composite class which provide a unified API to set source of data]]
|
||||
implements {
|
||||
Efl.Object.destructor;
|
||||
Efl.Object.finalize;
|
||||
Efl.Ui.View.model { set; get; }
|
||||
Efl.Model.property { set; get; }
|
||||
Efl.Model.properties { get; }
|
||||
Efl.Model.children_count { get; }
|
||||
Efl.Model.children_slice_get;
|
||||
Efl.Model.child_add;
|
||||
Efl.Model.child_del;
|
||||
}
|
||||
}
|
|
@ -1,307 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <Efl_Core.h>
|
||||
|
||||
#include "efl_model_composite_boolean_children.eo.h"
|
||||
#include "efl_model_composite_private.h"
|
||||
|
||||
typedef struct _Efl_Model_Composite_Boolean_Data Efl_Model_Composite_Boolean_Data;
|
||||
typedef struct _Efl_Model_Composite_Boolean_Children_Data Efl_Model_Composite_Boolean_Children_Data;
|
||||
typedef struct _Efl_Model_Composite_Boolean_Value Efl_Model_Composite_Boolean_Value;
|
||||
|
||||
struct _Efl_Model_Composite_Boolean_Data
|
||||
{
|
||||
Eina_Hash *values;
|
||||
};
|
||||
|
||||
struct _Efl_Model_Composite_Boolean_Value
|
||||
{
|
||||
Eina_Stringshare *property;
|
||||
|
||||
// This is not the best for supporting sparse bitfield with random insertion
|
||||
// but will do for now (Would be best to have a tree of fixed size array
|
||||
// or something along that line).
|
||||
unsigned char *buffer;
|
||||
unsigned int buffer_count;
|
||||
|
||||
Eina_Bool default_value;
|
||||
};
|
||||
|
||||
struct _Efl_Model_Composite_Boolean_Children_Data
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Data *parent;
|
||||
unsigned int index;
|
||||
};
|
||||
|
||||
/**************** efl_mmodel_composite_boolean_children **************/
|
||||
|
||||
static void
|
||||
_efl_model_composite_boolean_children_index_set(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Boolean_Children_Data *pd,
|
||||
unsigned int index)
|
||||
{
|
||||
if (pd->parent) // This is set during finalize
|
||||
return ;
|
||||
|
||||
pd->index = index;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
_efl_model_composite_boolean_children_index_get(const Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Boolean_Children_Data *pd)
|
||||
{
|
||||
return pd->index;
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_composite_boolean_children_efl_object_finalize(Eo *obj,
|
||||
Efl_Model_Composite_Boolean_Children_Data *pd)
|
||||
{
|
||||
Eo *parent;
|
||||
|
||||
parent = efl_parent_get(obj);
|
||||
if (!parent) return NULL;
|
||||
pd->parent = efl_data_scope_get(parent, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_composite_boolean_children_efl_model_properties_get(const Eo *obj,
|
||||
Efl_Model_Composite_Boolean_Children_Data *pd)
|
||||
{
|
||||
EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(props,
|
||||
obj, EFL_MODEL_COMPOSITE_BOOLEAN_CHILDREN_CLASS,
|
||||
eina_hash_iterator_key_new(pd->parent->values),
|
||||
"child.index");
|
||||
return props;
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_composite_boolean_children_efl_model_property_get(const Eo *obj,
|
||||
Efl_Model_Composite_Boolean_Children_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Value *v;
|
||||
Eina_Stringshare *s;
|
||||
Eina_Bool flag;
|
||||
|
||||
if (property == NULL) return NULL;
|
||||
if (strcmp(property, "child.index") == 0)
|
||||
return eina_value_uint_new(pd->index);
|
||||
|
||||
s = eina_stringshare_add(property);
|
||||
v = eina_hash_find(pd->parent->values, s);
|
||||
eina_stringshare_del(s);
|
||||
|
||||
if (!v)
|
||||
return efl_model_property_get(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CHILDREN_CLASS),
|
||||
property);
|
||||
|
||||
// As an optimization we do optimistically allocate the boolean array
|
||||
// Better would be to have a sparse boolean array
|
||||
if ((pd->index >> 3) >= v->buffer_count)
|
||||
flag = v->default_value;
|
||||
else
|
||||
flag = v->buffer[pd->index >> 3] & (((unsigned char)1) << (pd->index & 0x7));
|
||||
|
||||
return eina_value_bool_new(!!flag);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_boolean_children_efl_model_property_set(Eo *obj,
|
||||
Efl_Model_Composite_Boolean_Children_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Value *v;
|
||||
Eina_Stringshare *s;
|
||||
Eina_Value b = EINA_VALUE_EMPTY;
|
||||
Eina_Bool flag;
|
||||
|
||||
if (!property)
|
||||
return efl_loop_future_rejected(obj,
|
||||
EFL_MODEL_ERROR_UNKNOWN);
|
||||
if (strcmp(property, "child.index") == 0)
|
||||
return efl_loop_future_rejected(obj,
|
||||
EFL_MODEL_ERROR_READ_ONLY);
|
||||
|
||||
s = eina_stringshare_add(property);
|
||||
v = eina_hash_find(pd->parent->values, s);
|
||||
eina_stringshare_del(s);
|
||||
|
||||
if (!v)
|
||||
return efl_model_property_set(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CHILDREN_CLASS),
|
||||
property, value);
|
||||
|
||||
eina_value_setup(&b, EINA_VALUE_TYPE_BOOL);
|
||||
if (!eina_value_convert(value, &b))
|
||||
return efl_loop_future_rejected(obj,
|
||||
EFL_MODEL_ERROR_UNKNOWN);
|
||||
if (!eina_value_get(value, &flag))
|
||||
return efl_loop_future_rejected(obj,
|
||||
EFL_MODEL_ERROR_UNKNOWN);
|
||||
|
||||
eina_value_flush(&b);
|
||||
|
||||
// We are optimistically allocating the boolean buffer now.
|
||||
// Aligning it on 64bits
|
||||
if (v->buffer_count < (((pd->index) >> 3) | 0x7) + 1)
|
||||
{
|
||||
unsigned int rcount = (((pd->index | 0xF) >> 3) | 0x7) + 1;
|
||||
unsigned char *tmp;
|
||||
|
||||
tmp = realloc(v->buffer, rcount);
|
||||
if (!tmp) return efl_loop_future_rejected(obj, ENOMEM);
|
||||
v->buffer = tmp;
|
||||
memset(v->buffer + v->buffer_count, 0, rcount - v->buffer_count);
|
||||
v->buffer_count = rcount;
|
||||
}
|
||||
|
||||
// It is assumed that during slice get the buffer is properly sized
|
||||
if (flag)
|
||||
v->buffer[pd->index >> 3] |= ((unsigned char)1) << (pd->index & 0x7);
|
||||
else
|
||||
v->buffer[pd->index >> 3] &= ~(((unsigned char)1) << (pd->index & 0x7));
|
||||
|
||||
// Calling "properties,changed" event
|
||||
efl_model_properties_changed(obj, property);
|
||||
|
||||
// Return fulfilled future
|
||||
return efl_loop_future_resolved(obj, eina_value_bool_init(!!flag));
|
||||
}
|
||||
|
||||
/**************** efl_model_composite_boolean **************/
|
||||
typedef struct _Efl_Model_Slice_Request Efl_Model_Slice_Request;
|
||||
struct _Efl_Model_Slice_Request
|
||||
{
|
||||
Eo *parent;
|
||||
unsigned int start;
|
||||
};
|
||||
|
||||
static Eina_Value
|
||||
_efl_model_composite_boolean_then(Eo *o EINA_UNUSED, void *data, const Eina_Value v)
|
||||
{
|
||||
Efl_Model_Slice_Request *req = data;
|
||||
unsigned int i, len;
|
||||
Eina_Value r = EINA_VALUE_EMPTY;
|
||||
Eo *target = NULL;
|
||||
|
||||
eina_value_array_setup(&r, EINA_VALUE_TYPE_OBJECT, 4);
|
||||
|
||||
EINA_VALUE_ARRAY_FOREACH(&v, len, i, target)
|
||||
{
|
||||
Eo *composite;
|
||||
|
||||
// It would have been nice if I could have just overriden the object
|
||||
// function, but this would allow only one composite model
|
||||
composite = efl_add(EFL_MODEL_COMPOSITE_BOOLEAN_CHILDREN_CLASS, req->parent,
|
||||
efl_model_composite_boolean_children_index_set(efl_added, req->start + i),
|
||||
efl_ui_view_model_set(efl_added, target));
|
||||
|
||||
eina_value_array_append(&r, composite);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_boolean_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Efl_Model_Slice_Request *req = data;
|
||||
|
||||
efl_unref(req->parent);
|
||||
free(req);
|
||||
}
|
||||
|
||||
static void
|
||||
_boolean_value_free(void *data)
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Value *value = data;
|
||||
|
||||
eina_stringshare_del(value->property);
|
||||
value->property = NULL;
|
||||
|
||||
free(value->buffer);
|
||||
value->buffer = NULL;
|
||||
value->buffer_count = 0;
|
||||
|
||||
free(value);
|
||||
}
|
||||
|
||||
static Eo *
|
||||
_efl_model_composite_boolean_efl_object_constructor(Eo *obj, Efl_Model_Composite_Boolean_Data *pd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS));
|
||||
|
||||
if (!obj) return NULL;
|
||||
|
||||
pd->values = eina_hash_stringshared_new(_boolean_value_free);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_boolean_efl_object_destructor(Eo *obj, Efl_Model_Composite_Boolean_Data *pd)
|
||||
{
|
||||
eina_hash_free(pd->values);
|
||||
|
||||
efl_destructor(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS));
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_boolean_boolean_add(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Boolean_Data *pd,
|
||||
const char *name, Eina_Bool default_value)
|
||||
{
|
||||
Efl_Model_Composite_Boolean_Value *value;
|
||||
|
||||
if (!name) return ;
|
||||
|
||||
value = calloc(1, sizeof (Efl_Model_Composite_Boolean_Value));
|
||||
if (!value) return ;
|
||||
|
||||
value->property = eina_stringshare_add(name);
|
||||
value->default_value = default_value;
|
||||
|
||||
eina_hash_direct_add(pd->values, value->property, value);
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_composite_boolean_boolean_del(Eo *obj EINA_UNUSED,
|
||||
Efl_Model_Composite_Boolean_Data *pd,
|
||||
const char *name)
|
||||
{
|
||||
Eina_Stringshare *s;
|
||||
|
||||
s = eina_stringshare_add(name);
|
||||
eina_hash_del(pd->values, s, NULL);
|
||||
eina_stringshare_del(s);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_boolean_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Model_Composite_Boolean_Data *pd EINA_UNUSED,
|
||||
unsigned int start, unsigned int count)
|
||||
{
|
||||
Efl_Model_Slice_Request *req;
|
||||
Eina_Future *f;
|
||||
|
||||
f = efl_model_children_slice_get(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS),
|
||||
start, count);
|
||||
|
||||
req = malloc(sizeof (Efl_Model_Slice_Request));
|
||||
if (!req) return efl_loop_future_rejected(obj,
|
||||
ENOMEM);
|
||||
req->parent = efl_ref(obj);
|
||||
req->start = start;
|
||||
|
||||
return efl_future_then(obj, f, .success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _efl_model_composite_boolean_then,
|
||||
.free = _efl_model_composite_boolean_clean,
|
||||
.data = req);
|
||||
}
|
||||
|
||||
#include "efl_model_composite_boolean.eo.c"
|
||||
#include "efl_model_composite_boolean_children.eo.c"
|
|
@ -1,23 +0,0 @@
|
|||
class Efl.Model_Composite_Boolean_Children extends Efl.Model_Composite
|
||||
{
|
||||
[[Efl model composite boolean children class]]
|
||||
methods {
|
||||
@property index {
|
||||
[[Position of children in the parent model.]]
|
||||
set {
|
||||
[[Set the index. It can only be set before the object is finalized.]]
|
||||
}
|
||||
get {
|
||||
[[Get the index.]]
|
||||
}
|
||||
values {
|
||||
index: uint; [[The index of the child in the parent model.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
implements {
|
||||
Efl.Model.properties { get; }
|
||||
Efl.Model.property { get; set; }
|
||||
Efl.Object.finalize;
|
||||
}
|
||||
}
|
|
@ -1,490 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Eina.h"
|
||||
#include "Efl.h"
|
||||
#include <Ecore.h>
|
||||
#include "Eo.h"
|
||||
|
||||
#include "efl_model_composite_selection.eo.h"
|
||||
#include "efl_model_accessor_view_private.h"
|
||||
#include "efl_model_composite_private.h"
|
||||
|
||||
typedef struct _Efl_Model_Composite_Selection_Data Efl_Model_Composite_Selection_Data;
|
||||
typedef struct _Efl_Model_Composite_Selection_Children_Data Efl_Model_Composite_Selection_Children_Data;
|
||||
|
||||
struct _Efl_Model_Composite_Selection_Data
|
||||
{
|
||||
unsigned long last;
|
||||
|
||||
Eina_Bool exclusive : 1;
|
||||
Eina_Bool none : 1;
|
||||
};
|
||||
|
||||
struct _Efl_Model_Composite_Selection_Children_Data
|
||||
{
|
||||
};
|
||||
|
||||
static Eo*
|
||||
_efl_model_composite_selection_efl_object_constructor(Eo *obj,
|
||||
Efl_Model_Composite_Selection_Data *pd EINA_UNUSED)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS));
|
||||
|
||||
efl_model_composite_boolean_add(obj, "selected", EINA_FALSE);
|
||||
|
||||
pd->last = -1;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v)
|
||||
{
|
||||
Efl_Model_Composite_Selection_Data *pd;
|
||||
Eina_Value *vc = NULL;
|
||||
Eina_Value *selected = NULL;
|
||||
Eina_Bool selflag = EINA_FALSE;
|
||||
|
||||
if (v.type == EINA_VALUE_TYPE_ERROR)
|
||||
goto on_error;
|
||||
|
||||
vc = efl_model_property_get(child, "Child.index");
|
||||
selected = efl_model_property_get(child, "selected");
|
||||
|
||||
pd = efl_data_scope_get(efl_parent_get(child), EFL_MODEL_COMPOSITE_SELECTION_CLASS);
|
||||
if (!pd) goto on_error;
|
||||
|
||||
eina_value_bool_get(selected, &selflag);
|
||||
if (selflag)
|
||||
{
|
||||
// select case
|
||||
pd->none = EINA_FALSE;
|
||||
eina_value_ulong_get(vc, &pd->last);
|
||||
efl_event_callback_call(child, EFL_MODEL_COMPOSITE_SELECTION_EVENT_SELECTED, child);
|
||||
}
|
||||
else
|
||||
{
|
||||
// unselect case
|
||||
unsigned long last;
|
||||
|
||||
eina_value_ulong_get(vc, &last);
|
||||
if (pd->last == last)
|
||||
{
|
||||
pd->last = 0;
|
||||
pd->none = EINA_TRUE;
|
||||
}
|
||||
efl_event_callback_call(child, EFL_MODEL_COMPOSITE_SELECTION_EVENT_UNSELECTED, child);
|
||||
}
|
||||
|
||||
on_error:
|
||||
eina_value_free(vc);
|
||||
eina_value_free(selected);
|
||||
return v;
|
||||
}
|
||||
|
||||
static void
|
||||
_clear_child(Eo *child,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
efl_del(child);
|
||||
}
|
||||
|
||||
static Efl_Model *
|
||||
_select_child_get(const Eina_Value *array, unsigned int idx)
|
||||
{
|
||||
Efl_Model *ret = NULL;
|
||||
|
||||
if (eina_value_type_get(array) != EINA_VALUE_TYPE_ARRAY)
|
||||
return NULL;
|
||||
|
||||
if (idx >= eina_value_array_count(array))
|
||||
return NULL;
|
||||
|
||||
eina_value_array_get(array, idx, &ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_check_child_change(Efl_Model *child, Eina_Bool value)
|
||||
{
|
||||
Eina_Future *r = NULL;
|
||||
Eina_Value *prev;
|
||||
Eina_Bool prevflag = EINA_FALSE;
|
||||
|
||||
prev = efl_model_property_get(child, "selected");
|
||||
eina_value_bool_get(prev, &prevflag);
|
||||
eina_value_free(prev);
|
||||
|
||||
if (prevflag & value)
|
||||
{
|
||||
r = efl_loop_future_resolved(child, eina_value_bool_init(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
r = efl_model_property_set(child, "selected", eina_value_bool_new(!!value));
|
||||
r = efl_future_then(child, r, .success = _commit_change, .free = _clear_child);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_select_child(Efl_Model *child)
|
||||
{
|
||||
return _check_child_change(child, EINA_TRUE);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_unselect_child(Efl_Model *child)
|
||||
{
|
||||
return _check_child_change(child, EINA_FALSE);
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_select_slice_then(Eo *obj EINA_UNUSED,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Value v)
|
||||
{
|
||||
Efl_Model *child = NULL;
|
||||
Eina_Future *r;
|
||||
|
||||
child = _select_child_get(&v, 0);
|
||||
if (!child) goto on_error;
|
||||
|
||||
r = _select_child(child);
|
||||
return eina_future_as_value(r);
|
||||
|
||||
on_error:
|
||||
return v;
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_unselect_slice_then(Eo *obj EINA_UNUSED,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Value v)
|
||||
{
|
||||
Efl_Model *child = NULL;
|
||||
Eina_Future *r;
|
||||
|
||||
child = _select_child_get(&v, 0);
|
||||
if (!child) goto on_error;
|
||||
|
||||
r = _unselect_child(child);
|
||||
return eina_future_as_value(r);
|
||||
|
||||
on_error:
|
||||
return v;
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_composite_selection_efl_model_properties_get(const Eo *obj,
|
||||
Efl_Model_Composite_Selection_Data *pd EINA_UNUSED)
|
||||
{
|
||||
EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(props,
|
||||
obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS,
|
||||
NULL,
|
||||
"selected", "exclusive");
|
||||
return props;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_selection_efl_model_property_set(Eo *obj,
|
||||
Efl_Model_Composite_Selection_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Eina_Value vf = EINA_VALUE_EMPTY;
|
||||
|
||||
if (!strcmp("exclusive", property))
|
||||
{
|
||||
Eina_Bool exclusive = pd->exclusive;
|
||||
Eina_Bool changed;
|
||||
|
||||
vf = eina_value_bool_init(exclusive);
|
||||
eina_value_convert(value, &vf);
|
||||
eina_value_bool_get(&vf, &exclusive);
|
||||
|
||||
changed = (!pd->exclusive != !exclusive);
|
||||
pd->exclusive = !!exclusive;
|
||||
|
||||
if (changed) efl_model_properties_changed(obj, "exclusive");
|
||||
|
||||
return efl_loop_future_resolved(obj, vf);
|
||||
}
|
||||
|
||||
if (!strcmp("selected", property))
|
||||
{
|
||||
Eina_Value vl = EINA_VALUE_EMPTY;
|
||||
unsigned long l = 0;
|
||||
Eina_Bool success = EINA_TRUE;
|
||||
|
||||
vl = eina_value_ulong_init(0);
|
||||
success &= eina_value_convert(value, &vl);
|
||||
success &= eina_value_ulong_get(&vl, &l);
|
||||
if (!success)
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
|
||||
|
||||
return efl_future_then(obj, efl_model_children_slice_get(obj, l, 1),
|
||||
.success = _select_slice_then,
|
||||
.success_type = EINA_VALUE_TYPE_ARRAY);
|
||||
}
|
||||
|
||||
return efl_model_property_set(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS),
|
||||
property, value);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_composite_selection_efl_model_property_get(const Eo *obj, Efl_Model_Composite_Selection_Data *pd, const char *property)
|
||||
{
|
||||
if (!strcmp("exclusive", property))
|
||||
return eina_value_bool_new(pd->exclusive);
|
||||
if (!strcmp("selected", property))
|
||||
{
|
||||
if (pd->none)
|
||||
return eina_value_error_new(EFL_MODEL_ERROR_INCORRECT_VALUE);
|
||||
else
|
||||
return eina_value_ulong_new(pd->last);
|
||||
}
|
||||
|
||||
return efl_model_property_get(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CLASS), property);
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_regenerate_error(void *data,
|
||||
const Eina_Value v,
|
||||
const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Eina_Error *error = data;
|
||||
Eina_Value r = v;
|
||||
|
||||
if (v.type == EINA_VALUE_TYPE_ERROR)
|
||||
goto cleanup;
|
||||
|
||||
r = eina_value_error_init(*error);
|
||||
|
||||
cleanup:
|
||||
free(error);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_untangle_array(void *data EINA_UNUSED,
|
||||
const Eina_Value v)
|
||||
{
|
||||
Eina_Value va = EINA_VALUE_EMPTY;
|
||||
|
||||
// Only return the commit change, not the result of the unselect
|
||||
eina_value_array_get(&v, 0, &va);
|
||||
return va;
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_composite_selection_children_efl_model_properties_get(const Eo *obj,
|
||||
Efl_Model_Composite_Selection_Children_Data *pd EINA_UNUSED)
|
||||
{
|
||||
EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(props,
|
||||
obj, EFL_MODEL_COMPOSITE_SELECTION_CHILDREN_CLASS,
|
||||
NULL,
|
||||
"selected");
|
||||
return props;
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_untangle_error(void *data, Eina_Error err)
|
||||
{
|
||||
Efl_Model *child = data;
|
||||
Eina_Future *f;
|
||||
|
||||
// We need to roll back the change, which means in this
|
||||
// case to unselect this child as this is the only case
|
||||
// where we could end up here.
|
||||
Eina_Error *error = calloc(1, sizeof (Eina_Error));
|
||||
|
||||
f = efl_model_property_set(efl_super(child, EFL_MODEL_COMPOSITE_SELECTION_CHILDREN_CLASS),
|
||||
"selected", eina_value_bool_new(EINA_FALSE));
|
||||
// Once this is done, we need to repropagate the error
|
||||
*error = err;
|
||||
f = eina_future_then(f, _regenerate_error, error, NULL);
|
||||
|
||||
return eina_future_as_value(f);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_selection_children_efl_model_property_set(Eo *obj,
|
||||
Efl_Model_Composite_Selection_Children_Data *pd EINA_UNUSED,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Eina_Value *ve = NULL;
|
||||
Eina_Value *vb = NULL;
|
||||
Eina_Value lvb = EINA_VALUE_EMPTY;
|
||||
Eina_Bool success = EINA_TRUE;
|
||||
Eina_Bool exclusive = EINA_FALSE;
|
||||
Eina_Bool prevflag = EINA_FALSE, newflag = EINA_FALSE;
|
||||
Eina_Future *chain;
|
||||
|
||||
if (strcmp("selected", property))
|
||||
return efl_model_property_set(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CHILDREN_CLASS),
|
||||
property, value);
|
||||
|
||||
vb = efl_model_property_get(obj, "selected");
|
||||
success &= eina_value_bool_get(vb, &prevflag);
|
||||
eina_value_free(vb);
|
||||
|
||||
lvb = eina_value_bool_init(prevflag);
|
||||
success &= eina_value_convert(value, &lvb);
|
||||
success &= eina_value_bool_get(&lvb, &newflag);
|
||||
eina_value_flush(&lvb);
|
||||
|
||||
if (!success)
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
|
||||
|
||||
// Nothing changed
|
||||
if (newflag == prevflag)
|
||||
return efl_loop_future_resolved(obj,
|
||||
eina_value_bool_init(newflag));
|
||||
|
||||
ve = efl_model_property_get(efl_parent_get(obj), "exclusive");
|
||||
eina_value_bool_get(ve, &exclusive);
|
||||
eina_value_free(ve);
|
||||
|
||||
// First store the new value in the boolean model we inherit from
|
||||
chain = efl_model_property_set(efl_super(obj, EFL_MODEL_COMPOSITE_SELECTION_CHILDREN_CLASS),
|
||||
"selected", value);
|
||||
|
||||
// Now act !
|
||||
if (exclusive)
|
||||
{
|
||||
// We are here either, because we weren't and are after this call
|
||||
// or because we were selected and are not anymore. In the later case,
|
||||
// there is nothing special to do, just normal commit change will do.
|
||||
if (!newflag)
|
||||
{
|
||||
Efl_Model_Composite_Selection_Data *ppd;
|
||||
Eina_Value *index;
|
||||
unsigned int i = 0;
|
||||
|
||||
index = efl_model_property_get(obj, "child.index");
|
||||
if (!eina_value_uint_get(index, &i))
|
||||
goto commit_change;
|
||||
|
||||
ppd = efl_data_scope_get(efl_parent_get(obj), EFL_MODEL_COMPOSITE_SELECTION_CLASS);
|
||||
if (ppd->last == i && !newflag)
|
||||
ppd->none = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Eo *parent;
|
||||
Eina_Value *vs;
|
||||
unsigned long selected = 0;
|
||||
|
||||
// In this case we need to first unselect the previously selected one
|
||||
// and then commit the change to this one.
|
||||
|
||||
// Fetch the one to unselect
|
||||
vs = efl_model_property_get(efl_parent_get(obj), "selected");
|
||||
// Check if there was any selected
|
||||
if (eina_value_type_get(vs) == EINA_VALUE_TYPE_ERROR)
|
||||
{
|
||||
eina_value_free(vs);
|
||||
goto commit_change;
|
||||
}
|
||||
success = eina_value_ulong_get(vs, &selected);
|
||||
eina_value_free(vs);
|
||||
|
||||
if (!success)
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
|
||||
|
||||
// There was, need to unselect the previous one along setting the new value
|
||||
parent = efl_parent_get(obj);
|
||||
chain = eina_future_all(chain,
|
||||
efl_future_then(parent, efl_model_children_slice_get(parent, selected, 1),
|
||||
.success = _unselect_slice_then,
|
||||
.success_type = EINA_VALUE_TYPE_ARRAY));
|
||||
|
||||
chain = eina_future_then_easy(chain,
|
||||
.success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _untangle_array,
|
||||
.data = obj,
|
||||
.error = _untangle_error);
|
||||
}
|
||||
}
|
||||
|
||||
commit_change:
|
||||
return efl_future_then(obj, chain,
|
||||
.success = _commit_change);
|
||||
}
|
||||
|
||||
typedef struct _Selection_Children_Request Selection_Children_Request;
|
||||
struct _Selection_Children_Request
|
||||
{
|
||||
Efl_Model *parent;
|
||||
|
||||
unsigned int start;
|
||||
};
|
||||
|
||||
static Eina_Value
|
||||
_slice_get(Eo *o EINA_UNUSED,
|
||||
void *data,
|
||||
const Eina_Value v)
|
||||
{
|
||||
Selection_Children_Request *req = data;
|
||||
unsigned int length, it;
|
||||
Eo *composited = NULL;
|
||||
Eina_Value r = EINA_VALUE_EMPTY;
|
||||
|
||||
eina_value_array_setup(&r, EINA_VALUE_TYPE_OBJECT, 4);
|
||||
|
||||
EINA_VALUE_ARRAY_FOREACH(&v, length, it, composited)
|
||||
{
|
||||
Eo *compositing;
|
||||
|
||||
compositing = efl_add(EFL_MODEL_COMPOSITE_SELECTION_CHILDREN_CLASS, req->parent,
|
||||
efl_model_composite_boolean_children_index_set(efl_added, req->start + it),
|
||||
efl_ui_view_model_set(efl_added, composited));
|
||||
eina_value_array_append(&r, compositing);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
_slice_clean(Eo *o EINA_UNUSED,
|
||||
void *data,
|
||||
const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Selection_Children_Request *req = data;
|
||||
|
||||
efl_unref(req->parent);
|
||||
free(req);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_composite_selection_efl_model_children_slice_get(Eo *obj,
|
||||
Efl_Model_Composite_Selection_Data *pd EINA_UNUSED,
|
||||
unsigned int start, unsigned int count)
|
||||
{
|
||||
Selection_Children_Request *req;
|
||||
Eina_Future *f;
|
||||
|
||||
req = calloc(1, sizeof (Selection_Children_Request));
|
||||
if (!req) return efl_loop_future_rejected(obj, ENOMEM);
|
||||
req->parent = efl_ref(obj);
|
||||
req->start = start;
|
||||
|
||||
// NOTE: We do jump on purpose EFL_MODEL_COMPOSITE_BOOLEAN_CLASS here
|
||||
f = efl_model_children_slice_get(efl_super(obj, EFL_MODEL_COMPOSITE_BOOLEAN_CLASS),
|
||||
start, count);
|
||||
|
||||
return efl_future_then(obj, f,
|
||||
.success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _slice_get,
|
||||
.free = _slice_clean,
|
||||
.data = req);
|
||||
}
|
||||
|
||||
#include "efl_model_composite_selection.eo.c"
|
||||
#include "efl_model_composite_selection_children.eo.c"
|
|
@ -1,9 +0,0 @@
|
|||
class Efl.Model_Composite_Selection_Children extends Efl.Model_Composite_Boolean_Children
|
||||
{
|
||||
[[Efl model composite selection children class]]
|
||||
implements {
|
||||
Efl.Model.property { set; }
|
||||
Efl.Model.properties { get; }
|
||||
}
|
||||
/* FIXME: emitting Efl.Model_Composite_Selection.Selected. Use a default selection event! */
|
||||
}
|
|
@ -0,0 +1,369 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include "Eina.h"
|
||||
#include "Efl.h"
|
||||
#include <Ecore.h>
|
||||
#include "Eo.h"
|
||||
|
||||
#include "efl_select_model.eo.h"
|
||||
#include "efl_model_accessor_view_private.h"
|
||||
#include "efl_composite_model_private.h"
|
||||
|
||||
typedef struct _Efl_Select_Model_Data Efl_Select_Model_Data;
|
||||
|
||||
struct _Efl_Select_Model_Data
|
||||
{
|
||||
Efl_Select_Model_Data *parent;
|
||||
unsigned long last;
|
||||
|
||||
Eina_Bool exclusive : 1;
|
||||
Eina_Bool none : 1;
|
||||
};
|
||||
|
||||
static Eo*
|
||||
_efl_select_model_efl_object_constructor(Eo *obj,
|
||||
Efl_Select_Model_Data *pd EINA_UNUSED)
|
||||
{
|
||||
Eo *parent;
|
||||
|
||||
obj = efl_constructor(efl_super(obj, EFL_SELECT_MODEL_CLASS));
|
||||
|
||||
efl_boolean_model_boolean_add(obj, "selected", EINA_FALSE);
|
||||
|
||||
pd->last = -1;
|
||||
|
||||
parent = efl_parent_get(obj);
|
||||
if (efl_isa(parent, EFL_SELECT_MODEL_CLASS))
|
||||
pd->parent = efl_data_scope_get(parent, EFL_SELECT_MODEL_CLASS);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_commit_change(Eo *child, void *data EINA_UNUSED, const Eina_Value v)
|
||||
{
|
||||
Efl_Select_Model_Data *pd;
|
||||
Eina_Value *selected = NULL;
|
||||
Eina_Bool selflag = EINA_FALSE;
|
||||
|
||||
if (v.type == EINA_VALUE_TYPE_ERROR)
|
||||
goto on_error;
|
||||
|
||||
selected = efl_model_property_get(child, "selected");
|
||||
|
||||
pd = efl_data_scope_get(efl_parent_get(child), EFL_SELECT_MODEL_CLASS);
|
||||
if (!pd) goto on_error;
|
||||
|
||||
eina_value_bool_get(selected, &selflag);
|
||||
if (selflag)
|
||||
{
|
||||
// select case
|
||||
pd->none = EINA_FALSE;
|
||||
pd->last = efl_composite_model_index_get(child);
|
||||
efl_event_callback_call(child, EFL_SELECT_MODEL_EVENT_SELECTED, child);
|
||||
}
|
||||
else
|
||||
{
|
||||
// unselect case
|
||||
unsigned long last;
|
||||
|
||||
last = efl_composite_model_index_get(child);
|
||||
if (pd->last == last)
|
||||
{
|
||||
pd->last = 0;
|
||||
pd->none = EINA_TRUE;
|
||||
}
|
||||
efl_event_callback_call(child, EFL_SELECT_MODEL_EVENT_UNSELECTED, child);
|
||||
}
|
||||
|
||||
on_error:
|
||||
eina_value_free(selected);
|
||||
return v;
|
||||
}
|
||||
|
||||
static void
|
||||
_clear_child(Eo *child,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
efl_del(child);
|
||||
}
|
||||
|
||||
static Efl_Model *
|
||||
_select_child_get(const Eina_Value *array, unsigned int idx)
|
||||
{
|
||||
Efl_Model *ret = NULL;
|
||||
|
||||
if (eina_value_type_get(array) != EINA_VALUE_TYPE_ARRAY)
|
||||
return NULL;
|
||||
|
||||
if (idx >= eina_value_array_count(array))
|
||||
return NULL;
|
||||
|
||||
eina_value_array_get(array, idx, &ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_check_child_change(Efl_Model *child, Eina_Bool value)
|
||||
{
|
||||
Eina_Future *r = NULL;
|
||||
Eina_Value *prev;
|
||||
Eina_Bool prevflag = EINA_FALSE;
|
||||
|
||||
prev = efl_model_property_get(child, "selected");
|
||||
eina_value_bool_get(prev, &prevflag);
|
||||
eina_value_free(prev);
|
||||
|
||||
if (prevflag & value)
|
||||
{
|
||||
r = efl_loop_future_resolved(child, eina_value_bool_init(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
r = efl_model_property_set(child, "selected", eina_value_bool_new(!!value));
|
||||
r = efl_future_then(child, r, .success = _commit_change, .free = _clear_child);
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_select_child(Efl_Model *child)
|
||||
{
|
||||
return _check_child_change(child, EINA_TRUE);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_unselect_child(Efl_Model *child)
|
||||
{
|
||||
return _check_child_change(child, EINA_FALSE);
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_select_slice_then(Eo *obj EINA_UNUSED,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Value v)
|
||||
{
|
||||
Efl_Model *child = NULL;
|
||||
Eina_Future *r;
|
||||
|
||||
child = _select_child_get(&v, 0);
|
||||
if (!child) goto on_error;
|
||||
|
||||
r = _select_child(child);
|
||||
return eina_future_as_value(r);
|
||||
|
||||
on_error:
|
||||
return v;
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_unselect_slice_then(Eo *obj EINA_UNUSED,
|
||||
void *data EINA_UNUSED,
|
||||
const Eina_Value v)
|
||||
{
|
||||
Efl_Model *child = NULL;
|
||||
Eina_Future *r;
|
||||
|
||||
child = _select_child_get(&v, 0);
|
||||
if (!child) goto on_error;
|
||||
|
||||
r = _unselect_child(child);
|
||||
return eina_future_as_value(r);
|
||||
|
||||
on_error:
|
||||
return v;
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_regenerate_error(void *data,
|
||||
const Eina_Value v,
|
||||
const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
Eina_Error *error = data;
|
||||
Eina_Value r = v;
|
||||
|
||||
if (v.type == EINA_VALUE_TYPE_ERROR)
|
||||
goto cleanup;
|
||||
|
||||
r = eina_value_error_init(*error);
|
||||
|
||||
cleanup:
|
||||
free(error);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_untangle_array(void *data EINA_UNUSED,
|
||||
const Eina_Value v)
|
||||
{
|
||||
Eina_Value va = EINA_VALUE_EMPTY;
|
||||
|
||||
// Only return the commit change, not the result of the unselect
|
||||
eina_value_array_get(&v, 0, &va);
|
||||
return va;
|
||||
}
|
||||
|
||||
static Eina_Value
|
||||
_untangle_error(void *data, Eina_Error err)
|
||||
{
|
||||
Efl_Model *child = data;
|
||||
Eina_Future *f;
|
||||
|
||||
// We need to roll back the change, which means in this
|
||||
// case to unselect this child as this is the only case
|
||||
// where we could end up here.
|
||||
Eina_Error *error = calloc(1, sizeof (Eina_Error));
|
||||
|
||||
f = efl_model_property_set(efl_super(child, EFL_SELECT_MODEL_CLASS),
|
||||
"selected", eina_value_bool_new(EINA_FALSE));
|
||||
// Once this is done, we need to repropagate the error
|
||||
*error = err;
|
||||
f = eina_future_then(f, _regenerate_error, error, NULL);
|
||||
|
||||
return eina_future_as_value(f);
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_select_model_efl_model_properties_get(const Eo *obj,
|
||||
Efl_Select_Model_Data *pd EINA_UNUSED)
|
||||
{
|
||||
EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props,
|
||||
obj, EFL_SELECT_MODEL_CLASS,
|
||||
NULL,
|
||||
"self.selected", "child.selected", "exclusive");
|
||||
return props;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_select_model_efl_model_property_set(Eo *obj,
|
||||
Efl_Select_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Eina_Value vf = EINA_VALUE_EMPTY;
|
||||
|
||||
if (!strcmp("exclusive", property))
|
||||
{
|
||||
Eina_Bool exclusive = pd->exclusive;
|
||||
Eina_Bool changed;
|
||||
|
||||
vf = eina_value_bool_init(exclusive);
|
||||
eina_value_convert(value, &vf);
|
||||
eina_value_bool_get(&vf, &exclusive);
|
||||
|
||||
changed = (!pd->exclusive != !exclusive);
|
||||
pd->exclusive = !!exclusive;
|
||||
|
||||
if (changed) efl_model_properties_changed(obj, "exclusive");
|
||||
|
||||
return efl_loop_future_resolved(obj, vf);
|
||||
}
|
||||
|
||||
if (!strcmp("child.selected", property))
|
||||
{
|
||||
unsigned long l = 0;
|
||||
|
||||
if (!eina_value_ulong_convert(value, &l))
|
||||
return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
|
||||
|
||||
return efl_future_then(obj, efl_model_children_slice_get(obj, l, 1),
|
||||
.success = _select_slice_then,
|
||||
.success_type = EINA_VALUE_TYPE_ARRAY);
|
||||
}
|
||||
|
||||
if (pd->parent && !strcmp("self.selected", property))
|
||||
{
|
||||
Eina_Bool prevflag = EINA_FALSE, newflag = EINA_FALSE;
|
||||
Eina_Bool exclusive = EINA_FALSE;
|
||||
Eina_Bool success;
|
||||
Eina_Value *prev;
|
||||
Eina_Future *chain;
|
||||
|
||||
prev = efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), "selected");
|
||||
success = eina_value_bool_get(prev, &prevflag);
|
||||
success &= eina_value_bool_convert(value, &newflag);
|
||||
|
||||
if (!success) return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_INCORRECT_VALUE);
|
||||
|
||||
// Nothing changed
|
||||
if (newflag == prevflag)
|
||||
return efl_loop_future_resolved(obj, eina_value_bool_init(newflag));
|
||||
|
||||
exclusive = pd->parent->exclusive;
|
||||
|
||||
// First store the new value in the boolean model we inherit from
|
||||
chain = efl_model_property_set(efl_super(obj, EFL_SELECT_MODEL_CLASS),
|
||||
"selected", value);
|
||||
|
||||
// Now act !
|
||||
if (exclusive)
|
||||
{
|
||||
// We are here either, because we weren't and are after this call
|
||||
// or because we were selected and are not anymore. In the later case,
|
||||
// there is nothing special to do, just normal commit change will do.
|
||||
if (!newflag)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
i = efl_composite_model_index_get(obj);
|
||||
if (pd->parent->last == i && !newflag)
|
||||
pd->parent->none = EINA_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
Eo *parent;
|
||||
unsigned long selected = 0;
|
||||
|
||||
// In this case we need to first unselect the previously selected one
|
||||
// and then commit the change to this one.
|
||||
selected = pd->parent->last;
|
||||
|
||||
// There was, need to unselect the previous one along setting the new value
|
||||
parent = efl_parent_get(obj);
|
||||
chain = eina_future_all(chain,
|
||||
efl_future_then(parent, efl_model_children_slice_get(parent, selected, 1),
|
||||
.success = _unselect_slice_then,
|
||||
.success_type = EINA_VALUE_TYPE_ARRAY));
|
||||
chain = eina_future_then_easy(chain,
|
||||
.success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _untangle_array,
|
||||
.data = obj,
|
||||
.error = _untangle_error);
|
||||
}
|
||||
}
|
||||
|
||||
return efl_future_then(obj, chain, .success = _commit_change);
|
||||
}
|
||||
|
||||
return efl_model_property_set(efl_super(obj, EFL_SELECT_MODEL_CLASS),
|
||||
property, value);
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_select_model_efl_model_property_get(const Eo *obj, Efl_Select_Model_Data *pd, const char *property)
|
||||
{
|
||||
if (!strcmp("exclusive", property))
|
||||
return eina_value_bool_new(pd->exclusive);
|
||||
// Last selected child
|
||||
if (!strcmp("child.selected", property))
|
||||
{
|
||||
if (pd->none)
|
||||
return eina_value_error_new(EFL_MODEL_ERROR_INCORRECT_VALUE);
|
||||
else
|
||||
return eina_value_ulong_new(pd->last);
|
||||
}
|
||||
// Redirect to are we ourself selected
|
||||
if (pd->parent && !strcmp("self.selected", property))
|
||||
{
|
||||
return efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), "selected");
|
||||
}
|
||||
|
||||
return efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), property);
|
||||
}
|
||||
|
||||
#include "efl_select_model.eo.c"
|
|
@ -1,9 +1,8 @@
|
|||
class Efl.Model_Composite_Selection extends Efl.Model_Composite_Boolean
|
||||
class Efl.Select_Model extends Efl.Boolean_Model
|
||||
{
|
||||
[[Efl model composite selection class]]
|
||||
[[Efl select model class]]
|
||||
implements {
|
||||
Efl.Object.constructor;
|
||||
Efl.Model.children_slice_get;
|
||||
Efl.Model.property { get; set; }
|
||||
Efl.Model.properties { get; }
|
||||
}
|
|
@ -618,8 +618,10 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
|
|||
pd->fd.out = pipe_from_thread[0]; // read - output from child
|
||||
eina_file_close_on_exec(thdat->fd.in, EINA_TRUE);
|
||||
eina_file_close_on_exec(pd->fd.out, EINA_TRUE);
|
||||
fcntl(thdat->fd.in, F_SETFL, O_NONBLOCK);
|
||||
fcntl(pd->fd.out, F_SETFL, O_NONBLOCK);
|
||||
if (fcntl(thdat->fd.in, F_SETFL, O_NONBLOCK) < 0)
|
||||
ERR("can't set pipe to NONBLOCK");
|
||||
if (fcntl(pd->fd.out, F_SETFL, O_NONBLOCK) < 0)
|
||||
ERR("can't set pipe to NONBLOCK");
|
||||
pd->fd.out_handler =
|
||||
efl_add(EFL_LOOP_HANDLER_CLASS, obj,
|
||||
efl_loop_handler_fd_set(efl_added, pd->fd.out),
|
||||
|
@ -634,8 +636,10 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
|
|||
thdat->fd.out = pipe_to_thread [0]; // read - output from parent
|
||||
eina_file_close_on_exec(pd->fd.in, EINA_TRUE);
|
||||
eina_file_close_on_exec(thdat->fd.out, EINA_TRUE);
|
||||
fcntl(thdat->fd.out, F_SETFL, O_NONBLOCK);
|
||||
fcntl(pd->fd.in, F_SETFL, O_NONBLOCK);
|
||||
if (fcntl(thdat->fd.out, F_SETFL, O_NONBLOCK) < 0)
|
||||
ERR("can't set pipe to NONBLOCK");
|
||||
if (fcntl(pd->fd.in, F_SETFL, O_NONBLOCK) < 0)
|
||||
ERR("can't set pipe to NONBLOCK");
|
||||
pd->fd.in_handler =
|
||||
efl_add(EFL_LOOP_HANDLER_CLASS, obj,
|
||||
efl_loop_handler_fd_set(efl_added, pd->fd.in),
|
||||
|
@ -682,10 +686,14 @@ _efl_thread_efl_task_run(Eo *obj, Efl_Thread_Data *pd)
|
|||
thdat->ctrl.out = pipe_to_thread [0]; // read - output from parent
|
||||
pd->ctrl.in = pipe_to_thread [1]; // write - input to child
|
||||
pd->ctrl.out = pipe_from_thread[0]; // read - output from child
|
||||
fcntl(thdat->ctrl.in, F_SETFL, O_NONBLOCK);
|
||||
fcntl(thdat->ctrl.out, F_SETFL, O_NONBLOCK);
|
||||
fcntl(pd->ctrl.in, F_SETFL, O_NONBLOCK);
|
||||
fcntl(pd->ctrl.out, F_SETFL, O_NONBLOCK);
|
||||
if (fcntl(thdat->ctrl.in, F_SETFL, O_NONBLOCK) < 0)
|
||||
ERR("can't set pipe to NONBLOCK");
|
||||
if (fcntl(thdat->ctrl.out, F_SETFL, O_NONBLOCK) < 0)
|
||||
ERR("can't set pipe to NONBLOCK");
|
||||
if (fcntl(pd->ctrl.in, F_SETFL, O_NONBLOCK) < 0)
|
||||
ERR("can't set pipe to NONBLOCK");
|
||||
if (fcntl(pd->ctrl.out, F_SETFL, O_NONBLOCK) < 0)
|
||||
ERR("can't set pipe to NONBLOCK");
|
||||
eina_file_close_on_exec(pd->ctrl.in, EINA_TRUE);
|
||||
eina_file_close_on_exec(pd->ctrl.out, EINA_TRUE);
|
||||
eina_file_close_on_exec(thdat->ctrl.in, EINA_TRUE);
|
||||
|
|
|
@ -9,22 +9,22 @@
|
|||
|
||||
#include "ecore_internal.h"
|
||||
|
||||
#include "efl_model_composite_private.h"
|
||||
#include "efl_composite_model_private.h"
|
||||
|
||||
typedef struct _Efl_Model_View_Data Efl_Model_View_Data;
|
||||
typedef struct _Efl_Model_View_Bind Efl_Model_View_Bind;
|
||||
typedef struct _Efl_Model_View_Logic Efl_Model_View_Logic;
|
||||
typedef struct _Efl_Model_View_Property_Ref Efl_Model_View_Property_Ref;
|
||||
typedef struct _Efl_View_Model_Data Efl_View_Model_Data;
|
||||
typedef struct _Efl_View_Model_Bind Efl_View_Model_Bind;
|
||||
typedef struct _Efl_View_Model_Logic Efl_View_Model_Logic;
|
||||
typedef struct _Efl_View_Model_Property_Ref Efl_View_Model_Property_Ref;
|
||||
|
||||
struct _Efl_Model_View_Data
|
||||
struct _Efl_View_Model_Data
|
||||
{
|
||||
// FIXME: If parent is set, always access parent... recursively?
|
||||
Efl_Model_View_Data *parent;
|
||||
Efl_View_Model_Data *parent;
|
||||
|
||||
Eina_Hash *bound; // Stringhash of Efl_Model_View_Bind
|
||||
Eina_Hash *logics; // Stringhash of Efl_Model_View_Logic
|
||||
Eina_Hash *bound; // Stringhash of Efl_View_Model_Bind
|
||||
Eina_Hash *logics; // Stringhash of Efl_View_Model_Logic
|
||||
|
||||
Eina_Hash *deduplication; // Stringhash of Efl_Model_View_Property_Ref
|
||||
Eina_Hash *deduplication; // Stringhash of Efl_View_Model_Property_Ref
|
||||
|
||||
struct {
|
||||
Eina_Bool property_changed : 1;
|
||||
|
@ -35,21 +35,21 @@ struct _Efl_Model_View_Data
|
|||
Eina_Bool children_bind : 1; // Define if child object should be automatically binded
|
||||
};
|
||||
|
||||
struct _Efl_Model_View_Bind
|
||||
struct _Efl_View_Model_Bind
|
||||
{
|
||||
Eina_Stringshare *source;
|
||||
Eina_List *destinations;
|
||||
};
|
||||
|
||||
struct _Efl_Model_View_Logic
|
||||
struct _Efl_View_Model_Logic
|
||||
{
|
||||
struct {
|
||||
EflModelViewPropertyGet fct;
|
||||
EflViewModelPropertyGet fct;
|
||||
Eina_Free_Cb free_cb;
|
||||
void *data;
|
||||
} get;
|
||||
struct {
|
||||
EflModelViewPropertySet fct;
|
||||
EflViewModelPropertySet fct;
|
||||
Eina_Free_Cb free_cb;
|
||||
void *data;
|
||||
} set;
|
||||
|
@ -59,7 +59,7 @@ struct _Efl_Model_View_Logic
|
|||
Eina_Stringshare *property;
|
||||
};
|
||||
|
||||
struct _Efl_Model_View_Property_Ref
|
||||
struct _Efl_View_Model_Property_Ref
|
||||
{
|
||||
EINA_REFCOUNT;
|
||||
Eina_Stringshare *property;
|
||||
|
@ -68,21 +68,21 @@ struct _Efl_Model_View_Property_Ref
|
|||
static void
|
||||
_ref_free(void *data)
|
||||
{
|
||||
Efl_Model_View_Property_Ref *r = data;
|
||||
Efl_View_Model_Property_Ref *r = data;
|
||||
|
||||
eina_stringshare_del(r->property);
|
||||
free(r);
|
||||
}
|
||||
|
||||
static void
|
||||
_ref_add(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
||||
_ref_add(Efl_View_Model_Data *pd, Eina_Stringshare *property)
|
||||
{
|
||||
Efl_Model_View_Property_Ref *r;
|
||||
Efl_View_Model_Property_Ref *r;
|
||||
|
||||
r = eina_hash_find(pd->deduplication, property);
|
||||
if (!r)
|
||||
{
|
||||
r = calloc(1, sizeof (Efl_Model_View_Property_Ref));
|
||||
r = calloc(1, sizeof (Efl_View_Model_Property_Ref));
|
||||
if (!r) return ;
|
||||
r->property = eina_stringshare_ref(property);
|
||||
|
||||
|
@ -93,9 +93,9 @@ _ref_add(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
|||
}
|
||||
|
||||
static void
|
||||
_ref_del(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
||||
_ref_del(Efl_View_Model_Data *pd, Eina_Stringshare *property)
|
||||
{
|
||||
Efl_Model_View_Property_Ref *r;
|
||||
Efl_View_Model_Property_Ref *r;
|
||||
|
||||
r = eina_hash_find(pd->deduplication, property);
|
||||
if (!r) return ;
|
||||
|
@ -107,14 +107,14 @@ _ref_del(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
|||
static void
|
||||
_logic_free(void *data)
|
||||
{
|
||||
Efl_Model_View_Logic *logic = data;
|
||||
Efl_View_Model_Logic *logic = data;
|
||||
Eina_Stringshare *source;
|
||||
|
||||
if (logic->get.free_cb) logic->get.free_cb(logic->get.data);
|
||||
if (logic->set.free_cb) logic->set.free_cb(logic->set.data);
|
||||
EINA_LIST_FREE(logic->sources, source)
|
||||
{
|
||||
efl_model_view_property_unbind(logic->object, source, logic->property);
|
||||
efl_view_model_property_unbind(logic->object, source, logic->property);
|
||||
eina_stringshare_del(source);
|
||||
}
|
||||
eina_stringshare_del(logic->property);
|
||||
|
@ -122,30 +122,30 @@ _logic_free(void *data)
|
|||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_view_property_dummy_get(void *data EINA_UNUSED,
|
||||
const Efl_Model_View *model_view EINA_UNUSED,
|
||||
_efl_view_model_property_dummy_get(void *data EINA_UNUSED,
|
||||
const Efl_View_Model *view_model EINA_UNUSED,
|
||||
Eina_Stringshare *property EINA_UNUSED)
|
||||
{
|
||||
return eina_value_error_new(EFL_MODEL_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_view_property_dummy_set(void *data EINA_UNUSED,
|
||||
Efl_Model_View *model_view,
|
||||
_efl_view_model_property_dummy_set(void *data EINA_UNUSED,
|
||||
Efl_View_Model *view_model,
|
||||
Eina_Stringshare *property EINA_UNUSED,
|
||||
Eina_Value *value EINA_UNUSED)
|
||||
{
|
||||
return efl_loop_future_rejected(model_view, EFL_MODEL_ERROR_READ_ONLY);
|
||||
return efl_loop_future_rejected(view_model, EFL_MODEL_ERROR_READ_ONLY);
|
||||
}
|
||||
|
||||
static Eina_Error
|
||||
_efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_property_logic_add(Eo *obj, Efl_View_Model_Data *pd,
|
||||
const char *property,
|
||||
void *get_data, EflModelViewPropertyGet get, Eina_Free_Cb get_free_cb,
|
||||
void *set_data, EflModelViewPropertySet set, Eina_Free_Cb set_free_cb,
|
||||
void *get_data, EflViewModelPropertyGet get, Eina_Free_Cb get_free_cb,
|
||||
void *set_data, EflViewModelPropertySet set, Eina_Free_Cb set_free_cb,
|
||||
Eina_Iterator *bound)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
Eina_Stringshare *prop;
|
||||
const char *source;
|
||||
|
||||
|
@ -157,15 +157,15 @@ _efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
|
|||
return EFL_MODEL_ERROR_INCORRECT_VALUE;
|
||||
}
|
||||
|
||||
logic = calloc(1, sizeof (Efl_Model_View_Logic));
|
||||
logic = calloc(1, sizeof (Efl_View_Model_Logic));
|
||||
if (!logic) return ENOMEM;
|
||||
|
||||
logic->object = obj;
|
||||
logic->property = prop;
|
||||
logic->get.fct = get ? get : _efl_model_view_property_dummy_get;
|
||||
logic->get.fct = get ? get : _efl_view_model_property_dummy_get;
|
||||
logic->get.free_cb = get_free_cb;
|
||||
logic->get.data = get_data;
|
||||
logic->set.fct = set ? set : _efl_model_view_property_dummy_set;
|
||||
logic->set.fct = set ? set : _efl_view_model_property_dummy_set;
|
||||
logic->set.free_cb = set_free_cb;
|
||||
logic->set.data = set_data;
|
||||
|
||||
|
@ -174,17 +174,17 @@ _efl_model_view_property_logic_add(Eo *obj, Efl_Model_View_Data *pd,
|
|||
EINA_ITERATOR_FOREACH(bound, source)
|
||||
{
|
||||
logic->sources = eina_list_append(logic->sources, eina_stringshare_add(source));
|
||||
efl_model_view_property_bind(obj, source, property);
|
||||
efl_view_model_property_bind(obj, source, property);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Eina_Error
|
||||
_efl_model_view_property_logic_del(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_property_logic_del(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
|
||||
logic = eina_hash_find(pd->logics, property);
|
||||
if (!logic) return EFL_MODEL_ERROR_INCORRECT_VALUE;
|
||||
|
@ -193,10 +193,10 @@ _efl_model_view_property_logic_del(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_property_bind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_property_bind(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
|
||||
const char *source, const char *destination)
|
||||
{
|
||||
Efl_Model_View_Bind *bind;
|
||||
Efl_View_Model_Bind *bind;
|
||||
Eina_Stringshare *src;
|
||||
Eina_Stringshare *dst;
|
||||
|
||||
|
@ -206,7 +206,7 @@ _efl_model_view_property_bind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
bind = eina_hash_find(pd->bound, src);
|
||||
if (!bind)
|
||||
{
|
||||
bind = calloc(1, sizeof (Efl_Model_View_Bind));
|
||||
bind = calloc(1, sizeof (Efl_View_Model_Bind));
|
||||
if (!bind) goto on_error;
|
||||
bind->source = eina_stringshare_ref(src);
|
||||
|
||||
|
@ -222,10 +222,10 @@ _efl_model_view_property_bind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_property_unbind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_property_unbind(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd,
|
||||
const char *source, const char *destination)
|
||||
{
|
||||
Efl_Model_View_Bind *bind;
|
||||
Efl_View_Model_Bind *bind;
|
||||
Eina_Stringshare *src;
|
||||
Eina_Stringshare *dst;
|
||||
Eina_Stringshare *cmp;
|
||||
|
@ -258,7 +258,7 @@ _efl_model_view_property_unbind(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
static void
|
||||
_bind_free(void *data)
|
||||
{
|
||||
Efl_Model_View_Bind *bind = data;
|
||||
Efl_View_Model_Bind *bind = data;
|
||||
Eina_Stringshare *dst;
|
||||
|
||||
eina_stringshare_del(bind->source);
|
||||
|
@ -269,20 +269,20 @@ _bind_free(void *data)
|
|||
free(bind);
|
||||
}
|
||||
|
||||
static Efl_Model_View_Bind *
|
||||
_efl_model_view_property_bind_lookup(Efl_Model_View_Data *pd, Eina_Stringshare *src)
|
||||
static Efl_View_Model_Bind *
|
||||
_efl_view_model_property_bind_lookup(Efl_View_Model_Data *pd, Eina_Stringshare *src)
|
||||
{
|
||||
Efl_Model_View_Bind *bind;
|
||||
Efl_View_Model_Bind *bind;
|
||||
|
||||
bind = eina_hash_find(pd->bound, src);
|
||||
if (!bind && pd->parent) return _efl_model_view_property_bind_lookup(pd->parent, src);
|
||||
if (!bind && pd->parent) return _efl_view_model_property_bind_lookup(pd->parent, src);
|
||||
return bind;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_property_changed(void *data, const Efl_Event *event)
|
||||
_efl_view_model_property_changed(void *data, const Efl_Event *event)
|
||||
{
|
||||
Efl_Model_View_Data *pd = data;
|
||||
Efl_View_Model_Data *pd = data;
|
||||
Efl_Model_Property_Event *ev = event->info;
|
||||
Efl_Model_Property_Event nev = { 0 };
|
||||
const char *property;
|
||||
|
@ -300,12 +300,12 @@ _efl_model_view_property_changed(void *data, const Efl_Event *event)
|
|||
|
||||
EINA_ARRAY_ITER_NEXT(ev->changed_properties, i, property, iterator)
|
||||
{
|
||||
Efl_Model_View_Bind *bind;
|
||||
Efl_View_Model_Bind *bind;
|
||||
|
||||
eina_array_push(nev.changed_properties, property);
|
||||
|
||||
src = eina_stringshare_add(property);
|
||||
bind = _efl_model_view_property_bind_lookup(pd, src);
|
||||
bind = _efl_view_model_property_bind_lookup(pd, src);
|
||||
if (bind)
|
||||
{
|
||||
Eina_Stringshare *dest;
|
||||
|
@ -324,7 +324,7 @@ _efl_model_view_property_changed(void *data, const Efl_Event *event)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_children_bind_set(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd, Eina_Bool enable)
|
||||
_efl_view_model_children_bind_set(Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd, Eina_Bool enable)
|
||||
{
|
||||
if (pd->finalized) return;
|
||||
|
||||
|
@ -332,46 +332,46 @@ _efl_model_view_children_bind_set(Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd,
|
|||
}
|
||||
|
||||
static Eina_Bool
|
||||
_efl_model_view_children_bind_get(const Eo *obj EINA_UNUSED, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_children_bind_get(const Eo *obj EINA_UNUSED, Efl_View_Model_Data *pd)
|
||||
{
|
||||
return pd->children_bind;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_parent_data(Efl_Model_View *child, Efl_Model_View_Data *ppd)
|
||||
_efl_view_model_parent_data(Efl_View_Model *child, Efl_View_Model_Data *ppd)
|
||||
{
|
||||
Efl_Model_View_Data *cpd;
|
||||
Efl_View_Model_Data *cpd;
|
||||
|
||||
cpd = efl_data_scope_get(child, EFL_MODEL_VIEW_CLASS);
|
||||
cpd = efl_data_scope_get(child, EFL_VIEW_MODEL_CLASS);
|
||||
cpd->parent = ppd;
|
||||
cpd->propagating = ppd->propagating;
|
||||
}
|
||||
|
||||
static Efl_Model_View *
|
||||
_efl_model_view_child_lookup(Efl_Model_View_Data *pd, Efl_Object *parent, Efl_Model *view)
|
||||
static Efl_View_Model *
|
||||
_efl_view_model_child_lookup(Efl_View_Model_Data *pd, Efl_Object *parent, Efl_Model *view)
|
||||
{
|
||||
Efl_Model_View *co;
|
||||
Efl_View_Model *co;
|
||||
|
||||
co = efl_key_wref_get(view, "_efl.model_view");
|
||||
co = efl_key_wref_get(view, "_efl.view_model");
|
||||
if (co) return co;
|
||||
|
||||
co = efl_add(EFL_MODEL_VIEW_CLASS, parent,
|
||||
co = efl_add(EFL_VIEW_MODEL_CLASS, parent,
|
||||
efl_ui_view_model_set(efl_added, view),
|
||||
_efl_model_view_parent_data(efl_added, pd));
|
||||
_efl_view_model_parent_data(efl_added, pd));
|
||||
if (!co) return NULL;
|
||||
|
||||
efl_key_wref_set(view, "_efl.model_view", co);
|
||||
efl_key_wref_set(view, "_efl.view_model", co);
|
||||
|
||||
return co;
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_child_added(void *data, const Efl_Event *event)
|
||||
_efl_view_model_child_added(void *data, const Efl_Event *event)
|
||||
{
|
||||
Efl_Model_Children_Event *ev = event->info;
|
||||
Efl_Model_Children_Event nevt = { 0 };
|
||||
Efl_Model_View_Data *pd = data;
|
||||
Efl_Model_View *co;
|
||||
Efl_View_Model_Data *pd = data;
|
||||
Efl_View_Model *co;
|
||||
|
||||
if (pd->propagating.child_added) return ;
|
||||
if (!pd->children_bind) return;
|
||||
|
@ -382,7 +382,7 @@ _efl_model_view_child_added(void *data, const Efl_Event *event)
|
|||
// Our strategy is to rebuild a new Child_Add and cancel the current one.
|
||||
efl_event_callback_stop(event->object);
|
||||
|
||||
co = _efl_model_view_child_lookup(pd, event->object, ev->child);
|
||||
co = _efl_view_model_child_lookup(pd, event->object, ev->child);
|
||||
if (!co) return;
|
||||
|
||||
nevt.index = ev->index;
|
||||
|
@ -394,12 +394,12 @@ _efl_model_view_child_added(void *data, const Efl_Event *event)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_child_removed(void *data, const Efl_Event *event)
|
||||
_efl_view_model_child_removed(void *data, const Efl_Event *event)
|
||||
{
|
||||
Efl_Model_Children_Event *ev = event->info;
|
||||
Efl_Model_Children_Event nevt = { 0 };
|
||||
Efl_Model_View_Data *pd = data;
|
||||
Efl_Model_View *co;
|
||||
Efl_View_Model_Data *pd = data;
|
||||
Efl_View_Model *co;
|
||||
|
||||
if (pd->propagating.child_removed) return ;
|
||||
if (!pd->children_bind) return;
|
||||
|
@ -410,7 +410,7 @@ _efl_model_view_child_removed(void *data, const Efl_Event *event)
|
|||
// Our strategy is to rebuild a new Child_Add and cancel the current one.
|
||||
efl_event_callback_stop(event->object);
|
||||
|
||||
co = _efl_model_view_child_lookup(pd, event->object, ev->child);
|
||||
co = _efl_view_model_child_lookup(pd, event->object, ev->child);
|
||||
if (!co) return;
|
||||
|
||||
nevt.index = ev->index;
|
||||
|
@ -418,44 +418,44 @@ _efl_model_view_child_removed(void *data, const Efl_Event *event)
|
|||
|
||||
efl_event_callback_call(event->object, EFL_MODEL_EVENT_CHILD_REMOVED, &nevt);
|
||||
|
||||
// The object is being destroyed, there is no point in us keeping the ModelView proxy alive.
|
||||
// The object is being destroyed, there is no point in us keeping the ViewModel proxy alive.
|
||||
efl_del(co);
|
||||
|
||||
pd->propagating.child_removed = EINA_FALSE;
|
||||
}
|
||||
|
||||
EFL_CALLBACKS_ARRAY_DEFINE(efl_model_view_intercept,
|
||||
{ EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_model_view_property_changed },
|
||||
{ EFL_MODEL_EVENT_CHILD_ADDED, _efl_model_view_child_added },
|
||||
{ EFL_MODEL_EVENT_CHILD_REMOVED, _efl_model_view_child_removed })
|
||||
EFL_CALLBACKS_ARRAY_DEFINE(efl_view_model_intercept,
|
||||
{ EFL_MODEL_EVENT_PROPERTIES_CHANGED, _efl_view_model_property_changed },
|
||||
{ EFL_MODEL_EVENT_CHILD_ADDED, _efl_view_model_child_added },
|
||||
{ EFL_MODEL_EVENT_CHILD_REMOVED, _efl_view_model_child_removed })
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_view_efl_object_constructor(Eo *obj, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_efl_object_constructor(Eo *obj, Efl_View_Model_Data *pd)
|
||||
{
|
||||
obj = efl_constructor(efl_super(obj, EFL_MODEL_VIEW_CLASS));
|
||||
obj = efl_constructor(efl_super(obj, EFL_VIEW_MODEL_CLASS));
|
||||
|
||||
pd->children_bind = EINA_TRUE;
|
||||
pd->bound = eina_hash_stringshared_new(_bind_free);
|
||||
pd->logics = eina_hash_stringshared_new(_logic_free);
|
||||
pd->deduplication = eina_hash_stringshared_new(_ref_free);
|
||||
|
||||
efl_event_callback_array_priority_add(obj, efl_model_view_intercept(), EFL_CALLBACK_PRIORITY_BEFORE, pd);
|
||||
efl_event_callback_array_priority_add(obj, efl_view_model_intercept(), EFL_CALLBACK_PRIORITY_BEFORE, pd);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
static Efl_Object *
|
||||
_efl_model_view_efl_object_finalize(Eo *obj, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_efl_object_finalize(Eo *obj, Efl_View_Model_Data *pd)
|
||||
{
|
||||
pd->finalized = EINA_TRUE;
|
||||
|
||||
return efl_finalize(efl_super(obj, EFL_MODEL_VIEW_CLASS));
|
||||
return efl_finalize(efl_super(obj, EFL_VIEW_MODEL_CLASS));
|
||||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_efl_object_destructor(Eo *obj, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_efl_object_destructor(Eo *obj, Efl_View_Model_Data *pd)
|
||||
{
|
||||
efl_event_callback_array_del(obj, efl_model_view_intercept(), pd);
|
||||
efl_event_callback_array_del(obj, efl_view_model_intercept(), pd);
|
||||
|
||||
eina_hash_free(pd->bound);
|
||||
pd->bound = NULL;
|
||||
|
@ -463,78 +463,78 @@ _efl_model_view_efl_object_destructor(Eo *obj, Efl_Model_View_Data *pd)
|
|||
eina_hash_free(pd->logics);
|
||||
pd->logics = NULL;
|
||||
|
||||
efl_destructor(efl_super(obj, EFL_MODEL_VIEW_CLASS));
|
||||
efl_destructor(efl_super(obj, EFL_VIEW_MODEL_CLASS));
|
||||
}
|
||||
|
||||
static Efl_Model_View_Logic *
|
||||
_efl_model_view_property_logic_lookup(Efl_Model_View_Data *pd, Eina_Stringshare *property)
|
||||
static Efl_View_Model_Logic *
|
||||
_efl_view_model_property_logic_lookup(Efl_View_Model_Data *pd, Eina_Stringshare *property)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
|
||||
if (!pd) return NULL;
|
||||
logic = eina_hash_find(pd->logics, property);
|
||||
if (!logic) return _efl_model_view_property_logic_lookup(pd->parent, property);
|
||||
if (!logic) return _efl_view_model_property_logic_lookup(pd->parent, property);
|
||||
return logic;
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_view_efl_model_property_set(Eo *obj, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_efl_model_property_set(Eo *obj, Efl_View_Model_Data *pd,
|
||||
const char *property, Eina_Value *value)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
Eina_Stringshare *prop;
|
||||
Eina_Future *f;
|
||||
|
||||
prop = eina_stringshare_add(property);
|
||||
logic = _efl_model_view_property_logic_lookup(pd, prop);
|
||||
logic = _efl_view_model_property_logic_lookup(pd, prop);
|
||||
if (logic)
|
||||
f = logic->set.fct(logic->get.data, obj, prop, value);
|
||||
else
|
||||
f = efl_model_property_set(efl_super(obj, EFL_MODEL_VIEW_CLASS), property, value);
|
||||
f = efl_model_property_set(efl_super(obj, EFL_VIEW_MODEL_CLASS), property, value);
|
||||
|
||||
eina_stringshare_del(prop);
|
||||
return f;
|
||||
}
|
||||
|
||||
static Eina_Value *
|
||||
_efl_model_view_efl_model_property_get(const Eo *obj, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_efl_model_property_get(const Eo *obj, Efl_View_Model_Data *pd,
|
||||
const char *property)
|
||||
{
|
||||
Efl_Model_View_Logic *logic;
|
||||
Efl_View_Model_Logic *logic;
|
||||
Eina_Stringshare *prop;
|
||||
Eina_Value *r;
|
||||
|
||||
prop = eina_stringshare_add(property);
|
||||
logic = _efl_model_view_property_logic_lookup(pd, prop);
|
||||
logic = _efl_view_model_property_logic_lookup(pd, prop);
|
||||
if (logic)
|
||||
r = logic->get.fct(logic->get.data, obj, prop);
|
||||
else
|
||||
r = efl_model_property_get(efl_super(obj, EFL_MODEL_VIEW_CLASS), property);
|
||||
r = efl_model_property_get(efl_super(obj, EFL_VIEW_MODEL_CLASS), property);
|
||||
|
||||
eina_stringshare_del(prop);
|
||||
return r;
|
||||
}
|
||||
|
||||
static Eina_Iterator *
|
||||
_efl_model_view_efl_model_properties_get(const Eo *obj, Efl_Model_View_Data *pd)
|
||||
_efl_view_model_efl_model_properties_get(const Eo *obj, Efl_View_Model_Data *pd)
|
||||
{
|
||||
EFL_MODEL_COMPOSITE_PROPERTIES_SUPER(props, obj, EFL_MODEL_VIEW_CLASS,
|
||||
EFL_COMPOSITE_MODEL_PROPERTIES_SUPER(props, obj, EFL_VIEW_MODEL_CLASS,
|
||||
eina_hash_iterator_key_new(pd->deduplication));
|
||||
|
||||
return props;
|
||||
}
|
||||
|
||||
typedef struct _Efl_Model_View_Slice_Request Efl_Model_View_Slice_Request;
|
||||
struct _Efl_Model_View_Slice_Request
|
||||
typedef struct _Efl_View_Model_Slice_Request Efl_View_Model_Slice_Request;
|
||||
struct _Efl_View_Model_Slice_Request
|
||||
{
|
||||
Efl_Model_View_Data *pd;
|
||||
Efl_View_Model_Data *pd;
|
||||
unsigned int start;
|
||||
};
|
||||
|
||||
static Eina_Value
|
||||
_efl_model_view_slice_then(Eo *o, void *data, const Eina_Value v)
|
||||
_efl_view_model_slice_then(Eo *o, void *data, const Eina_Value v)
|
||||
{
|
||||
Efl_Model_View_Slice_Request *req = data;
|
||||
Efl_View_Model_Slice_Request *req = data;
|
||||
Eo *target;
|
||||
Eina_Value r = EINA_VALUE_EMPTY;
|
||||
unsigned int i, len;
|
||||
|
@ -545,7 +545,7 @@ _efl_model_view_slice_then(Eo *o, void *data, const Eina_Value v)
|
|||
{
|
||||
Eo *composite;
|
||||
|
||||
composite = _efl_model_view_child_lookup(req->pd, o, target);
|
||||
composite = _efl_view_model_child_lookup(req->pd, o, target);
|
||||
eina_value_array_append(&r, composite);
|
||||
}
|
||||
|
||||
|
@ -553,21 +553,21 @@ _efl_model_view_slice_then(Eo *o, void *data, const Eina_Value v)
|
|||
}
|
||||
|
||||
static void
|
||||
_efl_model_view_slice_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
_efl_view_model_slice_clean(Eo *o EINA_UNUSED, void *data, const Eina_Future *dead_future EINA_UNUSED)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
static Eina_Future *
|
||||
_efl_model_view_efl_model_children_slice_get(Eo *obj, Efl_Model_View_Data *pd,
|
||||
_efl_view_model_efl_model_children_slice_get(Eo *obj, Efl_View_Model_Data *pd,
|
||||
unsigned int start, unsigned int count)
|
||||
{
|
||||
Efl_Model_View_Slice_Request *req;
|
||||
Efl_View_Model_Slice_Request *req;
|
||||
Eina_Future *f;
|
||||
|
||||
f = efl_model_children_slice_get(efl_super(obj, EFL_MODEL_VIEW_CLASS), start, count);
|
||||
f = efl_model_children_slice_get(efl_super(obj, EFL_VIEW_MODEL_CLASS), start, count);
|
||||
|
||||
req = malloc(sizeof (Efl_Model_View_Slice_Request));
|
||||
req = malloc(sizeof (Efl_View_Model_Slice_Request));
|
||||
if (!req)
|
||||
{
|
||||
eina_future_cancel(f);
|
||||
|
@ -578,9 +578,9 @@ _efl_model_view_efl_model_children_slice_get(Eo *obj, Efl_Model_View_Data *pd,
|
|||
req->start = start;
|
||||
|
||||
return efl_future_then(obj, f, .success_type = EINA_VALUE_TYPE_ARRAY,
|
||||
.success = _efl_model_view_slice_then,
|
||||
.free = _efl_model_view_slice_clean,
|
||||
.success = _efl_view_model_slice_then,
|
||||
.free = _efl_view_model_slice_clean,
|
||||
.data = req);
|
||||
}
|
||||
|
||||
#include "efl_model_view.eo.c"
|
||||
#include "efl_view_model.eo.c"
|
|
@ -1,23 +1,23 @@
|
|||
function EflModelViewPropertyGet {
|
||||
function EflViewModelPropertyGet {
|
||||
[[Function called when a property is get.]]
|
||||
params {
|
||||
@in model_view: const(Efl.Model_View); [[The ModelView object the @.property.get is issued on.]]
|
||||
@in view_model: const(Efl.View_Model); [[The ViewModel object the @.property.get is issued on.]]
|
||||
@in property: stringshare; [[The property name the @.property.get is issued on.]]
|
||||
}
|
||||
return: any_value_ptr; [[The property value.]]
|
||||
};
|
||||
|
||||
function EflModelViewPropertySet {
|
||||
function EflViewModelPropertySet {
|
||||
[[Function called when a property is set.]]
|
||||
params {
|
||||
@in model_view: Efl.Model_View; [[The ModelView object the @.property.set is issued on.]]
|
||||
@in view_model: Efl.View_Model; [[The ViewModel object the @.property.set is issued on.]]
|
||||
@in property: stringshare; [[The property name the @.property.set is issued on.]]
|
||||
@in value: any_value_ptr @owned; [[The new value to set.]]
|
||||
}
|
||||
return: future<any_value_ptr>; [[The value that was finally set.]]
|
||||
};
|
||||
|
||||
class Efl.Model_View extends Efl.Model_Composite
|
||||
class Efl.View_Model extends Efl.Composite_Model
|
||||
{
|
||||
[[Efl model providing helpers for custom properties used when linking a model to a view and you need to generate/adapt values for display.
|
||||
|
||||
|
@ -34,8 +34,8 @@ class Efl.Model_View extends Efl.Model_Composite
|
|||
]]
|
||||
params {
|
||||
property: string; [[The property to bind on to.]]
|
||||
get: EflModelViewPropertyGet; [[Define the get callback called when the @Efl.Model.property.get is called with the above property name.]]
|
||||
set: EflModelViewPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called with the above property name.]]
|
||||
get: EflViewModelPropertyGet; [[Define the get callback called when the @Efl.Model.property.get is called with the above property name.]]
|
||||
set: EflViewModelPropertySet; [[Define the set callback called when the @Efl.Model.property.set is called with the above property name.]]
|
||||
binded: iterator<string>; [[Iterator of property name to bind with this defined property see @.property_bind.]]
|
||||
}
|
||||
return: Eina.Error;
|
||||
|
@ -60,7 +60,7 @@ class Efl.Model_View extends Efl.Model_Composite
|
|||
]]
|
||||
params {
|
||||
@in source: string; [[Property name in the composited model.]]
|
||||
@in destination: string; [[Property name in the @Efl.Model_View]]
|
||||
@in destination: string; [[Property name in the @Efl.View_Model]]
|
||||
}
|
||||
}
|
||||
property_unbind {
|
||||
|
@ -70,12 +70,12 @@ class Efl.Model_View extends Efl.Model_Composite
|
|||
]]
|
||||
params {
|
||||
@in source: string; [[Property name in the composited model.]]
|
||||
@in destination: string; [[Property name in the @Efl.Model_View]]
|
||||
@in destination: string; [[Property name in the @Efl.View_Model]]
|
||||
}
|
||||
}
|
||||
@property children_bind {
|
||||
[[Define if we will intercept all childrens object reference and
|
||||
bind them through the ModelView with the same property logic as this
|
||||
bind them through the ViewModel with the same property logic as this
|
||||
one. Be careful of recursivity.
|
||||
|
||||
This can only be applied at construction time.]]
|
||||
|
@ -99,6 +99,6 @@ class Efl.Model_View extends Efl.Model_Composite
|
|||
Efl.Model.property { set; get; }
|
||||
}
|
||||
constructors {
|
||||
Efl.Model_View.children_bind;
|
||||
Efl.View_Model.children_bind;
|
||||
}
|
||||
}
|
|
@ -67,16 +67,14 @@ pub_eo_files = [
|
|||
'efl_cubic_bezier_interpolator.eo',
|
||||
'efl_loop_message_future_handler.eo',
|
||||
'efl_loop_message_future.eo',
|
||||
'efl_model_loop.eo',
|
||||
'efl_model_item.eo',
|
||||
'efl_model_container.eo',
|
||||
'efl_model_container_item.eo',
|
||||
'efl_model_composite_boolean.eo',
|
||||
'efl_model_composite_boolean_children.eo',
|
||||
'efl_model_composite_selection.eo',
|
||||
'efl_model_composite_selection_children.eo',
|
||||
'efl_model_composite.eo',
|
||||
'efl_model_view.eo'
|
||||
'efl_loop_model.eo',
|
||||
'efl_generic_model.eo',
|
||||
'efl_container_model.eo',
|
||||
'efl_container_model_item.eo',
|
||||
'efl_boolean_model.eo',
|
||||
'efl_select_model.eo',
|
||||
'efl_composite_model.eo',
|
||||
'efl_view_model.eo'
|
||||
]
|
||||
|
||||
foreach eo_file : pub_eo_files
|
||||
|
@ -146,18 +144,18 @@ ecore_src = [
|
|||
'efl_io_file.c',
|
||||
'efl_io_copier.c',
|
||||
'efl_io_buffered_stream.c',
|
||||
'efl_model_loop.c',
|
||||
'efl_model_item.c',
|
||||
'efl_model_container.c',
|
||||
'efl_model_container_item.c',
|
||||
'efl_model_container_private.h',
|
||||
'efl_model_composite.c',
|
||||
'efl_model_composite_boolean.c',
|
||||
'efl_model_composite_selection.c',
|
||||
'efl_model_composite_private.h',
|
||||
'efl_loop_model.c',
|
||||
'efl_generic_model.c',
|
||||
'efl_container_model.c',
|
||||
'efl_container_model_item.c',
|
||||
'efl_container_model_private.h',
|
||||
'efl_composite_model.c',
|
||||
'efl_boolean_model.c',
|
||||
'efl_select_model.c',
|
||||
'efl_composite_model_private.h',
|
||||
'efl_model_accessor_view.c',
|
||||
'efl_model_accessor_view_private.h',
|
||||
'efl_model_view.c',
|
||||
'efl_view_model.c',
|
||||
'efl_linear_interpolator.c',
|
||||
'efl_accelerate_interpolator.c',
|
||||
'efl_decelerate_interpolator.c',
|
||||
|
|
|
@ -288,13 +288,13 @@ efl_net_ip_port_parse_split(const char *host, const char *port, struct sockaddr_
|
|||
if (storage->ss_family == AF_INET6)
|
||||
{
|
||||
struct sockaddr_in6 *a = (struct sockaddr_in6 *)storage;
|
||||
a->sin6_port = htons(p);
|
||||
a->sin6_port = eina_htons(p);
|
||||
x = inet_pton(AF_INET6, host, &a->sin6_addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
struct sockaddr_in *a = (struct sockaddr_in *)storage;
|
||||
a->sin_port = htons(p);
|
||||
a->sin_port = eina_htons(p);
|
||||
x = inet_pton(AF_INET, host, &a->sin_addr);
|
||||
}
|
||||
|
||||
|
@ -313,13 +313,13 @@ efl_net_ip_port_fmt(char *buf, size_t buflen, const struct sockaddr *addr)
|
|||
{
|
||||
const struct sockaddr_in *a = (const struct sockaddr_in *)addr;
|
||||
mem = &a->sin_addr;
|
||||
port = ntohs(a->sin_port);
|
||||
port = eina_ntohs(a->sin_port);
|
||||
}
|
||||
else if (addr->sa_family == AF_INET6)
|
||||
{
|
||||
const struct sockaddr_in6 *a = (const struct sockaddr_in6 *)addr;
|
||||
mem = &a->sin6_addr;
|
||||
port = ntohs(a->sin6_port);
|
||||
port = eina_ntohs(a->sin6_port);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -11,10 +11,6 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#include "Ecore.h"
|
||||
|
@ -318,11 +314,11 @@ _ecore_con_eet_data(Ecore_Con_Reply *n, void *data, unsigned int size)
|
|||
unsigned int *tmp = data;
|
||||
size -= 4 * sizeof (unsigned int);
|
||||
|
||||
if (ntohl(tmp[0]) == ECORE_CON_EET_RAW_MAGIC)
|
||||
if (eina_ntohl(tmp[0]) == ECORE_CON_EET_RAW_MAGIC)
|
||||
{
|
||||
unsigned int protocol_length = ntohl(tmp[1]);
|
||||
unsigned int section_length = ntohl(tmp[2]);
|
||||
unsigned int data_length = ntohl(tmp[3]);
|
||||
unsigned int protocol_length = eina_ntohl(tmp[1]);
|
||||
unsigned int section_length = eina_ntohl(tmp[2]);
|
||||
unsigned int data_length = eina_ntohl(tmp[3]);
|
||||
|
||||
if (protocol_length > 1 && section_length > 1 && protocol_length + section_length <= size && data_length < 10 * 1024 * 1024)
|
||||
{
|
||||
|
@ -559,10 +555,10 @@ _ecore_con_eet_base_raw_send(Eo *obj EINA_UNUSED, Ecore_Con_Eet_Base_Data *pd, E
|
|||
if (protocol_length == 1) return;
|
||||
section_length = strlen(section) + 1;
|
||||
|
||||
protocol[0] = htonl(ECORE_CON_EET_RAW_MAGIC);
|
||||
protocol[1] = htonl(protocol_length);
|
||||
protocol[2] = htonl(section_length);
|
||||
protocol[3] = htonl(length);
|
||||
protocol[0] = eina_htonl(ECORE_CON_EET_RAW_MAGIC);
|
||||
protocol[1] = eina_htonl(protocol_length);
|
||||
protocol[2] = eina_htonl(section_length);
|
||||
protocol[3] = eina_htonl(length);
|
||||
|
||||
size = sizeof (protocol) + protocol_length + section_length;
|
||||
tmp = alloca(size);
|
||||
|
|
|
@ -143,7 +143,7 @@ _efl_net_dialer_udp_resolved_bind(Eo *o, Efl_Net_Dialer_Udp_Data *pd EINA_UNUSED
|
|||
if (family == AF_INET)
|
||||
{
|
||||
const struct sockaddr_in *a = (const struct sockaddr_in *)addr->ai_addr;
|
||||
uint32_t ipv4 = ntohl(a->sin_addr.s_addr);
|
||||
uint32_t ipv4 = eina_ntohl(a->sin_addr.s_addr);
|
||||
if (ipv4 == INADDR_BROADCAST)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -104,7 +104,7 @@ _efl_net_ip_address_family_get(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data
|
|||
EOLIAN static void
|
||||
_efl_net_ip_address_port_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, uint16_t port)
|
||||
{
|
||||
uint16_t *pport, nport = htons(port);
|
||||
uint16_t *pport, nport = eina_htons(port);
|
||||
|
||||
EINA_SAFETY_ON_TRUE_RETURN(pd->addr.sa_family == 0);
|
||||
if (pd->addr.sa_family == AF_INET6)
|
||||
|
@ -115,7 +115,7 @@ _efl_net_ip_address_port_set(Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd, uin
|
|||
if (*pport == nport) return;
|
||||
if (*pport)
|
||||
{
|
||||
ERR("port already set to %hu, new %hu", ntohs(*pport), port);
|
||||
ERR("port already set to %hu, new %hu", eina_ntohs(*pport), port);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ _efl_net_ip_address_port_get(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *p
|
|||
else
|
||||
pport = &pd->ipv4.sin_port;
|
||||
|
||||
return ntohs(*pport);
|
||||
return eina_ntohs(*pport);
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
|
@ -213,7 +213,7 @@ _efl_net_ip_address_sockaddr_get(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Dat
|
|||
return &pd->addr;
|
||||
}
|
||||
|
||||
#define IPV4_ADDR_GET(pd) ntohl(pd->ipv4.sin_addr.s_addr)
|
||||
#define IPV4_ADDR_GET(pd) eina_ntohl(pd->ipv4.sin_addr.s_addr)
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_net_ip_address_ipv4_class_a_check(const Eo *o EINA_UNUSED, Efl_Net_Ip_Address_Data *pd)
|
||||
|
|
|
@ -124,9 +124,9 @@ _efl_net_socket_udp_bind(Eo *o, Efl_Net_Socket_Udp_Data *pd)
|
|||
}
|
||||
|
||||
if (family == AF_INET)
|
||||
bsa4.sin_port = htons(ul);
|
||||
bsa4.sin_port = eina_htons(ul);
|
||||
else
|
||||
bsa6.sin6_port = htons(ul);
|
||||
bsa6.sin6_port = eina_htons(ul);
|
||||
|
||||
if (family == AF_INET)
|
||||
r = bind(fd, (struct sockaddr *)&bsa4, sizeof(bsa4));
|
||||
|
@ -539,7 +539,7 @@ _efl_net_socket_udp_efl_io_reader_read(Eo *o, Efl_Net_Socket_Udp_Data *pd, Eina_
|
|||
if (addr.ss_family == AF_INET)
|
||||
{
|
||||
const struct sockaddr_in *a = (const struct sockaddr_in *)pd->addr_remote;
|
||||
uint32_t ipv4 = ntohl(a->sin_addr.s_addr);
|
||||
uint32_t ipv4 = eina_ntohl(a->sin_addr.s_addr);
|
||||
if ((ipv4 != INADDR_BROADCAST) && (ipv4 != INADDR_ANY) && (!IN_MULTICAST(ipv4)))
|
||||
{
|
||||
if ((addrlen != pd->addr_remote_len) ||
|
||||
|
|
|
@ -310,6 +310,17 @@ EAPI void ecore_drm2_device_pointer_accel_profile_set(Ecore_Drm2_Device *device,
|
|||
*/
|
||||
EAPI Eina_Bool ecore_drm2_device_pointer_rotation_set(Ecore_Drm2_Device *device, int rotation);
|
||||
|
||||
/**
|
||||
* Enable or disable pointer tap-to-click
|
||||
*
|
||||
* @param device
|
||||
* @param enabled
|
||||
*
|
||||
* @ingroup Ecore_Drm2_Device_Group
|
||||
* @since 1.22
|
||||
*/
|
||||
EAPI void ecore_drm2_device_touch_tap_to_click_enabled_set(Ecore_Drm2_Device *device, Eina_Bool enabled);
|
||||
|
||||
/**
|
||||
* Set info to be used on keyboards
|
||||
*
|
||||
|
|
|
@ -782,6 +782,14 @@ ecore_drm2_device_pointer_accel_profile_set(Ecore_Drm2_Device *device, uint32_t
|
|||
elput_input_pointer_accel_profile_set(device->em, NULL, profile);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_drm2_device_touch_tap_to_click_enabled_set(Ecore_Drm2_Device *device, Eina_Bool enabled)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN(device);
|
||||
|
||||
elput_input_touch_tap_to_click_enabled_set(device->em, NULL, enabled);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_drm2_device_window_set(Ecore_Drm2_Device *device, unsigned int window)
|
||||
{
|
||||
|
|
|
@ -859,14 +859,14 @@ next:
|
|||
{
|
||||
output->connected = EINA_FALSE;
|
||||
output->enabled = EINA_FALSE;
|
||||
_output_event_send(output);
|
||||
}
|
||||
else
|
||||
{
|
||||
output->connected = EINA_TRUE;
|
||||
output->enabled = EINA_TRUE;
|
||||
_output_event_send(output);
|
||||
}
|
||||
|
||||
_output_event_send(output);
|
||||
}
|
||||
free(connected);
|
||||
}
|
||||
|
@ -891,10 +891,7 @@ _output_destroy(Ecore_Drm2_Device *dev EINA_UNUSED, Ecore_Drm2_Output *output)
|
|||
{
|
||||
if (output->prep.atomic_req)
|
||||
sym_drmModeAtomicFree(output->prep.atomic_req);
|
||||
}
|
||||
|
||||
if (_ecore_drm2_use_atomic)
|
||||
{
|
||||
EINA_LIST_FREE(output->plane_states, pstate)
|
||||
free(pstate);
|
||||
|
||||
|
@ -1347,8 +1344,8 @@ ecore_drm2_output_mode_set(Ecore_Drm2_Output *output, Ecore_Drm2_Output_Mode *mo
|
|||
else
|
||||
buffer = output->ocrtc->buffer_id;
|
||||
|
||||
if (sym_drmModeSetCrtc(output->fd, output->crtc_id, buffer,
|
||||
0, 0, &output->conn_id, 1, &mode->info) < 0)
|
||||
if (sym_drmModeSetCrtc(output->fd, output->crtc_id, buffer, 0, 0,
|
||||
&output->conn_id, 1, &mode->info) < 0)
|
||||
{
|
||||
ERR("Failed to set Mode %dx%d for Output %s: %m",
|
||||
mode->width, mode->height, output->name);
|
||||
|
@ -1551,8 +1548,7 @@ ecore_drm2_output_rotation_set(Ecore_Drm2_Output *output, int rotation)
|
|||
pstate->rotation.id, rotation);
|
||||
if (res < 0) goto err;
|
||||
|
||||
res = sym_drmModeAtomicCommit(output->fd, req, flags,
|
||||
output);
|
||||
res = sym_drmModeAtomicCommit(output->fd, req, flags, output);
|
||||
if (res < 0)
|
||||
goto err;
|
||||
else
|
||||
|
|
|
@ -77,10 +77,9 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h)
|
|||
else
|
||||
{
|
||||
if (bdata->pixels)
|
||||
bdata->free_func(bdata->data,
|
||||
bdata->pixels);
|
||||
bdata->pixels = bdata->alloc_func(bdata->data,
|
||||
ee->w * ee->h * sizeof(int));
|
||||
bdata->free_func(bdata->data, bdata->pixels);
|
||||
bdata->pixels =
|
||||
bdata->alloc_func(bdata->data, ee->w * ee->h * sizeof(int));
|
||||
stride = ee->w * sizeof(int);
|
||||
}
|
||||
|
||||
|
@ -103,7 +102,7 @@ _ecore_evas_resize(Ecore_Evas *ee, int w, int h)
|
|||
}
|
||||
}
|
||||
if (bdata->image)
|
||||
evas_object_image_data_set(bdata->image, bdata->pixels);
|
||||
evas_object_image_data_set(bdata->image, bdata->pixels);
|
||||
else
|
||||
bdata->resized = 1;
|
||||
}
|
||||
|
@ -176,7 +175,7 @@ _ecore_evas_buffer_prepare(Ecore_Evas *ee)
|
|||
|
||||
evas_object_image_size_get(bdata->image, &w, &h);
|
||||
if ((w != ee->w) || (h != ee->h))
|
||||
_ecore_evas_resize(ee, w, h);
|
||||
_ecore_evas_resize(ee, w, h);
|
||||
bdata->pixels = evas_object_image_data_get(bdata->image, 1);
|
||||
}
|
||||
else if (bdata->resized)
|
||||
|
@ -522,7 +521,7 @@ _ecore_evas_buffer_alpha_set(Ecore_Evas *ee, int alpha)
|
|||
if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return;
|
||||
ee->alpha = alpha;
|
||||
if (bdata->image)
|
||||
evas_object_image_alpha_set(bdata->image, ee->alpha);
|
||||
evas_object_image_alpha_set(bdata->image, ee->alpha);
|
||||
else
|
||||
{
|
||||
Evas_Engine_Info_Buffer *einfo;
|
||||
|
@ -665,90 +664,90 @@ _ecore_evas_buffer_pointer_warp(const Ecore_Evas *ee, Evas_Coord x, Evas_Coord y
|
|||
static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
|
||||
{
|
||||
_ecore_evas_buffer_free,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
_ecore_evas_move,
|
||||
NULL,
|
||||
_ecore_evas_resize,
|
||||
_ecore_evas_move_resize,
|
||||
NULL,
|
||||
NULL,
|
||||
_ecore_evas_show,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
_ecore_evas_buffer_title_set,
|
||||
_ecore_evas_buffer_name_class_set,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
_ecore_evas_buffer_ignore_events_set,
|
||||
_ecore_evas_buffer_alpha_set,
|
||||
NULL, //transparent
|
||||
NULL, // profiles_set
|
||||
_ecore_evas_buffer_profile_set,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
_ecore_evas_move,
|
||||
NULL,
|
||||
_ecore_evas_resize,
|
||||
_ecore_evas_move_resize,
|
||||
NULL,
|
||||
NULL,
|
||||
_ecore_evas_show,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
_ecore_evas_buffer_title_set,
|
||||
_ecore_evas_buffer_name_class_set,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
_ecore_evas_buffer_ignore_events_set,
|
||||
_ecore_evas_buffer_alpha_set,
|
||||
NULL, //transparent
|
||||
NULL, // profiles_set
|
||||
_ecore_evas_buffer_profile_set,
|
||||
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
||||
NULL,
|
||||
_ecore_evas_buffer_screen_geometry_get,
|
||||
NULL, // screen_dpi_get
|
||||
_ecore_evas_buffer_msg_parent_send,
|
||||
_ecore_evas_buffer_msg_send,
|
||||
NULL,
|
||||
_ecore_evas_buffer_screen_geometry_get,
|
||||
NULL, // screen_dpi_get
|
||||
_ecore_evas_buffer_msg_parent_send,
|
||||
_ecore_evas_buffer_msg_send,
|
||||
|
||||
_ecore_evas_buffer_pointer_xy_get, // pointer_xy_get
|
||||
_ecore_evas_buffer_pointer_warp, // pointer_warp
|
||||
_ecore_evas_buffer_pointer_xy_get, // pointer_xy_get
|
||||
_ecore_evas_buffer_pointer_warp, // pointer_warp
|
||||
|
||||
NULL, // wm_rot_preferred_rotation_set
|
||||
NULL, // wm_rot_available_rotations_set
|
||||
NULL, // wm_rot_manual_rotation_done_set
|
||||
NULL, // wm_rot_manual_rotation_done
|
||||
NULL, // wm_rot_preferred_rotation_set
|
||||
NULL, // wm_rot_available_rotations_set
|
||||
NULL, // wm_rot_manual_rotation_done_set
|
||||
NULL, // wm_rot_manual_rotation_done
|
||||
|
||||
NULL, // aux_hints_set
|
||||
NULL, // aux_hints_set
|
||||
|
||||
NULL, // fn_animator_register
|
||||
NULL, // fn_animator_unregister
|
||||
NULL, // fn_animator_register
|
||||
NULL, // fn_animator_unregister
|
||||
|
||||
NULL, // fn_evas_changed
|
||||
NULL, //fn_focus_device_set
|
||||
NULL, //fn_callback_focus_device_in_set
|
||||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
_ecore_evas_buffer_prepare,
|
||||
NULL // fn_last_tick_get
|
||||
NULL, // fn_evas_changed
|
||||
NULL, //fn_focus_device_set
|
||||
NULL, //fn_callback_focus_device_in_set
|
||||
NULL, //fn_callback_focus_device_out_set
|
||||
NULL, //fn_callback_device_mouse_in_set
|
||||
NULL, //fn_callback_device_mouse_out_set
|
||||
NULL, //fn_pointer_device_xy_get
|
||||
_ecore_evas_buffer_prepare,
|
||||
NULL // fn_last_tick_get
|
||||
};
|
||||
|
||||
static void *
|
||||
|
@ -893,8 +892,9 @@ ecore_evas_buffer_new(int w, int h)
|
|||
|
||||
ecore_event_evas_init();
|
||||
|
||||
ee = ecore_evas_buffer_allocfunc_new
|
||||
(w, h, _ecore_evas_buffer_pix_alloc, _ecore_evas_buffer_pix_free, NULL);
|
||||
ee =
|
||||
ecore_evas_buffer_allocfunc_new(w, h, _ecore_evas_buffer_pix_alloc,
|
||||
_ecore_evas_buffer_pix_free, NULL);
|
||||
|
||||
if (!ee) ecore_event_evas_shutdown();
|
||||
|
||||
|
|
|
@ -47,6 +47,8 @@ extern "C" {
|
|||
* @defgroup Ecore_IMF_Context_Group Ecore Input Method Context Functions
|
||||
* @ingroup Ecore_IMF_Lib_Group
|
||||
*
|
||||
* @section intro Introduction
|
||||
*
|
||||
* Functions that operate on Ecore Input Method Context objects.
|
||||
|
||||
* Ecore Input Method Context Function defines the interface for EFL input methods.
|
||||
|
@ -64,8 +66,44 @@ extern "C" {
|
|||
* ecore_imf_init() should be called to initialize and load immodule.@n
|
||||
* ecore_imf_shutdown() is used for shutdowning and unloading immodule.
|
||||
*
|
||||
* An example of usage of these functions can be found at:
|
||||
* @section how-to-compose How to process key event for composition or prediction
|
||||
*
|
||||
* To input Chinese, Japanese, Korean and other complex languages, the editor widget (as known as entry) should be connected with input method framework.@n
|
||||
* Each editor widget should have each input context to connect with input service framework.@n
|
||||
* Key event is processed by input method engine. The result is notified to application through ECORE_IMF_CALLBACK_PREEDIT_CHANGED and ECORE_IMF_CALLBACK_COMMIT event.@n
|
||||
* @n
|
||||
* The following example demonstrates how to connect input method framework and handle preedit and commit string from input method framework.
|
||||
* @li @ref ecore_imf_example_c
|
||||
*
|
||||
* @section media-content How to receive media contents from input method editor
|
||||
*
|
||||
* Users sometimes wants to send images and other rich content with their input method editor (as known as virtual keyboard or soft keyboard).@n
|
||||
* According to this requirement, the way to receive the media content URI such as images and other rich content as well as text have been provided since 1.20.@n
|
||||
* @n
|
||||
* The following code shows how to receive the media content URI.
|
||||
*
|
||||
* @code
|
||||
* #include <glib.h>
|
||||
*
|
||||
* static void
|
||||
* _imf_event_commit_content_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
|
||||
* {
|
||||
* Ecore_IMF_Event_Commit_Content *commit_content = (Ecore_IMF_Event_Commit_Content *)event_info;
|
||||
* if (!commit_content) return;
|
||||
*
|
||||
* // convert URI to filename
|
||||
* gchar *filepath = g_filename_from_uri(commit_content->content_uri, NULL, NULL);
|
||||
* printf("filepath : %s, description : %s, mime types : %s\n", filepath, commit_content->description, commit_content->mime_types);
|
||||
*
|
||||
* // do something to use filepath
|
||||
*
|
||||
* if (filepath)
|
||||
* g_free(filepath);
|
||||
* }
|
||||
*
|
||||
* ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT_CONTENT, _imf_event_commit_content_cb, data);
|
||||
* @endcode
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -1451,8 +1489,10 @@ EAPI void ecore_imf_context_delete_surrounding_event_ad
|
|||
*
|
||||
* The event type @p type to trigger the function may be one of
|
||||
* #ECORE_IMF_CALLBACK_PREEDIT_START, #ECORE_IMF_CALLBACK_PREEDIT_END,
|
||||
* #ECORE_IMF_CALLBACK_PREEDIT_CHANGED, #ECORE_IMF_CALLBACK_COMMIT and
|
||||
* #ECORE_IMF_CALLBACK_DELETE_SURROUNDING.
|
||||
* #ECORE_IMF_CALLBACK_PREEDIT_CHANGED, #ECORE_IMF_CALLBACK_COMMIT,
|
||||
* #ECORE_IMF_CALLBACK_DELETE_SURROUNDING, #ECORE_IMF_CALLBACK_SELECTION_SET,
|
||||
* #ECORE_IMF_CALLBACK_PRIVATE_COMMAND_SEND, #ECORE_IMF_CALLBACK_COMMIT_CONTENT,
|
||||
* #ECORE_IMF_CALLBACK_TRANSACTION_START, and #ECORE_IMF_CALLBACK_TRANSACTION_END.
|
||||
*
|
||||
* @param ctx Ecore_IMF_Context to attach a callback to.
|
||||
* @param type The type of event that will trigger the callback
|
||||
|
@ -1463,6 +1503,9 @@ EAPI void ecore_imf_context_delete_surrounding_event_ad
|
|||
*
|
||||
* Example
|
||||
* @code
|
||||
* #include <glib.h>
|
||||
*
|
||||
* // example for handling commit event from input framework
|
||||
* static void
|
||||
* _imf_event_commit_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
|
||||
* {
|
||||
|
@ -1471,6 +1514,28 @@ EAPI void ecore_imf_context_delete_surrounding_event_ad
|
|||
* }
|
||||
*
|
||||
* ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT, _imf_event_commit_cb, data);
|
||||
*
|
||||
* // example for receiving media content URI from input framework
|
||||
* @code
|
||||
* #include <glib.h>
|
||||
*
|
||||
* static void
|
||||
* _imf_event_commit_content_cb(void *data, Ecore_IMF_Context *ctx, void *event_info)
|
||||
* {
|
||||
* Ecore_IMF_Event_Commit_Content *commit_content = (Ecore_IMF_Event_Commit_Content *)event;
|
||||
* if (!commit_content) return;
|
||||
*
|
||||
* // convert URI to filename
|
||||
* gchar *filepath = g_filename_from_uri(commit_content->content_uri, NULL, NULL);
|
||||
* printf("filepath : %s, description : %s, mime types : %s\n", filepath, commit_content->description, commit_content->mime_types);
|
||||
*
|
||||
* // do something to use filepath
|
||||
*
|
||||
* if (filepath)
|
||||
* g_free(filepath);
|
||||
* }
|
||||
*
|
||||
* ecore_imf_context_event_callback_add(en->imf_context, ECORE_IMF_CALLBACK_COMMIT_CONTENT, _imf_event_commit_content_cb, data);
|
||||
* @endcode
|
||||
*/
|
||||
EAPI void ecore_imf_context_event_callback_add(Ecore_IMF_Context *ctx, Ecore_IMF_Callback_Type type, Ecore_IMF_Event_Cb func, const void *data);
|
||||
|
|
|
@ -886,7 +886,7 @@ ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr)
|
|||
unsigned char *dd; \
|
||||
dd = (unsigned char *)&v; \
|
||||
v = d; \
|
||||
v = htonl(v); \
|
||||
v = eina_htonl(v); \
|
||||
*(dat + s + 0) = dd[0]; \
|
||||
*(dat + s + 1) = dd[1]; \
|
||||
*(dat + s + 2) = dd[2]; \
|
||||
|
@ -899,7 +899,7 @@ ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr)
|
|||
unsigned char *dd; \
|
||||
dd = (unsigned char *)&v; \
|
||||
v = d; \
|
||||
v = htons(v); \
|
||||
v = eina_htons(v); \
|
||||
*(dat + s + 0) = dd[0]; \
|
||||
*(dat + s + 1) = dd[1]; \
|
||||
s += 2; \
|
||||
|
@ -945,7 +945,7 @@ ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int
|
|||
*head |= md << (4 * 4);
|
||||
SVENC(size);
|
||||
*head |= md << (4 * 5);
|
||||
*head = htonl(*head);
|
||||
*head = eina_htonl(*head);
|
||||
svr->prev.o = msg;
|
||||
|
||||
if (svr->dialer.input)
|
||||
|
@ -1101,7 +1101,7 @@ ecore_ipc_server_flush(Ecore_Ipc_Server *svr)
|
|||
unsigned char *dd; \
|
||||
dd = (unsigned char *)&v; \
|
||||
v = d; \
|
||||
v = htonl(v); \
|
||||
v = eina_htonl(v); \
|
||||
*(dat + s + 0) = dd[0]; \
|
||||
*(dat + s + 1) = dd[1]; \
|
||||
*(dat + s + 2) = dd[2]; \
|
||||
|
@ -1114,7 +1114,7 @@ ecore_ipc_server_flush(Ecore_Ipc_Server *svr)
|
|||
unsigned char *dd; \
|
||||
dd = (unsigned char *)&v; \
|
||||
v = d; \
|
||||
v = htons(v); \
|
||||
v = eina_htons(v); \
|
||||
*(dat + s + 0) = dd[0]; \
|
||||
*(dat + s + 1) = dd[1]; \
|
||||
s += 2; \
|
||||
|
@ -1168,7 +1168,7 @@ ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int r
|
|||
*head |= md << (4 * 4);
|
||||
CLENC(size);
|
||||
*head |= md << (4 * 5);
|
||||
*head = htonl(*head);
|
||||
*head = eina_htonl(*head);
|
||||
cl->prev.o = msg;
|
||||
|
||||
if (cl->socket.input)
|
||||
|
@ -1503,7 +1503,7 @@ ecore_ipc_ssl_available_get(void)
|
|||
dv[1] = *(cl->buf + offset + s + 1); \
|
||||
dv[2] = *(cl->buf + offset + s + 2); \
|
||||
dv[3] = *(cl->buf + offset + s + 3); \
|
||||
d = (int)ntohl(v); \
|
||||
d = (int)eina_ntohl(v); \
|
||||
s += 4; \
|
||||
} \
|
||||
else if (md >= DLT_ADD16) \
|
||||
|
@ -1513,7 +1513,7 @@ ecore_ipc_ssl_available_get(void)
|
|||
dv = (unsigned char *)&v; \
|
||||
dv[0] = *(cl->buf + offset + s + 0); \
|
||||
dv[1] = *(cl->buf + offset + s + 1); \
|
||||
d = (int)ntohs(v); \
|
||||
d = (int)eina_ntohs(v); \
|
||||
s += 2; \
|
||||
} \
|
||||
else if (md >= DLT_ADD8) \
|
||||
|
@ -1572,7 +1572,7 @@ ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_B
|
|||
dd[1] = *(cl->buf + offset + 1);
|
||||
dd[2] = *(cl->buf + offset + 2);
|
||||
dd[3] = *(cl->buf + offset + 3);
|
||||
head = ntohl(head);
|
||||
head = eina_ntohl(head);
|
||||
dd = (unsigned char *)&d;
|
||||
s = 4;
|
||||
CLSZ(0);
|
||||
|
@ -1695,7 +1695,7 @@ ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_B
|
|||
dv[1] = *(svr->buf + offset + s + 1); \
|
||||
dv[2] = *(svr->buf + offset + s + 2); \
|
||||
dv[3] = *(svr->buf + offset + s + 3); \
|
||||
d = (int)ntohl(v); \
|
||||
d = (int)eina_ntohl(v); \
|
||||
s += 4; \
|
||||
} \
|
||||
else if (md >= DLT_ADD16) \
|
||||
|
@ -1705,7 +1705,7 @@ ecore_ipc_client_data_process(Ecore_Ipc_Client *cl, void *data, int size, Eina_B
|
|||
dv = (unsigned char *)&v; \
|
||||
dv[0] = *(svr->buf + offset + s + 0); \
|
||||
dv[1] = *(svr->buf + offset + s + 1); \
|
||||
d = (int)ntohs(v); \
|
||||
d = (int)eina_ntohs(v); \
|
||||
s += 2; \
|
||||
} \
|
||||
else if (md >= DLT_ADD8) \
|
||||
|
@ -1763,7 +1763,7 @@ ecore_ipc_server_data_process(Ecore_Ipc_Server *svr, void *data, int size, Eina_
|
|||
dd[1] = *(svr->buf + offset + 1);
|
||||
dd[2] = *(svr->buf + offset + 2);
|
||||
dd[3] = *(svr->buf + offset + 3);
|
||||
head = ntohl(head);
|
||||
head = eina_ntohl(head);
|
||||
dd = (unsigned char *)&d;
|
||||
s = 4;
|
||||
SVSZ(0);
|
||||
|
|
|
@ -765,6 +765,7 @@ _pointer_cb_button(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned
|
|||
if (!input) return;
|
||||
|
||||
input->display->serial = serial;
|
||||
input->timestamp = timestamp;
|
||||
|
||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
|
||||
{
|
||||
|
@ -802,6 +803,8 @@ _pointer_cb_axis(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned in
|
|||
input = data;
|
||||
if (!input) return;
|
||||
|
||||
input->timestamp = timestamp;
|
||||
|
||||
_ecore_wl2_input_mouse_wheel_send(input, axis, wl_fixed_to_int(value),
|
||||
timestamp);
|
||||
}
|
||||
|
@ -1056,6 +1059,7 @@ _keyboard_cb_key(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned
|
|||
if (!window) return;
|
||||
|
||||
input->display->serial = serial;
|
||||
input->timestamp = timestamp;
|
||||
|
||||
/* xkb rules reflect X broken keycodes, so offset by 8 */
|
||||
code = keycode + 8;
|
||||
|
@ -1205,6 +1209,7 @@ _touch_cb_down(void *data, struct wl_touch *touch EINA_UNUSED, unsigned int seri
|
|||
if (!window) return;
|
||||
|
||||
input->focus.touch = window;
|
||||
input->timestamp = timestamp;
|
||||
|
||||
_pointer_cb_enter(data, NULL, serial, surface, x, y);
|
||||
|
||||
|
|
|
@ -77,7 +77,11 @@ edje_object_message_signal_recursive_process(Edje_Object *obj)
|
|||
EAPI void
|
||||
edje_object_signal_callback_add(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func, void *data)
|
||||
{
|
||||
efl_layout_signal_callback_add(obj, emission, source, (Efl_Signal_Cb) func, data);
|
||||
Edje *ed;
|
||||
|
||||
ed = _edje_fetch(obj);
|
||||
if (!ed || ed->delete_me) return;
|
||||
_edje_object_signal_callback_add(ed, emission, source, func, NULL, NULL, data);
|
||||
}
|
||||
|
||||
EAPI void *
|
||||
|
@ -95,7 +99,8 @@ edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, con
|
|||
emission = eina_stringshare_add(emission);
|
||||
source = eina_stringshare_add(source);
|
||||
|
||||
ok = _edje_signal_callback_disable(gp, emission, source, func, data);
|
||||
// We can cast here as the function won't be used and is just going to be used for comparison
|
||||
ok = _edje_signal_callback_disable(gp, emission, source, func, NULL, NULL, data);
|
||||
|
||||
// Legacy only
|
||||
if (!ok && !data)
|
||||
|
@ -104,7 +109,8 @@ edje_object_signal_callback_del_full(Evas_Object *obj, const char *emission, con
|
|||
{
|
||||
if (emission == gp->matches->matches[i].signal &&
|
||||
source == gp->matches->matches[i].source &&
|
||||
func == gp->matches->matches[i].func &&
|
||||
func == gp->matches->matches[i].legacy &&
|
||||
gp->flags[i].legacy &&
|
||||
!gp->flags[i].delete_me)
|
||||
{
|
||||
gp->flags[i].delete_me = EINA_TRUE;
|
||||
|
|
|
@ -553,7 +553,10 @@ edje_match_callback_exec_check_finals(const Edje_Signals_Sources_Patterns *ssp,
|
|||
|
||||
if (ed->callbacks->flags[idx].delete_me) continue;
|
||||
|
||||
cb->func((void *)ed->callbacks->custom_data[idx], ed->obj, sig, source);
|
||||
if (ed->callbacks->flags[idx].legacy)
|
||||
cb->legacy((void *)ed->callbacks->custom_data[idx], ed->obj, sig, source);
|
||||
else
|
||||
cb->eo((void *)ed->callbacks->custom_data[idx], ed->obj, sig, source);
|
||||
if (_edje_block_break(ed))
|
||||
{
|
||||
r = 0;
|
||||
|
|
|
@ -71,7 +71,7 @@ EDJE_PART_INVALID_VOID(efl_text_cursor_line_jump_by, _efl_canvas_layout_part_inv
|
|||
EDJE_PART_INVALID_VOID(efl_text_cursor_copy, _efl_canvas_layout_part_invalid_efl_text_cursor_cursor_copy, Efl_Text_Cursor_Cursor *dst, const Efl_Text_Cursor_Cursor *src)
|
||||
EDJE_PART_INVALID_CONST(Eina_Unicode, 0, efl_text_cursor_content_get, _efl_canvas_layout_part_invalid_efl_text_cursor_cursor_content_get, const Efl_Text_Cursor_Cursor *cur)
|
||||
EDJE_PART_INVALID_CONST(Eina_Bool, 0, efl_text_cursor_geometry_get, _efl_canvas_layout_part_invalid_efl_text_cursor_cursor_geometry_get, const Efl_Text_Cursor_Cursor *cur, Efl_Text_Cursor_Type ctype, int *cx, int *cy, int *cw, int *ch, int *cx2, int *cy2, int *cw2, int *ch2)
|
||||
EDJE_PART_INVALID_VOID(efl_text_markup_cursor_markup_insert, _efl_canvas_layout_part_invalid_efl_text_markup_cursor_markup_insert, Efl_Text_Cursor_Cursor *cur, const char *markup)
|
||||
EDJE_PART_INVALID_VOID(efl_text_markup_interactive_cursor_markup_insert, _efl_canvas_layout_part_invalid_efl_text_markup_interactive_cursor_markup_insert, Efl_Text_Cursor_Cursor *cur, const char *markup)
|
||||
EDJE_PART_INVALID(Eina_Iterator *, 0, efl_content_iterate, _efl_canvas_layout_part_invalid_efl_container_content_iterate)
|
||||
EDJE_PART_INVALID(int, 0, efl_content_count, _efl_canvas_layout_part_invalid_efl_container_content_count)
|
||||
EDJE_PART_INVALID(Eina_Bool, 0, efl_content_remove, _efl_canvas_layout_part_invalid_efl_container_content_remove, Efl_Gfx_Entity *content)
|
||||
|
|
|
@ -187,7 +187,7 @@ _efl_canvas_layout_part_text_efl_text_cursor_cursor_geometry_get(const Eo *obj,
|
|||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_canvas_layout_part_text_efl_text_markup_cursor_markup_insert(Eo *obj,
|
||||
_efl_canvas_layout_part_text_efl_text_markup_interactive_cursor_markup_insert(Eo *obj,
|
||||
void *_pd EINA_UNUSED, Efl_Text_Cursor_Cursor *cur EINA_UNUSED,
|
||||
const char *text)
|
||||
{
|
||||
|
|
|
@ -1056,12 +1056,16 @@ struct _Edje_Signal_Callback_Match
|
|||
{
|
||||
const char *signal;
|
||||
const char *source;
|
||||
Edje_Signal_Cb func;
|
||||
union {
|
||||
Edje_Signal_Cb legacy;
|
||||
EflLayoutSignalCb eo;
|
||||
};
|
||||
};
|
||||
|
||||
struct _Edje_Signal_Callback_Matches
|
||||
{
|
||||
Edje_Signal_Callback_Match *matches;
|
||||
Eina_Free_Cb *free_cb;
|
||||
|
||||
Edje_Signals_Sources_Patterns *patterns;
|
||||
|
||||
|
@ -1073,6 +1077,7 @@ struct _Edje_Signal_Callback_Matches
|
|||
|
||||
struct _Edje_Signal_Callback_Flags
|
||||
{
|
||||
Eina_Bool legacy:1;
|
||||
Eina_Bool delete_me:1;
|
||||
Eina_Bool just_added:1;
|
||||
Eina_Bool propagate:1;
|
||||
|
@ -2449,7 +2454,9 @@ const Eina_Inarray *edje_match_signal_source_hash_get(const char *signal,
|
|||
const char *source,
|
||||
const Eina_Rbtree *tree);
|
||||
void edje_match_signal_source_free(Edje_Signal_Source_Char *key, void *data);
|
||||
void _edje_signal_callback_matches_unref(Edje_Signal_Callback_Matches *m);
|
||||
Eina_Bool _edje_object_signal_callback_add(Edje *ed, const char *emission, const char *source,
|
||||
Edje_Signal_Cb func_legacy,
|
||||
Efl_Signal_Cb func_eo, Eina_Free_Cb func_free_cb, void *data);
|
||||
|
||||
// FIXME remove below 3 eapi decls when edje_convert goes
|
||||
EAPI void _edje_edd_init(void);
|
||||
|
@ -2572,14 +2579,19 @@ void _edje_callbacks_del(Evas_Object *obj, Edje *ed);
|
|||
void _edje_callbacks_focus_del(Evas_Object *obj, Edje *ed);
|
||||
|
||||
const Edje_Signal_Callback_Group *_edje_signal_callback_alloc(void);
|
||||
void _edje_signal_callback_matches_unref(Edje_Signal_Callback_Matches *m, Edje_Signal_Callback_Flags *flags, void **custom_data);
|
||||
void _edje_signal_callback_free(const Edje_Signal_Callback_Group *cgp);
|
||||
Eina_Bool _edje_signal_callback_push(Edje_Signal_Callback_Group *cgp,
|
||||
const char *signal, const char *source,
|
||||
Edje_Signal_Cb func, void *data,
|
||||
Edje_Signal_Cb func_legacy,
|
||||
Efl_Signal_Cb func_eo,
|
||||
Eina_Free_Cb func_free_cb,
|
||||
void *data,
|
||||
Eina_Bool propagate);
|
||||
Eina_Bool _edje_signal_callback_disable(Edje_Signal_Callback_Group *cgp,
|
||||
const char *signal, const char *source,
|
||||
Edje_Signal_Cb func, void *data);
|
||||
Edje_Signal_Cb func_legacy,
|
||||
EflLayoutSignalCb func, Eina_Free_Cb func_free_cb, void *data);
|
||||
|
||||
EAPI void _edje_edd_init(void);
|
||||
EAPI void _edje_edd_shutdown(void);
|
||||
|
|
|
@ -236,8 +236,10 @@ edje_transition_duration_factor_set(double scale)
|
|||
_edje_transition_duration_scale = FROM_DOUBLE(scale);
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
_edje_object_signal_callback_add(Edje *ed, const char *emission, const char *source, Efl_Signal_Cb func, void *data)
|
||||
Eina_Bool
|
||||
_edje_object_signal_callback_add(Edje *ed, const char *emission, const char *source,
|
||||
Edje_Signal_Cb func_legacy,
|
||||
Efl_Signal_Cb func_eo, Eina_Free_Cb func_free_cb, void *data)
|
||||
{
|
||||
Edje_Signal_Callback_Group *gp;
|
||||
const char *sig;
|
||||
|
@ -252,7 +254,7 @@ _edje_object_signal_callback_add(Edje *ed, const char *emission, const char *sou
|
|||
src = eina_stringshare_add(source);
|
||||
|
||||
gp = (Edje_Signal_Callback_Group *) ed->callbacks;
|
||||
ok = _edje_signal_callback_push(gp, sig, src, func, data, EINA_TRUE);
|
||||
ok = _edje_signal_callback_push(gp, sig, src, func_legacy, func_eo, func_free_cb, data, EINA_TRUE);
|
||||
|
||||
eina_stringshare_del(sig);
|
||||
eina_stringshare_del(src);
|
||||
|
@ -267,17 +269,17 @@ edje_object_propagate_callback_add(Evas_Object *obj, Efl_Signal_Cb func, void *d
|
|||
|
||||
ed = _edje_fetch(obj);
|
||||
if (!ed || ed->delete_me) return;
|
||||
_edje_object_signal_callback_add(ed, "*", "*", func, data);
|
||||
_edje_object_signal_callback_add(ed, "*", "*", func, NULL, NULL, data);
|
||||
}
|
||||
|
||||
EOLIAN Eina_Bool
|
||||
_efl_canvas_layout_efl_layout_signal_signal_callback_add(Eo *obj EINA_UNUSED, Edje *ed, const char *emission, const char *source, Efl_Signal_Cb func, void *data)
|
||||
Eina_Bool
|
||||
_efl_canvas_layout_efl_layout_signal_signal_callback_add(Eo *obj EINA_UNUSED, Edje *ed, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb)
|
||||
{
|
||||
return _edje_object_signal_callback_add(ed, emission, source, func, data);
|
||||
return _edje_object_signal_callback_add(ed, emission, source, NULL, func, func_free_cb, func_data);
|
||||
}
|
||||
|
||||
EOLIAN Eina_Bool
|
||||
_efl_canvas_layout_efl_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Edje *ed, const char *emission, const char *source, Efl_Signal_Cb func, void *data)
|
||||
Eina_Bool
|
||||
_efl_canvas_layout_efl_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Edje *ed, const char *emission, const char *source, void *func_data, EflLayoutSignalCb func, Eina_Free_Cb func_free_cb)
|
||||
{
|
||||
Edje_Signal_Callback_Group *gp;
|
||||
Eina_Bool ok;
|
||||
|
@ -291,7 +293,7 @@ _efl_canvas_layout_efl_layout_signal_signal_callback_del(Eo *obj EINA_UNUSED, Ed
|
|||
emission = eina_stringshare_add(emission);
|
||||
source = eina_stringshare_add(source);
|
||||
|
||||
ok = _edje_signal_callback_disable(gp, emission, source, func, data);
|
||||
ok = _edje_signal_callback_disable(gp, emission, source, NULL, func, func_free_cb, func_data);
|
||||
|
||||
eina_stringshare_del(emission);
|
||||
eina_stringshare_del(source);
|
||||
|
@ -1741,13 +1743,16 @@ _edje_emit_cb(Edje *ed, const char *sig, const char *src, Edje_Message_Signal_Da
|
|||
|
||||
cb = &m->matches[*i];
|
||||
|
||||
cb->func((void *)ed->callbacks->custom_data[*i], ed->obj, sig, src);
|
||||
if (ed->callbacks->flags[*i].legacy)
|
||||
cb->legacy((void *)ed->callbacks->custom_data[*i], ed->obj, sig, src);
|
||||
else
|
||||
cb->eo((void *)ed->callbacks->custom_data[*i], ed->obj, sig, src);
|
||||
if (_edje_block_break(ed)) break;
|
||||
}
|
||||
}
|
||||
|
||||
break_prog:
|
||||
_edje_signal_callback_matches_unref(m);
|
||||
_edje_signal_callback_matches_unref(m, ed->callbacks->flags, ed->callbacks->custom_data);
|
||||
|
||||
_edje_signal_callback_patterns_unref(ssp);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,13 @@ _edje_signal_match_key_cmp(const void *key1, int key1_length EINA_UNUSED, const
|
|||
{
|
||||
if (a->matches[i].signal != b->matches[i].signal) return a->matches[i].signal - b->matches[i].signal;
|
||||
if (a->matches[i].source != b->matches[i].source) return a->matches[i].source - b->matches[i].source;
|
||||
if (a->matches[i].func != b->matches[i].func) return (unsigned char *)a->matches[i].func - (unsigned char *)b->matches[i].func;
|
||||
// Callback be it legacy or eo, have the same pointer size and so can be just compared like that
|
||||
if (a->matches[i].legacy != b->matches[i].legacy) return (unsigned char *)a->matches[i].legacy - (unsigned char *)b->matches[i].legacy;
|
||||
if (a->free_cb && b->free_cb &&
|
||||
a->free_cb[i] != b->free_cb[i]) return (unsigned char *)a->free_cb[i] - (unsigned char *)b->free_cb[i];
|
||||
if ((!a->free_cb && b->free_cb) ||
|
||||
(a->free_cb && !b->free_cb))
|
||||
return a->free_cb - b->free_cb;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -39,11 +45,16 @@ _edje_signal_match_key_hash(const void *key, int key_length EINA_UNUSED)
|
|||
#ifdef EFL64
|
||||
hash ^= eina_hash_int64((const unsigned long long int *)&a->matches[i].signal, sizeof (char *));
|
||||
hash ^= eina_hash_int64((const unsigned long long int *)&a->matches[i].source, sizeof (char *));
|
||||
hash ^= eina_hash_int64((const unsigned long long int *)&a->matches[i].func, sizeof (Edje_Signal_Cb));
|
||||
hash ^= eina_hash_int64((const unsigned long long int *)&a->matches[i].legacy, sizeof (Edje_Signal_Cb));
|
||||
if (a->free_cb)
|
||||
hash ^= eina_hash_int64((const unsigned long long int *)&a->free_cb[i], sizeof (Eina_Free_Cb));
|
||||
#else
|
||||
hash ^= eina_hash_int32((const unsigned int *)&a->matches[i].signal, sizeof (char *));
|
||||
hash ^= eina_hash_int32((const unsigned int *)&a->matches[i].source, sizeof (char *));
|
||||
hash ^= eina_hash_int32((const unsigned int *)&a->matches[i].func, sizeof (Edje_Signal_Cb));
|
||||
// Callback be it legacy or eo, have the same pointer size and so using legacy for hash is enough
|
||||
hash ^= eina_hash_int32((const unsigned int *)&a->matches[i].legacy, sizeof (Edje_Signal_Cb));
|
||||
if (a->free_cb)
|
||||
hash ^= eina_hash_int32((const unsigned int *)&a->free_cb[i], sizeof (Eina_Free_Cb));
|
||||
#endif
|
||||
}
|
||||
return hash;
|
||||
|
@ -64,11 +75,17 @@ _edje_signal_callback_matches_dup(const Edje_Signal_Callback_Matches *src)
|
|||
result->patterns = NULL;
|
||||
EINA_REFCOUNT_REF(result);
|
||||
|
||||
if (src->free_cb)
|
||||
{
|
||||
result->free_cb = malloc(sizeof (Eina_Free_Cb) * src->matches_count);
|
||||
if (result->free_cb) memcpy(result->free_cb, src->free_cb, sizeof (Eina_Free_Cb) * src->matches_count);
|
||||
}
|
||||
|
||||
for (i = 0; i < src->matches_count; i++)
|
||||
{
|
||||
result->matches[i].signal = eina_stringshare_ref(src->matches[i].signal);
|
||||
result->matches[i].source = eina_stringshare_ref(src->matches[i].source);
|
||||
result->matches[i].func = src->matches[i].func;
|
||||
result->matches[i].legacy = src->matches[i].legacy;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -141,14 +158,23 @@ _edje_signal_callback_unset(Edje_Signal_Callback_Group *gp, int idx)
|
|||
static void
|
||||
_edje_signal_callback_set(Edje_Signal_Callback_Group *gp, int idx,
|
||||
const char *sig, const char *src,
|
||||
Edje_Signal_Cb func, void *data, Edje_Signal_Callback_Flags flags)
|
||||
Edje_Signal_Cb func_legacy,
|
||||
Efl_Signal_Cb func_eo, Eina_Free_Cb func_free_cb,
|
||||
void *data, Edje_Signal_Callback_Flags flags)
|
||||
{
|
||||
Edje_Signal_Callback_Match *m;
|
||||
|
||||
m = gp->matches->matches + idx;
|
||||
m->signal = eina_stringshare_ref(sig);
|
||||
m->source = eina_stringshare_ref(src);
|
||||
m->func = func;
|
||||
if (func_legacy) m->legacy = func_legacy;
|
||||
else m->eo = func_eo;
|
||||
if (func_free_cb)
|
||||
{
|
||||
if (!gp->matches->free_cb)
|
||||
((Edje_Signal_Callback_Matches *) gp->matches)->free_cb = calloc(sizeof (Eina_Free_Cb), gp->matches->matches_count);
|
||||
gp->matches->free_cb[idx] = func_free_cb;
|
||||
}
|
||||
|
||||
gp->custom_data[idx] = data;
|
||||
|
||||
|
@ -163,6 +189,11 @@ _edje_signal_callback_grow(Edje_Signal_Callback_Group *gp)
|
|||
tmp = (Edje_Signal_Callback_Matches *)gp->matches;
|
||||
tmp->matches_count++;
|
||||
tmp->matches = realloc(tmp->matches, sizeof (Edje_Signal_Callback_Match) * tmp->matches_count);
|
||||
if (tmp->free_cb)
|
||||
{
|
||||
tmp->free_cb = realloc(tmp->free_cb, sizeof (Eina_Free_Cb) * tmp->matches_count);
|
||||
tmp->free_cb[tmp->matches_count - 1] = NULL;
|
||||
}
|
||||
gp->custom_data = realloc(gp->custom_data, sizeof (void *) * tmp->matches_count);
|
||||
gp->flags = realloc(gp->flags, sizeof (Edje_Signal_Callback_Flags) * tmp->matches_count);
|
||||
|
||||
|
@ -172,7 +203,9 @@ _edje_signal_callback_grow(Edje_Signal_Callback_Group *gp)
|
|||
Eina_Bool
|
||||
_edje_signal_callback_push(Edje_Signal_Callback_Group *gp,
|
||||
const char *sig, const char *src,
|
||||
Edje_Signal_Cb func, void *data, Eina_Bool propagate)
|
||||
Edje_Signal_Cb func_legacy,
|
||||
Efl_Signal_Cb func_eo, Eina_Free_Cb func_free_cb,
|
||||
void *data, Eina_Bool propagate)
|
||||
{
|
||||
unsigned int i;
|
||||
Edje_Signal_Callback_Flags flags;
|
||||
|
@ -181,23 +214,11 @@ _edje_signal_callback_push(Edje_Signal_Callback_Group *gp,
|
|||
flags.delete_me = EINA_FALSE;
|
||||
flags.just_added = EINA_TRUE;
|
||||
flags.propagate = !!propagate;
|
||||
flags.legacy = !!func_legacy;
|
||||
|
||||
// FIXME: properly handle legacy and non legacy case, including free function
|
||||
tmp = (Edje_Signal_Callback_Matches *)gp->matches;
|
||||
|
||||
// let's first try to see if we do find an empty matching stop
|
||||
for (i = 0; i < tmp->matches_count; i++)
|
||||
{
|
||||
if ((sig == tmp->matches[i].signal) &&
|
||||
(src == tmp->matches[i].source) &&
|
||||
(func == tmp->matches[i].func) &&
|
||||
(gp->flags[i].delete_me))
|
||||
{
|
||||
_edje_signal_callback_unset(gp, i);
|
||||
_edje_signal_callback_set(gp, i, sig, src, func, data, flags);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (tmp->hashed)
|
||||
{
|
||||
if (EINA_REFCOUNT_GET(tmp) == 1)
|
||||
|
@ -224,7 +245,7 @@ _edje_signal_callback_push(Edje_Signal_Callback_Group *gp,
|
|||
if (gp->flags[i].delete_me)
|
||||
{
|
||||
_edje_signal_callback_unset(gp, i);
|
||||
_edje_signal_callback_set(gp, i, sig, src, func, data, flags);
|
||||
_edje_signal_callback_set(gp, i, sig, src, func_legacy, func_eo, func_free_cb, data, flags);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +253,7 @@ _edje_signal_callback_push(Edje_Signal_Callback_Group *gp,
|
|||
_edje_signal_callback_grow(gp);
|
||||
// Set propagate and just_added flags
|
||||
_edje_signal_callback_set(gp, tmp->matches_count - 1,
|
||||
sig, src, func, data, flags);
|
||||
sig, src, func_legacy, func_eo, func_free_cb, data, flags);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -260,12 +281,24 @@ _edje_signal_callback_alloc(void)
|
|||
}
|
||||
|
||||
void
|
||||
_edje_signal_callback_matches_unref(Edje_Signal_Callback_Matches *m)
|
||||
_edje_signal_callback_matches_unref(Edje_Signal_Callback_Matches *m, Edje_Signal_Callback_Flags *flags, void **custom_data)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (m->free_cb)
|
||||
{
|
||||
for (i = 0; i < m->matches_count; ++i)
|
||||
{
|
||||
if (!flags[i].delete_me &&
|
||||
m->free_cb[i])
|
||||
{
|
||||
m->free_cb[i](custom_data[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EINA_REFCOUNT_UNREF(m)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
_edje_signal_callback_patterns_unref(m->patterns);
|
||||
|
||||
if (m->hashed)
|
||||
|
@ -292,7 +325,7 @@ _edje_signal_callback_free(const Edje_Signal_Callback_Group *cgp)
|
|||
|
||||
if (!gp) return;
|
||||
|
||||
_edje_signal_callback_matches_unref((Edje_Signal_Callback_Matches *)gp->matches);
|
||||
_edje_signal_callback_matches_unref((Edje_Signal_Callback_Matches *)gp->matches, gp->flags, gp->custom_data);
|
||||
gp->matches = NULL;
|
||||
free(gp->flags);
|
||||
gp->flags = NULL;
|
||||
|
@ -304,7 +337,8 @@ _edje_signal_callback_free(const Edje_Signal_Callback_Group *cgp)
|
|||
Eina_Bool
|
||||
_edje_signal_callback_disable(Edje_Signal_Callback_Group *gp,
|
||||
const char *sig, const char *src,
|
||||
Edje_Signal_Cb func, void *data)
|
||||
Edje_Signal_Cb func_legacy,
|
||||
EflLayoutSignalCb func, Eina_Free_Cb func_free_cb, void *data)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
|
@ -314,10 +348,17 @@ _edje_signal_callback_disable(Edje_Signal_Callback_Group *gp,
|
|||
{
|
||||
if (sig == gp->matches->matches[i].signal &&
|
||||
src == gp->matches->matches[i].source &&
|
||||
func == gp->matches->matches[i].func &&
|
||||
gp->custom_data[i] == data &&
|
||||
!gp->flags[i].delete_me)
|
||||
!gp->flags[i].delete_me &&
|
||||
((func == gp->matches->matches[i].eo &&
|
||||
(!gp->matches->free_cb || func_free_cb == gp->matches->free_cb[i]) &&
|
||||
gp->custom_data[i] == data &&
|
||||
!gp->flags[i].legacy) ||
|
||||
(func_legacy == gp->matches->matches[i].legacy &&
|
||||
gp->custom_data[i] == data &&
|
||||
gp->flags[i].legacy))
|
||||
)
|
||||
{
|
||||
if (func && func_free_cb) func_free_cb(data);
|
||||
gp->flags[i].delete_me = EINA_TRUE;
|
||||
//return gp->custom_data[i];
|
||||
return EINA_TRUE;
|
||||
|
@ -341,9 +382,7 @@ _edje_signal_callback_move_last(Edje_Signal_Callback_Group *gp,
|
|||
if (!gp->flags[j].delete_me)
|
||||
{
|
||||
_edje_signal_callback_unset(gp, i);
|
||||
m->matches[i].signal = m->matches[j].signal;
|
||||
m->matches[i].source = m->matches[j].source;
|
||||
m->matches[i].func = m->matches[j].func;
|
||||
memcpy(&m->matches[i], &m->matches[j], sizeof (Edje_Signal_Callback_Match));
|
||||
gp->flags[i] = gp->flags[j];
|
||||
gp->custom_data[i] = gp->custom_data[j];
|
||||
return;
|
||||
|
@ -394,7 +433,7 @@ _edje_signal_callback_patterns_ref(const Edje_Signal_Callback_Group *gp)
|
|||
}
|
||||
else
|
||||
{
|
||||
_edje_signal_callback_matches_unref((Edje_Signal_Callback_Matches *)gp->matches);
|
||||
_edje_signal_callback_matches_unref((Edje_Signal_Callback_Matches *)gp->matches, gp->flags, gp->custom_data);
|
||||
((Edje_Signal_Callback_Group *)gp)->matches = m;
|
||||
tmp = (Edje_Signal_Callback_Matches *)gp->matches;
|
||||
EINA_REFCOUNT_REF(tmp);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Efl.Canvas.Layout_Part_Invalid extends Efl.Canvas.Layout_Part implements Efl.Content,
|
||||
Efl.Pack_Linear, Efl.Ui.Direction_Readonly,
|
||||
Efl.Pack_Table, Efl.Text,
|
||||
Efl.Text_Markup
|
||||
Efl.Text_Markup, Efl.Text_Markup_Interactive
|
||||
{
|
||||
[[Common class for part proxy objects for @Efl.Canvas.Layout.
|
||||
|
||||
|
@ -31,6 +31,7 @@ class Efl.Canvas.Layout_Part_Invalid extends Efl.Canvas.Layout_Part implements E
|
|||
// Efl.Canvas.Layout_Part_Text
|
||||
Efl.Text.text { set; get; }
|
||||
Efl.Text_Markup.markup { get; set; }
|
||||
Efl.Text_Markup_Interactive.cursor_markup_insert;
|
||||
Efl.Text_Cursor.text_cursor { get; }
|
||||
Efl.Text_Cursor.cursor_paragraph_first;
|
||||
Efl.Text_Cursor.cursor_paragraph_last;
|
||||
|
@ -44,7 +45,6 @@ class Efl.Canvas.Layout_Part_Invalid extends Efl.Canvas.Layout_Part implements E
|
|||
Efl.Text_Cursor.cursor_copy;
|
||||
Efl.Text_Cursor.cursor_content { get; }
|
||||
Efl.Text_Cursor.cursor_geometry { get; }
|
||||
Efl.Text_Markup.cursor_markup_insert;
|
||||
// Efl.Canvas.Layout_Part_Box
|
||||
Efl.Container.content_iterate;
|
||||
Efl.Container.content_count;
|
||||
|
|
|
@ -11,7 +11,7 @@ enum Efl.Canvas.Layout_Part_Text_Expand
|
|||
}
|
||||
|
||||
class Efl.Canvas.Layout_Part_Text extends Efl.Canvas.Layout_Part implements Efl.Text,
|
||||
Efl.Text_Markup, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style
|
||||
Efl.Text_Markup, Efl.Text_Markup_Interactive, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style
|
||||
{
|
||||
[[Represents a TEXT part of a layout
|
||||
|
||||
|
@ -36,6 +36,7 @@ Efl.Text_Markup, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style
|
|||
implements {
|
||||
Efl.Text.text { set; get; }
|
||||
Efl.Text_Markup.markup { get; set; }
|
||||
Efl.Text_Markup_Interactive.cursor_markup_insert;
|
||||
Efl.Text_Cursor.text_cursor { get; }
|
||||
Efl.Text_Cursor.cursor_paragraph_first;
|
||||
Efl.Text_Cursor.cursor_paragraph_last;
|
||||
|
@ -49,7 +50,6 @@ Efl.Text_Markup, Efl.Text_Format, Efl.Text_Font, Efl.Text_Style
|
|||
Efl.Text_Cursor.cursor_copy;
|
||||
Efl.Text_Cursor.cursor_content { get; }
|
||||
Efl.Text_Cursor.cursor_geometry { get; }
|
||||
Efl.Text_Markup.cursor_markup_insert;
|
||||
Efl.Text_Format.ellipsis { set; get; }
|
||||
Efl.Text_Format.wrap { set; get; }
|
||||
Efl.Text_Font.font { set; get; }
|
||||
|
|
|
@ -8,7 +8,14 @@
|
|||
match that.
|
||||
*/
|
||||
|
||||
type Efl.Signal_Cb: __undefined_type; [[Signal callback.]]
|
||||
function EflLayoutSignalCb {
|
||||
[[EflLayoutSignalCb function that is called when a specifc pair of signal/emision is triggered]]
|
||||
params {
|
||||
@in object: Efl.Layout.Signal; [[The object the callback is being triggered from.]]
|
||||
@in emission: string; [[The name component of the signal.]]
|
||||
@in source: string; [[The source of a signal used as context.]]
|
||||
}
|
||||
};
|
||||
|
||||
interface Efl.Layout.Signal
|
||||
{
|
||||
|
@ -83,9 +90,8 @@ interface Efl.Layout.Signal
|
|||
params {
|
||||
@in emission: string; [[The signal's "emission" string]]
|
||||
@in source: string; [[The signal's "source" string]]
|
||||
@in func: Efl.Signal_Cb;
|
||||
@in func: EflLayoutSignalCb;
|
||||
[[The callback function to be executed when the signal is emitted.]]
|
||||
@in data: void_ptr; [[A pointer to data to pass to $func.]]
|
||||
}
|
||||
return: bool; [[$true in case of success, $false in case of error.]]
|
||||
}
|
||||
|
@ -102,9 +108,8 @@ interface Efl.Layout.Signal
|
|||
params {
|
||||
@in emission: string; [[The signal's "emission" string]]
|
||||
@in source: string; [[The signal's "source" string]]
|
||||
@in func: Efl.Signal_Cb;
|
||||
@in func: EflLayoutSignalCb;
|
||||
[[The callback function to be executed when the signal is emitted.]]
|
||||
@in data: void_ptr; [[A pointer to data to pass to $func.]]
|
||||
}
|
||||
return: bool; [[$true in case of success, $false in case of error.]]
|
||||
}
|
||||
|
|
|
@ -8,10 +8,6 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SIGNATURE
|
||||
# include <sys/mman.h>
|
||||
# ifdef HAVE_GNUTLS
|
||||
|
@ -601,9 +597,9 @@ eet_identity_sign(FILE *fp,
|
|||
|
||||
# endif /* ifdef HAVE_GNUTLS */
|
||||
/* Append the signature at the end of the file. */
|
||||
head[0] = (int)htonl ((unsigned int)EET_MAGIC_SIGN);
|
||||
head[1] = (int)htonl ((unsigned int)sign_len);
|
||||
head[2] = (int)htonl ((unsigned int)cert_len);
|
||||
head[0] = (int)eina_htonl ((unsigned int)EET_MAGIC_SIGN);
|
||||
head[1] = (int)eina_htonl ((unsigned int)sign_len);
|
||||
head[2] = (int)eina_htonl ((unsigned int)cert_len);
|
||||
|
||||
if (fwrite(head, sizeof(head), 1, fp) != 1)
|
||||
{
|
||||
|
@ -675,9 +671,9 @@ eet_identity_check(const void *data_base,
|
|||
memcpy(&sign_len, header+1, sizeof(int));
|
||||
memcpy(&cert_len, header+2, sizeof(int));
|
||||
|
||||
magic = ntohl(magic);
|
||||
sign_len = ntohl(sign_len);
|
||||
cert_len = ntohl(cert_len);
|
||||
magic = eina_ntohl(magic);
|
||||
sign_len = eina_ntohl(sign_len);
|
||||
cert_len = eina_ntohl(cert_len);
|
||||
|
||||
/* Verify the header */
|
||||
if (magic != EET_MAGIC_SIGN)
|
||||
|
|
|
@ -5,14 +5,6 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#include "Eet.h"
|
||||
|
@ -71,9 +63,9 @@ eet_connection_received(Eet_Connection *conn,
|
|||
|
||||
msg = data;
|
||||
/* Check the magic */
|
||||
if (ntohl(msg[0]) != MAGIC_EET_DATA_PACKET) break;
|
||||
if (eina_ntohl(msg[0]) != MAGIC_EET_DATA_PACKET) break;
|
||||
|
||||
packet_size = ntohl(msg[1]);
|
||||
packet_size = eina_ntohl(msg[1]);
|
||||
/* Message should always be under MAX_MSG_SIZE */
|
||||
if (packet_size > MAX_MSG_SIZE) break;
|
||||
|
||||
|
@ -143,8 +135,8 @@ _eet_connection_raw_send(Eet_Connection *conn,
|
|||
/* Message should always be under MAX_MSG_SIZE */
|
||||
if (data_size > MAX_MSG_SIZE) return EINA_FALSE;
|
||||
message = malloc(data_size + (sizeof(int) * 2));
|
||||
message[0] = htonl(MAGIC_EET_DATA_PACKET);
|
||||
message[1] = htonl(data_size);
|
||||
message[0] = eina_htonl(MAGIC_EET_DATA_PACKET);
|
||||
message[1] = eina_htonl(data_size);
|
||||
memcpy(message + 2, data, data_size);
|
||||
conn->eet_write_cb(message,
|
||||
data_size + (sizeof(int) * 2),
|
||||
|
|
|
@ -8,14 +8,6 @@
|
|||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <Eina.h>
|
||||
|
||||
#include "Eet.h"
|
||||
|
@ -2877,7 +2869,7 @@ _eet_data_dump_encode(int parent_type,
|
|||
{
|
||||
unsigned long int v;
|
||||
|
||||
v = htonl(0x12345678);
|
||||
v = eina_htonl(0x12345678);
|
||||
if (v == 0x12345678)
|
||||
_eet_data_words_bigendian = 1;
|
||||
else
|
||||
|
@ -3483,7 +3475,7 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
|
|||
{
|
||||
unsigned long int v;
|
||||
|
||||
v = htonl(0x12345678);
|
||||
v = eina_htonl(0x12345678);
|
||||
if (v == 0x12345678)
|
||||
_eet_data_words_bigendian = 1;
|
||||
else
|
||||
|
@ -5088,7 +5080,7 @@ _eet_data_descriptor_encode(Eet_Dictionary *ed,
|
|||
{
|
||||
unsigned long int v;
|
||||
|
||||
v = htonl(0x12345678);
|
||||
v = eina_htonl(0x12345678);
|
||||
if (v == 0x12345678)
|
||||
_eet_data_words_bigendian = 1;
|
||||
else
|
||||
|
|
|
@ -6,16 +6,6 @@
|
|||
# include <sys/types.h>
|
||||
#endif /* ifdef __OpenBSD__ */
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
# define HAVE_BOOLEAN
|
||||
# define XMD_H /* This prevents libjpeg to redefine INT32 */
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
|
@ -254,7 +244,7 @@ _eet_image_endian_check(void)
|
|||
{
|
||||
unsigned long int v;
|
||||
|
||||
v = htonl(0x12345678);
|
||||
v = eina_htonl(0x12345678);
|
||||
if (v == 0x12345678)
|
||||
_eet_image_words_bigendian = 1;
|
||||
else
|
||||
|
@ -811,8 +801,8 @@ eet_data_image_etc1_compressed_convert(int *size,
|
|||
|
||||
image_stride = w;
|
||||
image_height = h;
|
||||
nl_width = htonl(image_stride);
|
||||
nl_height = htonl(image_height);
|
||||
nl_width = eina_htonl(image_stride);
|
||||
nl_height = eina_htonl(image_height);
|
||||
compress = !!compress;
|
||||
|
||||
// Disable dithering, as it will deteriorate the quality of flat surfaces
|
||||
|
@ -1792,8 +1782,8 @@ eet_data_image_header_advance_decode_cipher(const void *data,
|
|||
const char *m = data;
|
||||
|
||||
// We only use Emile for decoding the actual data, seems simpler this way.
|
||||
if (w) *w = ntohl(*((unsigned int*) &(m[OFFSET_WIDTH])));
|
||||
if (h) *h = ntohl(*((unsigned int*) &(m[OFFSET_HEIGHT])));
|
||||
if (w) *w = eina_ntohl(*((unsigned int*) &(m[OFFSET_WIDTH])));
|
||||
if (h) *h = eina_ntohl(*((unsigned int*) &(m[OFFSET_HEIGHT])));
|
||||
if (comp) *comp = m[OFFSET_OPTIONS] & 0x1;
|
||||
switch (m[OFFSET_ALGORITHM] & 0xFF)
|
||||
{
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
# include <config.h>
|
||||
#endif /* ifdef HAVE_CONFIG_H */
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -16,14 +12,6 @@
|
|||
#include <fnmatch.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <Evil.h>
|
||||
#endif /* ifdef _WIN32 */
|
||||
|
||||
#include <Eina.h>
|
||||
#include <Emile.h>
|
||||
|
||||
|
@ -384,9 +372,9 @@ eet_flush2(Eet_File *ef)
|
|||
num_dictionary_entries;
|
||||
|
||||
/* go thru and write the header */
|
||||
head[0] = (int)htonl((unsigned int)EET_MAGIC_FILE2);
|
||||
head[1] = (int)htonl((unsigned int)num_directory_entries);
|
||||
head[2] = (int)htonl((unsigned int)num_dictionary_entries);
|
||||
head[0] = (int)eina_htonl((unsigned int)EET_MAGIC_FILE2);
|
||||
head[1] = (int)eina_htonl((unsigned int)num_directory_entries);
|
||||
head[2] = (int)eina_htonl((unsigned int)num_dictionary_entries);
|
||||
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
if (fwrite(head, sizeof (head), 1, fp) != 1)
|
||||
|
@ -414,12 +402,12 @@ eet_flush2(Eet_File *ef)
|
|||
|
||||
efn->offset = data_offset;
|
||||
|
||||
ibuf[0] = (int)htonl((unsigned int)data_offset);
|
||||
ibuf[1] = (int)htonl((unsigned int)efn->size);
|
||||
ibuf[2] = (int)htonl((unsigned int)efn->data_size);
|
||||
ibuf[3] = (int)htonl((unsigned int)strings_offset);
|
||||
ibuf[4] = (int)htonl((unsigned int)efn->name_size);
|
||||
ibuf[5] = (int)htonl((unsigned int)flag);
|
||||
ibuf[0] = (int)eina_htonl((unsigned int)data_offset);
|
||||
ibuf[1] = (int)eina_htonl((unsigned int)efn->size);
|
||||
ibuf[2] = (int)eina_htonl((unsigned int)efn->data_size);
|
||||
ibuf[3] = (int)eina_htonl((unsigned int)strings_offset);
|
||||
ibuf[4] = (int)eina_htonl((unsigned int)efn->name_size);
|
||||
ibuf[5] = (int)eina_htonl((unsigned int)flag);
|
||||
|
||||
strings_offset += efn->name_size;
|
||||
data_offset += efn->size;
|
||||
|
@ -449,11 +437,11 @@ eet_flush2(Eet_File *ef)
|
|||
if (ef->ed->hash[ef->ed->all_hash[j]] == j)
|
||||
prev = -1;
|
||||
|
||||
sbuf[0] = (int)htonl((unsigned int)ef->ed->all_hash[j]);
|
||||
sbuf[1] = (int)htonl((unsigned int)offset);
|
||||
sbuf[2] = (int)htonl((unsigned int)ef->ed->all[j].len);
|
||||
sbuf[3] = (int)htonl((unsigned int)prev);
|
||||
sbuf[4] = (int)htonl((unsigned int)ef->ed->all[j].next);
|
||||
sbuf[0] = (int)eina_htonl((unsigned int)ef->ed->all_hash[j]);
|
||||
sbuf[1] = (int)eina_htonl((unsigned int)offset);
|
||||
sbuf[2] = (int)eina_htonl((unsigned int)ef->ed->all[j].len);
|
||||
sbuf[3] = (int)eina_htonl((unsigned int)prev);
|
||||
sbuf[4] = (int)eina_htonl((unsigned int)ef->ed->all[j].next);
|
||||
|
||||
offset += ef->ed->all[j].len;
|
||||
|
||||
|
@ -755,14 +743,14 @@ eet_internal_read2(Eet_File *ef)
|
|||
unsigned int i;
|
||||
|
||||
idx += sizeof(int);
|
||||
if (eet_test_close((int)ntohl(*data) != EET_MAGIC_FILE2, ef))
|
||||
if (eet_test_close((int)eina_ntohl(*data) != EET_MAGIC_FILE2, ef))
|
||||
return NULL;
|
||||
|
||||
data++;
|
||||
|
||||
#define GET_INT(Value, Pointer, Index) \
|
||||
{ \
|
||||
Value = ntohl(*Pointer); \
|
||||
Value = eina_ntohl(*Pointer); \
|
||||
Pointer++; \
|
||||
Index += sizeof(int); \
|
||||
}
|
||||
|
@ -1003,9 +991,9 @@ eet_internal_read2(Eet_File *ef)
|
|||
/* check the signature has the magic number and sig + cert len
|
||||
* + magic is sane */
|
||||
memcpy(head, buffer, 3 * sizeof(int));
|
||||
head[0] = ntohl(head[0]);
|
||||
head[1] = ntohl(head[1]);
|
||||
head[2] = ntohl(head[2]);
|
||||
head[0] = eina_ntohl(head[0]);
|
||||
head[1] = eina_ntohl(head[1]);
|
||||
head[2] = eina_ntohl(head[2]);
|
||||
if ((head[0] == EET_MAGIC_SIGN) && (head[1] > 0) && (head[2] > 0))
|
||||
{
|
||||
/* there appears to be an actual valid identity at the end
|
||||
|
@ -1061,14 +1049,14 @@ eet_internal_read1(Eet_File *ef)
|
|||
/* build header table if read mode */
|
||||
/* geat header */
|
||||
idx += sizeof(int);
|
||||
if (eet_test_close((int)ntohl(*((int *)ef->data)) != EET_MAGIC_FILE, ef))
|
||||
if (eet_test_close((int)eina_ntohl(*((int *)ef->data)) != EET_MAGIC_FILE, ef))
|
||||
return NULL;
|
||||
|
||||
#define EXTRACT_INT(Value, Pointer, Index) \
|
||||
{ \
|
||||
int tmp; \
|
||||
memcpy(&tmp, Pointer + Index, sizeof(int)); \
|
||||
Value = ntohl(tmp); \
|
||||
Value = eina_ntohl(tmp); \
|
||||
Index += sizeof(int); \
|
||||
}
|
||||
|
||||
|
@ -1248,7 +1236,7 @@ eet_internal_read(Eet_File *ef)
|
|||
if (eet_test_close(ef->data_size < (int)sizeof(int) * 3, ef))
|
||||
return NULL;
|
||||
|
||||
switch (ntohl(*data))
|
||||
switch (eina_ntohl(*data))
|
||||
{
|
||||
#if EET_OLD_EET_FILE_FORMAT
|
||||
case EET_MAGIC_FILE:
|
||||
|
|
|
@ -85,6 +85,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
|
|||
#include "interfaces/efl_control.eo.h"
|
||||
#include "interfaces/efl_duplicate.eo.h"
|
||||
#include "interfaces/efl_file.eo.h"
|
||||
#include "interfaces/efl_file_save.eo.h"
|
||||
#include "interfaces/efl_gfx_image.eo.h"
|
||||
#include "interfaces/efl_gfx_frame_controller.eo.h"
|
||||
#include "interfaces/efl_gfx_image_load_controller.eo.h"
|
||||
|
@ -182,6 +183,7 @@ typedef Efl_Gfx_Path_Command_Type Efl_Gfx_Path_Command;
|
|||
#include "interfaces/efl_text_cursor.eo.h"
|
||||
#include "interfaces/efl_text_annotate.eo.h"
|
||||
#include "interfaces/efl_text_markup.eo.h"
|
||||
#include "interfaces/efl_text_markup_interactive.eo.h"
|
||||
#include "interfaces/efl_text_markup_util.eo.h"
|
||||
|
||||
EAPI void efl_observable_tuple_free(Efl_Observable_Tuple *tuple);
|
||||
|
|
|
@ -60,3 +60,4 @@ _efl_file_load_error_get(const Eo *obj EINA_UNUSED, Efl_File_Data *pd)
|
|||
}
|
||||
|
||||
#include "interfaces/efl_file.eo.c"
|
||||
#include "interfaces/efl_file_save.eo.c"
|
||||
|
|
|
@ -89,27 +89,5 @@ mixin Efl.File {
|
|||
$null, otherwise.]]
|
||||
}
|
||||
}
|
||||
save @const @pure_virtual {
|
||||
[[Save the given image object's contents to an (image) file.
|
||||
|
||||
The extension suffix on $file will determine which saver
|
||||
module Evas is to use when saving, thus the final file's
|
||||
format. If the file supports multiple data stored in it (Eet ones),
|
||||
you can specify the key to be used as the index of the image in it.
|
||||
|
||||
You can specify some flags when saving the image. Currently
|
||||
acceptable flags are $quality and $compress. Eg.:
|
||||
"quality=100 compress=9".
|
||||
]]
|
||||
params {
|
||||
@in file: string @nonull; [[The filename to be used to save the image (extension
|
||||
obligatory).]]
|
||||
@in key: string; [[The image key in the file (if an Eet one), or $null,
|
||||
otherwise.]]
|
||||
@in flags: string; [[String containing the flags to be used ($null for
|
||||
none).]]
|
||||
}
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import eina_types;
|
||||
|
||||
interface Efl.File_Save {
|
||||
[[Efl file saving interface]]
|
||||
methods {
|
||||
save @const {
|
||||
[[Save the given image object's contents to an (image) file.
|
||||
|
||||
The extension suffix on $file will determine which saver
|
||||
module Evas is to use when saving, thus the final file's
|
||||
format. If the file supports multiple data stored in it (Eet ones),
|
||||
you can specify the key to be used as the index of the image in it.
|
||||
|
||||
You can specify some flags when saving the image. Currently
|
||||
acceptable flags are $quality and $compress. Eg.:
|
||||
"quality=100 compress=9".
|
||||
]]
|
||||
params {
|
||||
@in file: string @nonull; [[The filename to be used to save the image (extension
|
||||
obligatory).]]
|
||||
@in key: string; [[The image key in the file (if an Eet one), or $null,
|
||||
otherwise.]]
|
||||
@in flags: string; [[String containing the flags to be used ($null for
|
||||
none).]]
|
||||
}
|
||||
return: bool; [[$true on success, $false otherwise]]
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ interface Efl.Gfx.Frame_Controller
|
|||
[[Check if an object can be animated (has multiple frames).
|
||||
|
||||
This will be $true for animated object for instance but $false
|
||||
for still image.
|
||||
for a single frame object.
|
||||
|
||||
@since 1.1
|
||||
]]
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "interfaces/efl_text_cursor.eo.c"
|
||||
#include "interfaces/efl_text_annotate.eo.c"
|
||||
#include "interfaces/efl_text_markup.eo.c"
|
||||
#include "interfaces/efl_text_markup_interactive.eo.c"
|
||||
|
||||
#include "interfaces/efl_gfx_entity.eo.c"
|
||||
#include "interfaces/efl_gfx_buffer.eo.c"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
interface Efl.Text_Markup extends Efl.Text_Cursor {
|
||||
interface Efl.Text_Markup {
|
||||
[[Markup data that populates the text object's style and format
|
||||
|
||||
@since 1.21
|
||||
|
@ -10,24 +10,6 @@ interface Efl.Text_Markup extends Efl.Text_Cursor {
|
|||
markup: string; [[The markup-text representation set to this text.]]
|
||||
}
|
||||
}
|
||||
@property markup_range {
|
||||
[[Markup of a given range in the text]]
|
||||
values {
|
||||
markup: mstring @owned; [[The markup-text representation set to
|
||||
this text of a given range]]
|
||||
}
|
||||
keys {
|
||||
start: ptr(Efl.Text_Cursor_Cursor);
|
||||
end: ptr(Efl.Text_Cursor_Cursor);
|
||||
}
|
||||
}
|
||||
cursor_markup_insert {
|
||||
[[Inserts a markup text to the text object in a given cursor position]]
|
||||
params {
|
||||
cur: ptr(Efl.Text_Cursor_Cursor); [[Cursor position to insert markup]]
|
||||
@in markup: string; [[The markup text to insert]]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
interface Efl.Text_Markup_Interactive extends Efl.Text_Cursor {
|
||||
[[Markup data that populates the text object's style and format
|
||||
|
||||
@since 1.22
|
||||
]]
|
||||
methods {
|
||||
@property markup_range {
|
||||
[[Markup of a given range in the text]]
|
||||
values {
|
||||
markup: mstring @owned; [[The markup-text representation set to
|
||||
this text of a given range]]
|
||||
}
|
||||
keys {
|
||||
start: ptr(Efl.Text_Cursor_Cursor);
|
||||
end: ptr(Efl.Text_Cursor_Cursor);
|
||||
}
|
||||
}
|
||||
cursor_markup_insert {
|
||||
[[Inserts a markup text to the text object in a given cursor position]]
|
||||
params {
|
||||
cur: ptr(Efl.Text_Cursor_Cursor); [[Cursor position to insert markup]]
|
||||
@in markup: string; [[The markup text to insert]]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -14,4 +14,4 @@ _efl_ui_direction_readonly_efl_ui_direction_direction_set(Eo *obj EINA_UNUSED, E
|
|||
EINA_LOG_ERR("This object does not allow setting of a direction");
|
||||
}
|
||||
|
||||
#include "efl_ui_direction_readonly.eo.c"
|
||||
#include "interfaces/efl_ui_direction_readonly.eo.c"
|
||||
|
|
|
@ -49,6 +49,7 @@ pub_eo_files = [
|
|||
'efl_control.eo',
|
||||
'efl_duplicate.eo',
|
||||
'efl_file.eo',
|
||||
'efl_file_save.eo',
|
||||
'efl_gfx_image_load_controller.eo',
|
||||
'efl_part.eo',
|
||||
'efl_player.eo',
|
||||
|
@ -59,6 +60,7 @@ pub_eo_files = [
|
|||
'efl_text_cursor.eo',
|
||||
'efl_text_annotate.eo',
|
||||
'efl_text_markup.eo',
|
||||
'efl_text_markup_interactive.eo',
|
||||
'efl_text_markup_util.eo',
|
||||
'efl_gfx_stack.eo',
|
||||
'efl_gfx_view.eo',
|
||||
|
|
|
@ -9,18 +9,6 @@
|
|||
#include <sys/mman.h>
|
||||
#include <fnmatch.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
# include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include <Ecore.h>
|
||||
#include <Ecore_File.h>
|
||||
|
||||
|
@ -1018,7 +1006,7 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
|
|||
|
||||
tshort = 0;
|
||||
memcpy(&tshort, ptr, sizeof(short));
|
||||
entry->value_len = ntohs(tshort);
|
||||
entry->value_len = eina_ntohs(tshort);
|
||||
ptr += 2;
|
||||
|
||||
entry->value = NEW(char, entry->value_len);
|
||||
|
@ -1059,20 +1047,20 @@ efreet_mime_shared_mimeinfo_magic_parse(char *data, int size)
|
|||
if (entry->word_size == 2)
|
||||
{
|
||||
((short*)entry->value)[j] =
|
||||
ntohs(((short*)entry->value)[j]);
|
||||
eina_ntohs(((short*)entry->value)[j]);
|
||||
|
||||
if (entry->mask)
|
||||
((short*)entry->mask)[j] =
|
||||
ntohs(((short*)entry->mask)[j]);
|
||||
eina_ntohs(((short*)entry->mask)[j]);
|
||||
}
|
||||
else if (entry->word_size == 4)
|
||||
{
|
||||
((int*)entry->value)[j] =
|
||||
ntohl(((int*)entry->value)[j]);
|
||||
eina_ntohl(((int*)entry->value)[j]);
|
||||
|
||||
if (entry->mask)
|
||||
((int*)entry->mask)[j] =
|
||||
ntohl(((int*)entry->mask)[j]);
|
||||
eina_ntohl(((int*)entry->mask)[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue