summaryrefslogtreecommitdiff
path: root/src/bin/efl_wl
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
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')
-rw-r--r--src/bin/efl_wl/efl_wl_test.c65
-rw-r--r--src/bin/efl_wl/efl_wl_test_stack.c87
2 files changed, 152 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}
diff --git a/src/bin/efl_wl/efl_wl_test_stack.c b/src/bin/efl_wl/efl_wl_test_stack.c
new file mode 100644
index 0000000000..51cd598984
--- /dev/null
+++ b/src/bin/efl_wl/efl_wl_test_stack.c
@@ -0,0 +1,87 @@
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;
8
9static const char *cmds[] =
10{
11 "weston-terminal",
12 "terminology",
13};
14
15static unsigned int num_cmds = EINA_C_ARRAY_LENGTH(cmds);
16static unsigned int n;
17
18static Eina_Bool
19dostuff(void *data)
20{
21 efl_wl_run(data, cmds[n++]);
22 evas_object_focus_set(data, 1);
23 return n != num_cmds;
24}
25
26static void
27prev_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
28{
29 efl_wl_prev(data);
30}
31
32static void
33next_clicked(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
34{
35 efl_wl_next(data);
36}
37
38int
39main(int argc, char *argv[])
40{
41 Evas_Object *o, *comp, *prev, *next;
42 elm_init(argc, (char**)argv);
43
44 win = elm_win_util_standard_add("comp", "comp");
45 elm_win_autodel_set(win, 1);
46 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
47 o = evas_object_rectangle_add(evas_object_evas_get(win));
48 evas_object_color_set(o, 0, 125, 0, 125);
49 evas_object_size_hint_align_set(o, EVAS_HINT_FILL, EVAS_HINT_FILL);
50 evas_object_size_hint_weight_set(o, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
51 elm_win_resize_object_add(win, o);
52 evas_object_show(o);
53
54 o = elm_table_add(win);
55 elm_win_resize_object_add(win, o);
56 evas_object_show(o);
57
58 prev = elm_button_add(win);
59 elm_object_text_set(prev, "prev");
60 evas_object_size_hint_align_set(prev, EVAS_HINT_FILL, EVAS_HINT_FILL);
61 evas_object_size_hint_weight_set(prev, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
62 evas_object_show(prev);
63 elm_table_pack(o, prev, 0, 0, 1, 1);
64
65 next = elm_button_add(win);
66 elm_object_text_set(next, "next");
67 evas_object_size_hint_align_set(next, EVAS_HINT_FILL, EVAS_HINT_FILL);
68 evas_object_size_hint_weight_set(next, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
69 evas_object_show(next);
70 elm_table_pack(o, next, 1, 0, 1, 1);
71
72 comp = efl_wl_add(evas_object_evas_get(win));
73 evas_object_size_hint_min_set(comp, 640, 480);
74 elm_table_pack(o, comp, 0, 1, 2, 1);
75 evas_object_size_hint_align_set(comp, EVAS_HINT_FILL, EVAS_HINT_FILL);
76 evas_object_size_hint_weight_set(comp, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
77 evas_object_show(comp);
78 evas_object_show(win);
79 ecore_timer_add(1, dostuff, comp);
80
81 evas_object_smart_callback_add(prev, "clicked", prev_clicked, comp);
82 evas_object_smart_callback_add(next, "clicked", next_clicked, comp);
83
84 elm_run();
85 elm_shutdown();
86 return 0;
87}