forked from enlightenment/efl
Ecore_Wayland: Remove dependency on egl (handled in compositors).
Handle 'axis' events from multi-touch devices (also handles mouse wheel). Remove wl_buffer_damage calls (obsolete in newest wayland). NB: This will require the 'latest' wayland code from their git repo as of 2012-03-27. SVN revision: 69672
This commit is contained in:
parent
7fd2403a1d
commit
5d861aad45
|
@ -1917,7 +1917,7 @@ ECORE_EVAS_CHECK_MODULE([psl1ght],
|
|||
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"
|
||||
|
@ -1925,7 +1925,7 @@ fi
|
|||
|
||||
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],
|
||||
|
|
|
@ -811,9 +811,9 @@ _ecore_evas_wl_render(Ecore_Evas *ee)
|
|||
|
||||
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);
|
||||
|
|
|
@ -1,15 +1,8 @@
|
|||
#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
|
||||
|
@ -76,13 +69,6 @@ struct _Ecore_Wl_Display
|
|||
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;
|
||||
|
@ -95,9 +81,6 @@ struct _Ecore_Wl_Display
|
|||
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;
|
||||
};
|
||||
|
|
|
@ -29,8 +29,6 @@ static Eina_Bool _ecore_wl_shutdown(Eina_Bool close);
|
|||
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);
|
||||
|
||||
|
@ -161,29 +159,11 @@ ecore_wl_init(const char *name)
|
|||
/* 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;
|
||||
|
@ -372,7 +352,6 @@ _ecore_wl_shutdown(Eina_Bool close)
|
|||
_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);
|
||||
|
@ -463,85 +442,6 @@ _ecore_wl_cb_handle_global(struct wl_display *disp, unsigned int id, const char
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
/* 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__);
|
||||
|
@ -51,12 +52,14 @@ static void _ecore_wl_input_focus_in_send(Ecore_Wl_Input *input, unsigned int ti
|
|||
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,
|
||||
|
@ -219,6 +222,17 @@ _ecore_wl_input_cb_button(void *data, struct wl_input_device *input_device __UNU
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -692,3 +706,38 @@ _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, unsigned int timestamp)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue