Compare commits

...

17 Commits

Author SHA1 Message Date
Chris Michael c74e7102d3 Fix using global ewd variable by making it part of e_comp_wl
ref T2919

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-12-07 09:46:11 -05:00
Chris Michael efa015f926 Try to init (and error check the init) of ecore_wl2 library before we
create a compositor

ref T2919

Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-12-07 09:27:27 -05:00
Mike Blumenkrantz 1411222a7a create wl client connection during compositor init, use in shot module
fixes shot module

ref T2919
2015-12-05 13:09:03 -05:00
Mike Blumenkrantz 3f57674e35 call ecore_wl2_init() during compositor init
ref T2919
2015-12-05 13:07:33 -05:00
Chris Michael cbed2658b1 Fix formatting
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 5c2b91e7b2 Fix formatting
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael fb5fce9720 Port wl_fb module to use Ecore_Wl2 Library
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 7e0c617fa5 Port wl_weekeyboard to use Ecore_Wl2 library
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 9aa851f4fb Don't leak eina_iterator in shot module
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 9db7ce3c0a Fix formatting of wl_weekeyboard module
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael d0e7e77187 Port shot module to use ecore_wl2 library
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 7f468681ae port e_scale to use Ecore_Wl2
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 5bbbd488d2 port e_grabinput to use Ecore_Wl2
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 4a70c192ca port wayland compositor to use Ecore_Wl2
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 6b25e902c7 remove unused event loop and add external Ecore_Wl2_Display variable
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 5ab2de727b include header for Ecore_Wl2
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
Chris Michael 8fcdf3cb9f Make configure check for Ecore_Wl2 library
Signed-off-by: Chris Michael <cp.michael@samsung.com>
2015-11-10 09:10:06 -05:00
11 changed files with 266 additions and 208 deletions

View File

