Merge gitlab.freedesktop.org:wlroots/wlroots

This commit is contained in:
Christian Kröner 2022-08-30 21:25:19 +02:00
commit 26f6fab4eb
275 changed files with 7472 additions and 5463 deletions

View file

@ -58,6 +58,7 @@ struct wlr_drm_backend {
const struct wlr_drm_interface *iface;
clockid_t clock;
bool addfb2_modifiers;
struct udev_hwdb *hwdb;
int fd;
char *name;
@ -89,15 +90,6 @@ struct wlr_drm_backend {
struct wlr_drm_format_set mgpu_formats;
};
enum wlr_drm_connector_status {
// Connector is available but no output is plugged in
WLR_DRM_CONN_DISCONNECTED,
// An output just has been plugged in and is waiting for a modeset
WLR_DRM_CONN_NEEDS_MODESET,
WLR_DRM_CONN_CLEANUP,
WLR_DRM_CONN_CONNECTED,
};
struct wlr_drm_mode {
struct wlr_output_mode wlr_mode;
drmModeModeInfo drm_mode;
@ -115,9 +107,10 @@ struct wlr_drm_connector {
struct wlr_drm_backend *backend;
char name[24];
enum wlr_drm_connector_status status;
drmModeConnection status;
bool desired_enabled;
uint32_t id;
uint64_t max_bpc;
struct wlr_drm_lease *lease;
struct wlr_drm_crtc *crtc;

View file

@ -21,6 +21,8 @@ union wlr_drm_connector_props {
uint32_t non_desktop;
uint32_t panel_orientation; // not guaranteed to exist
uint32_t tile;
uint32_t content_type; // not guaranteed to exist
uint32_t max_bpc; // not guaranteed to exist
// atomic-modesetting only
@ -76,4 +78,7 @@ bool get_drm_prop(int fd, uint32_t obj, uint32_t prop, uint64_t *ret);
void *get_drm_prop_blob(int fd, uint32_t obj, uint32_t prop, size_t *ret_len);
char *get_drm_prop_enum(int fd, uint32_t obj, uint32_t prop);
bool introspect_drm_prop_range(int fd, uint32_t prop_id,
uint64_t *min, uint64_t *max);
#endif

View file

@ -19,10 +19,6 @@ struct wlr_drm_renderer {
struct wlr_drm_surface {
struct wlr_drm_renderer *renderer;
uint32_t width;
uint32_t height;
struct wlr_swapchain *swapchain;
};
@ -40,7 +36,7 @@ bool init_drm_renderer(struct wlr_drm_backend *drm,
void finish_drm_renderer(struct wlr_drm_renderer *renderer);
bool init_drm_surface(struct wlr_drm_surface *surf,
struct wlr_drm_renderer *renderer, uint32_t width, uint32_t height,
struct wlr_drm_renderer *renderer, int width, int height,
const struct wlr_drm_format *drm_format);
bool drm_fb_import(struct wlr_drm_fb **fb, struct wlr_drm_backend *drm,

View file

@ -2,20 +2,17 @@
#define BACKEND_DRM_UTIL_H
#include <stdint.h>
#include <wlr/types/wlr_output.h>
#include <xf86drm.h>
#include <xf86drmMode.h>
struct wlr_drm_connector;
// Calculates a more accurate refresh rate (mHz) than what mode itself provides
int32_t calculate_refresh_rate(const drmModeModeInfo *mode);
// Populates the make/model/phys_{width,height} of output from the edid data
void parse_edid(struct wlr_output *restrict output, size_t len,
const uint8_t *data);
void parse_edid(struct wlr_drm_connector *conn, size_t len, const uint8_t *data);
// Parses the TILE property
void parse_tile(struct wlr_output *restrict output, size_t len,
const uint8_t *data);
// Returns the string representation of a DRM output type
const char *conn_get_name(uint32_t type_id);
void parse_tile(struct wlr_drm_connector *conn, size_t len, const uint8_t *data);
// Part of match_obj
enum {

View file

@ -5,13 +5,12 @@
#include <wayland-server-core.h>
#include <wlr/backend/interface.h>
#include <wlr/backend/libinput.h>
#include <wlr/interfaces/wlr_keyboard.h>
#include <wlr/interfaces/wlr_pointer.h>
#include <wlr/interfaces/wlr_switch.h>
#include <wlr/interfaces/wlr_tablet_pad.h>
#include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/interfaces/wlr_touch.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_pointer.h>
#include <wlr/types/wlr_switch.h>
#include <wlr/types/wlr_tablet_pad.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/types/wlr_touch.h>
struct wlr_libinput_backend {
struct wlr_backend backend;
@ -26,13 +25,21 @@ struct wlr_libinput_backend {
struct wl_listener session_destroy;
struct wl_listener session_signal;
struct wl_array wlr_device_lists; // struct wl_list *
struct wl_list devices; // wlr_libinput_device::link
};
struct wlr_libinput_input_device {
struct wlr_input_device wlr_input_device;
struct wl_list link;
struct libinput_device *handle;
struct wlr_keyboard keyboard;
struct wlr_pointer pointer;
struct wlr_switch switch_device;
struct wlr_touch touch;
struct wlr_tablet tablet;
struct wl_list tablet_tools; // see backend/libinput/tablet_tool.c
struct wlr_tablet_pad tablet_pad;
struct wl_list link;
};
uint32_t usec_to_msec(uint64_t usec);
@ -40,10 +47,6 @@ uint32_t usec_to_msec(uint64_t usec);
void handle_libinput_event(struct wlr_libinput_backend *state,
struct libinput_event *event);
struct wlr_input_device *get_appropriate_device(
enum wlr_input_device_type desired_type,
struct libinput_device *device);
void destroy_libinput_input_device(struct wlr_libinput_input_device *dev);
extern const struct wlr_keyboard_impl libinput_keyboard_impl;
@ -53,74 +56,83 @@ extern const struct wlr_tablet_impl libinput_tablet_impl;
extern const struct wlr_tablet_pad_impl libinput_tablet_pad_impl;
extern const struct wlr_touch_impl libinput_touch_impl;
struct wlr_keyboard *create_libinput_keyboard(
struct libinput_device *device);
void handle_keyboard_key(struct libinput_event *event,
struct libinput_device *device);
void init_device_keyboard(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_keyboard(struct wlr_keyboard *kb);
void handle_keyboard_key(struct libinput_event *event, struct wlr_keyboard *kb);
struct wlr_pointer *create_libinput_pointer(
struct libinput_device *device);
void init_device_pointer(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_pointer(struct wlr_pointer *kb);
void handle_pointer_motion(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_motion_abs(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_button(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_axis(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
#if LIBINPUT_HAS_SCROLL_VALUE120
void handle_pointer_axis_value120(struct libinput_event *event,
struct wlr_pointer *pointer, enum wlr_axis_source source);
#endif
void handle_pointer_swipe_begin(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_swipe_update(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_swipe_end(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_pinch_begin(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_pinch_update(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_pinch_end(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_hold_begin(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
void handle_pointer_hold_end(struct libinput_event *event,
struct libinput_device *device);
struct wlr_pointer *pointer);
struct wlr_switch *create_libinput_switch(
struct libinput_device *device);
void init_device_switch(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_switch(
struct wlr_switch *switch_device);
void handle_switch_toggle(struct libinput_event *event,
struct libinput_device *device);
struct wlr_switch *switch_device);
struct wlr_touch *create_libinput_touch(
struct libinput_device *device);
void init_device_touch(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_touch(
struct wlr_touch *touch);
void handle_touch_down(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
void handle_touch_up(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
void handle_touch_motion(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
void handle_touch_cancel(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
void handle_touch_frame(struct libinput_event *event,
struct libinput_device *device);
struct wlr_touch *touch);
struct wlr_tablet *create_libinput_tablet(
struct libinput_device *device);
void init_device_tablet(struct wlr_libinput_input_device *dev);
void finish_device_tablet(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_tablet(
struct wlr_tablet *tablet);
void handle_tablet_tool_axis(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet *tablet);
void handle_tablet_tool_proximity(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet *tablet);
void handle_tablet_tool_tip(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet *tablet);
void handle_tablet_tool_button(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet *tablet);
struct wlr_tablet_pad *create_libinput_tablet_pad(
struct libinput_device *device);
void init_device_tablet_pad(struct wlr_libinput_input_device *dev);
void finish_device_tablet_pad(struct wlr_libinput_input_device *dev);
struct wlr_libinput_input_device *device_from_tablet_pad(
struct wlr_tablet_pad *tablet_pad);
void handle_tablet_pad_button(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet_pad *tablet_pad);
void handle_tablet_pad_ring(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet_pad *tablet_pad);
void handle_tablet_pad_strip(struct libinput_event *event,
struct libinput_device *device);
struct wlr_tablet_pad *tablet_pad);
#endif

View file

@ -8,7 +8,11 @@
#include <wlr/backend/wayland.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_pointer.h>
#include <wlr/types/wlr_tablet_pad.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/types/wlr_touch.h>
#include <wlr/render/drm_format_set.h>
struct wlr_wl_backend {
@ -17,7 +21,6 @@ struct wlr_wl_backend {
/* local state */
bool started;
struct wl_display *local_display;
struct wl_list devices;
struct wl_list outputs;
int drm_fd;
struct wl_list buffers; // wlr_wl_buffer.link
@ -85,64 +88,73 @@ struct wlr_wl_output {
} cursor;
};
struct wlr_wl_input_device {
struct wlr_input_device wlr_input_device;
struct wl_list link;
uint32_t fingers;
struct wlr_wl_backend *backend;
struct wlr_wl_seat *seat;
void *resource;
};
struct wlr_wl_pointer {
struct wlr_pointer wlr_pointer;
struct wlr_wl_input_device *input_device;
struct wlr_wl_seat *seat;
struct wlr_wl_output *output;
enum wlr_axis_source axis_source;
int32_t axis_discrete;
uint32_t fingers; // trackpad gesture
struct wl_listener output_destroy;
struct wl_list link;
};
struct wlr_wl_seat {
char *name;
struct wl_seat *wl_seat;
struct wlr_wl_backend *backend;
struct wl_keyboard *wl_keyboard;
struct wlr_keyboard wlr_keyboard;
struct wl_pointer *wl_pointer;
struct wlr_wl_pointer *active_pointer;
struct wl_list pointers; // wlr_wl_pointer::link
struct zwp_pointer_gesture_swipe_v1 *gesture_swipe;
struct zwp_pointer_gesture_pinch_v1 *gesture_pinch;
struct zwp_pointer_gesture_hold_v1 *gesture_hold;
struct zwp_relative_pointer_v1 *relative_pointer;
enum wlr_axis_source axis_source;
int32_t axis_discrete;
struct wlr_wl_output *output;
struct wl_listener output_destroy;
};
struct wl_touch *wl_touch;
struct wlr_touch wlr_touch;
struct wlr_wl_seat {
struct wl_seat *wl_seat;
struct zwp_tablet_seat_v2 *zwp_tablet_seat_v2;
struct zwp_tablet_v2 *zwp_tablet_v2;
struct wlr_tablet wlr_tablet;
struct zwp_tablet_tool_v2 *zwp_tablet_tool_v2;
struct wlr_tablet_tool wlr_tablet_tool;
struct zwp_tablet_pad_v2 *zwp_tablet_pad_v2;
struct wlr_tablet_pad wlr_tablet_pad;
struct wl_list link; // wlr_wl_backend.seats
char *name;
struct wl_touch *touch;
struct wl_pointer *pointer;
struct wl_keyboard *keyboard;
struct wlr_wl_backend *backend;
struct wlr_wl_pointer *active_pointer;
};
struct wlr_wl_backend *get_wl_backend_from_backend(struct wlr_backend *backend);
void update_wl_output_cursor(struct wlr_wl_output *output);
struct wlr_wl_pointer *pointer_get_wl(struct wlr_pointer *wlr_pointer);
void create_wl_pointer(struct wlr_wl_seat *seat, struct wlr_wl_output *output);
void create_wl_keyboard(struct wlr_wl_seat *seat);
void create_wl_touch(struct wlr_wl_seat *seat);
struct wlr_wl_input_device *create_wl_input_device(
struct wlr_wl_seat *seat, enum wlr_input_device_type type);
void init_seat_keyboard(struct wlr_wl_seat *seat);
void init_seat_pointer(struct wlr_wl_seat *seat);
void finish_seat_pointer(struct wlr_wl_seat *seat);
void create_pointer(struct wlr_wl_seat *seat, struct wlr_wl_output *output);
void init_seat_touch(struct wlr_wl_seat *seat);
void init_seat_tablet(struct wlr_wl_seat *seat);
void finish_seat_tablet(struct wlr_wl_seat *seat);
bool create_wl_seat(struct wl_seat *wl_seat, struct wlr_wl_backend *wl);
void destroy_wl_seats(struct wlr_wl_backend *wl);
void destroy_wl_input_device(struct wlr_wl_input_device *dev);
void destroy_wl_buffer(struct wlr_wl_buffer *buffer);
extern const struct wl_seat_listener seat_listener;
extern const struct wlr_tablet_pad_impl tablet_pad_impl;
extern const struct wlr_tablet_impl tablet_impl;
struct wlr_wl_tablet_seat *wl_add_tablet_seat(
struct zwp_tablet_manager_v2 *manager,
struct wlr_wl_seat *seat);
extern const struct wlr_pointer_impl wl_pointer_impl;
extern const struct wlr_tablet_pad_impl wl_tablet_pad_impl;
extern const struct wlr_tablet_impl wl_tablet_impl;
#endif

View file

@ -0,0 +1,20 @@
#ifndef INTERFACES_INPUT_DEVICE_H
#define INTERFACES_INPUT_DEVICE_H
#include <wlr/types/wlr_input_device.h>
/**
* Initializes a given wlr_input_device. Allocates memory for the name and sets
* its vendor and product id to 0.
* wlr_device must be non-NULL.
*/
void wlr_input_device_init(struct wlr_input_device *wlr_device,
enum wlr_input_device_type type, const char *name);
/**
* Cleans up all the memory owned by a given wlr_input_device and signals
* the destroy event.
*/
void wlr_input_device_finish(struct wlr_input_device *wlr_device);
#endif

View file

@ -3,6 +3,47 @@
#include <wlr/render/egl.h>
struct wlr_egl {
EGLDisplay display;
EGLContext context;
EGLDeviceEXT device; // may be EGL_NO_DEVICE_EXT
struct gbm_device *gbm_device;
struct {
// Display extensions
bool KHR_image_base;
bool EXT_image_dma_buf_import;
bool EXT_image_dma_buf_import_modifiers;
bool IMG_context_priority;
// Device extensions
bool EXT_device_drm;
bool EXT_device_drm_render_node;
// Client extensions
bool EXT_device_query;
bool KHR_platform_gbm;
bool EXT_platform_device;
} exts;
struct {
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT;
PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
PFNEGLQUERYWAYLANDBUFFERWL eglQueryWaylandBufferWL;
PFNEGLQUERYDMABUFFORMATSEXTPROC eglQueryDmaBufFormatsEXT;
PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT;
PFNEGLDEBUGMESSAGECONTROLKHRPROC eglDebugMessageControlKHR;
PFNEGLQUERYDISPLAYATTRIBEXTPROC eglQueryDisplayAttribEXT;
PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT;
PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT;
} procs;
bool has_modifiers;
struct wlr_drm_format_set dmabuf_texture_formats;
struct wlr_drm_format_set dmabuf_render_formats;
};
struct wlr_egl_context {
EGLDisplay display;
EGLContext context;
@ -60,4 +101,16 @@ void wlr_egl_save_context(struct wlr_egl_context *context);
*/
bool wlr_egl_restore_context(struct wlr_egl_context *context);
/**
* Make the EGL context current.
*
* Callers are expected to clear the current context when they are done by
* calling wlr_egl_unset_current().
*/
bool wlr_egl_make_current(struct wlr_egl *egl);
bool wlr_egl_unset_current(struct wlr_egl *egl);
bool wlr_egl_is_current(struct wlr_egl *egl);
#endif

View file

@ -17,6 +17,8 @@
struct wlr_gles2_pixel_format {
uint32_t drm_format;
// optional field, if empty then internalformat = format
GLint gl_internalformat;
GLint gl_format, gl_type;
bool has_alpha;
};
@ -45,6 +47,7 @@ struct wlr_gles2_renderer {
bool OES_egl_image;
bool EXT_texture_type_2_10_10_10_REV;
bool OES_texture_half_float_linear;
bool EXT_texture_norm16;
} exts;
struct {

View file

@ -69,4 +69,13 @@ struct wlr_dmabuf_buffer *dmabuf_buffer_create(
*/
bool dmabuf_buffer_drop(struct wlr_dmabuf_buffer *buffer);
/**
* Check whether a buffer is fully opaque.
*
* When true is returned, the buffer is guaranteed to be fully opaque, but the
* reverse is not true: false may be returned in cases where the buffer is fully
* opaque.
*/
bool buffer_is_opaque(struct wlr_buffer *buffer);
#endif

View file

@ -1,7 +1,7 @@
#include <wlr/types/wlr_keyboard.h>
void keyboard_key_update(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event);
struct wlr_keyboard_key_event *event);
bool keyboard_modifier_update(struct wlr_keyboard *keyboard);

View file

@ -0,0 +1,15 @@
#ifndef TYPES_WLR_MATRIX_H
#define TYPES_WLR_MATRIX_H
#include <wlr/types/wlr_matrix.h>
/**
* Writes a 2D orthographic projection matrix to mat of (width, height) with a
* specified wl_output_transform.
*
* Equivalent to glOrtho(0, width, 0, height, 1, -1) with the transform applied.
*/
void matrix_projection(float mat[static 9], int width, int height,
enum wl_output_transform transform);
#endif

View file

@ -4,12 +4,15 @@
#include <wlr/render/drm_format_set.h>
#include <wlr/types/wlr_output.h>
void output_pending_resolution(struct wlr_output *output, int *width,
int *height);
void output_pending_resolution(struct wlr_output *output,
const struct wlr_output_state *state, int *width, int *height);
void output_state_attach_buffer(struct wlr_output_state *state,
struct wlr_buffer *buffer);
struct wlr_drm_format *output_pick_format(struct wlr_output *output,
const struct wlr_drm_format_set *display_formats, uint32_t format);
void output_clear_back_buffer(struct wlr_output *output);
bool output_ensure_buffer(struct wlr_output *output);
bool output_ensure_buffer(struct wlr_output *output,
const struct wlr_output_state *state, bool *new_back_buffer);
#endif

View file

@ -0,0 +1,8 @@
#ifndef TYPES_WLR_SCENE_H
#define TYPES_WLR_SCENE_H
#include <wlr/types/wlr_scene.h>
struct wlr_scene *scene_node_get_root(struct wlr_scene_node *node);
#endif

View file

@ -26,6 +26,10 @@ void create_xdg_popup(struct wlr_xdg_surface *surface,
void unmap_xdg_popup(struct wlr_xdg_popup *popup);
void destroy_xdg_popup(struct wlr_xdg_popup *popup);
void handle_xdg_popup_committed(struct wlr_xdg_popup *popup);
struct wlr_xdg_popup_configure *send_xdg_popup_configure(
struct wlr_xdg_popup *popup);
void handle_xdg_popup_ack_configure(struct wlr_xdg_popup *popup,
struct wlr_xdg_popup_configure *configure);
void create_xdg_toplevel(struct wlr_xdg_surface *surface,
uint32_t id);

View file

@ -1,30 +1,18 @@
#ifndef UTIL_ARRAY_H
#define UTIL_ARRAY_H
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <wayland-util.h>
size_t push_zeroes_to_end(uint32_t arr[], size_t n);
/**
* Add `target` to `values` if it doesn't exist
* "set"s should only be modified with set_* functions
* Values MUST be greater than 0
*/
bool set_add(uint32_t values[], size_t *len, size_t cap, uint32_t target);
/**
* Remove `target` from `values` if it exists
* "set"s should only be modified with set_* functions
* Values MUST be greater than 0
*/
bool set_remove(uint32_t values[], size_t *len, size_t cap, uint32_t target);
/**
* Remove a chunk of memory of the specified size at the specified offset.
*/
void array_remove_at(struct wl_array *arr, size_t offset, size_t size);
/**
* Grow or shrink the array to fit the specifized size.
*/
bool array_realloc(struct wl_array *arr, size_t size);
#endif

11
include/util/env.h Normal file
View file

@ -0,0 +1,11 @@
#ifndef UTIL_ENV_H
#define UTIL_ENV_H
#include <stdbool.h>
#include <unistd.h>
bool env_parse_bool(const char *option);
ssize_t env_parse_switch(const char *option, const char **switches);
#endif

29
include/util/set.h Normal file
View file

@ -0,0 +1,29 @@
#ifndef UTIL_SET_H
#define UTIL_SET_H
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
/**
* Add target to values.
*
* Target is added to the end of the set.
*
* Returns the index of target, or -1 if the set is full or target already
* exists.
*/
ssize_t set_add(uint32_t values[], size_t *len, size_t cap, uint32_t target);
/**
* Remove target from values.
*
* When target is removed, the last element of the set is moved to where
* target was.
*
* Returns the previous index of target, or -1 if target wasn't in values.
*/
ssize_t set_remove(uint32_t values[], size_t *len, size_t cap, uint32_t target);
#endif

View file

@ -1,8 +0,0 @@
#ifndef UTIL_SIGNAL_H
#define UTIL_SIGNAL_H
#include <wayland-server-core.h>
void wlr_signal_emit_safe(struct wl_signal *signal, void *data);
#endif

View file

@ -14,22 +14,25 @@
struct wlr_backend_impl;
/**
* A backend provides a set of input and output devices.
*/
struct wlr_backend {
const struct wlr_backend_impl *impl;
struct {
/** Raised when destroyed, passed the wlr_backend reference */
/** Raised when destroyed */
struct wl_signal destroy;
/** Raised when new inputs are added, passed the wlr_input_device */
/** Raised when new inputs are added, passed the struct wlr_input_device */
struct wl_signal new_input;
/** Raised when new outputs are added, passed the wlr_output */
/** Raised when new outputs are added, passed the struct wlr_output */
struct wl_signal new_output;
} events;
};
/**
* Automatically initializes the most suitable backend given the environment.
* Will always return a multibackend. The backend is created but not started.
* Will always return a multi-backend. The backend is created but not started.
* Returns NULL on failure.
*/
struct wlr_backend *wlr_backend_autocreate(struct wl_display *display);
@ -41,11 +44,11 @@ struct wlr_backend *wlr_backend_autocreate(struct wl_display *display);
bool wlr_backend_start(struct wlr_backend *backend);
/**
* Destroy the backend and clean up all of its resources. Normally called
* automatically when the wl_display is destroyed.
* automatically when the struct wl_display is destroyed.
*/
void wlr_backend_destroy(struct wlr_backend *backend);
/**
* Obtains the wlr_session reference from this backend if there is any.
* Obtains the struct wlr_session reference from this backend if there is any.
* Might return NULL for backends that don't use a session.
*/
struct wlr_session *wlr_backend_get_session(struct wlr_backend *backend);

View file

@ -48,8 +48,9 @@ bool wlr_output_is_drm(struct wlr_output *output);
uint32_t wlr_drm_connector_get_id(struct wlr_output *output);
/**
* Tries to open non-master DRM FD. The compositor must not call `drmSetMaster`
* Tries to open non-master DRM FD. The compositor must not call drmSetMaster()
* on the returned FD.
*
* Returns a valid opened DRM FD, or -1 on error.
*/
int wlr_drm_backend_get_non_master_fd(struct wlr_backend *backend);
@ -71,7 +72,7 @@ struct wlr_drm_lease *wlr_drm_create_lease(struct wlr_output **outputs,
void wlr_drm_lease_terminate(struct wlr_drm_lease *lease);
/**
* Add mode to the list of available modes
* Add mode to the list of available modes.
*/
typedef struct _drmModeModeInfo drmModeModeInfo;
struct wlr_output_mode *wlr_drm_connector_add_mode(struct wlr_output *output,

View file

@ -10,7 +10,6 @@
#define WLR_BACKEND_HEADLESS_H
#include <wlr/backend.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output.h>
/**
@ -19,9 +18,9 @@
*/
struct wlr_backend *wlr_headless_backend_create(struct wl_display *display);
/**
* Create a new headless output backed by an in-memory EGL framebuffer. You can
* read pixels from this framebuffer via wlr_renderer_read_pixels but it is
* otherwise not displayed.
* Create a new headless output.
*
* The buffers presented on the output won't be displayed to the user.
*/
struct wlr_output *wlr_headless_add_output(struct wlr_backend *backend,
unsigned int width, unsigned int height);

View file

@ -23,8 +23,8 @@ struct wlr_backend_impl {
};
/**
* Initializes common state on a wlr_backend and sets the implementation to the
* provided wlr_backend_impl reference.
* Initializes common state on a struct wlr_backend and sets the implementation
* to the provided struct wlr_backend_impl reference.
*/
void wlr_backend_init(struct wlr_backend *backend,
const struct wlr_backend_impl *impl);

View file

@ -13,11 +13,14 @@
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/backend/session.h>
#include <wlr/types/wlr_input_device.h>
struct wlr_input_device;
struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
struct wlr_session *session);
/** Gets the underlying libinput_device handle for the given wlr_input_device */
/**
* Gets the underlying struct libinput_device handle for the given input device.
*/
struct libinput_device *wlr_libinput_get_device_handle(
struct wlr_input_device *dev);

View file

@ -79,36 +79,33 @@ struct wlr_device_change_event {
* This should not be called if another program is already in control
* of the terminal (Xorg, another Wayland compositor, etc.).
*
* If libseat support is not enabled, or if a standalone backend is to be used,
* then you must have CAP_SYS_ADMIN or be root. It is safe to drop privileges
* after this is called.
*
* Returns NULL on error.
*/
struct wlr_session *wlr_session_create(struct wl_display *disp);
/*
* Closes a previously opened session and restores the virtual terminal.
* You should call wlr_session_close_file on each files you opened
* with wlr_session_open_file before you call this.
* You should call wlr_session_close_file() on each files you opened
* with wlr_session_open_file() before you call this.
*/
void wlr_session_destroy(struct wlr_session *session);
/*
* Opens the file at path.
* This can only be used to open DRM or evdev (input) devices.
*
* This can only be used to open DRM or evdev (input) devices. Files opened via
* this function must be closed by calling wlr_session_close_file().
*
* When the session becomes inactive:
*
* - DRM files lose their DRM master status
* - evdev files become invalid and should be closed
*
* Returns -errno on error.
*/
struct wlr_device *wlr_session_open_file(struct wlr_session *session,
const char *path);
/*
* Closes a file previously opened with wlr_session_open_file.
* Closes a file previously opened with wlr_session_open_file().
*/
void wlr_session_close_file(struct wlr_session *session,
struct wlr_device *device);

View file

@ -4,22 +4,23 @@
#include <wayland-client.h>
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output.h>
struct wlr_input_device;
/**
* Creates a new wlr_wl_backend. This backend will be created with no outputs;
* you must use wlr_wl_output_create to add them.
* Creates a new Wayland backend. This backend will be created with no outputs;
* you must use wlr_wl_output_create() to add them.
*
* The `remote` argument is the name of the host compositor wayland socket. Set
* to NULL for the default behaviour (WAYLAND_DISPLAY env variable or wayland-0
* default)
* default).
*/
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
const char *remote);
/**
* Returns the remote wl_display used by the Wayland backend.
* Returns the remote struct wl_display used by the Wayland backend.
*/
struct wl_display *wlr_wl_backend_get_remote_display(struct wlr_backend *backend);
@ -27,37 +28,37 @@ struct wl_display *wlr_wl_backend_get_remote_display(struct wlr_backend *backend
* Adds a new output to this backend. You may remove outputs by destroying them.
* Note that if called before initializing the backend, this will return NULL
* and your outputs will be created during initialization (and given to you via
* the output_add signal).
* the new_output signal).
*/
struct wlr_output *wlr_wl_output_create(struct wlr_backend *backend);
/**
* True if the given backend is a wlr_wl_backend.
* Check whether the provided backend is a Wayland backend.
*/
bool wlr_backend_is_wl(struct wlr_backend *backend);
/**
* True if the given input device is a wlr_wl_input_device.
* Check whether the provided input device is a Wayland input device.
*/
bool wlr_input_device_is_wl(struct wlr_input_device *device);
/**
* True if the given output is a wlr_wl_output.
* Check whether the provided output device is a Wayland output device.
*/
bool wlr_output_is_wl(struct wlr_output *output);
/**
* Sets the title of a wlr_output which is a Wayland window.
* Sets the title of a struct wlr_output which is a Wayland toplevel.
*/
void wlr_wl_output_set_title(struct wlr_output *output, const char *title);
/**
* Returns the remote wl_surface used by the Wayland output.
* Returns the remote struct wl_surface used by the Wayland output.
*/
struct wl_surface *wlr_wl_output_get_surface(struct wlr_output *output);
/**
* Returns the remote wl_seat for a Wayland input device.
* Returns the remote struct wl_seat for a Wayland input device.
*/
struct wl_seat *wlr_wl_input_device_get_seat(struct wlr_input_device *dev);

View file

@ -6,15 +6,16 @@
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output.h>
struct wlr_input_device;
/**
* Creates a new wlr_x11_backend. This backend will be created with no outputs;
* you must use wlr_x11_output_create to add them.
* Creates a new X11 backend. This backend will be created with no outputs;
* you must use wlr_x11_output_create() to add them.
*
* The `x11_display` argument is the name of the X Display socket. Set
* to NULL for the default behaviour of XOpenDisplay.
* to NULL for the default behaviour of XOpenDisplay().
*/
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
const char *x11_display);
@ -23,27 +24,27 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
* Adds a new output to this backend. You may remove outputs by destroying them.
* Note that if called before initializing the backend, this will return NULL
* and your outputs will be created during initialization (and given to you via
* the output_add signal).
* the new_output signal).
*/
struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend);
/**
* True if the given backend is a wlr_x11_backend.
* Check whether this backend is an X11 backend.
*/
bool wlr_backend_is_x11(struct wlr_backend *backend);
/**
* True if the given input device is a wlr_x11_input_device.
* Check whether this input device is an X11 input device.
*/
bool wlr_input_device_is_x11(struct wlr_input_device *device);
/**
* True if the given output is a wlr_x11_output.
* Check whether this output device is an X11 output device.
*/
bool wlr_output_is_x11(struct wlr_output *output);
/**
* Sets the title of a wlr_output which is an X11 window.
* Sets the title of a struct wlr_output which is an X11 window.
*/
void wlr_x11_output_set_title(struct wlr_output *output, const char *title);

View file

@ -6,9 +6,10 @@
#mesondefine WLR_HAS_X11_BACKEND
#mesondefine WLR_HAS_GLES2_RENDERER
#mesondefine WLR_HAS_VULKAN_RENDERER
#mesondefine WLR_HAS_GBM_ALLOCATOR
#mesondefine WLR_HAS_XWAYLAND
#endif

View file

@ -0,0 +1,48 @@
/*
* 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_BUFFER_H
#define WLR_INTERFACES_WLR_BUFFER_H
#include <wlr/types/wlr_buffer.h>
struct wlr_buffer_impl {
void (*destroy)(struct wlr_buffer *buffer);
bool (*get_dmabuf)(struct wlr_buffer *buffer,
struct wlr_dmabuf_attributes *attribs);
bool (*get_shm)(struct wlr_buffer *buffer,
struct wlr_shm_attributes *attribs);
bool (*begin_data_ptr_access)(struct wlr_buffer *buffer, uint32_t flags,
void **data, uint32_t *format, size_t *stride);
void (*end_data_ptr_access)(struct wlr_buffer *buffer);
};
struct wlr_buffer_resource_interface {
const char *name;
bool (*is_instance)(struct wl_resource *resource);
struct wlr_buffer *(*from_resource)(struct wl_resource *resource);
};
/**
* Initialize a buffer. This function should be called by producers. The
* initialized buffer is referenced: once the producer is done with the buffer
* they should call wlr_buffer_drop().
*/
void wlr_buffer_init(struct wlr_buffer *buffer,
const struct wlr_buffer_impl *impl, int width, int height);
/**
* Allows the registration of a struct wl_resource implementation.
*
* The matching function will be called for the struct wl_resource when creating
* a struct wlr_buffer from a struct wl_resource.
*/
void wlr_buffer_register_resource_interface(
const struct wlr_buffer_resource_interface *iface);
#endif

View file

@ -13,15 +13,20 @@
#include <wlr/types/wlr_keyboard.h>
struct wlr_keyboard_impl {
void (*destroy)(struct wlr_keyboard *keyboard);
const char *name;
void (*led_update)(struct wlr_keyboard *keyboard, uint32_t leds);
};
void wlr_keyboard_init(struct wlr_keyboard *keyboard,
const struct wlr_keyboard_impl *impl, const char *name);
void wlr_keyboard_destroy(struct wlr_keyboard *keyboard);
const struct wlr_keyboard_impl *impl, const char *name);
/**
* Cleans up all of the resources owned by the struct wlr_keyboard.
*/
void wlr_keyboard_finish(struct wlr_keyboard *keyboard);
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_event_keyboard_key *event);
struct wlr_keyboard_key_event *event);
void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
uint32_t group);

View file

@ -22,10 +22,10 @@
WLR_OUTPUT_STATE_SCALE | \
WLR_OUTPUT_STATE_TRANSFORM | \
WLR_OUTPUT_STATE_RENDER_FORMAT | \
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED)
WLR_OUTPUT_STATE_SUBPIXEL)
/**
* A backend implementation of wlr_output.
* A backend implementation of struct wlr_output.
*
* The commit function is mandatory. Other functions are optional.
*/
@ -38,7 +38,7 @@ struct wlr_output_impl {
* The hotspot indicates the offset that needs to be applied to the
* top-left corner of the image to match the cursor position. In other
* words, the image should be displayed at (x - hotspot_x, y - hotspot_y).
* The hotspot is given in the texture's coordinate space.
* The hotspot is given in the buffer's coordinate space.
*/
bool (*set_cursor)(struct wlr_output *output, struct wlr_buffer *buffer,
int hotspot_x, int hotspot_y);
@ -53,18 +53,18 @@ struct wlr_output_impl {
*/
void (*destroy)(struct wlr_output *output);
/**
* Check that the pending output state is a valid configuration.
* Check that the supplied output state is a valid configuration.
*
* If this function returns true, commit can only fail due to a runtime
* error.
*/
bool (*test)(struct wlr_output *output);
bool (*test)(struct wlr_output *output, const struct wlr_output_state *state);
/**
* Commit the pending output state.
* Commit the supplied output state.
*
* If a buffer has been attached, a frame event is scheduled.
*/
bool (*commit)(struct wlr_output *output);
bool (*commit)(struct wlr_output *output, const struct wlr_output_state *state);
/**
* Get the maximum number of gamma LUT elements for each channel.
*

View file

@ -12,11 +12,11 @@
#include <wlr/types/wlr_pointer.h>
struct wlr_pointer_impl {
void (*destroy)(struct wlr_pointer *pointer);
const char *name;
};
void wlr_pointer_init(struct wlr_pointer *pointer,
const struct wlr_pointer_impl *impl, const char *name);
void wlr_pointer_destroy(struct wlr_pointer *pointer);
void wlr_pointer_finish(struct wlr_pointer *pointer);
#endif

View file

@ -12,11 +12,11 @@
#include <wlr/types/wlr_switch.h>
struct wlr_switch_impl {
void (*destroy)(struct wlr_switch *switch_device);
const char *name;
};
void wlr_switch_init(struct wlr_switch *switch_device,
const struct wlr_switch_impl *impl, const char *name);
void wlr_switch_destroy(struct wlr_switch *switch_device);
void wlr_switch_finish(struct wlr_switch *switch_device);
#endif

View file

@ -12,11 +12,19 @@
#include <wlr/types/wlr_tablet_pad.h>
struct wlr_tablet_pad_impl {
void (*destroy)(struct wlr_tablet_pad *pad);
const char *name;
};
void wlr_tablet_pad_init(struct wlr_tablet_pad *pad,
const struct wlr_tablet_pad_impl *impl, const char *name);
void wlr_tablet_pad_destroy(struct wlr_tablet_pad *pad);
/**
* Cleans up the resources owned by a struct wlr_tablet_pad.
*
* This function will not clean the memory allocated by
* struct wlr_tablet_pad_group, it's the responsibility of the caller to clean
* it.
*/
void wlr_tablet_pad_finish(struct wlr_tablet_pad *pad);
#endif

View file

@ -12,11 +12,11 @@
#include <wlr/types/wlr_tablet_tool.h>
struct wlr_tablet_impl {
void (*destroy)(struct wlr_tablet *tablet);
const char *name;
};
void wlr_tablet_init(struct wlr_tablet *tablet,
const struct wlr_tablet_impl *impl, const char *name);
void wlr_tablet_destroy(struct wlr_tablet *tablet);
void wlr_tablet_finish(struct wlr_tablet *tablet);
#endif

View file

@ -12,11 +12,11 @@
#include <wlr/types/wlr_touch.h>
struct wlr_touch_impl {
void (*destroy)(struct wlr_touch *touch);
const char *name;
};
void wlr_touch_init(struct wlr_touch *touch,
const struct wlr_touch_impl *impl, const char *name);
void wlr_touch_destroy(struct wlr_touch *touch);
void wlr_touch_finish(struct wlr_touch *touch);
#endif

View file

@ -1,4 +1,5 @@
version_array = meson.project_version().split('.')
version_base = meson.project_version().split('-')[0]
version_array = version_base.split('.')
version_data = configuration_data()
version_data.set_quoted('WLR_VERSION_STR', meson.project_version())
version_data.set('WLR_VERSION_MAJOR', version_array[0])

View file

@ -37,7 +37,7 @@ struct wlr_allocator {
};
/**
* Creates the adequate wlr_allocator given a backend and a renderer
* Creates the adequate struct wlr_allocator given a backend and a renderer.
*/
struct wlr_allocator *wlr_allocator_autocreate(struct wlr_backend *backend,
struct wlr_renderer *renderer);
@ -50,7 +50,7 @@ void wlr_allocator_destroy(struct wlr_allocator *alloc);
* Allocate a new buffer.
*
* When the caller is done with it, they must unreference it by calling
* wlr_buffer_drop.
* wlr_buffer_drop().
*
* The `format` passed in indicates the format to use and the list of
* acceptable modifiers. The order in which modifiers are listed is not

View file

@ -51,7 +51,7 @@ struct wlr_drm_format_set {
void wlr_drm_format_set_finish(struct wlr_drm_format_set *set);
/**
* Return a pointer to a member of this `wlr_drm_format_set` of format
* Return a pointer to a member of this struct wlr_drm_format_set of format
* `format`, or NULL if none exists.
*/
const struct wlr_drm_format *wlr_drm_format_set_get(

View file

@ -9,9 +9,6 @@
#ifndef WLR_RENDER_EGL_H
#define WLR_RENDER_EGL_H
#ifndef MESA_EGL_NO_X11_HEADERS
#define MESA_EGL_NO_X11_HEADERS
#endif
#ifndef EGL_NO_X11
#define EGL_NO_X11
#endif
@ -29,60 +26,31 @@
#include <wlr/render/dmabuf.h>
#include <wlr/render/drm_format_set.h>
struct wlr_egl {
EGLDisplay display;
EGLContext context;
EGLDeviceEXT device; // may be EGL_NO_DEVICE_EXT
struct gbm_device *gbm_device;
struct {
// Display extensions
bool KHR_image_base;
bool EXT_image_dma_buf_import;
bool EXT_image_dma_buf_import_modifiers;
bool IMG_context_priority;
// Device extensions
bool EXT_device_drm;
bool EXT_device_drm_render_node;
// Client extensions
bool EXT_device_query;
bool KHR_platform_gbm;
bool EXT_platform_device;
} exts;
struct {
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT;
PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHR;
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHR;
PFNEGLQUERYWAYLANDBUFFERWL eglQueryWaylandBufferWL;
PFNEGLQUERYDMABUFFORMATSEXTPROC eglQueryDmaBufFormatsEXT;
PFNEGLQUERYDMABUFMODIFIERSEXTPROC eglQueryDmaBufModifiersEXT;
PFNEGLDEBUGMESSAGECONTROLKHRPROC eglDebugMessageControlKHR;
PFNEGLQUERYDISPLAYATTRIBEXTPROC eglQueryDisplayAttribEXT;
PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT;
PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT;
} procs;
bool has_modifiers;
struct wlr_drm_format_set dmabuf_texture_formats;
struct wlr_drm_format_set dmabuf_render_formats;
};
struct wlr_egl;
/**
* Create a struct wlr_egl with an existing EGL display and context.
*
* This is typically used by compositors which want to customize EGL
* initialization.
*/
struct wlr_egl *wlr_egl_create_with_context(EGLDisplay display,
EGLContext context);
/**
* Make the EGL context current.
* Get the EGL display used by the struct wlr_egl.
*
* Callers are expected to clear the current context when they are done by
* calling wlr_egl_unset_current.
* This is typically used by compositors which need to perform custom OpenGL
* operations.
*/
bool wlr_egl_make_current(struct wlr_egl *egl);
EGLDisplay wlr_egl_get_display(struct wlr_egl *egl);
bool wlr_egl_unset_current(struct wlr_egl *egl);
bool wlr_egl_is_current(struct wlr_egl *egl);
/**
* Get the EGL context used by the struct wlr_egl.
*
* This is typically used by compositors which need to perform custom OpenGL
* operations.
*/
EGLContext wlr_egl_get_context(struct wlr_egl *egl);
#endif

View file

@ -54,11 +54,8 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
const struct wlr_renderer_impl *impl);
struct wlr_texture_impl {
bool (*is_opaque)(struct wlr_texture *texture);
bool (*write_pixels)(struct wlr_texture *texture,
uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
const void *data);
bool (*update_from_buffer)(struct wlr_texture *texture,
struct wlr_buffer *buffer, pixman_region32_t *damage);
void (*destroy)(struct wlr_texture *texture);
};

View file

@ -77,13 +77,13 @@ void wlr_render_quad_with_matrix(struct wlr_renderer *r,
const float color[static 4], const float matrix[static 9]);
/**
* Get the shared-memory formats supporting import usage. Buffers allocated
* with a format from this list may be imported via wlr_texture_from_pixels.
* with a format from this list may be imported via wlr_texture_from_pixels().
*/
const uint32_t *wlr_renderer_get_shm_texture_formats(
struct wlr_renderer *r, size_t *len);
/**
* Get the DMA-BUF formats supporting sampling usage. Buffers allocated with
* a format from this list may be imported via wlr_texture_from_dmabuf.
* a format from this list may be imported via wlr_texture_from_dmabuf().
*/
const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_texture_formats(
struct wlr_renderer *renderer);
@ -92,7 +92,7 @@ const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_texture_formats(
* bytes.
*
* If `flags` is not NULl, the caller indicates that it accepts frame flags
* defined in `enum wlr_renderer_read_pixels_flags`.
* defined in enum wlr_renderer_read_pixels_flags.
*/
bool wlr_renderer_read_pixels(struct wlr_renderer *r, uint32_t fmt,
uint32_t *flags, uint32_t stride, uint32_t width, uint32_t height,
@ -107,7 +107,7 @@ bool wlr_renderer_init_wl_display(struct wlr_renderer *r,
struct wl_display *wl_display);
/**
* Initializes wl_shm on the provided wl_display.
* Initializes wl_shm on the provided struct wl_display.
*/
bool wlr_renderer_init_wl_shm(struct wlr_renderer *r,
struct wl_display *wl_display);
@ -120,7 +120,9 @@ bool wlr_renderer_init_wl_shm(struct wlr_renderer *r,
int wlr_renderer_get_drm_fd(struct wlr_renderer *r);
/**
* Destroys this wlr_renderer. Textures must be destroyed separately.
* Destroys the renderer.
*
* Textures must be destroyed separately.
*/
void wlr_renderer_destroy(struct wlr_renderer *renderer);

View file

@ -9,6 +9,7 @@
#ifndef WLR_RENDER_WLR_TEXTURE_H
#define WLR_RENDER_WLR_TEXTURE_H
#include <pixman.h>
#include <stdint.h>
#include <wayland-server-core.h>
#include <wlr/render/dmabuf.h>
@ -25,9 +26,6 @@ struct wlr_texture {
/**
* Create a new texture from raw pixel data. `stride` is in bytes. The returned
* texture is mutable.
*
* Should not be called in a rendering block like renderer_begin()/end() or
* between attaching a renderer to an output and committing it.
*/
struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
uint32_t fmt, uint32_t stride, uint32_t width, uint32_t height,
@ -35,40 +33,30 @@ struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
/**
* Create a new texture from a DMA-BUF. The returned texture is immutable.
*
* Should not be called in a rendering block like renderer_begin()/end() or
* between attaching a renderer to an output and committing it.
*/
struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer,
struct wlr_dmabuf_attributes *attribs);
/**
* Returns true if this texture is using a fully opaque format.
*/
bool wlr_texture_is_opaque(struct wlr_texture *texture);
/**
* Update a texture with raw pixels. The texture must be mutable, and the input
* data must have the same pixel format that the texture was created with.
* Update a texture with a struct wlr_buffer's contents.
*
* Should not be called in a rendering block like renderer_begin()/end() or
* between attaching a renderer to an output and committing it.
* The update might be rejected (in case the texture is immutable, the buffer
* has an unsupported type/format, etc), so callers must be prepared to fall
* back to re-creating the texture from scratch via wlr_texture_from_buffer().
*
* The damage can be used by the renderer as an optimization: only the supplied
* region needs to be updated.
*/
bool wlr_texture_write_pixels(struct wlr_texture *texture,
uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
const void *data);
bool wlr_texture_update_from_buffer(struct wlr_texture *texture,
struct wlr_buffer *buffer, pixman_region32_t *damage);
/**
* Destroys this wlr_texture.
* Destroys the texture.
*/
void wlr_texture_destroy(struct wlr_texture *texture);
/**
* Create a new texture from a buffer.
*
* Should not be called in a rendering block like renderer_begin()/end() or
* between attaching a renderer to an output and committing it.
*/
struct wlr_texture *wlr_texture_from_buffer(struct wlr_renderer *renderer,
struct wlr_buffer *buffer);

View file

@ -24,22 +24,11 @@ struct wlr_shm_attributes {
off_t offset;
};
struct wlr_buffer_impl {
void (*destroy)(struct wlr_buffer *buffer);
bool (*get_dmabuf)(struct wlr_buffer *buffer,
struct wlr_dmabuf_attributes *attribs);
bool (*get_shm)(struct wlr_buffer *buffer,
struct wlr_shm_attributes *attribs);
bool (*begin_data_ptr_access)(struct wlr_buffer *buffer, uint32_t flags,
void **data, uint32_t *format, size_t *stride);
void (*end_data_ptr_access)(struct wlr_buffer *buffer);
};
/**
* Buffer capabilities.
*
* These bits indicate the features supported by a wlr_buffer. There is one bit
* per function in wlr_buffer_impl.
* These bits indicate the features supported by a struct wlr_buffer. There is
* one bit per function in struct wlr_buffer_impl.
*/
enum wlr_buffer_cap {
WLR_BUFFER_CAP_DATA_PTR = 1 << 0,
@ -72,19 +61,6 @@ struct wlr_buffer {
struct wlr_addon_set addons;
};
struct wlr_buffer_resource_interface {
const char *name;
bool (*is_instance)(struct wl_resource *resource);
struct wlr_buffer *(*from_resource)(struct wl_resource *resource);
};
/**
* Initialize a buffer. This function should be called by producers. The
* initialized buffer is referenced: once the producer is done with the buffer
* they should call wlr_buffer_drop.
*/
void wlr_buffer_init(struct wlr_buffer *buffer,
const struct wlr_buffer_impl *impl, int width, int height);
/**
* Unreference the buffer. This function should be called by producers when
* they are done with the buffer.
@ -93,7 +69,7 @@ void wlr_buffer_drop(struct wlr_buffer *buffer);
/**
* Lock the buffer. This function should be called by consumers to make
* sure the buffer can be safely read from. Once the consumer is done with the
* buffer, they should call wlr_buffer_unlock.
* buffer, they should call wlr_buffer_unlock().
*/
struct wlr_buffer *wlr_buffer_lock(struct wlr_buffer *buffer);
/**
@ -106,7 +82,7 @@ void wlr_buffer_unlock(struct wlr_buffer *buffer);
* returns false.
*
* The returned DMA-BUF attributes are valid for the lifetime of the
* wlr_buffer. The caller isn't responsible for cleaning up the DMA-BUF
* struct wlr_buffer. The caller isn't responsible for cleaning up the DMA-BUF
* attributes.
*/
bool wlr_buffer_get_dmabuf(struct wlr_buffer *buffer,
@ -116,24 +92,16 @@ bool wlr_buffer_get_dmabuf(struct wlr_buffer *buffer,
* memory, returns false.
*
* The returned shared memory attributes are valid for the lifetime of the
* wlr_buffer. The caller isn't responsible for cleaning up the shared memory
* attributes.
* struct wlr_buffer. The caller isn't responsible for cleaning up the shared
* memory attributes.
*/
bool wlr_buffer_get_shm(struct wlr_buffer *buffer,
struct wlr_shm_attributes *attribs);
/**
* Allows the registration of a wl_resource implementation.
* Transforms a struct wl_resource into a struct wlr_buffer and locks it. Once
* the caller is done with the buffer, they must call wlr_buffer_unlock().
*
* The matching function will be called for the wl_resource when creating a
* wlr_buffer from a wl_resource.
*/
void wlr_buffer_register_resource_interface(
const struct wlr_buffer_resource_interface *iface);
/**
* Transforms a wl_resource into a wlr_buffer and locks it. Once the caller is
* done with the buffer, they must call wlr_buffer_unlock.
*
* The provided wl_resource must be a wl_buffer.
* The provided struct wl_resource must be a wl_buffer.
*/
struct wlr_buffer *wlr_buffer_from_resource(struct wl_resource *resource);
@ -158,7 +126,7 @@ enum wlr_buffer_data_ptr_access_flag {
*
* The returned pointer should be pointing to a valid memory region for the
* operations specified in the flags. The returned pointer is only valid up to
* the next buffer_end_data_ptr_access call.
* the next wlr_buffer_end_data_ptr_access() call.
*/
bool wlr_buffer_begin_data_ptr_access(struct wlr_buffer *buffer, uint32_t flags,
void **data, uint32_t *format, size_t *stride);
@ -183,14 +151,11 @@ struct wlr_client_buffer {
// private state
struct wl_listener source_destroy;
// If the client buffer has been created from a wl_shm buffer
uint32_t shm_source_format;
};
/**
* Creates a wlr_client_buffer from a given wlr_buffer by creating a texture
* from it, and copying its wl_resource.
* Creates a struct wlr_client_buffer from a given struct wlr_buffer by creating
* a texture from it, and copying its struct wl_resource.
*/
struct wlr_client_buffer *wlr_client_buffer_create(struct wlr_buffer *buffer,
struct wlr_renderer *renderer);

View file

@ -28,6 +28,7 @@ enum wlr_surface_state_field {
WLR_SURFACE_STATE_SCALE = 1 << 6,
WLR_SURFACE_STATE_FRAME_CALLBACK_LIST = 1 << 7,
WLR_SURFACE_STATE_VIEWPORT = 1 << 8,
WLR_SURFACE_STATE_OFFSET = 1 << 9,
};
struct wlr_surface_state {
@ -147,7 +148,7 @@ struct wlr_surface {
struct wl_signal destroy;
} events;
struct wl_list current_outputs; // wlr_surface_output::link
struct wl_list current_outputs; // wlr_surface_output.link
struct wlr_addon_set addons;
void *data;
@ -162,6 +163,8 @@ struct wlr_surface {
int width, height;
int buffer_width, buffer_height;
} previous;
bool opaque;
};
struct wlr_renderer;
@ -243,9 +246,10 @@ void wlr_surface_send_frame_done(struct wlr_surface *surface,
void wlr_surface_get_extends(struct wlr_surface *surface, struct wlr_box *box);
/**
* Get the wlr_surface corresponding to a wl_surface resource. This asserts
* that the resource is a valid wl_surface resource created by wlroots and
* will never return NULL.
* Get the struct wlr_surface corresponding to a wl_surface resource.
*
* This asserts that the resource is a valid wl_surface resource created by
* wlroots and will never return NULL.
*/
struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource);
@ -281,7 +285,7 @@ void wlr_surface_get_buffer_source_box(struct wlr_surface *surface,
* Acquire a lock for the pending surface state.
*
* The state won't be committed before the caller releases the lock. Instead,
* the state becomes cached. The caller needs to use wlr_surface_unlock_cached
* the state becomes cached. The caller needs to use wlr_surface_unlock_cached()
* to release the lock.
*
* Returns a surface commit sequence number for the cached state.

View file

@ -10,19 +10,20 @@
#define WLR_TYPES_WLR_CURSOR_H
#include <wayland-server-core.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
struct wlr_input_device;
/**
* wlr_cursor implements the behavior of the "cursor", that is, the image on the
* screen typically moved about with a mouse or so. It provides tracking for
* this in global coordinates, and integrates with wlr_output,
* wlr_output_layout, and wlr_input_device. You can use it to abstract multiple
* input devices over a single cursor, constrain cursor movement to the usable
* area of a wlr_output_layout and communicate position updates to the hardware
* cursor, constrain specific input devices to specific outputs or regions of
* the screen, and so on.
* this in global coordinates, and integrates with struct wlr_output,
* struct wlr_output_layout, and struct wlr_input_device. You can use it to
* abstract multiple input devices over a single cursor, constrain cursor
* movement to the usable area of a struct wlr_output_layout and communicate
* position updates to the hardware cursor, constrain specific input devices to
* specific outputs or regions of the screen, and so on.
*/
struct wlr_box;
@ -36,15 +37,15 @@ struct wlr_cursor {
* The interpretation of these signals is the responsibility of the
* compositor, but some helpers are provided for your benefit. If you
* receive a relative motion event, for example, you may want to call
* wlr_cursor_move. If you receive an absolute event, call
* wlr_cursor_warp_absolute. If you pass an input device into these
* wlr_cursor_move(). If you receive an absolute event, call
* wlr_cursor_warp_absolute(). If you pass an input device into these
* functions, it will apply the region/output constraints associated with
* that device to the resulting cursor motion. If an output layout is
* attached, these functions will constrain the resulting cursor motion to
* within the usable space of the output layout.
*
* Re-broadcasting these signals to, for example, a wlr_seat, is also your
* responsibility.
* Re-broadcasting these signals to, for example, a struct wlr_seat, is also
* your responsibility.
*/
struct {
struct wl_signal motion;
@ -190,13 +191,14 @@ void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
struct wlr_input_device *dev, struct wlr_output *output);
/**
* Maps this cursor to an arbitrary region on the associated wlr_output_layout.
* Maps this cursor to an arbitrary region on the associated
* struct wlr_output_layout.
*/
void wlr_cursor_map_to_region(struct wlr_cursor *cur, const struct wlr_box *box);
/**
* Maps inputs from this input device to an arbitrary region on the associated
* wlr_output_layout.
* struct wlr_output_layout.
*/
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
struct wlr_input_device *dev, const struct wlr_box *box);

View file

@ -0,0 +1,81 @@
/*
* 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_DAMAGE_RING_H
#define WLR_TYPES_WLR_DAMAGE_RING_H
#include <stdbool.h>
/* For triple buffering, a history of two frames is required. */
#define WLR_DAMAGE_RING_PREVIOUS_LEN 2
struct wlr_box;
struct wlr_damage_ring {
int32_t width, height;
// Difference between the current buffer and the previous one
pixman_region32_t current;
// private state
pixman_region32_t previous[WLR_DAMAGE_RING_PREVIOUS_LEN];
size_t previous_idx;
};
void wlr_damage_ring_init(struct wlr_damage_ring *ring);
void wlr_damage_ring_finish(struct wlr_damage_ring *ring);
/**
* Set ring bounds and damage the ring fully.
*
* Next time damage will be added, it will be cropped to the ring bounds.
* If at least one of the dimensions is 0, bounds are removed.
*
* By default, a damage ring doesn't have bounds.
*/
void wlr_damage_ring_set_bounds(struct wlr_damage_ring *ring,
int32_t width, int32_t height);
/**
* Add a region to the current damage.
*
* Returns true if the region intersects the ring bounds, false otherwise.
*/
bool wlr_damage_ring_add(struct wlr_damage_ring *ring,
pixman_region32_t *damage);
/**
* Add a box to the current damage.
*
* Returns true if the box intersects the ring bounds, false otherwise.
*/
bool wlr_damage_ring_add_box(struct wlr_damage_ring *ring,
const struct wlr_box *box);
/**
* Damage the ring fully.
*/
void wlr_damage_ring_add_whole(struct wlr_damage_ring *ring);
/**
* Rotate the damage ring. This needs to be called after using the accumulated
* damage, e.g. after rendering to an output's back buffer.
*/
void wlr_damage_ring_rotate(struct wlr_damage_ring *ring);
/**
* Get accumulated damage, which is the difference between the current buffer
* and the buffer with age of buffer_age; in context of rendering, this is
* the region that needs to be redrawn.
*/
void wlr_damage_ring_get_buffer_damage(struct wlr_damage_ring *ring,
int buffer_age, pixman_region32_t *damage);
#endif

View file

@ -14,7 +14,7 @@
struct wlr_data_control_manager_v1 {
struct wl_global *global;
struct wl_list devices; // wlr_data_control_device_v1::link
struct wl_list devices; // wlr_data_control_device_v1.link
struct {
struct wl_signal destroy;
@ -27,7 +27,7 @@ struct wlr_data_control_manager_v1 {
struct wlr_data_control_device_v1 {
struct wl_resource *resource;
struct wlr_data_control_manager_v1 *manager;
struct wl_list link; // wlr_data_control_manager_v1::devices
struct wl_list link; // wlr_data_control_manager_v1.devices
struct wlr_seat *seat;
struct wl_resource *selection_offer_resource; // current selection offer

View file

@ -43,7 +43,7 @@ struct wlr_data_offer {
struct wl_resource *resource;
struct wlr_data_source *source;
enum wlr_data_offer_type type;
struct wl_list link; // wlr_seat::{selection_offers,drag_offers}
struct wl_list link; // wlr_seat.{selection_offers,drag_offers}
uint32_t actions;
enum wl_data_device_manager_dnd_action preferred_action;
@ -54,7 +54,7 @@ struct wlr_data_offer {
/**
* A data source implementation. Only the `send` function is mandatory. Refer to
* the matching wl_data_source_* functions documentation to know what they do.
* the matching `wlr_data_source_*` functions documentation to know what they do.
*/
struct wlr_data_source_impl {
void (*send)(struct wlr_data_source *source, const char *mime_type,
@ -131,8 +131,8 @@ struct wlr_drag {
struct {
struct wl_signal focus;
struct wl_signal motion; // wlr_drag_motion_event
struct wl_signal drop; // wlr_drag_drop_event
struct wl_signal motion; // struct wlr_drag_motion_event
struct wl_signal drop; // struct wlr_drag_drop_event
struct wl_signal destroy;
} events;
@ -155,7 +155,7 @@ struct wlr_drag_drop_event {
};
/**
* Create a wl data device manager global for this display.
* Create a wl_data_device_manager global for this display.
*/
struct wlr_data_device_manager *wlr_data_device_manager_create(
struct wl_display *display);
@ -181,7 +181,7 @@ void wlr_seat_set_selection(struct wlr_seat *seat,
/**
* Creates a new drag. To request to start the drag, call
* `wlr_seat_request_start_drag`.
* wlr_seat_request_start_drag().
*/
struct wlr_drag *wlr_drag_create(struct wlr_seat_client *seat_client,
struct wlr_data_source *source, struct wlr_surface *icon_surface);
@ -258,7 +258,7 @@ void wlr_data_source_dnd_finish(struct wlr_data_source *source);
* Notifies the data source that a target accepts the drag with the specified
* action.
*
* This shouldn't be called after `wlr_data_source_dnd_drop` unless the
* This shouldn't be called after wlr_data_source_dnd_drop() unless the
* drag-and-drop operation ended in an "ask" action.
*/
void wlr_data_source_dnd_action(struct wlr_data_source *source,

View file

@ -15,7 +15,7 @@ struct wlr_backend;
struct wlr_output;
struct wlr_drm_lease_v1_manager {
struct wl_list devices; // wlr_drm_lease_device_v1::link;
struct wl_list devices; // wlr_drm_lease_device_v1.link
struct wl_display *display;
struct wl_listener display_destroy;
@ -23,9 +23,9 @@ struct wlr_drm_lease_v1_manager {
struct {
/**
* Upon receiving this signal, call
* wlr_drm_lease_device_v1_grant_lease_request to grant a lease of the
* wlr_drm_lease_device_v1_grant_lease_request() to grant a lease of the
* requested DRM resources, or
* wlr_drm_lease_device_v1_reject_lease_request to reject the request.
* wlr_drm_lease_device_v1_reject_lease_request() to reject the request.
*/
struct wl_signal request;
} events;
@ -38,10 +38,10 @@ struct wlr_drm_lease_device_v1 {
struct wlr_drm_lease_v1_manager *manager;
struct wlr_backend *backend;
struct wl_list connectors; // wlr_drm_lease_connector_v1::link
struct wl_list leases; // wlr_drm_lease_v1::link
struct wl_list requests; // wlr_drm_lease_request_v1::link
struct wl_list link; // wlr_drm_lease_v1_manager::devices
struct wl_list connectors; // wlr_drm_lease_connector_v1.link
struct wl_list leases; // wlr_drm_lease_v1.link
struct wl_list requests; // wlr_drm_lease_request_v1.link
struct wl_list link; // wlr_drm_lease_v1_manager.devices
struct wl_listener backend_destroy;
@ -51,7 +51,7 @@ struct wlr_drm_lease_device_v1 {
struct wlr_drm_lease_v1;
struct wlr_drm_lease_connector_v1 {
struct wl_list resources; // wl_resource_get_link
struct wl_list resources; // wl_resource_get_link()
struct wlr_output *output;
struct wlr_drm_lease_device_v1 *device;
@ -60,7 +60,7 @@ struct wlr_drm_lease_connector_v1 {
struct wl_listener destroy;
struct wl_list link; // wlr_drm_lease_device_v1::connectors
struct wl_list link; // wlr_drm_lease_device_v1.connectors
};
struct wlr_drm_lease_request_v1 {
@ -76,7 +76,7 @@ struct wlr_drm_lease_request_v1 {
bool invalid;
struct wl_list link; // wlr_drm_lease_device_v1::requests
struct wl_list link; // wlr_drm_lease_device_v1.requests
};
struct wlr_drm_lease_v1 {
@ -97,7 +97,8 @@ struct wlr_drm_lease_v1 {
/**
* Creates a DRM lease manager. A DRM lease device will be created for each
* DRM backend supplied in case of a wlr_multi_backend.
* DRM backend supplied in case of a struct wlr_multi_backend.
*
* Returns NULL if no DRM backend is supplied.
*/
struct wlr_drm_lease_v1_manager *wlr_drm_lease_v1_manager_create(
@ -105,6 +106,7 @@ struct wlr_drm_lease_v1_manager *wlr_drm_lease_v1_manager_create(
/**
* Offers a wlr_output for lease.
*
* Returns false if the output can't be offered to lease.
*/
bool wlr_drm_lease_v1_manager_offer_output(
@ -120,7 +122,7 @@ void wlr_drm_lease_v1_manager_withdraw_output(
/**
* Grants a client's lease request. The lease device will then provision the
* DRM lease and transfer the file descriptor to the client. After calling this,
* each wlr_output leased is destroyed, and will be re-issued through
* each struct wlr_output leased is destroyed, and will be re-issued through
* wlr_backend.events.new_outputs when the lease is revoked.
*
* This will return NULL without leasing any resources if the lease is invalid;

View file

@ -15,7 +15,7 @@
struct wlr_export_dmabuf_manager_v1 {
struct wl_global *global;
struct wl_list frames; // wlr_export_dmabuf_frame_v1::link
struct wl_list frames; // wlr_export_dmabuf_frame_v1.link
struct wl_listener display_destroy;
@ -27,7 +27,7 @@ struct wlr_export_dmabuf_manager_v1 {
struct wlr_export_dmabuf_frame_v1 {
struct wl_resource *resource;
struct wlr_export_dmabuf_manager_v1 *manager;
struct wl_list link; // wlr_export_dmabuf_manager_v1::frames
struct wl_list link; // wlr_export_dmabuf_manager_v1.frames
struct wlr_output *output;

View file

@ -15,8 +15,8 @@
struct wlr_foreign_toplevel_manager_v1 {
struct wl_event_loop *event_loop;
struct wl_global *global;
struct wl_list resources; // wl_resource_get_link
struct wl_list toplevels; // wlr_foreign_toplevel_handle_v1::link
struct wl_list resources; // wl_resource_get_link()
struct wl_list toplevels; // wlr_foreign_toplevel_handle_v1.link
struct wl_listener display_destroy;
@ -35,7 +35,7 @@ enum wlr_foreign_toplevel_handle_v1_state {
};
struct wlr_foreign_toplevel_handle_v1_output {
struct wl_list link; // wlr_foreign_toplevel_handle_v1::outputs
struct wl_list link; // wlr_foreign_toplevel_handle_v1.outputs
struct wlr_output *output;
struct wlr_foreign_toplevel_handle_v1 *toplevel;
@ -54,21 +54,21 @@ struct wlr_foreign_toplevel_handle_v1 {
char *title;
char *app_id;
struct wlr_foreign_toplevel_handle_v1 *parent;
struct wl_list outputs; // wlr_foreign_toplevel_v1_output
uint32_t state; // wlr_foreign_toplevel_v1_state
struct wl_list outputs; // wlr_foreign_toplevel_v1_output.link
uint32_t state; // enum wlr_foreign_toplevel_v1_state
struct {
// wlr_foreign_toplevel_handle_v1_maximized_event
// struct wlr_foreign_toplevel_handle_v1_maximized_event
struct wl_signal request_maximize;
//wlr_foreign_toplevel_handle_v1_minimized_event
// struct wlr_foreign_toplevel_handle_v1_minimized_event
struct wl_signal request_minimize;
//wlr_foreign_toplevel_handle_v1_activated_event
// struct wlr_foreign_toplevel_handle_v1_activated_event
struct wl_signal request_activate;
//wlr_foreign_toplevel_handle_v1_fullscreen_event
// struct wlr_foreign_toplevel_handle_v1_fullscreen_event
struct wl_signal request_fullscreen;
struct wl_signal request_close;
//wlr_foreign_toplevel_handle_v1_set_rectangle_event
// struct wlr_foreign_toplevel_handle_v1_set_rectangle_event
struct wl_signal set_rectangle;
struct wl_signal destroy;
} events;
@ -108,12 +108,14 @@ struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create(
struct wlr_foreign_toplevel_handle_v1 *wlr_foreign_toplevel_handle_v1_create(
struct wlr_foreign_toplevel_manager_v1 *manager);
/* Destroy the given toplevel handle, sending the closed event to any
/**
* Destroy the given toplevel handle, sending the closed event to any
* client. Also, if the destroyed toplevel is set as a parent of any
* other valid toplevel, clients still holding a handle to both are
* sent a parent signal with NULL parent. If this is not desired, the
* caller should ensure that any child toplevels are destroyed before
* the parent. */
* the parent.
*/
void wlr_foreign_toplevel_handle_v1_destroy(
struct wlr_foreign_toplevel_handle_v1 *toplevel);
@ -136,11 +138,13 @@ void wlr_foreign_toplevel_handle_v1_set_activated(
void wlr_foreign_toplevel_handle_v1_set_fullscreen(
struct wlr_foreign_toplevel_handle_v1* toplevel, bool fullscreen);
/* Set the parent of a toplevel. If the parent changed from its previous
/**
* Set the parent of a toplevel. If the parent changed from its previous
* value, also sends a parent event to all clients that hold handles to
* both toplevel and parent (no message is sent to clients that have
* previously destroyed their parent handle). NULL is allowed as the
* parent, meaning no parent exists. */
* parent, meaning no parent exists.
*/
void wlr_foreign_toplevel_handle_v1_set_parent(
struct wlr_foreign_toplevel_handle_v1 *toplevel,
struct wlr_foreign_toplevel_handle_v1 *parent);

View file

@ -17,7 +17,7 @@ struct wlr_fullscreen_shell_v1 {
struct {
struct wl_signal destroy;
// wlr_fullscreen_shell_v1_present_surface_event
// struct wlr_fullscreen_shell_v1_present_surface_event
struct wl_signal present_surface;
} events;

View file

@ -5,7 +5,7 @@
struct wlr_gamma_control_manager_v1 {
struct wl_global *global;
struct wl_list controls; // wlr_gamma_control_v1::link
struct wl_list controls; // wlr_gamma_control_v1.link
struct wl_listener display_destroy;

View file

@ -23,7 +23,7 @@
struct wlr_idle {
struct wl_global *global;
struct wl_list idle_timers; // wlr_idle_timeout::link
struct wl_list idle_timers; // wlr_idle_timeout.link
struct wl_event_loop *event_loop;
bool enabled;

View file

@ -24,7 +24,7 @@
*/
struct wlr_idle_inhibit_manager_v1 {
struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1::link
struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1.link
struct wl_global *global;
struct wl_listener display_destroy;
@ -42,7 +42,7 @@ struct wlr_idle_inhibitor_v1 {
struct wl_resource *resource;
struct wl_listener surface_destroy;
struct wl_list link; // wlr_idle_inhibit_manager_v1::inhibitors;
struct wl_list link; // wlr_idle_inhibit_manager_v1.inhibitors
struct {
struct wl_signal destroy;

View file

@ -25,26 +25,10 @@ enum wlr_input_device_type {
WLR_INPUT_DEVICE_SWITCH,
};
struct wlr_input_device_impl;
struct wlr_input_device {
enum wlr_input_device_type type;
unsigned int vendor, product;
char *name;
// Or 0 if not applicable to this device
double width_mm, height_mm;
char *output_name;
/* wlr_input_device.type determines which of these is valid */
union {
void *_device;
struct wlr_keyboard *keyboard;
struct wlr_pointer *pointer;
struct wlr_switch *switch_device;
struct wlr_touch *touch;
struct wlr_tablet *tablet;
struct wlr_tablet_pad *tablet_pad;
};
struct {
struct wl_signal destroy;
@ -53,19 +37,4 @@ struct wlr_input_device {
void *data;
};
void wlr_input_device_init(struct wlr_input_device *wlr_device,
enum wlr_input_device_type type, const char *name);
/**
* Clean up all of the provided wlr_input_device resources
*/
void wlr_input_device_finish(struct wlr_input_device *wlr_device);
/**
* Calls the specialized input device destroy function.
* If the wlr_input_device is not owned by a specialized input device, the
* function will finish the wlr_input_device and free it.
*/
void wlr_input_device_destroy(struct wlr_input_device *dev);
#endif

View file

@ -51,10 +51,10 @@ struct wlr_input_method_v2 {
struct wl_listener seat_client_destroy;
struct {
struct wl_signal commit; // (struct wlr_input_method_v2*)
struct wl_signal new_popup_surface; // (struct wlr_input_popup_surface_v2*)
struct wl_signal grab_keyboard; // (struct wlr_input_method_keyboard_grab_v2*)
struct wl_signal destroy; // (struct wlr_input_method_v2*)
struct wl_signal commit; // struct wlr_input_method_v2 *
struct wl_signal new_popup_surface; // struct wlr_input_popup_surface_v2 *
struct wl_signal grab_keyboard; // struct wlr_input_method_keyboard_grab_v2 *
struct wl_signal destroy; // struct wlr_input_method_v2 *
} events;
};
@ -87,19 +87,19 @@ struct wlr_input_method_keyboard_grab_v2 {
struct wl_listener keyboard_destroy;
struct {
struct wl_signal destroy; // (struct wlr_input_method_keyboard_grab_v2*)
struct wl_signal destroy; // struct wlr_input_method_keyboard_grab_v2 *
} events;
};
struct wlr_input_method_manager_v2 {
struct wl_global *global;
struct wl_list input_methods; // struct wlr_input_method_v2*::link
struct wl_list input_methods; // struct wlr_input_method_v2.link
struct wl_listener display_destroy;
struct {
struct wl_signal input_method; // (struct wlr_input_method_v2*)
struct wl_signal destroy; // (struct wlr_input_method_manager_v2*)
struct wl_signal input_method; // struct wlr_input_method_v2 *
struct wl_signal destroy; // struct wlr_input_method_manager_v2 *
} events;
};
@ -122,9 +122,20 @@ void wlr_input_method_v2_send_done(struct wlr_input_method_v2 *input_method);
void wlr_input_method_v2_send_unavailable(
struct wlr_input_method_v2 *input_method);
/**
* Returns true if the surface has the input popup surface role.
*/
bool wlr_surface_is_input_popup_surface_v2(struct wlr_surface *surface);
/**
* Get a struct wlr_input_popup_surface_v2 from a struct wlr_surface.
* Asserts that the surface has the input popup surface role.
* May return NULL even if the surface has the input popup surface role if the
* corresponding input popup surface has been destroyed.
*/
struct wlr_input_popup_surface_v2 *wlr_input_popup_surface_v2_from_wlr_surface(
struct wlr_surface *surface);
void wlr_input_popup_surface_v2_send_text_input_rectangle(
struct wlr_input_popup_surface_v2 *popup_surface, struct wlr_box *sbox);

View file

@ -73,7 +73,7 @@ struct wlr_keyboard {
struct {
/**
* The `key` event signals with a `wlr_event_keyboard_key` event that a
* The `key` event signals with a struct wlr_keyboard_key_event that a
* key has been pressed or released on the keyboard. This event is
* emitted before the xkb state of the keyboard has been updated
* (including modifiers).
@ -82,26 +82,33 @@ struct wlr_keyboard {
/**
* The `modifiers` event signals that the modifier state of the
* `wlr_keyboard` has been updated. At this time, you can read the
* modifier state of the `wlr_keyboard` and handle the updated state by
* sending it to clients.
* struct wlr_keyboard has been updated. At this time, you can read the
* modifier state of the struct wlr_keyboard and handle the updated
* state by sending it to clients.
*/
struct wl_signal modifiers;
struct wl_signal keymap;
struct wl_signal repeat_info;
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_event_keyboard_key {
struct wlr_keyboard_key_event {
uint32_t time_msec;
uint32_t keycode;
bool update_state; // if backend doesn't update modifiers on its own
enum wl_keyboard_key_state state;
};
/**
* Get a struct wlr_keyboard from a struct wlr_input_device.
*
* Asserts that the input device is a keyboard.
*/
struct wlr_keyboard *wlr_keyboard_from_input_device(
struct wlr_input_device *input_device);
bool wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
struct xkb_keymap *keymap);

View file

@ -14,28 +14,28 @@
struct wlr_keyboard_group {
struct wlr_keyboard keyboard;
struct wl_list devices; // keyboard_group_device::link
struct wl_list keys; // keyboard_group_key::link
struct wl_list devices; // keyboard_group_device.link
struct wl_list keys; // keyboard_group_key.link
struct {
/*
/**
* Sent when a keyboard has entered the group with keys currently
* pressed that are not pressed by any other keyboard in the group. The
* data for this signal will be a wl_array containing the key codes.
* This should be used to update the compositor's internal state.
* data for this signal will be a struct wl_array containing the key
* codes. This should be used to update the compositor's internal state.
* Bindings should not be triggered based off of these key codes and
* they should also not notify any surfaces of the key press.
*/
struct wl_signal enter;
/*
/**
* Sent when a keyboard has left the group with keys currently pressed
* that are not pressed by any other keyboard in the group. The data for
* this signal will be a wl_array containing the key codes. This should
* be used to update the compositor's internal state. Bindings should
* not be triggered based off of these key codes. Additionally, surfaces
* should only be notified if they received a corresponding key press
* for the key code.
* this signal will be a struct wl_array containing the key codes. This
* should be used to update the compositor's internal state. Bindings
* should not be triggered based off of these key codes. Additionally,
* surfaces should only be notified if they received a corresponding key
* press for the key code.
*/
struct wl_signal leave;
} events;

View file

@ -23,14 +23,14 @@
*/
struct wlr_keyboard_shortcuts_inhibit_manager_v1 {
// wlr_keyboard_shortcuts_inhibitor_v1::link
// wlr_keyboard_shortcuts_inhibitor_v1.link
struct wl_list inhibitors;
struct wl_global *global;
struct wl_listener display_destroy;
struct {
struct wl_signal new_inhibitor; // wlr_keyboard_shortcuts_inhibitor_v1
struct wl_signal new_inhibitor; // struct wlr_keyboard_shortcuts_inhibitor_v1
struct wl_signal destroy;
} events;
@ -46,7 +46,7 @@ struct wlr_keyboard_shortcuts_inhibitor_v1 {
struct wl_listener surface_destroy;
struct wl_listener seat_destroy;
// wlr_keyboard_shortcuts_inhibit_manager_v1::inhibitors
// wlr_keyboard_shortcuts_inhibit_manager_v1.inhibitors
struct wl_list link;
struct {

View file

@ -19,11 +19,11 @@
* wlr_layer_shell_v1 allows clients to arrange themselves in "layers" on the
* desktop in accordance with the wlr-layer-shell protocol. When a client is
* added, the new_surface signal will be raised and passed a reference to our
* wlr_layer_surface_v1. At this time, the client will have configured the
* struct wlr_layer_surface_v1. At this time, the client will have configured the
* surface as it desires, including information like desired anchors and
* margins. The compositor should use this information to decide how to arrange
* the layer on-screen, then determine the dimensions of the layer and call
* wlr_layer_surface_v1_configure. The client will then attach a buffer and
* wlr_layer_surface_v1_configure(). The client will then attach a buffer and
* commit the surface, at which point the wlr_layer_surface_v1 map signal is
* raised and the compositor should begin rendering the surface.
*/
@ -69,7 +69,7 @@ struct wlr_layer_surface_v1_state {
};
struct wlr_layer_surface_v1_configure {
struct wl_list link; // wlr_layer_surface_v1::configure_list
struct wl_list link; // wlr_layer_surface_v1.configure_list
uint32_t serial;
uint32_t width, height;
@ -80,7 +80,7 @@ struct wlr_layer_surface_v1 {
struct wlr_output *output;
struct wl_resource *resource;
struct wlr_layer_shell_v1 *shell;
struct wl_list popups; // wlr_xdg_popup::link
struct wl_list popups; // wlr_xdg_popup.link
char *namespace;
@ -93,9 +93,10 @@ struct wlr_layer_surface_v1 {
struct {
/**
* The destroy signal indicates that the wlr_layer_surface is about to be
* freed. It is guaranteed that the unmap signal is raised before the destroy
* signal if the layer surface is destroyed while mapped.
* The destroy signal indicates that the struct wlr_layer_surface is
* about to be freed. It is guaranteed that the unmap signal is raised
* before the destroy signal if the layer surface is destroyed while
* mapped.
*/
struct wl_signal destroy;
/**
@ -114,7 +115,8 @@ struct wlr_layer_surface_v1 {
struct wl_signal unmap;
/**
* The new_popup signal is raised when a new popup is created. The data
* parameter passed to the listener is a pointer to the new wlr_xdg_popup.
* parameter passed to the listener is a pointer to the new
* struct wlr_xdg_popup.
*/
struct wl_signal new_popup;
} events;
@ -134,12 +136,21 @@ uint32_t wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface,
/**
* Notify the client that the surface has been closed and destroy the
* wlr_layer_surface_v1, rendering the resource inert.
* struct wlr_layer_surface_v1, rendering the resource inert.
*/
void wlr_layer_surface_v1_destroy(struct wlr_layer_surface_v1 *surface);
/**
* Returns true if the surface has the layer surface role.
*/
bool wlr_surface_is_layer_surface(struct wlr_surface *surface);
/**
* Get a struct wlr_layer_surface from a struct wlr_surface.
* Asserts that the surface has the layer surface role.
* May return NULL even if the surface has the layer surface role if the
* corresponding layer surface has been destroyed.
*/
struct wlr_layer_surface_v1 *wlr_layer_surface_v1_from_wlr_surface(
struct wlr_surface *surface);
@ -178,4 +189,12 @@ struct wlr_surface *wlr_layer_surface_v1_popup_surface_at(
struct wlr_layer_surface_v1 *surface, double sx, double sy,
double *sub_x, double *sub_y);
/**
* Get the corresponding struct wlr_layer_surface_v1 from a resource.
*
* Aborts if the resource doesn't have the correct type.
*/
struct wlr_layer_surface_v1 *wlr_layer_surface_v1_from_resource(
struct wl_resource *resource);
#endif

View file

@ -35,8 +35,8 @@ struct wlr_dmabuf_v1_buffer {
bool wlr_dmabuf_v1_resource_is_buffer(struct wl_resource *buffer_resource);
/**
* Returns the wlr_dmabuf_buffer if the given resource was created
* via the linux-dmabuf buffer protocol
* Returns the struct wlr_dmabuf_buffer if the given resource was created
* via the linux-dmabuf buffer protocol.
*/
struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_buffer_resource(
struct wl_resource *buffer_resource);
@ -72,7 +72,7 @@ struct wlr_linux_dmabuf_v1 {
};
/**
* Create linux-dmabuf interface
* Create linux-dmabuf interface.
*/
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
struct wlr_renderer *renderer);

View file

@ -43,14 +43,6 @@ void wlr_matrix_rotate(float mat[static 9], float rad);
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.
*
* Deprecated: this function is deprecated and will be removed in a future
* version of wlroots. */
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

View file

@ -41,10 +41,6 @@ struct wlr_output_cursor {
struct wlr_surface *surface;
struct wl_listener surface_commit;
struct wl_listener surface_destroy;
struct {
struct wl_signal destroy;
} events;
};
struct wlr_output_tile_info {
@ -61,7 +57,6 @@ struct wlr_output_tile_info {
enum wlr_output_adaptive_sync_status {
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED,
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED,
WLR_OUTPUT_ADAPTIVE_SYNC_UNKNOWN, // requested, but maybe disabled
};
enum wlr_output_state_field {
@ -75,6 +70,7 @@ enum wlr_output_state_field {
WLR_OUTPUT_STATE_GAMMA_LUT = 1 << 7,
WLR_OUTPUT_STATE_RENDER_FORMAT = 1 << 8,
WLR_OUTPUT_STATE_SOURCE_BOX = 1 << 9,
WLR_OUTPUT_STATE_SUBPIXEL = 1 << 9,
};
enum wlr_output_state_mode_type {
@ -96,6 +92,7 @@ struct wlr_output_state {
* only valid if WLR_OUTPUT_STATE_SOURCE_BOX */
struct wlr_box source_box; // source box for respective output
uint32_t render_format;
enum wl_output_subpixel subpixel;
// only valid if WLR_OUTPUT_STATE_BUFFER
struct wlr_buffer *buffer;
@ -122,9 +119,9 @@ struct wlr_output_impl;
* The `frame` event will be emitted when it is a good time for the compositor
* to submit a new frame.
*
* To render a new frame, compositors should call `wlr_output_attach_render`,
* render and call `wlr_output_commit`. No rendering should happen outside a
* `frame` event handler or before `wlr_output_attach_render`.
* To render a new frame, compositors should call wlr_output_attach_render(),
* render and call wlr_output_commit(). No rendering should happen outside a
* `frame` event handler or before wlr_output_attach_render().
*/
struct wlr_output {
const struct wlr_output_impl *impl;
@ -136,9 +133,7 @@ struct wlr_output {
char *name;
char *description; // may be NULL
char make[56];
char model[16];
char serial[16];
char *make, *model, *serial; // may be NULL
int32_t phys_width, phys_height; // mm
struct wlr_output_tile_info tile_info;
@ -222,6 +217,7 @@ struct wlr_output_event_damage {
struct wlr_output_event_precommit {
struct wlr_output *output;
struct timespec *when;
const struct wlr_output_state *state;
};
struct wlr_output_event_commit {
@ -274,7 +270,7 @@ struct wlr_surface;
* emit `frame` events.
*
* Whether an output is enabled is double-buffered state, see
* `wlr_output_commit`.
* wlr_output_commit().
*/
void wlr_output_enable(struct wlr_output *output, bool enable);
void wlr_output_create_global(struct wlr_output *output);
@ -283,8 +279,8 @@ void wlr_output_destroy_global(struct wlr_output *output);
* Initialize the output's rendering subsystem with the provided allocator and
* renderer. Can only be called once.
*
* Call this function prior to any call to wlr_output_attach_render,
* wlr_output_commit or wlr_output_cursor_create.
* Call this function prior to any call to wlr_output_attach_render(),
* wlr_output_commit() or wlr_output_cursor_create().
*
* The buffer capabilities of the provided must match the capabilities of the
* output's backend. Returns false otherwise.
@ -299,7 +295,7 @@ struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output);
/**
* Sets the output mode. The output needs to be enabled.
*
* Mode is double-buffered state, see `wlr_output_commit`.
* Mode is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode);
@ -308,25 +304,28 @@ void wlr_output_set_mode(struct wlr_output *output,
* Setting `refresh` to zero lets the backend pick a preferred value. The
* output needs to be enabled.
*
* Custom mode is double-buffered state, see `wlr_output_commit`.
* Custom mode is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh);
/**
* Sets a transform for the output.
*
* Transform is double-buffered state, see `wlr_output_commit`.
* Transform is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_transform(struct wlr_output *output,
enum wl_output_transform transform);
/**
* Enables or disables adaptive sync (ie. variable refresh rate) on this
* output. This is just a hint, the backend is free to ignore this setting.
* output. On some backends, this is just a hint and may be ignored.
* Compositors can inspect `wlr_output.adaptive_sync_status` to query the
* effective status. Backends that don't support adaptive sync will reject
* the output commit.
*
* When enabled, compositors can submit frames a little bit later than the
* deadline without dropping a frame.
*
* Adaptive sync is double-buffered state, see `wlr_output_commit`.
* Adaptive sync is double-buffered state, see wlr_output_commit().
*/
void wlr_output_enable_adaptive_sync(struct wlr_output *output, bool enabled);
/**
@ -338,17 +337,17 @@ void wlr_output_enable_adaptive_sync(struct wlr_output *output, bool enabled);
* hardware and software permit this.
*
* This only affects the format of the output buffer used when rendering,
* as with `wlr_output_attach_render`. It has no impact on the cursor buffer
* as with wlr_output_attach_render(). It has no impact on the cursor buffer
* format, or on the formats supported for direct scan-out (see also
* `wlr_output_attach_buffer`).
* wlr_output_attach_buffer()).
*
* This format is double-buffered state, see `wlr_output_commit`.
* This format is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_render_format(struct wlr_output *output, uint32_t format);
/**
* Sets a scale for the output.
*
* Scale is double-buffered state, see `wlr_output_commit`.
* Scale is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_scale(struct wlr_output *output, float scale);
void wlr_output_set_subpixel(struct wlr_output *output,
@ -385,22 +384,22 @@ void wlr_output_effective_resolution(struct wlr_output *output,
/**
* Attach the renderer's buffer to the output. Compositors must call this
* function before rendering. After they are done rendering, they should call
* `wlr_output_commit` to submit the new frame. The output needs to be
* wlr_output_commit() to submit the new frame. The output needs to be
* enabled.
*
* If non-NULL, `buffer_age` is set to the drawing buffer age in number of
* frames or -1 if unknown. This is useful for damage tracking.
*
* If the compositor decides not to render after calling this function, it
* must call wlr_output_rollback.
* must call wlr_output_rollback().
*/
bool wlr_output_attach_render(struct wlr_output *output, int *buffer_age);
/**
* Attach a buffer to the output. Compositors should call `wlr_output_commit`
* Attach a buffer to the output. Compositors should call wlr_output_commit()
* to submit the new frame. The output needs to be enabled.
*
* Not all backends support direct scan-out on all buffers. Compositors can
* check whether a buffer is supported by calling `wlr_output_test`.
* check whether a buffer is supported by calling wlr_output_test().
*/
void wlr_output_attach_buffer(struct wlr_output *output,
struct wlr_buffer *buffer);
@ -432,14 +431,14 @@ void wlr_output_set_source_box(struct wlr_output *output,
struct wlr_box source_box);
/**
* Test whether the pending output state would be accepted by the backend. If
* this function returns true, `wlr_output_commit` can only fail due to a
* this function returns true, wlr_output_commit() can only fail due to a
* runtime error.
*
* This function doesn't mutate the pending state.
*/
bool wlr_output_test(struct wlr_output *output);
/**
* Commit the pending output state. If `wlr_output_attach_render` has been
* Commit the pending output state. If wlr_output_attach_render() has been
* called, the pending frame will be submitted for display and a `frame` event
* will be scheduled.
*
@ -450,6 +449,10 @@ bool wlr_output_commit(struct wlr_output *output);
* Discard the pending output state.
*/
void wlr_output_rollback(struct wlr_output *output);
bool wlr_output_test_state(struct wlr_output *output,
const struct wlr_output_state *state);
bool wlr_output_commit_state(struct wlr_output *output,
const struct wlr_output_state *state);
/**
* Manually schedules a `frame` event. If a `frame` event is already pending,
* it is a no-op.
@ -462,11 +465,11 @@ size_t wlr_output_get_gamma_size(struct wlr_output *output);
/**
* Sets the gamma table for this output. `r`, `g` and `b` are gamma ramps for
* red, green and blue. `size` is the length of the ramps and must not exceed
* the value returned by `wlr_output_get_gamma_size`.
* the value returned by wlr_output_get_gamma_size().
*
* Providing zero-sized ramps resets the gamma table.
*
* The gamma table is double-buffered state, see `wlr_output_commit`.
* The gamma table is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_gamma(struct wlr_output *output, size_t size,
const uint16_t *r, const uint16_t *g, const uint16_t *b);
@ -518,11 +521,30 @@ bool wlr_output_cursor_set_image(struct wlr_output_cursor *cursor,
int32_t hotspot_x, int32_t hotspot_y);
void wlr_output_cursor_set_surface(struct wlr_output_cursor *cursor,
struct wlr_surface *surface, int32_t hotspot_x, int32_t hotspot_y);
bool wlr_output_cursor_set_buffer(struct wlr_output_cursor *cursor,
struct wlr_buffer *buffer, int32_t hotspot_x, int32_t hotspot_y);
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
double x, double y);
void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor);
void wlr_output_state_set_enabled(struct wlr_output_state *state,
bool enabled);
void wlr_output_state_set_mode(struct wlr_output_state *state,
struct wlr_output_mode *mode);
void wlr_output_state_set_custom_mode(struct wlr_output_state *state,
int32_t width, int32_t height, int32_t refresh);
void wlr_output_state_set_scale(struct wlr_output_state *state, float scale);
void wlr_output_state_set_transform(struct wlr_output_state *state,
enum wl_output_transform transform);
void wlr_output_state_set_adaptive_sync_enabled(struct wlr_output_state *state,
bool enabled);
void wlr_output_state_set_render_format(struct wlr_output_state *state,
uint32_t format);
void wlr_output_state_set_subpixel(struct wlr_output_state *state,
enum wl_output_subpixel subpixel);
/**
* Returns the transform that, when composed with `tr`, gives
* `WL_OUTPUT_TRANSFORM_NORMAL`.

View file

@ -29,9 +29,9 @@ struct wlr_box;
* to submit a new frame.
*
* To render a new frame, compositors should call
* `wlr_output_damage_attach_render`, render and call `wlr_output_commit`. No
* wlr_output_damage_attach_render(), render and call wlr_output_commit(). No
* rendering should happen outside a `frame` event handler or before
* `wlr_output_damage_attach_render`.
* wlr_output_damage_attach_render().
*/
struct wlr_output_damage {
struct wlr_output *output;
@ -64,7 +64,7 @@ void wlr_output_damage_destroy(struct wlr_output_damage *output_damage);
/**
* Attach the renderer's buffer to the output. Compositors must call this
* function before rendering. After they are done rendering, they should call
* `wlr_output_set_damage` and `wlr_output_commit` to submit the new frame.
* wlr_output_set_damage() and wlr_output_commit() to submit the new frame.
*
* `needs_frame` will be set to true if a frame should be submitted. `damage`
* will be set to the region of the output that needs to be repainted, in

View file

@ -18,10 +18,10 @@ struct wlr_box;
/**
* Helper to arrange outputs in a 2D coordinate space. The output effective
* resolution is used, see wlr_output_effective_resolution.
* resolution is used, see wlr_output_effective_resolution().
*
* Outputs added to the output layout are automatically exposed to clients (see
* wlr_output_create_global). They are no longer exposed when removed from the
* wlr_output_create_global()). They are no longer exposed when removed from the
* layout.
*/
struct wlr_output_layout {
@ -115,7 +115,7 @@ void wlr_output_layout_get_box(struct wlr_output_layout *layout,
* sensible location in the layout. The coordinates of the output in the layout
* may adjust dynamically when the layout changes. If the output is already in
* the layout, it will become auto configured. If the position of the output is
* set such as with `wlr_output_layout_move()`, the output will become manually
* set such as with wlr_output_layout_move(), the output will become manually
* configured.
*/
void wlr_output_layout_add_auto(struct wlr_output_layout *layout,

View file

@ -16,9 +16,9 @@
struct wlr_output_manager_v1 {
struct wl_display *display;
struct wl_global *global;
struct wl_list resources; // wl_resource_get_link
struct wl_list resources; // wl_resource_get_link()
struct wl_list heads; // wlr_output_head_v1::link
struct wl_list heads; // wlr_output_head_v1.link
uint32_t serial;
bool current_configuration_dirty;
@ -33,8 +33,8 @@ struct wlr_output_manager_v1 {
* event data). That is, the compositor is responsible for destroying
* the configuration.
*/
struct wl_signal apply; // wlr_output_configuration_v1
struct wl_signal test; // wlr_output_configuration_v1
struct wl_signal apply; // struct wlr_output_configuration_v1
struct wl_signal test; // struct wlr_output_configuration_v1
struct wl_signal destroy;
} events;
@ -61,16 +61,16 @@ struct wlr_output_head_v1_state {
struct wlr_output_head_v1 {
struct wlr_output_head_v1_state state;
struct wlr_output_manager_v1 *manager;
struct wl_list link; // wlr_output_manager_v1::heads
struct wl_list link; // wlr_output_manager_v1.heads
struct wl_list resources; // wl_resource_get_link
struct wl_list mode_resources; // wl_resource_get_link
struct wl_list resources; // wl_resource_get_link()
struct wl_list mode_resources; // wl_resource_get_link()
struct wl_listener output_destroy;
};
struct wlr_output_configuration_v1 {
struct wl_list heads; // wlr_output_configuration_head_v1::link
struct wl_list heads; // wlr_output_configuration_head_v1.link
// client state
struct wlr_output_manager_v1 *manager;
@ -83,7 +83,7 @@ struct wlr_output_configuration_v1 {
struct wlr_output_configuration_head_v1 {
struct wlr_output_head_v1_state state;
struct wlr_output_configuration_v1 *config;
struct wl_list link; // wlr_output_configuration_v1::heads
struct wl_list link; // wlr_output_configuration_v1.heads
// client state
struct wl_resource *resource; // can be NULL if finalized or disabled
@ -93,7 +93,7 @@ struct wlr_output_configuration_head_v1 {
/**
* Create a new output manager. The compositor is responsible for calling
* `wlr_output_manager_v1_set_configuration` whenever the current output
* wlr_output_manager_v1_set_configuration() whenever the current output
* configuration changes.
*/
struct wlr_output_manager_v1 *wlr_output_manager_v1_create(
@ -111,8 +111,8 @@ void wlr_output_manager_v1_set_configuration(
/**
* Create a new, empty output configuration. Compositors should add current head
* status with `wlr_output_configuration_head_v1_create`. They can then call
* `wlr_output_manager_v1_set_configuration`.
* status with wlr_output_configuration_head_v1_create(). They can then call
* wlr_output_manager_v1_set_configuration().
*/
struct wlr_output_configuration_v1 *wlr_output_configuration_v1_create(void);
void wlr_output_configuration_v1_destroy(
@ -141,4 +141,16 @@ struct wlr_output_configuration_head_v1 *
wlr_output_configuration_head_v1_create(
struct wlr_output_configuration_v1 *config, struct wlr_output *output);
/**
* Apply the head state on the supplied struct wlr_output_state.
*
* Compositors can then pass the resulting struct wlr_output_state to
* wlr_output_commit_state() or wlr_output_test_state().
*
* The position needs to be applied manually by the caller.
*/
void wlr_output_head_v1_state_apply(
const struct wlr_output_head_v1_state *head_state,
struct wlr_output_state *output_state);
#endif

View file

@ -6,12 +6,12 @@
struct wlr_output_power_manager_v1 {
struct wl_global *global;
struct wl_list output_powers; // wlr_output_power_v1::link
struct wl_list output_powers; // wlr_output_power_v1.link
struct wl_listener display_destroy;
struct {
struct wl_signal set_mode; // wlr_output_power_v1_set_mode_event
struct wl_signal set_mode; // struct wlr_output_power_v1_set_mode_event
struct wl_signal destroy;
} events;
@ -22,7 +22,7 @@ struct wlr_output_power_v1 {
struct wl_resource *resource;
struct wlr_output *output;
struct wlr_output_power_manager_v1 *manager;
struct wl_list link;
struct wl_list link; // wlr_output_power_manager_v1.output_powers
struct wl_listener output_destroy_listener;
struct wl_listener output_commit_listener;

View file

@ -21,44 +21,46 @@ struct wlr_pointer {
const struct wlr_pointer_impl *impl;
char *output_name;
struct {
struct wl_signal motion; // struct wlr_event_pointer_motion
struct wl_signal motion_absolute; // struct wlr_event_pointer_motion_absolute
struct wl_signal button; // struct wlr_event_pointer_button
struct wl_signal axis; // struct wlr_event_pointer_axis
struct wl_signal motion; // struct wlr_pointer_motion_event
struct wl_signal motion_absolute; // struct wlr_pointer_motion_absolute_event
struct wl_signal button; // struct wlr_pointer_button_event
struct wl_signal axis; // struct wlr_pointer_axis_event
struct wl_signal frame;
struct wl_signal swipe_begin; // struct wlr_event_pointer_swipe_begin
struct wl_signal swipe_update; // struct wlr_event_pointer_swipe_update
struct wl_signal swipe_end; // struct wlr_event_pointer_swipe_end
struct wl_signal swipe_begin; // struct wlr_pointer_swipe_begin_event
struct wl_signal swipe_update; // struct wlr_pointer_swipe_update_event
struct wl_signal swipe_end; // struct wlr_pointer_swipe_end_event
struct wl_signal pinch_begin; // struct wlr_event_pointer_pinch_begin
struct wl_signal pinch_update; // struct wlr_event_pointer_pinch_update
struct wl_signal pinch_end; // struct wlr_event_pointer_pinch_end
struct wl_signal pinch_begin; // struct wlr_pointer_pinch_begin_event
struct wl_signal pinch_update; // struct wlr_pointer_pinch_update_event
struct wl_signal pinch_end; // struct wlr_pointer_pinch_end_event
struct wl_signal hold_begin; // struct wlr_event_pointer_hold_begin
struct wl_signal hold_end; // struct wlr_event_pointer_hold_end
struct wl_signal hold_begin; // struct wlr_pointer_hold_begin_event
struct wl_signal hold_end; // struct wlr_pointer_hold_end_event
} events;
void *data;
};
struct wlr_event_pointer_motion {
struct wlr_input_device *device;
struct wlr_pointer_motion_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
double delta_x, delta_y;
double unaccel_dx, unaccel_dy;
};
struct wlr_event_pointer_motion_absolute {
struct wlr_input_device *device;
struct wlr_pointer_motion_absolute_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
// From 0..1
double x, y;
};
struct wlr_event_pointer_button {
struct wlr_input_device *device;
struct wlr_pointer_button_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
uint32_t button;
enum wlr_button_state state;
@ -76,8 +78,10 @@ enum wlr_axis_orientation {
WLR_AXIS_ORIENTATION_HORIZONTAL,
};
struct wlr_event_pointer_axis {
struct wlr_input_device *device;
#define WLR_POINTER_AXIS_DISCRETE_STEP 120
struct wlr_pointer_axis_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
enum wlr_axis_source source;
enum wlr_axis_orientation orientation;
@ -85,14 +89,14 @@ struct wlr_event_pointer_axis {
int32_t delta_discrete;
};
struct wlr_event_pointer_swipe_begin {
struct wlr_input_device *device;
struct wlr_pointer_swipe_begin_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
uint32_t fingers;
};
struct wlr_event_pointer_swipe_update {
struct wlr_input_device *device;
struct wlr_pointer_swipe_update_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
uint32_t fingers;
// Relative coordinates of the logical center of the gesture
@ -100,20 +104,20 @@ struct wlr_event_pointer_swipe_update {
double dx, dy;
};
struct wlr_event_pointer_swipe_end {
struct wlr_input_device *device;
struct wlr_pointer_swipe_end_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
bool cancelled;
};
struct wlr_event_pointer_pinch_begin {
struct wlr_input_device *device;
struct wlr_pointer_pinch_begin_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
uint32_t fingers;
};
struct wlr_event_pointer_pinch_update {
struct wlr_input_device *device;
struct wlr_pointer_pinch_update_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
uint32_t fingers;
// Relative coordinates of the logical center of the gesture
@ -125,22 +129,30 @@ struct wlr_event_pointer_pinch_update {
double rotation;
};
struct wlr_event_pointer_pinch_end {
struct wlr_input_device *device;
struct wlr_pointer_pinch_end_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
bool cancelled;
};
struct wlr_event_pointer_hold_begin {
struct wlr_input_device *device;
struct wlr_pointer_hold_begin_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
uint32_t fingers;
};
struct wlr_event_pointer_hold_end {
struct wlr_input_device *device;
struct wlr_pointer_hold_end_event {
struct wlr_pointer *pointer;
uint32_t time_msec;
bool cancelled;
};
/**
* Get a struct wlr_pointer from a struct wlr_input_device.
*
* Asserts that the input device is a pointer.
*/
struct wlr_pointer *wlr_pointer_from_input_device(
struct wlr_input_device *input_device);
#endif

View file

@ -53,7 +53,7 @@ struct wlr_pointer_constraint_v1 {
struct wl_listener surface_destroy;
struct wl_listener seat_destroy;
struct wl_list link; // wlr_pointer_constraints_v1::constraints
struct wl_list link; // wlr_pointer_constraints_v1.constraints
struct {
/**
@ -69,13 +69,13 @@ struct wlr_pointer_constraint_v1 {
struct wlr_pointer_constraints_v1 {
struct wl_global *global;
struct wl_list constraints; // wlr_pointer_constraint_v1::link
struct wl_list constraints; // wlr_pointer_constraint_v1.link
struct {
/**
* Called when a new pointer constraint is created.
*
* data: struct wlr_pointer_constraint_v1 *
* The data pointer is a struct wlr_pointer_constraint_v1.
*/
struct wl_signal new_constraint;
} events;

View file

@ -16,9 +16,9 @@ struct wlr_surface;
struct wlr_pointer_gestures_v1 {
struct wl_global *global;
struct wl_list swipes; // wl_resource_get_link
struct wl_list pinches; // wl_resource_get_link
struct wl_list holds; // wl_resource_get_link
struct wl_list swipes; // wl_resource_get_link()
struct wl_list pinches; // wl_resource_get_link()
struct wl_list holds; // wl_resource_get_link()
struct wl_listener display_destroy;

View file

@ -31,10 +31,10 @@ struct wlr_presentation {
};
struct wlr_presentation_feedback {
struct wl_list resources; // wl_resource_get_link
struct wl_list resources; // wl_resource_get_link()
// Only when the wlr_presentation_surface_sampled_on_output helper has been
// called
// Only when the wlr_presentation_surface_sampled_on_output() helper has
// been called.
struct wlr_output *output;
bool output_committed;
uint32_t output_commit_seq;
@ -50,7 +50,7 @@ struct wlr_presentation_event {
uint32_t tv_nsec;
uint32_t refresh;
uint64_t seq;
uint32_t flags; // wp_presentation_feedback_kind
uint32_t flags; // enum wp_presentation_feedback_kind
};
struct wlr_backend;
@ -64,8 +64,8 @@ struct wlr_presentation *wlr_presentation_create(struct wl_display *display,
* contents (e.g. when rendering the surface's current texture, when
* referencing its current buffer, or when directly scanning out its current
* buffer). A wlr_presentation_feedback is returned. The compositor should call
* wlr_presentation_feedback_send_presented if this content has been displayed,
* then wlr_presentation_feedback_destroy.
* wlr_presentation_feedback_send_presented() if this content has been displayed,
* then wlr_presentation_feedback_destroy().
*
* NULL is returned if the client hasn't requested presentation feedback for
* this surface.
@ -79,7 +79,7 @@ void wlr_presentation_feedback_destroy(
struct wlr_presentation_feedback *feedback);
/**
* Fill a wlr_presentation_event from a wlr_output_event_present.
* Fill a wlr_presentation_event from a struct wlr_output_event_present.
*/
void wlr_presentation_event_from_output(struct wlr_presentation_event *event,
const struct wlr_output_event_present *output_event);
@ -87,9 +87,9 @@ void wlr_presentation_event_from_output(struct wlr_presentation_event *event,
/**
* Mark the current surface's buffer as sampled on the given output.
*
* Instead of calling wlr_presentation_surface_sampled and managing the
* wlr_presentation_feedback itself, the compositor can call this function
* before a wlr_output_commit call to indicate that the surface's current
* Instead of calling wlr_presentation_surface_sampled() and managing the
* struct wlr_presentation_feedback itself, the compositor can call this function
* before a wlr_output_commit() call to indicate that the surface's current
* contents will be displayed on the output.
*/
void wlr_presentation_surface_sampled_on_output(

View file

@ -14,7 +14,7 @@
struct wlr_primary_selection_v1_device_manager {
struct wl_global *global;
struct wl_list devices; // wlr_primary_selection_v1_device::link
struct wl_list devices; // wlr_primary_selection_v1_device.link
struct wl_listener display_destroy;
@ -31,10 +31,10 @@ struct wlr_primary_selection_v1_device_manager {
struct wlr_primary_selection_v1_device {
struct wlr_primary_selection_v1_device_manager *manager;
struct wlr_seat *seat;
struct wl_list link; // wlr_primary_selection_v1_device_manager::devices
struct wl_list resources; // wl_resource_get_link
struct wl_list link; // wlr_primary_selection_v1_device_manager.devices
struct wl_list resources; // wl_resource_get_link()
struct wl_list offers; // wl_resource_get_link
struct wl_list offers; // wl_resource_get_link()
struct wl_listener seat_destroy;
struct wl_listener seat_focus_change;

View file

@ -23,11 +23,11 @@
*/
struct wlr_relative_pointer_manager_v1 {
struct wl_global *global;
struct wl_list relative_pointers; // wlr_relative_pointer_v1::link
struct wl_list relative_pointers; // wlr_relative_pointer_v1.link
struct {
struct wl_signal destroy;
struct wl_signal new_relative_pointer; // wlr_relative_pointer_v1
struct wl_signal new_relative_pointer; // struct wlr_relative_pointer_v1
} events;
struct wl_listener display_destroy_listener;
@ -45,7 +45,7 @@ struct wlr_relative_pointer_v1 {
struct wl_resource *resource;
struct wl_resource *pointer_resource;
struct wlr_seat *seat;
struct wl_list link; // wlr_relative_pointer_manager_v1::relative_pointers
struct wl_list link; // wlr_relative_pointer_manager_v1.relative_pointers
struct {
struct wl_signal destroy;

View file

@ -22,80 +22,95 @@
#include <pixman.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_damage_ring.h>
struct wlr_output;
struct wlr_output_layout;
struct wlr_xdg_surface;
struct wlr_layer_surface_v1;
struct wlr_scene_node;
struct wlr_scene_buffer;
typedef bool (*wlr_scene_buffer_point_accepts_input_func_t)(
struct wlr_scene_buffer *buffer, int sx, int sy);
typedef void (*wlr_scene_buffer_iterator_func_t)(
struct wlr_scene_buffer *buffer, int sx, int sy, void *user_data);
enum wlr_scene_node_type {
WLR_SCENE_NODE_ROOT,
WLR_SCENE_NODE_TREE,
WLR_SCENE_NODE_SURFACE,
WLR_SCENE_NODE_RECT,
WLR_SCENE_NODE_BUFFER,
};
struct wlr_scene_node_state {
struct wl_list link; // wlr_scene_node_state.children
struct wl_list children; // wlr_scene_node_state.link
bool enabled;
int x, y; // relative to parent
};
/** A node is an object in the scene. */
struct wlr_scene_node {
enum wlr_scene_node_type type;
struct wlr_scene_node *parent;
struct wlr_scene_node_state state;
struct wlr_scene_tree *parent;
struct wl_list link; // wlr_scene_tree.children
bool enabled;
int x, y; // relative to parent
struct {
struct wl_signal destroy;
} events;
void *data;
};
/** The root scene-graph node. */
struct wlr_scene {
struct wlr_scene_node node;
struct wl_list outputs; // wlr_scene_output.link
struct wlr_addon_set addons;
// private state
// May be NULL
struct wlr_presentation *presentation;
struct wl_listener presentation_destroy;
pixman_region32_t visible;
};
// List of buffers which need to be imported as textures
struct wl_list pending_buffers; // wlr_scene_buffer.pending_link
enum wlr_scene_debug_damage_option {
WLR_SCENE_DEBUG_DAMAGE_NONE,
WLR_SCENE_DEBUG_DAMAGE_RERENDER,
WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT
};
/** A sub-tree in the scene-graph. */
struct wlr_scene_tree {
struct wlr_scene_node node;
struct wl_list children; // wlr_scene_node.link
};
/** The root scene-graph node. */
struct wlr_scene {
struct wlr_scene_tree tree;
struct wl_list outputs; // wlr_scene_output.link
// May be NULL
struct wlr_presentation *presentation;
// private state
struct wl_listener presentation_destroy;
enum wlr_scene_debug_damage_option debug_damage_option;
bool direct_scanout;
bool calculate_visibility;
};
/** A scene-graph node displaying a single surface. */
struct wlr_scene_surface {
struct wlr_scene_node node;
struct wlr_scene_buffer *buffer;
struct wlr_surface *surface;
/**
* The output that the largest area of this surface is displayed on.
* This may be NULL if the surface is not currently displayed on any
* outputs. This is the output that should be used for frame callbacks,
* presentation feedback, etc.
*/
struct wlr_output *primary_output;
// private state
int prev_width, prev_height;
struct wlr_addon addon;
struct wl_listener output_enter;
struct wl_listener output_leave;
struct wl_listener output_present;
struct wl_listener frame_done;
struct wl_listener surface_destroy;
struct wl_listener surface_commit;
};
@ -110,15 +125,36 @@ struct wlr_scene_rect {
/** A scene-graph node displaying a buffer */
struct wlr_scene_buffer {
struct wlr_scene_node node;
// May be NULL
struct wlr_buffer *buffer;
struct {
struct wl_signal output_enter; // struct wlr_scene_output
struct wl_signal output_leave; // struct wlr_scene_output
struct wl_signal output_present; // struct wlr_scene_output
struct wl_signal frame_done; // struct timespec
} events;
// May be NULL
wlr_scene_buffer_point_accepts_input_func_t point_accepts_input;
/**
* The output that the largest area of this buffer is displayed on.
* This may be NULL if the buffer is not currently displayed on any
* outputs. This is the output that should be used for frame callbacks,
* presentation feedback, etc.
*/
struct wlr_scene_output *primary_output;
// private state
uint64_t active_outputs;
struct wlr_texture *texture;
struct wlr_fbox src_box;
int dst_width, dst_height;
enum wl_output_transform transform;
struct wl_list pending_link; // wlr_scene.pending_buffers
pixman_region32_t opaque_region;
};
/** A viewport for an output in the scene-graph */
@ -128,18 +164,32 @@ struct wlr_scene_output {
struct wlr_scene *scene;
struct wlr_addon addon;
struct wlr_output_damage *damage;
struct wlr_damage_ring damage_ring;
int x, y;
struct {
struct wl_signal destroy;
} events;
// private state
uint8_t index;
bool prev_scanout;
struct wl_listener output_commit;
struct wl_listener output_mode;
struct wl_listener output_damage;
struct wl_listener output_needs_frame;
struct wl_list damage_highlight_regions;
struct wl_array render_list;
};
/** A layer shell scene helper */
struct wlr_scene_layer_surface_v1 {
struct wlr_scene_node *node;
struct wlr_scene_tree *tree;
struct wlr_layer_surface_v1 *layer_surface;
// private state
@ -150,9 +200,6 @@ struct wlr_scene_layer_surface_v1 {
struct wl_listener layer_surface_unmap;
};
typedef void (*wlr_scene_node_iterator_func_t)(struct wlr_scene_node *node,
int sx, int sy, void *data);
/**
* Immediately destroy the scene-graph node.
*/
@ -190,7 +237,7 @@ void wlr_scene_node_lower_to_bottom(struct wlr_scene_node *node);
* Move the node to another location in the tree.
*/
void wlr_scene_node_reparent(struct wlr_scene_node *node,
struct wlr_scene_node *new_parent);
struct wlr_scene_tree *new_parent);
/**
* Get the node's layout-local coordinates.
*
@ -198,12 +245,12 @@ void wlr_scene_node_reparent(struct wlr_scene_node *node,
*/
bool wlr_scene_node_coords(struct wlr_scene_node *node, int *lx, int *ly);
/**
* Call `iterator` on each surface in the scene-graph, with the surface's
* Call `iterator` on each buffer in the scene-graph, with the buffer's
* position in layout coordinates. The function is called from root to leaves
* (in rendering order).
*/
void wlr_scene_node_for_each_surface(struct wlr_scene_node *node,
wlr_surface_iterator_func_t iterator, void *user_data);
void wlr_scene_node_for_each_buffer(struct wlr_scene_node *node,
wlr_scene_buffer_iterator_func_t iterator, void *user_data);
/**
* Find the topmost node in this scene-graph that contains the point at the
* given layout-local coordinates. (For surface nodes, this means accepting
@ -217,19 +264,11 @@ struct wlr_scene_node *wlr_scene_node_at(struct wlr_scene_node *node,
* Create a new scene-graph.
*/
struct wlr_scene *wlr_scene_create(void);
/**
* Manually render the scene-graph on an output. The compositor needs to call
* wlr_renderer_begin before and wlr_renderer_end after calling this function.
* Damage is given in output-buffer-local coordinates and can be set to NULL to
* disable damage tracking.
*/
void wlr_scene_render_output(struct wlr_scene *scene, struct wlr_output *output,
int lx, int ly, pixman_region32_t *damage);
/**
* Handle presentation feedback for all surfaces in the scene, assuming that
* scene outputs and the scene rendering functions are used.
*
* Asserts that a wlr_presentation hasn't already been set for the scene.
* Asserts that a struct wlr_presentation hasn't already been set for the scene.
*/
void wlr_scene_set_presentation(struct wlr_scene *scene,
struct wlr_presentation *presentation);
@ -237,26 +276,33 @@ void wlr_scene_set_presentation(struct wlr_scene *scene,
/**
* Add a node displaying nothing but its children.
*/
struct wlr_scene_tree *wlr_scene_tree_create(struct wlr_scene_node *parent);
struct wlr_scene_tree *wlr_scene_tree_create(struct wlr_scene_tree *parent);
/**
* Add a node displaying a single surface to the scene-graph.
*
* The child sub-surfaces are ignored.
*
* wlr_surface_send_enter()/wlr_surface_send_leave() will be called
* wlr_surface_send_enter() and wlr_surface_send_leave() will be called
* automatically based on the position of the surface and outputs in
* the scene.
*/
struct wlr_scene_surface *wlr_scene_surface_create(struct wlr_scene_node *parent,
struct wlr_scene_surface *wlr_scene_surface_create(struct wlr_scene_tree *parent,
struct wlr_surface *surface);
struct wlr_scene_surface *wlr_scene_surface_from_node(struct wlr_scene_node *node);
struct wlr_scene_buffer *wlr_scene_buffer_from_node(struct wlr_scene_node *node);
/**
* If this buffer is backed by a surface, then the struct wlr_scene_surface is
* returned. If not, NULL will be returned.
*/
struct wlr_scene_surface *wlr_scene_surface_from_buffer(
struct wlr_scene_buffer *scene_buffer);
/**
* Add a node displaying a solid-colored rectangle to the scene-graph.
*/
struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_node *parent,
struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent,
int width, int height, const float color[static 4]);
/**
@ -271,10 +317,36 @@ void wlr_scene_rect_set_color(struct wlr_scene_rect *rect, const float color[sta
/**
* Add a node displaying a buffer to the scene-graph.
*
* If the buffer is NULL, this node will not be displayed.
*/
struct wlr_scene_buffer *wlr_scene_buffer_create(struct wlr_scene_node *parent,
struct wlr_scene_buffer *wlr_scene_buffer_create(struct wlr_scene_tree *parent,
struct wlr_buffer *buffer);
/**
* Sets the buffer's backing buffer.
*
* If the buffer is NULL, the buffer node will not be displayed.
*/
void wlr_scene_buffer_set_buffer(struct wlr_scene_buffer *scene_buffer,
struct wlr_buffer *buffer);
/**
* Sets the buffer's backing buffer with a custom damage region.
*
* The damage region is in buffer-local coordinates. If the region is NULL,
* the whole buffer node will be damaged.
*/
void wlr_scene_buffer_set_buffer_with_damage(struct wlr_scene_buffer *scene_buffer,
struct wlr_buffer *buffer, pixman_region32_t *region);
/**
* Sets the buffer's opaque region. This is an optimization hint used to
* determine if buffers which reside under this one need to be rendered or not.
*/
void wlr_scene_buffer_set_opaque_region(struct wlr_scene_buffer *scene_buffer,
pixman_region32_t *region);
/**
* Set the source rectangle describing the region of the buffer which will be
* sampled to render this node. This allows cropping the buffer.
@ -300,6 +372,12 @@ void wlr_scene_buffer_set_dest_size(struct wlr_scene_buffer *scene_buffer,
void wlr_scene_buffer_set_transform(struct wlr_scene_buffer *scene_buffer,
enum wl_output_transform transform);
/**
* Calls the buffer's frame_done signal.
*/
void wlr_scene_buffer_send_frame_done(struct wlr_scene_buffer *scene_buffer,
struct timespec *now);
/**
* Add a viewport for the specified output to the scene-graph.
*
@ -322,20 +400,20 @@ void wlr_scene_output_set_position(struct wlr_scene_output *scene_output,
bool wlr_scene_output_commit(struct wlr_scene_output *scene_output);
/**
* Call wlr_surface_send_frame_done() on all surfaces in the scene rendered by
* wlr_scene_output_commit() for which wlr_scene_surface->primary_output
* wlr_scene_output_commit() for which wlr_scene_surface.primary_output
* matches the given scene_output.
*/
void wlr_scene_output_send_frame_done(struct wlr_scene_output *scene_output,
struct timespec *now);
/**
* Call `iterator` on each surface in the scene-graph visible on the output,
* with the surface's position in layout coordinates. The function is called
* Call `iterator` on each buffer in the scene-graph visible on the output,
* with the buffer's position in layout coordinates. The function is called
* from root to leaves (in rendering order).
*/
void wlr_scene_output_for_each_surface(struct wlr_scene_output *scene_output,
wlr_surface_iterator_func_t iterator, void *user_data);
void wlr_scene_output_for_each_buffer(struct wlr_scene_output *scene_output,
wlr_scene_buffer_iterator_func_t iterator, void *user_data);
/**
* Get a scene-graph output from a wlr_output.
* Get a scene-graph output from a struct wlr_output.
*
* If the output hasn't been added to the scene-graph, returns NULL.
*/
@ -345,8 +423,10 @@ struct wlr_scene_output *wlr_scene_get_scene_output(struct wlr_scene *scene,
/**
* Attach an output layout to a scene.
*
* Outputs in the output layout are automatically added to the scene. Any
* change to the output layout is mirrored to the scene-graph outputs.
* Adding, removing, or repositioning an output in the output layout
* will respectively add, remove or reposition a corresponding
* scene-graph output. When the output layout is destroyed, scene-graph
* outputs which were created by this helper will be destroyed.
*/
bool wlr_scene_attach_output_layout(struct wlr_scene *scene,
struct wlr_output_layout *output_layout);
@ -355,8 +435,8 @@ bool wlr_scene_attach_output_layout(struct wlr_scene *scene,
* Add a node displaying a surface and all of its sub-surfaces to the
* scene-graph.
*/
struct wlr_scene_node *wlr_scene_subsurface_tree_create(
struct wlr_scene_node *parent, struct wlr_surface *surface);
struct wlr_scene_tree *wlr_scene_subsurface_tree_create(
struct wlr_scene_tree *parent, struct wlr_surface *surface);
/**
* Add a node displaying an xdg_surface and all of its sub-surfaces to the
@ -365,8 +445,8 @@ struct wlr_scene_node *wlr_scene_subsurface_tree_create(
* The origin of the returned scene-graph node will match the top-left corner
* of the xdg_surface window geometry.
*/
struct wlr_scene_node *wlr_scene_xdg_surface_create(
struct wlr_scene_node *parent, struct wlr_xdg_surface *xdg_surface);
struct wlr_scene_tree *wlr_scene_xdg_surface_create(
struct wlr_scene_tree *parent, struct wlr_xdg_surface *xdg_surface);
/**
* Add a node displaying a layer_surface_v1 and all of its sub-surfaces to the
@ -376,7 +456,7 @@ struct wlr_scene_node *wlr_scene_xdg_surface_create(
* of the layer surface.
*/
struct wlr_scene_layer_surface_v1 *wlr_scene_layer_surface_v1_create(
struct wlr_scene_node *parent, struct wlr_layer_surface_v1 *layer_surface);
struct wlr_scene_tree *parent, struct wlr_layer_surface_v1 *layer_surface);
/**
* Configure a layer_surface_v1, position its scene node in accordance to its

View file

@ -15,7 +15,7 @@
struct wlr_screencopy_manager_v1 {
struct wl_global *global;
struct wl_list frames; // wlr_screencopy_frame_v1::link
struct wl_list frames; // wlr_screencopy_frame_v1.link
struct wl_listener display_destroy;
@ -35,7 +35,7 @@ struct wlr_screencopy_v1_client {
struct wlr_screencopy_frame_v1 {
struct wl_resource *resource;
struct wlr_screencopy_v1_client *client;
struct wl_list link;
struct wl_list link; // wlr_screencopy_manager_v1.frames
enum wl_shm_format format;
uint32_t fourcc;

View file

@ -32,7 +32,7 @@ struct wlr_serial_ringset {
/**
* Contains state for a single client's bound wl_seat resource and can be used
* to issue input events to that client. The lifetime of these objects is
* managed by wlr_seat; some may be NULL.
* managed by struct wlr_seat; some may be NULL.
*/
struct wlr_seat_client {
struct wl_client *client;
@ -54,6 +54,19 @@ struct wlr_seat_client {
// for use by wlr_seat_client_{next_serial,validate_event_serial}
struct wlr_serial_ringset serials;
bool needs_touch_frame;
// When the client doesn't support high-resolution scroll, accumulate deltas
// until we can notify a discrete event.
// Some mice have a free spinning wheel, making possible to lock the wheel
// when the accumulator value is not 0. To avoid synchronization issues
// between the mouse wheel and the accumulators, store the last delta and
// when the scroll direction changes, reset the accumulator.
// Indexed by wlr_axis_orientation.
struct {
int32_t acc_discrete[2];
int32_t last_discrete[2];
double acc_axis[2];
} value120;
};
struct wlr_touch_point {
@ -119,13 +132,15 @@ struct wlr_touch_grab_interface {
void (*enter)(struct wlr_seat_touch_grab *grab, uint32_t time_msec,
struct wlr_touch_point *point);
void (*frame)(struct wlr_seat_touch_grab *grab);
// XXX this will conflict with the actual touch cancel which is different so
// we need to rename this
// Cancel grab
void (*cancel)(struct wlr_seat_touch_grab *grab);
// Send wl_touch::cancel
void (*wl_cancel)(struct wlr_seat_touch_grab *grab,
struct wlr_surface *surface);
};
/**
* Passed to `wlr_seat_touch_start_grab()` to start a grab of the touch device.
* Passed to wlr_seat_touch_start_grab() to start a grab of the touch device.
* The grabber is responsible for handling touch events for the seat.
*/
struct wlr_seat_touch_grab {
@ -135,7 +150,7 @@ struct wlr_seat_touch_grab {
};
/**
* Passed to `wlr_seat_keyboard_start_grab()` to start a grab of the keyboard.
* Passed to wlr_seat_keyboard_start_grab() to start a grab of the keyboard.
* The grabber is responsible for handling keyboard events for the seat.
*/
struct wlr_seat_keyboard_grab {
@ -145,7 +160,7 @@ struct wlr_seat_keyboard_grab {
};
/**
* Passed to `wlr_seat_pointer_start_grab()` to start a grab of the pointer. The
* Passed to wlr_seat_pointer_start_grab() to start a grab of the pointer. The
* grabber is responsible for handling pointer events for the seat.
*/
struct wlr_seat_pointer_grab {
@ -177,7 +192,7 @@ struct wlr_seat_pointer_state {
struct wl_listener surface_destroy;
struct {
struct wl_signal focus_change; // wlr_seat_pointer_focus_change_event
struct wl_signal focus_change; // struct wlr_seat_pointer_focus_change_event
} events;
};
@ -199,13 +214,13 @@ struct wlr_seat_keyboard_state {
struct wlr_seat_keyboard_grab *default_grab;
struct {
struct wl_signal focus_change; // wlr_seat_keyboard_focus_change_event
struct wl_signal focus_change; // struct wlr_seat_keyboard_focus_change_event
} events;
};
struct wlr_seat_touch_state {
struct wlr_seat *seat;
struct wl_list touch_points; // wlr_touch_point::link
struct wl_list touch_points; // wlr_touch_point.link
uint32_t grab_serial;
uint32_t grab_id;
@ -228,7 +243,7 @@ struct wlr_seat {
struct wlr_data_source *selection_source;
uint32_t selection_serial;
struct wl_list selection_offers; // wlr_data_offer::link
struct wl_list selection_offers; // wlr_data_offer.link
struct wlr_primary_selection_source *primary_selection_source;
uint32_t primary_selection_serial;
@ -237,7 +252,7 @@ struct wlr_seat {
struct wlr_drag *drag;
struct wlr_data_source *drag_source;
uint32_t drag_serial;
struct wl_list drag_offers; // wlr_data_offer::link
struct wl_list drag_offers; // wlr_data_offer.link
struct wlr_seat_pointer_state pointer_state;
struct wlr_seat_keyboard_state keyboard_state;
@ -258,26 +273,26 @@ struct wlr_seat {
struct wl_signal touch_grab_begin;
struct wl_signal touch_grab_end;
// wlr_seat_pointer_request_set_cursor_event
// struct wlr_seat_pointer_request_set_cursor_event
struct wl_signal request_set_cursor;
// Called when an application _wants_ to set the selection (user copies some data).
// Compositors should listen to this event and call wlr_seat_set_selection
// Compositors should listen to this event and call wlr_seat_set_selection()
// if they want to accept the client's request.
struct wl_signal request_set_selection; // wlr_seat_request_set_selection_event
struct wl_signal request_set_selection; // struct wlr_seat_request_set_selection_event
// Called after the data source is set for the selection.
struct wl_signal set_selection;
// Called when an application _wants_ to set the primary selection (user selects some data).
// Compositors should listen to this event and call wlr_seat_set_primary_selection
// Compositors should listen to this event and call wlr_seat_set_primary_selection()
// if they want to accept the client's request.
struct wl_signal request_set_primary_selection; // wlr_seat_request_set_primary_selection_event
struct wl_signal request_set_primary_selection; // struct wlr_seat_request_set_primary_selection_event
// Called after the primary selection source object is set.
struct wl_signal set_primary_selection;
// wlr_seat_request_start_drag_event
// struct wlr_seat_request_start_drag_event
struct wl_signal request_start_drag;
struct wl_signal start_drag; // wlr_drag
struct wl_signal start_drag; // struct wlr_drag
struct wl_signal destroy;
} events;
@ -320,16 +335,16 @@ struct wlr_seat_keyboard_focus_change_event {
};
/**
* Allocates a new wlr_seat and adds a wl_seat global to the display.
* Allocates a new struct wlr_seat and adds a wl_seat global to the display.
*/
struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name);
/**
* Destroys a wlr_seat, removes its wl_seat global and clears focus for all
* Destroys a seat, removes its wl_seat global and clears focus for all
* devices belonging to the seat.
*/
void wlr_seat_destroy(struct wlr_seat *wlr_seat);
/**
* Gets a wlr_seat_client for the specified client, or returns NULL if no
* Gets a struct wlr_seat_client for the specified client, or returns NULL if no
* client is bound for that client.
*/
struct wlr_seat_client *wlr_seat_client_for_wl_client(struct wlr_seat *wlr_seat,
@ -357,7 +372,7 @@ bool wlr_seat_pointer_surface_has_focus(struct wlr_seat *wlr_seat,
* focused surface for the pointer. This will send a leave event to the last
* surface that was entered. Coordinates for the enter event are surface-local.
* This function does not respect pointer grabs: you probably want
* `wlr_seat_pointer_notify_enter()` instead.
* wlr_seat_pointer_notify_enter() instead.
*/
void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
struct wlr_surface *surface, double sx, double sy);
@ -365,14 +380,14 @@ void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat,
/**
* Clear the focused surface for the pointer and leave all entered surfaces.
* This function does not respect pointer grabs: you probably want
* `wlr_seat_pointer_notify_clear_focus()` instead.
* wlr_seat_pointer_notify_clear_focus() instead.
*/
void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat);
/**
* Send a motion event to the surface with pointer focus. Coordinates for the
* motion event are surface-local. This function does not respect pointer grabs:
* you probably want `wlr_seat_pointer_notify_motion()` instead.
* you probably want wlr_seat_pointer_notify_motion() instead.
*/
void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time_msec,
double sx, double sy);
@ -380,7 +395,7 @@ void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time_msec,
/**
* Send a button event to the surface with pointer focus. Coordinates for the
* button event are surface-local. Returns the serial. This function does not
* respect pointer grabs: you probably want `wlr_seat_pointer_notify_button()`
* respect pointer grabs: you probably want wlr_seat_pointer_notify_button()
* instead.
*/
uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat,
@ -388,7 +403,7 @@ uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat,
/**
* Send an axis event to the surface with pointer focus. This function does not
* respect pointer grabs: you probably want `wlr_seat_pointer_notify_axis()`
* respect pointer grabs: you probably want wlr_seat_pointer_notify_axis()
* instead.
*/
void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time_msec,
@ -397,7 +412,7 @@ void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time_msec,
/**
* Send a frame event to the surface with pointer focus. This function does not
* respect pointer grabs: you probably want `wlr_seat_pointer_notify_frame()`
* respect pointer grabs: you probably want wlr_seat_pointer_notify_frame()
* instead.
*/
void wlr_seat_pointer_send_frame(struct wlr_seat *wlr_seat);
@ -474,7 +489,7 @@ bool wlr_seat_pointer_has_grab(struct wlr_seat *seat);
/**
* Set this keyboard as the active keyboard for the seat.
*/
void wlr_seat_set_keyboard(struct wlr_seat *seat, struct wlr_input_device *dev);
void wlr_seat_set_keyboard(struct wlr_seat *seat, struct wlr_keyboard *keyboard);
/**
* Get the active keyboard for the seat.
@ -483,7 +498,7 @@ struct wlr_keyboard *wlr_seat_get_keyboard(struct wlr_seat *seat);
/**
* Send the keyboard key to focused keyboard resources. This function does not
* respect keyboard grabs: you probably want `wlr_seat_keyboard_notify_key()`
* respect keyboard grabs: you probably want wlr_seat_keyboard_notify_key()
* instead.
*/
void wlr_seat_keyboard_send_key(struct wlr_seat *seat, uint32_t time_msec,
@ -492,7 +507,7 @@ void wlr_seat_keyboard_send_key(struct wlr_seat *seat, uint32_t time_msec,
/**
* Send the modifier state to focused keyboard resources. This function does
* not respect keyboard grabs: you probably want
* `wlr_seat_keyboard_notify_modifiers()` instead.
* wlr_seat_keyboard_notify_modifiers() instead.
*/
void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
struct wlr_keyboard_modifiers *modifiers);
@ -501,7 +516,7 @@ void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
* Send a keyboard enter event to the given surface and consider it to be the
* focused surface for the keyboard. This will send a leave event to the last
* surface that was entered. This function does not respect keyboard grabs: you
* probably want `wlr_seat_keyboard_notify_enter()` instead.
* probably want wlr_seat_keyboard_notify_enter() instead.
*/
void wlr_seat_keyboard_enter(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t keycodes[], size_t num_keycodes,
@ -510,7 +525,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
/**
* Clear the focused surface for the keyboard and leave all entered surfaces.
* This function does not respect keyboard grabs: you probably want
* `wlr_seat_keyboard_notify_clear_focus()` instead.
* wlr_seat_keyboard_notify_clear_focus() instead.
*/
void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat);
@ -571,7 +586,7 @@ struct wlr_touch_point *wlr_seat_touch_get_point(struct wlr_seat *seat,
/**
* Notify the seat that the touch point given by `touch_id` has entered a new
* surface. The surface is required. To clear focus, use
* `wlr_seat_touch_point_clear_focus()`.
* wlr_seat_touch_point_clear_focus().
*/
void wlr_seat_touch_point_focus(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t time_msec,
@ -589,7 +604,7 @@ void wlr_seat_touch_point_clear_focus(struct wlr_seat *seat, uint32_t time_msec,
* this will add a new touch point with the given `touch_id`. The touch down may
* not be valid if the surface seat client does not accept touch input.
* Coordinates are surface-local. This function does not respect touch grabs:
* you probably want `wlr_seat_touch_notify_down()` instead.
* you probably want wlr_seat_touch_notify_down() instead.
*/
uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
struct wlr_surface *surface, uint32_t time_msec,
@ -599,7 +614,7 @@ uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat,
* Send a touch up event for the touch point given by the `touch_id`. The event
* will go to the client for the surface given in the corresponding touch down
* event. This will remove the touch point. This function does not respect touch
* grabs: you probably want `wlr_seat_touch_notify_up()` instead.
* grabs: you probably want wlr_seat_touch_notify_up() instead.
*/
void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time_msec,
int32_t touch_id);
@ -608,11 +623,19 @@ void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time_msec,
* Send a touch motion event for the touch point given by the `touch_id`. The
* event will go to the client for the surface given in the corresponding touch
* down event. This function does not respect touch grabs: you probably want
* `wlr_seat_touch_notify_motion()` instead.
* wlr_seat_touch_notify_motion() instead.
*/
void wlr_seat_touch_send_motion(struct wlr_seat *seat, uint32_t time_msec,
int32_t touch_id, double sx, double sy);
/**
* Notify the seat that this is a global gesture and the client should cancel
* processing it. The event will go to the client for the surface given.
* This function does not respect touch grabs: you probably want
* wlr_seat_touch_notify_cancel() instead.
*/
void wlr_seat_touch_send_cancel(struct wlr_seat *seat, struct wlr_surface *surface);
void wlr_seat_touch_send_frame(struct wlr_seat *seat);
/**
@ -639,6 +662,13 @@ void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time_msec,
void wlr_seat_touch_notify_motion(struct wlr_seat *seat, uint32_t time_msec,
int32_t touch_id, double sx, double sy);
/**
* Notify the seat that this is a global gesture and the client should
* cancel processing it. Defers to any grab of the touch device.
*/
void wlr_seat_touch_notify_cancel(struct wlr_seat *seat,
struct wlr_surface *surface);
void wlr_seat_touch_notify_frame(struct wlr_seat *seat);
/**
@ -678,7 +708,7 @@ bool wlr_seat_validate_pointer_grab_serial(struct wlr_seat *seat,
/**
* Check whether this serial is valid to start a touch grab action. If it's the
* case and point_ptr is non-NULL, *point_ptr is set to the touch point matching
* case and point_ptr is non-NULL, `*point_ptr` is set to the touch point matching
* the serial.
*/
bool wlr_seat_validate_touch_grab_serial(struct wlr_seat *seat,

View file

@ -44,8 +44,8 @@ enum wlr_server_decoration_manager_mode {
*/
struct wlr_server_decoration_manager {
struct wl_global *global;
struct wl_list resources; // wl_resource_get_link
struct wl_list decorations; // wlr_server_decoration::link
struct wl_list resources; // wl_resource_get_link()
struct wl_list decorations; // wlr_server_decoration.link
uint32_t default_mode; // enum wlr_server_decoration_manager_mode

View file

@ -31,7 +31,7 @@ struct wlr_session_lock_manager_v1 {
struct wlr_session_lock_v1 {
struct wl_resource *resource;
struct wl_list surfaces; // struct wlr_session_lock_surface_v1::link
struct wl_list surfaces; // struct wlr_session_lock_surface_v1.link
struct {
struct wl_signal new_surface; // struct wlr_session_lock_surface_v1 *
@ -48,7 +48,7 @@ struct wlr_session_lock_surface_v1_state {
};
struct wlr_session_lock_surface_v1_configure {
struct wl_list link; // wlr_session_lock_surface_v1::configure_list
struct wl_list link; // wlr_session_lock_surface_v1.configure_list
uint32_t serial;
uint32_t width, height;
@ -56,14 +56,14 @@ struct wlr_session_lock_surface_v1_configure {
struct wlr_session_lock_surface_v1 {
struct wl_resource *resource;
struct wl_list link; // wlr_session_lock_v1::surfaces
struct wl_list link; // wlr_session_lock_v1.surfaces
struct wlr_output *output;
struct wlr_surface *surface;
bool configured, mapped;
struct wl_list configure_list; // wlr_session_lock_surface_v1_configure::link
struct wl_list configure_list; // wlr_session_lock_surface_v1_configure.link
struct wlr_session_lock_surface_v1_state current;
struct wlr_session_lock_surface_v1_state pending;
@ -91,7 +91,17 @@ uint32_t wlr_session_lock_surface_v1_configure(
struct wlr_session_lock_surface_v1 *lock_surface,
uint32_t width, uint32_t height);
/**
* Returns true if the surface has the session lock surface role.
*/
bool wlr_surface_is_session_lock_surface_v1(struct wlr_surface *surface);
/**
* Get a struct wlr_session_lock_surface_v1 from a struct wlr_surface.
* Asserts that the surface has the session lock surface role.
* May return NULL even if the surface has the session lock surface role if the
* corresponding session lock surface has been destroyed.
*/
struct wlr_session_lock_surface_v1 *wlr_session_lock_surface_v1_from_wlr_surface(
struct wlr_surface *surface);

View file

@ -0,0 +1,19 @@
/*
* 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_SINGLE_PIXEL_BUFFER_V1
#define WLR_TYPES_WLR_SINGLE_PIXEL_BUFFER_V1
#include <wayland-server-core.h>
struct wlr_single_pixel_buffer_manager_v1;
struct wlr_single_pixel_buffer_manager_v1 *wlr_single_pixel_buffer_manager_v1_create(
struct wl_display *display);
#endif

View file

@ -63,11 +63,16 @@ struct wlr_subcompositor {
} events;
};
/**
* Returns true if the surface has the subsurface role.
*/
bool wlr_surface_is_subsurface(struct wlr_surface *surface);
/**
* Get a subsurface from a surface. Can return NULL if the subsurface has been
* destroyed.
* Get a struct wlr_subsurface from a struct wlr_surface.
* Asserts that the surface has the subsurface role.
* May return NULL even if the surface has the subsurface role if the
* corresponding subsurface has been destroyed.
*/
struct wlr_subsurface *wlr_subsurface_from_wlr_surface(
struct wlr_surface *surface);

View file

@ -28,21 +28,27 @@ struct wlr_switch {
};
enum wlr_switch_type {
WLR_SWITCH_TYPE_LID = 1,
WLR_SWITCH_TYPE_LID,
WLR_SWITCH_TYPE_TABLET_MODE,
};
enum wlr_switch_state {
WLR_SWITCH_STATE_OFF = 0,
WLR_SWITCH_STATE_ON,
WLR_SWITCH_STATE_TOGGLE
};
struct wlr_event_switch_toggle {
struct wlr_input_device *device;
struct wlr_switch_toggle_event {
uint32_t time_msec;
enum wlr_switch_type switch_type;
enum wlr_switch_state switch_state;
};
/**
* Get a struct wlr_switch from a struct wlr_input_device.
*
* Asserts that the input device is a switch.
*/
struct wlr_switch *wlr_switch_from_input_device(
struct wlr_input_device *input_device);
#endif

View file

@ -30,14 +30,14 @@ struct wlr_tablet_pad {
struct wl_signal button;
struct wl_signal ring;
struct wl_signal strip;
struct wl_signal attach_tablet; //struct wlr_tablet_tool
struct wl_signal attach_tablet; // struct wlr_tablet_tool
} events;
size_t button_count;
size_t ring_count;
size_t strip_count;
struct wl_list groups; // wlr_tablet_pad_group::link
struct wl_list groups; // wlr_tablet_pad_group.link
struct wl_array paths; // char *
void *data;
@ -58,7 +58,7 @@ struct wlr_tablet_pad_group {
unsigned int mode_count;
};
struct wlr_event_tablet_pad_button {
struct wlr_tablet_pad_button_event {
uint32_t time_msec;
uint32_t button;
enum wlr_button_state state;
@ -71,7 +71,7 @@ enum wlr_tablet_pad_ring_source {
WLR_TABLET_PAD_RING_SOURCE_FINGER,
};
struct wlr_event_tablet_pad_ring {
struct wlr_tablet_pad_ring_event {
uint32_t time_msec;
enum wlr_tablet_pad_ring_source source;
uint32_t ring;
@ -84,7 +84,7 @@ enum wlr_tablet_pad_strip_source {
WLR_TABLET_PAD_STRIP_SOURCE_FINGER,
};
struct wlr_event_tablet_pad_strip {
struct wlr_tablet_pad_strip_event {
uint32_t time_msec;
enum wlr_tablet_pad_strip_source source;
uint32_t strip;
@ -92,4 +92,12 @@ struct wlr_event_tablet_pad_strip {
unsigned int mode;
};
/**
* Get a struct wlr_tablet_pad from a struct wlr_input_device.
*
* Asserts that the input device is a tablet pad.
*/
struct wlr_tablet_pad *wlr_tablet_pad_from_input_device(
struct wlr_input_device *);
#endif

View file

@ -64,6 +64,8 @@ struct wlr_tablet {
const struct wlr_tablet_impl *impl;
double width_mm, height_mm;
struct {
struct wl_signal axis;
struct wl_signal proximity;
@ -71,7 +73,6 @@ struct wlr_tablet {
struct wl_signal button;
} events;
char *name;
struct wl_array paths; // char *
void *data;
@ -89,8 +90,8 @@ enum wlr_tablet_tool_axes {
WLR_TABLET_TOOL_AXIS_WHEEL = 1 << 8,
};
struct wlr_event_tablet_tool_axis {
struct wlr_input_device *device;
struct wlr_tablet_tool_axis_event {
struct wlr_tablet *tablet;
struct wlr_tablet_tool *tool;
uint32_t time_msec;
@ -112,8 +113,8 @@ enum wlr_tablet_tool_proximity_state {
WLR_TABLET_TOOL_PROXIMITY_IN,
};
struct wlr_event_tablet_tool_proximity {
struct wlr_input_device *device;
struct wlr_tablet_tool_proximity_event {
struct wlr_tablet *tablet;
struct wlr_tablet_tool *tool;
uint32_t time_msec;
// From 0..1
@ -122,12 +123,12 @@ struct wlr_event_tablet_tool_proximity {
};
enum wlr_tablet_tool_tip_state {
WLR_TABLET_TOOL_TIP_UP,
WLR_TABLET_TOOL_TIP_DOWN,
WLR_TABLET_TOOL_TIP_UP = 1 << 0,
WLR_TABLET_TOOL_TIP_DOWN = 1 << 1,
};
struct wlr_event_tablet_tool_tip {
struct wlr_input_device *device;
struct wlr_tablet_tool_tip_event {
struct wlr_tablet *tablet;
struct wlr_tablet_tool *tool;
uint32_t time_msec;
// From 0..1
@ -135,12 +136,20 @@ struct wlr_event_tablet_tool_tip {
enum wlr_tablet_tool_tip_state state;
};
struct wlr_event_tablet_tool_button {
struct wlr_input_device *device;
struct wlr_tablet_tool_button_event {
struct wlr_tablet *tablet;
struct wlr_tablet_tool *tool;
uint32_t time_msec;
uint32_t button;
enum wlr_button_state state;
};
/**
* Get a struct wlr_tablet from a struct wlr_input_device.
*
* Asserts that the input device is a tablet tool.
*/
struct wlr_tablet *wlr_tablet_from_input_device(
struct wlr_input_device *input_device);
#endif

View file

@ -11,13 +11,14 @@
#include <wayland-server-core.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_input_device.h>
#include "tablet-unstable-v2-protocol.h"
/* This can probably be even lower,the tools don't have a lot of buttons */
#define WLR_TABLET_V2_TOOL_BUTTONS_CAP 16
struct wlr_input_device;
struct wlr_tablet_pad_v2_grab_interface;
struct wlr_tablet_pad_v2_grab {
@ -40,8 +41,8 @@ struct wlr_tablet_pad_client_v2;
struct wlr_tablet_manager_v2 {
struct wl_global *wl_global;
struct wl_list clients; // wlr_tablet_manager_client_v2::link
struct wl_list seats; // wlr_tablet_seat_v2::link
struct wl_list clients; // wlr_tablet_manager_client_v2.link
struct wl_list seats; // wlr_tablet_seat_v2.link
struct wl_listener display_destroy;
@ -53,10 +54,10 @@ struct wlr_tablet_manager_v2 {
};
struct wlr_tablet_v2_tablet {
struct wl_list link; // wlr_tablet_seat_v2::tablets
struct wl_list link; // wlr_tablet_seat_v2.tablets
struct wlr_tablet *wlr_tablet;
struct wlr_input_device *wlr_device;
struct wl_list clients; // wlr_tablet_client_v2::tablet_link
struct wl_list clients; // wlr_tablet_client_v2.tablet_link
struct wl_listener tool_destroy;
@ -64,9 +65,9 @@ struct wlr_tablet_v2_tablet {
};
struct wlr_tablet_v2_tablet_tool {
struct wl_list link; // wlr_tablet_seat_v2::tablets
struct wl_list link; // wlr_tablet_seat_v2.tablets
struct wlr_tablet_tool *wlr_tool;
struct wl_list clients; // wlr_tablet_tool_client_v2::tool_link
struct wl_list clients; // wlr_tablet_tool_client_v2.tool_link
struct wl_listener tool_destroy;
@ -90,10 +91,10 @@ struct wlr_tablet_v2_tablet_tool {
};
struct wlr_tablet_v2_tablet_pad {
struct wl_list link; // wlr_tablet_seat_v2::pads
struct wl_list link; // wlr_tablet_seat_v2.pads
struct wlr_tablet_pad *wlr_pad;
struct wlr_input_device *wlr_device;
struct wl_list clients; // wlr_tablet_pad_client_v2::pad_link
struct wl_list clients; // wlr_tablet_pad_client_v2.pad_link
size_t group_count;
uint32_t *groups;

View file

@ -39,7 +39,7 @@ struct wlr_text_input_v3_state {
// Tracks which features were used in the current commit.
// Useful in the enabling commit, where usage means support.
uint32_t features; // OR'ed wlr_text_input_v3_features
uint32_t features; // bitfield of enum wlr_text_input_v3_features
};
struct wlr_text_input_v3 {
@ -52,7 +52,7 @@ struct wlr_text_input_v3 {
bool pending_enabled;
bool current_enabled;
// supported in the current text input, more granular than surface
uint32_t active_features; // OR'ed wlr_text_input_v3_features
uint32_t active_features; // bitfield of enum wlr_text_input_v3_features
struct wl_list link;
@ -60,22 +60,22 @@ struct wlr_text_input_v3 {
struct wl_listener seat_destroy;
struct {
struct wl_signal enable; // (struct wlr_text_input_v3*)
struct wl_signal commit; // (struct wlr_text_input_v3*)
struct wl_signal disable; // (struct wlr_text_input_v3*)
struct wl_signal destroy; // (struct wlr_text_input_v3*)
struct wl_signal enable; // struct wlr_text_input_v3 *
struct wl_signal commit; // struct wlr_text_input_v3 *
struct wl_signal disable; // struct wlr_text_input_v3 *
struct wl_signal destroy; // struct wlr_text_input_v3 *
} events;
};
struct wlr_text_input_manager_v3 {
struct wl_global *global;
struct wl_list text_inputs; // struct wlr_text_input_v3::resource::link
struct wl_list text_inputs; // struct wlr_text_input_v3.resource.link
struct wl_listener display_destroy;
struct {
struct wl_signal text_input; // (struct wlr_text_input_v3*)
struct wl_signal destroy; // (struct wlr_input_method_manager_v3*)
struct wl_signal text_input; // struct wlr_text_input_v3 *
struct wl_signal destroy; // struct wlr_input_method_manager_v3 *
} events;
};

View file

@ -20,43 +20,54 @@ struct wlr_touch {
const struct wlr_touch_impl *impl;
char *output_name;
double width_mm, height_mm;
struct {
struct wl_signal down; // struct wlr_event_touch_down
struct wl_signal up; // struct wlr_event_touch_up
struct wl_signal motion; // struct wlr_event_touch_motion
struct wl_signal cancel; // struct wlr_event_touch_cancel
struct wl_signal down; // struct wlr_touch_down_event
struct wl_signal up; // struct wlr_touch_up_event
struct wl_signal motion; // struct wlr_touch_motion_event
struct wl_signal cancel; // struct wlr_touch_cancel_event
struct wl_signal frame;
} events;
void *data;
};
struct wlr_event_touch_down {
struct wlr_input_device *device;
struct wlr_touch_down_event {
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
// From 0..1
double x, y;
};
struct wlr_event_touch_up {
struct wlr_input_device *device;
struct wlr_touch_up_event {
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
};
struct wlr_event_touch_motion {
struct wlr_input_device *device;
struct wlr_touch_motion_event {
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
// From 0..1
double x, y;
};
struct wlr_event_touch_cancel {
struct wlr_input_device *device;
struct wlr_touch_cancel_event {
struct wlr_touch *touch;
uint32_t time_msec;
int32_t touch_id;
};
/**
* Get a struct wlr_touch from a struct wlr_input_device.
*
* Asserts that the input device is a touch device.
*/
struct wlr_touch *wlr_touch_from_input_device(
struct wlr_input_device *input_device);
#endif

View file

@ -18,9 +18,9 @@
*
* - The size of the surface texture may not match the surface size anymore.
* Compositors must use the surface size only.
* - Compositors must call wlr_render_subtexture_with_matrix when rendering a
* - Compositors must call wlr_render_subtexture_with_matrix() when rendering a
* surface texture with the source box returned by
* wlr_surface_get_buffer_source_box.
* wlr_surface_get_buffer_source_box().
*/
struct wlr_viewporter {
struct wl_global *global;

View file

@ -14,12 +14,12 @@
struct wlr_virtual_keyboard_manager_v1 {
struct wl_global *global;
struct wl_list virtual_keyboards; // struct wlr_virtual_keyboard_v1*
struct wl_list virtual_keyboards; // wlr_virtual_keyboard_v1.link
struct wl_listener display_destroy;
struct {
struct wl_signal new_virtual_keyboard; // struct wlr_virtual_keyboard_v1*
struct wl_signal new_virtual_keyboard; // struct wlr_virtual_keyboard_v1 *
struct wl_signal destroy;
} events;
};
@ -30,11 +30,7 @@ struct wlr_virtual_keyboard_v1 {
struct wlr_seat *seat;
bool has_keymap;
struct wl_list link;
struct {
struct wl_signal destroy; // struct wlr_virtual_keyboard_v1*
} events;
struct wl_list link; // wlr_virtual_keyboard_manager_v1.virtual_keyboards
};
struct wlr_virtual_keyboard_manager_v1* wlr_virtual_keyboard_manager_v1_create(

View file

@ -16,12 +16,12 @@
struct wlr_virtual_pointer_manager_v1 {
struct wl_global *global;
struct wl_list virtual_pointers; // struct wlr_virtual_pointer_v1*
struct wl_list virtual_pointers; // wlr_virtual_pointer_v1.link
struct wl_listener display_destroy;
struct {
struct wl_signal new_virtual_pointer; // struct wlr_virtual_pointer_v1_new_pointer_event*
struct wl_signal new_virtual_pointer; // struct wlr_virtual_pointer_v1_new_pointer_event *
struct wl_signal destroy;
} events;
};
@ -30,15 +30,11 @@ struct wlr_virtual_pointer_v1 {
struct wlr_pointer pointer;
struct wl_resource *resource;
/* Vertical and horizontal */
struct wlr_event_pointer_axis axis_event[2];
struct wlr_pointer_axis_event axis_event[2];
enum wl_pointer_axis axis;
bool axis_valid[2];
struct wl_list link;
struct {
struct wl_signal destroy; // struct wlr_virtual_pointer_v1*
} events;
struct wl_list link; // wlr_virtual_pointer_manager_v1.virtual_pointers
};
struct wlr_virtual_pointer_v1_new_pointer_event {

View file

@ -23,9 +23,9 @@ struct wlr_xcursor_manager_theme {
};
/**
* wlr_xcursor_manager dynamically loads xcursor themes at sizes necessary for
* use on outputs at arbitrary scale factors. You should call
* wlr_xcursor_manager_load for each output you will show your cursor on, with
* struct wlr_xcursor_manager dynamically loads xcursor themes at sizes necessary
* for use on outputs at arbitrary scale factors. You should call
* wlr_xcursor_manager_load() for each output you will show your cursor on, with
* the scale factor parameter set to that output's scale factor.
*/
struct wlr_xcursor_manager {
@ -51,17 +51,17 @@ bool wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager,
/**
* Retrieves a wlr_xcursor reference for the given cursor name at the given
* scale factor, or NULL if this wlr_xcursor_manager has not loaded a cursor
* theme at the requested scale.
* scale factor, or NULL if this struct wlr_xcursor_manager has not loaded a
* cursor theme at the requested scale.
*/
struct wlr_xcursor *wlr_xcursor_manager_get_xcursor(
struct wlr_xcursor_manager *manager, const char *name, float scale);
/**
* Set a wlr_cursor's cursor image to the specified cursor name for all scale
* factors. wlr_cursor will take over from this point and ensure the correct
* cursor is used on each output, assuming a wlr_output_layout is attached to
* it.
* Set a struct wlr_cursor's cursor image to the specified cursor name for all
* scale factors. struct wlr_cursor will take over from this point and ensure
* the correct cursor is used on each output, assuming a
* struct wlr_output_layout is attached to it.
*/
void wlr_xcursor_manager_set_cursor_image(struct wlr_xcursor_manager *manager,
const char *name, struct wlr_cursor *cursor);

View file

@ -45,7 +45,7 @@ struct wlr_xdg_activation_v1 {
struct {
struct wl_signal destroy;
struct wl_signal request_activate; // wlr_xdg_activation_v1_request_activate_event
struct wl_signal request_activate; // struct wlr_xdg_activation_v1_request_activate_event
} events;
// private state

View file

@ -12,7 +12,7 @@ enum wlr_xdg_toplevel_decoration_v1_mode {
struct wlr_xdg_decoration_manager_v1 {
struct wl_global *global;
struct wl_list decorations; // wlr_xdg_toplevel_decoration::link
struct wl_list decorations; // wlr_xdg_toplevel_decoration.link
struct wl_listener display_destroy;
@ -25,7 +25,7 @@ struct wlr_xdg_decoration_manager_v1 {
};
struct wlr_xdg_toplevel_decoration_v1_configure {
struct wl_list link; // wlr_xdg_toplevel_decoration::configure_list
struct wl_list link; // wlr_xdg_toplevel_decoration.configure_list
struct wlr_xdg_surface_configure *surface_configure;
enum wlr_xdg_toplevel_decoration_v1_mode mode;
};
@ -38,7 +38,7 @@ struct wlr_xdg_toplevel_decoration_v1 {
struct wl_resource *resource;
struct wlr_xdg_surface *surface;
struct wlr_xdg_decoration_manager_v1 *manager;
struct wl_list link; // wlr_xdg_decoration_manager_v1::link
struct wl_list link; // wlr_xdg_decoration_manager_v1.link
struct wlr_xdg_toplevel_decoration_v1_state current, pending;
@ -47,7 +47,7 @@ struct wlr_xdg_toplevel_decoration_v1 {
bool added;
struct wl_list configure_list; // wlr_xdg_toplevel_decoration_v1_configure::link
struct wl_list configure_list; // wlr_xdg_toplevel_decoration_v1_configure.link
struct {
struct wl_signal destroy;

View file

@ -14,8 +14,8 @@
#define WLR_XDG_FOREIGN_HANDLE_SIZE 37
/**
* wlr_xdg_foreign_registry is used for storing a list of exported surfaces with
* the xdg-foreign family of protocols.
* struct wlr_xdg_foreign_registry is used for storing a list of exported
* surfaces with the xdg-foreign family of protocols.
*
* It can be used to allow interoperability between clients using different
* versions of the protocol (if all versions use the same registry).
@ -30,7 +30,7 @@ struct wlr_xdg_foreign_registry {
};
struct wlr_xdg_foreign_exported {
struct wl_list link; // wlr_xdg_foreign_registry::exported_surfaces
struct wl_list link; // wlr_xdg_foreign_registry.exported_surfaces
struct wlr_xdg_foreign_registry *registry;
struct wlr_surface *surface;
@ -43,7 +43,7 @@ struct wlr_xdg_foreign_exported {
};
/**
* Create an empty wlr_xdg_foreign_registry.
* Create an empty struct wlr_xdg_foreign_registry.
*
* It will be destroyed when the associated display is destroyed.
*/

View file

@ -15,7 +15,7 @@
struct wlr_xdg_foreign_v1 {
struct {
struct wl_global *global;
struct wl_list objects; // wlr_xdg_exported_v1::link or wlr_xdg_imported_v1::link
struct wl_list objects; // wlr_xdg_exported_v1.link or wlr_xdg_imported_v1.link
} exporter, importer;
struct wl_listener foreign_registry_destroy;
@ -34,9 +34,9 @@ struct wlr_xdg_exported_v1 {
struct wlr_xdg_foreign_exported base;
struct wl_resource *resource;
struct wl_listener xdg_surface_destroy;
struct wl_listener xdg_surface_unmap;
struct wl_list link; // wlr_xdg_foreign_v1::exporter::objects
struct wl_list link; // wlr_xdg_foreign_v1.exporter.objects
};
struct wlr_xdg_imported_v1 {
@ -44,7 +44,7 @@ struct wlr_xdg_imported_v1 {
struct wl_listener exported_destroyed;
struct wl_resource *resource;
struct wl_list link; // wlr_xdg_foreign_v1::importer::objects
struct wl_list link; // wlr_xdg_foreign_v1.importer.objects
struct wl_list children;
};
@ -52,7 +52,7 @@ struct wlr_xdg_imported_child_v1 {
struct wlr_xdg_imported_v1 *imported;
struct wlr_surface *surface;
struct wl_list link; // wlr_xdg_imported_v1::children
struct wl_list link; // wlr_xdg_imported_v1.children
struct wl_listener xdg_surface_unmap;
struct wl_listener xdg_toplevel_set_parent;

View file

@ -15,7 +15,7 @@
struct wlr_xdg_foreign_v2 {
struct {
struct wl_global *global;
struct wl_list objects; // wlr_xdg_exported_v2::link or wlr_xdg_imported_v2::link
struct wl_list objects; // wlr_xdg_exported_v2.link or wlr_xdg_imported_v2.link
} exporter, importer;
struct wl_listener foreign_registry_destroy;
@ -34,9 +34,9 @@ struct wlr_xdg_exported_v2 {
struct wlr_xdg_foreign_exported base;
struct wl_resource *resource;
struct wl_listener xdg_surface_destroy;
struct wl_listener xdg_surface_unmap;
struct wl_list link; // wlr_xdg_foreign_v2::exporter::objects
struct wl_list link; // wlr_xdg_foreign_v2.exporter.objects
};
struct wlr_xdg_imported_v2 {
@ -44,7 +44,7 @@ struct wlr_xdg_imported_v2 {
struct wl_listener exported_destroyed;
struct wl_resource *resource;
struct wl_list link; // wlr_xdg_foreign_v2::importer::objects
struct wl_list link; // wlr_xdg_foreign_v2.importer.objects
struct wl_list children;
};
@ -52,7 +52,7 @@ struct wlr_xdg_imported_child_v2 {
struct wlr_xdg_imported_v2 *imported;
struct wlr_surface *surface;
struct wl_list link; // wlr_xdg_imported_v2::children
struct wl_list link; // wlr_xdg_imported_v2.children
struct wl_listener xdg_surface_unmap;
struct wl_listener xdg_toplevel_set_parent;

View file

@ -17,6 +17,7 @@
struct wlr_xdg_shell {
struct wl_global *global;
uint32_t version;
struct wl_list clients;
struct wl_list popup_grabs;
uint32_t ping_timeout;
@ -43,7 +44,7 @@ struct wlr_xdg_client {
struct wl_client *client;
struct wl_list surfaces;
struct wl_list link; // wlr_xdg_shell::clients
struct wl_list link; // wlr_xdg_shell.clients
uint32_t ping_serial;
struct wl_event_source *ping_timer;
@ -55,9 +56,14 @@ struct wlr_xdg_positioner_rules {
enum xdg_positioner_gravity gravity;
enum xdg_positioner_constraint_adjustment constraint_adjustment;
bool reactive;
bool has_parent_configure_serial;
uint32_t parent_configure_serial;
struct {
int32_t width, height;
} size;
} size, parent_size;
struct {
int32_t x, y;
@ -69,6 +75,25 @@ struct wlr_xdg_positioner {
struct wlr_xdg_positioner_rules rules;
};
struct wlr_xdg_popup_state {
// Position of the popup relative to the upper left corner of
// the window geometry of the parent surface
struct wlr_box geometry;
bool reactive;
};
enum wlr_xdg_popup_configure_field {
WLR_XDG_POPUP_CONFIGURE_REPOSITION_TOKEN = 1 << 0,
};
struct wlr_xdg_popup_configure {
uint32_t fields; // enum wlr_xdg_popup_configure_field
struct wlr_box geometry;
struct wlr_xdg_positioner_rules rules;
uint32_t reposition_token;
};
struct wlr_xdg_popup {
struct wlr_xdg_surface *base;
struct wl_list link;
@ -78,13 +103,15 @@ struct wlr_xdg_popup {
struct wlr_surface *parent;
struct wlr_seat *seat;
// Position of the popup relative to the upper left corner of the window
// geometry of the parent surface
struct wlr_box geometry;
struct wlr_xdg_popup_configure scheduled;
struct wlr_xdg_positioner_rules positioner_rules;
struct wlr_xdg_popup_state current, pending;
struct wl_list grab_link; // wlr_xdg_popup_grab::popups
struct {
struct wl_signal reposition;
} events;
struct wl_list grab_link; // wlr_xdg_popup_grab.popups
};
// each seat gets a popup grab
@ -95,7 +122,7 @@ struct wlr_xdg_popup_grab {
struct wlr_seat_touch_grab touch_grab;
struct wlr_seat *seat;
struct wl_list popups;
struct wl_list link; // wlr_xdg_shell::popup_grabs
struct wl_list link; // wlr_xdg_shell.popup_grabs
struct wl_listener seat_destroy;
};
@ -113,10 +140,27 @@ struct wlr_xdg_toplevel_state {
uint32_t min_width, min_height;
};
enum wlr_xdg_toplevel_wm_capabilities {
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU = 1 << 0,
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE = 1 << 1,
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 1 << 2,
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE = 1 << 3,
};
enum wlr_xdg_toplevel_configure_field {
WLR_XDG_TOPLEVEL_CONFIGURE_BOUNDS = 1 << 0,
WLR_XDG_TOPLEVEL_CONFIGURE_WM_CAPABILITIES = 1 << 1,
};
struct wlr_xdg_toplevel_configure {
uint32_t fields; // enum wlr_xdg_toplevel_configure_field
bool maximized, fullscreen, resizing, activated;
uint32_t tiled; // enum wlr_edges
uint32_t width, height;
struct {
uint32_t width, height;
} bounds;
uint32_t wm_capabilities; // enum wlr_xdg_toplevel_wm_capabilities
};
struct wlr_xdg_toplevel_requested {
@ -140,15 +184,23 @@ struct wlr_xdg_toplevel {
// Properties that the client has requested. Intended to be checked
// by the compositor on surface map and state change requests (such as
// xdg_toplevel::set_fullscreen) and handled accordingly.
// xdg_toplevel.set_fullscreen) and handled accordingly.
struct wlr_xdg_toplevel_requested requested;
char *title;
char *app_id;
struct {
// Note: as per xdg-shell protocol, the compositor has to
// handle state requests by sending a configure event,
// even if it didn't actually change the state. Therefore,
// every compositor implementing xdg-shell support *must*
// listen to these signals and schedule a configure event
// immediately or at some time in the future; not doing so
// is a protocol violation.
struct wl_signal request_maximize;
struct wl_signal request_fullscreen;
struct wl_signal request_minimize;
struct wl_signal request_move;
struct wl_signal request_resize;
@ -161,10 +213,13 @@ struct wlr_xdg_toplevel {
struct wlr_xdg_surface_configure {
struct wlr_xdg_surface *surface;
struct wl_list link; // wlr_xdg_surface::configure_list
struct wl_list link; // wlr_xdg_surface.configure_list
uint32_t serial;
struct wlr_xdg_toplevel_configure *toplevel_configure;
union {
struct wlr_xdg_toplevel_configure *toplevel_configure;
struct wlr_xdg_popup_configure *popup_configure;
};
};
struct wlr_xdg_surface_state {
@ -186,7 +241,7 @@ struct wlr_xdg_surface {
struct wlr_xdg_client *client;
struct wl_resource *resource;
struct wlr_surface *surface;
struct wl_list link; // wlr_xdg_client::surfaces
struct wl_list link; // wlr_xdg_client.surfaces
enum wlr_xdg_surface_role role;
union {
@ -194,7 +249,7 @@ struct wlr_xdg_surface {
struct wlr_xdg_popup *popup;
};
struct wl_list popups; // wlr_xdg_popup::link
struct wl_list popups; // wlr_xdg_popup.link
bool added, configured, mapped;
struct wl_event_source *configure_idle;
@ -228,8 +283,8 @@ struct wlr_xdg_surface {
struct wl_signal unmap;
// for protocol extensions
struct wl_signal configure; // wlr_xdg_surface_configure
struct wl_signal ack_configure; // wlr_xdg_surface_configure
struct wl_signal configure; // struct wlr_xdg_surface_configure
struct wl_signal ack_configure; // struct wlr_xdg_surface_configure
} events;
void *data;
@ -255,9 +310,13 @@ struct wlr_xdg_toplevel_show_window_menu_event {
uint32_t x, y;
};
struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display);
/**
* Create the xdg_wm_base global with the specified version.
*/
struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display,
uint32_t version);
/** Get the corresponding wlr_xdg_surface from a resource.
/** Get the corresponding struct wlr_xdg_surface from a resource.
*
* Aborts if the resource doesn't have the correct type. Returns NULL if the
* resource is inert.
@ -265,7 +324,7 @@ struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display);
struct wlr_xdg_surface *wlr_xdg_surface_from_resource(
struct wl_resource *resource);
/** Get the corresponding wlr_xdg_popup from a resource.
/** Get the corresponding struct wlr_xdg_popup from a resource.
*
* Aborts if the resource doesn't have the correct type. Returns NULL if the
* resource is inert.
@ -273,7 +332,7 @@ struct wlr_xdg_surface *wlr_xdg_surface_from_resource(
struct wlr_xdg_popup *wlr_xdg_popup_from_resource(
struct wl_resource *resource);
/** Get the corresponding wlr_xdg_toplevel from a resource.
/** Get the corresponding struct wlr_xdg_toplevel from a resource.
*
* Aborts if the resource doesn't have the correct type. Returns NULL if the
* resource is inert.
@ -281,7 +340,7 @@ struct wlr_xdg_popup *wlr_xdg_popup_from_resource(
struct wlr_xdg_toplevel *wlr_xdg_toplevel_from_resource(
struct wl_resource *resource);
/** Get the corresponding wlr_xdg_positioner from a resource.
/** Get the corresponding struct wlr_xdg_positioner from a resource.
*
* Aborts if the resource doesn't have the correct type.
*/
@ -332,11 +391,26 @@ uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_toplevel *toplevel,
/**
* Request that this toplevel consider itself in a tiled layout and some
* edges are adjacent to another part of the tiling grid. `tiled_edges` is a
* bitfield of `enum wlr_edges`. Returns the associated configure serial.
* bitfield of enum wlr_edges. Returns the associated configure serial.
*/
uint32_t wlr_xdg_toplevel_set_tiled(struct wlr_xdg_toplevel *toplevel,
uint32_t tiled_edges);
/**
* Configure the recommended bounds for the client's window geometry size.
* Returns the associated configure serial.
*/
uint32_t wlr_xdg_toplevel_set_bounds(struct wlr_xdg_toplevel *toplevel,
int32_t width, int32_t height);
/**
* Configure the window manager capabilities for this toplevel. `caps` is a
* bitfield of `enum wlr_xdg_toplevel_wm_capabilities`. Returns the associated
* configure serial.
*/
uint32_t wlr_xdg_toplevel_set_wm_capabilities(struct wlr_xdg_toplevel *toplevel,
uint32_t caps);
/**
* Request that this toplevel closes.
*/
@ -405,17 +479,27 @@ struct wlr_surface *wlr_xdg_surface_popup_surface_at(
struct wlr_xdg_surface *surface, double sx, double sy,
double *sub_x, double *sub_y);
/**
* Returns true if the surface has the xdg surface role.
*/
bool wlr_surface_is_xdg_surface(struct wlr_surface *surface);
/**
* Get a struct wlr_xdg_surface from a struct wlr_surface.
* Asserts that the surface has the xdg surface role.
* May return NULL even if the surface has the xdg surface role if the
* corresponding xdg surface has been destroyed.
*/
struct wlr_xdg_surface *wlr_xdg_surface_from_wlr_surface(
struct wlr_surface *surface);
/**
* Get the surface geometry.
*
* This is either the geometry as set by the client, or defaulted to the bounds
* of the surface + the subsurfaces (as specified by the protocol).
*
* The x and y value can be <0
* The x and y value can be < 0.
*/
void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface,
struct wlr_box *box);

View file

@ -20,6 +20,7 @@ struct wlr_addon;
struct wlr_addon_interface {
const char *name;
// Has to call wlr_addon_finish()
void (*destroy)(struct wlr_addon *addon);
};
@ -34,10 +35,10 @@ void wlr_addon_set_init(struct wlr_addon_set *set);
void wlr_addon_set_finish(struct wlr_addon_set *set);
void wlr_addon_init(struct wlr_addon *addon, struct wlr_addon_set *set,
const void *owner, const struct wlr_addon_interface *impl);
const void *owner, const struct wlr_addon_interface *impl);
void wlr_addon_finish(struct wlr_addon *addon);
struct wlr_addon *wlr_addon_find(struct wlr_addon_set *set, const void *owner,
const struct wlr_addon_interface *impl);
const struct wlr_addon_interface *impl);
#endif

View file

@ -23,7 +23,7 @@
*
* The x and y coordinates are inclusive, and the width and height lengths are
* exclusive. In other words, the box starts from the coordinates (x, y), and
* goes up to but not including (x + width, y + height)
* goes up to but not including (x + width, y + height).
*/
struct wlr_box {
int x, y;
@ -33,7 +33,7 @@ struct wlr_box {
/**
* A floating-point box representing a rectangle region in a 2D space.
*
* wlr_fbox has the same semantics as wlr_box
* struct wlr_fbox has the same semantics as struct wlr_box.
*/
struct wlr_fbox {
double x, y;
@ -41,34 +41,35 @@ struct wlr_fbox {
};
/**
* Finds the closest point within the box bounds
* Finds the closest point within the box bounds.
*
* Returns NAN if the box is empty
* Returns NAN if the box is empty.
*/
void wlr_box_closest_point(const struct wlr_box *box, double x, double y,
double *dest_x, double *dest_y);
/**
* Gives the intersecting box between two wlr_box.
* Gives the intersecting box between two struct wlr_box.
*
* Returns an empty wlr_box if the provided wlr_box don't intersect.
* Returns an empty box if the provided boxes don't intersect.
*/
bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a,
const struct wlr_box *box_b);
/**
* Verifies if a point is contained within the bounds of a given wlr_box.
* Verifies if a point is contained within the bounds of a given struct wlr_box.
*
* For example:
* - A point at (100, 50) is not contained in the box (0, 0, 100, 50).
* - A point at (10, 10) is contained in the box (10, 0, 50, 50).
*
* - A point at (100, 50) is not contained in the box (0, 0, 100, 50).
* - A point at (10, 10) is contained in the box (10, 0, 50, 50).
*/
bool wlr_box_contains_point(const struct wlr_box *box, double x, double y);
/**
* Checks whether a box is empty or not.
*
* A wlr_box is considered empty if its width and/or height is zero or negative.
* A box is considered empty if its width and/or height is zero or negative.
*/
bool wlr_box_empty(const struct wlr_box *box);
@ -81,7 +82,7 @@ void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box,
/**
* Checks whether a box is empty or not.
*
* A wlr_box is considered empty if its width and/or height is zero or negative.
* A box is considered empty if its width and/or height is zero or negative.
*/
bool wlr_fbox_empty(const struct wlr_fbox *box);
@ -91,4 +92,18 @@ bool wlr_fbox_empty(const struct wlr_fbox *box);
void wlr_fbox_transform(struct wlr_fbox *dest, const struct wlr_fbox *box,
enum wl_output_transform transform, double width, double height);
#ifdef WLR_USE_UNSTABLE
/**
* Returns true if the two boxes are equal, false otherwise.
*/
bool wlr_box_equal(const struct wlr_box *a, const struct wlr_box *b);
/**
* Returns true if the two boxes are equal, false otherwise.
*/
bool wlr_fbox_equal(const struct wlr_fbox *a, const struct wlr_fbox *b);
#endif
#endif

Some files were not shown because too many files have changed in this diff Show more