[PATCH keyboard] Fix detect CustomKeycodes = True for Linux ifdef __powerpc__

Peter Hutterer peter.hutterer at who-t.net
Sun Jan 9 15:59:42 PST 2011


On Sat, Jan 08, 2011 at 05:42:18PM +0500, Alexandr Shadchin wrote:
> either to remove the block ifdef __powerpc__ in lnx_kbd.c
> because it is meaningless.

why not just replace the one instance where CustomKeycodes is set to TRUE
with the call to xf86AddNewOption()? so pKbd->CustomKeycodes always comes
from the option and we can remove pretty much all other instances.

Cheers,
  Peter

> Signed-off-by: Alexandr Shadchin <Alexandr.Shadchin at gmail.com>
> ---
>  src/kbd.c     |    8 +++++---
>  src/lnx_kbd.c |    2 ++
>  2 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/src/kbd.c b/src/kbd.c
> index f4b51ff..b261b2b 100644
> --- a/src/kbd.c
> +++ b/src/kbd.c
> @@ -89,7 +89,6 @@ static const char *kbdDefaults[] = {
>      "XkbRules",		"base",
>      "XkbModel",		"pc105",
>      "XkbLayout",	"us",
> -    "CustomKeycodes",	"off",
>      NULL
>  };
>  
> @@ -102,7 +101,6 @@ static const char *kbd98Defaults[] = {
>      "XkbRules",		"xfree98",
>      "XkbModel",		"pc98",
>      "XkbLayout",	"jp",
> -    "CustomKeycodes",	"off",
>      NULL
>  };
>  
> @@ -193,6 +191,11 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
>          goto out;
>      }
>  
> +    if (!xf86FindOption(pInfo->options, "CustomKeycodes")) {
> +        xf86AddNewOption(pInfo->options, "CustomKeycodes",
> +                         pKbd->CustomKeycodes ? "on" : "off");
> +    }
> +
>      if (!pKbd->OpenKeyboard(pInfo)) {
>          rc = BadMatch;
>          goto out;
> @@ -220,7 +223,6 @@ KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
>      xkb_variant = xf86SetStrOption(pInfo->options, "XkbVariant", NULL);
>      xkb_options = xf86SetStrOption(pInfo->options, "XkbOptions", NULL);
>  
> -  pKbd->CustomKeycodes = FALSE;
>    from = X_DEFAULT; 
>    if (xf86FindOption(pInfo->options, "CustomKeycodes")) {
>        pKbd->CustomKeycodes = xf86SetBoolOption(pInfo->options, "CustomKeycodes",
> diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c
> index 63b51d9..81e24ec 100644
> --- a/src/lnx_kbd.c
> +++ b/src/lnx_kbd.c
> @@ -221,6 +221,8 @@ xf86OSKbdPreInit(InputInfoPtr pInfo)
>  
>      pKbd->OpenKeyboard = OpenKeyboard;
>  
> +    pKbd->CustomKeycodes = FALSE;
> +
>      pKbd->private = calloc(sizeof(LnxKbdPrivRec), 1);
>      if (pKbd->private == NULL) {
>         xf86Msg(X_ERROR,"can't allocate keyboard OS private data\n");
> -- 
> 1.7.3.5


More information about the xorg-devel mailing list