aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/wl_eglfs/e_mod_main.c
blob: 5c2470deff49a8bc8d0b65e48ca0662cacede5b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "e.h"
#include <Ecore_Fb.h>
#include <Ecore_Wayland.h>

E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_EGLFS" };

E_API void *
e_modapi_init(E_Module *m)
{
   Ecore_Evas *ee;
   E_Screen *screen;
   int w, h;

   printf("LOAD WL_EGLFS MODULE\n");
   e_util_env_set("HYBRIS_EGLPLATFORM", "fbdev");

   /* try to init ecore_fb */
   if (!ecore_fb_init(NULL))
     {
        fprintf(stderr, "Could not initialize ecore_fb");
        return NULL;
     }

   ecore_fb_size_get(&w, &h);
   ee = ecore_evas_eglfs_new(NULL, 0, w, h);

   e_comp->ee = ee;
   e_comp_gl_set(!!e_comp->ee);

   if (!e_xinerama_fake_screens_exist())
     {
        screen = E_NEW(E_Screen, 1);
        screen->escreen = screen->screen = 0;
        screen->x = 0;
        screen->y = 0;
        screen->w = w;
        screen->h = h;
        e_xinerama_screens_set(eina_list_append(NULL, screen));
     }
   e_comp_wl_init();
   e_comp_canvas_init(w, h);
   e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE);

   e_comp_wl_input_pointer_enabled_set(EINA_TRUE);
   e_comp_wl_input_keyboard_enabled_set(EINA_TRUE);
   e_comp_wl_input_touch_enabled_set(EINA_TRUE);
   e_comp_wl_input_keymap_set(NULL, NULL, NULL);

   ecore_wl_init(NULL);
   ecore_wl_server_mode_set(1);
   e_util_env_set("HYBRIS_EGLPLATFORM", "wayland");
   return m;
}

E_API int 
e_modapi_shutdown(E_Module *m EINA_UNUSED)
{
   /* shutdown ecore_fb */
   ecore_fb_shutdown();

   return 1;
}