diff options
author | emersion <contact@emersion.fr> | 2018-02-13 23:48:46 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2018-02-13 23:48:46 +0100 |
commit | 392d54a35d34ff08baaffdd50b9d11072481706e (patch) | |
tree | 22ae4924ab5486ee97c22f0ce0a15a1cf853e043 /include/wlr | |
parent | 71cba94e73022d8cef8651055204a4706377ae11 (diff) |
Wrap wl_resource_get_user_data into safer helper functions
This ensures we're not incorrectly casting a resource.
Fixes #628
Diffstat (limited to 'include/wlr')
-rw-r--r-- | include/wlr/types/wlr_output.h | 1 | ||||
-rw-r--r-- | include/wlr/types/wlr_region.h | 7 | ||||
-rw-r--r-- | include/wlr/types/wlr_seat.h | 2 | ||||
-rw-r--r-- | include/wlr/types/wlr_surface.h | 2 |
4 files changed, 10 insertions, 2 deletions
diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index 5c2ffee0..a8138a80 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -157,6 +157,7 @@ void wlr_output_set_gamma(struct wlr_output *output, uint32_t wlr_output_get_gamma_size(struct wlr_output *output); void wlr_output_set_fullscreen_surface(struct wlr_output *output, struct wlr_surface *surface); +struct wlr_output *wlr_output_from_resource(struct wl_resource *resource); struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output); diff --git a/include/wlr/types/wlr_region.h b/include/wlr/types/wlr_region.h index 6d59ee5e..ffacea72 100644 --- a/include/wlr/types/wlr_region.h +++ b/include/wlr/types/wlr_region.h @@ -1,13 +1,16 @@ #ifndef WLR_TYPES_WLR_REGION_H #define WLR_TYPES_WLR_REGION_H +#include <pixman.h> + struct wl_resource; /* * Implements the given resource as region. - * Sets the associated pixman_region32_t as userdata. */ void wlr_region_create(struct wl_client *client, struct wl_resource *res, - uint32_t id); + uint32_t id); + +pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource); #endif diff --git a/include/wlr/types/wlr_seat.h b/include/wlr/types/wlr_seat.h index b03cab6e..124c1cb8 100644 --- a/include/wlr/types/wlr_seat.h +++ b/include/wlr/types/wlr_seat.h @@ -530,4 +530,6 @@ bool wlr_seat_touch_has_grab(struct wlr_seat *seat); */ bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial); +struct wlr_seat_client *wlr_seat_client_from_resource(struct wl_resource *resource); + #endif diff --git a/include/wlr/types/wlr_surface.h b/include/wlr/types/wlr_surface.h index 998b5ae5..203345bd 100644 --- a/include/wlr/types/wlr_surface.h +++ b/include/wlr/types/wlr_surface.h @@ -164,4 +164,6 @@ void wlr_surface_set_role_committed(struct wlr_surface *surface, void (*role_committed)(struct wlr_surface *surface, void *role_data), void *role_data); +struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource); + #endif |