wayland: Remove a lot of E_Comp_Data pointers

Summary: We should just use e_comp->wl_comp_data everywhere we can.

Reviewers: devilhorns, zmike

Reviewed By: zmike

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2507
devs/stefan/wl-session-recovery
Derek Foreman 8 years ago committed by Chris Michael
parent 20871a1e8f
commit 7f6f4b6966
  1. 46
      src/bin/e_comp_wl.c
  2. 75
      src/bin/e_comp_wl_data.c
  3. 6
      src/bin/e_comp_wl_data.h
  4. 102
      src/bin/e_comp_wl_input.c
  5. 12
      src/bin/e_comp_wl_input.h
  6. 94
      src/modules/wl_desktop_shell/e_mod_main.c
  7. 2
      src/modules/wl_drm/e_mod_main.c

@ -51,37 +51,26 @@ _e_comp_wl_log_cb_print(const char *format, va_list args)
}
static Eina_Bool
_e_comp_wl_cb_read(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
_e_comp_wl_cb_read(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED)
{
E_Comp_Data *cdata;
if (!(cdata = data)) return ECORE_CALLBACK_RENEW;
/* dispatch pending wayland events */
wl_event_loop_dispatch(cdata->wl.loop, 0);
wl_event_loop_dispatch(e_comp->wl_comp_data->wl.loop, 0);
return ECORE_CALLBACK_RENEW;
}
static void
_e_comp_wl_cb_prepare(void *data, Ecore_Fd_Handler *hdlr EINA_UNUSED)
_e_comp_wl_cb_prepare(void *data EINA_UNUSED, Ecore_Fd_Handler *hdlr EINA_UNUSED)
{
E_Comp_Data *cdata;
if (!(cdata = data)) return;
/* flush pending client events */
wl_display_flush_clients(cdata->wl.disp);
wl_display_flush_clients(e_comp->wl_comp_data->wl.disp);
}
static Eina_Bool
_e_comp_wl_cb_module_idle(void *data)
_e_comp_wl_cb_module_idle(void *data EINA_UNUSED)
{
E_Comp_Data *cdata;
E_Module *mod = NULL;
if (!(cdata = data)) return ECORE_CALLBACK_RENEW;
/* check if we are still loading modules */
if (e_module_loading_get()) return ECORE_CALLBACK_RENEW;
@ -511,7 +500,7 @@ _e_comp_wl_evas_cb_focus_in(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
/* update keyboard modifier state */
wl_array_for_each(k, &e_comp->wl_comp_data->kbd.keys)
e_comp_wl_input_keyboard_state_update(e_comp->wl_comp_data, *k, EINA_TRUE);
e_comp_wl_input_keyboard_state_update(*k, EINA_TRUE);
e_comp_wl_input_keyboard_enter_send(ec);
}
@ -532,7 +521,7 @@ _e_comp_wl_evas_cb_focus_out(void *data, Evas *evas EINA_UNUSED, Evas_Object *ob
/* update keyboard modifier state */
wl_array_for_each(k, &cdata->kbd.keys)
e_comp_wl_input_keyboard_state_update(cdata, *k, EINA_FALSE);
e_comp_wl_input_keyboard_state_update(*k, EINA_FALSE);
if (e_object_is_del(E_OBJECT(ec))) return;
@ -894,7 +883,7 @@ _e_comp_wl_cb_key_down(void *event)
if ((ec = e_client_focused_get()))
{
/* update modifier state */
e_comp_wl_input_keyboard_state_update(cdata, keycode, EINA_TRUE);
e_comp_wl_input_keyboard_state_update(keycode, EINA_TRUE);
if (ec->comp_data->surface)
{
@ -918,7 +907,7 @@ _e_comp_wl_cb_key_down(void *event)
if (cdata->kbd.mod_changed)
{
e_comp_wl_input_keyboard_modifiers_update(cdata);
e_comp_wl_input_keyboard_modifiers_update();
cdata->kbd.mod_changed = 0;
}
}
@ -942,7 +931,7 @@ _e_comp_wl_cb_key_up(void *event)
cdata->kbd.keys.size = (const char *)end - (const char *)cdata->kbd.keys.data;
/* update modifier state */
e_comp_wl_input_keyboard_state_update(cdata, keycode, EINA_FALSE);
e_comp_wl_input_keyboard_state_update(keycode, EINA_FALSE);
if ((ec = e_client_focused_get()))
{
@ -968,7 +957,7 @@ _e_comp_wl_cb_key_up(void *event)
if (cdata->kbd.mod_changed)
{
e_comp_wl_input_keyboard_modifiers_update(cdata);
e_comp_wl_input_keyboard_modifiers_update();
cdata->kbd.mod_changed = 0;
}
}
@ -1614,13 +1603,12 @@ _e_comp_wl_compositor_cb_bind(struct wl_client *client, void *data EINA_UNUSED,
}
static void
_e_comp_wl_compositor_cb_del(E_Comp *comp)
_e_comp_wl_compositor_cb_del(void *data EINA_UNUSED)
{
E_Comp_Data *cdata;
E_Comp_Wl_Output *output;
/* get existing compositor data */
if (!(cdata = comp->wl_comp_data)) return;
cdata = e_comp->wl_comp_data;
EINA_LIST_FREE(cdata->outputs, output)
{
@ -2263,7 +2251,7 @@ _e_comp_wl_client_cb_focus_set(void *data EINA_UNUSED, E_Client *ec)
if (e_comp->wl_comp_data->kbd.focus != ec->comp_data->surface)
{
e_comp->wl_comp_data->kbd.focus = ec->comp_data->surface;
e_comp_wl_data_device_keyboard_focus_set(e_comp->wl_comp_data);
e_comp_wl_data_device_keyboard_focus_set();
}
}
@ -2462,14 +2450,14 @@ _e_comp_wl_compositor_create(void)
/* _e_comp_wl_cb_randr_change(NULL, 0, NULL); */
/* try to init data manager */
if (!e_comp_wl_data_manager_init(cdata))
if (!e_comp_wl_data_manager_init())
{
ERR("Could not initialize data manager");
goto data_err;
}
/* try to init input */
if (!e_comp_wl_input_init(cdata))
if (!e_comp_wl_input_init())
{
ERR("Could not initialize input");
goto input_err;
@ -2543,7 +2531,7 @@ _e_comp_wl_compositor_create(void)
return EINA_TRUE;
input_err:
e_comp_wl_data_manager_shutdown(cdata);
e_comp_wl_data_manager_shutdown();
data_err:
comp_global_err:
e_env_unset("WAYLAND_DISPLAY");

@ -166,10 +166,7 @@ _e_comp_wl_data_device_destroy_selection_data_source(struct wl_listener *listene
if (!(source = (E_Comp_Wl_Data_Source*)data))
return;
if (!(cdata = container_of(listener, E_Comp_Data,
selection.data_source_listener)))
return;
cdata = e_comp->wl_comp_data;
cdata->selection.data_source = NULL;
if (cdata->kbd.enabled)
@ -226,11 +223,13 @@ _e_comp_wl_data_device_data_offer_create(E_Comp_Wl_Data_Source *source, struct w
}
static void
_e_comp_wl_data_device_selection_set(E_Comp_Data *cdata, E_Comp_Wl_Data_Source *source, uint32_t serial)
_e_comp_wl_data_device_selection_set(void *data EINA_UNUSED, E_Comp_Wl_Data_Source *source, uint32_t serial)
{
E_Comp_Wl_Data_Source *sel_source;
E_Comp_Data *cdata;
struct wl_resource *offer_res, *data_device_res, *focus = NULL;
cdata = e_comp->wl_comp_data;
sel_source = (E_Comp_Wl_Data_Source*)cdata->selection.data_source;
if ((sel_source) &&
@ -289,7 +288,7 @@ _e_comp_wl_data_device_selection_set(E_Comp_Data *cdata, E_Comp_Wl_Data_Source *
}
static void
_e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resource *resource, struct wl_resource *source_resource, struct wl_resource *origin_resource, struct wl_resource *icon_resource, uint32_t serial)
_e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resource *resource EINA_UNUSED, struct wl_resource *source_resource, struct wl_resource *origin_resource, struct wl_resource *icon_resource, uint32_t serial)
{
E_Comp_Data *cdata;
E_Comp_Wl_Data_Source *source;
@ -298,7 +297,7 @@ _e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resourc
DBG("Data Device Drag Start");
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata = e_comp->wl_comp_data;
if ((cdata->kbd.focus) && (cdata->kbd.focus != origin_resource)) return;
if (!(source = wl_resource_get_user_data(source_resource))) return;
@ -325,14 +324,12 @@ _e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resourc
static void
_e_comp_wl_data_device_cb_selection_set(struct wl_client *client EINA_UNUSED, struct wl_resource *resource EINA_UNUSED, struct wl_resource *source_resource, uint32_t serial)
{
E_Comp_Data *cdata;
E_Comp_Wl_Data_Source *source;
if (!source_resource) return;
if (!(cdata = wl_resource_get_user_data(resource))) return;
if (!(source = wl_resource_get_user_data(source_resource))) return;
_e_comp_wl_data_device_selection_set(cdata, source, serial);
_e_comp_wl_data_device_selection_set(e_comp->wl_comp_data, source, serial);
}
static void
@ -351,13 +348,8 @@ static const struct wl_data_device_interface _e_data_device_interface =
static void
_e_comp_wl_data_device_cb_unbind(struct wl_resource *resource)
{
E_Comp_Data *cdata;
if(!(cdata = wl_resource_get_user_data(resource)))
return;
cdata->mgr.data_resources =
eina_list_remove(cdata->mgr.data_resources, resource);
e_comp->wl_comp_data->mgr.data_resources =
eina_list_remove(e_comp->wl_comp_data->mgr.data_resources, resource);
}
static void
@ -395,15 +387,14 @@ _e_comp_wl_data_manager_cb_source_create(struct wl_client *client EINA_UNUSED, s
}
static void
_e_comp_wl_data_manager_cb_device_get(struct wl_client *client, struct wl_resource *manager_resource, uint32_t id, struct wl_resource *seat_resource)
_e_comp_wl_data_manager_cb_device_get(struct wl_client *client, struct wl_resource *manager_resource, uint32_t id, struct wl_resource *seat_resource EINA_UNUSED)
{
E_Comp_Data *cdata;
struct wl_resource *res;
/* DBG("Data Manager Device Get"); */
/* try to get the compositor data */
if (!(cdata = wl_resource_get_user_data(seat_resource))) return;
cdata = e_comp->wl_comp_data;
/* try to create the data device resource */
res = wl_resource_create(client, &wl_data_device_interface, 1, id);
@ -439,13 +430,10 @@ static const struct wl_data_device_manager_interface _e_manager_interface =
/* } */
static void
_e_comp_wl_data_cb_bind_manager(struct wl_client *client, void *data, uint32_t version EINA_UNUSED, uint32_t id)
_e_comp_wl_data_cb_bind_manager(struct wl_client *client, void *data EINA_UNUSED, uint32_t version EINA_UNUSED, uint32_t id)
{
E_Comp_Data *cdata;
struct wl_resource *res;
cdata = data;
/* try to create data manager resource */
res = wl_resource_create(client, &wl_data_device_manager_interface, 1, id);
if (!res)
@ -455,7 +443,8 @@ _e_comp_wl_data_cb_bind_manager(struct wl_client *client, void *data, uint32_t v
return;
}
wl_resource_set_implementation(res, &_e_manager_interface, cdata, NULL);
wl_resource_set_implementation(res, &_e_manager_interface,
e_comp->wl_comp_data, NULL);
}
static void
@ -527,14 +516,15 @@ _e_comp_wl_clipboard_offer_create(E_Comp_Wl_Clipboard_Source* source, int fd)
}
static Eina_Bool
_e_comp_wl_clipboard_source_save(void *data, Ecore_Fd_Handler *handler)
_e_comp_wl_clipboard_source_save(void *data EINA_UNUSED, Ecore_Fd_Handler *handler)
{
E_Comp_Data *cdata;
E_Comp_Wl_Clipboard_Source *source;
char *p;
int len, size;
if (!(cdata = data)) return ECORE_CALLBACK_CANCEL;
cdata = e_comp->wl_comp_data;
if (!(source = (E_Comp_Wl_Clipboard_Source*)cdata->clipboard.source))
return ECORE_CALLBACK_CANCEL;
@ -629,7 +619,7 @@ _e_comp_wl_clipboard_source_create(E_Comp_Data *cdata, const char *mime_type, ui
}
static void
_e_comp_wl_clipboard_selection_set(struct wl_listener *listener EINA_UNUSED, void *data)
_e_comp_wl_clipboard_selection_set(struct wl_listener *listener EINA_UNUSED, void *data EINA_UNUSED)
{
E_Comp_Data *cdata;
E_Comp_Wl_Data_Source *sel_source;
@ -637,7 +627,7 @@ _e_comp_wl_clipboard_selection_set(struct wl_listener *listener EINA_UNUSED, voi
int p[2];
char *mime_type;
cdata = data;
cdata = e_comp->wl_comp_data;
sel_source = (E_Comp_Wl_Data_Source*) cdata->selection.data_source;
clip_source = (E_Comp_Wl_Clipboard_Source*) cdata->clipboard.source;
@ -678,18 +668,24 @@ _e_comp_wl_clipboard_destroy(E_Comp_Data *cdata)
}
static void
_e_comp_wl_clipboard_create(E_Comp_Data *cdata)
_e_comp_wl_clipboard_create(void)
{
E_Comp_Data *cdata;
cdata = e_comp->wl_comp_data;
cdata->clipboard.listener.notify = _e_comp_wl_clipboard_selection_set;
wl_signal_add(&cdata->selection.signal, &cdata->clipboard.listener);
}
EINTERN void
e_comp_wl_data_device_keyboard_focus_set(E_Comp_Data *cdata)
e_comp_wl_data_device_keyboard_focus_set(void)
{
E_Comp_Data *cdata;
struct wl_resource *data_device_res, *offer_res, *focus;
E_Comp_Wl_Data_Source *source;
cdata = e_comp->wl_comp_data;
if (!cdata->kbd.enabled)
{
ERR("Keyboard not enabled");
@ -723,14 +719,11 @@ e_comp_wl_data_device_keyboard_focus_set(E_Comp_Data *cdata)
}
EINTERN Eina_Bool
e_comp_wl_data_manager_init(E_Comp_Data *cdata)
e_comp_wl_data_manager_init(void)
{
/* check for valid compositor data */
if (!cdata)
{
ERR("No Compositor Data");
return EINA_FALSE;
}
E_Comp_Data *cdata;
cdata = e_comp->wl_comp_data;
/* try to create global data manager */
cdata->mgr.global =
@ -745,16 +738,16 @@ e_comp_wl_data_manager_init(E_Comp_Data *cdata)
wl_signal_init(&cdata->selection.signal);
/* create clipboard */
_e_comp_wl_clipboard_create(cdata);
_e_comp_wl_clipboard_create();
return EINA_TRUE;
}
EINTERN void
e_comp_wl_data_manager_shutdown(E_Comp_Data *cdata)
e_comp_wl_data_manager_shutdown(void)
{
/* destroy the global manager resource */
/* if (cdata->mgr.global) wl_global_destroy(cdata->mgr.global); */
_e_comp_wl_clipboard_destroy(cdata);
_e_comp_wl_clipboard_destroy(e_comp->wl_comp_data);
}

@ -51,9 +51,9 @@ struct _E_Comp_Wl_Clipboard_Offer
size_t offset;
};
EINTERN void e_comp_wl_data_device_keyboard_focus_set(E_Comp_Data *cdata);
EINTERN Eina_Bool e_comp_wl_data_manager_init(E_Comp_Data *cdata);
EINTERN void e_comp_wl_data_manager_shutdown(E_Comp_Data *cdata);
EINTERN void e_comp_wl_data_device_keyboard_focus_set(void);
EINTERN Eina_Bool e_comp_wl_data_manager_init(void);
EINTERN void e_comp_wl_data_manager_shutdown(void);
# endif
#endif

@ -4,12 +4,15 @@
#include <sys/mman.h>
static void
_e_comp_wl_input_update_seat_caps(E_Comp_Data *cdata)
_e_comp_wl_input_update_seat_caps(void)
{
E_Comp_Data *cdata;
Eina_List *l;
struct wl_resource *res;
enum wl_seat_capability caps = 0;
cdata = e_comp->wl_comp_data;
if (cdata->ptr.enabled)
caps |= WL_SEAT_CAPABILITY_POINTER;
if (cdata->kbd.enabled)
@ -34,8 +37,7 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou
E_Client *ec;
Eina_Bool got_mouse = EINA_FALSE;
/* get compositor data */
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata = e_comp->wl_comp_data;
E_CLIENT_FOREACH(ec)
{
if (!ec->comp_data->surface) continue;
@ -92,9 +94,7 @@ _e_comp_wl_input_cb_pointer_unbind(struct wl_resource *resource)
{
E_Comp_Data *cdata;
/* get compositor data */
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata = e_comp->wl_comp_data;
cdata->ptr.resources = eina_list_remove(cdata->ptr.resources, resource);
}
@ -104,8 +104,7 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re
E_Comp_Data *cdata;
struct wl_resource *res;
/* get compositor data */
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata = e_comp->wl_comp_data;
/* try to create pointer resource */
res = wl_resource_create(client, &wl_pointer_interface,
@ -127,9 +126,7 @@ _e_comp_wl_input_cb_keyboard_unbind(struct wl_resource *resource)
{
E_Comp_Data *cdata;
/* get compositor data */
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata = e_comp->wl_comp_data;
cdata->kbd.resources = eina_list_remove(cdata->kbd.resources, resource);
}
@ -145,7 +142,7 @@ e_comp_wl_input_keyboard_enter_send(E_Client *ec)
if (!eina_list_count(e_comp->wl_comp_data->kbd.resources)) return;
e_comp_wl_input_keyboard_modifiers_serialize(e_comp->wl_comp_data);
e_comp_wl_input_keyboard_modifiers_serialize();
wc = wl_resource_get_client(ec->comp_data->surface);
serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp);
@ -170,8 +167,7 @@ _e_comp_wl_input_cb_keyboard_get(struct wl_client *client, struct wl_resource *r
E_Comp_Data *cdata;
struct wl_resource *res;
/* get compositor data */
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata = e_comp->wl_comp_data;
/* try to create keyboard resource */
res = wl_resource_create(client, &wl_keyboard_interface,
@ -204,9 +200,7 @@ _e_comp_wl_input_cb_touch_unbind(struct wl_resource *resource)
{
E_Comp_Data *cdata;
/* get compositor data */
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata = e_comp->wl_comp_data;
cdata->touch.resources = eina_list_remove(cdata->touch.resources, resource);
}
@ -216,8 +210,7 @@ _e_comp_wl_input_cb_touch_get(struct wl_client *client EINA_UNUSED, struct wl_re
E_Comp_Data *cdata;
struct wl_resource *res;
/* get compositor data */
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata = e_comp->wl_comp_data;
/* try to create pointer resource */
res = wl_resource_create(client, &wl_touch_interface,
@ -246,19 +239,17 @@ _e_comp_wl_input_cb_unbind_seat(struct wl_resource *resource)
{
E_Comp_Data *cdata;
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata = e_comp->wl_comp_data;
cdata->seat.resources = eina_list_remove(cdata->seat.resources, resource);
}
static void
_e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
_e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data EINA_UNUSED, uint32_t version, uint32_t id)
{
E_Comp_Data *cdata;
struct wl_resource *res;
/* try to create the seat resource */
cdata = data;
cdata = e_comp->wl_comp_data;
res = wl_resource_create(client, &wl_seat_interface, MIN(version, 4), id);
if (!res)
{
@ -273,7 +264,7 @@ _e_comp_wl_input_cb_bind_seat(struct wl_client *client, void *data, uint32_t ver
wl_resource_set_implementation(res, &_e_seat_interface, cdata,
_e_comp_wl_input_cb_unbind_seat);
_e_comp_wl_input_update_seat_caps(cdata);
_e_comp_wl_input_update_seat_caps();
if (cdata->seat.version >= WL_SEAT_NAME_SINCE_VERSION)
wl_seat_send_name(res, cdata->seat.name);
}
@ -326,14 +317,16 @@ _e_comp_wl_input_keymap_fd_get(off_t size)
}
static void
_e_comp_wl_input_keymap_update(E_Comp_Data *cdata, struct xkb_keymap *keymap)
_e_comp_wl_input_keymap_update(struct xkb_keymap *keymap)
{
char *tmp;
xkb_mod_mask_t latched = 0, locked = 0, group = 0;
struct wl_resource *res;
Eina_List *l;
uint32_t serial;
E_Comp_Data *cdata;
cdata = e_comp->wl_comp_data;
/* unreference any existing keymap */
if (cdata->xkb.keymap) xkb_map_unref(cdata->xkb.keymap);
@ -404,7 +397,7 @@ _e_comp_wl_input_keymap_update(E_Comp_Data *cdata, struct xkb_keymap *keymap)
cdata->xkb.fd, cdata->xkb.size);
/* update modifiers */
e_comp_wl_input_keyboard_modifiers_update(cdata);
e_comp_wl_input_keyboard_modifiers_update();
if ((!latched) && (!locked)) return;
@ -417,14 +410,11 @@ _e_comp_wl_input_keymap_update(E_Comp_Data *cdata, struct xkb_keymap *keymap)
}
EINTERN Eina_Bool
e_comp_wl_input_init(E_Comp_Data *cdata)
e_comp_wl_input_init(void)
{
/* check for valid compositor data */
if (!cdata)
{
ERR("No compositor data");
return EINA_FALSE;
}
E_Comp_Data *cdata;
cdata = e_comp->wl_comp_data;
/* set default seat name */
if (!cdata->seat.name) cdata->seat.name = "default";
@ -447,16 +437,12 @@ e_comp_wl_input_init(E_Comp_Data *cdata)
}
EINTERN void
e_comp_wl_input_shutdown(E_Comp_Data *cdata)
e_comp_wl_input_shutdown(void)
{
struct wl_resource *res;
E_Comp_Data *cdata;
/* check for valid compositor data */
if (!cdata)
{
ERR("No compositor data");
return;
}
cdata = e_comp->wl_comp_data;
/* destroy pointer resources */
EINA_LIST_FREE(cdata->ptr.resources, res)
@ -506,8 +492,12 @@ e_comp_wl_input_keyboard_check(struct wl_resource *res)
}
EINTERN void
e_comp_wl_input_keyboard_modifiers_serialize(E_Comp_Data *cdata)
e_comp_wl_input_keyboard_modifiers_serialize(void)
{
E_Comp_Data *cdata;
cdata = e_comp->wl_comp_data;
cdata->kbd.mod_depressed =
xkb_state_serialize_mods(cdata->xkb.state, XKB_STATE_DEPRESSED);
cdata->kbd.mod_latched =
@ -519,13 +509,15 @@ e_comp_wl_input_keyboard_modifiers_serialize(E_Comp_Data *cdata)
}
EINTERN void
e_comp_wl_input_keyboard_modifiers_update(E_Comp_Data *cdata)
e_comp_wl_input_keyboard_modifiers_update(void)
{
uint32_t serial;
struct wl_resource *res;
Eina_List *l;
E_Comp_Data *cdata;
e_comp_wl_input_keyboard_modifiers_serialize(cdata);
cdata = e_comp->wl_comp_data;
e_comp_wl_input_keyboard_modifiers_serialize();
if (!eina_list_count(cdata->kbd.resources)) return;
@ -539,10 +531,12 @@ e_comp_wl_input_keyboard_modifiers_update(E_Comp_Data *cdata)
}
EINTERN void
e_comp_wl_input_keyboard_state_update(E_Comp_Data *cdata, uint32_t keycode, Eina_Bool pressed)
e_comp_wl_input_keyboard_state_update(uint32_t keycode, Eina_Bool pressed)
{
enum xkb_key_direction dir;
E_Comp_Data *cdata;
cdata = e_comp->wl_comp_data;
if (!cdata->xkb.state) return;
if (pressed) dir = XKB_KEY_DOWN;
@ -563,7 +557,7 @@ e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled)
}
e_comp->wl_comp_data->ptr.enabled = !!enabled;
_e_comp_wl_input_update_seat_caps(e_comp->wl_comp_data);
_e_comp_wl_input_update_seat_caps();
}
E_API void
@ -577,21 +571,17 @@ e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled)
}
e_comp->wl_comp_data->kbd.enabled = !!enabled;
_e_comp_wl_input_update_seat_caps(e_comp->wl_comp_data);
_e_comp_wl_input_update_seat_caps();
}
E_API void
e_comp_wl_input_keymap_set(E_Comp_Data *cdata, const char *rules, const char *model, const char *layout)
e_comp_wl_input_keymap_set(const char *rules, const char *model, const char *layout)
{
struct xkb_keymap *keymap;
struct xkb_rule_names names;
E_Comp_Data *cdata;
/* check for valid compositor data */
if (!cdata)
{
ERR("No compositor data");
return;
}
cdata = e_comp->wl_comp_data;
/* DBG("COMP_WL: Keymap Set: %s %s %s", rules, model, layout); */
@ -611,7 +601,7 @@ e_comp_wl_input_keymap_set(E_Comp_Data *cdata, const char *rules, const char *mo
keymap = xkb_map_new_from_names(cdata->xkb.context, &names, 0);
/* update compositor keymap */
_e_comp_wl_input_keymap_update(cdata, keymap);
_e_comp_wl_input_keymap_update(keymap);
/* cleanup */
free((char *)names.rules);
@ -630,7 +620,7 @@ e_comp_wl_input_touch_enabled_set(Eina_Bool enabled)
}
e_comp->wl_comp_data->touch.enabled = !!enabled;
_e_comp_wl_input_update_seat_caps(e_comp->wl_comp_data);
_e_comp_wl_input_update_seat_caps();
}
EINTERN Eina_Bool

@ -3,22 +3,22 @@
# ifndef E_COMP_WL_INPUT_H
# define E_COMP_WL_INPUT_H
EINTERN Eina_Bool e_comp_wl_input_init(E_Comp_Data *cdata);
EINTERN void e_comp_wl_input_shutdown(E_Comp_Data *cdata);
EINTERN Eina_Bool e_comp_wl_input_init(void);
EINTERN void e_comp_wl_input_shutdown(void);
EINTERN Eina_Bool e_comp_wl_input_pointer_check(struct wl_resource *res);
EINTERN Eina_Bool e_comp_wl_input_keyboard_check(struct wl_resource *res);
EINTERN Eina_Bool e_comp_wl_input_touch_check(struct wl_resource *res);
EINTERN void e_comp_wl_input_keyboard_modifiers_serialize(E_Comp_Data *cdata);
EINTERN void e_comp_wl_input_keyboard_modifiers_update(E_Comp_Data *cdata);
EINTERN void e_comp_wl_input_keyboard_state_update(E_Comp_Data *cdata, uint32_t keycode, Eina_Bool pressed);
EINTERN void e_comp_wl_input_keyboard_modifiers_serialize(void);
EINTERN void e_comp_wl_input_keyboard_modifiers_update(void);
EINTERN void e_comp_wl_input_keyboard_state_update(uint32_t keycode, Eina_Bool pressed);
EINTERN void e_comp_wl_input_keyboard_enter_send(E_Client *client);
E_API void e_comp_wl_input_pointer_enabled_set(Eina_Bool enabled);
E_API void e_comp_wl_input_keyboard_enabled_set(Eina_Bool enabled);
E_API void e_comp_wl_input_touch_enabled_set(Eina_Bool enabled);
E_API void e_comp_wl_input_keymap_set(E_Comp_Data *cdata, const char *rules, const char *model, const char *layout);
E_API void e_comp_wl_input_keymap_set(const char *rules, const char *model, const char *layout);
# endif
#endif

@ -140,7 +140,7 @@ _e_shell_surface_cb_pong(struct wl_client *client EINA_UNUSED, struct wl_resourc
}
static void
_e_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial EINA_UNUSED)
_e_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource EINA_UNUSED, uint32_t serial EINA_UNUSED)
{
E_Client *ec;
E_Comp_Data *cdata;
@ -157,15 +157,7 @@ _e_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_resourc
if ((ec->maximized) || (ec->fullscreen)) return;
/* get compositor data from seat */
if (!(cdata = wl_resource_get_user_data(seat_resource)))
{
wl_resource_post_error(seat_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"No Comp_Data for Seat");
return;
}
cdata = e_comp->wl_comp_data;
switch (cdata->ptr.button)
{
case BTN_LEFT:
@ -191,7 +183,7 @@ _e_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_resourc
}
static void
_e_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial EINA_UNUSED, uint32_t edges)
_e_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource EINA_UNUSED, uint32_t serial EINA_UNUSED, uint32_t edges)
{
E_Client *ec;
E_Comp_Data *cdata;
@ -211,14 +203,7 @@ _e_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resou
if ((ec->maximized) || (ec->fullscreen)) return;
/* get compositor data from seat */
if (!(cdata = wl_resource_get_user_data(seat_resource)))
{
wl_resource_post_error(seat_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"No Comp_Data for Seat");
return;
}
cdata = e_comp->wl_comp_data;
DBG("Comp Resize Edges Set: %d", edges);
@ -734,7 +719,7 @@ _e_xdg_shell_surface_cb_window_menu_show(struct wl_client *client EINA_UNUSED, s
}
static void
_e_xdg_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial EINA_UNUSED)
_e_xdg_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource EINA_UNUSED, uint32_t serial EINA_UNUSED)
{
E_Client *ec;
E_Comp_Data *cdata;
@ -751,15 +736,7 @@ _e_xdg_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_res
if ((ec->maximized) || (ec->fullscreen)) return;
/* get compositor data from seat */
if (!(cdata = wl_resource_get_user_data(seat_resource)))
{
wl_resource_post_error(seat_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"No Comp_Data for Seat");
return;
}
cdata = e_comp->wl_comp_data;
switch (cdata->ptr.button)
{
case BTN_LEFT:
@ -785,7 +762,7 @@ _e_xdg_shell_surface_cb_move(struct wl_client *client EINA_UNUSED, struct wl_res
}
static void
_e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource, uint32_t serial EINA_UNUSED, uint32_t edges)
_e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_resource *resource, struct wl_resource *seat_resource EINA_UNUSED, uint32_t serial EINA_UNUSED, uint32_t edges)
{
E_Client *ec;
E_Comp_Data *cdata;
@ -808,15 +785,7 @@ _e_xdg_shell_surface_cb_resize(struct wl_client *client EINA_UNUSED, struct wl_r
if ((ec->maximized) || (ec->fullscreen)) return;
/* get compositor data from seat */
if (!(cdata = wl_resource_get_user_data(seat_resource)))
{
wl_resource_post_error(seat_resource,
WL_DISPLAY_ERROR_INVALID_OBJECT,
"No Comp_Data for Seat");
return;
}
cdata = e_comp->wl_comp_data;
cdata->resize.resource = resource;
cdata->resize.edges = edges;
cdata->ptr.grab_x = cdata->ptr.x;
@ -1301,23 +1270,17 @@ static const struct xdg_shell_interface _e_xdg_shell_interface =
};
static void
_e_xdg_shell_cb_unbind(struct wl_resource *resource)
_e_xdg_shell_cb_unbind(struct wl_resource *resource EINA_UNUSED)
{
E_Comp_Data *cdata;
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata->shell_interface.xdg_shell = NULL;
e_comp->wl_comp_data->shell_interface.xdg_shell = NULL;
}
static int
_e_xdg_shell_cb_dispatch(const void *implementation EINA_UNUSED, void *target, uint32_t opcode, const struct wl_message *message EINA_UNUSED, union wl_argument *args)
{
E_Comp_Data *cdata;
struct wl_resource *res;
if (!(res = target)) return 0;
if (!(cdata = wl_resource_get_user_data(res))) return 0;
if (opcode != 0)
{
@ -1335,65 +1298,50 @@ _e_xdg_shell_cb_dispatch(const void *implementation EINA_UNUSED, void *target, u
return 0;
}
wl_resource_set_implementation(res, &_e_xdg_shell_interface, cdata,
wl_resource_set_implementation(res, &_e_xdg_shell_interface,
e_comp->wl_comp_data,
_e_xdg_shell_cb_unbind);
return 1;
}
static void
_e_shell_cb_unbind(struct wl_resource *resource)
_e_shell_cb_unbind(struct wl_resource *resource EINA_UNUSED)
{
E_Comp_Data *cdata;
if (!(cdata = wl_resource_get_user_data(resource))) return;
cdata->shell_interface.shell = NULL;
e_comp->wl_comp_data->shell_interface.shell = NULL;
}
static void
_e_shell_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
_e_shell_cb_bind(struct wl_client *client, void *data EINA_UNUSED, uint32_t version, uint32_t id)
{
E_Comp_Data *cdata;
struct wl_resource *res;
if (!(cdata = data))
{
wl_client_post_no_memory(client);
return;
}
if (!(res = wl_resource_create(client, &wl_shell_interface, MIN(version, 1), id)))
{
wl_client_post_no_memory(client);
return;
}
cdata->shell_interface.shell = res;
wl_resource_set_implementation(res, &_e_shell_interface, cdata,
e_comp->wl_comp_data->shell_interface.shell = res;
wl_resource_set_implementation(res, &_e_shell_interface,
e_comp->wl_comp_data,
_e_shell_cb_unbind);
}
static void
_e_xdg_shell_cb_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
{
E_Comp_Data *cdata;
struct wl_resource *res;
if (!(cdata = data))
{
wl_client_post_no_memory(client);
return;
}
if (!(res = wl_resource_create(client, &xdg_shell_interface, MIN(version, 1), id)))
{
wl_client_post_no_memory(client);
return;
}
cdata->shell_interface.xdg_shell = res;
wl_resource_set_dispatcher(res, _e_xdg_shell_cb_dispatch, NULL, cdata, NULL);
e_comp->wl_comp_data->shell_interface.xdg_shell = res;
wl_resource_set_dispatcher(res, _e_xdg_shell_cb_dispatch, NULL,
e_comp->wl_comp_data, NULL);
}
E_API E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Wl_Desktop_Shell" };

@ -689,7 +689,7 @@ e_modapi_init(E_Module *m)
/* FIXME: This is just for testing at the moment....
* happens to jive with what drm does */
e_comp_wl_input_keymap_set(e_comp->wl_comp_data, NULL, NULL, NULL);
e_comp_wl_input_keymap_set(NULL, NULL, NULL);
activate_handler =
ecore_event_handler_add(ECORE_DRM_EVENT_ACTIVATE,

Loading…
Cancel
Save