types/wlr_input_device: move init and finish function to private API

master
Simon Zeni 3 years ago committed by Kirill Primak
parent 1bb2631c5c
commit cfed039c9a

@ -20,6 +20,7 @@
#include "pointer-gestures-unstable-v1-client-protocol.h" #include "pointer-gestures-unstable-v1-client-protocol.h"
#include "relative-pointer-unstable-v1-client-protocol.h" #include "relative-pointer-unstable-v1-client-protocol.h"
#include "interfaces/wlr_input_device.h"
#include "backend/wayland.h" #include "backend/wayland.h"
#include "util/signal.h" #include "util/signal.h"
#include "util/time.h" #include "util/time.h"

@ -0,0 +1,20 @@
#ifndef INTERFACES_INPUT_DEVICE_H
#define INTERFACES_INPUT_DEVICE_H
#include <wlr/types/wlr_input_device.h>
/**
* Initializes a given wlr_input_device. Allocates memory for the name and sets
* its vendor and product id to 0.
* wlr_device must be non-NULL.
*/
void wlr_input_device_init(struct wlr_input_device *wlr_device,
enum wlr_input_device_type type, const char *name);
/**
* Cleans up all the memory owned by a given wlr_input_device and signals
* the destroy event.
*/
void wlr_input_device_finish(struct wlr_input_device *wlr_device);
#endif

@ -10,7 +10,6 @@
#define WLR_BACKEND_HEADLESS_H #define WLR_BACKEND_HEADLESS_H
#include <wlr/backend.h> #include <wlr/backend.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
/** /**

@ -13,7 +13,8 @@
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/backend.h> #include <wlr/backend.h>
#include <wlr/backend/session.h> #include <wlr/backend/session.h>
#include <wlr/types/wlr_input_device.h>
struct wlr_input_device;
struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display, struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
struct wlr_session *session); struct wlr_session *session);

@ -4,9 +4,10 @@
#include <wayland-client.h> #include <wayland-client.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/backend.h> #include <wlr/backend.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
struct wlr_input_device;
/** /**
* Creates a new wlr_wl_backend. This backend will be created with no outputs; * Creates a new wlr_wl_backend. This backend will be created with no outputs;
* you must use wlr_wl_output_create to add them. * you must use wlr_wl_output_create to add them.

@ -6,9 +6,10 @@
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/backend.h> #include <wlr/backend.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
struct wlr_input_device;
/** /**
* Creates a new wlr_x11_backend. This backend will be created with no outputs; * Creates a new wlr_x11_backend. This backend will be created with no outputs;
* you must use wlr_x11_output_create to add them. * you must use wlr_x11_output_create to add them.

@ -10,10 +10,11 @@
#define WLR_TYPES_WLR_CURSOR_H #define WLR_TYPES_WLR_CURSOR_H
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h> #include <wlr/types/wlr_output.h>
struct wlr_input_device;
/** /**
* wlr_cursor implements the behavior of the "cursor", that is, the image on the * wlr_cursor implements the behavior of the "cursor", that is, the image on the
* screen typically moved about with a mouse or so. It provides tracking for * screen typically moved about with a mouse or so. It provides tracking for

@ -25,8 +25,6 @@ enum wlr_input_device_type {
WLR_INPUT_DEVICE_SWITCH, WLR_INPUT_DEVICE_SWITCH,
}; };
struct wlr_input_device_impl;
struct wlr_input_device { struct wlr_input_device {
enum wlr_input_device_type type; enum wlr_input_device_type type;
unsigned int vendor, product; unsigned int vendor, product;
@ -53,12 +51,4 @@ struct wlr_input_device {
void *data; void *data;
}; };
void wlr_input_device_init(struct wlr_input_device *wlr_device,
enum wlr_input_device_type type, const char *name);
/**
* Clean up all of the provided wlr_input_device resources
*/
void wlr_input_device_finish(struct wlr_input_device *wlr_device);
#endif #endif

