winex11: Simplify XInput2 device valuator lookup.
Valuator names aren't well specified, and although they are usually named "Rel X/Y" or "Abs X/Y", there are cases where the names are different. Lets just assume that the first two valuators are the X/Y axes, as it seems to be generally the case.
This commit is contained in:
parent
51e99345de
commit
165830c317
3 changed files with 10 additions and 15 deletions
|
@ -228,26 +228,25 @@ void set_window_cursor( Window window, HCURSOR handle )
|
|||
/***********************************************************************
|
||||
* update_relative_valuators
|
||||
*/
|
||||
static void update_relative_valuators(XIAnyClassInfo **valuators, int n_valuators)
|
||||
static void update_relative_valuators( XIAnyClassInfo **classes, int num_classes )
|
||||
{
|
||||
struct x11drv_thread_data *thread_data = x11drv_thread_data();
|
||||
int i;
|
||||
XIValuatorClassInfo *valuator;
|
||||
|
||||
thread_data->x_valuator.number = -1;
|
||||
thread_data->y_valuator.number = -1;
|
||||
|
||||
for (i = 0; i < n_valuators; i++)
|
||||
while (num_classes--)
|
||||
{
|
||||
XIValuatorClassInfo *class = (XIValuatorClassInfo *)valuators[i];
|
||||
if (valuators[i]->type != XIValuatorClass) continue;
|
||||
if (class->label == x11drv_atom( Rel_X ) ||
|
||||
(!class->label && class->number == 0 && class->mode == XIModeRelative))
|
||||
thread_data->x_valuator = *class;
|
||||
else if (class->label == x11drv_atom( Rel_Y ) ||
|
||||
(!class->label && class->number == 1 && class->mode == XIModeRelative))
|
||||
thread_data->y_valuator = *class;
|
||||
valuator = (XIValuatorClassInfo *)classes[num_classes];
|
||||
if (classes[num_classes]->type != XIValuatorClass) continue;
|
||||
if (valuator->number == 0 && valuator->mode == XIModeRelative) thread_data->x_valuator = *valuator;
|
||||
if (valuator->number == 1 && valuator->mode == XIModeRelative) thread_data->y_valuator = *valuator;
|
||||
}
|
||||
|
||||
if (thread_data->x_valuator.number < 0 || thread_data->y_valuator.number < 0)
|
||||
WARN( "X/Y axis valuators not found, ignoring RawMotion events\n" );
|
||||
|
||||
thread_data->x_valuator.value = 0;
|
||||
thread_data->y_valuator.value = 0;
|
||||
}
|
||||
|
|
|
@ -471,8 +471,6 @@ enum x11drv_atoms
|
|||
XATOM_RAW_ASCENT,
|
||||
XATOM_RAW_DESCENT,
|
||||
XATOM_RAW_CAP_HEIGHT,
|
||||
XATOM_Rel_X,
|
||||
XATOM_Rel_Y,
|
||||
XATOM_WM_PROTOCOLS,
|
||||
XATOM_WM_DELETE_WINDOW,
|
||||
XATOM_WM_STATE,
|
||||
|
|
|
@ -142,8 +142,6 @@ static const char * const atom_names[NB_XATOMS - FIRST_XATOM] =
|
|||
"RAW_ASCENT",
|
||||
"RAW_DESCENT",
|
||||
"RAW_CAP_HEIGHT",
|
||||
"Rel X",
|
||||
"Rel Y",
|
||||
"WM_PROTOCOLS",
|
||||
"WM_DELETE_WINDOW",
|
||||
"WM_STATE",
|
||||
|
|
Loading…
Add table
Reference in a new issue