@ -742,7 +742,7 @@ AC_MSG_CHECKING([whether wayland EGL support is enabled])
AC_MSG_RESULT([${e_cv_want_wayland_egl}])
if test "x${e_cv_want_wayland_only}" != "xno" ;then
PKG_CHECK_MODULES([WAYLAND], [ecore-wayland >= 1.16 wayland-server >= 1.8.0 wayland-client >= 1.8.0 xkbcommon uuid],
PKG_CHECK_MODULES([WAYLAND], [ecore-wl2 wayland-server >= 1.8.0 wayland-client >= 1.8.0 xkbcommon uuid],
[
have_wayland=yes
AC_DEFINE_UNQUOTED([HAVE_WAYLAND],[1],[enable wayland support])
@ -859,7 +859,7 @@ WL_WEEKEYBOARD=false
define([CHECK_MODULE_WL_WEEKEYBOARD],
[
if test "x${have_wayland}" = "xyes" ; then
AC_E_CHECK_PKG(WL_WEEKEYBOARD, [ eina >= 1.8.0 evas >= 1.8.0 ecore >= 1.8.0 ecore-evas >= 1.8.0 ecore-wayland >= 1.8.0 edje >= 1.8.0 ], [WL_WEEKEYBOARD=true], [WL_WEEKEYBOARD=false])
AC_E_CHECK_PKG(WL_WEEKEYBOARD, [ eina >= 1.8.0 evas >= 1.8.0 ecore >= 1.8.0 ecore-evas >= 1.8.0 ecore-wl2 >= 1.8.0 edje >= 1.8.0 ], [WL_WEEKEYBOARD=true], [WL_WEEKEYBOARD=false])
else
WL_WEEKEYBOARD=false
fi

View File

@ -127,7 +127,7 @@ void *alloca (size_t);
# include <Elementary.h>
# ifdef HAVE_WAYLAND
# include <Ecore_Wayland.h>
# include <Ecore_Wl2.h>
# include <uuid.h>
# endif

View File

@ -9,6 +9,7 @@
#define COMPOSITOR_VERSION 3
E_API int E_EVENT_WAYLAND_GLOBAL_ADD = -1;
#include "session-recovery-server-protocol.h"
#ifndef EGL_HEIGHT
@ -69,27 +70,11 @@ _e_comp_wl_focus_check(void)
e_grabinput_focus(e_comp->ee_win, E_FOCUS_METHOD_PASSIVE);
}
static void
_e_comp_wl_log_cb_print(const char *format, va_list args)
{
EINA_LOG_DOM_INFO(e_log_dom, format, args);
}
static Eina_Bool
_e_comp_wl_cb_read(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED)
{
/* dispatch pending wayland events */
wl_event_loop_dispatch(e_comp_wl->wl.loop, 0);
return ECORE_CALLBACK_RENEW;
}
static void
_e_comp_wl_cb_prepare(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED)
{
/* flush pending client events */
wl_display_flush_clients(e_comp_wl->wl.disp);
}
/* static void */
/* _e_comp_wl_log_cb_print(const char *format, va_list args) */
/* { */
/* EINA_LOG_DOM_INFO(e_log_dom, format, args); */
/* } */
static Eina_Bool
_e_comp_wl_cb_module_idle(void *data EINA_UNUSED)
@ -1599,7 +1584,7 @@ _e_comp_wl_compositor_cb_del(void *data EINA_UNUSED)
}
/* delete fd handler */
if (e_comp_wl->fd_hdlr) ecore_main_fd_handler_del(e_comp_wl->fd_hdlr);
/* if (e_comp_wl->fd_hdlr) ecore_main_fd_handler_del(e_comp_wl->fd_hdlr); */
/* free allocated data structure */
free(e_comp_wl);
@ -2459,8 +2444,6 @@ static Eina_Bool
_e_comp_wl_compositor_create(void)
{
E_Comp_Wl_Data *cdata;
const char *name;
int fd = 0;
/* check for existing compositor. create if needed */
if (e_comp->comp_type == E_PIXMAP_TYPE_NONE)
@ -2477,24 +2460,25 @@ _e_comp_wl_compositor_create(void)
e_comp_wl = e_comp->wl_comp_data = cdata;
/* set wayland log handler */
wl_log_set_handler_server(_e_comp_wl_log_cb_print);
/* wl_log_set_handler_server(_e_comp_wl_log_cb_print); */
/* try to create a wayland display */
if (!(cdata->wl.disp = wl_display_create()))
/* try to create an ecore_wl2 display */
cdata->ewd = ecore_wl2_display_create(NULL);
if (!cdata->ewd)
{
ERR("Could not create a Wayland display: %m");
free(cdata);
return EINA_FALSE;
}
cdata->wl.disp = ecore_wl2_display_get(cdata->ewd);
if (!cdata->wl.disp)
{
ERR("Could not create a Wayland display: %m");
goto disp_err;
}
/* try to setup wayland socket */
if (!(name = wl_display_add_socket_auto(cdata->wl.disp)))
{
ERR("Could not create Wayland display socket: %m");
goto sock_err;
}
/* set wayland display environment variable */
e_env_set("WAYLAND_DISPLAY", name);
/* e_env_set("WAYLAND_DISPLAY", name); */
/* initialize compositor signals */
wl_signal_init(&cdata->signals.surface.create);
@ -2595,19 +2579,7 @@ _e_comp_wl_compositor_create(void)
e_comp_wl_input_keymap_set(rules, model, layout);
}
#endif
/* get the wayland display loop */
cdata->wl.loop = wl_display_get_event_loop(cdata->wl.disp);
/* get the file descriptor of the wayland event loop */
fd = wl_event_loop_get_fd(cdata->wl.loop);
/* create a listener for wayland main loop events */
cdata->fd_hdlr =
ecore_main_fd_handler_add(fd, (ECORE_FD_READ | ECORE_FD_ERROR),
_e_comp_wl_cb_read, cdata, NULL, NULL);
ecore_main_fd_handler_prepare_callback_set(cdata->fd_hdlr,
_e_comp_wl_cb_prepare, cdata);
e_comp_wl->wl.client_disp = ecore_wl2_display_connect(NULL);
/* setup module idler to load shell mmodule */
ecore_idler_add(_e_comp_wl_cb_module_idle, cdata);
@ -2625,9 +2597,9 @@ input_err:
e_comp_wl_data_manager_shutdown();
data_err:
comp_global_err:
e_env_unset("WAYLAND_DISPLAY");
sock_err:
wl_display_destroy(cdata->wl.disp);
/* e_env_unset("WAYLAND_DISPLAY"); */
/* sock_err: */
ecore_wl2_display_destroy(cdata->ewd);
disp_err:
free(cdata);
return EINA_FALSE;
@ -2685,6 +2657,13 @@ _e_comp_wl_gl_init(void *d EINA_UNUSED)
E_API Eina_Bool
e_comp_wl_init(void)
{
/* try to init ecore_wayland */
if (!ecore_wl2_init())
{
e_error_message_show(_("Enlightenment cannot initialize Ecore_Wl2!\n"));
return EINA_FALSE;
}
/* set gl available if we have ecore_evas support */
if (ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_WAYLAND_EGL) ||
ecore_evas_engine_type_supported_get(ECORE_EVAS_ENGINE_OPENGL_DRM))
@ -2697,15 +2676,6 @@ e_comp_wl_init(void)
return EINA_FALSE;
}
ecore_wl_server_mode_set(1);
/* try to init ecore_wayland */
if (!ecore_wl_init(NULL))
{
e_error_message_show(_("Enlightenment cannot initialize Ecore_Wayland!\n"));
return EINA_FALSE;
}
/* create hash to store clients */
/* clients_win_hash = eina_hash_int64_new(NULL); */
@ -2774,24 +2744,27 @@ e_comp_wl_shutdown(void)
/* free handlers */
E_FREE_LIST(handlers, ecore_event_handler_del);
while (e_comp_wl->wl.globals)
{
Ecore_Wl_Global *global;
/* while (e_comp_wl->wl.globals) */
/* { */
/* Ecore_Wl_Global *global; */
global =
EINA_INLIST_CONTAINER_GET(e_comp_wl->wl.globals, Ecore_Wl_Global);
/* global = */
/* EINA_INLIST_CONTAINER_GET(e_comp_wl->wl.globals, Ecore_Wl_Global); */
e_comp_wl->wl.globals =
eina_inlist_remove(e_comp_wl->wl.globals, e_comp_wl->wl.globals);
/* e_comp_wl->wl.globals = */
/* eina_inlist_remove(e_comp_wl->wl.globals, e_comp_wl->wl.globals); */
/* free(global->interface); */
/* free(global); */
/* } */
free(global->interface);
free(global);
}
if (e_comp_wl->wl.shm) wl_shm_destroy(e_comp_wl->wl.shm);
_e_comp_wl_gl_shutdown();
ecore_wl2_display_destroy(e_comp_wl->ewd);
/* shutdown ecore_wayland */
ecore_wl_shutdown();
ecore_wl2_shutdown();
}
EINTERN struct wl_resource *

View File

@ -98,11 +98,14 @@ struct _E_Comp_Wl_Subsurf_Data
struct _E_Comp_Wl_Data
{
Ecore_Wl2_Display *ewd;
struct
{
struct wl_display *disp;
Ecore_Wl2_Display *client_disp;
struct wl_registry *registry; // only used for nested wl compositors
struct wl_event_loop *loop;
/* struct wl_event_loop *loop; */
Eina_Inlist *globals; // only used for nested wl compositors
struct wl_shm *shm; // only used for nested wl compositors
Evas_GL *gl;

View File

@ -263,7 +263,6 @@ _e_comp_wl_data_device_selection_set(void *data EINA_UNUSED, E_Comp_Wl_Data_Sour
_e_comp_wl_data_device_data_offer_create(source,
data_device_res);
wl_data_device_send_selection(data_device_res, offer_res);
}
else if (data_device_res)
wl_data_device_send_selection(data_device_res, NULL);
@ -302,8 +301,10 @@ _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped)
if (e_client_has_xwindow(e_comp_wl->selection.target))
{
ecore_x_client_message32_send(e_client_util_win_get(e_comp_wl->selection.target),
ECORE_X_ATOM_XDND_DROP, ECORE_X_EVENT_MASK_NONE,
e_comp->cm_selection, 0, ecore_x_current_time_get(), 0, 0);
ECORE_X_ATOM_XDND_DROP,
ECORE_X_EVENT_MASK_NONE,
e_comp->cm_selection, 0,
ecore_x_current_time_get(), 0, 0);
}
else
#endif
@ -319,7 +320,8 @@ _e_comp_wl_data_device_drag_finished(E_Drag *drag, int dropped)
#ifndef HAVE_WAYLAND_ONLY
if (e_comp_util_has_xwayland())
{
ecore_x_selection_owner_set(0, ECORE_X_ATOM_SELECTION_XDND, ecore_x_current_time_get());
ecore_x_selection_owner_set(0, ECORE_X_ATOM_SELECTION_XDND,
ecore_x_current_time_get());
ecore_x_window_hide(e_comp->cm_selection);
}
#endif
@ -340,7 +342,8 @@ _e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resourc
DBG("Data Device Drag Start");
if ((e_comp_wl->kbd.focus) && (e_comp_wl->kbd.focus != origin_resource)) return;
if ((e_comp_wl->kbd.focus) && (e_comp_wl->kbd.focus != origin_resource))
return;
if (!(source = wl_resource_get_user_data(source_resource))) return;
e_comp_wl->drag_source = source;
@ -371,9 +374,10 @@ _e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resourc
}
evas_pointer_canvas_xy_get(e_comp->evas, &x, &y);
e_comp_wl->drag = e_drag_new(x, y,
NULL, 0, NULL, 0, NULL, _e_comp_wl_data_device_drag_finished);
e_comp_wl->drag->button_mask = evas_pointer_button_down_mask_get(e_comp->evas);
e_comp_wl->drag = e_drag_new(x, y, NULL, 0, NULL, 0, NULL,
_e_comp_wl_data_device_drag_finished);
e_comp_wl->drag->button_mask =
evas_pointer_button_down_mask_get(e_comp->evas);
if (ec)
e_drag_object_set(e_comp_wl->drag, ec->frame);
e_drag_start(e_comp_wl->drag, x, y);
@ -381,7 +385,9 @@ _e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resourc
if (e_comp_util_has_xwayland())
{
ecore_x_window_show(e_comp->cm_selection);
ecore_x_selection_owner_set(e_comp->cm_selection, ECORE_X_ATOM_SELECTION_XDND, ecore_x_current_time_get());
ecore_x_selection_owner_set(e_comp->cm_selection,
ECORE_X_ATOM_SELECTION_XDND,
ecore_x_current_time_get());
}
#endif
if (e_comp_wl->ptr.ec)
@ -441,7 +447,8 @@ _e_comp_wl_data_manager_cb_device_get(struct wl_client *client, struct wl_resour
}
eina_hash_add(e_comp_wl->mgr.data_resources, &client, res);
wl_resource_set_implementation(res, &_e_data_device_interface, e_comp->wl_comp_data,
wl_resource_set_implementation(res, &_e_data_device_interface,
e_comp->wl_comp_data,
_e_comp_wl_data_device_cb_unbind);
}
@ -469,7 +476,8 @@ _e_comp_wl_data_cb_bind_manager(struct wl_client *client, void *data EINA_UNUSED
struct wl_resource *res;
/* try to create data manager resource */
e_comp_wl->mgr.resource = res = wl_resource_create(client, &wl_data_device_manager_interface, 1, id);
e_comp_wl->mgr.resource = res =
wl_resource_create(client, &wl_data_device_manager_interface, 1, id);
if (!res)
{
ERR("Could not create data device manager: %m");
@ -658,7 +666,9 @@ e_comp_wl_data_device_send_enter(E_Client *ec)
uint32_t serial;
int x, y;
if (e_client_has_xwindow(ec) && e_client_has_xwindow(e_comp_wl->drag_client)) return;
if (e_client_has_xwindow(ec) &&
e_client_has_xwindow(e_comp_wl->drag_client))
return;
if (!e_client_has_xwindow(ec))
{
data_device_res =
@ -668,7 +678,8 @@ e_comp_wl_data_device_send_enter(E_Client *ec)
if (e_comp_wl->drag_source && (!offer_res)) return;
}
e_comp_wl->selection.target = ec;
evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_DEL, _e_comp_wl_data_device_target_del, ec);
evas_object_event_callback_add(ec->frame, EVAS_CALLBACK_DEL,
_e_comp_wl_data_device_target_del, ec);
#ifndef HAVE_WAYLAND_ONLY
if (e_client_has_xwindow(ec))
@ -703,8 +714,10 @@ e_comp_wl_data_device_send_enter(E_Client *ec)
}
ecore_x_client_message32_send(e_client_util_win_get(ec),
ECORE_X_ATOM_XDND_ENTER, ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_XDND_ENTER,
ECORE_X_EVENT_MASK_NONE,
e_comp->cm_selection, d1, d2, d3, d4);
return;
}
#endif
@ -712,7 +725,8 @@ e_comp_wl_data_device_send_enter(E_Client *ec)
y = wl_fixed_to_int(e_comp_wl->ptr.y) - e_comp_wl->selection.target->client.y;
serial = wl_display_next_serial(e_comp_wl->wl.disp);
wl_data_device_send_enter(data_device_res, serial, ec->comp_data->surface,
wl_fixed_from_int(x), wl_fixed_from_int(y), offer_res);
wl_fixed_from_int(x), wl_fixed_from_int(y),
offer_res);
}
E_API void
@ -720,15 +734,19 @@ e_comp_wl_data_device_send_leave(E_Client *ec)
{
struct wl_resource *res;
if (e_client_has_xwindow(ec) && e_client_has_xwindow(e_comp_wl->drag_client)) return;
evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_DEL, _e_comp_wl_data_device_target_del, ec);
if (e_client_has_xwindow(ec) &&
e_client_has_xwindow(e_comp_wl->drag_client))
return;
evas_object_event_callback_del_full(ec->frame, EVAS_CALLBACK_DEL,
_e_comp_wl_data_device_target_del, ec);
if (e_comp_wl->selection.target == ec)
e_comp_wl->selection.target = NULL;
#ifndef HAVE_WAYLAND_ONLY
if (e_client_has_xwindow(ec))
{
ecore_x_client_message32_send(e_client_util_win_get(ec),
ECORE_X_ATOM_XDND_LEAVE, ECORE_X_EVENT_MASK_NONE,
ECORE_X_ATOM_XDND_LEAVE,
ECORE_X_EVENT_MASK_NONE,
e_comp->cm_selection, 0, 0, 0, 0);
return;
}
@ -749,7 +767,11 @@ e_comp_wl_data_device_send_offer(E_Client *ec)
if (!data_device_res) return NULL;
source = e_comp_wl->drag_source;
if (source)
offer_res = _e_comp_wl_data_device_data_offer_create(source, data_device_res);
{
offer_res =
_e_comp_wl_data_device_data_offer_create(source, data_device_res);
}
return offer_res;
}
@ -784,7 +806,9 @@ e_comp_wl_data_device_keyboard_focus_set(void)
else if (source && e_client_has_xwindow(e_client_focused_get()))
{
/* wl -> x11 */
ecore_x_selection_owner_set(e_comp->cm_selection, ECORE_X_ATOM_SELECTION_CLIPBOARD, ecore_x_current_time_get());
ecore_x_selection_owner_set(e_comp->cm_selection,
ECORE_X_ATOM_SELECTION_CLIPBOARD,
ecore_x_current_time_get());
return;
}
} while (0);
@ -794,7 +818,11 @@ e_comp_wl_data_device_keyboard_focus_set(void)
if (!data_device_res) return;
if (source)
offer_res = _e_comp_wl_data_device_data_offer_create(source, data_device_res);
{
offer_res =
_e_comp_wl_data_device_data_offer_create(source, data_device_res);
}
wl_data_device_send_selection(data_device_res, offer_res);
}
@ -894,7 +922,8 @@ e_comp_wl_clipboard_source_create(const char *mime_type, uint32_t serial, int fd
{
if (!source->data_source.mime_types)
source->data_source.mime_types = eina_array_new(1);
eina_array_push(source->data_source.mime_types, eina_stringshare_add(mime_type));
eina_array_push(source->data_source.mime_types,
eina_stringshare_add(mime_type));
}
if (fd > 0)

View File

@ -126,10 +126,14 @@ _e_comp_wl_input_cb_keyboard_unbind(struct wl_resource *resource)
e_comp_wl->kbd.resources =
eina_list_remove(e_comp_wl->kbd.resources, resource);
EINA_LIST_FOREACH_SAFE(e_comp_wl->kbd.focused, l, ll, res)
{
if (res == resource)
{
e_comp_wl->kbd.focused =
eina_list_remove_list(e_comp_wl->kbd.focused, l);
}
}
}
void
e_comp_wl_input_keyboard_enter_send(E_Client *ec)
@ -169,8 +173,7 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r
wl_resource_get_version(resource), id);
if (!res)
{
ERR("Could not create keyboard on seat %s: %m",
e_comp_wl->seat.name);
ERR("Could not create keyboard on seat %s: %m", e_comp_wl->seat.name);
wl_client_post_no_memory(client);
return;
}
@ -187,8 +190,7 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r
/* send current keymap */
wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
e_comp_wl->xkb.fd,
e_comp_wl->xkb.size);
e_comp_wl->xkb.fd, e_comp_wl->xkb.size);
/* if the client owns the focused surface, we need to send an enter */
focused = e_client_focused_get();
@ -403,8 +405,7 @@ _e_comp_wl_input_keymap_update(struct xkb_keymap *keymap)
/* send updated keymap */
EINA_LIST_FOREACH(e_comp_wl->kbd.resources, l, res)
wl_keyboard_send_keymap(res, WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
e_comp_wl->xkb.fd,
e_comp_wl->xkb.size);
e_comp_wl->xkb.fd, e_comp_wl->xkb.size);
/* update modifiers */
e_comp_wl_input_keyboard_modifiers_update();
@ -501,18 +502,15 @@ e_comp_wl_input_keyboard_modifiers_serialize(void)
xkb_mod_mask_t mod;
xkb_layout_index_t grp;
mod = xkb_state_serialize_mods(e_comp_wl->xkb.state,
XKB_STATE_DEPRESSED);
mod = xkb_state_serialize_mods(e_comp_wl->xkb.state, XKB_STATE_DEPRESSED);
changed |= mod != e_comp_wl->kbd.mod_depressed;
e_comp_wl->kbd.mod_depressed = mod;
mod = xkb_state_serialize_mods(e_comp_wl->xkb.state,
XKB_STATE_MODS_LATCHED);
mod = xkb_state_serialize_mods(e_comp_wl->xkb.state, XKB_STATE_MODS_LATCHED);
changed |= mod != e_comp_wl->kbd.mod_latched;
e_comp_wl->kbd.mod_latched = mod;
mod = xkb_state_serialize_mods(e_comp_wl->xkb.state,
XKB_STATE_MODS_LOCKED);
mod = xkb_state_serialize_mods(e_comp_wl->xkb.state, XKB_STATE_MODS_LOCKED);
changed |= mod != e_comp_wl->kbd.mod_locked;
e_comp_wl->kbd.mod_locked = mod;

