summaryrefslogtreecommitdiff
path: root/src/bin/efl_wl/efl_wl_test.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-06-30 14:59:21 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-06-30 14:59:55 -0400
commitc2fde93c9ef1108c0809a538cf2ec482ed8369a9 (patch)
treed9879e4ebea4d25cda1a6cc1268461ad0d669c3b /src/bin/efl_wl/efl_wl_test.c
parent3775a9645da7e92599babccfe8454304cec367b7 (diff)
efl_wl: a multiseat wayland compositor in an evas smart object
build when wayland support is enabled and provide two test/demo cases beta api @feature Reviewed-By: Cedric BAIL <cedric@osg.samsung.com>
Diffstat (limited to 'src/bin/efl_wl/efl_wl_test.c')
-rw-r--r--src/bin/efl_wl/efl_wl_test.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/bin/efl_wl/efl_wl_test.c b/src/bin/efl_wl/efl_wl_test.c
new file mode 100644
index 0000000000..29361ee920
--- /dev/null
+++ b/src/bin/efl_wl/efl_wl_test.c
@@ -0,0 +1,65 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4#include "Efl_Wl.h"
5#include "Elementary.h"
6
7static Evas_Object *win;
8static Eina_Strbuf *buf;
9static Ecore_Exe *exe;
10
11static Eina_Bool
12del_handler(void *d EINA_UNUSED, int t EINA_UNUSED, Ecore_Exe_Event_Del *ev)
13{
14 if (ev->exe == exe) ecore_main_loop_quit();
15 return ECORE_CALLBACK_RENEW;
16}
17
18static void
19focus_in(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
20{
21 evas_object_focus_set(data, 1);
22}
23
24static Eina_Bool
25dostuff(void *data)
26{
27 exe = efl_wl_run(data, eina_strbuf_string_get(buf));
28 ecore_event_handler_add(ECORE_EXE_EVENT_DEL, (Ecore_Event_Handler_Cb)del_handler, NULL);
29 evas_object_focus_set(data, 1);
30 return EINA_FALSE;
31}
32
33int
34main(int argc, char *argv[])
35{
36 Evas_Object *o;
37 int i;
38
39 if (argc < 2) return 0;
40 elm_init(argc, (char**)argv);
41 buf = eina_strbuf_new();
42 for (i = 1; i < argc; i++)
43 {
44 eina_strbuf_append(buf, argv[i]);
45 if (i + 1 < argc) eina_strbuf_append_char(buf, ' ');
46 }
47
48 win = elm_win_util_standard_add("comp", "comp");
49 elm_win_autodel_set(win, 1);
50 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
51
52 o = efl_wl_add(evas_object_evas_get(win));
53 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
54 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
55 elm_win_resize_object_add(win, o);
56 evas_object_show(o);
57 evas_object_show(win);
58 evas_object_resize(win, 640, 480);
59 evas_object_event_callback_add(win, EVAS_CALLBACK_FOCUS_IN, focus_in, o);
60 ecore_timer_add(1, dostuff, o);
61
62 elm_run();
63 elm_shutdown();
64 return 0;
65}