2012-01-22 08:32:39 -08:00
|
|
|
#include "e.h"
|
2012-01-31 08:36:07 -08:00
|
|
|
#ifdef HAVE_WAYLAND_CLIENTS
|
2013-01-09 03:34:07 -08:00
|
|
|
# include "e_comp_wl.h"
|
|
|
|
# include "e_comp_wl_comp.h"
|
|
|
|
# include "e_comp_wl_input.h"
|
|
|
|
# include "e_comp_wl_surface.h"
|
|
|
|
# include "e_comp_wl_region.h"
|
2012-01-22 08:32:39 -08:00
|
|
|
#endif
|
|
|
|
|
2012-01-29 12:31:46 -08:00
|
|
|
#ifdef __linux__
|
|
|
|
# include <linux/input.h>
|
|
|
|
#else
|
2012-06-28 00:03:44 -07:00
|
|
|
# define BTN_LEFT 0x110
|
|
|
|
# define BTN_RIGHT 0x111
|
|
|
|
# define BTN_MIDDLE 0x112
|
|
|
|
# define BTN_SIDE 0x113
|
|
|
|
# define BTN_EXTRA 0x114
|
|
|
|
# define BTN_FORWARD 0x115
|
|
|
|
# define BTN_BACK 0x116
|
2012-01-29 12:31:46 -08:00
|
|
|
#endif
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
#define MODIFIER_CTRL (1 << 8)
|
|
|
|
#define MODIFIER_ALT (1 << 9)
|
2012-01-29 12:31:46 -08:00
|
|
|
#define MODIFIER_SUPER (1 << 10)
|
|
|
|
|
2012-01-22 08:32:39 -08:00
|
|
|
/* local function prototypes */
|
2013-01-09 03:34:07 -08:00
|
|
|
static Eina_Bool _e_comp_wl_comp_egl_init(void);
|
|
|
|
static void _e_comp_wl_comp_egl_shutdown(void);
|
|
|
|
static void _e_comp_wl_comp_destroy(void);
|
|
|
|
static void _e_comp_wl_comp_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
|
|
|
|
static void _e_comp_wl_comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint32_t id);
|
|
|
|
static void _e_comp_wl_comp_region_create(struct wl_client *client, struct wl_resource *resource, unsigned int id);
|
|
|
|
static void _e_comp_wl_comp_region_destroy(struct wl_resource *resource);
|
|
|
|
static Eina_Bool _e_comp_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event);
|
|
|
|
static Eina_Bool _e_comp_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__);
|
|
|
|
static Eina_Bool _e_comp_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event);
|
|
|
|
static Eina_Bool _e_comp_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event);
|
|
|
|
static Eina_Bool _e_comp_wl_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event);
|
|
|
|
static Eina_Bool _e_comp_wl_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event);
|
|
|
|
static Eina_Bool _e_comp_wl_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event);
|
|
|
|
static Eina_Bool _e_comp_wl_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event);
|
|
|
|
static Eina_Bool _e_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event);
|
|
|
|
|
|
|
|
static Wayland_Surface *_e_comp_wl_comp_pick_surface(int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t *sx, int32_t *sy);
|
|
|
|
static void _e_comp_wl_comp_update_modifier(Wayland_Input *input, uint32_t key, uint32_t state);
|
2012-01-22 08:32:39 -08:00
|
|
|
|
|
|
|
/* wayland interfaces */
|
2012-06-28 00:03:44 -07:00
|
|
|
static const struct wl_compositor_interface _wl_comp_interface =
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_surface_create,
|
|
|
|
_e_comp_wl_comp_region_create
|
2012-01-22 08:32:39 -08:00
|
|
|
};
|
2012-06-28 00:03:44 -07:00
|
|
|
static const struct wl_surface_interface _wl_surface_interface =
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
2013-01-09 03:34:07 -08:00
|
|
|
e_comp_wl_surface_destroy,
|
|
|
|
e_comp_wl_surface_attach,
|
|
|
|
e_comp_wl_surface_damage,
|
|
|
|
e_comp_wl_surface_frame,
|
|
|
|
e_comp_wl_surface_set_opaque_region,
|
|
|
|
e_comp_wl_surface_set_input_region,
|
|
|
|
e_comp_wl_surface_commit
|
2012-03-07 08:08:43 -08:00
|
|
|
};
|
2012-06-28 00:03:44 -07:00
|
|
|
static const struct wl_region_interface _wl_region_interface =
|
2012-03-07 08:08:43 -08:00
|
|
|
{
|
2013-01-09 03:34:07 -08:00
|
|
|
e_comp_wl_region_destroy,
|
|
|
|
e_comp_wl_region_add,
|
|
|
|
e_comp_wl_region_subtract
|
2012-01-22 08:32:39 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* private variables */
|
|
|
|
static Wayland_Compositor *_wl_comp;
|
2012-01-29 12:31:46 -08:00
|
|
|
static Eina_List *_wl_event_handlers = NULL;
|
2012-01-22 08:32:39 -08:00
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
e_comp_wl_comp_init(void)
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
const char *extensions;
|
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!(_wl_comp = malloc(sizeof(Wayland_Compositor))))
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Could not allocate space for compositor\n");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(_wl_comp, 0, sizeof(*_wl_comp));
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
if (!_e_comp_wl_comp_egl_init())
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
2012-01-26 10:21:54 -08:00
|
|
|
EINA_LOG_ERR("Could not initialize egl\n");
|
2012-01-22 08:32:39 -08:00
|
|
|
free(_wl_comp);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
_wl_comp->destroy = _e_comp_wl_comp_destroy;
|
2012-01-22 08:32:39 -08:00
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
if (!wl_display_add_global(_wl_disp, &wl_compositor_interface, _wl_comp,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_bind))
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Failed to add compositor to wayland\n");
|
|
|
|
free(_wl_comp);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-01-23 04:21:39 -08:00
|
|
|
_wl_comp->image_target_texture_2d =
|
2012-01-25 03:01:18 -08:00
|
|
|
(void *)eglGetProcAddress("glEGLImageTargetTexture2DOES");
|
2012-01-23 04:21:39 -08:00
|
|
|
_wl_comp->image_target_renderbuffer_storage = (void *)
|
|
|
|
eglGetProcAddress("glEGLImageTargetRenderbufferStorageOES");
|
2012-01-25 03:01:18 -08:00
|
|
|
_wl_comp->create_image = (void *)eglGetProcAddress("eglCreateImageKHR");
|
|
|
|
_wl_comp->destroy_image = (void *)eglGetProcAddress("eglDestroyImageKHR");
|
2012-01-23 04:21:39 -08:00
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_comp->bind_display =
|
2012-01-22 08:32:39 -08:00
|
|
|
(void *)eglGetProcAddress("eglBindWaylandDisplayWL");
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_comp->unbind_display =
|
2012-01-22 08:32:39 -08:00
|
|
|
(void *)eglGetProcAddress("eglUnbindWaylandDisplayWL");
|
|
|
|
|
|
|
|
extensions = (const char *)glGetString(GL_EXTENSIONS);
|
|
|
|
if (!strstr(extensions, "GL_EXT_texture_format_BGRA8888"))
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("GL_EXT_texture_format_BGRA8888 not available\n");
|
|
|
|
free(_wl_comp);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
extensions =
|
2012-01-22 08:32:39 -08:00
|
|
|
(const char *)eglQueryString(_wl_comp->egl.display, EGL_EXTENSIONS);
|
|
|
|
if (strstr(extensions, "EGL_WL_bind_wayland_display"))
|
|
|
|
_wl_comp->has_bind = EINA_TRUE;
|
2012-06-28 00:03:44 -07:00
|
|
|
if (_wl_comp->has_bind)
|
2012-01-22 08:32:39 -08:00
|
|
|
_wl_comp->bind_display(_wl_comp->egl.display, _wl_disp);
|
|
|
|
|
|
|
|
wl_data_device_manager_init(_wl_disp);
|
|
|
|
|
2012-01-26 10:21:54 -08:00
|
|
|
wl_list_init(&_wl_comp->surfaces);
|
2012-01-22 08:32:39 -08:00
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_event_handlers =
|
|
|
|
eina_list_append(_wl_event_handlers,
|
2012-01-29 12:31:46 -08:00
|
|
|
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_focus_in, NULL));
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_event_handlers =
|
|
|
|
eina_list_append(_wl_event_handlers,
|
2012-01-29 12:31:46 -08:00
|
|
|
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_focus_out, NULL));
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_event_handlers =
|
|
|
|
eina_list_append(_wl_event_handlers,
|
2012-01-29 12:31:46 -08:00
|
|
|
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_in, NULL));
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_event_handlers =
|
|
|
|
eina_list_append(_wl_event_handlers,
|
2012-01-29 12:31:46 -08:00
|
|
|
ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_out, NULL));
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_event_handlers =
|
|
|
|
eina_list_append(_wl_event_handlers,
|
2012-01-29 12:31:46 -08:00
|
|
|
ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_move, NULL));
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_event_handlers =
|
|
|
|
eina_list_append(_wl_event_handlers,
|
2012-01-29 12:31:46 -08:00
|
|
|
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_down, NULL));
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_event_handlers =
|
|
|
|
eina_list_append(_wl_event_handlers,
|
2012-01-29 12:31:46 -08:00
|
|
|
ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_up, NULL));
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_event_handlers =
|
|
|
|
eina_list_append(_wl_event_handlers,
|
2012-01-29 12:31:46 -08:00
|
|
|
ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_key_down, NULL));
|
2012-06-28 00:03:44 -07:00
|
|
|
_wl_event_handlers =
|
|
|
|
eina_list_append(_wl_event_handlers,
|
2012-01-29 12:31:46 -08:00
|
|
|
ecore_event_handler_add(ECORE_EVENT_KEY_UP,
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_key_up, NULL));
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-01-22 08:32:39 -08:00
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
void
|
2013-01-09 03:34:07 -08:00
|
|
|
e_comp_wl_comp_shutdown(void)
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-01-29 12:31:46 -08:00
|
|
|
E_FREE_LIST(_wl_event_handlers, ecore_event_handler_del);
|
|
|
|
|
2012-01-26 10:21:54 -08:00
|
|
|
if (_wl_comp) _wl_comp->destroy();
|
2012-01-22 08:32:39 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Wayland_Compositor *
|
2013-01-09 03:34:07 -08:00
|
|
|
e_comp_wl_comp_get(void)
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
return _wl_comp;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
void
|
2013-01-09 03:34:07 -08:00
|
|
|
e_comp_wl_comp_repick(struct wl_seat *seat, uint32_t timestamp __UNUSED__)
|
2012-01-31 06:16:48 -08:00
|
|
|
{
|
|
|
|
Wayland_Surface *ws, *focus;
|
2012-11-12 06:41:30 -08:00
|
|
|
struct wl_pointer *pointer;
|
|
|
|
|
|
|
|
if (!(pointer = seat->pointer)) return;
|
2012-01-31 06:16:48 -08:00
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
ws =
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_pick_surface(pointer->x, pointer->y,
|
2013-01-11 02:34:29 -08:00
|
|
|
&pointer->current_x, &pointer->current_y);
|
2012-01-31 06:16:48 -08:00
|
|
|
if (!ws) return;
|
2012-11-12 06:41:30 -08:00
|
|
|
if (&ws->surface != pointer->current)
|
2012-01-31 06:16:48 -08:00
|
|
|
{
|
2012-02-22 11:26:10 -08:00
|
|
|
const struct wl_pointer_grab_interface *interface;
|
2012-01-31 06:16:48 -08:00
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
interface = pointer->grab->interface;
|
|
|
|
pointer->current = &ws->surface;
|
|
|
|
interface->focus(pointer->grab, &ws->surface,
|
|
|
|
pointer->current_x, pointer->current_y);
|
2012-01-31 06:16:48 -08:00
|
|
|
}
|
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
if ((focus = (Wayland_Surface *)pointer->grab->focus))
|
2012-01-31 06:16:48 -08:00
|
|
|
{
|
2012-11-12 06:41:30 -08:00
|
|
|
pointer->grab->x = pointer->x - focus->x;
|
|
|
|
pointer->grab->y = pointer->y - focus->y;
|
2012-01-31 06:16:48 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-01-22 08:32:39 -08:00
|
|
|
/* local functions */
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_egl_init(void)
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
EGLint major, minor, n;
|
2012-06-28 00:03:44 -07:00
|
|
|
EGLint config_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
|
|
|
|
};
|
|
|
|
EGLint context_attribs[] =
|
|
|
|
{
|
|
|
|
EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE
|
|
|
|
};
|
2012-01-22 08:32:39 -08:00
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (!(_wl_comp->egl.display = eglGetDisplay(NULL)))
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Failed to create EGL display\n");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!eglInitialize(_wl_comp->egl.display, &major, &minor))
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Failed to initialize EGL\n");
|
|
|
|
eglTerminate(_wl_comp->egl.display);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!eglBindAPI(EGL_OPENGL_ES_API))
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Failed to bind EGL API\n");
|
|
|
|
eglTerminate(_wl_comp->egl.display);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
if ((!eglChooseConfig(_wl_comp->egl.display, config_attribs,
|
|
|
|
&_wl_comp->egl.config, 1, &n) || (n == 0)))
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Failed to choose EGL config\n");
|
|
|
|
eglTerminate(_wl_comp->egl.display);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
if (!(_wl_comp->egl.context =
|
|
|
|
eglCreateContext(_wl_comp->egl.display, _wl_comp->egl.config,
|
|
|
|
EGL_NO_CONTEXT, context_attribs)))
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Failed to create EGL context\n");
|
|
|
|
eglTerminate(_wl_comp->egl.display);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
if (!eglMakeCurrent(_wl_comp->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
2012-01-22 08:32:39 -08:00
|
|
|
_wl_comp->egl.context))
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Failed to make EGL context current\n");
|
|
|
|
eglTerminate(_wl_comp->egl.display);
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static void
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_egl_shutdown(void)
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
eglMakeCurrent(_wl_comp->egl.display, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
2012-01-22 08:32:39 -08:00
|
|
|
EGL_NO_CONTEXT);
|
|
|
|
eglTerminate(_wl_comp->egl.display);
|
|
|
|
eglReleaseThread();
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static void
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_destroy(void)
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
if (_wl_comp->has_bind)
|
|
|
|
_wl_comp->unbind_display(_wl_comp->egl.display, _wl_disp);
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_egl_shutdown();
|
2012-01-22 08:32:39 -08:00
|
|
|
|
2012-01-26 10:21:54 -08:00
|
|
|
if (&_wl_comp->surfaces) wl_list_remove(&_wl_comp->surfaces);
|
2012-01-22 08:32:39 -08:00
|
|
|
free(_wl_comp);
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static void
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id)
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
wl_client_add_object(client, &wl_compositor_interface,
|
2012-01-22 08:32:39 -08:00
|
|
|
&_wl_comp_interface, id, data);
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static void
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_surface_create(struct wl_client *client, struct wl_resource *resource, uint32_t id)
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
2012-01-26 10:21:54 -08:00
|
|
|
Wayland_Surface *ws;
|
2012-01-22 08:32:39 -08:00
|
|
|
|
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
if (!(ws = e_comp_wl_surface_create(0, 0, 0, 0)))
|
2012-01-22 08:32:39 -08:00
|
|
|
{
|
|
|
|
wl_resource_post_no_memory(resource);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
ws->surface.resource.destroy = e_comp_wl_surface_destroy_surface;
|
2012-01-26 10:21:54 -08:00
|
|
|
ws->surface.resource.object.id = id;
|
|
|
|
ws->surface.resource.object.interface = &wl_surface_interface;
|
2012-06-28 00:03:44 -07:00
|
|
|
ws->surface.resource.object.implementation =
|
|
|
|
(void (* *)(void)) & _wl_surface_interface;
|
2012-01-26 10:21:54 -08:00
|
|
|
ws->surface.resource.data = ws;
|
2012-01-22 08:32:39 -08:00
|
|
|
|
2012-01-26 10:21:54 -08:00
|
|
|
wl_client_add_resource(client, &ws->surface.resource);
|
2012-01-22 08:32:39 -08:00
|
|
|
}
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static void
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_region_create(struct wl_client *client, struct wl_resource *resource, unsigned int id)
|
2012-03-07 08:08:43 -08:00
|
|
|
{
|
|
|
|
Wayland_Region *region;
|
|
|
|
|
|
|
|
region = malloc(sizeof(*region));
|
|
|
|
if (!region)
|
|
|
|
{
|
|
|
|
wl_resource_post_no_memory(resource);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
region->resource.destroy = _e_comp_wl_comp_region_destroy;
|
2012-03-07 08:08:43 -08:00
|
|
|
region->resource.object.id = id;
|
|
|
|
region->resource.object.interface = &wl_region_interface;
|
2012-06-28 00:03:44 -07:00
|
|
|
region->resource.object.implementation =
|
|
|
|
(void (* *)(void)) & _wl_region_interface;
|
2012-03-07 08:08:43 -08:00
|
|
|
region->resource.data = region;
|
|
|
|
|
|
|
|
pixman_region32_init(®ion->region);
|
|
|
|
wl_client_add_resource(client, ®ion->resource);
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static void
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_region_destroy(struct wl_resource *resource)
|
2012-03-07 08:08:43 -08:00
|
|
|
{
|
|
|
|
Wayland_Region *region;
|
|
|
|
|
|
|
|
region = container_of(resource, Wayland_Region, resource);
|
|
|
|
pixman_region32_fini(®ion->region);
|
|
|
|
free(region);
|
|
|
|
}
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
|
|
|
Wayland_Input *input;
|
|
|
|
Wayland_Surface *ws;
|
|
|
|
Ecore_X_Event_Window_Focus_In *ev;
|
|
|
|
|
|
|
|
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
input = e_comp_wl_input_get();
|
2012-01-29 12:31:46 -08:00
|
|
|
wl_list_for_each(ws, &_wl_comp->surfaces, link)
|
2012-06-28 00:03:44 -07:00
|
|
|
{
|
|
|
|
if (((ws->win) && (ws->win->border))
|
|
|
|
&& (ws->win->border->win == ev->win))
|
|
|
|
{
|
2012-11-12 06:41:30 -08:00
|
|
|
wl_keyboard_set_focus(input->seat.keyboard, &ws->surface);
|
|
|
|
wl_data_device_set_keyboard_focus(&input->seat);
|
2012-06-28 00:03:44 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
|
|
|
Wayland_Input *input;
|
2012-11-12 06:41:30 -08:00
|
|
|
/* Ecore_X_Event_Window_Focus_Out *ev; */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* ev = event; */
|
2013-01-09 03:34:07 -08:00
|
|
|
input = e_comp_wl_input_get();
|
2013-01-11 02:34:29 -08:00
|
|
|
if ((!input) || (!input->seat.keyboard))
|
2012-11-13 00:33:36 -08:00
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
2012-11-12 06:41:30 -08:00
|
|
|
wl_keyboard_set_focus(input->seat.keyboard, NULL);
|
|
|
|
wl_data_device_set_keyboard_focus(&input->seat);
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
|
|
|
Wayland_Input *input;
|
|
|
|
Ecore_X_Event_Mouse_In *ev;
|
2012-01-31 05:51:52 -08:00
|
|
|
uint32_t timestamp;
|
2012-11-12 06:41:30 -08:00
|
|
|
struct wl_pointer *ptr;
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
|
2013-01-09 03:34:07 -08:00
|
|
|
input = e_comp_wl_input_get();
|
2012-11-12 06:41:30 -08:00
|
|
|
|
|
|
|
ptr = input->seat.pointer;
|
|
|
|
ptr->x = ev->x;
|
|
|
|
ptr->y = ev->y;
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
timestamp = e_comp_wl_time_get();
|
|
|
|
e_comp_wl_comp_repick(&input->seat, timestamp);
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
|
|
|
Wayland_Input *input;
|
|
|
|
Ecore_X_Event_Mouse_Out *ev;
|
2012-01-31 05:51:52 -08:00
|
|
|
uint32_t timestamp;
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
|
2013-01-09 03:34:07 -08:00
|
|
|
input = e_comp_wl_input_get();
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
timestamp = e_comp_wl_time_get();
|
|
|
|
e_comp_wl_comp_repick(&input->seat, timestamp);
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
|
|
|
Wayland_Input *input;
|
|
|
|
Ecore_Event_Mouse_Move *ev;
|
2012-02-22 11:26:10 -08:00
|
|
|
const struct wl_pointer_grab_interface *interface;
|
2012-01-31 05:51:52 -08:00
|
|
|
uint32_t timestamp;
|
2012-11-12 06:41:30 -08:00
|
|
|
struct wl_pointer *ptr;
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
input = e_comp_wl_input_get();
|
2012-11-12 06:41:30 -08:00
|
|
|
|
|
|
|
ptr = input->seat.pointer;
|
|
|
|
ptr->x = ev->x;
|
|
|
|
ptr->y = ev->y;
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
timestamp = e_comp_wl_time_get();
|
|
|
|
e_comp_wl_comp_repick(&input->seat, timestamp);
|
2012-11-12 06:41:30 -08:00
|
|
|
|
|
|
|
interface = ptr->grab->interface;
|
|
|
|
interface->motion(ptr->grab, timestamp, ptr->grab->x, ptr->grab->y);
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* TODO: handle sprite */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
|
|
|
Wayland_Input *input;
|
|
|
|
Ecore_Event_Mouse_Button *ev;
|
2012-11-12 06:41:30 -08:00
|
|
|
struct wl_pointer *ptr;
|
2012-01-29 12:31:46 -08:00
|
|
|
int btn = 0;
|
2012-01-31 05:51:52 -08:00
|
|
|
uint32_t timestamp;
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-01-31 05:51:52 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
ev = event;
|
|
|
|
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
switch (ev->buttons)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
btn = ev->buttons + BTN_LEFT - 1;
|
|
|
|
break;
|
2012-06-28 00:03:44 -07:00
|
|
|
|
2012-01-29 12:31:46 -08:00
|
|
|
case 2:
|
|
|
|
btn = BTN_MIDDLE;
|
|
|
|
break;
|
2012-06-28 00:03:44 -07:00
|
|
|
|
2012-01-29 12:31:46 -08:00
|
|
|
case 3:
|
|
|
|
btn = BTN_RIGHT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
input = e_comp_wl_input_get();
|
2012-11-12 06:41:30 -08:00
|
|
|
ptr = input->seat.pointer;
|
2013-01-09 03:34:07 -08:00
|
|
|
timestamp = e_comp_wl_time_get();
|
2012-11-12 06:41:30 -08:00
|
|
|
if (ptr->button_count == 0)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
2012-11-12 06:41:30 -08:00
|
|
|
ptr->grab_button = btn;
|
|
|
|
ptr->grab_time = timestamp;
|
|
|
|
ptr->grab_x = ptr->x;
|
|
|
|
ptr->grab_y = ptr->y;
|
2012-01-29 12:31:46 -08:00
|
|
|
}
|
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
ptr->button_count++;
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
/* TODO: Run binding ?? */
|
2012-11-12 06:41:30 -08:00
|
|
|
|
|
|
|
ptr->grab->interface->button(ptr->grab, timestamp, btn, 1);
|
|
|
|
|
|
|
|
if (ptr->button_count == 1)
|
|
|
|
ptr->grab_serial = wl_display_get_serial(_wl_disp);
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_mouse_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
|
|
|
Wayland_Input *input;
|
|
|
|
Ecore_Event_Mouse_Button *ev;
|
2012-11-12 06:41:30 -08:00
|
|
|
struct wl_pointer *ptr;
|
2012-01-29 12:31:46 -08:00
|
|
|
int btn = 0;
|
2012-01-31 05:51:52 -08:00
|
|
|
uint32_t timestamp;
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
|
|
|
ev = event;
|
|
|
|
if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON;
|
|
|
|
|
|
|
|
switch (ev->buttons)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
btn = ev->buttons + BTN_LEFT - 1;
|
|
|
|
break;
|
2012-06-28 00:03:44 -07:00
|
|
|
|
2012-01-29 12:31:46 -08:00
|
|
|
case 2:
|
|
|
|
btn = BTN_MIDDLE;
|
|
|
|
break;
|
2012-06-28 00:03:44 -07:00
|
|
|
|
2012-01-29 12:31:46 -08:00
|
|
|
case 3:
|
|
|
|
btn = BTN_RIGHT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
input = e_comp_wl_input_get();
|
2012-11-12 06:41:30 -08:00
|
|
|
ptr = input->seat.pointer;
|
|
|
|
ptr->button_count--;
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
/* TODO: Run binding ?? */
|
2013-01-09 03:34:07 -08:00
|
|
|
timestamp = e_comp_wl_time_get();
|
2012-11-12 06:41:30 -08:00
|
|
|
ptr->grab->interface->button(ptr->grab, timestamp, btn, 0);
|
|
|
|
|
|
|
|
if (ptr->button_count == 1)
|
|
|
|
ptr->grab_serial = wl_display_get_serial(_wl_disp);
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_key_down(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
2012-11-12 06:41:30 -08:00
|
|
|
/* Wayland_Input *input; */
|
|
|
|
/* Ecore_Event_Key *ev; */
|
|
|
|
/* struct wl_keyboard *kbd; */
|
|
|
|
/* uint32_t *k, *end, key = 0; */
|
|
|
|
/* uint32_t timestamp; */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* ev = event; */
|
|
|
|
/* if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON; */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
/* input = e_comp_wl_input_get(); */
|
2012-11-12 06:41:30 -08:00
|
|
|
/* kbd = input->seat.keyboard; */
|
2013-01-09 03:34:07 -08:00
|
|
|
/* timestamp = e_comp_wl_time_get(); */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* key = ecore_x_keysym_keycode_get(ev->key); */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* input->modifier_state = 0; */
|
2013-01-09 03:34:07 -08:00
|
|
|
/* _e_comp_wl_comp_update_modifier(input, key, 1); */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* end = kbd->keys.data + kbd->keys.size; */
|
|
|
|
/* for (k = kbd->keys.data; k < end; k++) */
|
|
|
|
/* if (*k == key) *k = *--end; */
|
|
|
|
/* kbd->keys.size = (void *)end - kbd->keys.data; */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* k = wl_array_add(&kbd->keys, sizeof(*k)); */
|
|
|
|
/* *k = key; */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* if (kbd->keyboard_focus_resource) */
|
|
|
|
/* wl_resource_post_event(device->keyboard_focus_resource, */
|
|
|
|
/* WL_INPUT_DEVICE_KEY, timestamp, key, 1); */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static Eina_Bool
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_cb_key_up(void *data __UNUSED__, int type __UNUSED__, void *event)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
2012-11-12 06:41:30 -08:00
|
|
|
/* Wayland_Input *input; */
|
|
|
|
/* Ecore_Event_Key *ev; */
|
|
|
|
/* struct wl_input_device *device; */
|
|
|
|
/* uint32_t *k, *end, key = 0; */
|
|
|
|
/* uint32_t timestamp; */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
// LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* ev = event; */
|
|
|
|
/* if (wl_list_empty(&_wl_comp->surfaces)) return ECORE_CALLBACK_PASS_ON; */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
/* input = e_comp_wl_input_get(); */
|
2012-11-12 06:41:30 -08:00
|
|
|
/* device = &input->input_device; */
|
2013-01-09 03:34:07 -08:00
|
|
|
/* timestamp = e_comp_wl_time_get(); */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* key = ecore_x_keysym_keycode_get(ev->key); */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2013-01-09 03:34:07 -08:00
|
|
|
/* _e_comp_wl_comp_update_modifier(input, key, 0); */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* end = device->keys.data + device->keys.size; */
|
|
|
|
/* for (k = device->keys.data; k < end; k++) */
|
|
|
|
/* if (*k == key) *k = *--end; */
|
|
|
|
/* device->keys.size = (void *)end - device->keys.data; */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
/* k = wl_array_add(&device->keys, sizeof(*k)); */
|
|
|
|
/* *k = ev->key; */
|
|
|
|
|
2012-11-12 06:41:30 -08:00
|
|
|
/* if (device->keyboard_focus_resource) */
|
|
|
|
/* wl_resource_post_event(device->keyboard_focus_resource, */
|
|
|
|
/* WL_INPUT_DEVICE_KEY, timestamp, key, 0); */
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return ECORE_CALLBACK_PASS_ON;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Wayland_Surface *
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_pick_surface(int32_t x __UNUSED__, int32_t y __UNUSED__, int32_t *sx, int32_t *sy)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
|
|
|
Wayland_Surface *ws;
|
|
|
|
|
|
|
|
if (wl_list_empty(&_wl_comp->surfaces)) return NULL;
|
|
|
|
wl_list_for_each(ws, &_wl_comp->surfaces, link)
|
2012-06-28 00:03:44 -07:00
|
|
|
{
|
|
|
|
if (ws->surface.resource.client == NULL) continue;
|
|
|
|
if ((0 <= *sx) && (*sx < ws->w) &&
|
|
|
|
(0 <= *sy) && (*sy < ws->h))
|
|
|
|
return ws;
|
|
|
|
}
|
2012-01-29 12:31:46 -08:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
static void
|
2013-01-09 03:34:07 -08:00
|
|
|
_e_comp_wl_comp_update_modifier(Wayland_Input *input, uint32_t key, uint32_t state)
|
2012-01-29 12:31:46 -08:00
|
|
|
{
|
|
|
|
uint32_t mod;
|
|
|
|
|
|
|
|
switch (key)
|
|
|
|
{
|
|
|
|
case KEY_LEFTCTRL:
|
|
|
|
case KEY_RIGHTCTRL:
|
|
|
|
mod = MODIFIER_CTRL;
|
|
|
|
break;
|
2012-06-28 00:03:44 -07:00
|
|
|
|
2012-01-29 12:31:46 -08:00
|
|
|
case KEY_LEFTALT:
|
|
|
|
case KEY_RIGHTALT:
|
|
|
|
mod = MODIFIER_ALT;
|
|
|
|
break;
|
2012-06-28 00:03:44 -07:00
|
|
|
|
2012-01-29 12:31:46 -08:00
|
|
|
case KEY_LEFTMETA:
|
|
|
|
case KEY_RIGHTMETA:
|
|
|
|
mod = MODIFIER_SUPER;
|
|
|
|
break;
|
2012-06-28 00:03:44 -07:00
|
|
|
|
2012-01-29 12:31:46 -08:00
|
|
|
default:
|
|
|
|
mod = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-06-28 00:03:44 -07:00
|
|
|
if (state)
|
2012-01-29 12:31:46 -08:00
|
|
|
input->modifier_state |= mod;
|
2012-06-28 00:03:44 -07:00
|
|
|
else
|
2012-01-29 12:31:46 -08:00
|
|
|
input->modifier_state &= ~mod;
|
|
|
|
}
|
2012-06-28 00:03:44 -07:00
|
|
|
|