View File

@ -37,7 +37,15 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
ecore_x_pointer_ungrab();
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
ecore_wl_input_ungrab(ecore_wl_input_get());
{
Ecore_Wl2_Window *wl_win;
wl_win =
ecore_wl2_display_window_find(e_comp_wl->ewd, grab_mouse_win);
if (wl_win)
ecore_wl2_input_ungrab(ecore_wl2_window_input_get(wl_win),
wl_win, 0);
}
#endif
grab_mouse_win = 0;
}
@ -47,8 +55,17 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
if (e_comp->comp_type == E_PIXMAP_TYPE_X)
ecore_x_keyboard_ungrab();
#else
/* TODO */
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
ecore_wl_input_ungrab(ecore_wl_input_get());
{
Ecore_Wl2_Window *wl_win;
wl_win =
ecore_wl2_display_window_find(e_comp_wl->ewd, grab_key_win);
if (wl_win)
ecore_wl2_input_ungrab(ecore_wl2_window_input_get(wl_win),
wl_win, 0);
}
#endif
grab_key_win = 0;
@ -69,10 +86,12 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
Ecore_Wl_Window *wl_win;
Ecore_Wl2_Window *wl_win;
if ((wl_win = ecore_wl_window_find(mouse_win)))
ecore_wl_input_grab(ecore_wl_input_get(), wl_win, 0);
wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, mouse_win);
if (wl_win)
ecore_wl2_input_grab(ecore_wl2_window_input_get(wl_win),
wl_win, 0);
}
#endif
grab_mouse_win = mouse_win;
@ -98,10 +117,12 @@ e_grabinput_get(Ecore_Window mouse_win, int confine_mouse, Ecore_Window key_win)
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
Ecore_Wl_Window *wl_win;
Ecore_Wl2_Window *wl_win;
if ((wl_win = ecore_wl_window_find(key_win)))
ecore_wl_input_grab(ecore_wl_input_get(), wl_win, 0);
wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, key_win);
if (wl_win)
ecore_wl2_input_grab(ecore_wl2_window_input_get(wl_win),
wl_win, 0);
}
#endif
grab_key_win = key_win;
@ -122,7 +143,14 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win)
ecore_x_pointer_ungrab();
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
ecore_wl_input_ungrab(ecore_wl_input_get());
{
Ecore_Wl2_Window *wl_win;
wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, mouse_win);
if (wl_win)
ecore_wl2_input_ungrab(ecore_wl2_window_input_get(wl_win),
wl_win, 0);
}
#endif
grab_mouse_win = 0;
@ -134,7 +162,14 @@ e_grabinput_release(Ecore_Window mouse_win, Ecore_Window key_win)
ecore_x_keyboard_ungrab();
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
ecore_wl_input_ungrab(ecore_wl_input_get());
{
Ecore_Wl2_Window *wl_win;
wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, key_win);
if (wl_win)
ecore_wl2_input_grab(ecore_wl2_window_input_get(wl_win),
wl_win, 0);
}
#endif
grab_key_win = 0;
@ -192,7 +227,7 @@ static void
_e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method)
{
#ifdef HAVE_WAYLAND
Ecore_Wl_Window *wl_win;
Ecore_Wl2_Window *wl_win;
#endif
/* fprintf(stderr, "focus to %x method %i\n", win, method); */
@ -212,7 +247,7 @@ _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method)
#ifdef HAVE_WAYLAND
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
if ((wl_win = ecore_wl_window_find(win)))
if ((wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, win)))
{
/* FIXME: Need to add an ecore_wl_window_focus function */
}
@ -227,7 +262,7 @@ _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method)
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
if ((wl_win = ecore_wl_window_find(win)))
if ((wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, win)))
{
/* FIXME: Need to add an ecore_wl_window_focus function */
}
@ -242,7 +277,7 @@ _e_grabinput_focus_do(Ecore_Window win, E_Focus_Method method)
#else
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
{
if ((wl_win = ecore_wl_window_find(win)))
if ((wl_win = ecore_wl2_display_window_find(e_comp_wl->ewd, win)))
{
/* FIXME: Need to add an ecore_wl_window_focus function */
}

View File

@ -27,8 +27,12 @@ e_scale_update(void)
e_scale = (double)ecore_x_dpi_get() / (double)e_config->scale.base_dpi;
#endif
#ifdef HAVE_WAYLAND
/* FIXME: This needs to get the DPI from a given output */
if (e_comp->comp_type == E_PIXMAP_TYPE_WL)
e_scale = (double)ecore_wl_dpi_get() / (double)e_config->scale.base_dpi;
{
e_scale = (double)ecore_wl2_output_dpi_get(NULL) /
(double)e_config->scale.base_dpi;
}
#endif
if (e_scale > e_config->scale.max) e_scale = e_config->scale.max;
else if (e_scale < e_config->scale.min)

View File

@ -953,7 +953,7 @@ _wl_shot_now(E_Zone *zone, E_Client *ec, const char *params)
sh = E_CLAMP(sh, 1, ec->zone->y + ec->zone->h - y);
}
shm = e_comp_wl->wl.shm ?: ecore_wl_shm_get();
shm = e_comp_wl->wl.shm ?: ecore_wl2_display_shm_get(e_comp_wl->wl.client_disp);
EINA_LIST_FOREACH(_outputs, l, output)
{
@ -1258,31 +1258,19 @@ static Ecore_Event_Handler *wl_global_handler;
static Eina_Bool
_wl_init()
{
Eina_Inlist *globals;
Ecore_Wl_Global *global;
Eina_Iterator *itr;
Ecore_Wl2_Global *global;
struct wl_registry *reg;
void *data;
reg = e_comp_wl->wl.registry ?: ecore_wl_registry_get();
if (e_comp_wl->wl.registry)
globals = e_comp_wl->wl.globals;
else
globals = ecore_wl_globals_get();
if (!globals)
reg = e_comp_wl->wl.registry ?: ecore_wl2_display_registry_get(e_comp_wl->wl.client_disp);
itr = ecore_wl2_display_globals_get(e_comp_wl->wl.client_disp);
EINA_ITERATOR_FOREACH(itr, data)
{
if (!wl_global_handler)
{
if (e_comp_wl->wl.registry)
wl_global_handler = ecore_event_handler_add(E_EVENT_WAYLAND_GLOBAL_ADD,
(Ecore_Event_Handler_Cb)_wl_init, NULL);
else
wl_global_handler = ecore_event_handler_add(ECORE_WL_EVENT_INTERFACES_BOUND,
(Ecore_Event_Handler_Cb)_wl_init, NULL);
}
return ECORE_CALLBACK_RENEW;
}
EINA_INLIST_FOREACH(globals, global)
{
if ((!_wl_screenshooter) && (!strcmp(global->interface, "screenshooter")))
global = (Ecore_Wl2_Global *)data;
if ((!_wl_screenshooter) &&
(!strcmp(global->interface, "screenshooter")))
{
_wl_screenshooter =
wl_registry_bind(reg, global->id,
@ -1312,6 +1300,8 @@ _wl_init()
}
}
}
eina_iterator_free(itr);
return ECORE_CALLBACK_RENEW;
}
#endif

View File

@ -1,6 +1,6 @@
#include "e.h"
#include <Ecore_Fb.h>
#include <Ecore_Wayland.h>
/* #include <Ecore_Wayland.h> */
E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_FB" };
@ -39,8 +39,8 @@ e_modapi_init(E_Module *m)
e_comp_canvas_init(w, h);
e_comp->pointer = e_pointer_canvas_new(e_comp->ee, EINA_TRUE);
ecore_wl_init(NULL);
ecore_wl_server_mode_set(1);
/* ecore_wl_init(NULL); */
/* ecore_wl_server_mode_set(1); */
return m;
}