@ -11,13 +11,14 @@
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_input_device.h>
#include "tablet-unstable-v2-protocol.h" #include "tablet-unstable-v2-protocol.h"
/* This can probably be even lower,the tools don't have a lot of buttons */ /* This can probably be even lower,the tools don't have a lot of buttons */
#define WLR_TABLET_V2_TOOL_BUTTONS_CAP 16 #define WLR_TABLET_V2_TOOL_BUTTONS_CAP 16
struct wlr_input_device;
struct wlr_tablet_pad_v2_grab_interface; struct wlr_tablet_pad_v2_grab_interface;
struct wlr_tablet_pad_v2_grab { struct wlr_tablet_pad_v2_grab {

@ -5,7 +5,6 @@
#include <time.h> #include <time.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_primary_selection.h> #include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_seat.h> #include <wlr/types/wlr_seat.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>

@ -5,7 +5,6 @@
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_data_device.h> #include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_data_device.h" #include "types/wlr_data_device.h"
#include "types/wlr_seat.h" #include "types/wlr_seat.h"

@ -5,7 +5,6 @@
#include <time.h> #include <time.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_seat.h" #include "types/wlr_seat.h"
#include "util/signal.h" #include "util/signal.h"

@ -5,7 +5,6 @@
#include <time.h> #include <time.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/types/wlr_compositor.h> #include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "types/wlr_seat.h" #include "types/wlr_seat.h"
#include "util/signal.h" #include "util/signal.h"

@ -2,7 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <wlr/types/wlr_input_device.h> #include "interfaces/wlr_input_device.h"
#include "util/signal.h" #include "util/signal.h"
void wlr_input_device_init(struct wlr_input_device *dev, void wlr_input_device_init(struct wlr_input_device *dev,

@ -5,8 +5,8 @@
#include <unistd.h> #include <unistd.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/interfaces/wlr_keyboard.h> #include <wlr/interfaces/wlr_keyboard.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "interfaces/wlr_input_device.h"
#include "types/wlr_keyboard.h" #include "types/wlr_keyboard.h"
#include "util/array.h" #include "util/array.h"
#include "util/shm.h" #include "util/shm.h"

@ -4,6 +4,8 @@
#include <wlr/interfaces/wlr_pointer.h> #include <wlr/interfaces/wlr_pointer.h>
#include <wlr/types/wlr_pointer.h> #include <wlr/types/wlr_pointer.h>
#include "interfaces/wlr_input_device.h"
void wlr_pointer_init(struct wlr_pointer *pointer, void wlr_pointer_init(struct wlr_pointer *pointer,
const struct wlr_pointer_impl *impl, const char *name) { const struct wlr_pointer_impl *impl, const char *name) {
wlr_input_device_init(&pointer->base, WLR_INPUT_DEVICE_POINTER, name); wlr_input_device_init(&pointer->base, WLR_INPUT_DEVICE_POINTER, name);

@ -4,6 +4,8 @@
#include <wlr/interfaces/wlr_switch.h> #include <wlr/interfaces/wlr_switch.h>
#include <wlr/types/wlr_switch.h> #include <wlr/types/wlr_switch.h>
#include "interfaces/wlr_input_device.h"
void wlr_switch_init(struct wlr_switch *switch_device, void wlr_switch_init(struct wlr_switch *switch_device,
const struct wlr_switch_impl *impl, const char *name) { const struct wlr_switch_impl *impl, const char *name) {
wlr_input_device_init(&switch_device->base, WLR_INPUT_DEVICE_SWITCH, name); wlr_input_device_init(&switch_device->base, WLR_INPUT_DEVICE_SWITCH, name);

@ -5,6 +5,8 @@
#include <wlr/types/wlr_tablet_pad.h> #include <wlr/types/wlr_tablet_pad.h>
#include <wlr/util/log.h> #include <wlr/util/log.h>
#include "interfaces/wlr_input_device.h"
void wlr_tablet_pad_init(struct wlr_tablet_pad *pad, void wlr_tablet_pad_init(struct wlr_tablet_pad *pad,
const struct wlr_tablet_pad_impl *impl, const char *name) { const struct wlr_tablet_pad_impl *impl, const char *name) {
wlr_input_device_init(&pad->base, WLR_INPUT_DEVICE_TABLET_PAD, name); wlr_input_device_init(&pad->base, WLR_INPUT_DEVICE_TABLET_PAD, name);

@ -4,6 +4,8 @@
#include <wlr/interfaces/wlr_tablet_tool.h> #include <wlr/interfaces/wlr_tablet_tool.h>
#include <wlr/types/wlr_tablet_tool.h> #include <wlr/types/wlr_tablet_tool.h>
#include "interfaces/wlr_input_device.h"
void wlr_tablet_init(struct wlr_tablet *tablet, void wlr_tablet_init(struct wlr_tablet *tablet,
const struct wlr_tablet_impl *impl, const char *name) { const struct wlr_tablet_impl *impl, const char *name) {
wlr_input_device_init(&tablet->base, WLR_INPUT_DEVICE_TABLET_TOOL, name); wlr_input_device_init(&tablet->base, WLR_INPUT_DEVICE_TABLET_TOOL, name);

@ -4,6 +4,8 @@
#include <wlr/interfaces/wlr_touch.h> #include <wlr/interfaces/wlr_touch.h>
#include <wlr/types/wlr_touch.h> #include <wlr/types/wlr_touch.h>
#include "interfaces/wlr_input_device.h"
void wlr_touch_init(struct wlr_touch *touch, void wlr_touch_init(struct wlr_touch *touch,
const struct wlr_touch_impl *impl, const char *name) { const struct wlr_touch_impl *impl, const char *name) {
wlr_input_device_init(&touch->base, WLR_INPUT_DEVICE_TOUCH, name); wlr_input_device_init(&touch->base, WLR_INPUT_DEVICE_TOUCH, name);

Loading…
Cancel
Save