2
* Edje example demonstrating how to use multiseat features following
5
* It's an example of how themes can be implemented even if the number
6
* of seats using the UI is unknown.
8
* You'll need at least one Evas engine built for it (excluding the
9
* buffer one) that supports multiseat. It may be wayland or
10
* X11 with VNC support. Using other engines will lead you to a
11
* situation where all seats are reported as the same one ("default").
14
* edje_cc dynamic-multiseat.edc && gcc -o edje-dynamic-multiseat edje-dynamic-multiseat.c `pkg-config --libs --cflags evas ecore ecore-evas edje`
24
#ifndef PACKAGE_DATA_DIR
25
#define PACKAGE_DATA_DIR "."
29
#include <Ecore_Evas.h>
35
static const char *GROUPNAME = "example/main";
36
static const char *EDJE_FILE = PACKAGE_DATA_DIR"/dynamic_multiseat.edj";
39
_on_destroy(Ecore_Evas *ee EINA_UNUSED)
41
ecore_main_loop_quit();
45
_on_canvas_resize(Ecore_Evas *ee)
48
Evas_Object *edje_obj;
51
bg = ecore_evas_data_get(ee, "background");
52
edje_obj = ecore_evas_data_get(ee, "edje_obj");
54
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
55
evas_object_resize(bg, w, h);
56
evas_object_resize(edje_obj, w, h);
60
_edje_seat_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, const char *emission, const char *source EINA_UNUSED)
64
sig = emission + strlen("seat,");
65
printf("Device %s\n", sig);
69
_print_msg_cb(void *data EINA_UNUSED, Evas_Object *o EINA_UNUSED, const char *emission, const char *source EINA_UNUSED)
71
printf("Info: %s\n", emission);
75
main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
77
Evas_Object *edje_obj, *bg;
81
if (!ecore_evas_init())
85
goto shutdown_ecore_evas;
87
ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
88
if (!ee) goto shutdown_edje;
90
ecore_evas_callback_destroy_set(ee, _on_destroy);
91
ecore_evas_callback_resize_set(ee, _on_canvas_resize);
92
ecore_evas_title_set(ee, "Edje Dynamic Multiseat Example");
94
evas = ecore_evas_get(ee);
96
bg = evas_object_rectangle_add(evas);
97
evas_object_color_set(bg, 255, 255, 255, 255);
98
evas_object_resize(bg, WIDTH, HEIGHT);
100
ecore_evas_data_set(ee, "background", bg);
102
edje_obj = edje_object_add(evas);
104
if (!edje_object_file_set(edje_obj, EDJE_FILE, GROUPNAME))
105
printf("failed to set file %s.\n", EDJE_FILE);
107
evas_object_move(edje_obj, 0, 0);
108
evas_object_resize(edje_obj, WIDTH, HEIGHT);
109
evas_object_show(edje_obj);
110
ecore_evas_data_set(ee, "edje_obj", edje_obj);
112
edje_object_signal_callback_add(edje_obj, "seat,*", "",
113
_edje_seat_cb, NULL);
114
edje_object_signal_callback_add(edje_obj, "*", "theme",
115
_print_msg_cb, NULL);
117
printf("Running example on evas engine %s\n",
118
ecore_evas_engine_name_get(ee));
122
ecore_main_loop_begin();
125
ecore_evas_shutdown();
133
ecore_evas_shutdown();