mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-03 06:46:38 -04:00
opt: remove dead code from tablet.h
This commit is contained in:
parent
19a9cb19a1
commit
cdf5f95e25
1 changed files with 2 additions and 35 deletions
|
|
@ -2,9 +2,6 @@
|
||||||
#include <wlr/types/wlr_tablet_tool.h>
|
#include <wlr/types/wlr_tablet_tool.h>
|
||||||
#include <wlr/types/wlr_tablet_v2.h>
|
#include <wlr/types/wlr_tablet_v2.h>
|
||||||
|
|
||||||
static const int tabletmaptosurface =
|
|
||||||
0; /* map tablet input to surface(1) or monitor(0) */
|
|
||||||
|
|
||||||
static void createtablet(struct wlr_input_device *device);
|
static void createtablet(struct wlr_input_device *device);
|
||||||
static void destroytablet(struct wl_listener *listener, void *data);
|
static void destroytablet(struct wl_listener *listener, void *data);
|
||||||
static void destroytabletsurfacenotify(struct wl_listener *listener,
|
static void destroytabletsurfacenotify(struct wl_listener *listener,
|
||||||
|
|
@ -44,8 +41,8 @@ void createtablet(struct wlr_input_device *device) {
|
||||||
wl_signal_add(&tablet->wlr_device->events.destroy,
|
wl_signal_add(&tablet->wlr_device->events.destroy,
|
||||||
&tablet_device_destroy);
|
&tablet_device_destroy);
|
||||||
if (libinput_device_config_send_events_get_modes(device_handle)) {
|
if (libinput_device_config_send_events_get_modes(device_handle)) {
|
||||||
libinput_device_config_send_events_set_mode(device_handle,
|
libinput_device_config_send_events_set_mode(
|
||||||
config.send_events_mode);
|
device_handle, config.send_events_mode);
|
||||||
wlr_cursor_attach_input_device(cursor, device);
|
wlr_cursor_attach_input_device(cursor, device);
|
||||||
}
|
}
|
||||||
} else if (device == tablet->wlr_device) {
|
} else if (device == tablet->wlr_device) {
|
||||||
|
|
@ -71,32 +68,6 @@ void destroytablettool(struct wl_listener *listener, void *data) {
|
||||||
tablet_tool = NULL;
|
tablet_tool = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void tabletapplymap(double tablet_width, double tablet_height,
|
|
||||||
struct wlr_fbox box, double *x, double *y) {
|
|
||||||
if ((!box.x && !box.y && !box.width && !box.height) || !tablet_width ||
|
|
||||||
!tablet_height) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!box.width) {
|
|
||||||
box.width = tablet_width - box.x;
|
|
||||||
}
|
|
||||||
if (!box.height) {
|
|
||||||
box.height = tablet_height - box.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (box.x + box.width <= tablet_width) {
|
|
||||||
const double max_x = 1;
|
|
||||||
double width_offset = max_x * box.x / tablet_width;
|
|
||||||
*x = (*x - width_offset) * tablet_width / box.width;
|
|
||||||
}
|
|
||||||
if (box.y + box.height <= tablet_height) {
|
|
||||||
const double max_y = 1;
|
|
||||||
double height_offset = max_y * box.y / tablet_height;
|
|
||||||
*y = (*y - height_offset) * tablet_height / box.height;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void tablettoolmotion(struct wlr_tablet_v2_tablet_tool *tool, bool change_x,
|
void tablettoolmotion(struct wlr_tablet_v2_tablet_tool *tool, bool change_x,
|
||||||
bool change_y, double x, double y, double dx, double dy) {
|
bool change_y, double x, double y, double dx, double dy) {
|
||||||
struct wlr_surface *surface = NULL;
|
struct wlr_surface *surface = NULL;
|
||||||
|
|
@ -107,9 +78,6 @@ void tablettoolmotion(struct wlr_tablet_v2_tablet_tool *tool, bool change_x,
|
||||||
if (!change_x && !change_y)
|
if (!change_x && !change_y)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tabletapplymap(tablet->wlr_tablet->width_mm, tablet->wlr_tablet->height_mm,
|
|
||||||
(struct wlr_fbox){0}, &x, &y);
|
|
||||||
|
|
||||||
// TODO: apply constraints
|
// TODO: apply constraints
|
||||||
switch (tablet_tool->wlr_tool->type) {
|
switch (tablet_tool->wlr_tool->type) {
|
||||||
case WLR_TABLET_TOOL_TYPE_LENS:
|
case WLR_TABLET_TOOL_TYPE_LENS:
|
||||||
|
|
@ -209,7 +177,6 @@ void tablettoolaxis(struct wl_listener *listener, void *data) {
|
||||||
wlr_tablet_v2_tablet_tool_notify_distance(tablet_tool, event->distance);
|
wlr_tablet_v2_tablet_tool_notify_distance(tablet_tool, event->distance);
|
||||||
if (event->updated_axes &
|
if (event->updated_axes &
|
||||||
(WLR_TABLET_TOOL_AXIS_TILT_X | WLR_TABLET_TOOL_AXIS_TILT_Y)) {
|
(WLR_TABLET_TOOL_AXIS_TILT_X | WLR_TABLET_TOOL_AXIS_TILT_Y)) {
|
||||||
printf("DEBUGGING: In axis event handling\n");
|
|
||||||
wlr_tablet_v2_tablet_tool_notify_tilt(tablet_tool, event->tilt_x,
|
wlr_tablet_v2_tablet_tool_notify_tilt(tablet_tool, event->tilt_x,
|
||||||
event->tilt_y);
|
event->tilt_y);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue