xserver: Branch 'master' - 4 commits
Tiago Vignatti
vignatti at kemper.freedesktop.org
Tue Aug 7 00:24:43 PDT 2007
hw/kdrive/ephyr/ephyrinit.c | 29 +++++---
hw/kdrive/src/kdrive.c | 4 +
hw/kdrive/src/kdrive.h | 5 +
hw/kdrive/src/kinput.c | 153 ++++++++++++++++++++++++++++++++++----------
4 files changed, 146 insertions(+), 45 deletions(-)
New commits:
diff-tree 1339e57485db5a285cfbecbe0bba7154458680ad (from d9ee5f3e3a3a814ebcd257736c305b41139cc354)
Author: Tiago Vignatti <tiagov at balalaika.(none)>
Date: Tue Aug 7 04:24:34 2007 -0300
Fix typo.
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index df2ac5a..4377354 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1146,6 +1146,7 @@ KdParseKbdOptions (KdKeyboardInfo *ki)
for (option = ki->options; option; option = option->next)
{
+#ifdef XKB
if (strcasecmp(option->key, "XkbRules") == 0)
ki->xkbRules = option->value;
else if (strcasecmp(option->key, "XkbModel") == 0)
@@ -1156,7 +1157,8 @@ KdParseKbdOptions (KdKeyboardInfo *ki)
ki->xkbVariant = option->value;
else if (strcasecmp(option->key, "XkbOptions") == 0)
ki->xkbOptions = option->value;
- else
+ else
+#endif
ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
option->key, option->value);
}
diff-tree d9ee5f3e3a3a814ebcd257736c305b41139cc354 (from 7a5eb3e96b74daaaeb6babf46b13d698280aa3f6)
Author: Tiago Vignatti <tiagov at balalaika.(none)>
Date: Tue Aug 7 04:22:26 2007 -0300
Clean a little bit the code.
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index b84e989..df2ac5a 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -1105,6 +1105,40 @@ KdRemovePointer (KdPointerInfo *pi)
KdFreePointer(pi);
}
+static Bool
+KdGetOptions (InputOption **options, char *string)
+{
+ InputOption *newopt = NULL, **tmpo = NULL;
+ int tam_key = 0;
+
+ newopt = (InputOption *) xalloc(sizeof (InputOption));
+ if (!newopt)
+ return FALSE;
+
+ bzero(newopt, sizeof (InputOption));
+
+ for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next)
+ ; /* Hello, I'm here */
+ *tmpo = newopt;
+
+ if (strchr(string, '='))
+ {
+ tam_key = (strchr(string, '=') - string);
+ newopt->key = (char *)xalloc(tam_key);
+ strncpy(newopt->key, string, tam_key);
+ newopt->key[tam_key] = '\0';
+ newopt->value = xstrdup(strchr(string, '=') + 1);
+ }
+ else
+ {
+ newopt->key = xstrdup(string);
+ newopt->value = NULL;
+ }
+ newopt->next = NULL;
+
+ return TRUE;
+}
+
static void
KdParseKbdOptions (KdKeyboardInfo *ki)
{
@@ -1133,8 +1167,7 @@ KdParseKeyboard (char *arg)
{
char save[1024];
char delim;
- InputOption *options = NULL, *newopt = NULL, **tmpo = NULL;
- int i = 0;
+ InputOption *options = NULL;
KdKeyboardInfo *ki = NULL;
ki = KdNewKeyboard();
@@ -1188,32 +1221,11 @@ KdParseKeyboard (char *arg)
{
arg = KdParseFindNext (arg, ",", save, &delim);
- newopt = (InputOption *) xalloc(sizeof (InputOption));
- if (!newopt)
- {
- KdFreeKeyboard(ki);
- return NULL;
- }
- bzero(newopt, sizeof (InputOption));
-
- for (tmpo = &options; *tmpo; tmpo = &(*tmpo)->next)
- ; /* Hello, I'm here */
- *tmpo = newopt;
-
- if (strchr(save, '='))
- {
- i = (strchr(save, '=') - save);
- newopt->key = (char *)xalloc(i);
- strncpy(newopt->key, save, i);
- newopt->key[i] = '\0';
- newopt->value = xstrdup(strchr(save, '=') + 1);
- }
- else
- {
- newopt->key = xstrdup(save);
- newopt->value = NULL;
- }
- newopt->next = NULL;
+ if (!KdGetOptions(&options, save))
+ {
+ KdFreeKeyboard(ki);
+ return NULL;
+ }
}
if (options)
@@ -1252,7 +1264,7 @@ KdParsePointer (char *arg)
char save[1024];
char delim;
KdPointerInfo *pi = NULL;
- InputOption *options = NULL, *newopt = NULL, **tmpo = NULL;
+ InputOption *options = NULL;
int i = 0;
pi = KdNewPointer();
@@ -1314,33 +1326,11 @@ KdParsePointer (char *arg)
}
else
{
- newopt = (InputOption *) xalloc(sizeof (InputOption));
- if (!newopt)
+ if (!KdGetOptions(&options, save))
{
KdFreePointer(pi);
return NULL;
}
- bzero(newopt, sizeof (InputOption));
-
- for (tmpo = &options; *tmpo; tmpo = &(*tmpo)->next)
- ; /* Hello, I'm here */
-
- *tmpo = newopt;
-
- if (strchr(save, '='))
- {
- i = (strchr(save, '=') - save);
- newopt->key = (char *)xalloc(i);
- strncpy(newopt->key, save, i);
- newopt->key[i] = '\0';
- newopt->value = xstrdup(strchr(save, '=') + 1);
- }
- else
- {
- newopt->key = xstrdup(save);
- newopt->value = NULL;
- }
- newopt->next = NULL;
}
}
diff-tree 7a5eb3e96b74daaaeb6babf46b13d698280aa3f6 (from 955d5f6c0d14fae63bfe7c4ab39ee0a708919479)
Author: Tiago Vignatti <tiagov at balalaika.(none)>
Date: Tue Aug 7 02:16:44 2007 -0300
Let xkb options be passed through command line in kdrive servers. I start my
Xephyr using something like:
./hw/kdrive/ephyr/Xephyr :1 -fp /usr/share/fonts/X11/misc/ -mouse ephyr -keybd ephyr,,xkblayout=br,xkbmodel=abnt2
diff --git a/hw/kdrive/src/kdrive.h b/hw/kdrive/src/kdrive.h
index 2ebde22..21f9539 100644
--- a/hw/kdrive/src/kdrive.h
+++ b/hw/kdrive/src/kdrive.h
@@ -330,6 +330,11 @@ struct _KdKeyboardInfo {
int inputClass;
#ifdef XKB
XkbDescPtr xkb;
+ char *xkbRules;
+ char *xkbModel;
+ char *xkbLayout;
+ char *xkbVariant;
+ char *xkbOptions;
#endif
int LockLed;
diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c
index 8018bef..b84e989 100644
--- a/hw/kdrive/src/kinput.c
+++ b/hw/kdrive/src/kinput.c
@@ -792,7 +792,9 @@ KdKeyboardProc(DeviceIntPtr pDevice, int
if (!noXkbExtension) {
memset(&names, 0, sizeof(XkbComponentNamesRec));
- XkbSetRulesDflts ("base", "pc105", "us", NULL, NULL);
+ XkbSetRulesDflts (ki->xkbRules, ki->xkbModel, ki->xkbLayout,
+ ki->xkbVariant, ki->xkbOptions);
+
ret = XkbInitKeyboardDeviceStruct (pDevice,
&names,
&ki->keySyms,
@@ -961,6 +963,13 @@ KdNewKeyboard (void)
ki->bellDuration = 200;
ki->next = NULL;
ki->options = NULL;
+#ifdef XKB
+ ki->xkbRules = KdSaveString("base");
+ ki->xkbModel = KdSaveString("pc105");
+ ki->xkbLayout = KdSaveString("us");
+ ki->xkbVariant = NULL;
+ ki->xkbOptions = NULL;
+#endif
return ki;
}
@@ -1096,11 +1105,36 @@ KdRemovePointer (KdPointerInfo *pi)
KdFreePointer(pi);
}
+static void
+KdParseKbdOptions (KdKeyboardInfo *ki)
+{
+ InputOption *option = NULL;
+
+ for (option = ki->options; option; option = option->next)
+ {
+ if (strcasecmp(option->key, "XkbRules") == 0)
+ ki->xkbRules = option->value;
+ else if (strcasecmp(option->key, "XkbModel") == 0)
+ ki->xkbModel = option->value;
+ else if (strcasecmp(option->key, "XkbLayout") == 0)
+ ki->xkbLayout = option->value;
+ else if (strcasecmp(option->key, "XkbVariant") == 0)
+ ki->xkbVariant = option->value;
+ else if (strcasecmp(option->key, "XkbOptions") == 0)
+ ki->xkbOptions = option->value;
+ else
+ ErrorF("Kbd option key (%s) of value (%s) not assigned!\n",
+ option->key, option->value);
+ }
+}
+
KdKeyboardInfo *
KdParseKeyboard (char *arg)
{
char save[1024];
char delim;
+ InputOption *options = NULL, *newopt = NULL, **tmpo = NULL;
+ int i = 0;
KdKeyboardInfo *ki = NULL;
ki = KdNewKeyboard();
@@ -1143,11 +1177,75 @@ KdParseKeyboard (char *arg)
else
ki->driverPrivate = xstrdup(save);
- /* FIXME actually implement options */
+ if (delim != ',')
+ {
+ return ki;
+ }
+
+ arg = KdParseFindNext (arg, ",", save, &delim);
+
+ while (delim == ',')
+ {
+ arg = KdParseFindNext (arg, ",", save, &delim);
+
+ newopt = (InputOption *) xalloc(sizeof (InputOption));
+ if (!newopt)
+ {
+ KdFreeKeyboard(ki);
+ return NULL;
+ }
+ bzero(newopt, sizeof (InputOption));
+
+ for (tmpo = &options; *tmpo; tmpo = &(*tmpo)->next)
+ ; /* Hello, I'm here */
+ *tmpo = newopt;
+
+ if (strchr(save, '='))
+ {
+ i = (strchr(save, '=') - save);
+ newopt->key = (char *)xalloc(i);
+ strncpy(newopt->key, save, i);
+ newopt->key[i] = '\0';
+ newopt->value = xstrdup(strchr(save, '=') + 1);
+ }
+ else
+ {
+ newopt->key = xstrdup(save);
+ newopt->value = NULL;
+ }
+ newopt->next = NULL;
+ }
+
+ if (options)
+ {
+ ki->options = options;
+ KdParseKbdOptions(ki);
+ }
return ki;
}
+static void
+KdParsePointerOptions (KdPointerInfo *pi)
+{
+ InputOption *option = NULL;
+
+ for (option = pi->options; option; option = option->next)
+ {
+ if (!strcmp (option->key, "emulatemiddle"))
+ pi->emulateMiddleButton = TRUE;
+ else if (!strcmp (option->key, "noemulatemiddle"))
+ pi->emulateMiddleButton = FALSE;
+ else if (!strcmp (option->key, "transformcoord"))
+ pi->transformCoordinates = TRUE;
+ else if (!strcmp (option->key, "rawcoord"))
+ pi->transformCoordinates = FALSE;
+ else
+ ErrorF("Pointer option key (%s) of value (%s) not assigned!\n",
+ option->key, option->value);
+ }
+}
+
KdPointerInfo *
KdParsePointer (char *arg)
{
@@ -1214,14 +1312,6 @@ KdParsePointer (char *arg)
s++;
}
}
- else if (!strcmp (save, "emulatemiddle"))
- pi->emulateMiddleButton = TRUE;
- else if (!strcmp (save, "noemulatemiddle"))
- pi->emulateMiddleButton = FALSE;
- else if (!strcmp (save, "transformcoord"))
- pi->transformCoordinates = TRUE;
- else if (!strcmp (save, "rawcoord"))
- pi->transformCoordinates = FALSE;
else
{
newopt = (InputOption *) xalloc(sizeof (InputOption));
@@ -1255,7 +1345,10 @@ KdParsePointer (char *arg)
}
if (options)
+ {
pi->options = options;
+ KdParsePointerOptions(pi);
+ }
return pi;
}
diff-tree 955d5f6c0d14fae63bfe7c4ab39ee0a708919479 (from aa3c6aaaab213200591d29ddb2921adfb87ee5b4)
Author: Tiago Vignatti <tiagov at balalaika.(none)>
Date: Tue Aug 7 01:39:29 2007 -0300
When we call Xephyr with '-pointer' a new pointer is added inside the server
and the Xephyr virtual mouse keeps alive. With this patch the semantic changes
turning '-pointer' && 'Xephyr virtual mouse' always false.
Now we can open a device pointer and pass its options in Xephyr's command line
without having other pointer unused.
diff --git a/hw/kdrive/ephyr/ephyrinit.c b/hw/kdrive/ephyr/ephyrinit.c
index 45e2d30..850dc76 100644
--- a/hw/kdrive/ephyr/ephyrinit.c
+++ b/hw/kdrive/ephyr/ephyrinit.c
@@ -30,6 +30,8 @@
extern Window EphyrPreExistingHostWin;
extern Bool EphyrWantGrayScale;
+extern Bool kdHasPointer;
+extern Bool kdHasKbd;
void
InitCard (char *name)
@@ -54,19 +56,24 @@ InitInput (int argc, char **argv)
KdKeyboardInfo *ki;
KdPointerInfo *pi;
- ki = KdNewKeyboard();
- if (!ki)
- FatalError("Couldn't create Xephyr keyboard\n");
- ki->driver = &EphyrKeyboardDriver;
KdAddKeyboardDriver(&EphyrKeyboardDriver);
- KdAddKeyboard(ki);
-
- pi = KdNewPointer();
- if (!pi)
- FatalError("Couldn't create Xephyr pointer\n");
- pi->driver = &EphyrMouseDriver;
KdAddPointerDriver(&EphyrMouseDriver);
- KdAddPointer(pi);
+
+ if (!kdHasKbd) {
+ ki = KdNewKeyboard();
+ if (!ki)
+ FatalError("Couldn't create Xephyr keyboard\n");
+ ki->driver = &EphyrKeyboardDriver;
+ KdAddKeyboard(ki);
+ }
+
+ if (!kdHasPointer) {
+ pi = KdNewPointer();
+ if (!pi)
+ FatalError("Couldn't create Xephyr pointer\n");
+ pi->driver = &EphyrMouseDriver;
+ KdAddPointer(pi);
+ }
KdInitInput();
}
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c
index 8653d72..5158ef5 100644
--- a/hw/kdrive/src/kdrive.c
+++ b/hw/kdrive/src/kdrive.c
@@ -81,6 +81,8 @@ int kdVirtualTerminal = -1;
Bool kdSwitchPending;
char *kdSwitchCmd;
DDXPointRec kdOrigin;
+Bool kdHasPointer = FALSE;
+Bool kdHasKbd = FALSE;
static Bool kdCaughtSignal = FALSE;
@@ -737,12 +739,14 @@ KdProcessArgument (int argc, char **argv
if (i + 1 >= argc)
UseMsg();
KdAddConfigPointer(argv[i + 1]);
+ kdHasPointer = TRUE;
return 2;
}
if (!strcmp (argv[i], "-keybd")) {
if (i + 1 >= argc)
UseMsg();
KdAddConfigKeyboard(argv[i + 1]);
+ kdHasKbd = TRUE;
return 2;
}
More information about the xorg-commit
mailing list