ecore_wayland_deps="no"
have_wayland="no"
if test "x${want_ecore_wayland}" = "xyes" ; then
- PKG_CHECK_MODULES([WAYLAND], [egl >= 7.10 wayland-egl wayland-client xkbcommon], [have_wayland="yes"], [have_wayland="no"])
+ PKG_CHECK_MODULES([WAYLAND], [wayland-client xkbcommon], [have_wayland="yes"], [have_wayland="no"])
fi
if test "x${have_ecore_input}" = "xyes" -a "x${have_wayland}" = "xyes" ; then
ecore_wayland_deps="yes"
ECORE_CHECK_MODULE([wayland], [${want_ecore_wayland}], [Wayland], [${ecore_wayland_deps}])
if test "x${have_ecore_wayland}" = "xyes" ; then
- requirements_ecore_wayland="ecore-input >= 1.1.0 egl >= 7.10 wayland-egl wayland-client xkbcommon ${requirements_ecore_wayland}"
+ requirements_ecore_wayland="ecore-input >= 1.1.0 wayland-client xkbcommon ${requirements_ecore_wayland}"
fi
ECORE_EVAS_CHECK_MODULE_FULL([wayland-shm], [wayland-shm],
EINA_LIST_FOREACH(updates, l, r)
{
- if (ee->engine.wl.buffer)
- wl_buffer_damage(ee->engine.wl.buffer,
- r->x, r->y, r->w, r->h);
+ /* if (ee->engine.wl.buffer) */
+ /* wl_buffer_damage(ee->engine.wl.buffer, */
+ /* r->x, r->y, r->w, r->h); */
ecore_wl_window_damage(ee->engine.wl.win,
r->x, r->y, r->w, r->h);
#ifndef _ECORE_WAYLAND_H_
# define _ECORE_WAYLAND_H_
-# define GL_GLEXT_PROTOTYPES
-
# include <Eina.h>
# include <wayland-client.h>
-# include <wayland-egl.h> // NB: already includes wayland-client.h
-# include <GLES2/gl2.h>
-# include <GLES2/gl2ext.h>
-# include <EGL/egl.h>
-# include <EGL/eglext.h>
# ifdef EAPI
# undef EAPI
struct wl_data_device_manager *data_device_manager;
} wl;
- struct
- {
- EGLDisplay display;
- EGLConfig argb_config;
- EGLContext argb_context;
- } egl;
-
int fd;
unsigned int mask;
Ecore_Fd_Handler *fd_hdl;
Ecore_Wl_Output *output;
Ecore_Wl_Input *input;
- PFNEGLCREATEIMAGEKHRPROC create_image;
- PFNEGLDESTROYIMAGEKHRPROC destroy_image;
-
void (*output_configure)(Ecore_Wl_Output *output, void *data);
void *data;
};
static int _ecore_wl_cb_event_mask_update(unsigned int mask, void *data);
static Eina_Bool _ecore_wl_cb_handle_data(void *data, Ecore_Fd_Handler *hdl __UNUSED__);
static void _ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char *interface, unsigned int version __UNUSED__, void *data);
-static Eina_Bool _ecore_wl_egl_init(Ecore_Wl_Display *ewd);
-static Eina_Bool _ecore_wl_egl_shutdown(Ecore_Wl_Display *ewd);
static Eina_Bool _ecore_wl_xkb_init(Ecore_Wl_Display *ewd);
static Eina_Bool _ecore_wl_xkb_shutdown(Ecore_Wl_Display *ewd);
/* FIXME: Process connection events ?? */
/* wl_display_iterate(_ecore_wl_disp->wl.display, WL_DISPLAY_READABLE); */
- /* if (!_ecore_wl_egl_init(_ecore_wl_disp)) */
- /* { */
- /* ERR("Could not initialize EGL"); */
- /* free(_ecore_wl_disp); */
- /* eina_log_domain_unregister(_ecore_wl_log_dom); */
- /* _ecore_wl_log_dom = -1; */
- /* ecore_event_shutdown(); */
- /* ecore_shutdown(); */
- /* eina_shutdown(); */
- /* return --_ecore_wl_init_count; */
- /* } */
-
- /* _ecore_wl_disp->create_image = */
- /* (void *)eglGetProcAddress("eglCreateImageKHR"); */
- /* _ecore_wl_disp->destroy_image = */
- /* (void *)eglGetProcAddress("eglDestroyImageKHR"); */
-
/* TODO: create pointer surfaces */
if (!_ecore_wl_xkb_init(_ecore_wl_disp))
{
ERR("Could not initialize XKB");
- _ecore_wl_egl_shutdown(_ecore_wl_disp);
free(_ecore_wl_disp);
eina_log_domain_unregister(_ecore_wl_log_dom);
_ecore_wl_log_dom = -1;
_ecore_wl_input_del(in);
_ecore_wl_xkb_shutdown(_ecore_wl_disp);
- /* _ecore_wl_egl_shutdown(_ecore_wl_disp); */
if (_ecore_wl_disp->wl.shell)
wl_shell_destroy(_ecore_wl_disp->wl.shell);
}
static Eina_Bool
-_ecore_wl_egl_init(Ecore_Wl_Display *ewd)
-{
- EGLint major, minor, n;
- static const EGLint context_attribs[] =
- {
- EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE
- };
- static const EGLint argb_attribs[] =
- {
- EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8,
- EGL_ALPHA_SIZE, 1, EGL_DEPTH_SIZE, 0, EGL_STENCIL_SIZE, 0,
- EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_SURFACE_TYPE,
- EGL_WINDOW_BIT, EGL_NONE
- };
-
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- ewd->egl.display = eglGetDisplay(ewd->wl.display);
- if (!eglInitialize(ewd->egl.display, &major, &minor))
- {
- ERR("Failed to initialize EGL display");
- return EINA_FALSE;
- }
-
- if (!eglBindAPI(EGL_OPENGL_ES_API))
- {
- ERR("Failed to bind EGL Api");
- return EINA_FALSE;
- }
-
- if ((!eglChooseConfig(ewd->egl.display, argb_attribs, &ewd->egl.argb_config,
- 1, &n)) || (n == 0))
- {
- ERR("Failed to choose ARGB config");
- return EINA_FALSE;
- }
-
- ewd->egl.argb_context =
- eglCreateContext(ewd->egl.display, ewd->egl.argb_config,
- EGL_NO_CONTEXT, context_attribs);
- if (!ewd->egl.argb_context)
- {
- ERR("Failed to create ARGB context");
- return EINA_FALSE;
- }
-
- if (!eglMakeCurrent(ewd->egl.display, EGL_NO_SURFACE,
- EGL_NO_SURFACE, ewd->egl.argb_context))
- {
- ERR("Failed to make ARGB context current");
- return EINA_FALSE;
- }
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
-_ecore_wl_egl_shutdown(Ecore_Wl_Display *ewd)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-
- eglMakeCurrent(ewd->egl.display,
- EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-
- eglDestroyContext(ewd->egl.display, ewd->egl.argb_context);
-
- /* NB: This is hanging when we run elm apps as wayland clients
- * inside the weston compositor */
-
- /* printf("Egl Terminate\n"); */
- /* eglTerminate(ewd->egl.display); */
- /* printf("Egl Terminate Done\n"); */
-
- eglReleaseThread();
-
- return EINA_TRUE;
-}
-
-static Eina_Bool
_ecore_wl_xkb_init(Ecore_Wl_Display *ewd)
{
struct xkb_rule_names names;
/* local function prototypes */
static void _ecore_wl_input_cb_motion(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, int sx, int sy);
static void _ecore_wl_input_cb_button(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, unsigned int button, unsigned int state);
+static void _ecore_wl_input_cb_axis(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, unsigned int axis, int value);
static void _ecore_wl_input_cb_key(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp __UNUSED__, unsigned int key, unsigned int state);
static void _ecore_wl_input_cb_pointer_enter(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface, int sx, int sy);
static void _ecore_wl_input_cb_pointer_leave(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, struct wl_surface *surface __UNUSED__);
static void _ecore_wl_input_focus_out_send(Ecore_Wl_Input *input, unsigned int timestamp);
static void _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, unsigned int timestamp);
static void _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, unsigned int timestamp);
+static void _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int value, unsigned int timestamp);
/* wayland interfaces */
static const struct wl_input_device_listener _ecore_wl_input_listener =
{
_ecore_wl_input_cb_motion,
_ecore_wl_input_cb_button,
+ _ecore_wl_input_cb_axis,
_ecore_wl_input_cb_key,
_ecore_wl_input_cb_pointer_enter,
_ecore_wl_input_cb_pointer_leave,
}
static void
+_ecore_wl_input_cb_axis(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp, unsigned int axis, int value)
+{
+ Ecore_Wl_Input *input;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(input = data)) return;
+ _ecore_wl_input_mouse_wheel_send(input, axis, value, timestamp);
+}
+
+static void
_ecore_wl_input_cb_key(void *data, struct wl_input_device *input_device __UNUSED__, unsigned int timestamp __UNUSED__, unsigned int key, unsigned int state)
{
Ecore_Wl_Input *input;
ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL);
}
+
+static void
+_ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int value, unsigned int timestamp)
+{
+ Ecore_Event_Mouse_Wheel *ev;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+ if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return;
+
+ ev->timestamp = timestamp;
+ ev->modifiers = input->modifiers;
+ ev->x = input->sx;
+ ev->y = input->sy;
+ ev->root.x = input->sx;
+ ev->root.y = input->sy;
+
+ if (axis == WL_INPUT_DEVICE_AXIS_VERTICAL_SCROLL)
+ {
+ ev->direction = value;
+ ev->z = 1;
+ }
+ else if (axis == WL_INPUT_DEVICE_AXIS_HORIZONTAL_SCROLL)
+ {
+ /* TODO: handle horizontal scroll */
+ }
+
+ if (input->pointer_focus)
+ {
+ ev->window = input->pointer_focus->id;
+ ev->event_window = input->pointer_focus->id;
+ }
+
+ ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
+}