mirror of
https://github.com/X11Libre/xserver.git
synced 2026-04-14 17:18:09 +00:00
kdrive: correctly use keyboard driver proc return values
The Enable() and Init() procs are defined to return Bool, the actual functions (as well as their callers) are using X11 reply status codes, but practically using only one bit of information. This happens to magically works, because all involved types come down to plain int. Instead of relying on some black magic, better write clean and easily understandable code instead. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt, metux IT consult .
parent
11dd212a0e
commit
7ef19de104
@@ -26,6 +26,7 @@
|
||||
#include <dix-config.h>
|
||||
|
||||
#include <xcb/xcb_keysyms.h>
|
||||
#include <X11/Xdefs.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#include "mi/mipointer_priv.h"
|
||||
@@ -1316,7 +1317,7 @@ KdPointerDriver EphyrMouseDriver = {
|
||||
|
||||
/* Keyboard */
|
||||
|
||||
static Status
|
||||
static Bool
|
||||
EphyrKeyboardInit(KdKeyboardInfo * ki)
|
||||
{
|
||||
KeySymsRec keySyms;
|
||||
@@ -1344,15 +1345,14 @@ EphyrKeyboardInit(KdKeyboardInfo * ki)
|
||||
|
||||
ki->name = strdup("Xephyr virtual keyboard");
|
||||
ephyrKbd = ki;
|
||||
return Success;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static Status
|
||||
static Bool
|
||||
EphyrKeyboardEnable(KdKeyboardInfo * ki)
|
||||
{
|
||||
((EphyrKbdPrivate *) ki->driverPrivate)->enabled = TRUE;
|
||||
|
||||
return Success;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -541,9 +541,8 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
|
||||
return BadImplementation;
|
||||
}
|
||||
|
||||
if ((*ki->driver->Init) (ki) != Success) {
|
||||
if (!(ki->driver->Init(ki)))
|
||||
return BadRequest;
|
||||
}
|
||||
|
||||
xiclass = AtomFromName(XI_KEYBOARD);
|
||||
AssignTypeAndName(pDevice, xiclass,
|
||||
@@ -560,9 +559,8 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff)
|
||||
if (!ki->driver->Enable)
|
||||
return BadImplementation;
|
||||
|
||||
if ((*ki->driver->Enable) (ki) != Success) {
|
||||
if (!(ki->driver->Enable(ki)))
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
pDev->on = TRUE;
|
||||
return Success;
|
||||
|
||||
Reference in New Issue
Block a user