From a3c0f9781073a29c020d8f5c992b8019264dc219 Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 8 Dec 2017 17:03:05 +0100 Subject: Make keyboard repeat info configurable --- include/wlr/types/wlr_keyboard.h | 8 ++++++++ include/wlr/types/wlr_seat.h | 1 + 2 files changed, 9 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index e2d50b03..c259189d 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -51,10 +51,16 @@ struct wlr_keyboard { xkb_mod_mask_t group; } modifiers; + struct { + int32_t rate; + int32_t delay; + } repeat_info; + struct { struct wl_signal key; struct wl_signal modifiers; struct wl_signal keymap; + struct wl_signal repeat_info; } events; void *data; @@ -74,6 +80,8 @@ struct wlr_event_keyboard_key { void wlr_keyboard_set_keymap(struct wlr_keyboard *kb, struct xkb_keymap *keymap); +void wlr_keyboard_set_repeat_info(struct wlr_keyboard *kb, int32_t rate, + int32_t delay); void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds); uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *keyboard); diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 6d59315b..6c04380e 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -146,6 +146,7 @@ struct wlr_seat_keyboard_state { struct wl_listener keyboard_destroy; struct wl_listener keyboard_keymap; + struct wl_listener keyboard_repeat_info; struct wl_listener surface_destroy; struct wl_listener resource_destroy; -- cgit v1.2.3 From 2c6e52c164cfd19bac642d3507fb8584a0201845 Mon Sep 17 00:00:00 2001 From: emersion Date: Fri, 8 Dec 2017 17:06:31 +0100 Subject: Add docs for wlr_keyboard_set_repeat_info --- include/wlr/types/wlr_keyboard.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index c259189d..450cd473 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -80,6 +80,10 @@ struct wlr_event_keyboard_key { void wlr_keyboard_set_keymap(struct wlr_keyboard *kb, struct xkb_keymap *keymap); +/** + * Sets the keyboard repeat info. `rate` is in key repeats/second and delay is + * in milliseconds. + */ void wlr_keyboard_set_repeat_info(struct wlr_keyboard *kb, int32_t rate, int32_t delay); void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds); -- cgit v1.2.3 From 529675b7b04a2598f7701d2e05567d8249ea1cfb Mon Sep 17 00:00:00 2001 From: emersion Date: Mon, 11 Dec 2017 12:14:23 +0100 Subject: Add wlr_output_set_custom_mode --- backend/wayland/output.c | 10 ++++++++++ backend/x11/backend.c | 16 ++++++++++++++-- include/wlr/interfaces/wlr_output.h | 2 ++ include/wlr/types/wlr_output.h | 2 ++ rootston/output.c | 9 ++++++++- types/wlr_output.c | 17 +++++++++++++++++ 6 files changed, 53 insertions(+), 3 deletions(-) (limited to 'include/wlr') diff --git a/backend/wayland/output.c b/backend/wayland/output.c index c4301617..f6182dcd 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -28,6 +28,15 @@ static struct wl_callback_listener frame_listener = { .done = surface_frame_callback }; +static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output, + int32_t width, int32_t height, int32_t refresh) { + struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output; + wl_egl_window_resize(output->egl_window, width, height, 0, 0); + wlr_output_update_size(&output->wlr_output, width, height); + wl_signal_emit(&output->wlr_output.events.resolution, output); + return true; +} + static void wlr_wl_output_make_current(struct wlr_output *_output) { struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output; if (!eglMakeCurrent(output->backend->egl.display, @@ -185,6 +194,7 @@ bool wlr_wl_output_move_cursor(struct wlr_output *_output, int x, int y) { } static struct wlr_output_impl output_impl = { + .set_custom_mode = wlr_wl_output_set_custom_mode, .transform = wlr_wl_output_transform, .destroy = wlr_wl_output_destroy, .make_current = wlr_wl_output_make_current, diff --git a/backend/x11/backend.c b/backend/x11/backend.c index b798daf6..5fb54ffd 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -267,8 +267,8 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) { snprintf(output->wlr_output.name, sizeof(output->wlr_output.name), "X11-1"); output->win = xcb_generate_id(x11->xcb_conn); - xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win, x11->screen->root, - 0, 0, 1024, 768, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT, + xcb_create_window(x11->xcb_conn, XCB_COPY_FROM_PARENT, output->win, + x11->screen->root, 0, 0, 1024, 768, 1, XCB_WINDOW_CLASS_INPUT_OUTPUT, x11->screen->root_visual, mask, values); output->surf = wlr_egl_create_surface(&x11->egl, &output->win); @@ -329,6 +329,17 @@ static struct wlr_backend_impl backend_impl = { .get_egl = wlr_x11_backend_get_egl, }; +static bool output_set_custom_mode(struct wlr_output *wlr_output, int32_t width, + int32_t height, int32_t refresh) { + struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output; + struct wlr_x11_backend *x11 = output->x11; + + const uint32_t values[] = { width, height }; + xcb_configure_window(x11->xcb_conn, output->win, + XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT, values); + return true; +} + static void output_transform(struct wlr_output *wlr_output, enum wl_output_transform transform) { struct wlr_x11_output *output = (struct wlr_x11_output *)wlr_output; output->wlr_output.transform = transform; @@ -362,6 +373,7 @@ static void output_swap_buffers(struct wlr_output *wlr_output) { } static struct wlr_output_impl output_impl = { + .set_custom_mode = output_set_custom_mode, .transform = output_transform, .destroy = output_destroy, .make_current = output_make_current, diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index b4f39d35..dc2a867b 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -9,6 +9,8 @@ struct wlr_output_impl { void (*enable)(struct wlr_output *output, bool enable); bool (*set_mode)(struct wlr_output *output, struct wlr_output_mode *mode); + bool (*set_custom_mode)(struct wlr_output *output, int32_t width, + int32_t height, int32_t refresh); void (*transform)(struct wlr_output *output, enum wl_output_transform transform); bool (*set_cursor)(struct wlr_output *output, const uint8_t *buf, diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 895536e1..7f681ab7 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -83,6 +83,8 @@ struct wlr_surface; void wlr_output_enable(struct wlr_output *output, bool enable); bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode); +bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, + int32_t height, int32_t refresh); void wlr_output_transform(struct wlr_output *output, enum wl_output_transform transform); void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly); diff --git a/rootston/output.c b/rootston/output.c index cf2ffdc3..b2d6554d 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -263,8 +263,15 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { static void set_mode(struct wlr_output *output, struct roots_output_config *oc) { - struct wlr_output_mode *mode, *best = NULL; int mhz = (int)(oc->mode.refresh_rate * 1000); + + if (wl_list_empty(&output->modes)) { + // Output has no mode, try setting a custom one + wlr_output_set_custom_mode(output, oc->mode.width, oc->mode.height, mhz); + return; + } + + struct wlr_output_mode *mode, *best = NULL; wl_list_for_each(mode, &output->modes, link) { if (mode->width == oc->mode.width && mode->height == oc->mode.height) { if (mode->refresh == mhz) { diff --git a/types/wlr_output.c b/types/wlr_output.c index f4ae7aaa..adade238 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -164,6 +164,23 @@ bool wlr_output_set_mode(struct wlr_output *output, return result; } +bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, + int32_t height, int32_t refresh) { + if (!output->impl || !output->impl->set_custom_mode) { + return false; + } + bool result = output->impl->set_custom_mode(output, width, height, refresh); + if (result) { + wlr_output_update_matrix(output); + + struct wl_resource *resource; + wl_resource_for_each(resource, &output->wl_resources) { + wlr_output_send_current_mode_to_resource(resource); + } + } + return result; +} + void wlr_output_update_size(struct wlr_output *output, int32_t width, int32_t height) { if (output->width == width && output->height == height) { -- cgit v1.2.3 From 3b4b8953d96194e8b168149f46c731443239accd Mon Sep 17 00:00:00 2001 From: emersion Date: Tue, 12 Dec 2017 21:58:00 +0100 Subject: Update output layout when scale or transform changes --- backend/drm/drm.c | 6 +----- backend/wayland/output.c | 2 -- backend/x11/backend.c | 1 - examples/multi-pointer.c | 2 +- examples/output-layout.c | 2 +- examples/pointer.c | 2 +- examples/rotation.c | 2 +- include/wlr/types/wlr_output.h | 4 +++- rootston/output.c | 2 +- types/wlr_output.c | 10 +++++++++- types/wlr_output_layout.c | 20 ++++++++++++++++++++ 11 files changed, 38 insertions(+), 15 deletions(-) (limited to 'include/wlr') diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 9fcf2ad7..ba203791 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -453,11 +453,7 @@ static bool wlr_drm_connector_set_mode(struct wlr_output *output, conn->state = WLR_DRM_CONN_CONNECTED; conn->output.current_mode = mode; - if (conn->output.width != mode->width || conn->output.height != mode->height) { - conn->output.width = mode->width; - conn->output.height = mode->height; - wl_signal_emit(&conn->output.events.resolution, &conn->output); - } + wlr_output_update_size(&conn->output, mode->width, mode->height); // Since realloc_crtcs can deallocate planes on OTHER outputs, // we actually need to reinitalise any than has changed diff --git a/backend/wayland/output.c b/backend/wayland/output.c index f6182dcd..f940299e 100644 --- a/backend/wayland/output.c +++ b/backend/wayland/output.c @@ -33,7 +33,6 @@ static bool wlr_wl_output_set_custom_mode(struct wlr_output *_output, struct wlr_wl_backend_output *output = (struct wlr_wl_backend_output *)_output; wl_egl_window_resize(output->egl_window, width, height, 0, 0); wlr_output_update_size(&output->wlr_output, width, height); - wl_signal_emit(&output->wlr_output.events.resolution, output); return true; } @@ -228,7 +227,6 @@ static void xdg_toplevel_handle_configure(void *data, struct zxdg_toplevel_v6 *x // loop over states for maximized etc? wl_egl_window_resize(output->egl_window, width, height, 0, 0); wlr_output_update_size(&output->wlr_output, width, height); - wl_signal_emit(&output->wlr_output.events.resolution, output); } static void xdg_toplevel_handle_close(void *data, struct zxdg_toplevel_v6 *xdg_toplevel) { diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 5fb54ffd..5a6e90b5 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -118,7 +118,6 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *e xcb_configure_notify_event_t *ev = (xcb_configure_notify_event_t *)event; wlr_output_update_size(&output->wlr_output, ev->width, ev->height); - wl_signal_emit(&output->wlr_output.events.resolution, output); // Move the pointer to its new location xcb_query_pointer_cookie_t cookie = diff --git a/examples/multi-pointer.c b/examples/multi-pointer.c index f1bcebc7..3f8b2415 100644 --- a/examples/multi-pointer.c +++ b/examples/multi-pointer.c @@ -72,7 +72,7 @@ static void handle_output_add(struct output_state *ostate) { example_config_get_output(sample->config, ostate->output); if (o_config) { - wlr_output_transform(ostate->output, o_config->transform); + wlr_output_set_transform(ostate->output, o_config->transform); wlr_output_layout_add(sample->layout, ostate->output, o_config->x, o_config->y); } else { diff --git a/examples/output-layout.c b/examples/output-layout.c index 084bd7df..b9228692 100644 --- a/examples/output-layout.c +++ b/examples/output-layout.c @@ -136,7 +136,7 @@ static void handle_output_add(struct output_state *ostate) { example_config_get_output(sample->config, ostate->output); if (o_config) { - wlr_output_transform(ostate->output, o_config->transform); + wlr_output_set_transform(ostate->output, o_config->transform); wlr_output_layout_add(sample->layout, ostate->output, o_config->x, o_config->y); } else { diff --git a/examples/pointer.c b/examples/pointer.c index f75e1bce..280372e0 100644 --- a/examples/pointer.c +++ b/examples/pointer.c @@ -101,7 +101,7 @@ static void handle_output_add(struct output_state *ostate) { example_config_get_output(sample->config, ostate->output); if (o_config) { - wlr_output_transform(ostate->output, o_config->transform); + wlr_output_set_transform(ostate->output, o_config->transform); wlr_output_layout_add(sample->layout, ostate->output, o_config->x, o_config->y); } else { diff --git a/examples/rotation.c b/examples/rotation.c index 276b6255..f9307ed3 100644 --- a/examples/rotation.c +++ b/examples/rotation.c @@ -78,7 +78,7 @@ static void handle_output_add(struct output_state *output) { struct output_config *conf; wl_list_for_each(conf, &state->config->outputs, link) { if (strcmp(conf->name, output->output->name) == 0) { - wlr_output_transform(output->output, conf->transform); + wlr_output_set_transform(output->output, conf->transform); break; } } diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 7f681ab7..99737c48 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -62,6 +62,8 @@ struct wlr_output { struct wl_signal frame; struct wl_signal swap_buffers; struct wl_signal resolution; + struct wl_signal scale; + struct wl_signal transform; struct wl_signal destroy; } events; @@ -85,7 +87,7 @@ bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode); bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, int32_t height, int32_t refresh); -void wlr_output_transform(struct wlr_output *output, +void wlr_output_set_transform(struct wlr_output *output, enum wl_output_transform transform); void wlr_output_set_position(struct wlr_output *output, int32_t lx, int32_t ly); void wlr_output_set_scale(struct wlr_output *output, uint32_t scale); diff --git a/rootston/output.c b/rootston/output.c index b2d6554d..560e5eeb 100644 --- a/rootston/output.c +++ b/rootston/output.c @@ -321,7 +321,7 @@ void output_add_notify(struct wl_listener *listener, void *data) { set_mode(wlr_output, output_config); } wlr_output_set_scale(wlr_output, output_config->scale); - wlr_output_transform(wlr_output, output_config->transform); + wlr_output_set_transform(wlr_output, output_config->transform); wlr_output_layout_add(desktop->layout, wlr_output, output_config->x, output_config->y); } else { diff --git a/types/wlr_output.c b/types/wlr_output.c index adade238..a922b6f3 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -195,9 +195,11 @@ void wlr_output_update_size(struct wlr_output *output, int32_t width, wl_resource_for_each(resource, &output->wl_resources) { wlr_output_send_current_mode_to_resource(resource); } + + wl_signal_emit(&output->events.resolution, output); } -void wlr_output_transform(struct wlr_output *output, +void wlr_output_set_transform(struct wlr_output *output, enum wl_output_transform transform) { output->impl->transform(output, transform); wlr_output_update_matrix(output); @@ -207,6 +209,8 @@ void wlr_output_transform(struct wlr_output *output, wl_resource_for_each(resource, &output->wl_resources) { wl_output_send_to_resource(resource); } + + wl_signal_emit(&output->events.transform, output); } void wlr_output_set_position(struct wlr_output *output, int32_t lx, @@ -237,6 +241,8 @@ void wlr_output_set_scale(struct wlr_output *output, uint32_t scale) { wl_resource_for_each(resource, &output->wl_resources) { wl_output_send_to_resource(resource); } + + wl_signal_emit(&output->events.scale, output); } void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, @@ -252,6 +258,8 @@ void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend, wl_signal_init(&output->events.frame); wl_signal_init(&output->events.swap_buffers); wl_signal_init(&output->events.resolution); + wl_signal_init(&output->events.scale); + wl_signal_init(&output->events.transform); wl_signal_init(&output->events.destroy); } diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c index b2bcb113..a6942655 100644 --- a/types/wlr_output_layout.c +++ b/types/wlr_output_layout.c @@ -19,6 +19,8 @@ struct wlr_output_layout_output_state { bool auto_configured; struct wl_listener resolution; + struct wl_listener scale; + struct wl_listener transform; struct wl_listener output_destroy; }; @@ -46,6 +48,8 @@ static void wlr_output_layout_output_destroy( struct wlr_output_layout_output *l_output) { wl_signal_emit(&l_output->events.destroy, l_output); wl_list_remove(&l_output->state->resolution.link); + wl_list_remove(&l_output->state->scale.link); + wl_list_remove(&l_output->state->transform.link); wl_list_remove(&l_output->state->output_destroy.link); wl_list_remove(&l_output->link); free(l_output->state); @@ -134,6 +138,18 @@ static void handle_output_resolution(struct wl_listener *listener, void *data) { wlr_output_layout_reconfigure(state->layout); } +static void handle_output_scale(struct wl_listener *listener, void *data) { + struct wlr_output_layout_output_state *state = + wl_container_of(listener, state, scale); + wlr_output_layout_reconfigure(state->layout); +} + +static void handle_output_transform(struct wl_listener *listener, void *data) { + struct wlr_output_layout_output_state *state = + wl_container_of(listener, state, transform); + wlr_output_layout_reconfigure(state->layout); +} + static void handle_output_destroy(struct wl_listener *listener, void *data) { struct wlr_output_layout_output_state *state = wl_container_of(listener, state, output_destroy); @@ -162,6 +178,10 @@ static struct wlr_output_layout_output *wlr_output_layout_output_create( wl_signal_add(&output->events.resolution, &l_output->state->resolution); l_output->state->resolution.notify = handle_output_resolution; + wl_signal_add(&output->events.scale, &l_output->state->scale); + l_output->state->scale.notify = handle_output_scale; + wl_signal_add(&output->events.transform, &l_output->state->transform); + l_output->state->transform.notify = handle_output_transform; wl_signal_add(&output->events.destroy, &l_output->state->output_destroy); l_output->state->output_destroy.notify = handle_output_destroy; -- cgit v1.2.3 From ea4b871e16ae63db67f2bf89c00e814b3dde6c78 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Wed, 13 Dec 2017 17:54:19 -0500 Subject: xwm: user custom event handler --- include/wlr/xwayland.h | 7 +++++ include/wlr/xwm.h | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ meson.build | 2 +- xwayland/xwayland.c | 2 +- xwayland/xwm.c | 8 +++++- xwayland/xwm.h | 75 -------------------------------------------------- 6 files changed, 91 insertions(+), 78 deletions(-) create mode 100644 include/wlr/xwm.h delete mode 100644 xwayland/xwm.h (limited to 'include/wlr') diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 792d2b88..9a89661b 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -32,6 +32,13 @@ struct wlr_xwayland { struct wl_signal new_surface; } events; + /** + * Add a custom event handler to xwayland. Return 1 if the event was + * handled or 0 to use the default wlr-xwayland handler. wlr-xwayland will + * free the event. + */ + int (*user_event_handler)(struct wlr_xwm *xwm, xcb_generic_event_t *event); + void *data; }; diff --git a/include/wlr/xwm.h b/include/wlr/xwm.h new file mode 100644 index 00000000..c350b6e2 --- /dev/null +++ b/include/wlr/xwm.h @@ -0,0 +1,75 @@ +#ifndef XWAYLAND_INTERNALS_H +#define XWAYLAND_INTERNALS_H + +#include +#include +#include + +enum atom_name { + WL_SURFACE_ID, + WM_DELETE_WINDOW, + WM_PROTOCOLS, + WM_HINTS, + WM_NORMAL_HINTS, + WM_SIZE_HINTS, + MOTIF_WM_HINTS, + UTF8_STRING, + WM_S0, + NET_SUPPORTED, + NET_WM_S0, + NET_WM_PID, + NET_WM_NAME, + NET_WM_STATE, + NET_WM_WINDOW_TYPE, + WM_TAKE_FOCUS, + WINDOW, + _NET_ACTIVE_WINDOW, + _NET_WM_MOVERESIZE, + _NET_WM_NAME, + _NET_SUPPORTING_WM_CHECK, + _NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_MAXIMIZED_VERT, + _NET_WM_STATE_MAXIMIZED_HORZ, + WM_STATE, + ATOM_LAST, +}; + +extern const char *atom_map[ATOM_LAST]; + +enum net_wm_state_action { + NET_WM_STATE_REMOVE = 0, + NET_WM_STATE_ADD = 1, + NET_WM_STATE_TOGGLE = 2, +}; + +struct wlr_xwm { + struct wlr_xwayland *xwayland; + struct wl_event_source *event_source; + + xcb_atom_t atoms[ATOM_LAST]; + xcb_connection_t *xcb_conn; + xcb_screen_t *screen; + xcb_window_t window; + xcb_visualid_t visual_id; + xcb_colormap_t colormap; + xcb_render_pictformat_t render_format_id; + xcb_cursor_t cursor; + + struct wlr_xwayland_surface *focus_surface; + + struct wl_list surfaces; // wlr_xwayland_surface::link + struct wl_list unpaired_surfaces; // wlr_xwayland_surface::unpaired_link + + const xcb_query_extension_reply_t *xfixes; + + struct wl_listener compositor_surface_create; +}; + +struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland); + +void xwm_destroy(struct wlr_xwm *xwm); + +void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride, + uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y); + +#endif diff --git a/meson.build b/meson.build index addea930..a3f5e7f9 100644 --- a/meson.build +++ b/meson.build @@ -87,7 +87,7 @@ if get_option('enable_xwayland') wlr_parts += [lib_wlr_xwayland] conf_data.set('WLR_HAS_XWAYLAND', true) else - exclude_files += ['xwayland.h'] + exclude_files += ['xwayland.h', 'xwm.h'] endif configure_file(output: 'config.h', install_dir: 'include/wlr', configuration: conf_data) install_subdir('include/wlr', install_dir: 'include', exclude_files: exclude_files) diff --git a/xwayland/xwayland.c b/xwayland/xwayland.c index ecec785c..eb06bd57 100644 --- a/xwayland/xwayland.c +++ b/xwayland/xwayland.c @@ -19,7 +19,7 @@ #include "wlr/util/log.h" #include "wlr/xwayland.h" #include "sockets.h" -#include "xwm.h" +#include "wlr/xwm.h" #ifdef __FreeBSD__ static inline int clearenv(void) { diff --git a/xwayland/xwm.c b/xwayland/xwm.c index a86fbd0e..54092cda 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -12,7 +12,7 @@ #include "wlr/types/wlr_surface.h" #include "wlr/xwayland.h" #include "wlr/xcursor.h" -#include "xwm.h" +#include "wlr/xwm.h" #ifdef HAS_XCB_ICCCM #include @@ -938,6 +938,12 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) { while ((event = xcb_poll_for_event(xwm->xcb_conn))) { count++; + + if (xwm->xwayland->user_event_handler && + xwm->xwayland->user_event_handler(xwm, event)) { + break; + } + switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) { case XCB_CREATE_NOTIFY: xwm_handle_create_notify(xwm, (xcb_create_notify_event_t *)event); diff --git a/xwayland/xwm.h b/xwayland/xwm.h deleted file mode 100644 index c350b6e2..00000000 --- a/xwayland/xwm.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef XWAYLAND_INTERNALS_H -#define XWAYLAND_INTERNALS_H - -#include -#include -#include - -enum atom_name { - WL_SURFACE_ID, - WM_DELETE_WINDOW, - WM_PROTOCOLS, - WM_HINTS, - WM_NORMAL_HINTS, - WM_SIZE_HINTS, - MOTIF_WM_HINTS, - UTF8_STRING, - WM_S0, - NET_SUPPORTED, - NET_WM_S0, - NET_WM_PID, - NET_WM_NAME, - NET_WM_STATE, - NET_WM_WINDOW_TYPE, - WM_TAKE_FOCUS, - WINDOW, - _NET_ACTIVE_WINDOW, - _NET_WM_MOVERESIZE, - _NET_WM_NAME, - _NET_SUPPORTING_WM_CHECK, - _NET_WM_STATE_FULLSCREEN, - _NET_WM_STATE_MAXIMIZED_VERT, - _NET_WM_STATE_MAXIMIZED_HORZ, - WM_STATE, - ATOM_LAST, -}; - -extern const char *atom_map[ATOM_LAST]; - -enum net_wm_state_action { - NET_WM_STATE_REMOVE = 0, - NET_WM_STATE_ADD = 1, - NET_WM_STATE_TOGGLE = 2, -}; - -struct wlr_xwm { - struct wlr_xwayland *xwayland; - struct wl_event_source *event_source; - - xcb_atom_t atoms[ATOM_LAST]; - xcb_connection_t *xcb_conn; - xcb_screen_t *screen; - xcb_window_t window; - xcb_visualid_t visual_id; - xcb_colormap_t colormap; - xcb_render_pictformat_t render_format_id; - xcb_cursor_t cursor; - - struct wlr_xwayland_surface *focus_surface; - - struct wl_list surfaces; // wlr_xwayland_surface::link - struct wl_list unpaired_surfaces; // wlr_xwayland_surface::unpaired_link - - const xcb_query_extension_reply_t *xfixes; - - struct wl_listener compositor_surface_create; -}; - -struct wlr_xwm *xwm_create(struct wlr_xwayland *wlr_xwayland); - -void xwm_destroy(struct wlr_xwm *xwm); - -void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride, - uint32_t width, uint32_t height, int32_t hotspot_x, int32_t hotspot_y); - -#endif -- cgit v1.2.3