mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-10-02 16:23:57 +08:00
wayland: Basic support for zwp_tablet_*v2 protocol
This commit is contained in:
committed by
Ethan Lee
parent
13337e17a5
commit
9125b244e7
File diff suppressed because it is too large
Load Diff
@@ -29,6 +29,34 @@
|
||||
#include "SDL_waylanddatamanager.h"
|
||||
#include "SDL_waylandkeyboard.h"
|
||||
|
||||
struct SDL_WaylandTabletSeat;
|
||||
|
||||
struct SDL_WaylandTabletObjectListNode {
|
||||
void* object;
|
||||
struct SDL_WaylandTabletObjectListNode* next;
|
||||
};
|
||||
|
||||
struct SDL_WaylandTabletInput {
|
||||
struct SDL_WaylandTabletSeat* seat;
|
||||
|
||||
struct SDL_WaylandTabletObjectListNode* tablets;
|
||||
struct SDL_WaylandTabletObjectListNode* tools;
|
||||
struct SDL_WaylandTabletObjectListNode* pads;
|
||||
|
||||
SDL_WindowData *tool_focus;
|
||||
uint32_t tool_prox_serial;
|
||||
|
||||
/* Last motion location */
|
||||
wl_fixed_t sx_w;
|
||||
wl_fixed_t sy_w;
|
||||
|
||||
SDL_bool is_down;
|
||||
|
||||
SDL_bool btn_stylus;
|
||||
SDL_bool btn_stylus2;
|
||||
SDL_bool btn_stylus3;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
// repeat_rate in range of [1, 1000]
|
||||
int32_t repeat_rate;
|
||||
@@ -80,6 +108,8 @@ struct SDL_WaylandInput {
|
||||
} pointer_curr_axis_info;
|
||||
|
||||
SDL_WaylandKeyboardRepeat keyboard_repeat;
|
||||
|
||||
struct SDL_WaylandTabletInput* tablet;
|
||||
};
|
||||
|
||||
extern void Wayland_PumpEvents(_THIS);
|
||||
@@ -107,6 +137,9 @@ extern void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d);
|
||||
extern int Wayland_input_grab_keyboard(SDL_Window *window, struct SDL_WaylandInput *input);
|
||||
extern int Wayland_input_ungrab_keyboard(SDL_Window *window);
|
||||
|
||||
extern void Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_WaylandTabletManager* tablet_manager);
|
||||
extern void Wayland_input_destroy_tablet(struct SDL_WaylandInput *input);
|
||||
|
||||
#endif /* SDL_waylandevents_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
#include "idle-inhibit-unstable-v1-client-protocol.h"
|
||||
#include "xdg-activation-v1-client-protocol.h"
|
||||
#include "text-input-unstable-v3-client-protocol.h"
|
||||
#include "tablet-unstable-v2-client-protocol.h"
|
||||
|
||||
#ifdef HAVE_LIBDECOR_H
|
||||
#include <libdecor.h>
|
||||
@@ -610,6 +611,11 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
|
||||
Wayland_add_data_device_manager(d, id, version);
|
||||
} else if (SDL_strcmp(interface, "zxdg_decoration_manager_v1") == 0) {
|
||||
d->decoration_manager = wl_registry_bind(d->registry, id, &zxdg_decoration_manager_v1_interface, 1);
|
||||
} else if (SDL_strcmp(interface, "zwp_tablet_manager_v2") == 0) {
|
||||
d->tablet_manager = wl_registry_bind(d->registry, id, &zwp_tablet_manager_v2_interface, 1);
|
||||
if (d->input) {
|
||||
Wayland_input_add_tablet(d->input, d->tablet_manager);
|
||||
}
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||
} else if (SDL_strcmp(interface, "qt_touch_extension") == 0) {
|
||||
@@ -769,6 +775,9 @@ Wayland_VideoQuit(_THIS)
|
||||
Wayland_touch_destroy(data);
|
||||
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
|
||||
|
||||
if (data->tablet_manager)
|
||||
zwp_tablet_manager_v2_destroy((struct zwp_tablet_manager_v2*)data->tablet_manager);
|
||||
|
||||
if (data->data_device_manager)
|
||||
wl_data_device_manager_destroy(data->data_device_manager);
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
struct xkb_context;
|
||||
struct SDL_WaylandInput;
|
||||
struct SDL_WaylandTabletManager;
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||
struct SDL_WaylandTouch;
|
||||
@@ -77,6 +78,7 @@ typedef struct {
|
||||
|
||||
struct xkb_context *xkb_context;
|
||||
struct SDL_WaylandInput *input;
|
||||
struct SDL_WaylandTabletManager *tablet_manager;
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
|
||||
struct SDL_WaylandTouch *touch;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user