diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/rootston/desktop.h | 2 | ||||
-rw-r--r-- | include/wlr/render/interface.h | 2 | ||||
-rw-r--r-- | include/wlr/render/wlr_renderer.h | 9 | ||||
-rw-r--r-- | include/wlr/types/wlr_compositor.h | 5 | ||||
-rw-r--r-- | include/wlr/types/wlr_idle.h | 9 | ||||
-rw-r--r-- | include/wlr/types/wlr_idle_inhibit_v1.h | 4 | ||||
-rw-r--r-- | include/wlr/types/wlr_screencopy_v1.h | 39 | ||||
-rw-r--r-- | include/wlr/types/wlr_surface.h | 114 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_shell.h | 14 | ||||
-rw-r--r-- | include/wlr/types/wlr_xdg_shell_v6.h | 14 |
10 files changed, 158 insertions, 54 deletions
diff --git a/include/rootston/desktop.h b/include/rootston/desktop.h index dfe070ca..88c5ca90 100644 --- a/include/rootston/desktop.h +++ b/include/rootston/desktop.h @@ -22,6 +22,7 @@ #include <wlr/types/wlr_list.h> #include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_idle_inhibit_v1.h> +#include <wlr/types/wlr_screencopy_v1.h> #include "rootston/view.h" #include "rootston/config.h" #include "rootston/output.h" @@ -54,6 +55,7 @@ struct roots_desktop { struct wlr_linux_dmabuf *linux_dmabuf; struct wlr_layer_shell *layer_shell; struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard; + struct wlr_screencopy_manager_v1 *screencopy; struct wl_listener new_output; struct wl_listener layout_change; diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h index fb427c89..1b138ea3 100644 --- a/include/wlr/render/interface.h +++ b/include/wlr/render/interface.h @@ -34,7 +34,7 @@ struct wlr_renderer_impl { int (*get_dmabuf_modifiers)(struct wlr_renderer *renderer, int format, uint64_t **modifiers); bool (*read_pixels)(struct wlr_renderer *renderer, enum wl_shm_format fmt, - uint32_t stride, uint32_t width, uint32_t height, + uint32_t *flags, 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, void *data); bool (*format_supported)(struct wlr_renderer *renderer, diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h index c715e4b0..0650bf1b 100644 --- a/include/wlr/render/wlr_renderer.h +++ b/include/wlr/render/wlr_renderer.h @@ -7,6 +7,10 @@ #include <wlr/render/wlr_texture.h> #include <wlr/types/wlr_box.h> +enum wlr_renderer_read_pixels_flags { + WLR_RENDERER_READ_PIXELS_Y_INVERT = 1, +}; + struct wlr_renderer_impl; struct wlr_renderer { @@ -87,9 +91,12 @@ int wlr_renderer_get_dmabuf_modifiers(struct wlr_renderer *renderer, int format, /** * Reads out of pixels of the currently bound surface into data. `stride` is in * bytes. + * + * If `flags` is not NULl, the caller indicates that it accepts frame flags + * defined in `enum wlr_renderer_read_pixels_flags`. */ bool wlr_renderer_read_pixels(struct wlr_renderer *r, enum wl_shm_format fmt, - uint32_t stride, uint32_t width, uint32_t height, + uint32_t *flags, 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, void *data); /** * Checks if a format is supported. diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h index f6be0a74..51702884 100644 --- a/include/wlr/types/wlr_compositor.h +++ b/include/wlr/types/wlr_compositor.h @@ -31,10 +31,11 @@ struct wlr_compositor { void wlr_compositor_destroy(struct wlr_compositor *wlr_compositor); struct wlr_compositor *wlr_compositor_create(struct wl_display *display, - struct wlr_renderer *renderer); + struct wlr_renderer *renderer); bool wlr_surface_is_subsurface(struct wlr_surface *surface); -struct wlr_subsurface *wlr_subsurface_from_surface(struct wlr_surface *surface); +struct wlr_subsurface *wlr_subsurface_from_wlr_surface( + struct wlr_surface *surface); #endif diff --git a/include/wlr/types/wlr_idle.h b/include/wlr/types/wlr_idle.h index 45f350be..aca9146c 100644 --- a/include/wlr/types/wlr_idle.h +++ b/include/wlr/types/wlr_idle.h @@ -17,6 +17,7 @@ struct wlr_idle { struct wl_global *wl_global; struct wl_list idle_timers; // wlr_idle_timeout::link struct wl_event_loop *event_loop; + bool enabled; struct wl_listener display_destroy; struct { @@ -33,6 +34,7 @@ struct wlr_idle_timeout { struct wl_event_source *idle_source; bool idle_state; + bool enabled; uint32_t timeout; // milliseconds struct wl_listener input_listener; @@ -50,4 +52,11 @@ void wlr_idle_destroy(struct wlr_idle *idle); * compositor when there is an user activity event on that seat. */ void wlr_idle_notify_activity(struct wlr_idle *idle, struct wlr_seat *seat); + +/** + * Enable or disable timers for a given idle resource by seat. + * Passing a NULL seat means update timers for all seats. + */ +void wlr_idle_set_enabled(struct wlr_idle *idle, struct wlr_seat *seat, + bool enabled); #endif diff --git a/include/wlr/types/wlr_idle_inhibit_v1.h b/include/wlr/types/wlr_idle_inhibit_v1.h index a777ff43..8c20d2c8 100644 --- a/include/wlr/types/wlr_idle_inhibit_v1.h +++ b/include/wlr/types/wlr_idle_inhibit_v1.h @@ -25,6 +25,8 @@ struct wlr_idle_inhibit_manager_v1 { struct { struct wl_signal new_inhibitor; } events; + + void *data; }; struct wlr_idle_inhibitor_v1 { @@ -37,6 +39,8 @@ struct wlr_idle_inhibitor_v1 { struct { struct wl_signal destroy; } events; + + void *data; }; struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display *display); diff --git a/include/wlr/types/wlr_screencopy_v1.h b/include/wlr/types/wlr_screencopy_v1.h new file mode 100644 index 00000000..892687aa --- /dev/null +++ b/include/wlr/types/wlr_screencopy_v1.h @@ -0,0 +1,39 @@ +#ifndef WLR_TYPES_WLR_SCREENCOPY_V1_H +#define WLR_TYPES_WLR_SCREENCOPY_V1_H + +#include <wayland-server.h> + +struct wlr_screencopy_manager_v1 { + struct wl_global *global; + struct wl_list resources; // wl_resource + struct wl_list frames; // wlr_screencopy_frame_v1::link + + struct wl_listener display_destroy; + + void *data; +}; + +struct wlr_screencopy_frame_v1 { + struct wl_resource *resource; + struct wlr_screencopy_manager_v1 *manager; + struct wl_list link; + + enum wl_shm_format format; + struct wlr_box box; + int stride; + + struct wl_shm_buffer *buffer; + struct wl_listener buffer_destroy; + + struct wlr_output *output; + struct wl_listener output_swap_buffers; + + void *data; +}; + +struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create( + struct wl_display *display); +void wlr_screencopy_manager_v1_destroy( + struct wlr_screencopy_manager_v1 *screencopy); + +#endif diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 46588f0a..b89da87a 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -8,57 +8,32 @@ #include <wayland-server.h> #include <wlr/types/wlr_output.h> -#define WLR_SURFACE_INVALID_BUFFER 1 -#define WLR_SURFACE_INVALID_SURFACE_DAMAGE 2 -#define WLR_SURFACE_INVALID_BUFFER_DAMAGE 4 -#define WLR_SURFACE_INVALID_OPAQUE_REGION 8 -#define WLR_SURFACE_INVALID_INPUT_REGION 16 -#define WLR_SURFACE_INVALID_TRANSFORM 32 -#define WLR_SURFACE_INVALID_SCALE 64 -#define WLR_SURFACE_INVALID_SUBSURFACE_POSITION 128 -#define WLR_SURFACE_INVALID_FRAME_CALLBACK_LIST 256 +enum wlr_surface_state_field { + WLR_SURFACE_STATE_BUFFER = 1, + WLR_SURFACE_STATE_SURFACE_DAMAGE = 2, + WLR_SURFACE_STATE_BUFFER_DAMAGE = 4, + WLR_SURFACE_STATE_OPAQUE_REGION = 8, + WLR_SURFACE_STATE_INPUT_REGION = 16, + WLR_SURFACE_STATE_TRANSFORM = 32, + WLR_SURFACE_STATE_SCALE = 64, + WLR_SURFACE_STATE_FRAME_CALLBACK_LIST = 128, +}; struct wlr_surface_state { - uint32_t invalid; - struct wl_resource *buffer; - struct wl_listener buffer_destroy_listener; - int32_t sx, sy; + uint32_t committed; // enum wlr_surface_state_field + + struct wl_resource *buffer_resource; + int32_t dx, dy; // relative to previous position pixman_region32_t surface_damage, buffer_damage; pixman_region32_t opaque, input; enum wl_output_transform transform; int32_t scale; - int width, height; - int buffer_width, buffer_height; - - struct { - int32_t x, y; - } subsurface_position; - - struct wl_list frame_callback_list; // wl_surface.frame -}; - -struct wlr_subsurface { - struct wl_resource *resource; - struct wlr_surface *surface; - struct wlr_surface *parent; - - struct wlr_surface_state *cached; - bool has_cache; - - bool synchronized; - bool reordered; - - struct wl_list parent_link; - struct wl_list parent_pending_link; - - struct wl_listener surface_destroy; - struct wl_listener parent_destroy; + struct wl_list frame_callback_list; // wl_resource - struct { - struct wl_signal destroy; - } events; + int width, height; // in surface-local coordinates + int buffer_width, buffer_height; - void *data; + struct wl_listener buffer_destroy; }; struct wlr_surface { @@ -71,7 +46,28 @@ struct wlr_surface { * or something went wrong with uploading the buffer. */ struct wlr_buffer *buffer; - struct wlr_surface_state *current, *pending; + /** + * The buffer position, in surface-local units. + */ + int sx, sy; + /** + * The last commit's buffer damage, in buffer-local coordinates. This + * contains both the damage accumulated by the client via + * `wlr_surface_state.surface_damage` and `wlr_surface_state.buffer_damage`. + * If the buffer has changed its size or moved, the whole buffer is + * damaged. + * + * This region needs to be scaled and transformed into output coordinates, + * just like the buffer's texture. + */ + pixman_region32_t buffer_damage; + /** + * `current` contains the current, committed surface state. `pending` + * accumulates state changes from the client between commits and shouldn't + * be accessed by the compositor directly. `previous` contains the state of + * the previous commit. + */ + struct wlr_surface_state current, pending, previous; const char *role; // the lifetime-bound role or null struct { @@ -94,6 +90,36 @@ struct wlr_surface { void *data; }; +struct wlr_subsurface_state { + int32_t x, y; +}; + +struct wlr_subsurface { + struct wl_resource *resource; + struct wlr_surface *surface; + struct wlr_surface *parent; + + struct wlr_subsurface_state current, pending; + + struct wlr_surface_state cached; + bool has_cache; + + bool synchronized; + bool reordered; + + struct wl_list parent_link; + struct wl_list parent_pending_link; + + struct wl_listener surface_destroy; + struct wl_listener parent_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + typedef void (*wlr_surface_iterator_func_t)(struct wlr_surface *surface, int sx, int sy, void *data); diff --git a/include/wlr/types/wlr_xdg_shell.h b/include/wlr/types/wlr_xdg_shell.h index 01dc17fe..d2dfaacb 100644 --- a/include/wlr/types/wlr_xdg_shell.h +++ b/include/wlr/types/wlr_xdg_shell.h @@ -352,11 +352,19 @@ struct wlr_xdg_surface *wlr_xdg_surface_from_wlr_surface( void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface, struct wlr_box *box); /** - * Call `iterator` on each surface in the xdg-surface tree, with the surface's - * position relative to the root xdg-surface. The function is called from root to - * leaves (in rendering order). + * Call `iterator` on each surface and popup in the xdg-surface tree, with the + * surface's position relative to the root xdg-surface. The function is called + * from root to leaves (in rendering order). */ void wlr_xdg_surface_for_each_surface(struct wlr_xdg_surface *surface, wlr_surface_iterator_func_t iterator, void *user_data); +/** + * Call `iterator` on each popup in the xdg-surface tree, with the popup's + * position relative to the root xdg-surface. The function is called from root + * to leaves (in rendering order). + */ +void wlr_xdg_surface_for_each_popup(struct wlr_xdg_surface *surface, + wlr_surface_iterator_func_t iterator, void *user_data); + #endif diff --git a/include/wlr/types/wlr_xdg_shell_v6.h b/include/wlr/types/wlr_xdg_shell_v6.h index 5f98eb13..38f85635 100644 --- a/include/wlr/types/wlr_xdg_shell_v6.h +++ b/include/wlr/types/wlr_xdg_shell_v6.h @@ -329,11 +329,19 @@ struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_from_wlr_surface( void wlr_xdg_surface_v6_get_geometry(struct wlr_xdg_surface_v6 *surface, struct wlr_box *box); /** - * Call `iterator` on each surface in the xdg-surface tree, with the surface's - * position relative to the root xdg-surface. The function is called from root to - * leaves (in rendering order). + * Call `iterator` on each surface and popup in the xdg-surface tree, with the + * surface's position relative to the root xdg-surface. The function is called + * from root to leaves (in rendering order). */ void wlr_xdg_surface_v6_for_each_surface(struct wlr_xdg_surface_v6 *surface, wlr_surface_iterator_func_t iterator, void *user_data); +/** + * Call `iterator` on each popup in the xdg-surface tree, with the popup's + * position relative to the root xdg-surface. The function is called from root + * to leaves (in rendering order). + */ +void wlr_xdg_surface_v6_for_each_popup(struct wlr_xdg_surface_v6 *surface, + wlr_surface_iterator_func_t iterator, void *user_data); + #endif |