mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-15 06:59:43 -05:00
Merge branch 'master' into xwayland-dnd
This commit is contained in:
commit
8836b4f024
80 changed files with 3987 additions and 1491 deletions
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
||||
const char *x11_display);
|
||||
struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend);
|
||||
|
||||
bool wlr_backend_is_x11(struct wlr_backend *backend);
|
||||
bool wlr_input_device_is_x11(struct wlr_input_device *device);
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ struct wlr_egl {
|
|||
EGLConfig config;
|
||||
EGLContext context;
|
||||
|
||||
const char *egl_exts_str;
|
||||
const char *gl_exts_str;
|
||||
const char *exts_str;
|
||||
|
||||
struct {
|
||||
bool buffer_age;
|
||||
bool swap_buffers_with_damage;
|
||||
bool dmabuf_import;
|
||||
bool dmabuf_import_modifiers;
|
||||
bool bind_wayland_display;
|
||||
} egl_exts;
|
||||
|
||||
struct wl_display *wl_display;
|
||||
|
|
@ -28,30 +28,25 @@ struct wlr_egl {
|
|||
|
||||
// TODO: Allocate and return a wlr_egl
|
||||
/**
|
||||
* Initializes an egl context for the given platform and remote display.
|
||||
* Initializes an EGL context for the given platform and remote display.
|
||||
* Will attempt to load all possibly required api functions.
|
||||
*/
|
||||
bool wlr_egl_init(struct wlr_egl *egl, EGLenum platform, void *remote_display,
|
||||
EGLint *config_attribs, EGLint visual_id);
|
||||
|
||||
/**
|
||||
* Frees all related egl resources, makes the context not-current and
|
||||
* Frees all related EGL resources, makes the context not-current and
|
||||
* unbinds a bound wayland display.
|
||||
*/
|
||||
void wlr_egl_finish(struct wlr_egl *egl);
|
||||
|
||||
/**
|
||||
* Binds the given display to the egl instance.
|
||||
* This will allow clients to create egl surfaces from wayland ones and render to it.
|
||||
* Binds the given display to the EGL instance.
|
||||
* This will allow clients to create EGL surfaces from wayland ones and render
|
||||
* to it.
|
||||
*/
|
||||
bool wlr_egl_bind_display(struct wlr_egl *egl, struct wl_display *local_display);
|
||||
|
||||
/**
|
||||
* Refer to the eglQueryWaylandBufferWL extension function.
|
||||
*/
|
||||
bool wlr_egl_query_buffer(struct wlr_egl *egl, struct wl_resource *buf,
|
||||
EGLint attrib, EGLint *value);
|
||||
|
||||
/**
|
||||
* Returns a surface for the given native window
|
||||
* The window must match the remote display the wlr_egl was created with.
|
||||
|
|
@ -59,24 +54,25 @@ bool wlr_egl_query_buffer(struct wlr_egl *egl, struct wl_resource *buf,
|
|||
EGLSurface wlr_egl_create_surface(struct wlr_egl *egl, void *window);
|
||||
|
||||
/**
|
||||
* Creates an egl image from the given client buffer and attributes.
|
||||
* Creates an EGL image from the given wl_drm buffer resource.
|
||||
*/
|
||||
EGLImageKHR wlr_egl_create_image(struct wlr_egl *egl,
|
||||
EGLenum target, EGLClientBuffer buffer, const EGLint *attribs);
|
||||
EGLImageKHR wlr_egl_create_image_from_wl_drm(struct wlr_egl *egl,
|
||||
struct wl_resource *data, EGLint *fmt, int *width, int *height,
|
||||
bool *inverted_y);
|
||||
|
||||
/**
|
||||
* Creates an egl image from the given dmabuf attributes. Check usability
|
||||
* Creates an EGL image from the given dmabuf attributes. Check usability
|
||||
* of the dmabuf with wlr_egl_check_import_dmabuf once first.
|
||||
*/
|
||||
EGLImageKHR wlr_egl_create_image_from_dmabuf(struct wlr_egl *egl,
|
||||
struct wlr_dmabuf_buffer_attribs *attributes);
|
||||
struct wlr_dmabuf_buffer_attribs *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_buffer *dmabuf);
|
||||
struct wlr_dmabuf_buffer *dmabuf);
|
||||
|
||||
/**
|
||||
* Get the available dmabuf formats
|
||||
|
|
@ -90,13 +86,15 @@ int wlr_egl_get_dmabuf_modifiers(struct wlr_egl *egl, int format,
|
|||
uint64_t **modifiers);
|
||||
|
||||
/**
|
||||
* Destroys an egl image created with the given wlr_egl.
|
||||
* Destroys an EGL image created with the given wlr_egl.
|
||||
*/
|
||||
bool wlr_egl_destroy_image(struct wlr_egl *egl, EGLImageKHR image);
|
||||
|
||||
bool wlr_egl_make_current(struct wlr_egl *egl, EGLSurface surface,
|
||||
int *buffer_age);
|
||||
|
||||
bool wlr_egl_is_current(struct wlr_egl *egl);
|
||||
|
||||
bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface,
|
||||
pixman_region32_t *damage);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,15 @@
|
|||
#include <wlr/render/wlr_renderer.h>
|
||||
|
||||
struct wlr_egl;
|
||||
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_backend *backend);
|
||||
|
||||
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl);
|
||||
|
||||
struct wlr_texture *wlr_gles2_texture_from_pixels(struct wlr_egl *egl,
|
||||
enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height,
|
||||
const void *data);
|
||||
struct wlr_texture *wlr_gles2_texture_from_wl_drm(struct wlr_egl *egl,
|
||||
struct wl_resource *data);
|
||||
struct wlr_texture *wlr_gles2_texture_from_dmabuf(struct wlr_egl *egl,
|
||||
struct wlr_dmabuf_buffer_attribs *attribs);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ struct wlr_renderer_impl {
|
|||
void (*end)(struct wlr_renderer *renderer);
|
||||
void (*clear)(struct wlr_renderer *renderer, const float color[static 4]);
|
||||
void (*scissor)(struct wlr_renderer *renderer, struct wlr_box *box);
|
||||
struct wlr_texture *(*texture_create)(struct wlr_renderer *renderer);
|
||||
bool (*render_texture_with_matrix)(struct wlr_renderer *renderer,
|
||||
struct wlr_texture *texture, const float matrix[static 9],
|
||||
float alpha);
|
||||
|
|
@ -33,45 +32,39 @@ struct wlr_renderer_impl {
|
|||
const float color[static 4], const float matrix[static 9]);
|
||||
const enum wl_shm_format *(*formats)(
|
||||
struct wlr_renderer *renderer, size_t *len);
|
||||
bool (*buffer_is_drm)(struct wlr_renderer *renderer,
|
||||
struct wl_resource *buffer);
|
||||
bool (*resource_is_wl_drm_buffer)(struct wlr_renderer *renderer,
|
||||
struct wl_resource *resource);
|
||||
void (*wl_drm_buffer_get_size)(struct wlr_renderer *renderer,
|
||||
struct wl_resource *buffer, int *width, int *height);
|
||||
bool (*read_pixels)(struct wlr_renderer *renderer, enum wl_shm_format fmt,
|
||||
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,
|
||||
enum wl_shm_format fmt);
|
||||
struct wlr_texture *(*texture_from_pixels)(struct wlr_renderer *renderer,
|
||||
enum wl_shm_format fmt, uint32_t stride, uint32_t width,
|
||||
uint32_t height, const void *data);
|
||||
struct wlr_texture *(*texture_from_wl_drm)(struct wlr_renderer *renderer,
|
||||
struct wl_resource *data);
|
||||
struct wlr_texture *(*texture_from_dmabuf)(struct wlr_renderer *renderer,
|
||||
struct wlr_dmabuf_buffer_attribs *attribs);
|
||||
void (*destroy)(struct wlr_renderer *renderer);
|
||||
};
|
||||
|
||||
void wlr_renderer_init(struct wlr_renderer *renderer,
|
||||
const struct wlr_renderer_impl *impl);
|
||||
const struct wlr_renderer_impl *impl);
|
||||
|
||||
struct wlr_texture_impl {
|
||||
bool (*upload_pixels)(struct wlr_texture *texture,
|
||||
enum wl_shm_format format, int stride, int width, int height,
|
||||
const unsigned char *pixels);
|
||||
bool (*update_pixels)(struct wlr_texture *texture,
|
||||
enum wl_shm_format format, int stride, int x, int y,
|
||||
int width, int height, const unsigned char *pixels);
|
||||
bool (*upload_shm)(struct wlr_texture *texture, uint32_t format,
|
||||
struct wl_shm_buffer *shm);
|
||||
bool (*update_shm)(struct wlr_texture *texture, uint32_t format,
|
||||
int x, int y, int width, int height, struct wl_shm_buffer *shm);
|
||||
bool (*upload_drm)(struct wlr_texture *texture,
|
||||
struct wl_resource *drm_buf);
|
||||
bool (*upload_eglimage)(struct wlr_texture *texture, EGLImageKHR image,
|
||||
uint32_t width, uint32_t height);
|
||||
bool (*upload_dmabuf)(struct wlr_texture *texture,
|
||||
struct wl_resource *dmabuf_resource);
|
||||
void (*get_buffer_size)(struct wlr_texture *texture,
|
||||
struct wl_resource *resource, int *width, int *height);
|
||||
void (*get_size)(struct wlr_texture *texture, int *width, int *height);
|
||||
bool (*write_pixels)(struct wlr_texture *texture,
|
||||
enum wl_shm_format wl_fmt, 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);
|
||||
void (*destroy)(struct wlr_texture *texture);
|
||||
};
|
||||
|
||||
void wlr_texture_init(struct wlr_texture *texture,
|
||||
const struct wlr_texture_impl *impl);
|
||||
void wlr_texture_get_buffer_size(struct wlr_texture *texture,
|
||||
struct wl_resource *resource, int *width, int *height);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
#ifndef WLR_RENDER_WLR_RENDERER_H
|
||||
#define WLR_RENDER_WLR_RENDERER_H
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
#include <stdint.h>
|
||||
#include <wayland-server-protocol.h>
|
||||
#include <wlr/render/wlr_texture.h>
|
||||
|
|
@ -21,10 +19,6 @@ void wlr_renderer_clear(struct wlr_renderer *r, const float color[static 4]);
|
|||
* box.
|
||||
*/
|
||||
void wlr_renderer_scissor(struct wlr_renderer *r, struct wlr_box *box);
|
||||
/**
|
||||
* Requests a texture handle from this renderer.
|
||||
*/
|
||||
struct wlr_texture *wlr_render_texture_create(struct wlr_renderer *r);
|
||||
/**
|
||||
* Renders the requested texture.
|
||||
*/
|
||||
|
|
@ -61,10 +55,15 @@ void wlr_render_ellipse_with_matrix(struct wlr_renderer *r,
|
|||
const enum wl_shm_format *wlr_renderer_get_formats(struct wlr_renderer *r,
|
||||
size_t *len);
|
||||
/**
|
||||
* Returns true if this wl_buffer is a DRM buffer.
|
||||
* Returns true if this wl_buffer is a wl_drm buffer.
|
||||
*/
|
||||
bool wlr_renderer_buffer_is_drm(struct wlr_renderer *renderer,
|
||||
bool wlr_renderer_resource_is_wl_drm_buffer(struct wlr_renderer *renderer,
|
||||
struct wl_resource *buffer);
|
||||
/**
|
||||
* Gets the width and height of a wl_drm buffer.
|
||||
*/
|
||||
void wlr_renderer_wl_drm_buffer_get_size(struct wlr_renderer *renderer,
|
||||
struct wl_resource *buffer, int *width, int *height);
|
||||
/**
|
||||
* Reads out of pixels of the currently bound surface into data. `stride` is in
|
||||
* bytes.
|
||||
|
|
|
|||
|
|
@ -5,62 +5,49 @@
|
|||
#include <EGL/eglext.h>
|
||||
#include <stdint.h>
|
||||
#include <wayland-server-protocol.h>
|
||||
#include <wlr/types/wlr_linux_dmabuf.h>
|
||||
|
||||
struct wlr_renderer;
|
||||
struct wlr_texture_impl;
|
||||
|
||||
struct wlr_texture {
|
||||
const struct wlr_texture_impl *impl;
|
||||
|
||||
bool valid;
|
||||
uint32_t format;
|
||||
int width, height;
|
||||
bool inverted_y;
|
||||
struct wl_signal destroy_signal;
|
||||
struct wl_resource *resource;
|
||||
};
|
||||
|
||||
/**
|
||||
* Copies pixels to this texture. The buffer is not accessed after this function
|
||||
* returns.
|
||||
* Create a new texture from raw pixel data. `stride` is in bytes. The returned
|
||||
* texture is mutable.
|
||||
*/
|
||||
bool wlr_texture_upload_pixels(struct wlr_texture *tex,
|
||||
enum wl_shm_format format, int stride, int width, int height,
|
||||
const unsigned char *pixels);
|
||||
/**
|
||||
* Copies pixels to this texture. The buffer is not accessed after this function
|
||||
* returns. Under some circumstances, this function may re-upload the entire
|
||||
* buffer - therefore, the entire buffer must be valid.
|
||||
*/
|
||||
bool wlr_texture_update_pixels(struct wlr_texture *surf,
|
||||
enum wl_shm_format format, int stride, int x, int y,
|
||||
int width, int height, const unsigned char *pixels);
|
||||
/**
|
||||
* Copies pixels from a wl_shm_buffer into this texture. The buffer is not
|
||||
* accessed after this function returns.
|
||||
*/
|
||||
bool wlr_texture_upload_shm(struct wlr_texture *tex, uint32_t format,
|
||||
struct wl_shm_buffer *shm);
|
||||
/**
|
||||
* Attaches the contents from the given wl_drm wl_buffer resource onto the
|
||||
* texture. The wl_resource is not used after this call.
|
||||
* Will fail (return false) if the given resource is no drm buffer.
|
||||
*/
|
||||
bool wlr_texture_upload_drm(struct wlr_texture *tex,
|
||||
struct wl_resource *drm_buffer);
|
||||
struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
|
||||
enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height,
|
||||
const void *data);
|
||||
|
||||
bool wlr_texture_upload_eglimage(struct wlr_texture *tex,
|
||||
EGLImageKHR image, uint32_t width, uint32_t height);
|
||||
|
||||
bool wlr_texture_upload_dmabuf(struct wlr_texture *tex,
|
||||
struct wl_resource *dmabuf_resource);
|
||||
/**
|
||||
* Copies a rectangle of pixels from a wl_shm_buffer onto the texture. The
|
||||
* buffer is not accessed after this function returns. Under some circumstances,
|
||||
* this function may re-upload the entire buffer - therefore, the entire buffer
|
||||
* must be valid.
|
||||
* Create a new texture from a wl_drm resource. The returned texture is
|
||||
* immutable.
|
||||
*/
|
||||
bool wlr_texture_update_shm(struct wlr_texture *surf, uint32_t format,
|
||||
int x, int y, int width, int height, struct wl_shm_buffer *shm);
|
||||
struct wlr_texture *wlr_texture_from_wl_drm(struct wlr_renderer *renderer,
|
||||
struct wl_resource *data);
|
||||
|
||||
/**
|
||||
* Create a new texture from a DMA-BUF. The returned texture is immutable.
|
||||
*/
|
||||
struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer,
|
||||
struct wlr_dmabuf_buffer_attribs *attribs);
|
||||
|
||||
/**
|
||||
* Get the texture width and height.
|
||||
*/
|
||||
void wlr_texture_get_size(struct wlr_texture *texture, int *width, int *height);
|
||||
|
||||
/**
|
||||
* Update a texture with raw pixels. The texture must be mutable.
|
||||
*/
|
||||
bool wlr_texture_write_pixels(struct wlr_texture *texture,
|
||||
enum wl_shm_format wl_fmt, 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);
|
||||
|
||||
/**
|
||||
* Destroys this wlr_texture.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
|
|||
double x, double y);
|
||||
|
||||
void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
|
||||
struct wlr_input_device *dev, double x_mm, double y_mm);
|
||||
struct wlr_input_device *dev, double x, double y);
|
||||
|
||||
/**
|
||||
* Move the cursor in the direction of the given x and y coordinates.
|
||||
|
|
@ -155,7 +155,7 @@ void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
|
|||
* Convert absolute coordinates to layout coordinates for the device.
|
||||
*/
|
||||
bool wlr_cursor_absolute_to_layout_coords(struct wlr_cursor *cur,
|
||||
struct wlr_input_device *device, double x_mm, double y_mm,
|
||||
double width_mm, double height_mm, double *lx, double *ly);
|
||||
struct wlr_input_device *device, double x, double y,
|
||||
double *lx, double *ly);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ struct wlr_input_device {
|
|||
enum wlr_input_device_type type;
|
||||
int vendor, product;
|
||||
char *name;
|
||||
// Or 0 if not applicable to this device
|
||||
double width_mm, height_mm;
|
||||
|
||||
/* wlr_input_device.type determines which of these is valid */
|
||||
union {
|
||||
|
|
|
|||
102
include/wlr/types/wlr_layer_shell.h
Normal file
102
include/wlr/types/wlr_layer_shell.h
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
#ifndef WLR_TYPES_WLR_LAYER_SHELL_H
|
||||
#define WLR_TYPES_WLR_LAYER_SHELL_H
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_surface.h>
|
||||
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
||||
|
||||
/**
|
||||
* wlr_layer_shell 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. 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_configure. The client will then attach a buffer and commit
|
||||
* the surface, at which point the wlr_layer_surface map signal is raised and
|
||||
* the compositor should begin rendering the surface.
|
||||
*/
|
||||
struct wlr_layer_shell {
|
||||
struct wl_global *wl_global;
|
||||
struct wl_list client_resources; // wl_resource
|
||||
struct wl_list surfaces; // wl_layer_surface
|
||||
|
||||
struct wl_listener display_destroy;
|
||||
|
||||
struct {
|
||||
struct wl_signal new_surface;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wlr_layer_surface_state {
|
||||
uint32_t anchor;
|
||||
int32_t exclusive_zone;
|
||||
struct {
|
||||
uint32_t top, right, bottom, left;
|
||||
} margin;
|
||||
bool keyboard_interactive;
|
||||
uint32_t desired_width, desired_height;
|
||||
uint32_t actual_width, actual_height;
|
||||
};
|
||||
|
||||
struct wlr_layer_surface_configure {
|
||||
struct wl_list link; // wlr_layer_surface::configure_list
|
||||
uint32_t serial;
|
||||
struct wlr_layer_surface_state state;
|
||||
};
|
||||
|
||||
struct wlr_layer_surface {
|
||||
struct wl_list link; // wlr_layer_shell::surfaces
|
||||
struct wlr_surface *surface;
|
||||
struct wlr_output *output;
|
||||
struct wl_resource *resource;
|
||||
struct wlr_layer_shell *shell;
|
||||
|
||||
const char *namespace;
|
||||
enum zwlr_layer_shell_v1_layer layer;
|
||||
|
||||
bool added, configured, mapped, closed;
|
||||
uint32_t configure_serial;
|
||||
struct wl_event_source *configure_idle;
|
||||
uint32_t configure_next_serial;
|
||||
struct wl_list configure_list;
|
||||
|
||||
struct wlr_layer_surface_configure *acked_configure;
|
||||
|
||||
struct wlr_layer_surface_state client_pending;
|
||||
struct wlr_layer_surface_state server_pending;
|
||||
struct wlr_layer_surface_state current;
|
||||
|
||||
struct wl_listener surface_destroy_listener;
|
||||
|
||||
struct {
|
||||
struct wl_signal destroy;
|
||||
struct wl_signal map;
|
||||
struct wl_signal unmap;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct wlr_layer_shell *wlr_layer_shell_create(struct wl_display *display);
|
||||
void wlr_layer_shell_destroy(struct wlr_layer_shell *layer_shell);
|
||||
|
||||
/**
|
||||
* Notifies the layer surface to configure itself with this width/height. The
|
||||
* layer_surface will signal its map event when the surface is ready to assume
|
||||
* this size.
|
||||
*/
|
||||
void wlr_layer_surface_configure(struct wlr_layer_surface *surface,
|
||||
uint32_t width, uint32_t height);
|
||||
|
||||
/**
|
||||
* Unmaps this layer surface and notifies the client that it has been closed.
|
||||
*/
|
||||
void wlr_layer_surface_close(struct wlr_layer_surface *surface);
|
||||
|
||||
#endif
|
||||
|
|
@ -11,6 +11,12 @@
|
|||
#define DRM_FORMAT_MOD_INVALID ((1ULL<<56) - 1)
|
||||
#endif
|
||||
|
||||
enum {
|
||||
WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_Y_INVERT = 1,
|
||||
WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_INTERLACED = 2,
|
||||
WLR_DMABUF_BUFFER_ATTRIBS_FLAGS_BOTTOM_FIRST = 4,
|
||||
};
|
||||
|
||||
struct wlr_dmabuf_buffer_attribs {
|
||||
/* set via params_add */
|
||||
int n_planes;
|
||||
|
|
@ -22,7 +28,7 @@ struct wlr_dmabuf_buffer_attribs {
|
|||
int32_t width;
|
||||
int32_t height;
|
||||
uint32_t format;
|
||||
uint32_t flags; /* enum zlinux_buffer_params_flags */
|
||||
uint32_t flags;
|
||||
};
|
||||
|
||||
struct wlr_dmabuf_buffer {
|
||||
|
|
@ -52,11 +58,6 @@ struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource(
|
|||
struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource(
|
||||
struct wl_resource *params_resource);
|
||||
|
||||
/**
|
||||
* Returns true if the given dmabuf has y-axis inverted, false otherwise
|
||||
*/
|
||||
bool wlr_dmabuf_buffer_has_inverted_y(struct wlr_dmabuf_buffer *dmabuf);
|
||||
|
||||
/* the protocol interface */
|
||||
struct wlr_linux_dmabuf {
|
||||
struct wl_global *wl_global;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <pixman.h>
|
||||
#include <time.h>
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,41 +40,42 @@ struct wlr_output_layout_output *wlr_output_layout_get(
|
|||
struct wlr_output_layout *layout, struct wlr_output *reference);
|
||||
|
||||
struct wlr_output *wlr_output_layout_output_at(struct wlr_output_layout *layout,
|
||||
double x, double y);
|
||||
double lx, double ly);
|
||||
|
||||
void wlr_output_layout_add(struct wlr_output_layout *layout,
|
||||
struct wlr_output *output, int x, int y);
|
||||
struct wlr_output *output, int lx, int ly);
|
||||
|
||||
void wlr_output_layout_move(struct wlr_output_layout *layout,
|
||||
struct wlr_output *output, int x, int y);
|
||||
struct wlr_output *output, int lx, int ly);
|
||||
|
||||
void wlr_output_layout_remove(struct wlr_output_layout *layout,
|
||||
struct wlr_output *output);
|
||||
|
||||
/**
|
||||
* Given x and y as pointers to global coordinates, adjusts them to local output
|
||||
* Given x and y in layout coordinates, adjusts them to local output
|
||||
* coordinates relative to the given reference output.
|
||||
*/
|
||||
void wlr_output_layout_output_coords(struct wlr_output_layout *layout,
|
||||
struct wlr_output *reference, double *x, double *y);
|
||||
struct wlr_output *reference, double *lx, double *ly);
|
||||
|
||||
bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
|
||||
struct wlr_output *reference, int x, int y);
|
||||
struct wlr_output *reference, int lx, int ly);
|
||||
|
||||
bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
|
||||
struct wlr_output *reference, const struct wlr_box *target_box);
|
||||
struct wlr_output *reference, const struct wlr_box *target_lbox);
|
||||
|
||||
/**
|
||||
* Get the closest point on this layout from the given point from the reference
|
||||
* output. If reference is NULL, gets the closest point from the entire layout.
|
||||
*/
|
||||
void wlr_output_layout_closest_point(struct wlr_output_layout *layout,
|
||||
struct wlr_output *reference, double x, double y, double *dest_x,
|
||||
double *dest_y);
|
||||
struct wlr_output *reference, double lx, double ly, double *dest_lx,
|
||||
double *dest_ly);
|
||||
|
||||
/**
|
||||
* Get the box of the layout for the given reference output. If `reference`
|
||||
* is NULL, the box will be for the extents of the entire layout.
|
||||
* Get the box of the layout for the given reference output in layout
|
||||
* coordinates. If `reference` is NULL, the box will be for the extents of the
|
||||
* entire layout.
|
||||
*/
|
||||
struct wlr_box *wlr_output_layout_get_box(
|
||||
struct wlr_output_layout *layout, struct wlr_output *reference);
|
||||
|
|
@ -109,6 +110,6 @@ enum wlr_direction {
|
|||
*/
|
||||
struct wlr_output *wlr_output_layout_adjacent_output(
|
||||
struct wlr_output_layout *layout, enum wlr_direction direction,
|
||||
struct wlr_output *reference, double ref_x, double ref_y);
|
||||
struct wlr_output *reference, double ref_lx, double ref_ly);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ struct wlr_event_pointer_motion {
|
|||
struct wlr_event_pointer_motion_absolute {
|
||||
struct wlr_input_device *device;
|
||||
uint32_t time_msec;
|
||||
double x_mm, y_mm;
|
||||
double width_mm, height_mm;
|
||||
// From 0..1
|
||||
double x, y;
|
||||
};
|
||||
|
||||
struct wlr_event_pointer_button {
|
||||
|
|
|
|||
|
|
@ -134,6 +134,9 @@ struct wlr_surface *wlr_surface_get_main_surface(struct wlr_surface *surface);
|
|||
struct wlr_subsurface *wlr_surface_subsurface_at(struct wlr_surface *surface,
|
||||
double sx, double sy, double *sub_x, double *sub_y);
|
||||
|
||||
bool wlr_surface_point_accepts_input(
|
||||
struct wlr_surface *surface, double sx, double sy);
|
||||
|
||||
void wlr_surface_send_enter(struct wlr_surface *surface,
|
||||
struct wlr_output *output);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,8 +36,8 @@ struct wlr_event_tablet_tool_axis {
|
|||
struct wlr_input_device *device;
|
||||
uint32_t time_msec;
|
||||
uint32_t updated_axes;
|
||||
double x_mm, y_mm;
|
||||
double width_mm, height_mm;
|
||||
// From 0..1
|
||||
double x, y;
|
||||
double pressure;
|
||||
double distance;
|
||||
double tilt_x, tilt_y;
|
||||
|
|
@ -54,8 +54,8 @@ enum wlr_tablet_tool_proximity_state {
|
|||
struct wlr_event_tablet_tool_proximity {
|
||||
struct wlr_input_device *device;
|
||||
uint32_t time_msec;
|
||||
double x_mm, y_mm;
|
||||
double width_mm, height_mm;
|
||||
// From 0..1
|
||||
double x, y;
|
||||
enum wlr_tablet_tool_proximity_state state;
|
||||
};
|
||||
|
||||
|
|
@ -67,8 +67,8 @@ enum wlr_tablet_tool_tip_state {
|
|||
struct wlr_event_tablet_tool_tip {
|
||||
struct wlr_input_device *device;
|
||||
uint32_t time_msec;
|
||||
double x_mm, y_mm;
|
||||
double width_mm, height_mm;
|
||||
// From 0..1
|
||||
double x, y;
|
||||
enum wlr_tablet_tool_tip_state state;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ struct wlr_event_touch_down {
|
|||
struct wlr_input_device *device;
|
||||
uint32_t time_msec;
|
||||
int32_t touch_id;
|
||||
double x_mm, y_mm;
|
||||
double width_mm, height_mm;
|
||||
// From 0..1
|
||||
double x, y;
|
||||
};
|
||||
|
||||
struct wlr_event_touch_up {
|
||||
|
|
@ -37,8 +37,8 @@ struct wlr_event_touch_motion {
|
|||
struct wlr_input_device *device;
|
||||
uint32_t time_msec;
|
||||
int32_t touch_id;
|
||||
double x_mm, y_mm;
|
||||
double width_mm, height_mm;
|
||||
// From 0..1
|
||||
double x, y;
|
||||
};
|
||||
|
||||
struct wlr_event_touch_cancel {
|
||||
|
|
|
|||
|
|
@ -77,9 +77,22 @@ struct wlr_xdg_toplevel {
|
|||
struct wlr_xdg_surface *base;
|
||||
struct wlr_xdg_surface *parent;
|
||||
bool added;
|
||||
struct wlr_xdg_toplevel_state next; // client protocol requests
|
||||
struct wlr_xdg_toplevel_state pending; // user configure requests
|
||||
|
||||
struct wlr_xdg_toplevel_state client_pending;
|
||||
struct wlr_xdg_toplevel_state server_pending;
|
||||
struct wlr_xdg_toplevel_state current;
|
||||
|
||||
char *title;
|
||||
char *app_id;
|
||||
|
||||
struct {
|
||||
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;
|
||||
struct wl_signal request_show_window_menu;
|
||||
} events;
|
||||
};
|
||||
|
||||
struct wlr_xdg_surface_configure {
|
||||
|
|
@ -109,9 +122,6 @@ struct wlr_xdg_surface {
|
|||
uint32_t configure_next_serial;
|
||||
struct wl_list configure_list;
|
||||
|
||||
char *title;
|
||||
char *app_id;
|
||||
|
||||
bool has_next_geometry;
|
||||
struct wlr_box next_geometry;
|
||||
struct wlr_box geometry;
|
||||
|
|
@ -124,13 +134,6 @@ struct wlr_xdg_surface {
|
|||
struct wl_signal new_popup;
|
||||
struct wl_signal map;
|
||||
struct wl_signal unmap;
|
||||
|
||||
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;
|
||||
struct wl_signal request_show_window_menu;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <wayland-server.h>
|
||||
#include <wlr/types/wlr_box.h>
|
||||
#include <wlr/types/wlr_seat.h>
|
||||
#include "xdg-shell-unstable-v6-protocol.h"
|
||||
|
||||
struct wlr_xdg_shell_v6 {
|
||||
struct wl_global *wl_global;
|
||||
|
|
@ -32,6 +33,21 @@ struct wlr_xdg_client_v6 {
|
|||
struct wl_event_source *ping_timer;
|
||||
};
|
||||
|
||||
struct wlr_xdg_positioner_v6 {
|
||||
struct wlr_box anchor_rect;
|
||||
enum zxdg_positioner_v6_anchor anchor;
|
||||
enum zxdg_positioner_v6_gravity gravity;
|
||||
enum zxdg_positioner_v6_constraint_adjustment constraint_adjustment;
|
||||
|
||||
struct {
|
||||
int32_t width, height;
|
||||
} size;
|
||||
|
||||
struct {
|
||||
int32_t x, y;
|
||||
} offset;
|
||||
};
|
||||
|
||||
struct wlr_xdg_popup_v6 {
|
||||
struct wlr_xdg_surface_v6 *base;
|
||||
struct wl_list link;
|
||||
|
|
@ -45,6 +61,8 @@ struct wlr_xdg_popup_v6 {
|
|||
// geometry of the parent surface
|
||||
struct wlr_box geometry;
|
||||
|
||||
struct wlr_xdg_positioner_v6 positioner;
|
||||
|
||||
struct wl_list grab_link; // wlr_xdg_popup_grab_v6::popups
|
||||
};
|
||||
|
||||
|
|
@ -77,9 +95,22 @@ struct wlr_xdg_toplevel_v6 {
|
|||
struct wlr_xdg_surface_v6 *base;
|
||||
struct wlr_xdg_surface_v6 *parent;
|
||||
bool added;
|
||||
struct wlr_xdg_toplevel_v6_state next; // client protocol requests
|
||||
struct wlr_xdg_toplevel_v6_state pending; // user configure requests
|
||||
|
||||
struct wlr_xdg_toplevel_v6_state client_pending;
|
||||
struct wlr_xdg_toplevel_v6_state server_pending;
|
||||
struct wlr_xdg_toplevel_v6_state current;
|
||||
|
||||
char *title;
|
||||
char *app_id;
|
||||
|
||||
struct {
|
||||
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;
|
||||
struct wl_signal request_show_window_menu;
|
||||
} events;
|
||||
};
|
||||
|
||||
struct wlr_xdg_surface_v6_configure {
|
||||
|
|
@ -109,9 +140,6 @@ struct wlr_xdg_surface_v6 {
|
|||
uint32_t configure_next_serial;
|
||||
struct wl_list configure_list;
|
||||
|
||||
char *title;
|
||||
char *app_id;
|
||||
|
||||
bool has_next_geometry;
|
||||
struct wlr_box next_geometry;
|
||||
struct wlr_box geometry;
|
||||
|
|
@ -124,13 +152,6 @@ struct wlr_xdg_surface_v6 {
|
|||
struct wl_signal new_popup;
|
||||
struct wl_signal map;
|
||||
struct wl_signal unmap;
|
||||
|
||||
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;
|
||||
struct wl_signal request_show_window_menu;
|
||||
} events;
|
||||
|
||||
void *data;
|
||||
|
|
@ -226,4 +247,46 @@ struct wlr_xdg_surface_v6 *wlr_xdg_surface_v6_popup_at(
|
|||
struct wlr_xdg_surface_v6 *surface, double sx, double sy,
|
||||
double *popup_sx, double *popup_sy);
|
||||
|
||||
/**
|
||||
* Get the geometry for this positioner based on the anchor rect, gravity, and
|
||||
* size of this positioner.
|
||||
*/
|
||||
struct wlr_box wlr_xdg_positioner_v6_get_geometry(
|
||||
struct wlr_xdg_positioner_v6 *positioner);
|
||||
|
||||
/**
|
||||
* Get the anchor point for this popup in the toplevel parent's coordinate system.
|
||||
*/
|
||||
void wlr_xdg_popup_v6_get_anchor_point(struct wlr_xdg_popup_v6 *popup,
|
||||
int *toplevel_sx, int *toplevel_sy);
|
||||
|
||||
/**
|
||||
* Convert the given coordinates in the popup coordinate system to the toplevel
|
||||
* surface coordinate system.
|
||||
*/
|
||||
void wlr_xdg_popup_v6_get_toplevel_coords(struct wlr_xdg_popup_v6 *popup,
|
||||
int popup_sx, int popup_sy, int *toplevel_sx, int *toplevel_sy);
|
||||
|
||||
/**
|
||||
* Set the geometry of this popup to unconstrain it according to its
|
||||
* xdg-positioner rules. The box should be in the popup's root toplevel parent
|
||||
* surface coordinate system.
|
||||
*/
|
||||
void wlr_xdg_popup_v6_unconstrain_from_box(struct wlr_xdg_popup_v6 *popup,
|
||||
struct wlr_box *toplevel_sx_box);
|
||||
|
||||
/**
|
||||
Invert the right/left anchor and gravity for this positioner. This can be
|
||||
used to "flip" the positioner around the anchor rect in the x direction.
|
||||
*/
|
||||
void wlr_positioner_v6_invert_x(
|
||||
struct wlr_xdg_positioner_v6 *positioner);
|
||||
|
||||
/**
|
||||
Invert the top/bottom anchor and gravity for this positioner. This can be
|
||||
used to "flip" the positioner around the anchor rect in the y direction.
|
||||
*/
|
||||
void wlr_positioner_v6_invert_y(
|
||||
struct wlr_xdg_positioner_v6 *positioner);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -126,8 +126,8 @@ struct wlr_xwayland_surface {
|
|||
struct wl_signal request_maximize;
|
||||
struct wl_signal request_fullscreen;
|
||||
|
||||
struct wl_signal map_notify;
|
||||
struct wl_signal unmap_notify;
|
||||
struct wl_signal map;
|
||||
struct wl_signal unmap;
|
||||
struct wl_signal set_title;
|
||||
struct wl_signal set_class;
|
||||
struct wl_signal set_parent;
|
||||
|
|
@ -166,21 +166,23 @@ void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland,
|
|||
int32_t hotspot_x, int32_t hotspot_y);
|
||||
|
||||
void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *surface,
|
||||
bool activated);
|
||||
bool activated);
|
||||
|
||||
void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *surface,
|
||||
int16_t x, int16_t y, uint16_t width, uint16_t height);
|
||||
int16_t x, int16_t y, uint16_t width, uint16_t height);
|
||||
|
||||
void wlr_xwayland_surface_close(struct wlr_xwayland_surface *surface);
|
||||
|
||||
void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface,
|
||||
bool maximized);
|
||||
bool maximized);
|
||||
|
||||
void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface,
|
||||
bool fullscreen);
|
||||
bool fullscreen);
|
||||
|
||||
void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
|
||||
struct wlr_seat *seat);
|
||||
struct wlr_seat *seat);
|
||||
|
||||
bool wlr_xwayland_surface_is_unmanaged(
|
||||
const struct wlr_xwayland_surface *surface);
|
||||
|
||||
bool wlr_xwayland_surface_is_unmanaged(const struct wlr_xwayland_surface *surface);
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue