winex11.drv: Use XIValuatorClassInfo instead of a custom struct.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2021-10-25 11:51:53 +02:00 committed by Alexandre Julliard
parent 7bc5b6800e
commit da11387857
3 changed files with 13 additions and 24 deletions

View file

@ -262,25 +262,13 @@ static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuator
for (i = 0; i < n_valuators; i++)
{
XIValuatorClassInfo *class = (XIValuatorClassInfo *)valuators[i];
struct x11drv_valuator_data *valuator_data = NULL;
if (valuators[i]->type != XIValuatorClass) continue;
if (class->label == x11drv_atom( Rel_X ) ||
(!class->label && class->number == 0 && class->mode == XIModeRelative))
{
valuator_data = &thread_data->x_rel_valuator;
}
thread_data->x_rel_valuator = *class;
else if (class->label == x11drv_atom( Rel_Y ) ||
(!class->label && class->number == 1 && class->mode == XIModeRelative))
{
valuator_data = &thread_data->y_rel_valuator;
}
if (valuator_data) {
valuator_data->number = class->number;
valuator_data->min = class->min;
valuator_data->max = class->max;
}
thread_data->y_rel_valuator = *class;
}
}
#endif
@ -638,7 +626,7 @@ static BOOL map_raw_event_coords( XIRawEvent *event, INPUT *input )
{
struct x11drv_thread_data *thread_data = x11drv_thread_data();
const double *values = event->valuators.values;
struct x11drv_valuator_data *x_rel, *y_rel;
XIValuatorClassInfo *x_rel, *y_rel;
double dx = 0, dy = 0, val;
RECT virtual_rect;
int i;

View file

@ -36,6 +36,9 @@
#ifdef HAVE_LIBXSHAPE
#include <X11/extensions/shape.h>
#endif /* HAVE_LIBXSHAPE */
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
#include <X11/extensions/XInput2.h>
#endif
/* avoid conflict with field names in included win32 headers */
#undef Status

View file

@ -32,6 +32,9 @@
#include <X11/Xresource.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
#include <X11/extensions/XInput2.h>
#endif
#define BOOL X_BOOL
#define BYTE X_BYTE
@ -314,13 +317,6 @@ struct x11drv_escape_flush_gl_drawable
* X11 USER driver
*/
struct x11drv_valuator_data
{
double min;
double max;
int number;
};
struct x11drv_thread_data
{
Display *display;
@ -335,13 +331,15 @@ struct x11drv_thread_data
Window clip_window; /* window used for cursor clipping */
HWND clip_hwnd; /* message window stored in desktop while clipping is active */
DWORD clip_reset; /* time when clipping was last reset */
#ifdef HAVE_X11_EXTENSIONS_XINPUT2_H
enum { xi_unavailable = -1, xi_unknown, xi_disabled, xi_enabled } xi2_state; /* XInput2 state */
void *xi2_devices; /* list of XInput2 devices (valid when state is enabled) */
int xi2_device_count;
struct x11drv_valuator_data x_rel_valuator;
struct x11drv_valuator_data y_rel_valuator;
XIValuatorClassInfo x_rel_valuator;
XIValuatorClassInfo y_rel_valuator;
int xi2_core_pointer; /* XInput2 core pointer id */
int xi2_current_slave; /* Current slave driving the Core pointer */
#endif /* HAVE_X11_EXTENSIONS_XINPUT2_H */
};
extern struct x11drv_thread_data *x11drv_init_thread_data(void) DECLSPEC_HIDDEN;