mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-14 08:56:26 -05:00
Add free functions for allocated resources
This commit is contained in:
parent
1e8970b4a9
commit
1aed987301
10 changed files with 96 additions and 10 deletions
|
|
@ -1,6 +1,8 @@
|
|||
#define _XOPEN_SOURCE 500
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <wayland-client.h>
|
||||
#include "backend/wayland.h"
|
||||
#include "common/log.h"
|
||||
|
|
@ -13,6 +15,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
|||
assert(backend);
|
||||
|
||||
if ((caps & WL_SEAT_CAPABILITY_POINTER)) {
|
||||
wlr_log(L_DEBUG, "seat %p offered pointer", wl_seat);
|
||||
struct wl_pointer *wl_pointer = wl_seat_get_pointer(wl_seat);
|
||||
struct wlr_wl_pointer *pointer;
|
||||
if (!(pointer = calloc(sizeof(struct wlr_wl_pointer), 1))) {
|
||||
|
|
@ -25,6 +28,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
|||
}
|
||||
|
||||
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD)) {
|
||||
wlr_log(L_DEBUG, "seat %p offered keyboard", wl_seat);
|
||||
struct wl_keyboard *wl_keyboard = wl_seat_get_keyboard(wl_seat);
|
||||
struct wlr_wl_keyboard *keyboard;
|
||||
if (!(keyboard = calloc(sizeof(struct wlr_wl_pointer), 1))) {
|
||||
|
|
@ -42,7 +46,7 @@ static void seat_handle_capabilities(void *data, struct wl_seat *wl_seat,
|
|||
static void seat_handle_name(void *data, struct wl_seat *wl_seat, const char *name) {
|
||||
struct wlr_wl_seat *seat = data;
|
||||
assert(seat->wl_seat == wl_seat);
|
||||
seat->name = name;
|
||||
seat->name = strdup(name);
|
||||
}
|
||||
|
||||
const struct wl_seat_listener seat_listener = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue