mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-17 06:59:43 -05:00
types/wlr_compositor: Change to new design
- wlr_surface and wlr_region are bundled into the same file - Allows extensions to add state to wl_surface commits Old surface code has not been removed yet.
This commit is contained in:
parent
cf3b083c32
commit
e76d4581ce
12 changed files with 619 additions and 261 deletions
|
|
@ -31,7 +31,6 @@ install_headers(
|
|||
'wlr_presentation_time.h',
|
||||
'wlr_primary_selection_v1.h',
|
||||
'wlr_primary_selection.h',
|
||||
'wlr_region.h',
|
||||
'wlr_relative_pointer_v1.h',
|
||||
'wlr_screencopy_v1.h',
|
||||
'wlr_screenshooter.h',
|
||||
|
|
|
|||
|
|
@ -12,34 +12,105 @@
|
|||
#include <wayland-server.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
|
||||
struct wlr_commit;
|
||||
struct wlr_output;
|
||||
struct wlr_surface;
|
||||
|
||||
struct wlr_subcompositor {
|
||||
struct wl_global *global;
|
||||
struct wl_list resources;
|
||||
struct wl_list subsurface_resources;
|
||||
};
|
||||
|
||||
struct wlr_compositor {
|
||||
struct wl_global *global;
|
||||
struct wl_list resources;
|
||||
struct wlr_renderer *renderer;
|
||||
struct wl_list surface_resources;
|
||||
struct wl_list region_resources;
|
||||
|
||||
uint32_t ids;
|
||||
|
||||
struct wlr_subcompositor subcompositor;
|
||||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal new_surface;
|
||||
struct wl_signal new_surface_2;
|
||||
struct wl_signal new_state;
|
||||
} events;
|
||||
|
||||
struct wl_listener display_destroy;
|
||||
};
|
||||
|
||||
struct wlr_surface_2 {
|
||||
struct wl_resource *resource;
|
||||
struct wlr_compositor *compositor;
|
||||
|
||||
struct {
|
||||
struct wl_signal commit;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
|
||||
struct wlr_commit *pending;
|
||||
struct wl_list committed;
|
||||
|
||||
struct wl_list frame_callbacks;
|
||||
};
|
||||
|
||||
struct wlr_commit {
|
||||
struct wl_list link;
|
||||
struct wlr_surface_2 *surface;
|
||||
|
||||
// If the user has called wl_surface.commit
|
||||
bool committed;
|
||||
// See wlr_commit_inhibit
|
||||
size_t inhibit;
|
||||
size_t ref_cnt;
|
||||
|
||||
// wl_surface.attach
|
||||
struct wl_resource *buffer_resource;
|
||||
int32_t sx, sy;
|
||||
// wl_surface.damage
|
||||
pixman_region32_t surface_damage;
|
||||
// wl_surface.frame
|
||||
struct wl_list frame_callbacks;
|
||||
// wl_surface.set_opaque_region
|
||||
pixman_region32_t opaque_region;
|
||||
// wl_surface.set_input_region
|
||||
pixman_region32_t input_region;
|
||||
// wl_surface.set_buffer_transform
|
||||
enum wl_output_transform transform;
|
||||
// wl_surface.set_buffer_scale
|
||||
int32_t scale;
|
||||
// wl_surface.damage_buffer
|
||||
pixman_region32_t buffer_damage;
|
||||
|
||||
size_t state_len;
|
||||
void **state;
|
||||
|
||||
struct {
|
||||
struct wl_signal commit;
|
||||
struct wl_signal complete;
|
||||
struct wl_signal destroy;
|
||||
} events;
|
||||
};
|
||||
|
||||
void wlr_compositor_destroy(struct wlr_compositor *wlr_compositor);
|
||||
struct wlr_compositor_new_state_args {
|
||||
struct wlr_commit *old;
|
||||
struct wlr_commit *new;
|
||||
};
|
||||
|
||||
struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
|
||||
struct wlr_renderer *renderer);
|
||||
uint32_t wlr_compositor_register(struct wlr_compositor *compositor);
|
||||
|
||||
struct wlr_surface_2 *wlr_surface_from_resource_2(struct wl_resource *resource);
|
||||
|
||||
struct wlr_commit *wlr_surface_get_commit(struct wlr_surface_2 *surface);
|
||||
struct wlr_commit *wlr_surface_get_pending(struct wlr_surface_2 *surface);
|
||||
|
||||
void wlr_surface_send_enter_2(struct wlr_surface_2 *surf, struct wlr_output *output);
|
||||
void wlr_surface_send_leave_2(struct wlr_surface_2 *surf, struct wlr_output *output);
|
||||
|
||||
void wlr_commit_unref(struct wlr_commit *commit);
|
||||
|
||||
void wlr_commit_inhibit(struct wlr_commit *commit);
|
||||
void wlr_commit_uninhibit(struct wlr_commit *commit);
|
||||
|
||||
bool wlr_surface_is_subsurface(struct wlr_surface *surface);
|
||||
|
||||
|
|
@ -50,4 +121,6 @@ bool wlr_surface_is_subsurface(struct wlr_surface *surface);
|
|||
struct wlr_subsurface *wlr_subsurface_from_wlr_surface(
|
||||
struct wlr_surface *surface);
|
||||
|
||||
pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* This an unstable interface of wlroots. No guarantees are made regarding the
|
||||
* future consistency of this API.
|
||||
*/
|
||||
#ifndef WLR_USE_UNSTABLE
|
||||
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
|
||||
#endif
|
||||
|
||||
#ifndef WLR_TYPES_WLR_REGION_H
|
||||
#define WLR_TYPES_WLR_REGION_H
|
||||
|
||||
#include <pixman.h>
|
||||
#include <wayland-server-protocol.h>
|
||||
|
||||
/*
|
||||
* Creates a new region resource with the provided new ID. If `resource_list` is
|
||||
* non-NULL, adds the region's resource to the list.
|
||||
*/
|
||||
struct wl_resource *wlr_region_create(struct wl_client *client,
|
||||
uint32_t version, uint32_t id, struct wl_list *resource_list);
|
||||
|
||||
pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource);
|
||||
|
||||
#endif
|
||||
|
|
@ -157,8 +157,7 @@ struct wlr_renderer;
|
|||
* is non-NULL, adds the surface's resource to the list.
|
||||
*/
|
||||
struct wlr_surface *wlr_surface_create(struct wl_client *client,
|
||||
uint32_t version, uint32_t id, struct wlr_renderer *renderer,
|
||||
struct wl_list *resource_list);
|
||||
uint32_t version, uint32_t id, struct wlr_renderer *renderer);
|
||||
|
||||
/**
|
||||
* Set the lifetime role for this surface. Returns 0 on success or -1 if the
|
||||
|
|
@ -188,8 +187,7 @@ struct wlr_texture *wlr_surface_get_texture(struct wlr_surface *surface);
|
|||
* is non-NULL, adds the subsurface's resource to the list.
|
||||
*/
|
||||
struct wlr_subsurface *wlr_subsurface_create(struct wlr_surface *surface,
|
||||
struct wlr_surface *parent, uint32_t version, uint32_t id,
|
||||
struct wl_list *resource_list);
|
||||
struct wlr_surface *parent, uint32_t version, uint32_t id);
|
||||
|
||||
/**
|
||||
* Get the root of the subsurface tree for this surface.
|
||||
|
|
|
|||
|
|
@ -128,7 +128,6 @@ struct wlr_xwm {
|
|||
#endif
|
||||
|
||||
struct wl_listener compositor_new_surface;
|
||||
struct wl_listener compositor_destroy;
|
||||
struct wl_listener seat_set_selection;
|
||||
struct wl_listener seat_set_primary_selection;
|
||||
struct wl_listener seat_start_drag;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue