Merge branch 'master' into screencontent

This commit is contained in:
emersion 2018-06-17 14:49:18 +01:00
commit 57548b557a
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
43 changed files with 886 additions and 375 deletions

View file

@ -25,6 +25,14 @@ struct wlr_gles2_pixel_format {
bool has_alpha;
};
struct wlr_gles2_tex_shader {
GLuint program;
GLint proj;
GLint invert_y;
GLint tex;
GLint alpha;
};
struct wlr_gles2_renderer {
struct wlr_renderer wlr_renderer;
@ -32,11 +40,19 @@ struct wlr_gles2_renderer {
const char *exts_str;
struct {
GLuint quad;
GLuint ellipse;
GLuint tex_rgba;
GLuint tex_rgbx;
GLuint tex_ext;
struct {
GLuint program;
GLint proj;
GLint color;
} quad;
struct {
GLuint program;
GLint proj;
GLint color;
} ellipse;
struct wlr_gles2_tex_shader tex_rgba;
struct wlr_gles2_tex_shader tex_rgbx;
struct wlr_gles2_tex_shader tex_ext;
} shaders;
uint32_t viewport_width, viewport_height;

View file

@ -59,6 +59,7 @@ struct roots_drag_icon {
struct wl_listener surface_commit;
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener destroy;
};
@ -94,9 +95,6 @@ void roots_seat_destroy(struct roots_seat *seat);
void roots_seat_add_device(struct roots_seat *seat,
struct wlr_input_device *device);
void roots_seat_remove_device(struct roots_seat *seat,
struct wlr_input_device *device);
void roots_seat_configure_cursor(struct roots_seat *seat);
void roots_seat_configure_xcursor(struct roots_seat *seat);

View file

@ -25,8 +25,12 @@ struct wlr_session {
struct wl_signal session_signal;
bool active;
/*
* 0 if virtual terminals are not supported
* i.e. seat != "seat0"
*/
unsigned vtnr;
char seat[8];
char seat[256];
struct udev *udev;
struct udev_monitor *mon;

View file

@ -16,13 +16,15 @@ struct wlr_egl {
const char *exts_str;
struct {
bool buffer_age;
bool swap_buffers_with_damage;
bool dmabuf_import;
bool dmabuf_import_modifiers;
bool dmabuf_export;
bool bind_wayland_display;
} egl_exts;
bool bind_wayland_display_wl;
bool buffer_age_ext;
bool image_base_khr;
bool image_dma_buf_export_mesa;
bool image_dmabuf_import_ext;
bool image_dmabuf_import_modifiers_ext;
bool swap_buffers_with_damage_ext;
bool swap_buffers_with_damage_khr;
} exts;
struct wl_display *wl_display;
};
@ -68,13 +70,6 @@ EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl,
EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
struct wlr_dmabuf_attributes *attributes);
/**
* Try to import the given dmabuf. On success return true false otherwise.
* If this succeeds the dmabuf can be used for rendering on a texture
*/
bool wlr_egl_check_import_dmabuf(struct wlr_egl *egl,
struct wlr_dmabuf_attributes *attributes);
/**
* Get the available dmabuf formats
*/

View file

@ -30,8 +30,6 @@ struct wlr_renderer_impl {
struct wl_resource *resource);
void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer,
struct wl_resource *buffer, int *width, int *height);
bool (*check_import_dmabuf)(struct wlr_renderer *renderer,
struct wlr_dmabuf_attributes *attribs);
int (*get_dmabuf_formats)(struct wlr_renderer *renderer, int **formats);
int (*get_dmabuf_modifiers)(struct wlr_renderer *renderer, int format,
uint64_t **modifiers);

View file

@ -84,12 +84,6 @@ int wlr_renderer_get_dmabuf_formats(struct wlr_renderer *renderer,
*/
int wlr_renderer_get_dmabuf_modifiers(struct wlr_renderer *renderer, int format,
uint64_t **modifiers);
/**
* Try to import the given dmabuf. On success return true false otherwise.
* If this succeeds the dmabuf can be used for rendering on a texture
*/
bool wlr_renderer_check_import_dmabuf(struct wlr_renderer *renderer,
struct wlr_dmabuf_attributes *attributes);
/**
* Reads out of pixels of the currently bound surface into data. `stride` is in
* bytes.

View file

@ -0,0 +1,63 @@
#ifndef WLR_TYPES_WLR_BUFFER_H
#define WLR_TYPES_WLR_BUFFER_H
#include <pixman.h>
#include <wayland-server.h>
/**
* A client buffer.
*/
struct wlr_buffer {
/**
* The buffer resource, if any. Will be NULL if the client destroys it.
*/
struct wl_resource *resource;
/**
* The buffer's texture, if any. A buffer will not have a texture if the
* client destroys the buffer before it has been released.
*/
struct wlr_texture *texture;
bool released;
size_t n_refs;
struct wl_listener resource_destroy;
};
struct wlr_renderer;
/**
* Check if a resource is a wl_buffer resource.
*/
bool wlr_resource_is_buffer(struct wl_resource *resource);
/**
* Get the size of a wl_buffer resource.
*/
bool wlr_buffer_get_resource_size(struct wl_resource *resource,
struct wlr_renderer *renderer, int *width, int *height);
/**
* Upload a buffer to the GPU and reference it.
*/
struct wlr_buffer *wlr_buffer_create(struct wlr_renderer *renderer,
struct wl_resource *resource);
/**
* Reference the buffer.
*/
struct wlr_buffer *wlr_buffer_ref(struct wlr_buffer *buffer);
/**
* Unreference the buffer. After this call, `buffer` may not be accessed
* anymore.
*/
void wlr_buffer_unref(struct wlr_buffer *buffer);
/**
* Try to update the buffer's content. On success, returns the updated buffer
* and destroys the provided `buffer`. On error, `buffer` is intact and NULL is
* returned.
*
* Fails if there's more than one reference to the buffer or if the texture
* isn't mutable.
*/
struct wlr_buffer *wlr_buffer_apply_damage(struct wlr_buffer *buffer,
struct wl_resource *resource, pixman_region32_t *damage);
#endif

View file

@ -88,12 +88,15 @@ struct wlr_drag_icon {
int32_t sx, sy;
struct {
struct wl_signal map; // emitted when mapped or unmapped
struct wl_signal map;
struct wl_signal unmap;
struct wl_signal destroy;
} events;
struct wl_listener surface_destroy;
struct wl_listener seat_client_destroy;
void *data;
};
struct wlr_drag {

View file

@ -89,7 +89,7 @@ enum wlr_key_state {
struct wlr_event_keyboard_key {
uint32_t time_msec;
uint32_t keycode;
bool update_state;
bool update_state; // if backend doesn't update modifiers on its own
enum wlr_key_state state;
};

View file

@ -13,11 +13,11 @@
* managed by wlr_seat; some may be NULL.
*/
struct wlr_seat_client {
struct wl_resource *wl_resource;
struct wl_client *client;
struct wlr_seat *seat;
// lists of wl_resource
struct wl_list wl_resources;
struct wl_list pointers;
struct wl_list keyboards;
struct wl_list touches;

View file

@ -62,12 +62,20 @@ struct wlr_subsurface {
struct {
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_surface {
struct wl_resource *resource;
struct wlr_renderer *renderer;
struct wlr_texture *texture;
/**
* The surface's buffer, if any. A surface has an attached buffer when it
* commits with a non-null buffer in its pending state. A surface will not
* have a buffer if it has never committed one, has committed a null buffer,
* or something went wrong with uploading the buffer.
*/
struct wlr_buffer *buffer;
struct wlr_surface_state *current, *pending;
const char *role; // the lifetime-bound role or null
@ -122,6 +130,13 @@ int wlr_surface_set_role(struct wlr_surface *surface, const char *role,
*/
bool wlr_surface_has_buffer(struct wlr_surface *surface);
/**
* Get the texture of the buffer currently attached to this surface. Returns
* NULL if no buffer is currently attached or if something went wrong with
* uploading the buffer.
*/
struct wlr_texture *wlr_surface_get_texture(struct wlr_surface *surface);
/**
* Create a new subsurface resource with the provided new ID. If `resource_list`
* is non-NULL, adds the subsurface's resource to the list.
@ -159,6 +174,14 @@ void wlr_surface_send_leave(struct wlr_surface *surface,
void wlr_surface_send_frame_done(struct wlr_surface *surface,
const struct timespec *when);
struct wlr_box;
/**
* Get the bounding box that contains the surface and all subsurfaces in
* surface coordinates.
* X and y may be negative, if there are subsurfaces with negative position.
*/
void wlr_surface_get_extends(struct wlr_surface *surface, struct wlr_box *box);
/**
* Set a callback for surface commit that runs before all the other callbacks.
* This is intended for use by the surface role.

View file

@ -118,6 +118,7 @@ struct wlr_xdg_toplevel {
struct wl_signal request_move;
struct wl_signal request_resize;
struct wl_signal request_show_window_menu;
struct wl_signal set_parent;
} events;
};
@ -341,6 +342,15 @@ bool wlr_surface_is_xdg_surface(struct wlr_surface *surface);
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
*/
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

View file

@ -126,6 +126,7 @@ struct wlr_xdg_toplevel_v6 {
struct wl_signal request_move;
struct wl_signal request_resize;
struct wl_signal request_show_window_menu;
struct wl_signal set_parent;
} events;
};
@ -318,6 +319,15 @@ bool wlr_surface_is_xdg_surface_v6(struct wlr_surface *surface);
struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_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
*/
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