mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-09 23:22:22 +00:00
input: switch InputOption to use XF86OptionRec storage.
Use the same struct for both InputOption and XF86OptionRec so we don't need to convert to and fro the two in the config backends. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
parent
16ac78a53c
commit
c39c8d3428
10 changed files with 59 additions and 43 deletions
|
|
@ -44,6 +44,7 @@
|
|||
#include "xf86Xinput.h"
|
||||
#include "xf86Optrec.h"
|
||||
#include "xf86Parser.h"
|
||||
#include "optionstr.h"
|
||||
|
||||
static Bool ParseOptionValue(int scrnIndex, XF86OptionPtr options, OptionInfoPtr p,
|
||||
Bool markUsed);
|
||||
|
|
|
|||
|
|
@ -24,16 +24,7 @@
|
|||
|
||||
#ifndef XF86OPTIONSTR_H
|
||||
#define XF86OPTIONSTR_H
|
||||
|
||||
/*
|
||||
* all records that need to be linked lists should contain a GenericList as
|
||||
* their first field.
|
||||
*/
|
||||
typedef struct generic_list_rec
|
||||
{
|
||||
void *next;
|
||||
}
|
||||
GenericListRec, *GenericListPtr, *glp;
|
||||
#include "list.h"
|
||||
|
||||
/*
|
||||
* All options are stored using this data type.
|
||||
|
|
@ -48,6 +39,6 @@ typedef struct _XF86OptionRec
|
|||
}
|
||||
XF86OptionRec;
|
||||
|
||||
typedef struct _XF86OptionRec *XF86OptionPtr;
|
||||
typedef struct _InputOption *XF86OptionPtr;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
#include "exglobals.h"
|
||||
#include "eventstr.h"
|
||||
#include "inpututils.h"
|
||||
#include "optionstr.h"
|
||||
|
||||
#include <string.h> /* InputClassMatches */
|
||||
#ifdef HAVE_FNMATCH_H
|
||||
|
|
@ -908,7 +909,7 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
|
|||
if (!pInfo)
|
||||
return BadAlloc;
|
||||
|
||||
nt_list_for_each_entry(option, options, next) {
|
||||
nt_list_for_each_entry(option, options, list.next) {
|
||||
if (strcasecmp(input_option_get_key(option), "driver") == 0) {
|
||||
if (pInfo->driver) {
|
||||
rval = BadRequest;
|
||||
|
|
@ -946,7 +947,7 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs,
|
|||
}
|
||||
}
|
||||
|
||||
nt_list_for_each_entry(option, options, next) {
|
||||
nt_list_for_each_entry(option, options, list.next) {
|
||||
/* Copy option key/value strings from the provided list */
|
||||
pInfo->options = xf86AddNewOption(pInfo->options,
|
||||
input_option_get_key(option),
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@
|
|||
#include "Configint.h"
|
||||
#include <X11/Xfuncproto.h>
|
||||
#include "Xprintf.h"
|
||||
#include "optionstr.h"
|
||||
|
||||
extern LexRec val;
|
||||
|
||||
|
|
@ -203,7 +204,7 @@ addNewOption2 (XF86OptionPtr head, char *name, char *val, int used)
|
|||
free(new->opt_val);
|
||||
}
|
||||
else
|
||||
new = calloc (1, sizeof (XF86OptionRec));
|
||||
new = calloc (1, sizeof (*new));
|
||||
new->opt_name = name;
|
||||
new->opt_val = val;
|
||||
new->opt_used = used;
|
||||
|
|
@ -284,7 +285,7 @@ xf86newOption(char *name, char *value)
|
|||
{
|
||||
XF86OptionPtr opt;
|
||||
|
||||
opt = calloc(1, sizeof (XF86OptionRec));
|
||||
opt = calloc(1, sizeof (*opt));
|
||||
if (!opt)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
#include "xf86tokens.h"
|
||||
#include "Configint.h"
|
||||
#include <string.h>
|
||||
|
||||
#include "optionstr.h"
|
||||
|
||||
/* Needed for auto server layout */
|
||||
extern int xf86CheckBoolOption(void* optlist, const char *name, int deflt);
|
||||
|
|
|
|||
Loading…
Reference in a new issue