Re: [PATCH keyboard] Adjust to input ABI 12.

2010-11-17 Thread Chase Douglas
On 11/16/2010 07:11 PM, Peter Hutterer wrote:
 New PreInit prototype and a few other things.
 
 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
 ---
 Sorry, had this on my local tree and never pushed it, hence why I didn't
 notice the build breaks.
 
 Cheers,
   Peter
 
  src/kbd.c |   80 
 +
  1 files changed, 59 insertions(+), 21 deletions(-)
 
 diff --git a/src/kbd.c b/src/kbd.c
 index e0b7003..62ce0c4 100644
 --- a/src/kbd.c
 +++ b/src/kbd.c
 @@ -49,7 +49,11 @@
  /* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */
  #define INITFLAG (1U  31)
  
 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
  static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
 +#else
 +static int KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
 +#endif
  static int KbdProc(DeviceIntPtr device, int what);
  static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
  static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused);
 @@ -125,21 +129,52 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char 
 **option)
  }
  }
  
 +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
 +static int
 +NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)

Has this been test built against  12? I think you're missing a
semicolon here.

-- Chase
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


Re: [PATCH keyboard] Adjust to input ABI 12.

2010-11-17 Thread Cyril Brulebois
Chase Douglas chase.doug...@canonical.com (17/11/2010):
  +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
  +static int
  +NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
 
 Has this been test built against  12? I think you're missing a
 semicolon here.

Indeed, and it builds fine once the semicolon added.

Mraw,
KiBi.


signature.asc
Description: Digital signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH keyboard] Adjust to input ABI 12.

2010-11-17 Thread Peter Hutterer
On Wed, Nov 17, 2010 at 01:51:19PM -0500, Chase Douglas wrote:
 On 11/16/2010 07:11 PM, Peter Hutterer wrote:
  New PreInit prototype and a few other things.
  
  Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
  ---
  Sorry, had this on my local tree and never pushed it, hence why I didn't
  notice the build breaks.
  
  Cheers,
Peter
  
   src/kbd.c |   80 
  +
   1 files changed, 59 insertions(+), 21 deletions(-)
  
  diff --git a/src/kbd.c b/src/kbd.c
  index e0b7003..62ce0c4 100644
  --- a/src/kbd.c
  +++ b/src/kbd.c
  @@ -49,7 +49,11 @@
   /* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */
   #define INITFLAG   (1U  31)
   
  +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
   static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
  +#else
  +static int KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
  +#endif
   static int KbdProc(DeviceIntPtr device, int what);
   static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
   static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int 
  unused);
  @@ -125,21 +129,52 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char 
  **option)
   }
   }
   
  +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
  +static int
  +NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
 
 Has this been test built against  12? I think you're missing a
 semicolon here.

oops. I thought I had, but I must have only tested for ABI 12. Will do tests
for both and re-send. thanks for catching this.

Cheers,
  Peter
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH keyboard] Adjust to input ABI 12.

2010-11-16 Thread Peter Hutterer
New PreInit prototype and a few other things.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
Sorry, had this on my local tree and never pushed it, hence why I didn't
notice the build breaks.

Cheers,
  Peter

 src/kbd.c |   80 +
 1 files changed, 59 insertions(+), 21 deletions(-)

diff --git a/src/kbd.c b/src/kbd.c
index e0b7003..62ce0c4 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -49,7 +49,11 @@
 /* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */
 #define INITFLAG   (1U  31)
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
 static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
+#else
+static int KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
+#endif
 static int KbdProc(DeviceIntPtr device, int what);
 static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
 static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused);
@@ -125,21 +129,52 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char 
**option)
 }
 }
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
+static int
+NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+
 static InputInfoPtr
 KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 {
 InputInfoPtr pInfo;
-KbdDevPtr pKbd;
-MessageType from = X_DEFAULT;
-char *s;
 
 if (!(pInfo = xf86AllocateInput(drv, 0)))
return NULL;
 
-/* Initialise the InputInfoRec. */
 pInfo-name = dev-identifier;
-pInfo-type_name = XI_KEYBOARD;
 pInfo-flags = XI86_KEYBOARD_CAPABLE;
+pInfo-conversion_proc = NULL;
+pInfo-reverse_conversion_proc = NULL;
+pInfo-private_flags = 0;
+pInfo-always_core_feedback = NULL;
+pInfo-conf_idev = dev;
+pInfo-close_proc = NULL;
+
+if (NewKbdPreInit(drv, pInfo, flags) == Success)
+{
+pInfo-flags |= XI86_CONFIGURED;
+return pInfo;
+}
+
+xf86DeleteInput(pInfo, 0);
+return NULL;
+}
+
+static int
+NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#else
+static int
+KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#endif
+{
+KbdDevPtr pKbd;
+MessageType from = X_DEFAULT;
+char *s;
+const char **defaults;
+int rc = Success;
+
+/* Initialise the InputInfoRec. */
+pInfo-type_name = XI_KEYBOARD;
 pInfo-device_control = KbdProc;
 /*
  * We don't specify our own read_input function. We expect
@@ -147,33 +182,37 @@ KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
  */
 pInfo-read_input = NULL;
 pInfo-control_proc = NULL;
-pInfo-close_proc = NULL;
 pInfo-switch_mode = NULL;
-pInfo-conversion_proc = NULL;
-pInfo-reverse_conversion_proc = NULL;
 pInfo-fd = -1;
 pInfo-dev = NULL;
-pInfo-private_flags = 0;
-pInfo-always_core_feedback = NULL;
-pInfo-conf_idev = dev;
 
 if (!xf86IsPc98())
-xf86CollectInputOptions(pInfo, kbdDefaults, NULL);
+defaults = kbdDefaults;
 else
-xf86CollectInputOptions(pInfo, kbd98Defaults, NULL);
+defaults = kbd98Defaults;
+xf86CollectInputOptions(pInfo, kbdDefaults
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
+, NULL
+#endif
+);
 xf86ProcessCommonOptions(pInfo, pInfo-options); 
 
-if (!(pKbd = calloc(sizeof(KbdDevRec), 1)))
-return pInfo;
+if (!(pKbd = calloc(sizeof(KbdDevRec), 1))) {
+rc = BadAlloc;
+goto out;
+}
 
 pInfo-private = pKbd;
 pKbd-PostEvent = PostKbdEvent;
 
-if (!xf86OSKbdPreInit(pInfo))
-return pInfo;
+if (!xf86OSKbdPreInit(pInfo)) {
+rc = BadAlloc;
+goto out;
+}
 
 if (!pKbd-OpenKeyboard(pInfo)) {
-return pInfo;
+rc = BadMatch;
+goto out;
 }
 
 if ((s = xf86SetStrOption(pInfo-options, XLeds, NULL))) {
@@ -209,9 +248,8 @@ KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
   xf86Msg(from, %s: CustomKeycodes %s\n,
pInfo-name, pKbd-CustomKeycodes ? enabled : disabled);
 
-  pInfo-flags |= XI86_CONFIGURED;
-
-  return pInfo;
+out:
+  return rc;
 }
 
 static void
-- 
1.7.3.2

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH keyboard] Adjust to input ABI 12.

2010-10-24 Thread Peter Hutterer
New PreInit prototype and a few other things.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
Alan, the current input-api branch is available on
people.freedesktop.org/~whot/xserver.git if you want to test this.



 src/kbd.c |   80 +
 1 files changed, 59 insertions(+), 21 deletions(-)

diff --git a/src/kbd.c b/src/kbd.c
index e0b7003..62ce0c4 100644
--- a/src/kbd.c
+++ b/src/kbd.c
@@ -49,7 +49,11 @@
 /* Used to know when the first DEVICE_ON after a DEVICE_INIT is called */
 #define INITFLAG   (1U  31)
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
 static InputInfoPtr KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags);
