diff options
84 files changed, 738 insertions, 49 deletions
diff --git a/examples/simple.c b/examples/simple.c index f161dc22..1125bd2a 100644 --- a/examples/simple.c +++ b/examples/simple.c @@ -37,8 +37,8 @@ struct sample_keyboard { }; void output_frame_notify(struct wl_listener *listener, void *data) { - wlr_log(WLR_DEBUG, "Output removed"); - struct sample_output *sample_output = wl_container_of(listener, sample_output, frame); + struct sample_output *sample_output = + wl_container_of(listener, sample_output, frame); struct sample_state *sample = sample_output->sample; struct timespec now; clock_gettime(CLOCK_MONOTONIC, &now); @@ -66,7 +66,9 @@ void output_frame_notify(struct wl_listener *listener, void *data) { } void output_remove_notify(struct wl_listener *listener, void *data) { - struct sample_output *sample_output = wl_container_of(listener, sample_output, destroy); + struct sample_output *sample_output = + wl_container_of(listener, sample_output, destroy); + wlr_log(WLR_DEBUG, "Output removed"); wl_list_remove(&sample_output->frame.link); wl_list_remove(&sample_output->destroy.link); free(sample_output); @@ -74,10 +76,13 @@ void output_remove_notify(struct wl_listener *listener, void *data) { void new_output_notify(struct wl_listener *listener, void *data) { struct wlr_output *output = data; - struct sample_state *sample = wl_container_of(listener, sample, new_output); - struct sample_output *sample_output = calloc(1, sizeof(struct sample_output)); + struct sample_state *sample = + wl_container_of(listener, sample, new_output); + struct sample_output *sample_output = + calloc(1, sizeof(struct sample_output)); if (!wl_list_empty(&output->modes)) { - struct wlr_output_mode *mode = wl_container_of(output->modes.prev, mode, link); + struct wlr_output_mode *mode = + wl_container_of(output->modes.prev, mode, link); wlr_output_set_mode(output, mode); } sample_output->output = output; @@ -105,7 +110,8 @@ void keyboard_key_notify(struct wl_listener *listener, void *data) { } void keyboard_destroy_notify(struct wl_listener *listener, void *data) { - struct sample_keyboard *keyboard = wl_container_of(listener, keyboard, destroy); + struct sample_keyboard *keyboard = + wl_container_of(listener, keyboard, destroy); wl_list_remove(&keyboard->destroy.link); wl_list_remove(&keyboard->key.link); free(keyboard); @@ -116,7 +122,8 @@ void new_input_notify(struct wl_listener *listener, void *data) { struct sample_state *sample = wl_container_of(listener, sample, new_input); switch (device->type) { case WLR_INPUT_DEVICE_KEYBOARD:; - struct sample_keyboard *keyboard = calloc(1, sizeof(struct sample_keyboard)); + struct sample_keyboard *keyboard = + calloc(1, sizeof(struct sample_keyboard)); keyboard->device = device; keyboard->sample = sample; wl_signal_add(&device->events.destroy, &keyboard->destroy); @@ -152,19 +159,19 @@ int main(void) { .last_frame = { 0 }, .display = display }; - struct wlr_backend *wlr = wlr_backend_autocreate(display, NULL); - if (!wlr) { + struct wlr_backend *backend = wlr_backend_autocreate(display, NULL); + if (!backend) { exit(1); } - wl_signal_add(&wlr->events.new_output, &state.new_output); + wl_signal_add(&backend->events.new_output, &state.new_output); state.new_output.notify = new_output_notify; - wl_signal_add(&wlr->events.new_input, &state.new_input); + wl_signal_add(&backend->events.new_input, &state.new_input); state.new_input.notify = new_input_notify; clock_gettime(CLOCK_MONOTONIC, &state.last_frame); - if (!wlr_backend_start(wlr)) { + if (!wlr_backend_start(backend)) { wlr_log(WLR_ERROR, "Failed to start backend"); - wlr_backend_destroy(wlr); + wlr_backend_destroy(backend); exit(1); } wl_display_run(display); diff --git a/include/rootston/cursor.h b/include/rootston/cursor.h index f7410dec..2c687a39 100644 --- a/include/rootston/cursor.h +++ b/include/rootston/cursor.h @@ -80,4 +80,7 @@ void roots_cursor_handle_tool_tip(struct roots_cursor *cursor, void roots_cursor_handle_request_set_cursor(struct roots_cursor *cursor, struct wlr_seat_pointer_request_set_cursor_event *event); +void roots_cursor_update_position(struct roots_cursor *cursor, + uint32_t time); + #endif diff --git a/include/rootston/input.h b/include/rootston/input.h index ef46fab2..2cdb13e6 100644 --- a/include/rootston/input.h +++ b/include/rootston/input.h @@ -32,4 +32,6 @@ struct roots_seat *input_get_seat(struct roots_input *input, char *name); struct roots_seat *input_last_active_seat(struct roots_input *input); +void input_update_cursor_focus(struct roots_input *input); + #endif diff --git a/include/types/wlr_xdg_shell.h b/include/types/wlr_xdg_shell.h index 7a17d286..93fdc670 100644 --- a/include/types/wlr_xdg_shell.h +++ b/include/types/wlr_xdg_shell.h @@ -19,7 +19,8 @@ struct wlr_xdg_surface *create_xdg_surface( uint32_t id); void unmap_xdg_surface(struct wlr_xdg_surface *surface); void destroy_xdg_surface(struct wlr_xdg_surface *surface); -void handle_xdg_surface_committed(struct wlr_surface *wlr_surface); +void handle_xdg_surface_commit(struct wlr_surface *wlr_surface); +void handle_xdg_surface_precommit(struct wlr_surface *wlr_surface); void create_xdg_positioner(struct wlr_xdg_client *client, uint32_t id); struct wlr_xdg_positioner_resource *get_xdg_positioner_from_resource( diff --git a/include/types/wlr_xdg_shell_v6.h b/include/types/wlr_xdg_shell_v6.h index 030c10e4..59fca667 100644 --- a/include/types/wlr_xdg_shell_v6.h +++ b/include/types/wlr_xdg_shell_v6.h @@ -19,7 +19,8 @@ struct wlr_xdg_surface_v6 *create_xdg_surface_v6( uint32_t id); void unmap_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface); void destroy_xdg_surface_v6(struct wlr_xdg_surface_v6 *surface); -void handle_xdg_surface_v6_committed(struct wlr_surface *wlr_surface); +void handle_xdg_surface_v6_commit(struct wlr_surface *wlr_surface); +void handle_xdg_surface_v6_precommit(struct wlr_surface *wlr_surface); void create_xdg_positioner_v6(struct wlr_xdg_client_v6 *client, uint32_t id); struct wlr_xdg_positioner_v6_resource *get_xdg_positioner_v6_from_resource( diff --git a/include/wlr/backend.h b/include/wlr/backend.h index f40f5353..39d072e2 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_BACKEND_H #define WLR_BACKEND_H diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h index 7f41ca15..a8a5525e 100644 --- a/include/wlr/backend/drm.h +++ b/include/wlr/backend/drm.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_BACKEND_DRM_H #define WLR_BACKEND_DRM_H diff --git a/include/wlr/backend/headless.h b/include/wlr/backend/headless.h index 02c7cd11..eab102e2 100644 --- a/include/wlr/backend/headless.h +++ b/include/wlr/backend/headless.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_BACKEND_HEADLESS_H #define WLR_BACKEND_HEADLESS_H diff --git a/include/wlr/backend/interface.h b/include/wlr/backend/interface.h index 42b39a16..f3dee69b 100644 --- a/include/wlr/backend/interface.h +++ b/include/wlr/backend/interface.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_BACKEND_INTERFACE_H #define WLR_BACKEND_INTERFACE_H diff --git a/include/wlr/backend/libinput.h b/include/wlr/backend/libinput.h index 92d31415..1a2ab294 100644 --- a/include/wlr/backend/libinput.h +++ b/include/wlr/backend/libinput.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_BACKEND_LIBINPUT_H #define WLR_BACKEND_LIBINPUT_H diff --git a/include/wlr/backend/multi.h b/include/wlr/backend/multi.h index 1e04dba4..7137b075 100644 --- a/include/wlr/backend/multi.h +++ b/include/wlr/backend/multi.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_BACKEND_MULTI_H #define WLR_BACKEND_MULTI_H diff --git a/include/wlr/backend/session/interface.h b/include/wlr/backend/session/interface.h index b35ed71d..5ccf9c8a 100644 --- a/include/wlr/backend/session/interface.h +++ b/include/wlr/backend/session/interface.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_BACKEND_SESSION_INTERFACE_H #define WLR_BACKEND_SESSION_INTERFACE_H diff --git a/include/wlr/interfaces/wlr_input_device.h b/include/wlr/interfaces/wlr_input_device.h index a5c513b7..05248bf6 100644 --- a/include/wlr/interfaces/wlr_input_device.h +++ b/include/wlr/interfaces/wlr_input_device.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_INTERFACES_WLR_INPUT_DEVICE_H #define WLR_INTERFACES_WLR_INPUT_DEVICE_H diff --git a/include/wlr/interfaces/wlr_keyboard.h b/include/wlr/interfaces/wlr_keyboard.h index c9a13fd7..5d537827 100644 --- a/include/wlr/interfaces/wlr_keyboard.h +++ b/include/wlr/interfaces/wlr_keyboard.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_INTERFACES_WLR_KEYBOARD_H #define WLR_INTERFACES_WLR_KEYBOARD_H diff --git a/include/wlr/interfaces/wlr_output.h b/include/wlr/interfaces/wlr_output.h index 8f87408a..2224932f 100644 --- a/include/wlr/interfaces/wlr_output.h +++ b/include/wlr/interfaces/wlr_output.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_INTERFACES_WLR_OUTPUT_H #define WLR_INTERFACES_WLR_OUTPUT_H diff --git a/include/wlr/interfaces/wlr_pointer.h b/include/wlr/interfaces/wlr_pointer.h index f0cf9081..fd3ab102 100644 --- a/include/wlr/interfaces/wlr_pointer.h +++ b/include/wlr/interfaces/wlr_pointer.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_INTERFACES_WLR_POINTER_H #define WLR_INTERFACES_WLR_POINTER_H diff --git a/include/wlr/interfaces/wlr_tablet_pad.h b/include/wlr/interfaces/wlr_tablet_pad.h index 5ec1e3eb..86bbe9c3 100644 --- a/include/wlr/interfaces/wlr_tablet_pad.h +++ b/include/wlr/interfaces/wlr_tablet_pad.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_INTERFACES_WLR_TABLET_PAD_H #define WLR_INTERFACES_WLR_TABLET_PAD_H diff --git a/include/wlr/interfaces/wlr_tablet_tool.h b/include/wlr/interfaces/wlr_tablet_tool.h index 12b2e32e..9cfc3ca0 100644 --- a/include/wlr/interfaces/wlr_tablet_tool.h +++ b/include/wlr/interfaces/wlr_tablet_tool.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_INTERFACES_WLR_TABLET_TOOL_H #define WLR_INTERFACES_WLR_TABLET_TOOL_H diff --git a/include/wlr/interfaces/wlr_touch.h b/include/wlr/interfaces/wlr_touch.h index 63bac6b8..cc426332 100644 --- a/include/wlr/interfaces/wlr_touch.h +++ b/include/wlr/interfaces/wlr_touch.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_INTERFACES_WLR_TOUCH_H #define WLR_INTERFACES_WLR_TOUCH_H diff --git a/include/wlr/render/dmabuf.h b/include/wlr/render/dmabuf.h index 78f8c2eb..33c3a129 100644 --- a/include/wlr/render/dmabuf.h +++ b/include/wlr/render/dmabuf.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_RENDER_DMABUF_H #define WLR_RENDER_DMABUF_H diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index 6b887f4f..c42b0325 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_RENDER_EGL_H #define WLR_RENDER_EGL_H diff --git a/include/wlr/render/gles2.h b/include/wlr/render/gles2.h index 866c6658..fca11ab8 100644 --- a/include/wlr/render/gles2.h +++ b/include/wlr/render/gles2.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_RENDER_GLES2_H #define WLR_RENDER_GLES2_H diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index f4565ad5..63f4265c 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_RENDER_INTERFACE_H #define WLR_RENDER_INTERFACE_H diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h index 0650bf1b..9c031b7f 100644 --- a/include/wlr/render/wlr_renderer.h +++ b/include/wlr/render/wlr_renderer.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_RENDER_WLR_RENDERER_H #define WLR_RENDER_WLR_RENDERER_H diff --git a/include/wlr/render/wlr_texture.h b/include/wlr/render/wlr_texture.h index 9370fa25..dbfabfee 100644 --- a/include/wlr/render/wlr_texture.h +++ b/include/wlr/render/wlr_texture.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_RENDER_WLR_TEXTURE_H #define WLR_RENDER_WLR_TEXTURE_H diff --git a/include/wlr/types/wlr_box.h b/include/wlr/types/wlr_box.h index 0e586a18..11a53b56 100644 --- a/include/wlr/types/wlr_box.h +++ b/include/wlr/types/wlr_box.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_BOX_H #define WLR_TYPES_WLR_BOX_H diff --git a/include/wlr/types/wlr_buffer.h b/include/wlr/types/wlr_buffer.h index eabc8b51..0c987b17 100644 --- a/include/wlr/types/wlr_buffer.h +++ b/include/wlr/types/wlr_buffer.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_BUFFER_H #define WLR_TYPES_WLR_BUFFER_H diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index 0d79b0bb..1772e54b 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_COMPOSITOR_H #define WLR_TYPES_WLR_COMPOSITOR_H diff --git a/include/wlr/types/wlr_cursor.h b/include/wlr/types/wlr_cursor.h index 998c6f0d..ba582be9 100644 --- a/include/wlr/types/wlr_cursor.h +++ b/include/wlr/types/wlr_cursor.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_CURSOR_H #define WLR_TYPES_WLR_CURSOR_H diff --git a/include/wlr/types/wlr_data_device.h b/include/wlr/types/wlr_data_device.h index 8b7b374c..cc04c9e9 100644 --- a/include/wlr/types/wlr_data_device.h +++ b/include/wlr/types/wlr_data_device.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_DATA_DEVICE_H #define WLR_TYPES_WLR_DATA_DEVICE_H diff --git a/include/wlr/types/wlr_export_dmabuf_v1.h b/include/wlr/types/wlr_export_dmabuf_v1.h index a094b3de..56767540 100644 --- a/include/wlr/types/wlr_export_dmabuf_v1.h +++ b/include/wlr/types/wlr_export_dmabuf_v1.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_EXPORT_DMABUF_V1_H #define WLR_TYPES_WLR_EXPORT_DMABUF_V1_H diff --git a/include/wlr/types/wlr_gamma_control.h b/include/wlr/types/wlr_gamma_control.h index f195c8ef..ac078b5a 100644 --- a/include/wlr/types/wlr_gamma_control.h +++ b/include/wlr/types/wlr_gamma_control.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_GAMMA_CONTROL_H #define WLR_TYPES_WLR_GAMMA_CONTROL_H diff --git a/include/wlr/types/wlr_idle.h b/include/wlr/types/wlr_idle.h index 53fc6b98..608b5894 100644 --- a/include/wlr/types/wlr_idle.h +++ b/include/wlr/types/wlr_idle.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_IDLE_H #define WLR_TYPES_WLR_IDLE_H diff --git a/include/wlr/types/wlr_idle_inhibit_v1.h b/include/wlr/types/wlr_idle_inhibit_v1.h index 011abbe5..9f481e2f 100644 --- a/include/wlr/types/wlr_idle_inhibit_v1.h +++ b/include/wlr/types/wlr_idle_inhibit_v1.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_IDLE_INHIBIT_V1_H #define WLR_TYPES_WLR_IDLE_INHIBIT_V1_H @@ -19,7 +27,7 @@ struct wlr_idle_inhibit_manager_v1 { struct wl_list resources; // wl_resource_get_link struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1::link struct wl_global *global; - + struct wl_listener display_destroy; struct { diff --git a/include/wlr/types/wlr_input_device.h b/include/wlr/types/wlr_input_device.h index cce15d90..ab0aecb6 100644 --- a/include/wlr/types/wlr_input_device.h +++ b/include/wlr/types/wlr_input_device.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_INPUT_DEVICE_H #define WLR_TYPES_WLR_INPUT_DEVICE_H diff --git a/include/wlr/types/wlr_input_inhibitor.h b/include/wlr/types/wlr_input_inhibitor.h index 2f333f3b..5772f1a5 100644 --- a/include/wlr/types/wlr_input_inhibitor.h +++ b/include/wlr/types/wlr_input_inhibitor.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_INPUT_INHIBITOR_H #define WLR_TYPES_INPUT_INHIBITOR_H #include <wayland-server.h> diff --git a/include/wlr/types/wlr_keyboard.h b/include/wlr/types/wlr_keyboard.h index 67d4e5be..3e207523 100644 --- a/include/wlr/types/wlr_keyboard.h +++ b/include/wlr/types/wlr_keyboard.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_KEYBOARD_H #define WLR_TYPES_WLR_KEYBOARD_H diff --git a/include/wlr/types/wlr_layer_shell.h b/include/wlr/types/wlr_layer_shell.h index 2848a115..029f8cbe 100644 --- a/include/wlr/types/wlr_layer_shell.h +++ b/include/wlr/types/wlr_layer_shell.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_LAYER_SHELL_H #define WLR_TYPES_WLR_LAYER_SHELL_H #include <stdbool.h> diff --git a/include/wlr/types/wlr_linux_dmabuf_v1.h b/include/wlr/types/wlr_linux_dmabuf_v1.h index 43bc8385..f21b0b3a 100644 --- a/include/wlr/types/wlr_linux_dmabuf_v1.h +++ b/include/wlr/types/wlr_linux_dmabuf_v1.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_LINUX_DMABUF_H #define WLR_TYPES_WLR_LINUX_DMABUF_H diff --git a/include/wlr/types/wlr_list.h b/include/wlr/types/wlr_list.h index 23bf53b7..60f388f9 100644 --- a/include/wlr/types/wlr_list.h +++ b/include/wlr/types/wlr_list.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_LIST_H #define WLR_TYPES_WLR_LIST_H diff --git a/include/wlr/types/wlr_matrix.h b/include/wlr/types/wlr_matrix.h index 02111db8..a3961c35 100644 --- a/include/wlr/types/wlr_matrix.h +++ b/include/wlr/types/wlr_matrix.h @@ -1,20 +1,57 @@ +/* + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. + */ + #ifndef WLR_TYPES_WLR_MATRIX_H #define WLR_TYPES_WLR_MATRIX_H #include <wayland-server.h> #include <wlr/types/wlr_box.h> +/** Writes the identity matrix into mat */ void wlr_matrix_identity(float mat[static 9]); + +/** mat ← a × b */ void wlr_matrix_multiply(float mat[static 9], const float a[static 9], const float b[static 9]); + void wlr_matrix_transpose(float mat[static 9], const float a[static 9]); + +/** Writes a 2D translation matrix to mat of magnitude (x, y) */ void wlr_matrix_translate(float mat[static 9], float x, float y); + +/** Writes a 2D scale matrix to mat of magnitude (x, y) */ void wlr_matrix_scale(float mat[static 9], float x, float y); + +/** Writes a 2D rotation matrix to mat at an angle of rad radians */ void wlr_matrix_rotate(float mat[static 9], float rad); + +/** Writes a transformation matrix which applies the specified + * wl_output_transform to mat */ void wlr_matrix_transform(float mat[static 9], enum wl_output_transform transform); + +/** Writes a 2D orthographic projection matrix to mat of (width, height) with a + * specified wl_output_transform*/ void wlr_matrix_projection(float mat[static 9], int width, int height, enum wl_output_transform transform); + +/** Shortcut for the various matrix operations involved in projecting the + * specified wlr_box onto a given orthographic projection with a given + * rotation. The result is written to mat, which can be applied to each + * coordinate of the box to get a new coordinate from [-1,1]. */ void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box, enum wl_output_transform transform, float rotation, const float projection[static 9]); diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index c93ed2eb..f8452d12 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_OUTPUT_H #define WLR_TYPES_WLR_OUTPUT_H diff --git a/include/wlr/types/wlr_output_damage.h b/include/wlr/types/wlr_output_damage.h index a4333c1a..d614e6d6 100644 --- a/include/wlr/types/wlr_output_damage.h +++ b/include/wlr/types/wlr_output_damage.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_OUTPUT_DAMAGE_H #define WLR_TYPES_WLR_OUTPUT_DAMAGE_H diff --git a/include/wlr/types/wlr_output_layout.h b/include/wlr/types/wlr_output_layout.h index 759c8ccf..2ac12a6a 100644 --- a/include/wlr/types/wlr_output_layout.h +++ b/include/wlr/types/wlr_output_layout.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_OUTPUT_LAYOUT_H #define WLR_TYPES_WLR_OUTPUT_LAYOUT_H diff --git a/include/wlr/types/wlr_pointer.h b/include/wlr/types/wlr_pointer.h index 48c89151..7dc643ae 100644 --- a/include/wlr/types/wlr_pointer.h +++ b/include/wlr/types/wlr_pointer.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_POINTER_H #define WLR_TYPES_WLR_POINTER_H diff --git a/include/wlr/types/wlr_primary_selection.h b/include/wlr/types/wlr_primary_selection.h index 78f23ad6..fa9ee843 100644 --- a/include/wlr/types/wlr_primary_selection.h +++ b/include/wlr/types/wlr_primary_selection.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_PRIMARY_SELECTION_H #define WLR_TYPES_WLR_PRIMARY_SELECTION_H diff --git a/include/wlr/types/wlr_region.h b/include/wlr/types/wlr_region.h index be2f8b84..3c4a0532 100644 --- a/include/wlr/types/wlr_region.h +++ b/include/wlr/types/wlr_region.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_REGION_H #define WLR_TYPES_WLR_REGION_H diff --git a/include/wlr/types/wlr_screencopy_v1.h b/include/wlr/types/wlr_screencopy_v1.h index 892687aa..8c3b77fd 100644 --- a/include/wlr/types/wlr_screencopy_v1.h +++ b/include/wlr/types/wlr_screencopy_v1.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_SCREENCOPY_V1_H #define WLR_TYPES_WLR_SCREENCOPY_V1_H diff --git a/include/wlr/types/wlr_screenshooter.h b/include/wlr/types/wlr_screenshooter.h index 916c8942..ccdb8cf5 100644 --- a/include/wlr/types/wlr_screenshooter.h +++ b/include/wlr/types/wlr_screenshooter.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_SCREENSHOOTER_H #define WLR_TYPES_WLR_SCREENSHOOTER_H diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index 92d0a233..b3c02cf2 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_SEAT_H #define WLR_TYPES_WLR_SEAT_H diff --git a/include/wlr/types/wlr_server_decoration.h b/include/wlr/types/wlr_server_decoration.h index 23387968..2a76b35c 100644 --- a/include/wlr/types/wlr_server_decoration.h +++ b/include/wlr/types/wlr_server_decoration.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_SERVER_DECORATION_H #define WLR_TYPES_WLR_SERVER_DECORATION_H diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 0e3b5ff4..063f9e26 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_SURFACE_H #define WLR_TYPES_WLR_SURFACE_H @@ -39,6 +47,7 @@ struct wlr_surface_state { struct wlr_surface_role { const char *name; void (*commit)(struct wlr_surface *surface); + void (*precommit)(struct wlr_surface *surface); }; struct wlr_surface { diff --git a/include/wlr/types/wlr_tablet_pad.h b/include/wlr/types/wlr_tablet_pad.h index 23ac464d..d9bb284f 100644 --- a/include/wlr/types/wlr_tablet_pad.h +++ b/include/wlr/types/wlr_tablet_pad.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_TABLET_PAD_H #define WLR_TYPES_WLR_TABLET_PAD_H diff --git a/include/wlr/types/wlr_tablet_tool.h b/include/wlr/types/wlr_tablet_tool.h index bfa2e1f7..cb516ed9 100644 --- a/include/wlr/types/wlr_tablet_tool.h +++ b/include/wlr/types/wlr_tablet_tool.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_TABLET_TOOL_H #define WLR_TYPES_TABLET_TOOL_H diff --git a/include/wlr/types/wlr_tablet_v2.h b/include/wlr/types/wlr_tablet_v2.h index afa74d05..c332b5b1 100644 --- a/include/wlr/types/wlr_tablet_v2.h +++ b/include/wlr/types/wlr_tablet_v2.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_TABLET_V2_H #define WLR_TYPES_WLR_TABLET_V2_H diff --git a/include/wlr/types/wlr_touch.h b/include/wlr/types/wlr_touch.h index 70070f84..99316ae0 100644 --- a/include/wlr/types/wlr_touch.h +++ b/include/wlr/types/wlr_touch.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_TOUCH_H #define WLR_TYPES_WLR_TOUCH_H diff --git a/include/wlr/types/wlr_virtual_keyboard_v1.h b/include/wlr/types/wlr_virtual_keyboard_v1.h index 1236ae24..1df0f3a3 100644 --- a/include/wlr/types/wlr_virtual_keyboard_v1.h +++ b/include/wlr/types/wlr_virtual_keyboard_v1.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_VIRTUAL_KEYBOARD_V1_H #define WLR_TYPES_WLR_VIRTUAL_KEYBOARD_V1_H diff --git a/include/wlr/types/wlr_wl_shell.h b/include/wlr/types/wlr_wl_shell.h index c4cc1999..0a52ae3e 100644 --- a/include/wlr/types/wlr_wl_shell.h +++ b/include/wlr/types/wlr_wl_shell.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_WL_SHELL_H #define WLR_TYPES_WLR_WL_SHELL_H diff --git a/include/wlr/types/wlr_xcursor_manager.h b/include/wlr/types/wlr_xcursor_manager.h index c7fa83be..285006bf 100644 --- a/include/wlr/types/wlr_xcursor_manager.h +++ b/include/wlr/types/wlr_xcursor_manager.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_XCURSOR_MANAGER_H #define WLR_TYPES_WLR_XCURSOR_MANAGER_H diff --git a/include/wlr/types/wlr_xdg_output.h b/include/wlr/types/wlr_xdg_output.h index 81566ab9..2754b291 100644 --- a/include/wlr/types/wlr_xdg_output.h +++ b/include/wlr/types/wlr_xdg_output.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_XDG_OUTPUT_H #define WLR_TYPES_WLR_XDG_OUTPUT_H #include <wayland-server.h> diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 06b59989..a067c62e 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_XDG_SHELL_H #define WLR_TYPES_WLR_XDG_SHELL_H #include <wlr/types/wlr_box.h> diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index 2357d945..8fdf5090 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_TYPES_WLR_XDG_SHELL_V6_H #define WLR_TYPES_WLR_XDG_SHELL_V6_H diff --git a/include/wlr/util/edges.h b/include/wlr/util/edges.h index 53268323..bf1eb1e7 100644 --- a/include/wlr/util/edges.h +++ b/include/wlr/util/edges.h @@ -1,3 +1,19 @@ +/* + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. + */ + #ifndef WLR_UTIL_EDGES_H #define WLR_UTIL_EDGES_H diff --git a/include/wlr/util/log.h b/include/wlr/util/log.h index 098a020d..7b0070bb 100644 --- a/include/wlr/util/log.h +++ b/include/wlr/util/log.h @@ -1,3 +1,19 @@ +/* + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. + */ + #ifndef WLR_UTIL_LOG_H #define WLR_UTIL_LOG_H diff --git a/include/wlr/util/region.h b/include/wlr/util/region.h index c0fe6063..32387bfb 100644 --- a/include/wlr/util/region.h +++ b/include/wlr/util/region.h @@ -1,6 +1,21 @@ +/* + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. + */ + #ifndef WLR_UTIL_REGION_H #define WLR_UTIL_REGION_H - #include <pixman.h> #include <wayland-server.h> diff --git a/include/wlr/xcursor.h b/include/wlr/xcursor.h index d97469f8..39874f39 100644 --- a/include/wlr/xcursor.h +++ b/include/wlr/xcursor.h @@ -24,8 +24,19 @@ */ /* - * This is adapted from wayland-cursor, but with the wl_shm client stuff removed - * so we can use it on the compositor, too. + * This is a stable interface of wlroots. Future changes will be limited to: + * + * - New functions + * - New struct members + * - New enum members + * + * Note that wlroots does not make an ABI compatibility promise - in the future, + * the layout and size of structs used by wlroots may change, requiring code + * depending on this header to be recompiled (but not edited). + * + * Breaking changes are announced by email and follow a 1-year deprecation + * schedule. Send an email to ~sircmpwn/wlroots-announce+subscribe@lists.sr.ht + * to receive these announcements. */ #ifndef WLR_XCURSOR_H diff --git a/include/wlr/xwayland.h b/include/wlr/xwayland.h index 2b643ec9..39644dc1 100644 --- a/include/wlr/xwayland.h +++ b/include/wlr/xwayland.h @@ -1,3 +1,11 @@ +/* + * This an unstable interface of wlroots. No guarantees are made regarding the + * future consistency of this API. + */ +#ifndef WLR_USE_UNSTABLE +#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features" +#endif + #ifndef WLR_XWAYLAND_H #define WLR_XWAYLAND_H @@ -209,4 +217,29 @@ struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface( void wlr_xwayland_surface_ping(struct wlr_xwayland_surface *surface); +/** Metric to guess if an OR window should "receive" focus + * + * In the pure X setups, window managers usually straight up ignore override + * redirect windows, and never touch them. (we have to handle them for mapping) + * + * When such a window wants to receive keyboard input (e.g. rofi/dzen) it will + * use mechanics we don't support (sniffing/grabbing input). + * [Sadly this is unrelated to xwayland-keyboard-grab] + * + * To still support these windows, while keeping general OR semantics as is, we + * need to hand a subset of windows focus. + * The dirty truth is, we need to hand focus to any Xwayland window, though + * pretending this window has focus makes it easier to handle unmap. + * + * This function provides a handy metric based on the window type to guess if + * the OR window wants focus. + * It's probably not perfect, nor exactly intended but works in practice. + * + * Returns: true if the window should receive focus + * false if it should be ignored + */ +bool wlr_xwayland_or_surface_wants_focus( + const struct wlr_xwayland_surface *surface); + + #endif diff --git a/meson.build b/meson.build index 47910cad..fb610377 100644 --- a/meson.build +++ b/meson.build @@ -29,6 +29,10 @@ add_project_link_arguments( '-Wl,-rpath,@0@'.format(meson.build_root()), language: 'c', ) +add_project_arguments( + '-DWLR_USE_UNSTABLE', + language: 'c', +) conf_data = configuration_data() diff --git a/rootston/cursor.c b/rootston/cursor.c index 94f5520e..9a9f9af6 100644 --- a/rootston/cursor.c +++ b/rootston/cursor.c @@ -101,6 +101,7 @@ static void seat_view_deco_button(struct roots_seat_view *view, double sx, static void roots_passthrough_cursor(struct roots_cursor *cursor, uint32_t time) { + bool focus_changed; double sx, sy; struct roots_view *view = NULL; struct roots_seat *seat = cursor->seat; @@ -136,8 +137,11 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor, } if (surface) { + focus_changed = (seat->seat->pointer_state.focused_surface != surface); wlr_seat_pointer_notify_enter(seat->seat, surface, sx, sy); - wlr_seat_pointer_notify_motion(seat->seat, time, sx, sy); + if (!focus_changed) { + wlr_seat_pointer_notify_motion(seat->seat, time, sx, sy); + } } else { wlr_seat_pointer_clear_focus(seat->seat); } @@ -148,8 +152,8 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor, } } -static void roots_cursor_update_position( - struct roots_cursor *cursor, uint32_t time) { +void roots_cursor_update_position(struct roots_cursor *cursor, + uint32_t time) { struct roots_seat *seat = cursor->seat; struct roots_view *view; switch (cursor->mode) { @@ -266,13 +270,7 @@ static void roots_cursor_press_button(struct roots_cursor *cursor, cursor->mode = ROOTS_CURSOR_PASSTHROUGH; } - switch (state) { - case WLR_BUTTON_RELEASED: - if (!is_touch) { - roots_cursor_update_position(cursor, time); - } - break; - case WLR_BUTTON_PRESSED: + if (state == WLR_BUTTON_PRESSED) { if (view) { roots_seat_set_focus(seat, view); } @@ -283,7 +281,6 @@ static void roots_cursor_press_button(struct roots_cursor *cursor, roots_seat_set_focus_layer(seat, layer); } } - break; } } diff --git a/rootston/desktop.c b/rootston/desktop.c index e90623e2..786ac99e 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -423,6 +423,7 @@ struct roots_subsurface *subsurface_create(struct roots_view *view, view_child_init(&subsurface->view_child, view, wlr_subsurface->surface); subsurface->destroy.notify = subsurface_handle_destroy; wl_signal_add(&wlr_subsurface->events.destroy, &subsurface->destroy); + input_update_cursor_focus(view->desktop->server->input); return subsurface; } @@ -468,6 +469,7 @@ void view_map(struct roots_view *view, struct wlr_surface *surface) { wl_list_insert(&view->desktop->views, &view->link); view_damage_whole(view); + input_update_cursor_focus(view->desktop->server->input); } void view_unmap(struct roots_view *view) { diff --git a/rootston/input.c b/rootston/input.c index 84b5acae..de847d78 100644 --- a/rootston/input.c +++ b/rootston/input.c @@ -1,5 +1,7 @@ +#define _POSIX_C_SOURCE 199309L #include <assert.h> #include <stdlib.h> +#include <time.h> #include <wayland-server.h> #include <wlr/backend/libinput.h> #include <wlr/config.h> @@ -126,3 +128,16 @@ bool input_view_has_focus(struct roots_input *input, struct roots_view *view) { return false; } + +static inline int64_t timespec_to_msec(const struct timespec *a) { + return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000; +} + +void input_update_cursor_focus(struct roots_input *input) { + struct roots_seat *seat; + struct timespec now; + wl_list_for_each(seat, &input->seats, link) { + clock_gettime(CLOCK_MONOTONIC, &now); + roots_cursor_update_position(seat->cursor, timespec_to_msec(&now)); + } +} diff --git a/rootston/layer_shell.c b/rootston/layer_shell.c index ba69c3db..6795cb58 100644 --- a/rootston/layer_shell.c +++ b/rootston/layer_shell.c @@ -291,7 +291,10 @@ static void handle_map(struct wl_listener *listener, void *data) { static void handle_unmap(struct wl_listener *listener, void *data) { struct roots_layer_surface *layer = wl_container_of( listener, layer, unmap); + struct wlr_output *wlr_output = layer->layer_surface->output; + struct roots_output *output = wlr_output->data; unmap(layer->layer_surface); + input_update_cursor_focus(output->desktop->server->input); } static void popup_handle_map(struct wl_listener *listener, void *data) { @@ -303,6 +306,7 @@ static void popup_handle_map(struct wl_listener *listener, void *data) { int oy = popup->wlr_popup->geometry.y + layer->geo.y; output_damage_whole_local_surface(output, popup->wlr_popup->base->surface, ox, oy, 0); + input_update_cursor_focus(output->desktop->server->input); } static void popup_handle_unmap(struct wl_listener *listener, void *data) { diff --git a/rootston/main.c b/rootston/main.c index 6f4e2612..cc3ffd3e 100644 --- a/rootston/main.c +++ b/rootston/main.c @@ -1,6 +1,5 @@ #define _POSIX_C_SOURCE 200112L #include <assert.h> -#include <signal.h> #include <stdlib.h> #include <unistd.h> #include <wayland-server.h> @@ -16,11 +15,6 @@ struct roots_server server = { 0 }; int main(int argc, char **argv) { - if (signal(SIGCHLD, SIG_IGN) == SIG_ERR) { - wlr_log_errno(WLR_ERROR, "Unable to install SIGCHLD handler"); - return 1; - } - wlr_log_init(WLR_DEBUG, NULL); server.config = roots_config_create_from_args(argc, argv); server.wl_display = wl_display_create(); diff --git a/rootston/seat.c b/rootston/seat.c index cae548d3..27363d8e 100644 --- a/rootston/seat.c +++ b/rootston/seat.c @@ -1124,7 +1124,8 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) { #ifdef WLR_HAS_XWAYLAND if (view && view->type == ROOTS_XWAYLAND_VIEW && - view->xwayland_surface->override_redirect) { + !wlr_xwayland_or_surface_wants_focus( + view->xwayland_surface)) { return; } #endif diff --git a/rootston/xdg_shell.c b/rootston/xdg_shell.c index e63eed85..e5ab9efd 100644 --- a/rootston/xdg_shell.c +++ b/rootston/xdg_shell.c @@ -6,6 +6,7 @@ #include <wlr/types/wlr_surface.h> #include <wlr/types/wlr_xdg_shell.h> #include <wlr/util/log.h> +#include "rootston/cursor.h" #include "rootston/desktop.h" #include "rootston/input.h" #include "rootston/server.h" @@ -33,6 +34,7 @@ static void popup_handle_destroy(struct wl_listener *listener, void *data) { static void popup_handle_map(struct wl_listener *listener, void *data) { struct roots_xdg_popup *popup = wl_container_of(listener, popup, map); view_damage_whole(popup->view_child.view); + input_update_cursor_focus(popup->view_child.view->desktop->server->input); } static void popup_handle_unmap(struct wl_listener *listener, void *data) { diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 219be2b0..1201ba68 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -34,6 +34,7 @@ static void popup_handle_map(struct wl_listener *listener, void *data) { struct roots_xdg_popup_v6 *popup = wl_container_of(listener, popup, map); view_damage_whole(popup->view_child.view); + input_update_cursor_focus(popup->view_child.view->desktop->server->input); } static void popup_handle_unmap(struct wl_listener *listener, void *data) { diff --git a/types/wlr_surface.c b/types/wlr_surface.c index f2b248ca..ab1dfc2d 100644 --- a/types/wlr_surface.c +++ b/types/wlr_surface.c @@ -360,10 +360,14 @@ static void surface_update_opaque_region(struct wlr_surface *surface) { } static void surface_commit_pending(struct wlr_surface *surface) { - bool invalid_buffer = surface->pending.committed & WLR_SURFACE_STATE_BUFFER; - surface_state_finalize(surface, &surface->pending); + if (surface->role && surface->role->precommit) { + surface->role->precommit(surface); + } + + bool invalid_buffer = surface->pending.committed & WLR_SURFACE_STATE_BUFFER; + surface->sx += surface->pending.dx; surface->sy += surface->pending.dy; surface_update_damage(&surface->buffer_damage, diff --git a/types/xdg_shell/wlr_xdg_popup.c b/types/xdg_shell/wlr_xdg_popup.c index 26d248e1..b3409261 100644 --- a/types/xdg_shell/wlr_xdg_popup.c +++ b/types/xdg_shell/wlr_xdg_popup.c @@ -214,7 +214,8 @@ static void xdg_popup_handle_resource_destroy(struct wl_resource *resource) { const struct wlr_surface_role xdg_popup_surface_role = { .name = "xdg_popup", - .commit = handle_xdg_surface_committed, + .commit = handle_xdg_surface_commit, + .precommit = handle_xdg_surface_precommit, }; void create_xdg_popup(struct wlr_xdg_surface *xdg_surface, diff --git a/types/xdg_shell/wlr_xdg_surface.c b/types/xdg_shell/wlr_xdg_surface.c index dd85c7b1..e32b7f18 100644 --- a/types/xdg_shell/wlr_xdg_surface.c +++ b/types/xdg_shell/wlr_xdg_surface.c @@ -326,7 +326,7 @@ static void xdg_surface_handle_surface_commit(struct wl_listener *listener, } } -void handle_xdg_surface_committed(struct wlr_surface *wlr_surface) { +void handle_xdg_surface_commit(struct wlr_surface *wlr_surface) { struct wlr_xdg_surface *surface = wlr_xdg_surface_from_wlr_surface(wlr_surface); if (surface == NULL) { @@ -368,6 +368,22 @@ void handle_xdg_surface_committed(struct wlr_surface *wlr_surface) { } } +void handle_xdg_surface_precommit(struct wlr_surface *wlr_surface) { + struct wlr_xdg_surface *surface = + wlr_xdg_surface_from_wlr_surface(wlr_surface); + if (surface == NULL) { + return; + } + + if (wlr_surface->pending.committed & WLR_SURFACE_STATE_BUFFER && + wlr_surface->pending.buffer_resource == NULL) { + // This is a NULL commit + if (surface->configured && surface->mapped) { + unmap_xdg_surface(surface); + } + } +} + static void xdg_surface_handle_surface_destroy(struct wl_listener *listener, void *data) { struct wlr_xdg_surface *xdg_surface = diff --git a/types/xdg_shell/wlr_xdg_toplevel.c b/types/xdg_shell/wlr_xdg_toplevel.c index 84c67820..77398c7e 100644 --- a/types/xdg_shell/wlr_xdg_toplevel.c +++ b/types/xdg_shell/wlr_xdg_toplevel.c @@ -451,7 +451,8 @@ static void xdg_toplevel_handle_resource_destroy(struct wl_resource *resource) { const struct wlr_surface_role xdg_toplevel_surface_role = { .name = "xdg_toplevel", - .commit = handle_xdg_surface_committed, + .commit = handle_xdg_surface_commit, + .precommit = handle_xdg_surface_precommit, }; void create_xdg_toplevel(struct wlr_xdg_surface *xdg_surface, diff --git a/types/xdg_shell_v6/wlr_xdg_popup_v6.c b/types/xdg_shell_v6/wlr_xdg_popup_v6.c index 59af020f..097e0253 100644 --- a/types/xdg_shell_v6/wlr_xdg_popup_v6.c +++ b/types/xdg_shell_v6/wlr_xdg_popup_v6.c @@ -251,7 +251,8 @@ void handle_xdg_surface_v6_popup_committed(struct wlr_xdg_surface_v6 *surface) { const struct wlr_surface_role xdg_popup_v6_surface_role = { .name = "xdg_popup_v6", - .commit = handle_xdg_surface_v6_committed, + .commit = handle_xdg_surface_v6_commit, + .precommit = handle_xdg_surface_v6_precommit, }; void create_xdg_popup_v6(struct wlr_xdg_surface_v6 *xdg_surface, diff --git a/types/xdg_shell_v6/wlr_xdg_surface_v6.c b/types/xdg_shell_v6/wlr_xdg_surface_v6.c index ca729c48..c4007c71 100644 --- a/types/xdg_shell_v6/wlr_xdg_surface_v6.c +++ b/types/xdg_shell_v6/wlr_xdg_surface_v6.c @@ -371,7 +371,7 @@ static void xdg_surface_handle_surface_commit(struct wl_listener *listener, } } -void handle_xdg_surface_v6_committed(struct wlr_surface *wlr_surface) { +void handle_xdg_surface_v6_commit(struct wlr_surface *wlr_surface) { struct wlr_xdg_surface_v6 *surface = wlr_xdg_surface_v6_from_wlr_surface(wlr_surface); if (surface == NULL) { @@ -407,9 +407,21 @@ void handle_xdg_surface_v6_committed(struct wlr_surface *wlr_surface) { surface->mapped = true; wlr_signal_emit_safe(&surface->events.map, surface); } - if (surface->configured && !wlr_surface_has_buffer(surface->surface) && - surface->mapped) { - unmap_xdg_surface_v6(surface); +} + +void handle_xdg_surface_v6_precommit(struct wlr_surface *wlr_surface) { + struct wlr_xdg_surface_v6 *surface = + wlr_xdg_surface_v6_from_wlr_surface(wlr_surface); + if (surface == NULL) { + return; + } + + if (wlr_surface->pending.committed & WLR_SURFACE_STATE_BUFFER && + wlr_surface->pending.buffer_resource == NULL) { + // This is a NULL commit + if (surface->configured && surface->mapped) { + unmap_xdg_surface_v6(surface); + } } } diff --git a/types/xdg_shell_v6/wlr_xdg_toplevel_v6.c b/types/xdg_shell_v6/wlr_xdg_toplevel_v6.c index 3490f337..297f49f5 100644 --- a/types/xdg_shell_v6/wlr_xdg_toplevel_v6.c +++ b/types/xdg_shell_v6/wlr_xdg_toplevel_v6.c @@ -421,7 +421,8 @@ static void xdg_toplevel_handle_resource_destroy(struct wl_resource *resource) { const struct wlr_surface_role xdg_toplevel_v6_surface_role = { .name = "xdg_toplevel_v6", - .commit = handle_xdg_surface_v6_committed, + .commit = handle_xdg_surface_v6_commit, + .precommit = handle_xdg_surface_v6_precommit, }; void create_xdg_toplevel_v6(struct wlr_xdg_surface_v6 *xdg_surface, diff --git a/xwayland/xwm.c b/xwayland/xwm.c index 6632b5fc..c939d8ea 100644 --- a/xwayland/xwm.c +++ b/xwayland/xwm.c @@ -654,9 +654,27 @@ static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) { } } +static void xwayland_surface_role_precommit(struct wlr_surface *wlr_surface) { + assert(wlr_surface->role == &xwayland_surface_role); + struct wlr_xwayland_surface *surface = wlr_surface->role_data; + if (surface == NULL) { + return; + } + + if (wlr_surface->pending.committed & WLR_SURFACE_STATE_BUFFER && + wlr_surface->pending.buffer_resource == NULL) { + // This is a NULL commit + if (surface->mapped) { + wlr_signal_emit_safe(&surface->events.unmap, surface); + surface->mapped = false; + } + } +} + static const struct wlr_surface_role xwayland_surface_role = { .name = "wlr_xwayland_surface", .commit = xwayland_surface_role_commit, + .precommit = xwayland_surface_role_precommit, }; static void handle_surface_destroy(struct wl_listener *listener, void *data) { @@ -1685,3 +1703,27 @@ void wlr_xwayland_surface_ping(struct wlr_xwayland_surface *surface) { surface->xwm->ping_timeout); surface->pinging = true; } + +bool wlr_xwayland_or_surface_wants_focus( + const struct wlr_xwayland_surface *surface) { + bool ret = true; + static enum atom_name needles[] = { + NET_WM_WINDOW_TYPE_COMBO, + NET_WM_WINDOW_TYPE_DND, + NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + NET_WM_WINDOW_TYPE_MENU, + NET_WM_WINDOW_TYPE_NOTIFICATION, + NET_WM_WINDOW_TYPE_POPUP_MENU, + NET_WM_WINDOW_TYPE_SPLASH, + NET_WM_WINDOW_TYPE_TOOLTIP, + NET_WM_WINDOW_TYPE_UTILITY, + }; + for (size_t i = 0; i < sizeof(needles) / sizeof(needles[0]); ++i) { + if (xwm_atoms_contains(surface->xwm, surface->window_type, + surface->window_type_len, needles[i])) { + ret = false; + } + } + + return ret; +} |