View File

@ -9,7 +9,7 @@ struct weekeyboard
{
E_Module *module;
Ecore_Evas *ee;
Ecore_Wl_Window *win;
Ecore_Wl2_Window *win;
Evas_Object *edje_obj;
const char *ee_engine;
char **ignore_keys;
@ -72,11 +72,14 @@ _wkb_commit_preedit_str(struct weekeyboard *wkb)
return;
wl_input_method_context_cursor_position(wkb->im_ctx, 0, 0);
wl_input_method_context_commit_string(wkb->im_ctx, wkb->serial, wkb->preedit_str);
wl_input_method_context_commit_string(wkb->im_ctx, wkb->serial,
wkb->preedit_str);
if (wkb->surrounding_text)
{
surrounding_text = _wkb_insert_text(wkb->surrounding_text, wkb->surrounding_cursor, wkb->preedit_str);
surrounding_text =
_wkb_insert_text(wkb->surrounding_text, wkb->surrounding_cursor,
wkb->preedit_str);
free(wkb->surrounding_text);
wkb->surrounding_text = surrounding_text;
wkb->surrounding_cursor += strlen(wkb->preedit_str);
@ -97,13 +100,16 @@ _wkb_send_preedit_str(struct weekeyboard *wkb, int cursor)
unsigned int index = strlen(wkb->preedit_str);
if (wkb->preedit_style)
wl_input_method_context_preedit_styling(wkb->im_ctx, 0, strlen(wkb->preedit_str), wkb->preedit_style);
wl_input_method_context_preedit_styling(wkb->im_ctx, 0,
strlen(wkb->preedit_str),
wkb->preedit_style);
if (cursor > 0)
index = cursor;
wl_input_method_context_preedit_cursor(wkb->im_ctx, index);
wl_input_method_context_preedit_string(wkb->im_ctx, wkb->serial, wkb->preedit_str, wkb->preedit_str);
wl_input_method_context_preedit_string(wkb->im_ctx, wkb->serial,
wkb->preedit_str, wkb->preedit_str);
}
static void
@ -185,7 +191,8 @@ _cb_wkb_on_key_down(void *data, Evas_Object *obj EINA_UNUSED, const char *emissi
{
_wkb_commit_preedit_str(wkb);
wl_input_method_context_keysym(wkb->im_ctx, wkb->serial, 0,
XKB_KEY_Return, WL_KEYBOARD_KEY_STATE_PRESSED, 0);
XKB_KEY_Return,
WL_KEYBOARD_KEY_STATE_PRESSED, 0);
goto end;
}
else if (eina_streq(key, "space"))
@ -213,12 +220,14 @@ _wkb_ui_setup(struct weekeyboard *wkb)
if (!wkb->edje_obj)
{
Evas *evas;
ecore_evas_alpha_set(wkb->ee, EINA_TRUE);
ecore_evas_title_set(wkb->ee, "Weekeyboard");
evas = ecore_evas_get(wkb->ee);
wkb->edje_obj = edje_object_add(evas);
edje_object_signal_callback_add(wkb->edje_obj, "key_down", "*", _cb_wkb_on_key_down, wkb);
edje_object_signal_callback_add(wkb->edje_obj, "key_down", "*",
_cb_wkb_on_key_down, wkb);
}
// hard coded
@ -232,7 +241,7 @@ _wkb_ui_setup(struct weekeyboard *wkb)
if (eina_streq(wkb->theme, "default"))
{
ecore_wl_screen_size_get(&w, &h);
ecore_wl2_display_screen_size_get(e_comp_wl->ewd, &w, &h);
DBG("Screen size: w=%d, h=%d", w, h);
if (w >= 1080)
w = 1080;
@ -244,7 +253,8 @@ _wkb_ui_setup(struct weekeyboard *wkb)
DBG("Using default_%d theme", w);
}
snprintf(path, PATH_MAX, "%s/%s_%d.edj", e_module_dir_get(wkb->module), wkb->theme, w);
snprintf(path, PATH_MAX, "%s/%s_%d.edj",
e_module_dir_get(wkb->module), wkb->theme, w);
INF("Loading edje file: '%s'", path);
if (!edje_object_file_set(wkb->edje_obj, path, "main"))
@ -277,8 +287,9 @@ _wkb_ui_setup(struct weekeyboard *wkb)
{
int rx, ry, rw, rh;
edje_object_part_geometry_get(wkb->edje_obj, "background", &rx, &ry, &rw, &rh);
ecore_wl_window_input_region_set(wkb->win, rx, ry, rw, rh);
edje_object_part_geometry_get(wkb->edje_obj, "background",
&rx, &ry, &rw, &rh);
ecore_wl2_window_input_region_set(wkb->win, rx, ry, rw, rh);
}
ignore_keys = edje_file_data_get(path, "ignore-keys");
@ -304,7 +315,8 @@ _wkb_im_ctx_surrounding_text(void *data, struct wl_input_method_context *im_ctx,
EINA_SAFETY_ON_NULL_RETURN(text);
DBG("im_context = %p text = '%s' cursor = %d anchor = %d", im_ctx, text, cursor, anchor);
DBG("im_context = %p text = '%s' cursor = %d anchor = %d",
im_ctx, text, cursor, anchor);
free(wkb->surrounding_text);
@ -390,7 +402,8 @@ _wkb_im_ctx_commit_state(void *data, struct wl_input_method_context *im_ctx, uin
wkb->serial = serial;
wl_input_method_context_language(im_ctx, wkb->serial, "en");
wl_input_method_context_text_direction(im_ctx, wkb->serial, WL_TEXT_INPUT_TEXT_DIRECTION_LTR);
wl_input_method_context_text_direction(im_ctx, wkb->serial,
WL_TEXT_INPUT_TEXT_DIRECTION_LTR);
}
static void
@ -451,7 +464,8 @@ _wkb_im_activate(void *data, struct wl_input_method *input_method EINA_UNUSED, s
/* hard coded */
wl_input_method_context_language(im_ctx, wkb->serial, "en");
wl_input_method_context_text_direction(im_ctx, wkb->serial, WL_TEXT_INPUT_TEXT_DIRECTION_LTR);
wl_input_method_context_text_direction(im_ctx, wkb->serial,
WL_TEXT_INPUT_TEXT_DIRECTION_LTR);
wkb->context_changed = EINA_TRUE;
evas_object_show(wkb->edje_obj);
@ -478,32 +492,41 @@ static const struct wl_input_method_listener wkb_im_listener = {
static Eina_Bool
_wkb_setup(struct weekeyboard *wkb)
{
Eina_Inlist *globals;
Eina_Iterator *itr;
Ecore_Wl2_Global *global;
struct wl_registry *registry;
Ecore_Wl_Global *global;
struct wl_input_panel_surface *ips;
void *data;
globals = ecore_wl_globals_get();
registry = ecore_wl_registry_get();
EINA_INLIST_FOREACH(globals, global)
registry = e_comp_wl->wl.registry ?: ecore_wl2_display_registry_get(e_comp_wl->ewd);
itr = ecore_wl2_display_globals_get(e_comp_wl->ewd);
EINA_ITERATOR_FOREACH(itr, data)
{
global = (Ecore_Wl2_Global *)data;
DBG("interface: <%s>", global->interface);
if (eina_streq(global->interface, "wl_input_panel"))
{
wkb->ip = wl_registry_bind(registry, global->id, &wl_input_panel_interface, 1);
wkb->ip =
wl_registry_bind(registry, global->id,
&wl_input_panel_interface, 1);
DBG("binding wl_input_panel");
}
else if (eina_streq(global->interface, "wl_input_method"))
{
wkb->im = wl_registry_bind(registry, global->id, &wl_input_method_interface, 1);
wkb->im =
wl_registry_bind(registry, global->id,
&wl_input_method_interface, 1);
DBG("binding wl_input_method, id = %d", global->id);
}
else if (eina_streq(global->interface, "wl_output"))
{
wkb->output = wl_registry_bind(registry, global->id, &wl_output_interface, 1);
wkb->output =
wl_registry_bind(registry, global->id, &wl_output_interface, 1);
DBG("binding wl_output");
}
}
eina_iterator_free(itr);
if ((!wkb->ip) || (!wkb->im) || (!wkb->output))
return EINA_FALSE;
@ -513,11 +536,14 @@ _wkb_setup(struct weekeyboard *wkb)
/* Set input panel surface */
DBG("Setting up input panel");
wkb->win = ecore_evas_wayland_window_get(wkb->ee);
ecore_wl_window_type_set(wkb->win, ECORE_WL_WINDOW_TYPE_NONE);
wkb->surface = ecore_wl_window_surface_create(wkb->win);
wkb->win = ecore_evas_wayland_window_get2(wkb->ee);
ecore_wl2_window_type_set(wkb->win, ECORE_WL2_WINDOW_TYPE_NONE);
wkb->surface = ecore_wl2_window_surface_get(wkb->win);
ips = wl_input_panel_get_input_panel_surface(wkb->ip, wkb->surface);
wl_input_panel_surface_set_toplevel(ips, wkb->output, WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
wl_input_panel_surface_set_toplevel(ips, wkb->output,
WL_INPUT_PANEL_SURFACE_POSITION_CENTER_BOTTOM);
/* Input method listener */
DBG("Adding wl_input_method listener");