mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
parent
5adf325333
commit
8ccbe45143
4 changed files with 7 additions and 13 deletions
|
@ -103,7 +103,7 @@ bool wlr_buffer_get_shm(struct wlr_buffer *buffer,
|
|||
*
|
||||
* The provided struct wl_resource must be a wl_buffer.
|
||||
*/
|
||||
struct wlr_buffer *wlr_buffer_from_resource(struct wl_resource *resource);
|
||||
struct wlr_buffer *wlr_buffer_try_from_resource(struct wl_resource *resource);
|
||||
|
||||
/**
|
||||
* Buffer data pointer access flags.
|
||||
|
@ -160,9 +160,5 @@ struct wlr_client_buffer {
|
|||
* buffer, returns NULL.
|
||||
*/
|
||||
struct wlr_client_buffer *wlr_client_buffer_get(struct wlr_buffer *buffer);
|
||||
/**
|
||||
* Check if a resource is a wl_buffer resource.
|
||||
*/
|
||||
bool wlr_resource_is_buffer(struct wl_resource *resource);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
#include <wlr/util/log.h>
|
||||
#include "types/wlr_buffer.h"
|
||||
|
||||
bool wlr_resource_is_buffer(struct wl_resource *resource) {
|
||||
return strcmp(wl_resource_get_class(resource), wl_buffer_interface.name) == 0;
|
||||
}
|
||||
|
||||
/* struct wlr_buffer_resource_interface */
|
||||
static struct wl_array buffer_resource_interfaces = {0};
|
||||
|
||||
|
@ -43,8 +39,10 @@ static const struct wlr_buffer_resource_interface *get_buffer_resource_iface(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct wlr_buffer *wlr_buffer_from_resource(struct wl_resource *resource) {
|
||||
assert(resource && wlr_resource_is_buffer(resource));
|
||||
struct wlr_buffer *wlr_buffer_try_from_resource(struct wl_resource *resource) {
|
||||
if (strcmp(wl_resource_get_class(resource), wl_buffer_interface.name) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const struct wlr_buffer_resource_interface *iface =
|
||||
get_buffer_resource_iface(resource);
|
||||
|
|
|
@ -61,7 +61,7 @@ static void surface_handle_attach(struct wl_client *client,
|
|||
|
||||
struct wlr_buffer *buffer = NULL;
|
||||
if (buffer_resource != NULL) {
|
||||
buffer = wlr_buffer_from_resource(buffer_resource);
|
||||
buffer = wlr_buffer_try_from_resource(buffer_resource);
|
||||
if (buffer == NULL) {
|
||||
wl_resource_post_error(buffer_resource, 0, "unknown buffer type");
|
||||
return;
|
||||
|
|
|
@ -350,7 +350,7 @@ static void frame_handle_copy(struct wl_client *wl_client,
|
|||
return;
|
||||
}
|
||||
|
||||
struct wlr_buffer *buffer = wlr_buffer_from_resource(buffer_resource);
|
||||
struct wlr_buffer *buffer = wlr_buffer_try_from_resource(buffer_resource);
|
||||
if (buffer == NULL) {
|
||||
wl_resource_post_error(frame->resource,
|
||||
ZWLR_SCREENCOPY_FRAME_V1_ERROR_INVALID_BUFFER,
|
||||
|
|
Loading…
Reference in a new issue