+#else
+static int KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags);
+#endif
 static int KbdProc(DeviceIntPtr device, int what);
 static void KbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl);
 static void KbdBell(int percent, DeviceIntPtr dev, pointer ctrl, int unused);
@@ -125,21 +129,52 @@ SetXkbOption(InputInfoPtr pInfo, char *name, char 
**option)
 }
 }
 
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
+static int
+NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+
 static InputInfoPtr
 KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
 {
 InputInfoPtr pInfo;
-KbdDevPtr pKbd;
-MessageType from = X_DEFAULT;
-char *s;
 
 if (!(pInfo = xf86AllocateInput(drv, 0)))
return NULL;
 
-/* Initialise the InputInfoRec. */
 pInfo-name = dev-identifier;
-pInfo-type_name = XI_KEYBOARD;
 pInfo-flags = XI86_KEYBOARD_CAPABLE;
+pInfo-conversion_proc = NULL;
+pInfo-reverse_conversion_proc = NULL;
+pInfo-private_flags = 0;
+pInfo-always_core_feedback = NULL;
+pInfo-conf_idev = dev;
+pInfo-close_proc = NULL;
+
+if (NewKbdPreInit(drv, pInfo, flags) == Success)
+{
+pInfo-flags |= XI86_CONFIGURED;
+return pInfo;
+}
+
+xf86DeleteInput(pInfo, 0);
+return NULL;
+}
+
+static int
+NewKbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#else
+static int
+KbdPreInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags)
+#endif
+{
+KbdDevPtr pKbd;
+MessageType from = X_DEFAULT;
+char *s;
+const char **defaults;
+int rc = Success;
+
+/* Initialise the InputInfoRec. */
+pInfo-type_name = XI_KEYBOARD;
 pInfo-device_control = KbdProc;
 /*
  * We don't specify our own read_input function. We expect
@@ -147,33 +182,37 @@ KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
  */
 pInfo-read_input = NULL;
 pInfo-control_proc = NULL;
-pInfo-close_proc = NULL;
 pInfo-switch_mode = NULL;
-pInfo-conversion_proc = NULL;
-pInfo-reverse_conversion_proc = NULL;
 pInfo-fd = -1;
 pInfo-dev = NULL;
-pInfo-private_flags = 0;
-pInfo-always_core_feedback = NULL;
-pInfo-conf_idev = dev;
 
 if (!xf86IsPc98())
-xf86CollectInputOptions(pInfo, kbdDefaults, NULL);
+defaults = kbdDefaults;
 else
-xf86CollectInputOptions(pInfo, kbd98Defaults, NULL);
+defaults = kbd98Defaults;
+xf86CollectInputOptions(pInfo, kbdDefaults
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION)  12
+, NULL
+#endif
+);
 xf86ProcessCommonOptions(pInfo, pInfo-options); 
 
-if (!(pKbd = calloc(sizeof(KbdDevRec), 1)))
-return pInfo;
+if (!(pKbd = calloc(sizeof(KbdDevRec), 1))) {
+rc = BadAlloc;
+goto out;
+}
 
 pInfo-private = pKbd;
 pKbd-PostEvent = PostKbdEvent;
 
-if (!xf86OSKbdPreInit(pInfo))
-return pInfo;
+if (!xf86OSKbdPreInit(pInfo)) {
+rc = BadAlloc;
+goto out;
+}
 
 if (!pKbd-OpenKeyboard(pInfo)) {
-return pInfo;
+rc = BadMatch;
+goto out;
 }
 
 if ((s = xf86SetStrOption(pInfo-options, XLeds, NULL))) {
@@ -209,9 +248,8 @@ KbdPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
   xf86Msg(from, %s: CustomKeycodes %s\n,
pInfo-name, pKbd-CustomKeycodes ? enabled : disabled);
 
-  pInfo-flags |= XI86_CONFIGURED;
-
-  return pInfo;
+out:
+  return rc;
 }
 
 static void
-- 
1.7.2.3

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel