forked from enlightenment/efl
efl_loop / efl_app: make efl_app / efl_loop abstract
this is done inorder to ensure that noone ever thinks of creating theire own app/loop object. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D7982
This commit is contained in:
parent
e4b98a243b
commit
078ccd1ca9
|
@ -5,6 +5,7 @@
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
|
|
||||||
#include "ecore_private.h"
|
#include "ecore_private.h"
|
||||||
|
#include "eo_internal.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
|
@ -12,13 +13,15 @@
|
||||||
|
|
||||||
#define MY_CLASS EFL_APP_CLASS
|
#define MY_CLASS EFL_APP_CLASS
|
||||||
|
|
||||||
|
EFL_CLASS_SIMPLE_CLASS(efl_app, "Efl.App", EFL_APP_CLASS)
|
||||||
|
|
||||||
Efl_Version _app_efl_version = { 0, 0, 0, 0, NULL, NULL };
|
Efl_Version _app_efl_version = { 0, 0, 0, 0, NULL, NULL };
|
||||||
|
|
||||||
EOLIAN static Efl_App*
|
EOLIAN static Efl_App*
|
||||||
_efl_app_app_main_get(void)
|
_efl_app_app_main_get(void)
|
||||||
{
|
{
|
||||||
if (_mainloop_singleton) return _mainloop_singleton;
|
if (_mainloop_singleton) return _mainloop_singleton;
|
||||||
_mainloop_singleton = efl_add_ref(EFL_APP_CLASS, NULL);
|
_mainloop_singleton = efl_add_ref(efl_app_realized_class_get(), NULL);
|
||||||
_mainloop_singleton_data = efl_data_scope_get(_mainloop_singleton, EFL_LOOP_CLASS);
|
_mainloop_singleton_data = efl_data_scope_get(_mainloop_singleton, EFL_LOOP_CLASS);
|
||||||
return _mainloop_singleton;
|
return _mainloop_singleton;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import efl_types;
|
import efl_types;
|
||||||
|
|
||||||
class @beta Efl.App extends Efl.Loop implements Efl.Core.Command_Line
|
abstract @beta Efl.App extends Efl.Loop implements Efl.Core.Command_Line
|
||||||
{
|
{
|
||||||
[[Object representing the application itself]]
|
[[Object representing the application itself]]
|
||||||
data: null;
|
data: null;
|
||||||
|
|
|
@ -4,7 +4,7 @@ struct Efl.Loop_Arguments {
|
||||||
initialization: bool; [[Set to $true when the program should initialize its internal state. This happen once per process instance.]]
|
initialization: bool; [[Set to $true when the program should initialize its internal state. This happen once per process instance.]]
|
||||||
}
|
}
|
||||||
|
|
||||||
class @beta Efl.Loop extends Efl.Task
|
abstract @beta Efl.Loop extends Efl.Task
|
||||||
{
|
{
|
||||||
[[The Efl Main Loop
|
[[The Efl Main Loop
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,15 @@ EAPI void ___efl_auto_unref_set(Eo *obj_id, Eina_Bool enable);
|
||||||
EAPI int ___efl_ref2_count(const Eo *obj_id);
|
EAPI int ___efl_ref2_count(const Eo *obj_id);
|
||||||
EAPI void ___efl_ref2_reset(const Eo *obj_id);
|
EAPI void ___efl_ref2_reset(const Eo *obj_id);
|
||||||
|
|
||||||
|
#define EFL_CLASS_SIMPLE_CLASS(FUNC, NAME, ABSTRACT_CLASS) \
|
||||||
|
static const Efl_Class_Description FUNC ##_realized_class_desc = { \
|
||||||
|
EO_VERSION, \
|
||||||
|
#NAME"_Realized", \
|
||||||
|
EFL_CLASS_TYPE_REGULAR, \
|
||||||
|
0, NULL, NULL, NULL \
|
||||||
|
}; \
|
||||||
|
EFL_DEFINE_CLASS(FUNC ##_realized_class_get, &FUNC ##_realized_class_desc, ABSTRACT_CLASS, NULL)
|
||||||
|
|
||||||
#undef EAPI
|
#undef EAPI
|
||||||
#define EAPI
|
#define EAPI
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include "eo_internal.h"
|
||||||
#define EFL_NOLEGACY_API_SUPPORT
|
#define EFL_NOLEGACY_API_SUPPORT
|
||||||
#include <Efl_Core.h>
|
#include <Efl_Core.h>
|
||||||
#include "efl_app_suite.h"
|
#include "efl_app_suite.h"
|
||||||
|
@ -65,13 +66,15 @@ loop_timer_tick(void *data, const Efl_Event *ev EINA_UNUSED)
|
||||||
efl_loop_iterate(data);
|
efl_loop_iterate(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFL_CLASS_SIMPLE_CLASS(efl_loop, "Efl.Loop", EFL_LOOP_CLASS)
|
||||||
|
|
||||||
EFL_START_TEST(efl_app_test_efl_loop_concentric)
|
EFL_START_TEST(efl_app_test_efl_loop_concentric)
|
||||||
{
|
{
|
||||||
Eo *loop, *loop2, *timer, *timer2;
|
Eo *loop, *loop2, *timer, *timer2;
|
||||||
int exitcode;
|
int exitcode;
|
||||||
|
|
||||||
loop = efl_main_loop_get();
|
loop = efl_main_loop_get();
|
||||||
loop2 = efl_add(EFL_LOOP_CLASS, loop);
|
loop2 = efl_add(efl_loop_realized_class_get(), loop);
|
||||||
efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE, loop_idle, loop2);
|
efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE, loop_idle, loop2);
|
||||||
efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE_ENTER, loop_idle_enter, NULL);
|
efl_event_callback_add(loop, EFL_LOOP_EVENT_IDLE_ENTER, loop_idle_enter, NULL);
|
||||||
timer = efl_add(EFL_LOOP_TIMER_CLASS, loop2,
|
timer = efl_add(EFL_LOOP_TIMER_CLASS, loop2,
|
||||||
|
|
|
@ -25,7 +25,7 @@ class TestEoEvents
|
||||||
|
|
||||||
public static void idle_event()
|
public static void idle_event()
|
||||||
{
|
{
|
||||||
Efl.Loop loop = new Efl.Loop();
|
Efl.Loop loop = Efl.App.AppMain;
|
||||||
loop.SetName("loop");
|
loop.SetName("loop");
|
||||||
TestEoEvents listener = new TestEoEvents();
|
TestEoEvents listener = new TestEoEvents();
|
||||||
listener.loop = loop;
|
listener.loop = loop;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <Elementary.h>
|
#include <Elementary.h>
|
||||||
#include <Efl_Ui.h>
|
#include <Efl_Ui.h>
|
||||||
#include <check.h>
|
#include <check.h>
|
||||||
|
#include "eo_internal.h"
|
||||||
#include "../efl_check.h"
|
#include "../efl_check.h"
|
||||||
#include "elm_widget.h"
|
#include "elm_widget.h"
|
||||||
|
|
||||||
|
@ -170,6 +171,8 @@ _ui_win_hide(void *data EINA_UNUSED, const Efl_Event *ev)
|
||||||
efl_key_data_set(ev->object, "timer", NULL);
|
efl_key_data_set(ev->object, "timer", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFL_CLASS_SIMPLE_CLASS(efl_loop, "Efl.Loop", EFL_LOOP_CLASS)
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_elm_suite_win_create()
|
_elm_suite_win_create()
|
||||||
{
|
{
|
||||||
|
@ -181,7 +184,7 @@ _elm_suite_win_create()
|
||||||
else
|
else
|
||||||
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC));
|
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(), efl_ui_win_type_set(efl_added, EFL_UI_WIN_BASIC));
|
||||||
if (!buffer) return win;
|
if (!buffer) return win;
|
||||||
loop = efl_add(EFL_LOOP_CLASS, win);
|
loop = efl_add(efl_loop_realized_class_get(), win);
|
||||||
timer = efl_add(EFL_LOOP_TIMER_CLASS, loop,
|
timer = efl_add(EFL_LOOP_TIMER_CLASS, loop,
|
||||||
efl_loop_timer_interval_set(efl_added, BUFFER_RENDER_INTERVAL),
|
efl_loop_timer_interval_set(efl_added, BUFFER_RENDER_INTERVAL),
|
||||||
efl_event_freeze(efl_added),
|
efl_event_freeze(efl_added),
|
||||||
|
|
Loading…
Reference in New Issue