[PATCH libXi 3/3] Silence compiler warning due to differnent event conversion procs
Peter Hutterer
peter.hutterer at who-t.net
Thu May 5 17:46:03 PDT 2011
XExtInt.c:161:5: warning: initialization from incompatible pointer type
XSndExEv.c: In function 'XSendExtensionEvent':
XSndExEv.c:84:8: warning: assignment from incompatible pointer type
Xlib and libXi differ in the conversion functions. libXi takes an xEvent**
and a num_events parameter since it may split an event into multiple
xEvents.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
src/XExtInt.c | 4 +++-
src/XSndExEv.c | 11 ++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 55144c6..32df6f9 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -149,6 +149,8 @@ wireToPropertyEvent(xXIPropertyEvent *in, XGenericEventCookie *cookie);
static /* const */ XEvent emptyevent;
+typedef Status (*core_event_to_wire)(Display*, XEvent*, xEvent*);
+
static /* const */ XExtensionHooks xinput_extension_hooks = {
NULL, /* create_gc */
NULL, /* copy_gc */
@@ -158,7 +160,7 @@ static /* const */ XExtensionHooks xinput_extension_hooks = {
NULL, /* free_font */
XInputClose, /* close_display */
XInputWireToEvent, /* wire_to_event */
- _XiEventToWire, /* event_to_wire */
+ (core_event_to_wire)_XiEventToWire, /* event_to_wire */
NULL, /* error */
XInputError, /* error_string */
};
diff --git a/src/XSndExEv.c b/src/XSndExEv.c
index ebaab33..e21f8f7 100644
--- a/src/XSndExEv.c
+++ b/src/XSndExEv.c
@@ -57,6 +57,11 @@ SOFTWARE.
#include <X11/extensions/extutil.h>
#include "XIint.h"
+/* Xlib's wire_vec is defined for a single event only, libXi may return
+ * multiple events.
+ */
+typedef Status (*ext_event_to_wire)(Display*, XEvent*, xEvent**, int*);
+
Status
XSendExtensionEvent(
register Display *dpy,
@@ -71,7 +76,7 @@ XSendExtensionEvent(
int ev_size;
xSendExtensionEventReq *req;
xEvent *ev;
- register Status(**fp) (Display *, XEvent*, xEvent **, int *);
+ ext_event_to_wire *fp;
Status status;
XExtDisplayInfo *info = XInput_find_display(dpy);
@@ -81,10 +86,10 @@ XSendExtensionEvent(
/* call through display to find proper conversion routine */
- fp = &dpy->wire_vec[event->type & 0177];
+ fp = (ext_event_to_wire*)&dpy->wire_vec[event->type & 0177];
if (*fp == NULL)
*fp = _XiEventToWire;
- status = (**fp) (dpy, event, &ev, &num_events);
+ status = (*fp) (dpy, event, &ev, &num_events);
if (status) {
GetReq(SendExtensionEvent, req);
--
1.7.4.4
More information about the xorg-devel
mailing list