Merge branch 'input-hotplug' of git+ssh://git.freedesktop.org/git/xorg/xserver into input-hotplug

This commit is contained in:
Daniel Stone 2006-10-02 02:18:17 +03:00 committed by Daniel Stone
commit 3c98cebb6e
180 changed files with 6248 additions and 16868 deletions

1
.gitignore vendored
View File

@ -267,3 +267,4 @@ mfb/mfbteblack.c
mfb/mfbtewhite.c
mfb/mfbtileC.c
mfb/mfbtileG.c
.*.swp

View File

@ -26,10 +26,6 @@ if GLX
GLX_DIR=GL
endif
if XINPUT
XINPUT_DIR=Xi
endif
if DBE
DBE_DIR=dbe
endif
@ -45,7 +41,7 @@ SUBDIRS = \
os \
randr \
render \
$(XINPUT_DIR) \
Xi \
xkb \
$(DBE_DIR) \
$(MFB_DIR) \
@ -59,6 +55,7 @@ SUBDIRS = \
$(COMPOSITE_DIR) \
$(GLX_DIR) \
exa \
config \
hw
aclocaldir = $(datadir)/aclocal

View File

@ -104,6 +104,8 @@ ProcXChangeDeviceControl(ClientPtr client)
xChangeDeviceControlReply rep;
AxisInfoPtr a;
CARD32 *resolution;
xDeviceTSCtl *ts;
xDeviceCoreCtl *c;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@ -168,6 +170,54 @@ ProcXChangeDeviceControl(ClientPtr client)
return Success;
}
break;
case DEVICE_TOUCHSCREEN:
ts = (xDeviceTSCtl *)&stuff[1];
if (ts->button_threshold < 0 || ts->button_threshold > 255) {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadValue);
return Success;
}
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) ts);
if (status == Success) {
dev->touchscreen->min_x = ts->min_x;
dev->touchscreen->max_x = ts->max_x;
dev->touchscreen->min_y = ts->min_y;
dev->touchscreen->max_y = ts->max_y;
dev->touchscreen->button_threshold = ts->button_threshold;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
&rep);
return Success;
} else {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadMatch);
return Success;
}
break;
case DEVICE_CORE:
c = (xDeviceCoreCtl *)&stuff[1];
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) c);
if (status == Success) {
dev->coreEvents = c->status;
} else if (status == DeviceBusy) {
rep.status = DeviceBusy;
WriteReplyToClient(client, sizeof(xChangeDeviceControlReply),
&rep);
return Success;
} else {
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0,
BadMatch);
return Success;
}
break;
default:
SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue);
return Success;

View File

@ -302,7 +302,12 @@ _X_EXPORT void
InitValuatorAxisStruct(DeviceIntPtr dev, int axnum, int minval, int maxval,
int resolution, int min_res, int max_res)
{
register AxisInfoPtr ax = dev->valuator->axes + axnum;
register AxisInfoPtr ax;
if (!dev || !dev->valuator)
return NULL;
ax = dev->valuator->axes + axnum;
ax->min_value = minval;
ax->max_value = maxval;

View File

@ -51,6 +51,7 @@ extern Mask DeviceMappingNotifyMask;
extern Mask DeviceOwnerGrabButtonMask;
extern Mask DeviceButtonGrabMask;
extern Mask DeviceButtonMotionMask;
extern Mask DevicePresenceNotifyMask;
extern Mask PropagateMask[];
extern int DeviceValuator;
@ -68,12 +69,8 @@ extern int DeviceKeyStateNotify;
extern int DeviceButtonStateNotify;
extern int DeviceMappingNotify;
extern int ChangeDeviceNotify;
extern int DevicePresenceNotify;
extern int RT_INPUTCLIENT;
#if 0
/* FIXME: in dix */
extern InputInfo inputInfo;
#endif
#endif /* EXGLOBALS_H */

View File

@ -166,6 +166,7 @@ Mask DeviceMappingNotifyMask;
Mask DeviceOwnerGrabButtonMask;
Mask DeviceButtonGrabMask;
Mask DeviceButtonMotionMask;
Mask DevicePresenceNotifyMask;
int DeviceValuator;
int DeviceKeyPress;
@ -182,6 +183,7 @@ int DeviceKeyStateNotify;
int DeviceButtonStateNotify;
int DeviceMappingNotify;
int ChangeDeviceNotify;
int DevicePresenceNotify;
int RT_INPUTCLIENT;
@ -202,8 +204,8 @@ Mask PropagateMask[MAX_DEVICES];
*/
static XExtensionVersion thisversion = { XI_Present,
XI_Add_XChangeDeviceControl_Major,
XI_Add_XChangeDeviceControl_Minor
XI_Add_DevicePresenceNotify_Major,
XI_Add_DevicePresenceNotify_Minor
};
/**********************************************************************
@ -648,6 +650,16 @@ SDeviceMappingNotifyEvent(deviceMappingNotify * from, deviceMappingNotify * to)
swapl(&to->time, n);
}
void
SDevicePresenceNotifyEvent (devicePresenceNotify *from, devicePresenceNotify *to)
{
register char n;
*to = *from;
swaps(&to->sequenceNumber,n);
swapl(&to->time, n);
}
/************************************************************************
*
* This function sets up extension event types and masks.
@ -674,6 +686,7 @@ FixExtensionEvents(ExtensionEntry * extEntry)
ChangeDeviceNotify = DeviceMappingNotify + 1;
DeviceKeyStateNotify = ChangeDeviceNotify + 1;
DeviceButtonStateNotify = DeviceKeyStateNotify + 1;
DevicePresenceNotify = DeviceButtonStateNotify + 1;
event_base[KeyClass] = DeviceKeyPress;
event_base[ButtonClass] = DeviceButtonPress;
@ -746,6 +759,9 @@ FixExtensionEvents(ExtensionEntry * extEntry)
DeviceOwnerGrabButtonMask = GetNextExtEventMask();
SetEventInfo(DeviceOwnerGrabButtonMask, _deviceOwnerGrabButton);
DevicePresenceNotifyMask = GetNextExtEventMask();
SetEventInfo(DevicePresenceNotifyMask, _devicePresence);
SetEventInfo(0, _noExtensionEvent);
}
@ -786,6 +802,7 @@ RestoreExtensionEvents(void)
ChangeDeviceNotify = 12;
DeviceKeyStateNotify = 13;
DeviceButtonStateNotify = 13;
DevicePresenceNotify = 14;
BadDevice = 0;
BadEvent = 1;
@ -823,6 +840,7 @@ IResetProc(ExtensionEntry * unused)
EventSwapVector[DeviceButtonStateNotify] = NotImplemented;
EventSwapVector[DeviceMappingNotify] = NotImplemented;
EventSwapVector[ChangeDeviceNotify] = NotImplemented;
EventSwapVector[DevicePresenceNotify] = NotImplemented;
RestoreExtensionEvents();
}
@ -857,9 +875,7 @@ MakeDeviceTypeAtoms(void)
}
/**************************************************************************
*
* Return a DeviceIntPtr corresponding to a specified device id.
* This will not return the pointer or keyboard, or devices that are not on.
*
*/
@ -869,13 +885,16 @@ LookupDeviceIntRec(CARD8 id)
DeviceIntPtr dev;
for (dev = inputInfo.devices; dev; dev = dev->next) {
if (dev->id == id) {
if (id == inputInfo.pointer->id || id == inputInfo.keyboard->id)
return (NULL);
return (dev);
}
if (dev->id == id)
return dev;
}
return (NULL);
for (dev = inputInfo.off_devices; dev; dev = dev->next) {
if (dev->id == id)
return dev;
}
return NULL;
}
/**************************************************************************

View File

@ -124,6 +124,18 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceResolutionState) +
(3 * sizeof(int) * dev->valuator->numAxes);
break;
case DEVICE_TOUCHSCREEN:
if (!dev->touchscreen) {
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0,
BadMatch);
return Success;
}
total_length = sizeof(xDeviceTSCtl);
break;
case DEVICE_CORE:
total_length = sizeof(xDeviceCoreCtl);
break;
default:
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
return Success;
@ -140,6 +152,11 @@ ProcXGetDeviceControl(ClientPtr client)
case DEVICE_RESOLUTION:
CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
break;
case DEVICE_TOUCHSCREEN:
CopySwapDeviceTouchscreen(client, dev->touchscreen, buf);
break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
default:
break;
}
@ -189,6 +206,48 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
}
}
void CopySwapDeviceTouchscreen (ClientPtr client, TouchscreenClassPtr dts,
char *buf)
{
register char n;
xDeviceTSState *ts = (xDeviceTSState *) buf;
ts->control = DEVICE_TOUCHSCREEN;
ts->length = sizeof(ts);
ts->min_x = dts->min_x;
ts->max_x = dts->max_x;
ts->min_y = dts->min_y;
ts->max_y = dts->max_y;
ts->button_threshold = dts->button_threshold;
if (client->swapped) {
swaps(&ts->control, n);
swaps(&ts->length, n);
swapl(&ts->min_x, n);
swapl(&ts->max_x, n);
swapl(&ts->min_y, n);
swapl(&ts->max_y, n);
swapl(&ts->button_threshold, n);
}
}
void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
{
register char n;
xDeviceCoreState *c = (xDeviceCoreState *) buf;
c->control = DEVICE_CORE;
c->length = sizeof(c);
c->status = dev->coreEvents;
if (client->swapped) {
swaps(&c->control, n);
swaps(&c->length, n);
swaps(&c->status, n);
}
}
/***********************************************************************
*
* This procedure writes the reply for the xGetDeviceControl function,

View File

@ -42,6 +42,16 @@ void CopySwapDeviceResolution(ClientPtr /* client */ ,
int /* length */
);
void CopySwapDeviceTouchscreen(ClientPtr /* client */ ,
TouchscreenClassPtr /* ts */ ,
char * /* buf */
);
void CopySwapDeviceCore(ClientPtr /* client */ ,
DeviceIntPtr /* dev */ ,
char * /* buf */
);
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */

View File

@ -96,7 +96,7 @@ int
ProcXListInputDevices(register ClientPtr client)
{
xListInputDevicesReply rep;
int numdevs;
int numdevs = 0;
int namesize = 1; /* need 1 extra byte for strcpy */
int size = 0;
int total_length;
@ -115,12 +115,15 @@ ProcXListInputDevices(register ClientPtr client)
rep.sequenceNumber = client->sequence;
AddOtherInputDevices();
numdevs = inputInfo.numDevices;
for (d = inputInfo.devices; d; d = d->next)
for (d = inputInfo.devices; d; d = d->next) {
SizeDeviceInfo(d, &namesize, &size);
for (d = inputInfo.off_devices; d; d = d->next)
numdevs++;
}
for (d = inputInfo.off_devices; d; d = d->next) {
SizeDeviceInfo(d, &namesize, &size);
numdevs++;
}
total_length = numdevs * sizeof(xDeviceInfo) + size + namesize;
devbuf = (char *)xalloc(total_length);
@ -241,6 +244,10 @@ CopySwapDevice(register ClientPtr client, DeviceIntPtr d, int num_classes,
dev->use = IsXKeyboard;
else if (d == inputInfo.pointer)
dev->use = IsXPointer;
else if (d->key && d->kbdfeed)
dev->use = IsXExtensionKeyboard;
else if (d->valuator && d->button)
dev->use = IsXExtensionPointer;
else
dev->use = IsXExtensionDevice;
if (client->swapped) {

View File

@ -74,6 +74,53 @@ SOFTWARE.
extern Mask ExtExclusiveMasks[];
extern Mask ExtValidMasks[];
static int
HandleDevicePresenceMask(ClientPtr client, WindowPtr win,
XEventClass *cls, CARD16 *count)
{
int i, j;
Mask mask;
/* We use the device ID 256 to select events that aren't bound to
* any device. For now we only handle the device presence event,
* but this could be extended to other events that aren't bound to
* a device.
*
* In order not to break in CreateMaskFromList() we remove the
* entries with device ID 256 from the XEventClass array.
*/
mask = 0;
for (i = 0, j = 0; i < *count; i++) {
if (cls[i] >> 8 != 256) {
cls[j] = cls[i];
j++;
continue;
}
switch (cls[i] & 0xff) {
case _devicePresence:
mask |= DevicePresenceNotifyMask;
break;
}
}
*count = j;
if (mask == 0)
return Success;
/* We always only use mksidx = 0 for events not bound to
* devices */
if (AddExtensionClient (win, client, mask, 0) != Success)
return BadAlloc;
RecalculateDeviceDeliverableEvents(win);
return Success;
}
/***********************************************************************
*
* Handle requests from clients with a different byte order.
@ -131,6 +178,13 @@ ProcXSelectExtensionEvent(register ClientPtr client)
return Success;
}
if (HandleDevicePresenceMask(client, pWin, (XEventClass *) & stuff[1],
&stuff->count) != Success) {
SendErrorToClient(client, IReqCode, X_SelectExtensionEvent, 0,
BadAlloc);
return Success;
}
if ((ret = CreateMaskFromList(client, (XEventClass *) & stuff[1],
stuff->count, tmp, NULL,
X_SelectExtensionEvent)) != Success)

View File

@ -287,6 +287,10 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr dev,
switch (control->control) {
case DEVICE_RESOLUTION:
return (BadMatch);
case DEVICE_TOUCHSCREEN:
return (BadMatch);
case DEVICE_CORE:
return (BadMatch);
default:
return (BadMatch);
}

10
config/Makefile.am Normal file
View File

@ -0,0 +1,10 @@
AM_CFLAGS = @DIX_CFLAGS@
dbusconfigdir = $(sysconfdir)/dbus-1/system.d
dbusconfig_DATA = xorg-server.conf
lib_LIBRARIES = libconfig.a
libconfig_a_SOURCES = config.c
EXTRA_DIST = xorg-server.conf

297
config/config.c Normal file
View File

@ -0,0 +1,297 @@
/*
* Copyright © 2006 Daniel Stone
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of the copyright holders and/or authors
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. The copyright holders
* and/or authors make no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* THE COPYRIGHT HOLDERS AND/OR AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND/OR AUTHORS BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
* CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
#ifdef HAVE_DBUS
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus.h>
#include <string.h>
#include "opaque.h" /* for 'display': there has to be a better way */
/* the above comment lies. there is no better way. */
#include "input.h"
#include "config.h"
#define MATCH_RULE "type='method_call',interface='org.x.config.input'"
static DBusConnection *configConnection = NULL;
static int configfd = -1;
static char busobject[32] = { 0 };
static char busname[64] = { 0 };
void
configDispatch()
{
if (!configConnection)
return;
dbus_connection_read_write_dispatch(configConnection, 0);
}
static DBusHandlerResult
configMessage(DBusConnection *connection, DBusMessage *message, void *closure)
{
InputOption *option = NULL, *ret = NULL;
DBusMessageIter iter, subiter;
DBusError error;
char *tmp = NULL;
int deviceid = -1;
DeviceIntPtr pDev = NULL;
#ifdef DEBUG
ErrorF("[dbus] new message!\n");
ErrorF(" source: %s\n", dbus_message_get_sender(message));
ErrorF(" destination: %s\n", dbus_message_get_destination(message));
ErrorF(" signature: %s\n", dbus_message_get_signature(message));
ErrorF(" path: %s\n", dbus_message_get_path(message));
ErrorF(" interface: %s\n", dbus_message_get_interface(message));
ErrorF(" member: %s\n", dbus_message_get_member(message));
ErrorF(" method call? %s\n", (dbus_message_get_type(message) ==
DBUS_MESSAGE_TYPE_METHOD_CALL) ?
"yes" : "no");
#endif
dbus_error_init(&error);
if (strcmp(dbus_message_get_interface(message),
"org.x.config.input") == 0) {
if (!dbus_message_iter_init(message, &iter)) {
ErrorF("failed to init iterator! this is probably bad.\n");
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY; /* ?? */
}
if (strcmp(dbus_message_get_member(message), "add") == 0) {
#ifdef DEBUG
ErrorF(" we want to add a device!\n");
#endif
/* signature should be [ss][ss]... */
while (dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_ARRAY) {
option = (InputOption *)xcalloc(sizeof(InputOption), 1);
if (!option) {
while (ret) {
option = ret;
ret = ret->next;
xfree(option);
}
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY;
}
dbus_message_iter_recurse(&iter, &subiter);
if (dbus_message_iter_get_arg_type(&subiter) !=
DBUS_TYPE_STRING) {
ErrorF("couldn't get the arg type\n");
xfree(option);
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
dbus_message_iter_get_basic(&subiter, &tmp);
if (!tmp) {
ErrorF("couldn't get the key!\n");
xfree(option);
break;
}
option->key = xstrdup(tmp);
if (!option->key) {
ErrorF("couldn't duplicate the key!\n");
xfree(option);
break;
}
if (!dbus_message_iter_has_next(&subiter)) {
ErrorF("broken message: no next\n");
xfree(option->key);
xfree(option);
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
dbus_message_iter_next(&subiter);
if (dbus_message_iter_get_arg_type(&subiter) !=
DBUS_TYPE_STRING) {
ErrorF("couldn't get the arg type\n");
xfree(option);
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
dbus_message_iter_get_basic(&subiter, &tmp);
if (!tmp) {
ErrorF("couldn't get the value!\n");
xfree(option->key);
xfree(option);
break;
}
option->value = xstrdup(tmp);
if (!option->value) {
ErrorF("couldn't duplicate the option!\n");
xfree(option->value);
xfree(option);
break;
}
option->next = ret;
ret = option;
dbus_message_iter_next(&iter);
}
if (NewInputDeviceRequest(ret) != Success) {
ErrorF("[config] NIDR failed\n");
}
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
else if (strcmp(dbus_message_get_member(message), "remove") == 0) {
#ifdef DEBUG
ErrorF(" we want to remove a device!\n");
#endif
if (!dbus_message_get_args(message, &error, DBUS_TYPE_INT32,
&deviceid, DBUS_TYPE_INVALID)) {
ErrorF("couldn't get args: %s %s\n", error.name, error.message);
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
if (deviceid < 0 || !(pDev = LookupDeviceIntRec(deviceid))) {
ErrorF("bogus device id %d\n", deviceid);
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
/* Call PIE here so we don't try to dereference a device that's
* already been removed. Technically there's still a small race
* here, so we should ensure that SIGIO is blocked. */
ProcessInputEvents();
RemoveDevice(pDev);
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_HANDLED;
}
}
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
void
configInitialise()
{
DBusConnection *bus = NULL;
DBusError error;
DBusObjectPathVTable vtable;
configConnection = NULL;
dbus_error_init(&error);
bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error);
if (!bus || dbus_error_is_set(&error)) {
dbus_error_free(&error);
FatalError("[dbus] some kind of error occurred: %s (%s)\n", error.name,
error.message);
return;
}
if (!dbus_connection_get_unix_fd(bus, &configfd)) {
dbus_connection_close(bus);
configfd = -1;
FatalError("[dbus] couldn't get fd for bus\n");
return;
}
snprintf(busname, sizeof(busname), "org.x.config.display%d", atoi(display));
if (!dbus_bus_request_name(bus, busname, 0, &error) ||
dbus_error_is_set(&error)) {
dbus_error_free(&error);
dbus_connection_close(bus);
configfd = -1;
FatalError("[dbus] couldn't take over org.x.config: %s (%s)\n",
error.name, error.message);
return;
}
/* blocks until we get a reply. */
dbus_bus_add_match(bus, MATCH_RULE, &error);
if (dbus_error_is_set(&error)) {
dbus_error_free(&error);
dbus_bus_release_name(bus, busname, &error);
dbus_connection_close(bus);
configfd = -1;
FatalError("[dbus] couldn't match X.Org rule: %s (%s)\n", error.name,
error.message);
return;
}
vtable.message_function = configMessage;
snprintf(busobject, sizeof(busobject), "/org/x/config/%d", atoi(display));
if (!dbus_connection_register_object_path(bus, busobject, &vtable, NULL)) {
configfd = -1;
dbus_bus_release_name(bus, busname, &error);
dbus_bus_remove_match(bus, MATCH_RULE, &error);
dbus_connection_close(bus);
FatalError("[dbus] couldn't register object path\n");
return;
}
#ifdef DEBUG
ErrorF("[dbus] registered object path %s\n", busobject);
ErrorF("[dbus] registered and listening\n");
#endif
dbus_error_free(&error);
configConnection = bus;
AddGeneralSocket(configfd);
}
void
configFini()
{
DBusError error;
if (configConnection) {
dbus_error_init(&error);
dbus_bus_remove_match(configConnection, MATCH_RULE, &error);
dbus_bus_release_name(configConnection, busname, &error);
dbus_connection_close(configConnection);
RemoveGeneralSocket(configfd);
configConnection = NULL;
configfd = -1;
dbus_error_free(&error);
}
}
#else
void
configDispatch()
{
}
void
configInitialise()
{
}
void
configFini()
{
}
#endif

13
config/xorg-server.conf Normal file
View File

@ -0,0 +1,13 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy context="default">
<allow own="org.x.config.display0"/>
<allow send_destination="org.x.config.display0"/>
<allow send_interface="org.x.config.display0"/>
<allow own="org.x.config.display1"/>
<allow send_destination="org.x.config.display1"/>
<allow send_interface="org.x.config.display1"/>
</policy>
</busconfig>

View File

@ -393,6 +393,12 @@ AC_ARG_ENABLE(install-libxf86config,
[Install libxf86config (default: disabled)]),
[INSTALL_LIBXF86CONFIG=$enableval],
[INSTALL_LIBXF86CONFIG=no])
AC_ARG_ENABLE(builtin-fonts, AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: use external)]),
[BUILTIN_FONTS=$enableval],
[BUILTIN_FONTS=no])
AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]),
[NULL_ROOT_CURSOR=$enableval],
[NULL_ROOT_CURSOR=no])
dnl Extensions.
AC_ARG_ENABLE(composite, AS_HELP_STRING([--disable-composite], [Build Composite extension (default: enabled)]), [COMPOSITE=$enableval], [COMPOSITE=yes])
@ -402,7 +408,7 @@ AC_ARG_ENABLE(xtrap, AS_HELP_STRING([--disable-xtrap], [Build XTrap ext
AC_ARG_ENABLE(record, AS_HELP_STRING([--disable-record], [Build Record extension (default: enabled)]), [RECORD=$enableval], [RECORD=yes])
AC_ARG_ENABLE(xv, AS_HELP_STRING([--disable-xv], [Build Xv extension (default: enabled)]), [XV=$enableval], [XV=yes])
AC_ARG_ENABLE(xvmc, AS_HELP_STRING([--disable-xvmc], [Build XvMC extension (default: enabled)]), [XVMC=$enableval], [XVMC=yes])
AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: enabled)]), [DGA=$enableval], [DGA=yes])
AC_ARG_ENABLE(dga, AS_HELP_STRING([--disable-dga], [Build DGA extension (default: auto)]), [DGA=$enableval], [DGA=auto])
AC_ARG_ENABLE(screensaver, AS_HELP_STRING([--disable-screensaver], [Build ScreenSaver extension (default: enabled)]), [SCREENSAVER=$enableval], [SCREENSAVER=yes])
AC_ARG_ENABLE(xdmcp, AS_HELP_STRING([--disable-xdmcp], [Build XDMCP extension (default: auto)]), [XDMCP=$enableval], [XDMCP=auto])
AC_ARG_ENABLE(xdm-auth-1, AS_HELP_STRING([--disable-xdm-auth-1], [Build XDM-Auth-1 extension (default: auto)]), [XDMAUTH=$enableval], [XDMAUTH=auto])
@ -411,8 +417,8 @@ AC_ARG_ENABLE(aiglx, AS_HELP_STRING([--enable-aiglx], [Build accelerate
AC_ARG_ENABLE(glx-tls, AS_HELP_STRING([--enable-glx-tls], [Build GLX with TLS support (default: disabled)]), [GLX_USE_TLS=$enableval], [GLX_USE_TLS=no])
AC_ARG_ENABLE(dri, AS_HELP_STRING([--enable-dri], [Build DRI extension (default: auto)]), [DRI=$enableval])
AC_ARG_ENABLE(xinerama, AS_HELP_STRING([--disable-xinerama], [Build Xinerama extension (default: enabled)]), [XINERAMA=$enableval], [XINERAMA=yes])
AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: enabled)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=yes])
AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: enabled)]), [XF86MISC=$enableval], [XF86MISC=yes])
AC_ARG_ENABLE(xf86vidmode, AS_HELP_STRING([--disable-xf86vidmode], [Build XF86VidMode extension (default: auto)]), [XF86VIDMODE=$enableval], [XF86VIDMODE=auto])
AC_ARG_ENABLE(xf86misc, AS_HELP_STRING([--disable-xf86misc], [Build XF86Misc extension (default: auto)]), [XF86MISC=$enableval], [XF86MISC=auto])
AC_ARG_ENABLE(xcsecurity, AS_HELP_STRING([--disable-xcsecurity], [Build Security extension (default: enabled)]), [XCSECURITY=$enableval], [XCSECURITY=yes])
AC_ARG_ENABLE(xcalibrate, AS_HELP_STRING([--enable-xcalibrate], [Build XCalibrate extension (default: disabled)]), [XCALIBRATE=$enableval], [XCALIBRATE=no])
AC_ARG_ENABLE(tslib, AS_HELP_STRING([--enable-tslib], [Build kdrive tslib touchscreen support (default: disabled)]), [TSLIB=$enableval], [TSLIB=no])
@ -425,7 +431,7 @@ AC_ARG_ENABLE(fontcache, AS_HELP_STRING([--enable-fontcache], [Build FontCa
AC_ARG_ENABLE(dbe, AS_HELP_STRING([--disable-dbe], [Build DBE extension (default: enabled)]), [DBE=$enableval], [DBE=yes])
AC_ARG_ENABLE(xf86bigfont, AS_HELP_STRING([--disable-xf86bigfont], [Build XF86 Big Font extension (default: enabled)]), [XF86BIGFONT=$enableval], [XF86BIGFONT=yes])
AC_ARG_ENABLE(dpms, AS_HELP_STRING([--disable-dpms], [Build DPMS extension (default: enabled)]), [DPMSExtension=$enableval], [DPMSExtension=yes])
AC_ARG_ENABLE(xinput, AS_HELP_STRING([--disable-xinput], [Build XInput Extension (default: enabled)]), [XINPUT=$enableval], [XINPUT=yes])
AC_ARG_ENABLE(dbus, AS_HELP_STRING([--disable-dbus], [Build D-BUS support (default: auto)]), [DBUS=$enableval], [DBUS=auto])
AC_ARG_ENABLE(xfree86-utils, AS_HELP_STRING([--enable-xfree86-utils], [Build xfree86 DDX utilities (default: enabled)]), [XF86UTILS=$enableval], [XF86UTILS=yes])
dnl DDXes.
@ -442,6 +448,9 @@ dnl kdrive and its subsystems
AC_ARG_ENABLE(kdrive, AS_HELP_STRING([--enable-kdrive], [Build kdrive servers (default: no)]), [KDRIVE=$enableval], [KDRIVE=no])
AC_ARG_ENABLE(xephyr, AS_HELP_STRING([--enable-xephyr], [Build the kdrive Xephyr server (default: auto)]), [XEPHYR=$enableval], [XEPHYR=auto])
AC_ARG_ENABLE(xsdl, AS_HELP_STRING([--enable-xsdl], [Build the kdrive Xsdl server (default: auto)]), [XSDL=$enableval], [XSDL=auto])
AC_ARG_ENABLE(xfake, AS_HELP_STRING([--enable-xfake], [Build the kdrive 'fake' server (default: auto)]), [XFAKE=$enableval], [XFAKE=auto])
AC_ARG_ENABLE(xfbdev, AS_HELP_STRING([--enable-xfbdev], [Build the kdrive framebuffer device server (default: auto)]), [XFBDEV=$enableval], [XFBDEV=auto])
AC_ARG_ENABLE(kdrive-vesa, AS_HELP_STRING([--enable-kdrive-vesa], [Build the kdrive VESA-based servers (default: auto)]), [KDRIVEVESA=$enableval], [KDRIVEVESA=auto])
dnl xprint
AC_ARG_ENABLE(freetype, AS_HELP_STRING([ --enable-freetype], [Build Xprint FreeType backend (default: yes)]), [XP_USE_FREETYPE=$enableval],[XP_USE_FREETYPE=no])
AC_ARG_WITH(freetype-config, AS_HELP_STRING([ --with-freetype-config=PROG], [Use FreeType configuration program PROG (default: auto)]), freetype_config=$withval, freetype_config=auto)
@ -513,9 +522,21 @@ XEXT_LIB='$(top_builddir)/Xext/libXext.la'
XEXTXORG_LIB='$(top_builddir)/Xext/libXextbuiltin.la'
dnl Core modules for most extensions, et al.
REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans xf86miscproto xf86vidmodeproto xf86bigfontproto [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto inputproto xf86dgaproto [kbproto >= 1.0.3]"
REQUIRED_MODULES="randrproto renderproto [fixesproto >= 4.0] damageproto xcmiscproto xextproto xproto xtrans [scrnsaverproto >= 1.1] bigreqsproto resourceproto fontsproto [inputproto >= 1.4] [kbproto >= 1.0.3]"
REQUIRED_LIBS="xfont xau fontenc"
if test "x$DBUS" = xauto; then
PKG_CHECK_MODULES(DBUS, dbus-1, [DBUS=yes], [DBUS=no])
fi
if test "x$DBUS" = xyes; then
PKG_CHECK_MODULES(DBUS, dbus-1)
AC_DEFINE(HAVE_DBUS, 1, [Have D-BUS support])
REQUIRED_MODULES="$REQUIRED_MODULES dbus-1"
REQUIRED_LIBS="$REQUIRED_LIBS dbus-1"
fi
CONFIG_LIB='$(top_builddir)/config/libconfig.a'
AM_CONDITIONAL(DBUS, [test "x$DBUS" = xyes])
AM_CONDITIONAL(XV, [test "x$XV" = xyes])
if test "x$XV" = xyes; then
AC_DEFINE(XV, 1, [Support Xv extension])
@ -530,10 +551,6 @@ if test "x$XVMC" = xyes; then
AC_DEFINE(XvMCExtension, 1, [Build XvMC extension])
fi
AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
if test "x$DGA" = xyes; then
AC_DEFINE(DGA, 1, [Support DGA extension])
fi
AM_CONDITIONAL(COMPOSITE, [test "x$COMPOSITE" = xyes])
if test "x$COMPOSITE" = xyes; then
@ -682,14 +699,6 @@ if test "x$DPMSExtension" = xyes; then
AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
fi
if test "x$XF86VIDMODE" = xyes; then
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
fi
if test "x$XF86MISC" = xyes; then
AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
fi
if test "x$XPRINT" = xauto; then
PKG_CHECK_MODULES([XPRINTPROTO], [printproto], [XPRINT=yes], [XPRINT=no])
fi
@ -699,6 +708,11 @@ if test "x$XPRINT" = xyes; then
REQUIRED_MODULES="$REQUIRED_MODULES printproto"
fi
if test "x$BUILTIN_FONTS" = xyes; then
AC_DEFINE(BUILTIN_FONTS, 1, [Use only built-in fonts])
AC_DEFINE(NOFONTSERVERACCESS, 1, [Avoid using a font server])
fi
if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateproto"
@ -729,12 +743,9 @@ if test "$COMPOSITE" = yes; then
fi
MIEXT_DAMAGE_INC='-I$(top_srcdir)/miext/damage'
AM_CONDITIONAL(XINPUT, [test "x$XINPUT" = xyes])
if test "x$XINPUT" = xyes; then
AC_DEFINE(XINPUT, 1, [Support X Input extension])
XI_LIB='$(top_builddir)/Xi/libXi.la'
XI_INC='-I$(top_srcdir)/Xi'
fi
AC_DEFINE(XINPUT, 1, [Support X Input extension])
XI_LIB='$(top_builddir)/Xi/libXi.la'
XI_INC='-I$(top_srcdir)/Xi'
AM_CONDITIONAL(XF86UTILS, test "x$XF86UTILS" = xyes)
@ -750,6 +761,10 @@ XKB_STUB_LIB='$(top_builddir)/xkb/libxkbstubs.la'
AC_CHECK_FUNC(strcasecmp, [], AC_DEFINE([NEED_STRCASECMP], 1,
[Do not have `strcasecmp'.]))
if test "x$NULL_ROOT_CURSOR" = xyes; then
AC_DEFINE(NULL_ROOT_CURSOR, 1, [Use an empty root cursor])
fi
PKG_CHECK_MODULES([XDMCP], [xdmcp], [have_libxdmcp="yes"], [have_libxdmcp="no"])
if test "x$have_libxdmcp" = xyes; then
AC_CHECK_LIB(Xdmcp, XdmcpWrap, [have_xdmcpwrap="yes"], [have_xdmcpwrap="no"], [$XDMCP_LIBS])
@ -825,11 +840,35 @@ AC_DEFINE(DDXOSINIT, 1, [Use OsVendorInit])
AC_DEFINE(SERVER_LOCK, 1, [Use a lock to prevent multiple servers on a display])
AC_DEFINE(SMART_SCHEDULE, 1, [Include time-based scheduler])
AC_DEFINE(NO_LIBCWRAPPER, 1, [Define to 1 if modules should avoid the libcwrapper])
AM_CONDITIONAL(DEBUG, test "x$DEBUGGING" = xyes)
if ! test "x$DEBUGGING" = xyes; then
AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
if test "x$DEBUGGING" = xyes; then
AC_DEFINE(DEBUG, 1, [Enable debugging code])
else
AC_DEFINE(NDEBUG, 1, [Disable some debugging code])
fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
# The Xorg binary needs to export symbols so that they can be used from modules
# Some platforms require extra flags to do this. gcc should set these flags
# when -rdynamic is passed to it, other compilers/linkers may need to be added
# here.
if test "x$GCC" = "xyes"; then
GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
if test "x$WERROR" = "xyes"; then
GCC_WARNINGS="${GCC_WARNINGS} -Werror"
fi
XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"
LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
fi
case $host_os in
openbsd*)
LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
;;
esac
AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
AC_DEFINE(USE_RGB_TXT, 1, [Use rgb.txt directly])
AC_DEFINE(MITMISC, 1, [Support MIT Misc extension])
@ -1021,7 +1060,7 @@ if test "x$XGLX" = xyes; then
fi
# XORG_CORE_LIBS is needed even if you're not building the Xorg DDX
XORG_CORE_LIBS="$DIX_LIB"
XORG_CORE_LIBS="$DIX_LIB $CONFIG_LIB"
AC_SUBST([XORG_CORE_LIBS])
xorg_bus_linuxpci=no
@ -1039,6 +1078,37 @@ if test "x$XORG" = xyes -o "x$XGL" = xyes; then
XORG_CFLAGS="$XORGSERVER_CFLAGS -DHAVE_XORG_CONFIG_H"
XORG_LIBS="$COMPOSITE_LIB $MI_LIB $FIXES_LIB $XEXTXORG_LIB $GLX_LIBS $RENDER_LIB $RANDR_LIB $DAMAGE_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XPSTUBS_LIB $OS_LIB"
if test "x$DGA" = xauto; then
PKG_CHECK_MODULES(DGA, xf86dgaproto, [DGA=yes], [DGA=no])
fi
if test "x$DGA" = xyes; then
XORG_MODULES="$XORG_MODULES xf86dgaproto"
AC_DEFINE(DGA, 1, [Support DGA extension])
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
fi
if test "x$XF86MISC" = xauto; then
PKG_CHECK_MODULES(XF86MISC, xf86miscproto, [XF86MISC=yes], [XF86MISC=no])
fi
if test "x$XF86MISC" = xyes; then
XORG_MODULES="$XORG_MODULES xf86miscproto"
AC_DEFINE(XF86MISC, 1, [Support XFree86 miscellaneous extensions])
fi
if test "x$XF86VIDMODE" = xauto; then
PKG_CHECK_MODULES(XF86VIDMODE, xf86vidmodeproto, [XF86VIDMODE=yes], [XF86VIDMODE=no])
fi
if test "x$XF86VIDMODE" = xyes; then
XORG_MODULES="$XORG_MODULES xf86vidmodeproto"
AC_DEFINE(XF86VIDMODE, 1, [Support XFree86 Video Mode extension])
fi
if test -n "$XORG_MODULES"; then
PKG_CHECK_MODULES(XORG_MODULES, [$XORG_MODULES])
XORG_CFLAGS="$XORG_CFLAGS $XORG_MODULES_CFLAGS"
XORG_LIBS="$XORG_LIBS $XORG_MODULES_LIBS"
fi
dnl Check to see if dlopen is in default libraries (like Solaris, which
dnl has it in libc), or if libdl is needed to get it.
AC_CHECK_FUNC([dlopen], [],
@ -1051,7 +1121,6 @@ dnl has it in libc), or if libdl is needed to get it.
fi
XORG_OS="linux"
XORG_OS_SUBDIR="linux"
XORG_OS_KBD="Lnx"
xorg_bus_linuxpci="yes"
linux_acpi="no"
case $host_cpu in
@ -1093,7 +1162,6 @@ int main () {
freebsd* | kfreebsd*-gnu)
XORG_OS="freebsd"
XORG_OS_SUBDIR="bsd"
XORG_OS_KBD="BSD"
case $host_cpu in
i*86)
;;
@ -1105,7 +1173,6 @@ int main () {
netbsd*)
XORG_OS="netbsd"
XORG_OS_SUBDIR="bsd"
XORG_OS_KBD="BSD"
case $host_cpu in
i*86|amd64*|x86_64*|ia64*)
;;
@ -1117,7 +1184,6 @@ int main () {
openbsd*)
XORG_OS="openbsd"
XORG_OS_SUBDIR="bsd"
XORG_OS_KBD="BSD"
case $host_cpu in
i*86|amd64*|x86_64*|ia64*)
;;
@ -1224,7 +1290,6 @@ int main () {
AC_SUBST([XORG_INCS])
AC_SUBST([XORG_OS])
AC_SUBST([XORG_OS_SUBDIR])
AC_SUBST([XORG_OS_KBD])
dnl only used in hw/xfree86/scanpci, TTBOMK
AC_PATH_PROG(PERL, perl, no)
@ -1234,28 +1299,7 @@ int main () {
fi
AC_SUBST(PERL)
# The Xorg binary needs to export symbols so that they can be used from modules
# Some platforms require extra flags to do this. gcc should set these flags
# when -rdynamic is passed to it, other compilers/linkers may need to be added
# here.
if test "x$GCC" = "xyes"; then
GCC_WARNINGS1="-Wall -Wpointer-arith -Wstrict-prototypes"
GCC_WARNINGS2="-Wmissing-prototypes -Wmissing-declarations"
GCC_WARNINGS3="-Wnested-externs -fno-strict-aliasing"
GCC_WARNINGS="$GCC_WARNINGS1 $GCC_WARNINGS2 $GCC_WARNINGS3"
if test "x$WERROR" = "xyes"; then
GCC_WARNINGS="${GCC_WARNINGS} -Werror"
fi
XSERVER_CFLAGS="$GCC_WARNINGS $XSERVER_CFLAGS"
LD_EXPORT_SYMBOLS_FLAG="-rdynamic"
fi
case $host_os in
openbsd*)
LD_EXPORT_SYMBOLS_FLAG="-Wl,--export-dynamic"
;;
esac
AC_SUBST([XORG_CFLAGS])
AC_SUBST([LD_EXPORT_SYMBOLS_FLAG])
dnl these only go in xorg-config.h
XF86CONFIGFILE="xorg.conf"
@ -1304,6 +1348,7 @@ AM_CONDITIONAL([SOLARIS_ASM_INLINE], [test "x$solaris_asm_inline" = xyes])
AM_CONDITIONAL(MFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(CFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(AFB, [test "x$XORG" = xyes])
AM_CONDITIONAL(DGA, [test "x$DGA" = xyes])
dnl Xprint DDX
@ -1313,7 +1358,7 @@ AC_MSG_RESULT([$XPRINT])
if test "x$XPRINT" = xyes; then
PKG_CHECK_MODULES([XPRINT], [printproto x11 xfont $XDMCP_MODULES xau])
XPRINT_EXTENSIONS="$XEXT_LIB $DBE_LIB $XTRAP_LIB $RECORD_LIB $RENDER_LIB $COMPOSITE_LIB $RANDR_LIB $XI_LIB $FIXES_LIB $DAMAGE_LIB $XI_LIB $GLX_LIBS"
XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB"
XPRINT_LIBS="$XPRINT_LIBS $DIX_LIB $CONFIG_LIB $XKB_LIB $XKB_STUB_LIB $XPRINT_EXTENSIONS $MI_LIB $MIEXT_DAMAGE_LIB $CWRAP_LIB $OS_LIB"
AC_SUBST([XPRINT_CFLAGS])
AC_SUBST([XPRINT_LIBS])
@ -1442,16 +1487,59 @@ if test "$KDRIVE" = yes; then
AC_DEFINE(KDRIVEDDXACTIONS,,[Build kdrive ddx])
AC_CHECK_HEADERS([sys/vm86.h sys/io.h])
if test "$ac_cv_header_sys_vm86_h" = yes; then
if test "$ac_cv_header_sys_vm86_h" = yes && test "x$KDRIVEVESA" = xauto; then
KDRIVEVESA=yes
fi
if test "x$KDRIVEVESA" = xyes; then
KDRIVEFBDEVLIB=yes
AC_DEFINE(KDRIVEVESA, 1, [Build VESA-based kdrive servers])
fi
AC_CHECK_HEADERS([linux/fb.h])
if test "$ac_cv_header_linux_fb_h" = yes; then
if test "$ac_cv_header_linux_fb_h" = yes && test "x$XFBDEV" = xauto; then
XFBDEV=yes
fi
if test "x$XFBDEV" = xyes; then
KDRIVEFBDEVLIB=yes
AC_DEFINE(KDRIVEFBDEV, 1, [Build fbdev-based kdrive server])
fi
# tslib...
AC_CHECK_LIB(ts, ts_open, [HAVE_TSLIB="yes"])
if test "x$TSLIB" = xauto && test "x$HAVE_TSLIB" = xyes; then
TSLIB=yes
fi
if test "x$TSLIB" = xyes; then
if ! test "x$HAVE_TSLIB" = xyes; then
AC_MSG_ERROR([tslib must be installed to build the tslib input driver.])
fi
TSLIB_LIBS="-lts"
AC_DEFINE(TSLIB, 1, [Have tslib support])
fi
if test x"$ac_cv_header_SDL_SDL_h" = xyes && test "x$XSDL" = xauto; then
XSDL=yes
fi
if test x"$XSDL" = xyes; then
# PKG_CHECK_MODULES(XSDL_EXTRA, Xfont xau $XDMCP_MODULES)
AC_DEFINE(XSDLSERVER,1,[Build Xsdl server])
XSDL_LIBS="`sdl-config --libs` $XSERVER_LIBS"
XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS"
fi
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
if test "x$XEPHYR" = xauto; then
XEPHYR=$xephyr
fi
# Xephyr needs nanosleep() which is in librt on Solaris
AC_CHECK_FUNC([nanosleep], [],
AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
XEPHYR_LIBS="$XEPHYR_LIBS $XSERVER_LIBS"
if test "x$TSLIB" = xyes; then
PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [HAVE_TSLIB="yes"], [HAVE_TSLIB="no"])
if test "x$HAVE_TSLIB" = xno; then
@ -1475,53 +1563,49 @@ if test "$KDRIVE" = yes; then
KDRIVE_LIB='$(top_builddir)/hw/kdrive/src/libkdrive.a'
KDRIVE_OS_LIB='$(top_builddir)/hw/kdrive/linux/liblinux.a'
KDRIVE_STUB_LIB='$(top_builddir)/hw/kdrive/src/libkdrivestubs.a'
KDRIVE_LIBS="$DIX_LIB $KDRIVE_LIB $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB $TSLIB_LIBS"
KDRIVE_LIBS="$XSERVERLIBS_LIBS $DIX_LIB $CONFIG_LIB $KDRIVE_LIB $TSLIB_LIBS $KDRIVE_OS_LIB $KDRIVE_PURE_LIBS $KDRIVE_STUB_LIB"
# check if we can build Xephyr
PKG_CHECK_MODULES(XEPHYR, x11 xext xfont xau xdmcp, [xephyr="yes"], [xephyr="no"])
XEPHYR_LIBS="$XEPHYR_LIBS $XSERVER_LIBS"
# Xephyr needs nanosleep() which is in librt on Solaris
AC_CHECK_FUNC([nanosleep], [],
AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
# check for SDL SDK
AC_CHECK_HEADERS([SDL/SDL.h])
if test "x$XSDL" = xauto; then
XSDL="$ac_cv_header_SDL_SDL_h"
fi
AC_SUBST([XEPHYR_LIBS])
AC_SUBST([XEPHYR_INCS])
AC_SUBST([XSDL_LIBS])
AC_SUBST([XSDL_INCS])
fi
AC_SUBST(KDRIVE_INCS)
AC_SUBST(KDRIVE_PURE_INCS)
AC_SUBST(KDRIVE_CFLAGS)
AC_SUBST(KDRIVE_PURE_LIBS)
AC_SUBST(KDRIVE_LIBS)
AC_SUBST([KDRIVE_INCS])
AC_SUBST([KDRIVE_PURE_INCS])
AC_SUBST([KDRIVE_CFLAGS])
AC_SUBST([KDRIVE_PURE_LIBS])
AC_SUBST([KDRIVE_LIBS])
AM_CONDITIONAL(TSLIB, [test "x$HAVE_TSLIB" = xyes])
AM_CONDITIONAL(H3600_TS, false)
AM_CONDITIONAL(KDRIVEVESA, [test "x$KDRIVEVESA" = xyes])
AM_CONDITIONAL(KDRIVEFBDEV, [test "x$XFBDEV" = xyes])
AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes])
AM_CONDITIONAL(XEPHYR, [test "x$KDRIVE" = xyes && test "x$XEPHYR" = xyes])
AM_CONDITIONAL(BUILD_KDRIVEFBDEVLIB, [test "x$KDRIVE" = xyes && test "x$KDRIVEFBDEVLIB" = xyes])
AM_CONDITIONAL(XFAKESERVER, [test "x$KDRIVE" = xyes && test "x$XFAKE" = xyes])
AM_CONDITIONAL(KDRIVEVESA, [test x"$ac_cv_header_sys_vm86_h" = xyes])
AM_CONDITIONAL(KDRIVEFBDEV, [test x"$ac_cv_header_linux_fb_h" = xyes])
# Xephyr needs nanosleep() which is in librt on Solaris
AC_CHECK_FUNC([nanosleep], [],
AC_CHECK_LIB([rt], [nanosleep], XEPHYR_LIBS="$XEPHYR_LIBS -lrt"))
AM_CONDITIONAL(XEPHYR, [test x"$xephyr" = xyes])
XEPHYR_LIBS="$XEPHYR_LIBS $XSERVER_LIBS"
AC_SUBST([XEPHYR_LIBS])
AC_SUBST([XEPHYR_INCS])
if test x"$XSDL" = xyes; then
AC_DEFINE(XSDLSERVER,,[Build Xsdl server])
XSDL_LIBS="`sdl-config --libs` $XSERVER_LIBS"
XSDL_INCS="`sdl-config --cflags` $XSERVER_CFLAGS"
fi
AM_CONDITIONAL(XSDLSERVER, [test x"$XSDL" = xyes])
AC_SUBST([XSDL_LIBS])
AC_SUBST([XSDL_INCS])
dnl these only go in xkb-config.h (which is shared by the Xorg and Xnest servers)
AC_DEFINE(__XKBDEFRULES__, "xorg", [Default XKB rules])
AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
AC_DEFINE_DIR(XKB_BIN_DIRECTORY, bindir, [Path to XKB bin dir])
# Make sure XKM_OUTPUT_DIR is an absolute path
XKBOUTPUT_FIRSTCHAR=`echo $XKBOUTPUT | cut -b 1`
if [[ x$XKBOUTPUT_FIRSTCHAR != x/ ]] ; then
@ -1539,7 +1623,6 @@ AC_DEFINE_DIR(XKM_OUTPUT_DIR, XKBOUTPUT, [Path to XKB output dir])
AC_SUBST(XKB_COMPILED_DIR)
dnl and the rest of these are generic, so they're in config.h
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
AC_DEFINE(XResExtension, 1, [Build XRes extension])
dnl CYGWIN does not define fd_set if _POSIX_SOURCE is defined
@ -1560,15 +1643,21 @@ esac
AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])
dnl xorgconfig CLI configuration utility
PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile x11])
AC_SUBST(XORGCONFIG_DEP_CFLAGS)
AC_SUBST(XORGCONFIG_DEP_LIBS)
if test "x$XORG" = xyes; then
PKG_CHECK_MODULES([XORGCONFIG_DEP], [xkbfile x11])
AC_SUBST(XORGCONFIG_DEP_CFLAGS)
AC_SUBST(XORGCONFIG_DEP_LIBS)
fi
dnl xorgcfg GUI configuration utility
AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg],
[Build xorgcfg GUI configuration utility (default: yes)]),
[XORGCFG=$enableval],[XORGCFG=yes])
if test x$XORGCFG = xyes ; then
[Build xorgcfg GUI configuration utility (default: auto)]),
[XORGCFG=$enableval],[XORGCFG=auto])
if test "x$XORGCFG" = xauto && test "x$XORG" = xyes; then
XORGCFG=yes
fi
if test "x$XORGCFG" = xyes; then
PKG_CHECK_MODULES([XORGCFG_DEP],
[xkbui >= 1.0.2 xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm xext x11])
AC_CHECK_LIB([curses],[waddstr],
@ -1654,6 +1743,7 @@ XTrap/Makefile
mfb/Makefile
cfb/Makefile
cfb32/Makefile
config/Makefile
mi/Makefile
miext/Makefile
miext/damage/Makefile

File diff suppressed because it is too large Load Diff

View File

@ -100,6 +100,7 @@ int ProcInitialConnection();
#include "dispatch.h"
#include "swaprep.h"
#include "swapreq.h"
#include "config.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@ -382,6 +383,9 @@ Dispatch(void)
nready = WaitForSomething(clientReady);
/* this is an enormous hack and NEEDS TO GO AWAY. */
configDispatch();
#ifdef SMART_SCHEDULE
if (nready && !SmartScheduleDisable)
{

View File

@ -155,11 +155,6 @@ QueueFontWakeup(FontPathElementPtr fpe)
for (i = 0; i < num_slept_fpes; i++) {
if (slept_fpes[i] == fpe) {
#ifdef DEBUG
fprintf(stderr, "re-queueing fpe wakeup\n");
#endif
return;
}
}
@ -1886,7 +1881,7 @@ InitFonts ()
{
patternCache = MakeFontPatternCache();
#ifndef KDRIVESERVER
#ifndef BUILTIN_FONTS
if (screenInfo.numScreens > screenInfo.numVideoScreens) {
PrinterFontRegisterFpeFunctions();
FontFileCheckRegisterFpeFunctions();
@ -1894,10 +1889,11 @@ InitFonts ()
} else
#endif
{
#ifdef KDRIVESERVER
BuiltinRegisterFpeFunctions();
#endif
#ifdef BUILTIN_FONTS
BuiltinRegisterFpeFunctions();
#else
FontFileRegisterFpeFunctions();
#endif
#ifndef NOFONTSERVERACCESS
fs_register_fpe_functions();
#endif
@ -2059,11 +2055,6 @@ init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
fs_handlers_installed = 0;
}
if (fs_handlers_installed == 0) {
#ifdef DEBUG
fprintf(stderr, "adding FS b & w handlers\n");
#endif
if (!RegisterBlockAndWakeupHandlers(block_handler,
FontWakeup, (pointer) 0))
return AllocError;
@ -2079,55 +2070,9 @@ remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, Bo
if (all) {
/* remove the handlers if no one else is using them */
if (--fs_handlers_installed == 0) {
#ifdef DEBUG
fprintf(stderr, "removing FS b & w handlers\n");
#endif
RemoveBlockAndWakeupHandlers(block_handler, FontWakeup,
(pointer) 0);
}
}
RemoveFontWakeup(fpe);
}
#ifdef DEBUG
#define GLWIDTHBYTESPADDED(bits,nbytes) \
((nbytes) == 1 ? (((bits)+7)>>3) /* pad to 1 byte */ \
:(nbytes) == 2 ? ((((bits)+15)>>3)&~1) /* pad to 2 bytes */ \
:(nbytes) == 4 ? ((((bits)+31)>>3)&~3) /* pad to 4 bytes */ \
:(nbytes) == 8 ? ((((bits)+63)>>3)&~7) /* pad to 8 bytes */ \
: 0)
#define GLYPH_SIZE(ch, nbytes) \
GLWIDTHBYTESPADDED((ch)->metrics.rightSideBearing - \
(ch)->metrics.leftSideBearing, (nbytes))
void
dump_char_ascii(CharInfoPtr cip)
{
int r,
l;
int bpr;
int byte;
static unsigned maskTab[] = {
(1 << 7), (1 << 6), (1 << 5), (1 << 4),
(1 << 3), (1 << 2), (1 << 1), (1 << 0),
};
bpr = GLYPH_SIZE(cip, 4);
for (r = 0; r < (cip->metrics.ascent + cip->metrics.descent); r++) {
pointer row = (pointer) cip->bits + r * bpr;
byte = 0;
for (l = 0; l <= (cip->metrics.rightSideBearing -
cip->metrics.leftSideBearing); l++) {
if (maskTab[l & 7] & row[l >> 3])
putchar('X');
else
putchar('.');
}
putchar('\n');
}
}
#endif

View File

@ -113,6 +113,7 @@ of the copyright holder.
#endif
#include <X11/X.h>
#include <X11/keysym.h>
#include "misc.h"
#include "resource.h"
#define NEED_EVENTS
@ -131,8 +132,10 @@ of the copyright holder.
#include "globals.h"
#ifdef XKB
#include <X11/extensions/XKBproto.h>
#include <X11/extensions/XKBsrv.h>
extern Bool XkbFilterEvents(ClientPtr, int, xEvent *);
extern Bool XkbCopyKeymap(XkbDescPtr src, XkbDescPtr dst, Bool sendNotifies);
#endif
#ifdef XCSECURITY
@ -154,7 +157,9 @@ xEvent *xeviexE;
#endif
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
#include "exevents.h"
#include "exglobals.h"
#include "extnsionst.h"
#include "dixevents.h"
@ -206,9 +211,6 @@ _X_EXPORT CallbackListPtr DeviceEventCallback;
Mask DontPropagateMasks[DNPMCOUNT];
static int DontPropagateRefCnts[DNPMCOUNT];
#ifdef DEBUG
static debug_events = 0;
#endif
_X_EXPORT InputInfo inputInfo;
static struct {
@ -1531,9 +1533,8 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
int i;
int type;
#ifdef DEBUG
if (debug_events) ErrorF(
"Event([%d, %d], mask=0x%x), client=%d",
#ifdef DEBUG_EVENTS
ErrorF("Event([%d, %d], mask=0x%x), client=%d",
pEvents->u.u.type, pEvents->u.u.detail, mask, client->index);
#endif
if ((client) && (client != serverClient) && (!client->clientGone) &&
@ -1549,9 +1550,9 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
if (WID(inputInfo.pointer->valuator->motionHintWindow) ==
pEvents->u.keyButtonPointer.event)
{
#ifdef DEBUG
if (debug_events) ErrorF("\n");
fprintf(stderr,"motionHintWindow == keyButtonPointer.event\n");
#ifdef DEBUG_EVENTS
ErrorF("\n");
ErrorF("motionHintWindow == keyButtonPointer.event\n");
#endif
return 1; /* don't send, but pretend we did */
}
@ -1589,15 +1590,15 @@ TryClientEvents (ClientPtr client, xEvent *pEvents, int count, Mask mask,
}
WriteEventsToClient(client, count, pEvents);
#ifdef DEBUG
if (debug_events) ErrorF( " delivered\n");
#ifdef DEBUG_EVENTS
ErrorF( " delivered\n");
#endif
return 1;
}
else
{
#ifdef DEBUG
if (debug_events) ErrorF("\n");
#ifdef DEBUG_EVENTS
ErrorF("\n");
#endif
return 0;
}
@ -2777,8 +2778,7 @@ drawable.id:0;
#endif
#ifdef DEBUG
if ((xkbDebugFlags&0x4)&&
((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
ErrorF("CoreProcessKbdEvent: Key %d %s\n",key,
(xE->u.u.type==KeyPress?"down":"up"));
}
@ -2864,8 +2864,7 @@ FixKeyState (register xEvent *xE, register DeviceIntPtr keybd)
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
#ifdef DEBUG
if ((xkbDebugFlags&0x4)&&
((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
if (((xE->u.u.type==KeyPress)||(xE->u.u.type==KeyRelease))) {
ErrorF("FixKeyState: Key %d %s\n",key,
(xE->u.u.type==KeyPress?"down":"up"));
}
@ -4593,3 +4592,431 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
(void)WriteToClient(pClient, count * sizeof(xEvent), (char *) events);
}
}
/* Maximum number of valuators, divided by six, rounded up. */
#define MAX_VALUATOR_EVENTS 6
/**
* Returns the maximum number of events GetKeyboardEvents,
* GetKeyboardValuatorEvents, and GetPointerEvents will ever return.
*
* Should be used in DIX as:
* xEvent *events = xcalloc(sizeof(xEvent), GetMaximumEventsNum());
*/
int
GetMaximumEventsNum() {
/* Two base events -- core and device, plus valuator events. Multiply
* by two if we're doing key repeats. */
int ret = 2 + MAX_VALUATOR_EVENTS;
#ifdef XKB
if (noXkbExtension)
#endif
ret *= 2;
return ret;
}
/**
* Convenience wrapper around GetKeyboardValuatorEvents, that takes no
* valuators.
*/
int
GetKeyboardEvents(xEvent *events, DeviceIntPtr pDev, int type, int key_code) {
return GetKeyboardValuatorEvents(events, pDev, type, key_code, 0, NULL);
}
/**
* Returns a set of keyboard events for KeyPress/KeyRelease, optionally
* also with valuator events. Handles Xi and XKB.
*
* events is not NULL-terminated; the return value is the number of events.
* The DDX is responsible for allocating the event structure in the first
* place via GetMaximumEventsNum(), and for freeing it.
*
* If pDev is set to send core events, then the keymap on the core
* keyboard will be pivoted to that of the new keyboard and the appropriate
* MapNotify events (both core and XKB) will be sent.
*
* Note that this function recurses! If called for non-XKB, a repeating
* key press will trigger a matching KeyRelease, as well as the
* KeyPresses.
*/
int GetKeyboardValuatorEvents(xEvent *events, DeviceIntPtr pDev, int type,
int key_code, int num_valuators,
int *valuators) {
int numEvents = 0, ms = 0, first_valuator = 0;
KeySym sym = pDev->key->curKeySyms.map[key_code *
pDev->key->curKeySyms.mapWidth];
deviceKeyButtonPointer *kbp = NULL;
deviceValuator *xv = NULL;
KeyClassPtr ckeyc;
if (!events)
return 0;
if (type != KeyPress && type != KeyRelease)
return 0;
if (!pDev->key || !pDev->focus || !pDev->kbdfeed ||
(pDev->coreEvents && !inputInfo.keyboard->key))
return 0;
if (pDev->coreEvents)
numEvents = 2;
else
numEvents = 1;
if (num_valuators) {
if ((num_valuators / 6) + 1 > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS;
numEvents += (num_valuators / 6) + 1;
}
#ifdef XKB
if (noXkbExtension)
#endif
{
switch (sym) {
case XK_Num_Lock:
case XK_Caps_Lock:
case XK_Scroll_Lock:
case XK_Shift_Lock:
if (type == KeyRelease)
return 0;
else if (type == KeyPress &&
(pDev->key->down[key_code >> 3] & (key_code & 7)) & 1)
type = KeyRelease;
}
}
/* Handle core repeating, via press/release/press/release.
* FIXME: In theory, if you're repeating with two keyboards,
* you could get unbalanced events here. */
if (type == KeyPress &&
(((pDev->key->down[key_code >> 3] & (key_code & 7))) & 1)) {
if (!pDev->kbdfeed->ctrl.autoRepeat ||
pDev->key->modifierMap[key_code] ||
!(pDev->kbdfeed->ctrl.autoRepeats[key_code >> 3]
& (1 << (key_code & 7))))
return 0;
#ifdef XKB
if (noXkbExtension)
#endif
{
numEvents += GetKeyboardValuatorEvents(events, pDev,
KeyRelease, key_code,
num_valuators, valuators);
events += numEvents;
}
}
ms = GetTimeInMillis();
kbp = (deviceKeyButtonPointer *) events;
kbp->time = ms;
kbp->deviceid = pDev->id;
if (type == KeyPress)
kbp->type = DeviceKeyPress;
else if (type == KeyRelease)
kbp->type = DeviceKeyRelease;
if (num_valuators) {
kbp->deviceid |= MORE_EVENTS;
while (first_valuator < num_valuators) {
xv = (deviceValuator *) ++events;
xv->type = DeviceValuator;
xv->first_valuator = first_valuator;
xv->num_valuators = num_valuators;
xv->deviceid = kbp->deviceid;
switch (num_valuators - first_valuator) {
case 6:
xv->valuator5 = valuators[first_valuator+5];
case 5:
xv->valuator4 = valuators[first_valuator+4];
case 4:
xv->valuator3 = valuators[first_valuator+3];
case 3:
xv->valuator2 = valuators[first_valuator+2];
case 2:
xv->valuator1 = valuators[first_valuator+1];
case 1:
xv->valuator0 = valuators[first_valuator];
}
first_valuator += 6;
}
}
if (pDev->coreEvents) {
events++;
events->u.keyButtonPointer.time = ms;
events->u.u.type = type;
events->u.u.detail = key_code;
if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr !=
pDev) {
ckeyc = inputInfo.keyboard->key;
memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH);
if (ckeyc->modifierKeyMap)
xfree(ckeyc->modifierKeyMap);
ckeyc->modifierKeyMap = xalloc(8 * pDev->key->maxKeysPerModifier);
memcpy(ckeyc->modifierKeyMap, pDev->key->modifierKeyMap,
(8 * pDev->key->maxKeysPerModifier));
ckeyc->maxKeysPerModifier = pDev->key->maxKeysPerModifier;
ckeyc->curKeySyms.minKeyCode = pDev->key->curKeySyms.minKeyCode;
ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode;
SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms);
#ifdef XKB
if (!noXkbExtension && pDev->key->xkbInfo &&
pDev->key->xkbInfo->desc) {
if (!XkbCopyKeymap(pDev->key->xkbInfo->desc,
ckeyc->xkbInfo->desc, True))
FatalError("Couldn't pivot keymap from device to core!\n");
}
#endif
SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode,
(ckeyc->curKeySyms.maxKeyCode -
ckeyc->curKeySyms.minKeyCode),
serverClient);
inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
}
}
return numEvents;
}
/* Originally a part of xf86PostMotionEvent. */
static void
acceleratePointer(DeviceIntPtr pDev, int num_valuators, int *valuators)
{
float mult = 0.0;
int dx = num_valuators >= 1 ? valuators[0] : 0;
int dy = num_valuators >= 2 ? valuators[1] : 0;
if (!num_valuators || !valuators)
return;
/*
* Accelerate
*/
if (pDev->ptrfeed && pDev->ptrfeed->ctrl.num) {
/* modeled from xf86Events.c */
if (pDev->ptrfeed->ctrl.threshold) {
if ((abs(dx) + abs(dy)) >= pDev->ptrfeed->ctrl.threshold) {
pDev->valuator->dxremaind = ((float)dx *
(float)(pDev->ptrfeed->ctrl.num)) /
(float)(pDev->ptrfeed->ctrl.den) +
pDev->valuator->dxremaind;
valuators[0] = (int)pDev->valuator->dxremaind;
pDev->valuator->dxremaind = pDev->valuator->dxremaind -
(float)valuators[0];
pDev->valuator->dyremaind = ((float)dy *
(float)(pDev->ptrfeed->ctrl.num)) /
(float)(pDev->ptrfeed->ctrl.den) +
pDev->valuator->dyremaind;
valuators[1] = (int)pDev->valuator->dyremaind;
pDev->valuator->dyremaind = pDev->valuator->dyremaind -
(float)valuators[1];
}
}
else if (dx || dy) {
mult = pow((float)(dx * dx + dy * dy),
((float)(pDev->ptrfeed->ctrl.num) /
(float)(pDev->ptrfeed->ctrl.den) - 1.0) /
2.0) / 2.0;
if (dx) {
pDev->valuator->dxremaind = mult * (float)dx +
pDev->valuator->dxremaind;
valuators[0] = (int)pDev->valuator->dxremaind;
pDev->valuator->dxremaind = pDev->valuator->dxremaind -
(float)valuators[0];
}
if (dy) {
pDev->valuator->dyremaind = mult * (float)dy +
pDev->valuator->dyremaind;
valuators[1] = (int)pDev->valuator->dyremaind;
pDev->valuator->dyremaind = pDev->valuator->dyremaind -
(float)valuators[1];
}
}
}
}
/**
* Generate a series of xEvents (returned in xE) representing pointer
* motion, or button presses. Xi and XKB-aware.
*
* events is not NULL-terminated; the return value is the number of events.
* The DDX is responsible for allocating the event structure in the first
* place via GetMaximumEventsNum(), and for freeing it.
*/
int
GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
int flags, int num_valuators, int *valuators) {
int numEvents = 0, ms = 0, first_valuator = 0;
deviceKeyButtonPointer *kbp = NULL;
deviceValuator *xv = NULL;
AxisInfoPtr axes = NULL;
Bool sendValuators = (type == MotionNotify || flags & POINTER_ABSOLUTE);
DeviceIntPtr cp = inputInfo.pointer;
if (type != MotionNotify && type != ButtonPress && type != ButtonRelease)
return 0;
if (!pDev->button || (pDev->coreEvents && !(cp->button || !cp->valuator)))
return 0;
if (pDev->coreEvents)
numEvents = 2;
else
numEvents = 1;
if (num_valuators > 2 && sendValuators) {
if (((num_valuators / 6) + 1) > MAX_VALUATOR_EVENTS)
num_valuators = MAX_VALUATOR_EVENTS;
numEvents += (num_valuators / 6) + 1;
}
else if (type == MotionNotify && num_valuators < 2) {
return 0;
}
ms = GetTimeInMillis();
kbp = (deviceKeyButtonPointer *) events;
kbp->time = ms;
kbp->deviceid = pDev->id;
if (flags & POINTER_ABSOLUTE) {
if (num_valuators >= 1) {
kbp->root_x = valuators[0];
}
else {
if (pDev->coreEvents)
kbp->root_x = cp->valuator->lastx;
else
kbp->root_x = pDev->valuator->lastx;
}
if (num_valuators >= 2) {
kbp->root_y = valuators[1];
}
else {
if (pDev->coreEvents)
kbp->root_x = cp->valuator->lasty;
else
kbp->root_y = pDev->valuator->lasty;
}
}
else {
if (flags & POINTER_ACCELERATE)
acceleratePointer(pDev, num_valuators, valuators);
if (pDev->coreEvents) {
if (num_valuators >= 1)
kbp->root_x = cp->valuator->lastx + valuators[0];
else
kbp->root_x = cp->valuator->lastx;
if (num_valuators >= 2)
kbp->root_y = cp->valuator->lasty + valuators[1];
else
kbp->root_y = cp->valuator->lasty;
}
else {
if (num_valuators >= 1)
kbp->root_x = pDev->valuator->lastx + valuators[0];
else
kbp->root_x = pDev->valuator->lastx;
if (num_valuators >= 2)
kbp->root_y = pDev->valuator->lasty + valuators[1];
else
kbp->root_y = pDev->valuator->lasty;
}
}
/* FIXME: need mipointer-like semantics to move on to different screens. */
axes = pDev->valuator->axes;
if (kbp->root_x < axes->min_value)
kbp->root_x = axes->min_value;
if (axes->max_value > 0 && kbp->root_x > axes->max_value)
kbp->root_x = axes->max_value;
axes++;
if (kbp->root_y < axes->min_value)
kbp->root_y = axes->min_value;
if (axes->max_value > 0 && kbp->root_y > axes->max_value)
kbp->root_y = axes->max_value;
if (pDev->coreEvents) {
cp->valuator->lastx = kbp->root_x;
cp->valuator->lasty = kbp->root_y;
}
pDev->valuator->lastx = kbp->root_x;
pDev->valuator->lasty = kbp->root_y;
if (type == MotionNotify) {
kbp->type = DeviceMotionNotify;
}
else {
if (type == ButtonPress)
kbp->type = DeviceButtonPress;
else if (type == ButtonRelease)
kbp->type = DeviceButtonRelease;
kbp->detail = pDev->button->map[buttons];
}
if (num_valuators > 2 && sendValuators) {
kbp->deviceid |= MORE_EVENTS;
while (first_valuator < num_valuators) {
xv = (deviceValuator *) ++events;
xv->type = DeviceValuator;
xv->first_valuator = first_valuator;
xv->num_valuators = num_valuators;
xv->deviceid = kbp->deviceid;
switch (num_valuators - first_valuator) {
case 6:
xv->valuator5 = valuators[first_valuator+5];
case 5:
xv->valuator4 = valuators[first_valuator+4];
case 4:
xv->valuator3 = valuators[first_valuator+3];
case 3:
xv->valuator2 = valuators[first_valuator+2];
case 2:
if (first_valuator == 0)
xv->valuator1 = kbp->root_y;
else
xv->valuator1 = valuators[first_valuator+1];
case 1:
if (first_valuator == 0)
xv->valuator0 = kbp->root_x;
else
xv->valuator0 = valuators[first_valuator];
}
first_valuator += 6;
}
}
if (pDev->coreEvents) {
events++;
events->u.u.type = type;
events->u.keyButtonPointer.time = ms;
events->u.keyButtonPointer.rootX = kbp->root_x;
events->u.keyButtonPointer.rootY = kbp->root_y;
cp->valuator->lastx = kbp->root_x;
cp->valuator->lasty = kbp->root_y;
if (type == ButtonPress || type == ButtonRelease) {
/* Core buttons remapping shouldn't be transitive. */
events->u.u.detail = pDev->button->map[buttons];
}
else {
events->u.u.detail = 0;
}
if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr !=
pDev)
inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
}
return numEvents;
}

View File

@ -98,6 +98,7 @@ Equipment Corporation.
#include <X11/fonts/font.h>
#include "opaque.h"
#include "servermd.h"
#include "config.h"
#include "site.h"
#include "dixfont.h"
#include "extnsionst.h"
@ -248,6 +249,7 @@ main(int argc, char *argv[], char *envp[])
int i, j, k, error;
char *xauthfile;
HWEventQueueType alwaysCheckForInput[2];
CursorMetricRec cm;
display = "0";
@ -308,6 +310,7 @@ main(int argc, char *argv[], char *envp[])
DPMSPowerLevel = 0;
#endif
InitBlockAndWakeupHandlers();
configInitialise();
/* Perform any operating system dependent initializations you'd like */
OsInit();
if(serverGeneration == 1)
@ -393,23 +396,40 @@ main(int argc, char *argv[], char *envp[])
if (!CreateRootWindow(pScreen))
FatalError("failed to create root window");
}
InitCoreDevices();
InitInput(argc, argv);
if (InitAndStartDevices() != Success)
FatalError("failed to initialize core devices");
InitFonts();
#ifdef BUILTIN_FONTS
defaultFontPath = "built-ins";
#else
if (loadableFonts) {
SetFontPath(0, 0, (unsigned char *)defaultFontPath, &error);
} else {
} else
#endif
{
if (SetDefaultFontPath(defaultFontPath) != Success)
ErrorF("failed to set default font path '%s'",
defaultFontPath);
}
if (!SetDefaultFont(defaultTextFont))
FatalError("could not open default font '%s'", defaultTextFont);
#ifdef NULL_ROOT_CURSOR
cm.width = 0;
cm.height = 0;
cm.xhot = 0;
cm.yhot = 0;
if (!(rootCursor = AllocCursor(NULL, NULL, &cm, 0, 0, 0, 0, 0, 0)))
FatalError("could not create empty root cursor");
AddResource(FakeClientID(0), RT_CURSOR, (pointer)rootCursor);
#else
if (!(rootCursor = CreateRootCursor(defaultCursorFont, 0)))
FatalError("could not open default cursor font '%s'",
defaultCursorFont);
#endif
#ifdef DPMSExtension
/* check all screens, looking for DPMS Capabilities */
DPMSCapableFlag = DPMSSupported();
@ -460,6 +480,7 @@ main(int argc, char *argv[], char *envp[])
FreeAllResources();
#endif
configFini();
CloseDownDevices();
for (i = screenInfo.numScreens - 1; i >= 0; i--)
{

View File

@ -1020,7 +1020,7 @@ int DarwinModifierStringToNXKey(const char *str)
* This allows the ddx layer to prevent some keys from being remapped
* as modifier keys.
*/
Bool LegalModifier(unsigned int key, DevicePtr pDev)
Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return 1;
}

View File

@ -53,7 +53,7 @@
/** Returns TRUE if the key is a valid modifier. For PC-class
* keyboards, all keys can be used as modifiers, so return TRUE
* always. */
Bool LegalModifier(unsigned int key, DevicePtr pDev)
Bool LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}

View File

@ -3,10 +3,14 @@ VESA_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
smi via
endif
if KDRIVEFBDEV
if BUILD_KDRIVEFBDEVLIB
FBDEV_SUBDIRS = fbdev
endif
if XFAKESERVER
XFAKE_SUBDIRS = fake
endif
if XSDLSERVER
XSDL_SUBDIRS = sdl
endif
@ -22,7 +26,7 @@ SUBDIRS = \
$(FBDEV_SUBDIRS) \
$(VESA_SUBDIRS) \
$(XEPHYR_SUBDIRS) \
fake
$(XFAKE_SUBDIRS)
DIST_SUBDIRS = vesa ati chips epson i810 mach64 mga neomagic nvidia pm2 r128 \
smi via fbdev sdl ephyr src linux fake sis300

View File

@ -61,12 +61,4 @@ ATI_LIBS = \
Xati_LDADD = \
$(ATI_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xati_DEPENDENCIES = \
libati.a \
$(FBDEV_LIBS) \
$(VESA_LIBS) \
$(DRI_LIBS)
@XSERVER_LIBS@

View File

@ -53,7 +53,15 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput(int argc, char **argv)
{
KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
KdKeyboardInfo *ki = NULL;
KdAddPointerDriver(&LinuxMouseDriver);
ki = KdNewKeyboard();
if (ki) {
ki->driver = &LinuxKeyboardDriver;
KdAddKeyboard(ki);
}
KdInitInput();
}
void

View File

@ -24,7 +24,3 @@ Xchips_LDADD = \
$(CHIPS_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xchips_DEPENDENCIES = \
libchips.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a

View File

@ -28,9 +28,4 @@ Xephyr_LDADD = \
libxephyr-hostx.a \
../../../exa/libexa.la \
@KDRIVE_LIBS@ \
@KDRIVE_LIBS@ \
@XEPHYR_LIBS@
Xephyr_DEPENDENCIES = \
libxephyr.a \
libxephyr-hostx.a

View File

@ -36,10 +36,16 @@
#include "inputstr.h"
extern int KdTsPhyScreen;
extern DeviceIntPtr pKdKeyboard;
KdKeyboardInfo *ephyrKbd;
KdPointerInfo *ephyrMouse;
EphyrKeySyms ephyrKeySyms;
static int mouseState = 0;
typedef struct _EphyrInputPrivate {
Bool enabled;
} EphyrKbdPrivate, EphyrPointerPrivate;
Bool EphyrWantGrayScale = 0;
Bool
@ -206,15 +212,14 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
{
EphyrScrPriv *scrpriv = screen->driver;
EphyrPriv *priv = screen->card->driver;
KdMouseMatrix m;
KdPointerMatrix m;
int buffer_height;
EPHYR_DBG(" screen->width: %d, screen->height: %d",
screen->width, screen->height);
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdSetMouseMatrix (&m);
KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdSetPointerMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
@ -719,8 +724,9 @@ ephyrUpdateModifierState(unsigned int state)
kptr = &keyc->down[key >> 3];
bit = 1 << (key & 7);
if (*kptr & bit)
KdEnqueueKeyboardEvent(key, TRUE); /* release */
if (*kptr & bit && ephyrKbd &&
((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); /* release */
if (--count == 0)
break;
@ -732,7 +738,9 @@ ephyrUpdateModifierState(unsigned int state)
for (key = 0; key < MAP_LENGTH; key++)
if (keyc->modifierMap[key] & mask)
{
KdEnqueueKeyboardEvent(key, FALSE); /* press */
if (keyc->modifierMap[key] & mask && ephyrKbd &&
((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); /* press */
break;
}
}
@ -748,31 +756,47 @@ ephyrPoll(void)
switch (ev.type)
{
case EPHYR_EV_MOUSE_MOTION:
KdEnqueueMouseEvent(kdMouseInfo, mouseState,
ev.data.mouse_motion.x,
ev.data.mouse_motion.y);
if (!ephyrMouse ||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
continue;
KdEnqueuePointerEvent(ephyrMouse, mouseState,
ev.data.mouse_motion.x,
ev.data.mouse_motion.y,
0);
break;
case EPHYR_EV_MOUSE_PRESS:
if (!ephyrMouse ||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
continue;
ephyrUpdateModifierState(ev.key_state);
mouseState |= ev.data.mouse_down.button_num;
KdEnqueueMouseEvent(kdMouseInfo, mouseState|KD_MOUSE_DELTA, 0, 0);
KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
break;
case EPHYR_EV_MOUSE_RELEASE:
if (!ephyrMouse ||
!((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled)
continue;
ephyrUpdateModifierState(ev.key_state);
mouseState &= ~ev.data.mouse_up.button_num;
KdEnqueueMouseEvent(kdMouseInfo, mouseState|KD_MOUSE_DELTA, 0, 0);
KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0);
break;
case EPHYR_EV_KEY_PRESS:
if (!ephyrKbd ||
!((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
continue;
ephyrUpdateModifierState(ev.key_state);
KdEnqueueKeyboardEvent (ev.data.key_down.scancode, FALSE);
KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_down.scancode, FALSE);
break;
case EPHYR_EV_KEY_RELEASE:
if (!ephyrKbd ||
!((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled)
continue;
ephyrUpdateModifierState(ev.key_state);
KdEnqueueKeyboardEvent (ev.data.key_up.scancode, TRUE);
KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE);
break;
default:
@ -833,59 +857,112 @@ ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
/* Mouse calls */
static Bool
MouseInit (void)
static Status
MouseInit (KdPointerInfo *pi)
{
return TRUE;
pi->driverPrivate = (EphyrPointerPrivate *)
xcalloc(sizeof(EphyrPointerPrivate), 1);
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
pi->nAxes = 3;
pi->nButtons = 32;
pi->name = KdSaveString("Xephyr virtual mouse");
ephyrMouse = pi;
return Success;
}
static Status
MouseEnable (KdPointerInfo *pi)
{
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE;
return Success;
}
static void
MouseFini (void)
MouseDisable (KdPointerInfo *pi)
{
;
((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE;
return;
}
KdMouseFuncs EphyrMouseFuncs = {
static void
MouseFini (KdPointerInfo *pi)
{
ephyrMouse = NULL;
return;
}
KdPointerDriver EphyrMouseDriver = {
"ephyr",
MouseInit,
MouseEnable,
MouseDisable,
MouseFini,
NULL,
};
/* Keyboard */
static void
EphyrKeyboardLoad (void)
static Status
EphyrKeyboardInit (KdKeyboardInfo *ki)
{
EPHYR_DBG("mark");
ki->driverPrivate = (EphyrKbdPrivate *)
xcalloc(sizeof(EphyrKbdPrivate), 1);
hostx_load_keymap();
if (!ephyrKeySyms.map) {
ErrorF("Couldn't load keymap from host\n");
return BadAlloc;
}
ki->keySyms.minKeyCode = ephyrKeySyms.minKeyCode;
ki->keySyms.maxKeyCode = ephyrKeySyms.maxKeyCode;
ki->minScanCode = ki->keySyms.minKeyCode;
ki->maxScanCode = ki->keySyms.maxKeyCode;
ki->keySyms.mapWidth = ephyrKeySyms.mapWidth;
ki->keySyms.map = ephyrKeySyms.map;
ki->name = KdSaveString("Xephyr virtual keyboard");
ephyrKbd = ki;
return Success;
}
static int
EphyrKeyboardInit (void)
static Status
EphyrKeyboardEnable (KdKeyboardInfo *ki)
{
return 0;
((EphyrKbdPrivate *)ki->driverPrivate)->enabled = TRUE;
return Success;
}
static void
EphyrKeyboardFini (void)
EphyrKeyboardDisable (KdKeyboardInfo *ki)
{
((EphyrKbdPrivate *)ki->driverPrivate)->enabled = FALSE;
}
static void
EphyrKeyboardFini (KdKeyboardInfo *ki)
{
/* not xfree: we call malloc from hostx.c. */
free(ki->keySyms.map);
ephyrKbd = NULL;
return;
}
static void
EphyrKeyboardLeds (KdKeyboardInfo *ki, int leds)
{
}
static void
EphyrKeyboardLeds (int leds)
EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
{
}
static void
EphyrKeyboardBell (int volume, int frequency, int duration)
{
}
KdKeyboardFuncs EphyrKeyboardFuncs = {
EphyrKeyboardLoad,
KdKeyboardDriver EphyrKeyboardDriver = {
"ephyr",
EphyrKeyboardInit,
EphyrKeyboardEnable,
EphyrKeyboardLeds,
EphyrKeyboardBell,
EphyrKeyboardDisable,
EphyrKeyboardFini,
0,
NULL,
};

View File

@ -31,7 +31,6 @@
#include "os.h" /* for OsSignal() */
#include "kdrive.h"
#include "kkeymap.h"
#include "hostx.h"
#include "exa.h"
@ -68,7 +67,9 @@ typedef struct _ephyrScrPriv {
EphyrFakexaPriv *fakexa;
} EphyrScrPriv;
extern KdCardFuncs ephyrFuncs;
extern KdCardFuncs ephyrFuncs;
extern KdKeyboardInfo *ephyrKbd;
extern KdPointerInfo *ephyrMouse;
Bool
ephyrInitialize (KdCardInfo *card, EphyrPriv *priv);
@ -167,9 +168,9 @@ ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf);
void
ephyrUpdateModifierState(unsigned int state);
extern KdMouseFuncs EphyrMouseFuncs;
extern KdPointerDriver EphyrMouseDriver;
extern KdKeyboardFuncs EphyrKeyboardFuncs;
extern KdKeyboardDriver EphyrKeyboardDriver;
extern KdOsFuncs EphyrOsFuncs;

View File

@ -51,7 +51,24 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
KdInitInput (&EphyrMouseFuncs, &EphyrKeyboardFuncs);
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);
KdInitInput();
}
void

View File

@ -77,14 +77,8 @@ static EphyrHostXVars HostX = { "?", 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
static int HostXWantDamageDebug = 0;
extern KeySym EphyrKeymap[];
extern EphyrKeySyms ephyrKeySyms;
extern KeySym kdKeymap[];
extern int kdMinScanCode;
extern int kdMaxScanCode;
extern int kdMinKeyCode;
extern int kdMaxKeyCode;
extern int kdKeymapWidth;
extern int monitorResolution;
static void
@ -403,9 +397,9 @@ hostx_get_bpp(void)
}
void
hostx_get_visual_masks (unsigned long *rmsk,
unsigned long *gmsk,
unsigned long *bmsk)
hostx_get_visual_masks (CARD32 *rmsk,
CARD32 *gmsk,
CARD32 *bmsk)
{
if (host_depth_matches_server())
{
@ -683,19 +677,21 @@ hostx_load_keymap(void)
*/
width = (host_width > 4) ? 4 : host_width;
ephyrKeySyms.map = (KeySym *)calloc(sizeof(KeySym),
(max_keycode - min_keycode + 1) *
width);
if (!ephyrKeySyms.map)
return;
for (i=0; i<(max_keycode - min_keycode+1); i++)
for (j=0; j<width; j++)
kdKeymap[ (i*width)+j ] = keymap[ (i*host_width) + j ];
ephyrKeySyms.map[(i*width)+j] = keymap[(i*host_width) + j];
EPHYR_DBG("keymap width, host:%d kdrive:%d", host_width, width);
/* all kdrive vars - see kkeymap.c */
kdMinScanCode = min_keycode;
kdMaxScanCode = max_keycode;
kdMinKeyCode = min_keycode;
kdMaxKeyCode = max_keycode;
kdKeymapWidth = width;
ephyrKeySyms.minKeyCode = min_keycode;
ephyrKeySyms.maxKeyCode = max_keycode;
ephyrKeySyms.mapWidth = width;
XFree(keymap);
}

View File

@ -26,6 +26,9 @@
#ifndef _XLIBS_STUFF_H_
#define _XLIBS_STUFF_H_
#include <X11/X.h>
#include <X11/Xmd.h>
#define EPHYR_WANT_DEBUG 0
#if (EPHYR_WANT_DEBUG)
@ -48,6 +51,14 @@ typedef enum EphyrHostXEventType
}
EphyrHostXEventType;
/* I can't believe it's not a KeySymsRec. */
typedef struct {
int minKeyCode;
int maxKeyCode;
int mapWidth;
KeySym *map;
} EphyrKeySyms;
struct EphyrHostXEvent
{
EphyrHostXEventType type;
@ -126,9 +137,9 @@ int
hostx_get_bpp(void);
void
hostx_get_visual_masks (unsigned long *rmsk,
unsigned long *gmsk,
unsigned long *bmsk);
hostx_get_visual_masks (CARD32 *rmsk,
CARD32 *gmsk,
CARD32 *bmsk);
void
hostx_set_cmap_entry(unsigned char idx,
unsigned char r,

View File

@ -24,5 +24,3 @@ Xepson_LDADD = \
$(EPSON_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xepson_DEPENDENCIES = libepson.a

View File

@ -6,10 +6,6 @@ noinst_LIBRARIES = libfake.a
bin_PROGRAMS = Xfake
if TSLIB
TSLIB_FLAG = -lts
endif
libfake_a_SOURCES = \
fake.c \
kbd.c \
@ -23,9 +19,4 @@ Xfake_SOURCES = \
Xfake_LDADD = \
libfake.a \
@KDRIVE_LIBS@ \
@KDRIVE_LIBS@ \
$(TSLIB_FLAG) \
@XSERVER_LIBS@
Xfake_DEPENDENCIES = \
libfake.a

View File

@ -158,7 +158,7 @@ Bool
fakeMapFramebuffer (KdScreenInfo *screen)
{
FakeScrPriv *scrpriv = screen->driver;
KdMouseMatrix m;
KdPointerMatrix m;
FakePriv *priv = screen->card->driver;
if (scrpriv->randr != RR_Rotate_0)
@ -166,9 +166,9 @@ fakeMapFramebuffer (KdScreenInfo *screen)
else
scrpriv->shadow = FALSE;
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdSetMouseMatrix (&m);
KdSetPointerMatrix (&m);
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
if (priv->base)

View File

@ -130,9 +130,9 @@ fakeRandRInit (ScreenPtr pScreen);
#endif
extern KdMouseFuncs FakeMouseFuncs;
extern KdPointerDriver FakePointerDriver;
extern KdKeyboardFuncs FakeKeyboardFuncs;
extern KdKeyboardDriver FakeKeyboardDriver;
extern KdOsFuncs FakeOsFuncs;

View File

@ -44,7 +44,22 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
KdInitInput (&FakeMouseFuncs, &FakeKeyboardFuncs);
KdPointerInfo *pi;
KdKeyboardInfo *ki;
pi = KdNewPointer ();
if (!pi)
return;
pi->driver = &FakePointerDriver;
KdAddPointer(pi);
ki = KdNewKeyboard ();
if (!ki)
return;
ki->driver = &FakeKeyboardDriver;
KdAddKeyboard(ki);
KdInitInput ();
}
void

View File

@ -27,7 +27,6 @@
#include <kdrive-config.h>
#endif
#include "fake.h"
#include "kkeymap.h"
#include <X11/keysym.h>
#define FAKE_WIDTH 2
@ -155,41 +154,58 @@ KeySym FakeKeymap[] = {
/* 116 123 */ NoSymbol, NoSymbol, /* tiny button */
};
static void
FakeKeyboardLoad (void)
static Status
FakeKeyboardInit (KdKeyboardInfo *ki)
{
kdMinScanCode = 1;
kdKeymapWidth = FAKE_WIDTH;
kdMaxScanCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
memcpy (kdKeymap, FakeKeymap, sizeof (FakeKeymap));
ki->keySyms.minKeyCode = 1;
ki->keySyms.maxKeyCode = (sizeof (FakeKeymap) / sizeof (FakeKeymap[0])) / FAKE_WIDTH;
ki->keySyms.mapWidth = FAKE_WIDTH;
if (ki->keySyms.map)
xfree(ki->keySyms.map);
ki->keySyms.map = (KeySym *)xalloc(sizeof(FakeKeymap));
if (!ki->keySyms.map)
return BadAlloc;
memcpy (ki->keySyms.map, FakeKeymap, sizeof (FakeKeymap));
return Success;
}
static int
FakeKeyboardInit (void)
static Status
FakeKeyboardEnable (KdKeyboardInfo *ki)
{
return 0;
return Success;
}
static void
FakeKeyboardFini (void)
FakeKeyboardDisable (KdKeyboardInfo *ki)
{
return;
}
static void
FakeKeyboardFini (KdKeyboardInfo *ki)
{
xfree(ki->keySyms.map);
ki->keySyms.map = NULL;
}
static void
FakeKeyboardLeds (KdKeyboardInfo *ki, int leds)
{
}
static void
FakeKeyboardLeds (int leds)
FakeKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration)
{
}
static void
FakeKeyboardBell (int volume, int frequency, int duration)
{
}
KdKeyboardFuncs FakeKeyboardFuncs = {
FakeKeyboardLoad,
KdKeyboardDriver FakeKeyboardDriver = {
"fake",
FakeKeyboardInit,
FakeKeyboardEnable,
FakeKeyboardLeds,
FakeKeyboardBell,
FakeKeyboardDisable,
FakeKeyboardFini,
0,
NULL,
};

View File

@ -35,19 +35,35 @@
#include "scrnintstr.h"
#include "kdrive.h"
static Bool
MouseInit (void)
static Status
MouseInit (KdPointerInfo *pi)
{
return TRUE;
return Success;
}
static Status
MouseEnable (KdPointerInfo *pi)
{
return Success;
}
static void
MouseFini (void)
MouseDisable (KdPointerInfo *pi)
{
return;
}
static void
MouseFini (KdPointerInfo *pi)
{
return;
}
KdMouseFuncs FakeMouseFuncs = {
KdPointerDriver FakePointerDriver = {
"fake",
MouseInit,
MouseEnable,
MouseDisable,
MouseFini,
};

View File

@ -4,19 +4,18 @@ INCLUDES = \
noinst_LIBRARIES = libfbdev.a
bin_PROGRAMS = Xfbdev
libfbdev_a_SOURCES = \
fbdev.c \
fbdev.h
if KDRIVEFBDEV
bin_PROGRAMS = Xfbdev
Xfbdev_SOURCES = \
fbinit.c
Xfbdev_LDADD = \
libfbdev.a \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xfbdev_DEPENDENCIES = \
libfbdev.a
@XSERVER_LIBS@
endif

View File

@ -331,7 +331,7 @@ Bool
fbdevMapFramebuffer (KdScreenInfo *screen)
{
FbdevScrPriv *scrpriv = screen->driver;
KdMouseMatrix m;
KdPointerMatrix m;
FbdevPriv *priv = screen->card->driver;
if (scrpriv->randr != RR_Rotate_0)
@ -339,9 +339,9 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
else
scrpriv->shadow = FALSE;
KdComputeMouseMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
KdSetMouseMatrix (&m);
KdSetPointerMatrix (&m);
screen->width = priv->var.xres;
screen->height = priv->var.yres;

View File

@ -45,10 +45,18 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
KdInitInput (&LinuxMouseFuncs, &LinuxKeyboardFuncs);
#ifdef TOUCHSCREEN
KdAddMouseDriver (&TsFuncs);
KdKeyboardInfo *ki;
KdAddKeyboardDriver (&LinuxKeyboardDriver);
KdAddPointerDriver (&LinuxMouseDriver);
#ifdef TSLIB
KdAddPointerDriver (&TsDriver);
#endif
ki = KdParseKeyboard ("keybd");
KdAddKeyboard(ki);
KdInitInput ();
}
void

View File

@ -27,5 +27,3 @@ Xi810_LDADD = \
$(I810_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xi810_DEPENDENCIES = libi810.a

View File

@ -27,7 +27,6 @@
#include <kdrive-config.h>
#endif
#include "itsy.h"
#include "kkeymap.h"
#include <X11/keysym.h>
#include <linux/itsy_buttons.h>
@ -167,28 +166,44 @@ ItsyKeyboardLoad (void)
{
KeySym *k;
itsyButtonState = 0;
kdMinScanCode = 1;
kdKeymapWidth = ITSY_WIDTH;
kdMaxScanCode = (sizeof (ItsyKeymap) / sizeof (ItsyKeymap[0])) / ITSY_WIDTH;
memcpy (kdKeymap, ItsyKeymap, sizeof (ItsyKeymap));
}
int
ItsyKeyboardInit (void)
static Status
ItsyKeyboardInit (KdKeyboardInfo *ki)
{
int butPort;
if (!ki)
return BadImplementation;
butPort = open ("/dev/buttons", 0);
fprintf (stderr, "butPort %d\n", butPort);
return butPort;
ki->driverPrivate = open ("/dev/buttons", 0);
itsyButtonState = 0;
ki->keySyms.minKeyCode = 1;
ki->keySyms.maxKeyCode = (sizeof (ItsyKeymap) / sizeof (ItsyKeymap[0])) / ITSY_WIDTH;
ki->minScanCode = ki->keySyms.minKeyCode;
ki->maxScanCode = ki->keySyms.maxKeyCode;
ki->keySyms.mapWidth = ITSY_WIDTH;
if (ki->keySyms.map)
xfree(ki->keySyms.map);
ki->keySyms.map = xalloc(sizeof(ItsyKeymap));
if (!ki->keySyms.map)
return BadAlloc;
memcpy (kdKeymap, ItsyKeymap, sizeof (ItsyKeymap));
return Success;
}
void
ItsyKeyboardFini (int fd)
static void
ItsyKeyboardDisable (KdKeybdInfo *ki)
{
if (fd >= 0)
close (fd);
close ((int)ki->driverPrivate);
}
static void
ItsyKeyboardFini (KdKeybdInfo *ki)
{
return;
}
void
@ -227,11 +242,13 @@ ItsyKeyboardBell (int volume, int frequency, int duration)
}
KdKeyboardFuncs itsyKeyboardFuncs = {
ItsyKeyboardLoad,
"itsy",
ItsyKeyboardInit,
ItsyKeyboardEnable,
ItsyKeyboardRead,
ItsyKeyboardLeds,
ItsyKeyboardBell,
ItsyKeyboardDisable
ItsyKeyboardFini,
0,
NULL,
};

View File

@ -63,7 +63,7 @@ itsyTsReadBytes (int fd, char *buf, int len, int min)
}
void
itsyTsRead (int tsPort)
itsyTsRead (KdPointerInfo *pi, int tsPort)
{
ts_event event;
long buf[3];
@ -89,7 +89,7 @@ itsyTsRead (int tsPort)
x = 0;
y = 0;
}
KdEnqueueMouseEvent (flags, x, y);
KdEnqueuePointerEvent (pi, flags, x, y, 0);
}
}
@ -204,7 +204,8 @@ itsyTsFini (int tsPort)
close (tsPort);
}
KdMouseFuncs itsyTsMouseFuncs = {
KdPointerDriver itsyTsMouseDriver = {
"itsyts",
itsyTsInit,
itsyTsRead,
itsyTsFini

View File

@ -32,16 +32,3 @@ liblinux_a_SOURCES = \
$(KDRIVE_HW_SOURCES) \
$(TSLIB_C) \
$(TS_C)
liblinux_a_DEPENDENCIES = \
agp.c \
bus.c \
keyboard.c \
linux.c \
mouse.c \
evdev.c \
ms.c \
ps2.c \
$(TSLIB_C) \
$(TS_C)

View File

@ -55,7 +55,7 @@ BusRead (int adbPort, void *closure)
flags |= KD_BUTTON_2;
if ((buf[0] & 1) == 0)
flags |= KD_BUTTON_3;
KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
}
}
@ -66,36 +66,71 @@ char *BusNames[] = {
#define NUM_BUS_NAMES (sizeof (BusNames) / sizeof (BusNames[0]))
int BusInputType;
static int
BusInit (KdPointerInfo *pi)
{
int i, fd = 0;
if (!pi->path || (strcmp(pi->path, "auto") == 0))
{
for (i = 0; i < NUM_BUS_NAMES; i++)
{
if ((fd = open (BusNames[i], 0)) > 0)
{
close(fd);
if (pi->path)
xfree(pi->path);
pi->path = KdSaveString(BusNames[i]);
return Success;
}
}
}
else
{
if ((fd = open(pi->path, 0)) > 0)
{
close(fd);
return Success;
}
}
return !Success;
}
static int
BusInit (void)
BusEnable (KdPointerInfo *pi)
{
int i;
int busPort;
int n = 0;
int fd = open(pi->path, 0);
if (!BusInputType)
BusInputType = KdAllocInputType ();
for (i = 0; i < NUM_BUS_NAMES; i++)
if (fd > 0)
{
busPort = open (BusNames[i], 0);
{
KdRegisterFd (BusInputType, busPort, BusRead, 0);
n++;
}
KdRegisterFd(fd, BusRead, pi);
pi->driverPrivate = (void *)fd;
return Success;
}
else
{
return !Success;
}
return n;
}
static void
BusFini (void)
BusDisable (KdPointerInfo *pi)
{
KdUnregisterFds (BusInputType, TRUE);
KdUnregisterFd(pi, (int)pi->driverPrivate, TRUE);
}
KdMouseFuncs BusMouseFuncs = {
static void
BusFini (KdPointerInfo *pi)
{
return;
}
KdPointerDriver BusMouseDriver = {
"bus",
BusInit,
BusFini
BusEnable,
BusDisable,
BusFini,
NULL
};

View File

@ -43,98 +43,100 @@
#define ISBITSET(x,y) ((x)[LONG(y)] & BIT(y))
#define OFF(x) ((x)%BITS_PER_LONG)
#define LONG(x) ((x)/BITS_PER_LONG)
#define BIT(x) (1 << OFF(x))
#define BIT(x) (1 << OFF(x))
#define SETBIT(x,y) ((x)[LONG(y)] |= BIT(y))
#define CLRBIT(x,y) ((x)[LONG(y)] &= ~BIT(y))
#define ASSIGNBIT(x,y,z) ((x)[LONG(y)] = ((x)[LONG(y)] & ~BIT(y)) | (z << OFF(y)))
typedef struct _kevdevMouse {
/* current device state */
int rel[REL_MAX + 1];
int abs[ABS_MAX + 1];
int prevabs[ABS_MAX + 1];
long key[NBITS(KEY_MAX + 1)];
int rel[REL_MAX + 1];
int abs[ABS_MAX + 1];
int prevabs[ABS_MAX + 1];
long key[NBITS(KEY_MAX + 1)];
/* supported device info */
long relbits[NBITS(REL_MAX + 1)];
long absbits[NBITS(ABS_MAX + 1)];
long keybits[NBITS(KEY_MAX + 1)];
long relbits[NBITS(REL_MAX + 1)];
long absbits[NBITS(ABS_MAX + 1)];
long keybits[NBITS(KEY_MAX + 1)];
struct input_absinfo absinfo[ABS_MAX + 1];
int max_rel;
int max_abs;
int max_rel;
int max_abs;
int fd;
} Kevdev;
static void
EvdevMotion (KdMouseInfo *mi)
EvdevMotion (KdPointerInfo *pi)
{
Kevdev *ke = mi->driver;
int i;
Kevdev *ke = pi->driverPrivate;
int i;
for (i = 0; i <= ke->max_rel; i++)
if (ke->rel[i])
{
int a;
ErrorF ("rel");
for (a = 0; a <= ke->max_rel; a++)
{
if (ISBITSET (ke->relbits, a))
ErrorF (" %d=%d", a, ke->rel[a]);
ke->rel[a] = 0;
}
ErrorF ("\n");
break;
}
if (ke->rel[i])
{
int a;
ErrorF ("rel");
for (a = 0; a <= ke->max_rel; a++)
{
if (ISBITSET (ke->relbits, a))
ErrorF (" %d=%d", a, ke->rel[a]);
ke->rel[a] = 0;
}
ErrorF ("\n");
break;
}
for (i = 0; i < ke->max_abs; i++)
if (ke->abs[i] != ke->prevabs[i])
{
int a;
ErrorF ("abs");
for (a = 0; a <= ke->max_abs; a++)
{
if (ISBITSET (ke->absbits, a))
ErrorF (" %d=%d", a, ke->abs[a]);
ke->prevabs[a] = ke->abs[a];
}
ErrorF ("\n");
break;
}
if (ke->abs[i] != ke->prevabs[i])
{
int a;
ErrorF ("abs");
for (a = 0; a <= ke->max_abs; a++)
{
if (ISBITSET (ke->absbits, a))
ErrorF (" %d=%d", a, ke->abs[a]);
ke->prevabs[a] = ke->abs[a];
}
ErrorF ("\n");
break;
}
}
static void
EvdevRead (int evdevPort, void *closure)
{
KdMouseInfo *mi = closure;
Kevdev *ke = mi->driver;
int i;
struct input_event events[NUM_EVENTS];
int n;
KdPointerInfo *pi = closure;
Kevdev *ke = pi->driverPrivate;
int i;
struct input_event events[NUM_EVENTS];
int n;
n = read (evdevPort, &events, NUM_EVENTS * sizeof (struct input_event));
if (n <= 0)
return;
return;
n /= sizeof (struct input_event);
for (i = 0; i < n; i++)
{
switch (events[i].type) {
case EV_SYN:
break;
case EV_KEY:
EvdevMotion (mi);
ASSIGNBIT(ke->key,events[i].code, events[i].value);
if (events[i].code < 0x100)
ErrorF ("key %d %d\n", events[i].code, events[i].value);
else
ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
break;
case EV_REL:
ke->rel[events[i].code] += events[i].value;
break;
case EV_ABS:
ke->abs[events[i].code] = events[i].value;
break;
}
switch (events[i].type) {
case EV_SYN:
break;
case EV_KEY:
EvdevMotion (pi);
ASSIGNBIT(ke->key,events[i].code, events[i].value);
if (events[i].code < 0x100)
ErrorF ("key %d %d\n", events[i].code, events[i].value);
else
ErrorF ("key 0x%x %d\n", events[i].code, events[i].value);
break;
case EV_REL:
ke->rel[events[i].code] += events[i].value;
break;
case EV_ABS:
ke->abs[events[i].code] = events[i].value;
break;
}
}
EvdevMotion (mi);
EvdevMotion (pi);
}
int EvdevInputType;
@ -148,143 +150,153 @@ char *kdefaultEvdev[] = {
#define NUM_DEFAULT_EVDEV (sizeof (kdefaultEvdev) / sizeof (kdefaultEvdev[0]))
static Bool
EvdevInit (void)
static Status
EvdevInit (KdPointerInfo *pi)
{
int i;
int fd;
KdMouseInfo *mi, *next;
int n = 0;
char *prot;
int i;
int fd;
int n = 0;
char *prot;
if (!EvdevInputType)
EvdevInputType = KdAllocInputType ();
for (mi = kdMouseInfo; mi; mi = next)
{
next = mi->next;
prot = mi->prot;
if (mi->inputType)
continue;
if (!mi->name)
{
for (i = 0; i < NUM_DEFAULT_EVDEV; i++)
{
fd = open (kdefaultEvdev[i], 2);
if (fd >= 0)
{
mi->name = KdSaveString (kdefaultEvdev[i]);
break;
}
}
}
else
fd = open (mi->name, 2);
if (fd >= 0)
{
unsigned long ev[NBITS(EV_MAX)];
Kevdev *ke;
if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
{
perror ("EVIOCGBIT 0");
close (fd);
continue;
}
ke = xalloc (sizeof (Kevdev));
if (!ke)
{
close (fd);
continue;
}
memset (ke, '\0', sizeof (Kevdev));
if (ISBITSET (ev, EV_KEY))
{
if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
ke->keybits) < 0)
{
perror ("EVIOCGBIT EV_KEY");
xfree (ke);
close (fd);
continue;
}
}
if (ISBITSET (ev, EV_REL))
{
if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
ke->relbits) < 0)
{
perror ("EVIOCGBIT EV_REL");
xfree (ke);
close (fd);
continue;
}
for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
if (ISBITSET(ke->relbits, ke->max_rel))
break;
}
if (ISBITSET (ev, EV_ABS))
{
int i;
if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
ke->absbits) < 0)
{
perror ("EVIOCGBIT EV_ABS");
xfree (ke);
close (fd);
continue;
}
for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
if (ISBITSET(ke->absbits, ke->max_abs))
break;
for (i = 0; i <= ke->max_abs; i++)
{
if (ISBITSET (ke->absbits, i))
if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
{
perror ("EVIOCGABS");
break;
}
ke->prevabs[i] = ABS_UNSET;
}
if (i <= ke->max_abs)
{
xfree (ke);
close (fd);
continue;
}
}
mi->driver = ke;
mi->inputType = EvdevInputType;
if (KdRegisterFd (EvdevInputType, fd, EvdevRead, (void *) mi))
n++;
}
if (!pi->path) {
for (i = 0; i < NUM_DEFAULT_EVDEV; i++) {
fd = open (kdefaultEvdev[i], 2);
if (fd >= 0) {
pi->path = KdSaveString (kdefaultEvdev[i]);
break;
}
}
}
return TRUE;
else {
fd = open (pi->path, 2);
if (fd < 0) {
ErrorF("Failed to open evdev device %s\n", pi->path);
return BadMatch;
}
}
return Success;
}
static Status
EvdevEnable (KdPointerInfo *pi)
{
int fd;
if (!pi || !pi->path)
return BadImplementation;
fd = open(pi->path, 2);
if (fd < 0)
return BadMatch;
unsigned long ev[NBITS(EV_MAX)];
Kevdev *ke;
if (ioctl (fd, EVIOCGBIT(0 /*EV*/, sizeof (ev)), ev) < 0)
{
perror ("EVIOCGBIT 0");
close (fd);
return BadMatch;
}
ke = xalloc (sizeof (Kevdev));
if (!ke)
{
close (fd);
return BadAlloc;
}
memset (ke, '\0', sizeof (Kevdev));
if (ISBITSET (ev, EV_KEY))
{
if (ioctl (fd, EVIOCGBIT (EV_KEY, sizeof (ke->keybits)),
ke->keybits) < 0)
{
perror ("EVIOCGBIT EV_KEY");
xfree (ke);
close (fd);
return BadMatch;
}
}
if (ISBITSET (ev, EV_REL))
{
if (ioctl (fd, EVIOCGBIT (EV_REL, sizeof (ke->relbits)),
ke->relbits) < 0)
{
perror ("EVIOCGBIT EV_REL");
xfree (ke);
close (fd);
return BadMatch;
}
for (ke->max_rel = REL_MAX; ke->max_rel >= 0; ke->max_rel--)
if (ISBITSET(ke->relbits, ke->max_rel))
break;
}
if (ISBITSET (ev, EV_ABS))
{
int i;
if (ioctl (fd, EVIOCGBIT (EV_ABS, sizeof (ke->absbits)),
ke->absbits) < 0)
{
perror ("EVIOCGBIT EV_ABS");
xfree (ke);
close (fd);
return BadMatch;
}
for (ke->max_abs = ABS_MAX; ke->max_abs >= 0; ke->max_abs--)
if (ISBITSET(ke->absbits, ke->max_abs))
break;
for (i = 0; i <= ke->max_abs; i++)
{
if (ISBITSET (ke->absbits, i))
if (ioctl (fd, EVIOCGABS(i), &ke->absinfo[i]) < 0)
{
perror ("EVIOCGABS");
break;
}
ke->prevabs[i] = ABS_UNSET;
}
if (i <= ke->max_abs)
{
xfree (ke);
close (fd);
return BadValue;
}
}
if (!KdRegisterFd (fd, EvdevRead, pi)) {
xfree (ke);
close (fd);
return BadAlloc;
}
pi->driverPrivate = ke;
return Success;
}
static void
EvdevFini (void)
EvdevDisable (KdPointerInfo *pi)
{
KdMouseInfo *mi;
Kevdev *ke;
KdUnregisterFds (EvdevInputType, TRUE);
for (mi = kdMouseInfo; mi; mi = mi->next)
{
if (mi->inputType == EvdevInputType)
{
xfree (mi->driver);
mi->driver = 0;
mi->inputType = 0;
}
}
if (!pi || !pi->driverPrivate)
return;
KdUnregisterFd (pi, ke->fd, TRUE);
xfree (ke);
pi->driverPrivate = 0;
}
KdMouseFuncs LinuxEvdevMouseFuncs = {
static void
EvdevFini (KdPointerInfo *pi)
{
}
KdPointerDriver LinuxEvdevMouseDriver = {
"evdev",
EvdevInit,
EvdevEnable,
EvdevDisable,
EvdevFini,
NULL,
};
#if 0

View File

@ -2,31 +2,40 @@
* $RCSId: xc/programs/Xserver/hw/kdrive/linux/keyboard.c,v 1.10 2001/11/08 10:26:24 keithp Exp $
*
* Copyright © 1999 Keith Packard
* XKB integration © 2006 Nokia Corporation, author: Tomas Frydrych <tf@o-hand.com>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
* LinuxKeyboardRead() XKB code based on xf86KbdLnx.c:
* Copyright © 1990,91 by Thomas Roell, Dinkelscherben, Germany.
* Copyright © 1994-2001 by The XFree86 Project, Inc.
*
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
#ifdef HAVE_CONFIG_H
#include <kdrive-config.h>
#endif
#include "kdrive.h"
#include "kkeymap.h"
#include <linux/keyboard.h>
#include <linux/kd.h>
#define XK_PUBLISHING
@ -34,7 +43,7 @@
#include <termios.h>
#include <sys/ioctl.h>
extern int LinuxConsoleFd;
extern int LinuxConsoleFd;
static const KeySym linux_to_x[256] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
@ -103,7 +112,108 @@ static const KeySym linux_to_x[256] = {
XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
};
static unsigned char tbl[KD_MAX_WIDTH] =
#ifdef XKB
/*
* Getting a keycode from scancode
*
* With XKB
* --------
*
* We have to enqueue keyboard events using standard X keycodes which correspond
* to AT scancode + 8; this means that we need to translate the Linux scancode
* provided by the kernel to an AT scancode -- this translation is not linear
* and requires that we use a LUT.
*
*
* Without XKB
* -----------
*
* We can use custom keycodes, which makes things simpler; we define our custom
* keycodes as Linux scancodes + KD_KEY_OFFSET
*/
/*
This LUT translates AT scancodes into Linux ones -- the keymap we create
for the core X keyboard protocol has to be AT-scancode based so that it
corresponds to the Xkb keymap.
*/
static unsigned char at2lnx[] =
{
0x0, /* no valid scancode */
0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
0x03, /* KEY_2 */ 0x04, /* KEY_3 */
0x05, /* KEY_4 */ 0x06, /* KEY_5 */
0x07, /* KEY_6 */ 0x08, /* KEY_7 */
0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
0x11, /* KEY_W */ 0x12, /* KEY_E */
0x13, /* KEY_R */ 0x14, /* KEY_T */
0x15, /* KEY_Y */ 0x16, /* KEY_U */
0x17, /* KEY_I */ 0x18, /* KEY_O */
0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
0x1f, /* KEY_S */ 0x20, /* KEY_D */
0x21, /* KEY_F */ 0x22, /* KEY_G */
0x23, /* KEY_H */ 0x24, /* KEY_J */
0x25, /* KEY_K */ 0x26, /* KEY_L */
0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
0x2d, /* KEY_X */ 0x2e, /* KEY_C */
0x2f, /* KEY_V */ 0x30, /* KEY_B */
0x31, /* KEY_N */ 0x32, /* KEY_M */
0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
0x00, /* 0x55 */ 0x56, /* KEY_Less */
0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
0x66, /* KEY_Home */ 0x67, /* KEY_Up */
0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
0x00, /* 0x71 */ 0x00, /* 0x72 */
0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
0x00, /* 0x75 */ 0x00, /* 0x76 */
0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
0x00, /* 0x7f */
};
#define NUM_AT_KEYS (sizeof(at2lnx)/sizeof(at2lnx[0]))
#define LNX_KEY_INDEX(n) n < NUM_AT_KEYS ? at2lnx[n] : 0
#else /* not XKB */
#define LNX_KEY_INDEX(n) n
#endif
static unsigned char tbl[KD_MAX_WIDTH] =
{
0,
1 << KG_SHIFT,
@ -112,24 +222,31 @@ static unsigned char tbl[KD_MAX_WIDTH] =
};
static void
readKernelMapping(void)
readKernelMapping(KdKeyboardInfo *ki)
{
KeySym *k;
int i, j;
struct kbentry kbe;
int minKeyCode, maxKeyCode;
int row;
int fd;
if (!ki)
return;
fd = LinuxConsoleFd;
minKeyCode = NR_KEYS;
maxKeyCode = 0;
row = 0;
ki->keySyms.mapWidth = KD_MAX_WIDTH;
for (i = 0; i < NR_KEYS && row < KD_MAX_LENGTH; ++i)
{
kbe.kb_index = i;
kbe.kb_index = LNX_KEY_INDEX(i);
k = kdKeymap + row * KD_MAX_WIDTH;
k = ki->keySyms.map + row * ki->keySyms.mapWidth;
for (j = 0; j < KD_MAX_WIDTH; ++j)
for (j = 0; j < ki->keySyms.mapWidth; ++j)
{
unsigned short kval;
@ -137,7 +254,7 @@ readKernelMapping(void)
kbe.kb_table = tbl[j];
kbe.kb_value = 0;
if (ioctl(LinuxConsoleFd, KDGKBENT, &kbe))
if (ioctl(fd, KDGKBENT, &kbe))
continue;
kval = KVAL(kbe.kb_value);
@ -362,7 +479,7 @@ readKernelMapping(void)
if (minKeyCode == NR_KEYS)
continue;
if (k[3] == k[2]) k[3] = NoSymbol;
if (k[2] == k[1]) k[2] = NoSymbol;
if (k[1] == k[0]) k[1] = NoSymbol;
@ -370,28 +487,223 @@ readKernelMapping(void)
if (k[3] == k[0] && k[2] == k[1] && k[2] == NoSymbol) k[3] =NoSymbol;
row++;
}
kdMinScanCode = minKeyCode;
kdMaxScanCode = maxKeyCode;
ki->minScanCode = minKeyCode;
ki->maxScanCode = maxKeyCode;
}
static void
LinuxKeyboardLoad (void)
{
readKernelMapping ();
}
#ifdef XKB
/*
* We need these to handle extended scancodes correctly (I could just use the
* numbers below, but this makes the code more readable
*/
/* The prefix codes */
#define KEY_Prefix0 /* special 0x60 */ 96
#define KEY_Prefix1 /* special 0x61 */ 97
/* The raw scancodes */
#define KEY_Enter /* Enter 0x1c */ 28
#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29
#define KEY_Slash /* / (Slash) ? 0x35 */ 53
#define KEY_KP_Multiply /* * 0x37 */ 55
#define KEY_Alt /* Alt(left) 0x38 */ 56
#define KEY_F3 /* F3 0x3d */ 61
#define KEY_F4 /* F4 0x3e */ 62
#define KEY_F5 /* F5 0x3f */ 63
#define KEY_F6 /* F6 0x40 */ 64
#define KEY_F7 /* F7 0x41 */ 65
#define KEY_ScrollLock /* ScrollLock 0x46 */ 70
#define KEY_KP_7 /* 7 Home 0x47 */ 71
#define KEY_KP_8 /* 8 Up 0x48 */ 72
#define KEY_KP_9 /* 9 PgUp 0x49 */ 73
#define KEY_KP_Minus /* - (Minus) 0x4a */ 74
#define KEY_KP_4 /* 4 Left 0x4b */ 75
#define KEY_KP_5 /* 5 0x4c */ 76
#define KEY_KP_6 /* 6 Right 0x4d */ 77
#define KEY_KP_Plus /* + (Plus) 0x4e */ 78
#define KEY_KP_1 /* 1 End 0x4f */ 79
#define KEY_KP_2 /* 2 Down 0x50 */ 80
#define KEY_KP_3 /* 3 PgDown 0x51 */ 81
#define KEY_KP_0 /* 0 Insert 0x52 */ 82
#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83
#define KEY_Home /* Home 0x59 */ 89
#define KEY_Up /* Up 0x5a */ 90
#define KEY_PgUp /* PgUp 0x5b */ 91
#define KEY_Left /* Left 0x5c */ 92
#define KEY_Begin /* Begin 0x5d */ 93
#define KEY_Right /* Right 0x5e */ 94
#define KEY_End /* End 0x5f */ 95
#define KEY_Down /* Down 0x60 */ 96
#define KEY_PgDown /* PgDown 0x61 */ 97
#define KEY_Insert /* Insert 0x62 */ 98
#define KEY_Delete /* Delete 0x63 */ 99
#define KEY_KP_Enter /* Enter 0x64 */ 100
#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101
#define KEY_Pause /* Pause 0x66 */ 102
#define KEY_Print /* Print 0x67 */ 103
#define KEY_KP_Divide /* Divide 0x68 */ 104
#define KEY_AltLang /* AtlLang(right) 0x69 */ 105
#define KEY_Break /* Break 0x6a */ 106
#define KEY_LMeta /* Left Meta 0x6b */ 107
#define KEY_RMeta /* Right Meta 0x6c */ 108
#define KEY_Menu /* Menu 0x6d */ 109
#define KEY_F13 /* F13 0x6e */ 110
#define KEY_F14 /* F14 0x6f */ 111
#define KEY_F15 /* F15 0x70 */ 112
#define KEY_F16 /* F16 0x71 */ 113
#define KEY_F17 /* F17 0x72 */ 114
#define KEY_KP_DEC /* KP_DEC 0x73 */ 115
#endif /* XKB */
static void
LinuxKeyboardRead (int fd, void *closure)
{
unsigned char buf[256], *b;
int n;
unsigned char prefix = 0, scancode = 0;
while ((n = read (fd, buf, sizeof (buf))) > 0)
{
while ((n = read (fd, buf, sizeof (buf))) > 0) {
b = buf;
while (n--)
{
KdEnqueueKeyboardEvent (b[0] & 0x7f, b[0] & 0x80);
while (n--) {
#ifdef XKB
if (!noXkbExtension) {
/*
* With xkb we use RAW mode for reading the console, which allows us
* process extended scancodes.
*
* See if this is a prefix extending the following keycode
*/
if (!prefix && ((b[0] & 0x7f) == KEY_Prefix0))
{
prefix = KEY_Prefix0;
#ifdef DEBUG
ErrorF("Prefix0");
#endif
/* swallow this up */
b++;
continue;
}
else if (!prefix && ((b[0] & 0x7f) == KEY_Prefix1))
{
prefix = KEY_Prefix1;
ErrorF("Prefix1");
/* swallow this up */
b++;
continue;
}
scancode = b[0] & 0x7f;
switch (prefix) {
/* from xf86Events.c */
case KEY_Prefix0:
{
#ifdef DEBUG
ErrorF("Prefix0 scancode: 0x%02x\n", scancode);
#endif
switch (scancode) {
case KEY_KP_7:
scancode = KEY_Home; break; /* curs home */
case KEY_KP_8:
scancode = KEY_Up; break; /* curs up */
case KEY_KP_9:
scancode = KEY_PgUp; break; /* curs pgup */
case KEY_KP_4:
scancode = KEY_Left; break; /* curs left */
case KEY_KP_5:
scancode = KEY_Begin; break; /* curs begin */
case KEY_KP_6:
scancode = KEY_Right; break; /* curs right */
case KEY_KP_1:
scancode = KEY_End; break; /* curs end */
case KEY_KP_2:
scancode = KEY_Down; break; /* curs down */
case KEY_KP_3:
scancode = KEY_PgDown; break; /* curs pgdown */
case KEY_KP_0:
scancode = KEY_Insert; break; /* curs insert */
case KEY_KP_Decimal:
scancode = KEY_Delete; break; /* curs delete */
case KEY_Enter:
scancode = KEY_KP_Enter; break; /* keypad enter */
case KEY_LCtrl:
scancode = KEY_RCtrl; break; /* right ctrl */
case KEY_KP_Multiply:
scancode = KEY_Print; break; /* print */
case KEY_Slash:
scancode = KEY_KP_Divide; break; /* keyp divide */
case KEY_Alt:
scancode = KEY_AltLang; break; /* right alt */
case KEY_ScrollLock:
scancode = KEY_Break; break; /* curs break */
case 0x5b:
scancode = KEY_LMeta; break;
case 0x5c:
scancode = KEY_RMeta; break;
case 0x5d:
scancode = KEY_Menu; break;
case KEY_F3:
scancode = KEY_F13; break;
case KEY_F4:
scancode = KEY_F14; break;
case KEY_F5:
scancode = KEY_F15; break;
case KEY_F6:
scancode = KEY_F16; break;
case KEY_F7:
scancode = KEY_F17; break;
case KEY_KP_Plus:
scancode = KEY_KP_DEC; break;
/* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) */
case 0x2A:
case 0x36:
b++;
prefix = 0;
continue;
default:
#ifdef DEBUG
ErrorF("Unreported Prefix0 scancode: 0x%02x\n",
scancode);
#endif
/*
* "Internet" keyboards are generating lots of new
* codes. Let them pass. There is little consistency
* between them, so don't bother with symbolic names at
* this level.
*/
scancode += 0x78;
}
break;
}
case KEY_Prefix1:
{
/* we do no handle these */
#ifdef DEBUG
ErrorF("Prefix1 scancode: 0x%02x\n", scancode);
#endif
b++;
prefix = 0;
continue;
}
default: /* should not happen*/
case 0: /* do nothing */
#ifdef DEBUG
ErrorF("Plain scancode: 0x%02x\n", scancode);
#endif
;
}
prefix = 0;
}
/* without xkb we use mediumraw mode -- enqueue the scancode as is */
else
#endif
scancode = b[0] & 0x7f;
KdEnqueueKeyboardEvent (closure, scancode, b[0] & 0x80);
b++;
}
}
@ -399,19 +711,30 @@ LinuxKeyboardRead (int fd, void *closure)
static int LinuxKbdTrans;
static struct termios LinuxTermios;
static int LinuxKbdType;
static int
LinuxKeyboardEnable (int fd, void *closure)
static Status
LinuxKeyboardEnable (KdKeyboardInfo *ki)
{
struct termios nTty;
unsigned char buf[256];
int n;
int fd;
if (!ki)
return !Success;
fd = LinuxConsoleFd;
ki->driverPrivate = (void *) fd;
ioctl (fd, KDGKBMODE, &LinuxKbdTrans);
tcgetattr (fd, &LinuxTermios);
ioctl(fd, KDSKBMODE, K_MEDIUMRAW);
#ifdef XKB
if (!noXkbExtension)
ioctl(fd, KDSKBMODE, K_RAW);
else
#else
ioctl(fd, KDSKBMODE, K_MEDIUMRAW);
#endif
nTty = LinuxTermios;
nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP);
nTty.c_oflag = 0;
@ -422,54 +745,74 @@ LinuxKeyboardEnable (int fd, void *closure)
cfsetispeed(&nTty, 9600);
cfsetospeed(&nTty, 9600);
tcsetattr(fd, TCSANOW, &nTty);
/* Our kernel cleverly ignores O_NONBLOCK. Sigh. */
#if 0
/*
* Flush any pending keystrokes
*/
while ((n = read (fd, buf, sizeof (buf))) > 0)
;
return fd;
#endif
KdRegisterFd (fd, LinuxKeyboardRead, ki);
return Success;
}
static void
LinuxKeyboardDisable (int fd, void *closure)
LinuxKeyboardDisable (KdKeyboardInfo *ki)
{
ioctl(LinuxConsoleFd, KDSKBMODE, LinuxKbdTrans);
tcsetattr(LinuxConsoleFd, TCSANOW, &LinuxTermios);
int fd;
if (!ki)
return;
fd = (int) ki->driverPrivate;
KdUnregisterFd(ki, fd, FALSE);
ioctl(fd, KDSKBMODE, LinuxKbdTrans);
tcsetattr(fd, TCSANOW, &LinuxTermios);
}
static int
LinuxKeyboardInit (void)
static Status
LinuxKeyboardInit (KdKeyboardInfo *ki)
{
if (!LinuxKbdType)
LinuxKbdType = KdAllocInputType ();
if (!ki)
return !Success;
KdRegisterFd (LinuxKbdType, LinuxConsoleFd, LinuxKeyboardRead, 0);
LinuxKeyboardEnable (LinuxConsoleFd, 0);
KdRegisterFdEnableDisable (LinuxConsoleFd,
LinuxKeyboardEnable,
LinuxKeyboardDisable);
return 1;
if (ki->path)
xfree(ki->path);
ki->path = KdSaveString("console");
if (ki->name)
xfree(ki->name);
ki->name = KdSaveString("Linux console keyboard");
readKernelMapping (ki);
return Success;
}
static void
LinuxKeyboardFini (void)
LinuxKeyboardFini (KdKeyboardInfo *ki)
{
LinuxKeyboardDisable (LinuxConsoleFd, 0);
KdUnregisterFds (LinuxKbdType, FALSE);
}
static void
LinuxKeyboardLeds (int leds)
LinuxKeyboardLeds (KdKeyboardInfo *ki, int leds)
{
ioctl (LinuxConsoleFd, KDSETLED, leds & 7);
if (!ki)
return;
ioctl ((int)ki->driverPrivate, KDSETLED, leds & 7);
}
static void
LinuxKeyboardBell (int volume, int pitch, int duration)
LinuxKeyboardBell (KdKeyboardInfo *ki, int volume, int pitch, int duration)
{
if (!ki)
return;
if (volume && pitch)
{
ioctl(LinuxConsoleFd, KDMKTONE,
ioctl((int)ki->driverPrivate, KDMKTONE,
((1193190 / pitch) & 0xffff) |
(((unsigned long)duration *
volume / 50) << 16));
@ -477,11 +820,13 @@ LinuxKeyboardBell (int volume, int pitch, int duration)
}
}
KdKeyboardFuncs LinuxKeyboardFuncs = {
LinuxKeyboardLoad,
KdKeyboardDriver LinuxKeyboardDriver = {
"keyboard",
LinuxKeyboardInit,
LinuxKeyboardEnable,
LinuxKeyboardLeds,
LinuxKeyboardBell,
LinuxKeyboardDisable,
LinuxKeyboardFini,
3,
NULL,
};

View File

@ -456,6 +456,7 @@ LinuxFini (void)
}
}
close(LinuxConsoleFd); /* make the vt-manager happy */
LinuxConsoleFd = -1;
fd = open ("/dev/tty0", O_RDWR|O_NDELAY, 0);
if (fd >= 0)
{

View File

@ -206,10 +206,10 @@ MouseWriteBytes (int fd, unsigned char *c, int n, int timeout)
typedef struct _kmouseProt {
char *name;
Bool (*Complete) (KdMouseInfo *mi, unsigned char *ev, int ne);
int (*Valid) (KdMouseInfo *mi, unsigned char *ev, int ne);
Bool (*Parse) (KdMouseInfo *mi, unsigned char *ev, int ne);
Bool (*Init) (KdMouseInfo *mi);
Bool (*Complete) (KdPointerInfo *pi, unsigned char *ev, int ne);
int (*Valid) (KdPointerInfo *pi, unsigned char *ev, int ne);
Bool (*Parse) (KdPointerInfo *pi, unsigned char *ev, int ne);
Bool (*Init) (KdPointerInfo *pi);
unsigned char headerMask, headerValid;
unsigned char dataMask, dataValid;
Bool tty;
@ -238,9 +238,9 @@ typedef struct _kmouse {
unsigned long state; /* private per protocol, init to prot->state */
} Kmouse;
static int mouseValid (KdMouseInfo *mi, unsigned char *ev, int ne)
static int mouseValid (KdPointerInfo *pi, unsigned char *ev, int ne)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
const KmouseProt *prot = km->prot;
int i;
@ -255,24 +255,24 @@ static int mouseValid (KdMouseInfo *mi, unsigned char *ev, int ne)
return 0;
}
static Bool threeComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
static Bool threeComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
{
return ne == 3;
}
static Bool fourComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
static Bool fourComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
{
return ne == 4;
}
static Bool fiveComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
static Bool fiveComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
{
return ne == 5;
}
static Bool MouseReasonable (KdMouseInfo *mi, unsigned long flags, int dx, int dy)
static Bool MouseReasonable (KdPointerInfo *pi, unsigned long flags, int dx, int dy)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
if (km->stage == MouseWorking)
return TRUE;
@ -296,9 +296,9 @@ static Bool MouseReasonable (KdMouseInfo *mi, unsigned long flags, int dx, int d
/*
* Standard PS/2 mouse protocol
*/
static Bool ps2Parse (KdMouseInfo *mi, unsigned char *ev, int ne)
static Bool ps2Parse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
int dx, dy, dz;
unsigned long flags;
unsigned long flagsrelease = 0;
@ -333,21 +333,21 @@ static Bool ps2Parse (KdMouseInfo *mi, unsigned char *ev, int ne)
if (ev[0] & 0x20)
dy -= 256;
dy = -dy;
if (!MouseReasonable (mi, flags, dx, dy))
if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
{
KdEnqueueMouseEvent (mi, flags, dx, dy);
KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
if (flagsrelease)
{
flags &= ~flagsrelease;
KdEnqueueMouseEvent (mi, flags, dx, dy);
KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
}
}
return TRUE;
}
static Bool ps2Init (KdMouseInfo *mi);
static Bool ps2Init (KdPointerInfo *pi);
static const KmouseProt ps2Prot = {
"ps/2",
@ -450,9 +450,9 @@ static unsigned char intelli_init[] = {
#define NINIT_INTELLI 3
static int
ps2SkipInit (KdMouseInfo *mi, int ninit, Bool ret_next)
ps2SkipInit (KdPointerInfo *pi, int ninit, Bool ret_next)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
int c = -1;
int skipping;
Bool waiting;
@ -481,9 +481,9 @@ ps2SkipInit (KdMouseInfo *mi, int ninit, Bool ret_next)
}
static Bool
ps2Init (KdMouseInfo *mi)
ps2Init (KdPointerInfo *pi)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
int skipping;
Bool waiting;
int id;
@ -499,7 +499,7 @@ ps2Init (KdMouseInfo *mi)
return FALSE;
skipping = 0;
waiting = FALSE;
id = ps2SkipInit (mi, 0, TRUE);
id = ps2SkipInit (pi, 0, TRUE);
switch (id) {
case 3:
init = wheel_3button_init;
@ -524,13 +524,13 @@ ps2Init (KdMouseInfo *mi)
* initialization string. Make sure any partial event is
* skipped
*/
(void) ps2SkipInit (mi, ninit, FALSE);
(void) ps2SkipInit (pi, ninit, FALSE);
return TRUE;
}
static Bool busParse (KdMouseInfo *mi, unsigned char *ev, int ne)
static Bool busParse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
int dx, dy;
unsigned long flags;
@ -543,10 +543,10 @@ static Bool busParse (KdMouseInfo *mi, unsigned char *ev, int ne)
flags |= KD_BUTTON_2;
if ((ev[0] & 1) == 0)
flags |= KD_BUTTON_3;
if (!MouseReasonable (mi, flags, dx, dy))
if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
KdEnqueueMouseEvent (mi, flags, dx, dy);
KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
return TRUE;
}
@ -561,9 +561,9 @@ static const KmouseProt busProt = {
* Standard MS serial protocol, three bytes
*/
static Bool msParse (KdMouseInfo *mi, unsigned char *ev, int ne)
static Bool msParse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
int dx, dy;
unsigned long flags;
@ -576,10 +576,10 @@ static Bool msParse (KdMouseInfo *mi, unsigned char *ev, int ne)
dx = (signed char)(((ev[0] & 0x03) << 6) | (ev[1] & 0x3F));
dy = (signed char)(((ev[0] & 0x0C) << 4) | (ev[2] & 0x3F));
if (!MouseReasonable (mi, flags, dx, dy))
if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
KdEnqueueMouseEvent (mi, flags, dx, dy);
KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
return TRUE;
}
@ -600,9 +600,9 @@ static const KmouseProt msProt = {
* first byte of a synchronized protocol stream and see if it's got
* any bits turned on that can't occur in that fourth byte
*/
static Bool logiComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
static Bool logiComplete (KdPointerInfo *pi, unsigned char *ev, int ne)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
if ((ev[0] & 0x40) == 0x40)
return ne == 3;
@ -611,9 +611,9 @@ static Bool logiComplete (KdMouseInfo *mi, unsigned char *ev, int ne)
return FALSE;
}
static int logiValid (KdMouseInfo *mi, unsigned char *ev, int ne)
static int logiValid (KdPointerInfo *pi, unsigned char *ev, int ne)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
const KmouseProt *prot = km->prot;
int i;
@ -632,9 +632,9 @@ static int logiValid (KdMouseInfo *mi, unsigned char *ev, int ne)
return 0;
}
static Bool logiParse (KdMouseInfo *mi, unsigned char *ev, int ne)
static Bool logiParse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
int dx, dy;
unsigned long flags;
@ -660,10 +660,10 @@ static Bool logiParse (KdMouseInfo *mi, unsigned char *ev, int ne)
flags |= km->state & (KD_BUTTON_1|KD_BUTTON_3);
}
if (!MouseReasonable (mi, flags, dx, dy))
if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
KdEnqueueMouseEvent (mi, flags, dx, dy);
KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
return TRUE;
}
@ -682,9 +682,9 @@ static const KmouseProt logiProt = {
/*
* Mouse systems protocol, 5 bytes
*/
static Bool mscParse (KdMouseInfo *mi, unsigned char *ev, int ne)
static Bool mscParse (KdPointerInfo *pi, unsigned char *ev, int ne)
{
Kmouse *km = mi->driver;
Kmouse *km = pi->driverPrivate;
int dx, dy;
unsigned long flags;
@ -699,10 +699,10 @@ static Bool mscParse (KdMouseInfo *mi, unsigned char *ev, int ne)
dx = (signed char)(ev[1]) + (signed char)(ev[3]);
dy = - ((signed char)(ev[2]) + (signed char)(ev[4]));
if (!MouseReasonable (mi, flags, dx, dy))
if (!MouseReasonable (pi, flags, dx, dy))
return FALSE;
if (km->stage == MouseWorking)
KdEnqueueMouseEvent (mi, flags, dx, dy);
KdEnqueuePointerEvent (pi, flags, dx, dy, 0);
return TRUE;
}
@ -810,8 +810,8 @@ MouseNextProtocol (Kmouse *km)
static void
MouseRead (int mousePort, void *closure)
{
KdMouseInfo *mi = closure;
Kmouse *km = mi->driver;
KdPointerInfo *pi = closure;
Kmouse *km = pi->driverPrivate;
unsigned char event[MAX_MOUSE];
int ne;
int c;
@ -835,7 +835,7 @@ MouseRead (int mousePort, void *closure)
break;
}
event[ne++] = c;
i = (*km->prot->Valid) (mi, event, ne);
i = (*km->prot->Valid) (pi, event, ne);
if (i != 0)
{
#ifdef DEBUG
@ -867,9 +867,9 @@ MouseRead (int mousePort, void *closure)
}
else
{
if ((*km->prot->Complete) (mi, event, ne))
if ((*km->prot->Complete) (pi, event, ne))
{
if ((*km->prot->Parse) (mi, event, ne))
if ((*km->prot->Parse) (pi, event, ne))
{
switch (km->stage)
{
@ -896,7 +896,7 @@ MouseRead (int mousePort, void *closure)
km->invalid = 0;
km->tested = 0;
km->valid = 0;
if (km->prot->Init && !(*km->prot->Init) (mi))
if (km->prot->Init && !(*km->prot->Init) (pi))
km->stage = MouseBroken;
}
break;
@ -923,9 +923,9 @@ MouseRead (int mousePort, void *closure)
int MouseInputType;
char *kdefaultMouse[] = {
"/dev/input/mice",
"/dev/mouse",
"/dev/psaux",
"/dev/input/mice",
"/dev/adbmouse",
"/dev/ttyS0",
"/dev/ttyS1",
@ -933,81 +933,97 @@ char *kdefaultMouse[] = {
#define NUM_DEFAULT_MOUSE (sizeof (kdefaultMouse) / sizeof (kdefaultMouse[0]))
static Bool
MouseInit (void)
static Status
MouseInit (KdPointerInfo *pi)
{
int i;
int fd;
Kmouse *km;
KdMouseInfo *mi, *next;
int n = 0;
char *prot;
if (!MouseInputType)
MouseInputType = KdAllocInputType ();
for (mi = kdMouseInfo; mi; mi = next)
{
next = mi->next;
prot = mi->prot;
if (mi->inputType)
continue;
if (!mi->name)
{
for (i = 0; i < NUM_DEFAULT_MOUSE; i++)
{
fd = open (kdefaultMouse[i], 2);
if (fd >= 0)
{
mi->name = KdSaveString (kdefaultMouse[i]);
break;
}
}
}
else
fd = open (mi->name, 2);
if (fd >= 0)
{
km = (Kmouse *) xalloc (sizeof (Kmouse));
if (km)
{
km->iob.fd = fd;
km->iob.avail = km->iob.used = 0;
km->prot = 0;
km->i_prot = 0;
km->tty = isatty (fd);
mi->driver = km;
mi->inputType = MouseInputType;
MouseFirstProtocol (km, mi->prot);
if (KdRegisterFd (MouseInputType, fd, MouseRead, (void *) mi))
n++;
}
else
close (fd);
}
if (!pi)
return BadImplementation;
if (!pi->path || strcmp(pi->path, "auto") == 0) {
for (i = 0; i < NUM_DEFAULT_MOUSE; i++) {
fd = open (kdefaultMouse[i], 2);
if (fd >= 0) {
pi->path = KdSaveString (kdefaultMouse[i]);
break;
}
}
}
return TRUE;
else {
fd = open (pi->path, 2);
}
if (fd < 0)
return BadMatch;
close(fd);
km = (Kmouse *) xalloc (sizeof (Kmouse));
if (km) {
km->iob.avail = km->iob.used = 0;
MouseFirstProtocol(km, "exps/2");
km->i_prot = 0;
km->tty = isatty (fd);
km->iob.fd = -1;
pi->driverPrivate = km;
}
else {
close (fd);
return BadAlloc;
}
return Success;
}
static Status
MouseEnable (KdPointerInfo *pi)
{
Kmouse *km;
if (!pi || !pi->driverPrivate || !pi->path)
return BadImplementation;
km = pi->driverPrivate;
km->iob.fd = open(pi->path, 2);
if (km->iob.fd < 0)
return BadMatch;
if (!KdRegisterFd (km->iob.fd, MouseRead, pi))
{
close(km->iob.fd);
return BadAlloc;
}
return Success;
}
static void
MouseFini (void)
MouseDisable (KdPointerInfo *pi)
{
KdMouseInfo *mi;
KdUnregisterFds (MouseInputType, TRUE);
for (mi = kdMouseInfo; mi; mi = mi->next)
{
if (mi->inputType == MouseInputType)
{
xfree (mi->driver);
mi->driver = 0;
mi->inputType = 0;
}
}
Kmouse *km;
if (!pi || !pi->driverPrivate)
return;
km = pi->driverPrivate;
KdUnregisterFd (pi, km->iob.fd, TRUE);
}
KdMouseFuncs LinuxMouseFuncs = {
static void
MouseFini (KdPointerInfo *pi)
{
xfree (pi->driverPrivate);
pi->driverPrivate = NULL;
}
KdPointerDriver LinuxMouseDriver = {
"mouse",
MouseInit,
MouseEnable,
MouseDisable,
MouseFini,
NULL,
};

View File

@ -90,41 +90,50 @@ MsRead (int port, void *closure)
dy = (char)(((b[0] & 0x0C) << 4) | (b[2] & 0x3F));
n -= 3;
b += 3;
KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
}
}
}
int MsInputType;
static Status
MsInit (KdPointerInfo *pi)
{
if (!pi)
return BadImplementation;
static int
MsInit (void)
if (!pi->path || strcmp(pi->path, "auto"))
pi->path = KdSaveString("/dev/mouse");
if (!pi->name)
pi->name = KdSaveString("Microsoft protocol mouse");
return Success;
}
static Status
MsEnable (KdPointerInfo *pi)
{
int port;
char *device = "/dev/mouse";
struct termios t;
int ret;
if (!MsInputType)
MsInputType = KdAllocInputType ();
port = open (device, O_RDWR | O_NONBLOCK);
port = open (pi->path, O_RDWR | O_NONBLOCK);
if(port < 0) {
ErrorF("Couldn't open %s (%d)\n", device, (int)errno);
ErrorF("Couldn't open %s (%d)\n", pi->path, (int)errno);
return 0;
} else if (port == 0) {
ErrorF("Opening %s returned 0! Please complain to Keith.\n",
device);
pi->path);
goto bail;
}
if(!isatty(port)) {
ErrorF("%s is not a tty\n", device);
ErrorF("%s is not a tty\n", pi->path);
goto bail;
}
ret = tcgetattr(port, &t);
if(ret < 0) {
ErrorF("Couldn't tcgetattr(%s): %d\n", device, errno);
ErrorF("Couldn't tcgetattr(%s): %d\n", pi->path, errno);
goto bail;
}
t.c_iflag &= ~ (IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR |
@ -140,24 +149,36 @@ MsInit (void)
t.c_cc[VTIME] = 0;
ret = tcsetattr(port, TCSANOW, &t);
if(ret < 0) {
ErrorF("Couldn't tcsetattr(%s): %d\n", device, errno);
ErrorF("Couldn't tcsetattr(%s): %d\n", pi->path, errno);
goto bail;
}
if (KdRegisterFd (MsInputType, port, MsRead, (void *) 0))
return 1;
if (KdRegisterFd (port, MsRead, pi))
return TRUE;
pi->driverPrivate = (void *)port;
return Success;
bail:
close(port);
return 0;
return BadMatch;
}
static void
MsFini (void)
MsDisable (KdPointerInfo *pi)
{
KdUnregisterFds (MsInputType, TRUE);
KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
}
KdMouseFuncs MsMouseFuncs = {
static void
MsFini (KdPointerInfo *pi)
{
}
KdPointerDriver MsMouseDriver = {
"ms",
MsInit,
MsFini
MsEnable,
MsDisable,
MsFini,
NULL,
};

View File

@ -112,42 +112,78 @@ Ps2Read (int ps2Port, void *closure)
dy = -dy;
n -= 3;
b += 3;
KdEnqueueMouseEvent (kdMouseInfo, flags, dx, dy);
KdEnqueuePointerEvent (closure, flags, dx, dy, 0);
}
}
}
int Ps2InputType;
static int
Ps2Init (void)
static Status
Ps2Init (KdPointerInfo *pi)
{
int i;
int ps2Port;
int n;
int ps2Port, i;
if (!Ps2InputType)
Ps2InputType = KdAllocInputType ();
n = 0;
for (i = 0; i < NUM_PS2_NAMES; i++)
{
ps2Port = open (Ps2Names[i], 0);
if (ps2Port >= 0)
{
if (KdRegisterFd (Ps2InputType, ps2Port, Ps2Read, (void *) i))
n++;
if (!pi->path) {
for (i = 0; i < NUM_PS2_NAMES; i++) {
ps2Port = open (Ps2Names[i], 0);
if (ps2Port >= 0) {
pi->path = KdSaveString (Ps2Names[i]);
break;
}
}
}
return n;
else {
ps2Port = open (pi->path, 0);
}
if (ps2Port < 0)
return BadMatch;
close(ps2Port);
if (!pi->name)
pi->name = KdSaveString ("PS/2 Mouse");
return Success;
}
static Status
Ps2Enable (KdPointerInfo *pi)
{
int fd;
if (!pi)
return BadImplementation;
fd = open (pi->path, 0);
if (fd < 0)
return BadMatch;
if (!KdRegisterFd (fd, Ps2Read, pi)) {
close(fd);
return BadAlloc;
}
pi->driverPrivate = (void *)fd;
return Success;
}
static void
Ps2Disable (KdPointerInfo *pi)
{
KdUnregisterFd (pi, (int)pi->driverPrivate, TRUE);
}
static void
Ps2Fini (void)
Ps2Fini (KdPointerInfo *pi)
{
KdUnregisterFds (Ps2InputType, TRUE);
}
KdMouseFuncs Ps2MouseFuncs = {
KdPointerDriver Ps2MouseDriver = {
"ps2",
Ps2Init,
Ps2Fini
Ps2Enable,
Ps2Disable,
Ps2Fini,
NULL,
};

View File

@ -75,7 +75,7 @@ TsReadBytes (int fd, char *buf, int len, int min)
static void
TsRead (int tsPort, void *closure)
{
KdMouseInfo *mi = closure;
KdPointerInfo *pi = closure;
TS_EVENT event;
int n;
long x, y;
@ -117,7 +117,7 @@ TsRead (int tsPort, void *closure)
lastx = 0;
lasty = 0;
}
KdEnqueueMouseEvent (mi, flags, x, y);
KdEnqueuePointerEvent (pi, flags, x, y, 0);
}
}
@ -129,95 +129,83 @@ char *TsNames[] = {
#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0]))
int TsInputType;
static int
TsEnable (int fd, void *closure)
{
KdMouseInfo *mi = (KdMouseInfo *)closure;
return open (mi->name, 0);
}
static void
TsDisable (int fd, void *closure)
{
close (fd);
}
static int
TsInit (void)
static Status
TsInit (KdPointerInfo *pi)
{
int i;
int fd;
KdMouseInfo *mi, *next;
int n = 0;
if (!TsInputType)
TsInputType = KdAllocInputType ();
for (mi = kdMouseInfo; mi; mi = next)
{
next = mi->next;
if (mi->inputType)
continue;
if (!mi->name)
{
for (i = 0; i < NUM_TS_NAMES; i++)
{
fd = open (TsNames[i], 0);
if (fd >= 0)
{
mi->name = KdSaveString (TsNames[i]);
break;
}
}
}
else
fd = open (mi->name, 0);
if (fd >= 0)
{
struct h3600_ts_calibration cal;
/*
* Check to see if this is a touch screen
*/
if (ioctl (fd, TS_GET_CAL, &cal) != -1)
{
mi->driver = (void *) fd;
mi->inputType = TsInputType;
if (KdRegisterFd (TsInputType, fd, TsRead, (void *) mi))
{
/* Set callbacks for vt switches etc */
KdRegisterFdEnableDisable (fd, TsEnable, TsDisable);
n++;
}
}
else
close (fd);
if (!pi->path || strcmp(pi->path, "auto") == 0) {
for (i = 0; i < NUM_TS_NAMES; i++) {
fd = open (TsNames[i], 0);
if (fd >= 0) {
pi->path = KdSaveString (TsNames[i]);
break;
}
}
}
else {
fd = open (pi->path, 0);
}
return 0;
if (fd < 0) {
ErrorF("TsInit: Couldn't open %s\n", pi->path);
return BadMatch;
}
close(fd);
pi->name = KdSaveString("H3600 Touchscreen");
return Success;
}
static Status
TsEnable (KdPointerInfo *pi)
{
int fd;
if (!pi || !pi->path)
return BadImplementation;
fd = open(pi->path, 0);
if (fd < 0) {
ErrorF("TsInit: Couldn't open %s\n", pi->path);
return BadMatch;
}
struct h3600_ts_calibration cal;
/*
* Check to see if this is a touch screen
*/
if (ioctl (fd, TS_GET_CAL, &cal) != -1) {
mi->driverPrivate = (void *) fd;
if (!KdRegisterFd (fd, TsRead, (void *) mi)) {
close(fd);
return BadAlloc;
}
}
else {
ErrorF("TsEnable: %s is not a touchscreen\n", pi->path);
close (fd);
return BadMatch;
}
return Success;
}
static void
TsFini (void)
TsFini (KdPointerInfo *pi)
{
KdMouseInfo *mi;
KdUnregisterFds (TsInputType, TRUE);
for (mi = kdMouseInfo; mi; mi = mi->next)
{
if (mi->inputType == TsInputType)
{
mi->driver = 0;
mi->inputType = 0;
}
}
KdUnregisterFds (pi, (int)pi->driverPrivate, TRUE);
mi->driverPrivate = NULL;
}
KdMouseFuncs TsFuncs = {
KdPointerDriver TsDriver = {
TsInit,
TsFini
TsEnable,
TsDisable,
TsFini,
NULL,
};

View File

@ -1,6 +1,6 @@
/*
* $RCSId: xc/programs/Xserver/hw/kdrive/linux/tslib.c,v 1.1 2002/11/01 22:27:49 keithp Exp $
* TSLIB based touchscreen driver for TinyX
* TSLIB based touchscreen driver for KDrive
* Porting to new input API and event queueing by Daniel Stone.
* Derived from ts.c by Keith Packard
* Derived from ps2.c by Jim Gettys
*
@ -8,66 +8,33 @@
* Copyright © 2000 Compaq Computer Corporation
* Copyright © 2002 MontaVista Software Inc.
* Copyright © 2005 OpenedHand Ltd.
* Copyright © 2006 Nokia Corporation
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Keith Packard or Compaq not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Keith Packard and Compaq makes no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
* documentation, and that the name of the authors and/or copyright holders
* not be used in advertising or publicity pertaining to distribution of the
* software without specific, written prior permission. The authors and/or
* copyright holders make no representations about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
* KEITH PACKARD AND COMPAQ DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Michael Taht or MontaVista not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Michael Taht and Montavista make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* MICHAEL TAHT AND MONTAVISTA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL EITHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Matthew Allum or OpenedHand not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Matthew Allum and OpenedHand make no
* representations about the suitability of this software for any purpose. It
* is provided "as is" without express or implied warranty.
*
* MATTHEW ALLUM AND OPENEDHAND DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
* IN NO EVENT SHALL EITHER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* THE AUTHORS AND/OR COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
* TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL THE AUTHORS AND/OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifdef HAVE_CONFIG_H
#ifdef HAVE_KDRIVE_CONFIG_H
#include <kdrive-config.h>
#endif
#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
@ -77,186 +44,171 @@
#include "kdrive.h"
#include <sys/ioctl.h>
#include <tslib.h>
#include <dirent.h>
#include <linux/input.h>
static struct tsdev *tsDev = NULL;
static char *TsNames[] = {
NULL, /* set via TSLIB_TSDEVICE */
"/dev/ts",
"/dev/touchscreen/0",
struct TslibPrivate {
int fd;
int lastx, lasty;
struct tsdev *tsDev;
void (*raw_event_hook)(int x, int y, int pressure, void *closure);
void *raw_event_closure;
int phys_screen;
};
#define NUM_TS_NAMES (sizeof (TsNames) / sizeof (TsNames[0]))
/* For XCalibrate extension */
void (*tslib_raw_event_hook)(int x, int y, int pressure, void *closure);
void *tslib_raw_event_closure;
int TsInputType = 0;
int KdTsPhyScreen = 0; /* XXX Togo .. */
static void
TsRead (int tsPort, void *closure)
TsRead (int fd, void *closure)
{
KdMouseInfo *mi = closure;
struct ts_sample event;
long x, y;
unsigned long flags;
KdPointerInfo *pi = closure;
struct TslibPrivate *private = pi->driverPrivate;
struct ts_sample event;
long x = 0, y = 0;
unsigned long flags;
if (tslib_raw_event_hook)
{
/* XCalibrate Ext */
if (ts_read_raw(tsDev, &event, 1) == 1)
{
tslib_raw_event_hook (event.x,
event.y,
event.pressure,
tslib_raw_event_closure);
}
return;
}
while (ts_read(tsDev, &event, 1) == 1)
{
flags = (event.pressure) ? KD_BUTTON_1 : 0;
x = event.x;
y = event.y;
KdEnqueueMouseEvent (mi, flags, x, y);
}
}
static int
TsLibOpen(char *dev)
{
if(!(tsDev = ts_open(dev, 0)))
return -1;
if (ts_config(tsDev))
return -1;
return ts_fd(tsDev);
}
static int
TslibEnable (int not_needed_fd, void *closure)
{
KdMouseInfo *mi = closure;
int fd = 0;
if ((fd = TsLibOpen(mi->name)) == -1)
ErrorF ("Unable to re-enable TSLib ( on %s )", mi->name);
return fd;
}
static void
TslibDisable (int fd, void *closure)
{
if (tsDev)
ts_close(tsDev);
tsDev = NULL;
}
static int
TslibInit (void)
{
int i, j = 0;
KdMouseInfo *mi, *next;
int fd = 0;
int req_type;
if (!TsInputType)
{
TsInputType = KdAllocInputType ();
KdParseMouse(0); /* allocate safe slot in kdMouseInfo */
req_type = 0;
if (private->raw_event_hook) {
while (ts_read_raw(private->tsDev, &event, 1) == 1)
private->raw_event_hook (event.x, event.y, event.pressure,
private->raw_event_closure);
return;
}
else req_type = TsInputType; /* is being re-inited */
for (mi = kdMouseInfo; mi; mi = next)
{
next = mi->next;
/* find a usuable slot */
if (mi->inputType != req_type)
continue;
/* Check for tslib env var device setting */
if ((TsNames[0] = getenv("TSLIB_TSDEVICE")) == NULL)
j++;
if (!mi->name)
{
for (i = j; i < NUM_TS_NAMES; i++)
{
fd = TsLibOpen(TsNames[i]);
if (fd >= 0)
{
mi->name = KdSaveString (TsNames[i]);
break;
}
}
}
else
fd = TsLibOpen(mi->name);
if (fd >= 0 && tsDev != NULL)
{
mi->driver = (void *) fd;
mi->inputType = TsInputType;
KdRegisterFd (TsInputType, fd, TsRead, (void *) mi);
/* Set callbacks for vt switches etc */
KdRegisterFdEnableDisable (fd, TslibEnable, TslibDisable);
return TRUE;
}
}
ErrorF ("Failed to open TSLib device, tried ");
for (i = j; i < NUM_TS_NAMES; i++)
ErrorF ("%s ", TsNames[i]);
ErrorF (".\n");
if (!TsNames[0])
ErrorF ("Try setting TSLIB_TSDEVICE to valid /dev entry?\n");
if (fd > 0)
close(fd);
return FALSE;
}
static void
TslibFini (void)
{
KdMouseInfo *mi;
while (ts_read(private->tsDev, &event, 1) == 1) {
#ifdef DEBUG
ErrorF("[tslib] originally from (%d, %d)\n", event.x, event.y);
#endif
if (event.pressure) {
if (event.pressure > pi->dixdev->touchscreen->button_threshold)
flags = KD_BUTTON_8;
else
flags = KD_BUTTON_1;
KdUnregisterFds (TsInputType, TRUE);
for (mi = kdMouseInfo; mi; mi = mi->next)
{
if (mi->inputType == TsInputType)
{
if(mi->driver)
{
ts_close(tsDev);
tsDev = NULL;
}
mi->driver = 0;
/*
* Here we test for the touch screen driver actually being on the
* touch screen, if it is we send absolute coordinates. If not,
* then we send delta's so that we can track the entire vga screen.
*/
if (KdCurScreen == private->phys_screen) {
x = event.x;
y = event.y;
} else {
flags |= KD_MOUSE_DELTA;
if ((private->lastx == 0) || (private->lasty == 0)) {
x = event.x;
y = event.y;
} else {
x = event.x - private->lastx;
y = event.y - private->lasty;
}
}
private->lastx = x;
private->lasty = y;
} else {
flags = 0;
x = private->lastx;
y = private->lasty;
}
/* If below is set to 0, then MouseInit() will trash it,
* setting to 'mouse type' ( via server reset). Therefore
* Leave it alone and work around in TslibInit() ( see
* req_type ).
*/
/* mi->inputType = 0; */
}
#ifdef DEBUG
ErrorF("event at (%lu, %lu), pressure is %d, sending flags %lu\n", x, y, event.pressure, flags);
#endif
KdEnqueuePointerEvent (pi, flags, x, y, event.pressure);
}
}
KdMouseFuncs TsFuncs = {
static Status
TslibEnable (KdPointerInfo *pi)
{
struct TslibPrivate *private = pi->driverPrivate;
private->holdThumbEvents = 1;
private->raw_event_hook = NULL;
private->raw_event_closure = NULL;
private->tsDev = ts_open(pi->path, 0);
private->fd = ts_fd(private->tsDev);
if (!private->tsDev || ts_config(private->tsDev) || private->fd < 0) {
ErrorF("[tslib/TslibEnable] failed to open %s\n", pi->path);
if (private->fd > 0);
close(private->fd);
return BadAlloc;
}
if (pi->dixdev && pi->dixdev->touchscreen &&
pi->dixdev->touchscreen->button_threshold == 0)
pi->dixdev->touchscreen->button_threshold = 115;
#ifdef DEBUG
ErrorF("[tslib/TslibEnable] successfully enabled %s\n", pi->path);
#endif
KdRegisterFd(private->fd, TsRead, pi);
return Success;
}
static void
TslibDisable (KdPointerInfo *pi)
{
struct TslibPrivate *private = pi->driverPrivate;
if (private->fd) {
KdUnregisterFd(pi, private->fd);
close(private->fd);
}
if (private->tsDev)
ts_close(private->tsDev);
private->fd = 0;
private->tsDev = NULL;
}
static Status
TslibInit (KdPointerInfo *pi)
{
int fd = 0, i = 0;
char devpath[PATH_MAX], devname[TS_NAME_SIZE];
DIR *inputdir = NULL;
struct dirent *inputent = NULL;
struct tsdev *tsDev = NULL;
struct TslibPrivate *private = NULL;
if (!pi || !pi->dixdev)
return !Success;
pi->driverPrivate = (struct TslibPrivate *)
xcalloc(sizeof(struct TslibPrivate), 1);
if (!pi->driverPrivate)
return !Success;
private = pi->driverPrivate;
/* hacktastic */
private->phys_screen = 0;
pi->nAxes = 3;
pi->name = KdSaveString("Touchscreen");
pi->inputClass = KD_TOUCHSCREEN;
#ifdef DEBUG
ErrorF("[tslib/TslibInit] successfully inited for device %s\n", pi->path);
#endif
return Success;
}
static void
TslibFini (KdPointerInfo *pi)
{
if (pi->driverPrivate) {
xfree(pi->driverPrivate);
pi->driverPrivate = NULL;
}
}
KdPointerDriver TsDriver = {
"tslib",
TslibInit,
TslibFini
TslibEnable,
TslibDisable,
TslibFini,
NULL,
};

View File

@ -30,8 +30,4 @@ MACH64_LIBS = \
Xmach64_LDADD = \
$(MACH64_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
Xmach64_DEPENDENCIES = $(MACH64_LIBS)
@XSERVER_LIBS@

View File

@ -7,10 +7,6 @@ bin_PROGRAMS = Xmga
noinst_LIBRARIES = libmga.a
if TSLIB
TSLIB_FLAG = -lts
endif
libmga_a_SOURCES = \
mgadraw.c \
g400_composite.c \
@ -29,9 +25,4 @@ MGA_LIBS = \
Xmga_LDADD = \
$(MGA_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
Xmga_DEPENDENCIES = \
libmga.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a
@XSERVER_LIBS@

View File

@ -38,9 +38,3 @@ Xneomagic_LDADD = \
$(NEOMAGIC_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xneomagic_DEPENDENCIES = \
libneomagic.a \
${FBDEV_LIBS} \
${VESA_LIBS}

View File

@ -7,10 +7,6 @@ bin_PROGRAMS = Xnvidia
noinst_LIBRARIES = libnvidia.a
if TSLIB
TSLIB_FLAG = -lts
endif
# nvidiavideo.c
libnvidia_a_SOURCES = \
@ -31,7 +27,3 @@ Xnvidia_LDADD = \
$(NVIDIA_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xnvidia_DEPENDENCIES = \
libnvidia.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a

View File

@ -25,8 +25,3 @@ Xpm2_LDADD = \
$(PM2_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xpm2_DEPENDENCIES = \
libpm2.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a

View File

@ -24,8 +24,3 @@ Xr128_LDADD = \
$(R128_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xr128_DEPENDENCIES = \
libr128.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a

View File

@ -5,14 +5,9 @@ INCLUDES = \
bin_PROGRAMS = Xsdl
if TSLIB
TSLIB_FLAG = -lts
endif
Xsdl_SOURCES = sdl.c
Xsdl_LDADD = @KDRIVE_PURE_LIBS@ \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG) \
@XSDL_LIBS@

View File

@ -17,10 +17,6 @@ INCLUDES = \
bin_PROGRAMS = Xsis
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libsis.a
libsis_a_SOURCES = \
@ -42,5 +38,3 @@ Xsis_LDADD = \
$(SIS_LIBS) \
@KDRIVE_LIBS@ \
$(TSLIB_FLAG)
Xsis_DEPENDENCIES = $(SIS_LIBS)

View File

@ -29,9 +29,3 @@ Xsmi_LDADD = \
$(SMI_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xsmi_DEPENDENCIES = \
libsmi.a \
$(top_builddir)/hw/kdrive/fbdev/libfbdev.a \
$(top_builddir)/hw/kdrive/vesa/libvesa.a

View File

@ -24,7 +24,7 @@ libkdrive_a_SOURCES = \
kdrive.h \
kinfo.c \
kinput.c \
kkeymap.h \
kkeymap.c \
kmap.c \
kmode.c \
knoop.c \
@ -37,5 +37,4 @@ libkdrive_a_SOURCES = \
$(top_srcdir)/mi/miinitext.c
libkdrivestubs_a_SOURCES = \
$(top_srcdir)/Xi/stubs.c \
$(top_srcdir)/fb/fbcmap.c

View File

@ -43,6 +43,12 @@
#include "dpmsproc.h"
#endif
#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
#include <signal.h>
typedef struct _kdDepths {
CARD8 depth;
CARD8 bpp;
@ -60,6 +66,8 @@ KdDepths kdDepths[] = {
#define NUM_KD_DEPTHS (sizeof (kdDepths) / sizeof (kdDepths[0]))
#define KD_DEFAULT_BUTTONS 5
int kdScreenPrivateIndex;
unsigned long kdGeneration;
@ -76,6 +84,8 @@ Bool kdSwitchPending;
char *kdSwitchCmd;
DDXPointRec kdOrigin;
static Bool kdCaughtSignal = FALSE;
/*
* Carry arguments from InitOutput through driver initialization
* to KdScreenInit
@ -368,6 +378,9 @@ AbortDDX(void)
(*kdOsFuncs->Fini) ();
KdDoSwitchCmd ("stop");
}
if (kdCaughtSignal)
abort();
}
void
@ -379,7 +392,7 @@ ddxGiveUp ()
Bool kdDumbDriver;
Bool kdSoftCursor;
static char *
char *
KdParseFindNext (char *cur, char *delim, char *save, char *last)
{
while (*cur && !strchr (delim, *cur))
@ -560,97 +573,6 @@ KdSaveString (char *str)
return n;
}
/*
* Parse mouse information. Syntax:
*
* <device>,<nbutton>,<protocol>{,<option>}...
*
* options: {nmo} pointer mapping (e.g. {321})
* 2button emulate middle button
* 3button dont emulate middle button
*/
void
KdParseMouse (char *arg)
{
char save[1024];
char delim;
KdMouseInfo *mi;
int i;
mi = KdMouseInfoAdd ();
if (!mi)
return;
mi->name = 0;
mi->prot = 0;
mi->emulateMiddleButton = kdEmulateMiddleButton;
mi->transformCoordinates = !kdRawPointerCoordinates;
mi->nbutton = 3;
for (i = 0; i < KD_MAX_BUTTON; i++)
mi->map[i] = i + 1;
if (!arg)
return;
if (strlen (arg) >= sizeof (save))
return;
arg = KdParseFindNext (arg, ",", save, &delim);
if (!save[0])
return;
mi->name = KdSaveString (save);
if (delim != ',')
return;
arg = KdParseFindNext (arg, ",", save, &delim);
if (!save[0])
return;
if ('1' <= save[0] && save[0] <= '0' + KD_MAX_BUTTON && save[1] == '\0')
{
mi->nbutton = save[0] - '0';
if (mi->nbutton > KD_MAX_BUTTON)
{
UseMsg ();
return;
}
}
if (!delim != ',')
return;
arg = KdParseFindNext (arg, ",", save, &delim);
if (save[0])
mi->prot = KdSaveString (save);
while (delim == ',')
{
arg = KdParseFindNext (arg, ",", save, &delim);
if (save[0] == '{')
{
char *s = save + 1;
i = 0;
while (*s && *s != '}')
{
if ('1' <= *s && *s <= '0' + mi->nbutton)
mi->map[i] = *s - '0';
else
UseMsg ();
s++;
}
}
else if (!strcmp (save, "2button"))
mi->emulateMiddleButton = TRUE;
else if (!strcmp (save, "3button"))
mi->emulateMiddleButton = FALSE;
else if (!strcmp (save, "rawcoord"))
mi->transformCoordinates = FALSE;
else if (!strcmp (save, "transform"))
mi->transformCoordinates = TRUE;
else
UseMsg ();
}
}
void
KdParseRgba (char *rgba)
{
@ -697,6 +619,8 @@ KdProcessArgument (int argc, char **argv, int i)
{
KdCardInfo *card;
KdScreenInfo *screen;
KdPointerInfo *pi;
KdKeyboardInfo *ki;
if (!strcmp (argv[i], "-card"))
{
@ -736,6 +660,11 @@ KdProcessArgument (int argc, char **argv, int i)
kdDontZap = TRUE;
return 1;
}
if (!strcmp (argv[i], "-nozap"))
{
kdDontZap = TRUE;
return 1;
}
if (!strcmp (argv[i], "-3button"))
{
kdEmulateMiddleButton = FALSE;
@ -785,14 +714,6 @@ KdProcessArgument (int argc, char **argv, int i)
UseMsg ();
return 2;
}
if (!strcmp (argv[i], "-mouse"))
{
if ((i+1) < argc)
KdParseMouse (argv[i+1]);
else
UseMsg ();
return 2;
}
if (!strcmp (argv[i], "-rgba"))
{
if ((i+1) < argc)
@ -814,6 +735,20 @@ KdProcessArgument (int argc, char **argv, int i)
{
return 1;
}
if (!strcmp (argv[i], "-mouse") ||
!strcmp (argv[i], "-pointer")) {
if (i + 1 >= argc)
UseMsg();
KdAddConfigPointer(argv[i + 1]);
return 2;
}
if (!strcmp (argv[i], "-keybd")) {
if (i + 1 >= argc)
UseMsg();
KdAddConfigKeyboard(argv[i + 1]);
return 2;
}
#ifdef PSEUDO8
return p8ProcessArgument (argc, argv, i);
#else
@ -1420,6 +1355,39 @@ KdDepthToFb (ScreenPtr pScreen, int depth)
#endif
#ifdef HAVE_BACKTRACE
/* shamelessly ripped from xf86Events.c */
void
KdBacktrace (int signum)
{
void *array[32]; /* more than 32 and you have bigger problems */
size_t size, i;
char **strings;
signal(signum, SIG_IGN);
size = backtrace (array, 32);
fprintf (stderr, "\nBacktrace (%d deep):\n", size);
strings = backtrace_symbols (array, size);
for (i = 0; i < size; i++)
fprintf (stderr, "%d: %s\n", i, strings[i]);
free (strings);
kdCaughtSignal = TRUE;
if (signum == SIGSEGV)
FatalError("Segmentation fault caught\n");
else if (signum > 0)
FatalError("Signal %d caught\n", signum);
}
#else
void
KdBacktrace (int signum)
{
kdCaughtSignal = TRUE;
FatalError("Segmentation fault caught\n");
}
#endif
void
KdInitOutput (ScreenInfo *pScreenInfo,
int argc,
@ -1427,6 +1395,12 @@ KdInitOutput (ScreenInfo *pScreenInfo,
{
KdCardInfo *card;
KdScreenInfo *screen;
#ifdef COMPOSITE
/* kind of a hack: we want Composite enabled, but it's disabled per
* default. */
noCompositeExtension = FALSE;
#endif
if (!kdCardInfo)
{
@ -1464,6 +1438,8 @@ KdInitOutput (ScreenInfo *pScreenInfo,
for (card = kdCardInfo; card; card = card->next)
for (screen = card->screenList; screen; screen = screen->next)
KdAddScreen (pScreenInfo, screen, argc, argv);
signal(SIGSEGV, KdBacktrace);
}
#ifdef DPMSExtension

View File

@ -47,6 +47,10 @@
#include "shadow.h"
#include "randrstr.h"
#ifdef XKB
#include <X11/extensions/XKBstr.h>
#endif
extern WindowPtr *WindowTable;
#define KD_DPMS_NORMAL 0
@ -63,6 +67,8 @@ extern WindowPtr *WindowTable;
#define KD_MAX_CARD_ADDRESS 8
#endif
#define Status int
/*
* Configuration information per video card
*/
@ -215,7 +221,7 @@ typedef struct {
#endif
} KdPrivScreenRec, *KdPrivScreenPtr;
typedef enum _kdMouseState {
typedef enum _kdPointerState {
start,
button_1_pend,
button_1_down,
@ -226,51 +232,135 @@ typedef enum _kdMouseState {
synth_2_down_3,
synth_2_down_1,
num_input_states
} KdMouseState;
} KdPointerState;
#define KD_MAX_BUTTON 7
#define KD_MAX_BUTTON 32
typedef struct _KdMouseInfo {
struct _KdMouseInfo *next;
void *driver;
void *closure;
char *name;
char *prot;
char map[KD_MAX_BUTTON];
int nbutton;
Bool emulateMiddleButton;
unsigned long emulationTimeout;
Bool timeoutPending;
KdMouseState mouseState;
Bool eventHeld;
xEvent heldEvent;
unsigned char buttonState;
int emulationDx, emulationDy;
int inputType;
Bool transformCoordinates;
} KdMouseInfo;
#define KD_KEYBOARD 1
#define KD_MOUSE 2
#define KD_TOUCHSCREEN 3
extern KdMouseInfo *kdMouseInfo;
typedef struct _KdPointerInfo KdPointerInfo;
typedef struct _KdPointerDriver {
char *name;
Status (*Init) (KdPointerInfo *);
Status (*Enable) (KdPointerInfo *);
void (*Disable) (KdPointerInfo *);
void (*Fini) (KdPointerInfo *);
struct _KdPointerDriver *next;
} KdPointerDriver;
struct _KdPointerInfo {
DeviceIntPtr dixdev;
char *name;
char *path;
InputOption *options;
int inputClass;
CARD8 map[KD_MAX_BUTTON + 1];
int nButtons;
int nAxes;
Bool emulateMiddleButton;
unsigned long emulationTimeout;
int emulationDx, emulationDy;
Bool timeoutPending;
KdPointerState mouseState;
Bool eventHeld;
struct {
int type;
int x;
int y;
int z;
int flags;
int absrel;
} heldEvent;
unsigned char buttonState;
Bool transformCoordinates;
int pressureThreshold;
KdPointerDriver *driver;
void *driverPrivate;
struct _KdPointerInfo *next;
};
extern int KdCurScreen;
KdMouseInfo *KdMouseInfoAdd (void);
void KdMouseInfoDispose (KdMouseInfo *mi);
void KdParseMouse (char *);
void KdAddPointerDriver (KdPointerDriver *driver);
void KdRemovePointerDriver (KdPointerDriver *driver);
KdPointerInfo *KdNewPointer (void);
void KdFreePointer (KdPointerInfo *);
int KdAddPointer (KdPointerInfo *ki);
int KdAddConfigPointer (char *pointer);
void KdRemovePointer (KdPointerInfo *ki);
typedef struct _KdMouseFuncs {
Bool (*Init) (void);
void (*Fini) (void);
} KdMouseFuncs;
typedef struct _KdKeyboardFuncs {
void (*Load) (void);
int (*Init) (void);
void (*Leds) (int);
void (*Bell) (int, int, int);
void (*Fini) (void);
int LockLed;
} KdKeyboardFuncs;
#define KD_KEY_COUNT 248
#define KD_MIN_KEYCODE 8
#define KD_MAX_KEYCODE 255
#define KD_MAX_WIDTH 4
#define KD_MAX_LENGTH (KD_MAX_KEYCODE - KD_MIN_KEYCODE + 1)
typedef struct {
KeySym modsym;
int modbit;
} KdKeySymModsRec;
extern const KeySym kdDefaultKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH];
extern const int kdDefaultKeymapWidth;
extern const CARD8 kdDefaultModMap[MAP_LENGTH];
extern const KeySymsRec kdDefaultKeySyms;
typedef struct _KdKeyboardInfo KdKeyboardInfo;
typedef struct _KdKeyboardDriver {
char *name;
Bool (*Init) (KdKeyboardInfo *);
Bool (*Enable) (KdKeyboardInfo *);
void (*Leds) (KdKeyboardInfo *, int);
void (*Bell) (KdKeyboardInfo *, int, int, int);
void (*Disable) (KdKeyboardInfo *);
void (*Fini) (KdKeyboardInfo *);
struct _KdKeyboardDriver *next;
} KdKeyboardDriver;
struct _KdKeyboardInfo {
struct _KdKeyboardInfo *next;
DeviceIntPtr dixdev;
void *closure;
char *name;
char *path;
int inputClass;
#ifdef XKB
XkbDescPtr xkb;
#endif
int LockLed;
CARD8 keyState[KD_KEY_COUNT/8];
int minScanCode;
int maxScanCode;
CARD8 modmap[MAP_LENGTH];
KeySymsRec keySyms;
int leds;
int bellPitch;
int bellDuration;
InputOption *options;
KdKeyboardDriver *driver;
void *driverPrivate;
};
void KdAddKeyboardDriver (KdKeyboardDriver *driver);
void KdRemoveKeyboardDriver (KdKeyboardDriver *driver);
KdKeyboardInfo *KdNewKeyboard (void);
void KdFreeKeyboard (KdKeyboardInfo *ki);
int KdAddConfigKeyboard (char *pointer);
int KdAddKeyboard (KdKeyboardInfo *ki);
void KdRemoveKeyboard (KdKeyboardInfo *ki);
typedef struct _KdOsFuncs {
int (*Init) (void);
@ -307,9 +397,9 @@ typedef struct _KdMonitorTiming {
extern const KdMonitorTiming kdMonitorTimings[];
extern const int kdNumMonitorTimings;
typedef struct _KdMouseMatrix {
typedef struct _KdPointerMatrix {
int matrix[2][3];
} KdMouseMatrix;
} KdPointerMatrix;
typedef struct _KaaTrapezoid {
float tl, tr, ty;
@ -628,8 +718,14 @@ KdParseScreen (KdScreenInfo *screen,
char *
KdSaveString (char *str);
void
KdParseMouse (char *arg);
KdPointerInfo *
KdParsePointer (char *arg);
KdKeyboardInfo *
KdParseKeyboard (char *arg);
char *
KdParseFindNext (char *cur, char *delim, char *save, char *last);
void
KdParseRgba (char *rgba);
@ -677,6 +773,9 @@ KdInitOutput (ScreenInfo *pScreenInfo,
void
KdSetSubpixelOrder (ScreenPtr pScreen, Rotation randr);
void
KdBacktrace (int signum);
/* kinfo.c */
KdCardInfo *
@ -699,53 +798,51 @@ KdScreenInfoDispose (KdScreenInfo *si);
/* kinput.c */
void
KdInitInput(KdMouseFuncs *, KdKeyboardFuncs *);
KdInitInput(void);
void
KdAddMouseDriver(KdMouseFuncs *);
KdAddPointerDriver(KdPointerDriver *);
int
KdAllocInputType (void);
void
KdAddKeyboardDriver(KdKeyboardDriver *);
Bool
KdRegisterFd (int type, int fd, void (*read) (int fd, void *closure), void *closure);
KdRegisterFd (int fd, void (*read) (int fd, void *closure), void *closure);
void
KdRegisterFdEnableDisable (int fd,
int (*enable) (int fd, void *closure),
void (*disable) (int fd, void *closure));
KdUnregisterFds (void *closure, Bool do_close);
void
KdUnregisterFds (int type, Bool do_close);
void
KdEnqueueKeyboardEvent(unsigned char scan_code,
unsigned char is_up);
KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, unsigned char scan_code,
unsigned char is_up);
#define KD_BUTTON_1 0x01
#define KD_BUTTON_2 0x02
#define KD_BUTTON_3 0x04
#define KD_BUTTON_4 0x08
#define KD_BUTTON_5 0x10
#define KD_BUTTON_8 0x80
#define KD_MOUSE_DELTA 0x80000000
void
KdEnqueueMouseEvent(KdMouseInfo *mi, unsigned long flags, int x, int y);
KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry,
int rz);
void
KdEnqueueMotionEvent (KdMouseInfo *mi, int x, int y);
_KdEnqueuePointerEvent(KdPointerInfo *pi, int type, int x, int y, int z,
int b, int absrel, Bool force);
void
KdReleaseAllKeys (void);
void
KdSetLed (int led, Bool on);
KdSetLed (KdKeyboardInfo *ki, int led, Bool on);
void
KdSetMouseMatrix (KdMouseMatrix *matrix);
KdSetPointerMatrix (KdPointerMatrix *pointer);
void
KdComputeMouseMatrix (KdMouseMatrix *matrix, Rotation randr, int width, int height);
KdComputePointerMatrix (KdPointerMatrix *pointer, Rotation randr, int width, int height);
void
KdBlockHandler (int screen,
@ -768,19 +865,17 @@ KdEnableInput (void);
void
ProcessInputEvents (void);
extern KdMouseFuncs LinuxMouseFuncs;
extern KdMouseFuncs LinuxEvdevFuncs;
extern KdMouseFuncs Ps2MouseFuncs;
extern KdMouseFuncs BusMouseFuncs;
extern KdMouseFuncs MsMouseFuncs;
#ifdef TOUCHSCREEN
extern KdMouseFuncs TsFuncs;
#endif
extern KdKeyboardFuncs LinuxKeyboardFuncs;
extern KdPointerDriver LinuxMouseDriver;
extern KdPointerDriver LinuxEvdevDriver;
extern KdPointerDriver Ps2MouseDriver;
extern KdPointerDriver BusMouseDriver;
extern KdPointerDriver MsMouseDriver;
extern KdPointerDriver TsDriver;
extern KdKeyboardDriver LinuxKeyboardDriver;
extern KdOsFuncs LinuxFuncs;
extern KdMouseFuncs VxWorksMouseFuncs;
extern KdKeyboardFuncs VxWorksKeyboardFuncs;
extern KdPointerDriver VxWorksMouseDriver;
extern KdKeyboardDriver VxWorksKeyboardDriver;
extern KdOsFuncs VxWorksFuncs;
/* kmap.c */

View File

@ -101,7 +101,7 @@ KdScreenInfoDispose (KdScreenInfo *si)
KdCardInfo *ci = si->card;
KdScreenInfo **prev;
for (prev = &ci->screenList; *prev; prev = &(*prev)->next)
for (prev = &ci->screenList; *prev; prev = &(*prev)->next) {
if (*prev == si)
{
*prev = si->next;
@ -110,38 +110,67 @@ KdScreenInfoDispose (KdScreenInfo *si)
KdCardInfoDispose (ci);
break;
}
}
}
KdMouseInfo *kdMouseInfo;
KdMouseInfo *
KdMouseInfoAdd (void)
KdPointerInfo *
KdNewPointer (void)
{
KdMouseInfo *mi, **prev;
KdPointerInfo *pi;
int i;
mi = (KdMouseInfo *) xalloc (sizeof (KdMouseInfo));
if (!mi)
return 0;
bzero (mi, sizeof (KdMouseInfo));
for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next);
*prev = mi;
return mi;
pi = (KdPointerInfo *)xcalloc(1, sizeof(KdPointerInfo));
if (!pi)
return NULL;
pi->name = KdSaveString("Generic Pointer");
pi->path = NULL;
pi->inputClass = KD_MOUSE;
pi->driver = NULL;
pi->driverPrivate = NULL;
pi->next = NULL;
pi->options = NULL;
pi->nAxes = 3;
pi->nButtons = KD_MAX_BUTTON;
for (i = 1; i < KD_MAX_BUTTON; i++)
pi->map[i] = i;
return pi;
}
void
KdMouseInfoDispose (KdMouseInfo *mi)
KdFreePointer(KdPointerInfo *pi)
{
KdMouseInfo **prev;
InputOption *option, *prev = NULL;
for (prev = &kdMouseInfo; *prev; prev = &(*prev)->next)
if (*prev == mi)
{
*prev = mi->next;
if (mi->name)
xfree (mi->name);
if (mi->prot)
xfree (mi->prot);
xfree (mi);
break;
}
if (pi->name)
xfree(pi->name);
if (pi->path)
xfree(pi->path);
for (option = pi->options; option; option = option->next) {
if (prev)
xfree(prev);
if (option->key)
xfree(option->key);
if (option->value)
xfree(option->value);
prev = option;
}
if (prev)
xfree(prev);
xfree(pi);
}
void
KdFreeKeyboard(KdKeyboardInfo *ki)
{
if (ki->name)
xfree(ki->name);
if (ki->path)
xfree(ki->path);
ki->next = NULL;
xfree(ki);
}

File diff suppressed because it is too large Load Diff

View File

@ -28,14 +28,13 @@
#endif
#include "kdrive.h"
#include <X11/keysym.h>
#include "kkeymap.h"
/*
* Map scan codes (both regular and synthesized from extended keys)
* to X keysyms
*/
KeySym kdKeymap[(MAX_SCANCODE - MIN_SCANCODE + 1) * MAX_WIDTH] = {
const KeySym kdDefaultKeymap[KD_MAX_LENGTH * KD_MAX_WIDTH] = {
/* These are directly mapped from DOS scanset 0 */
/* 1 8 */ XK_Escape, NoSymbol,
/* 2 9 */ XK_1, XK_exclam,
@ -152,58 +151,13 @@ KeySym kdKeymap[(MAX_SCANCODE - MIN_SCANCODE + 1) * MAX_WIDTH] = {
/* 110 117 */ NoSymbol, NoSymbol,
/* 111 118 */ NoSymbol, NoSymbol,
/* 112 119 */ NoSymbol, NoSymbol,
;
/*
* Map extended keys to additional scancodes
*/
KdExtendMap kdExtendMap[] = {
0x1d, 89, /* Control_R */
0x1c, 90, /* KP_Enter */
0x35, 91, /* KP_Divide */
0x37, 92, /* Sys_Req */
0x38, 93, /* Alt_R */
0x45, 94, /* Num_Lock */
0x47, 95, /* Home */
0x48, 96, /* Up */
0x49, 97, /* Page_Up */
0x4b, 98, /* Left */
0x4d, 99, /* Right */
0x4f, 100, /* End */
0x50, 101, /* Down */
0x51, 102, /* Page_Down */
0x52, 103, /* Insert */
0x53, 104, /* Delete */
0x5b, 105, /* Super_L (Windows_L) */
0x5c, 106, /* Super_R (Windows_R) */
0x5d, 107, /* Menu */
0x46, 69, /* Break (with control pressed) */
};
#define NUM_EXTEND (sizeof (kdExtendMap)/ sizeof (kdExtendMap[0]))
int kdNumExtend = NUM_EXTEND;
/*
* Map keys on Japanese keyboard far from zero back to reasonable values
*/
KdExtendMap kdJapanMap[] = {
0x70, 108, /* next to Alt key */
0x73, 109, /* dash/vbar */
0x79, 110, /* right of space bar */
0x7b, 111, /* left of space bar */
0x7d, 112, /* Yen */
};
#define NUM_JAPAN (sizeof (kdJapanMap)/sizeof (kdJapanMap[0]))
int kdNumJapan = NUM_JAPAN;
/*
* List of locking key codes
*/
CARD8 kdLockMap[] = {
CARD8 kdLockMap[] = {
65,
101,
77,
@ -218,7 +172,7 @@ int kdNumLock = NUM_LOCK;
* the KEYMAP_LOCKING_ALTGR flag is set in CEKeymapFlags
*/
CARD8 kdOptionalLockMap[] = {
CARD8 kdOptionalLockMap[] = {
100,
};
@ -226,13 +180,13 @@ CARD8 kdOptionalLockMap[] = {
int kdNumOptionalLock = NUM_OPTIONAL_LOCK;
CARD8 kdModMap[MAP_LENGTH];
const CARD8 kdDefaultModMap[MAP_LENGTH];
unsigned long kdKeymapFlags = 0;
unsigned long kdDefaultKeymapFlags = 0;
KeySymsRec kdKeySyms = {
kdKeymap,
MIN_KEYCODE,
MAX_KEYCODE,
2
const KeySymsRec kdDefaultKeySyms = {
kdDefaultKeymap,
KD_MIN_KEYCODE,
KD_MAX_KEYCODE,
KD_MAX_WIDTH
};

View File

@ -27,7 +27,6 @@
#include <kdrive-config.h>
#endif
#include "kdrive.h"
#include "kkeymap.h"
#ifdef WINDOWS
#define KM_BUF 1024

View File

@ -22,8 +22,4 @@ Xvesa_SOURCES = \
Xvesa_LDADD = \
libvesa.a \
@KDRIVE_LIBS@ \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@
Xvesa_DEPENDENCIES = \
libvesa.a

View File

@ -871,7 +871,7 @@ vesaComputeFramebufferMapping (KdScreenInfo *screen)
VesaScreenPrivPtr pscr = screen->driver;
int depth, bpp, fbbpp;
Pixel allbits;
KdMouseMatrix m;
KdPointerMatrix m;
if (vesa_linear_fb)
{
@ -970,10 +970,10 @@ vesaComputeFramebufferMapping (KdScreenInfo *screen)
pscr->mapping = VESA_WINDOWED;
pscr->shadow = TRUE;
}
KdComputeMouseMatrix (&m, pscr->randr,
pscr->mode.XResolution, pscr->mode.YResolution);
KdComputePointerMatrix (&m, pscr->randr,
pscr->mode.XResolution, pscr->mode.YResolution);
KdSetMouseMatrix (&m);
KdSetPointerMatrix (&m);
screen->width = pscr->mode.XResolution;
screen->height = pscr->mode.YResolution;

View File

@ -71,7 +71,16 @@ InitOutput (ScreenInfo *pScreenInfo, int argc, char **argv)
void
InitInput (int argc, char **argv)
{
KdInitInput(&LinuxMouseFuncs, &LinuxKeyboardFuncs);
KdKeyboardInfo *ki = NULL;
KdAddPointerDriver(&LinuxMouseDriver);
KdAddKeyboardDriver(&LinuxKeyboardDriver);
ki = KdNewKeyboard();
if (ki) {
ki->driver = &LinuxKeyboardDriver;
KdAddKeyboard(ki);
}
KdInitInput();
}
void

View File

@ -5,10 +5,6 @@ INCLUDES = \
bin_PROGRAMS = Xvia
if TSLIB
TSLIB_FLAG = -lts
endif
noinst_LIBRARIES = libvia.a
libvia_a_SOURCES = \
@ -28,7 +24,4 @@ VIA_LIBS = \
Xvia_LDADD = \
$(VIA_LIBS) \
@KDRIVE_LIBS@ \
@XSERVER_LIBS@ \
$(TSLIB_FLAG)
Xvia_DEPENDENCIES = $(VIA_LIBS)
@XSERVER_LIBS@

View File

@ -171,7 +171,7 @@ static int kbdFd = -1;
#include <event.h>
#include <kbd_ioctl.h>
extern KeybdCtrl defaultKeyboardControl;
extern KeyboardCtrl defaultKeyboardControl;
static void
VxWorksSetAutorepeat (unsigned char *repeats, Bool on)
@ -235,7 +235,7 @@ void
VxWorksKeyboardLeds (int leds)
{
DeviceIntPtr pKeyboard = (DeviceIntPtr) LookupKeyboardDevice ();
KeybdCtrl *ctrl = &pKeyboard->kbdfeed->ctrl;
KeyboardCtrl *ctrl = &pKeyboard->kbdfeed->ctrl;
led_ioctl_info led_info;
int i;

View File

@ -43,7 +43,7 @@ from The Open Group.
#include <X11/keysym.h>
Bool
LegalModifier(unsigned int key, DevicePtr pDev)
LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}

View File

@ -21,8 +21,6 @@ RANDRSOURCES = xf86RandR.c
BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
KBDSOURCES = xf86Kbd@XORG_OS_KBD@.c
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
xf86DefModeSet.c: $(srcdir)/modeline2c.pl $(MODEDEFSOURCES)
@ -34,14 +32,13 @@ AM_LDFLAGS = -r
libcommon_la_SOURCES = xf86Configure.c xf86Bus.c xf86Config.c \
xf86Cursor.c xf86cvt.c xf86DGA.c xf86DPMS.c \
xf86DoProbe.c xf86DoScanPci.c xf86Events.c \
xf86Globals.c xf86Io.c xf86AutoConfig.c \
xf86Globals.c xf86AutoConfig.c \
xf86MiscExt.c xf86Option.c \
xf86VidMode.c xf86fbman.c xf86cmap.c \
xf86Helper.c xf86PM.c \
xf86Mode.c xf86Build.h xorgHelper.c xf86Versions.c \
$(XVSOURCES) $(BUSSOURCES) $(XKBSOURCES) \
$(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES) \
$(KBDSOURCES)
$(DEBUGSOURCES) $(XISOURCES) $(RANDRSOURCES)
nodist_libcommon_la_SOURCES = xf86DefModeSet.c
libinit_a_SOURCES = xf86Build.h xf86Init.c
@ -59,11 +56,6 @@ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
DISTCLEANFILES = xf86Build.h
CLEANFILES = $(BUILT_SOURCES)
# this is a hack for now. as above we don't have rules to build all of these
# yet, but we want to make sure they all get into the distball. this should
# eventually go away.
DISTKBDSOURCES = xf86Kbd.c xf86KbdBSD.c xf86KbdLnx.c xf86KbdMach.c
EXTRA_DIST = \
atKeynames.h \
compiler.h \

View File

@ -383,18 +383,6 @@ xf86DriverlistFromConfig()
return modulearray;
}
Bool
xf86BuiltinInputDriver(const char *name)
{
#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
if (xf86NameCmp(name, "keyboard") == 0)
return TRUE;
else
#endif
return FALSE;
}
char **
xf86InputDriverlistFromConfig()
{
@ -419,8 +407,7 @@ xf86InputDriverlistFromConfig()
if (xf86ConfigLayout.inputs) {
idp = xf86ConfigLayout.inputs;
while (idp->identifier) {
if (!xf86BuiltinInputDriver(idp->driver))
count++;
count++;
idp++;
}
}
@ -435,10 +422,8 @@ xf86InputDriverlistFromConfig()
count = 0;
idp = xf86ConfigLayout.inputs;
while (idp->identifier) {
if (!xf86BuiltinInputDriver(idp->driver)) {
modulearray[count] = idp->driver;
count++;
}
modulearray[count] = idp->driver;
count++;
idp++;
}
modulearray[count] = NULL;
@ -1119,304 +1104,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts)
return TRUE;
}
/*
* XXX This function is temporary, and will be removed when the keyboard
* driver is converted into a regular input driver.
*/
static Bool
configInputKbd(IDevPtr inputp)
{
char *s;
MessageType from = X_DEFAULT;
Bool customKeycodesDefault = FALSE;
int verb = 0;
#if defined(XQUEUE)
char *kbdproto = "Xqueue";
#else
char *kbdproto = "standard";
#endif
/* Initialize defaults */
xf86Info.xleds = 0L;
xf86Info.kbdDelay = 500;
xf86Info.kbdRate = 30;
xf86Info.kbdProc = NULL;
xf86Info.vtinit = NULL;
xf86Info.vtSysreq = VT_SYSREQ_DEFAULT;
#if defined(SVR4) && defined(i386)
xf86Info.panix106 = FALSE;
#endif
xf86Info.kbdCustomKeycodes = FALSE;
#ifdef WSCONS_SUPPORT
xf86Info.kbdFd = -1;
#endif
#ifdef XKB
if (!xf86IsPc98()) {
xf86Info.xkbrules = __XKBDEFRULES__;
xf86Info.xkbmodel = "pc105";
xf86Info.xkblayout = "us";
xf86Info.xkbvariant = NULL;
xf86Info.xkboptions = NULL;
} else {
xf86Info.xkbrules = "xfree98";
xf86Info.xkbmodel = "pc98";
xf86Info.xkblayout = "nec/jp";
xf86Info.xkbvariant = NULL;
xf86Info.xkboptions = NULL;
}
xf86Info.xkbcomponents_specified = FALSE;
/* Should discourage the use of these. */
xf86Info.xkbkeymap = NULL;
xf86Info.xkbtypes = NULL;
xf86Info.xkbcompat = NULL;
xf86Info.xkbkeycodes = NULL;
xf86Info.xkbsymbols = NULL;
xf86Info.xkbgeometry = NULL;
#endif
s = xf86SetStrOption(inputp->commonOptions, "Protocol", kbdproto);
if (xf86NameCmp(s, "standard") == 0) {
xf86Info.kbdProc = xf86KbdProc;
xf86Info.kbdEvents = xf86KbdEvents;
xfree(s);
} else if (xf86NameCmp(s, "xqueue") == 0) {
#ifdef __UNIXWARE__
/*
* To retain compatibility with older config files, on UnixWare, we
* accept the xqueue protocol but use the normal keyboard procs.
*/
xf86Info.kbdProc = xf86KbdProc;
xf86Info.kbdEvents = xf86KbdEvents;
#else
#ifdef XQUEUE
xf86Info.kbdProc = xf86XqueKbdProc;
xf86Info.kbdEvents = xf86XqueEvents;
xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n");
#endif
#endif
xfree(s);
#ifdef WSCONS_SUPPORT
} else if (xf86NameCmp(s, "wskbd") == 0) {
xf86Info.kbdProc = xf86KbdProc;
xf86Info.kbdEvents = xf86WSKbdEvents;
xfree(s);
s = xf86SetStrOption(inputp->commonOptions, "Device", NULL);
xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n");
if (s == NULL) {
xf86ConfigError("A \"device\" option is required with"
" the \"wskbd\" keyboard protocol");
return FALSE;
}
xf86Info.kbdFd = open(s, O_RDWR | O_NONBLOCK | O_EXCL);
if (xf86Info.kbdFd == -1) {
xf86ConfigError("cannot open \"%s\"", s);
xfree(s);
return FALSE;
}
xfree(s);
/* Find out keyboard type */
if (ioctl(xf86Info.kbdFd, WSKBDIO_GTYPE, &xf86Info.wsKbdType) == -1) {
xf86ConfigError("cannot get keyboard type");
close(xf86Info.kbdFd);
return FALSE;
}
switch (xf86Info.wsKbdType) {
case WSKBD_TYPE_PC_XT:
xf86Msg(X_PROBED, "Keyboard type: XT\n");
break;
case WSKBD_TYPE_PC_AT:
xf86Msg(X_PROBED, "Keyboard type: AT\n");
break;
case WSKBD_TYPE_USB:
xf86Msg(X_PROBED, "Keyboard type: USB\n");
break;
#ifdef WSKBD_TYPE_ADB
case WSKBD_TYPE_ADB:
xf86Msg(X_PROBED, "Keyboard type: ADB\n");
break;
#endif
#ifdef WSKBD_TYPE_SUN
case WSKBD_TYPE_SUN:
xf86Msg(X_PROBED, "Keyboard type: Sun\n");
break;
#endif
#ifdef WSKBD_TYPE_SUN5
case WSKBD_TYPE_SUN5:
xf86Msg(X_PROBED, "Keyboard type: Sun5\n");
break;
#endif
default:
xf86ConfigError("Unsupported wskbd type \"%d\"",
xf86Info.wsKbdType);
close(xf86Info.kbdFd);
return FALSE;
}
#endif
} else {
xf86ConfigError("\"%s\" is not a valid keyboard protocol name", s);
xfree(s);
return FALSE;
}
s = xf86SetStrOption(inputp->commonOptions, "AutoRepeat", NULL);
if (s) {
if (sscanf(s, "%d %d", &xf86Info.kbdDelay, &xf86Info.kbdRate) != 2) {
xf86ConfigError("\"%s\" is not a valid AutoRepeat value", s);
xfree(s);
return FALSE;
}
xfree(s);
}
s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL);
if (s) {
char *l, *end;
unsigned int i;
l = strtok(s, " \t\n");
while (l) {
i = strtoul(l, &end, 0);
if (*end == '\0')
xf86Info.xleds |= 1L << (i - 1);
else {
xf86ConfigError("\"%s\" is not a valid XLeds value", l);
xfree(s);
return FALSE;
}
l = strtok(NULL, " \t\n");
}
xfree(s);
}
#ifdef XKB
from = X_DEFAULT;
if (noXkbExtension)
from = X_CMDLINE;
else if (xf86FindOption(inputp->commonOptions, "XkbDisable")) {
xf86Msg(X_WARNING, "KEYBOARD: XKB should be disabled in the "
"ServerFlags section instead\n"
"\tof in the \"keyboard\" InputDevice section.\n");
noXkbExtension =
xf86SetBoolOption(inputp->commonOptions, "XkbDisable", FALSE);
from = X_CONFIG;
}
if (noXkbExtension)
xf86Msg(from, "XKB: disabled\n");
#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), (char *)NULL))
if (!noXkbExtension) {
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) {
xf86Info.xkbkeymap = NULL_IF_EMPTY(s);
xf86Msg(X_CONFIG, "XKB: keymap: \"%s\" "
"(overrides other XKB settings)\n", xf86Info.xkbkeymap);
} else {
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbCompat", NULL))) {
xf86Info.xkbcompat = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: compat: \"%s\"\n", s);
}
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbTypes", NULL))) {
xf86Info.xkbtypes = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: types: \"%s\"\n", s);
}
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeycodes", NULL))) {
xf86Info.xkbkeycodes = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: keycodes: \"%s\"\n", s);
}
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbGeometry", NULL))) {
xf86Info.xkbgeometry = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: geometry: \"%s\"\n", s);
}
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbSymbols", NULL))) {
xf86Info.xkbsymbols = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: symbols: \"%s\"\n", s);
}
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbRules", NULL))) {
xf86Info.xkbrules = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: rules: \"%s\"\n", s);
}
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbModel", NULL))) {
xf86Info.xkbmodel = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: model: \"%s\"\n", s);
}
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbLayout", NULL))) {
xf86Info.xkblayout = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: layout: \"%s\"\n", s);
}
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbVariant", NULL))) {
xf86Info.xkbvariant = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: variant: \"%s\"\n", s);
}
if ((s = xf86SetStrOption(inputp->commonOptions, "XkbOptions", NULL))) {
xf86Info.xkboptions = NULL_IF_EMPTY(s);
xf86Info.xkbcomponents_specified = TRUE;
xf86Msg(X_CONFIG, "XKB: options: \"%s\"\n", s);
}
}
}
#undef NULL_IF_EMPTY
#endif
#if defined(SVR4) && defined(i386)
if ((xf86Info.panix106 =
xf86SetBoolOption(inputp->commonOptions, "Panix106", FALSE))) {
xf86Msg(X_CONFIG, "PANIX106: enabled\n");
}
#endif
/*
* This was once a compile time option (ASSUME_CUSTOM_KEYCODES)
* defaulting to 1 on Linux/PPC. It is no longer necessary, but for
* backwards compatibility we provide 'Option "CustomKeycodes"'
* and try to autoprobe on Linux/PPC.
*/
from = X_DEFAULT;
verb = 2;
#if defined(__linux__) && defined(__powerpc__)
{
FILE *f;
f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r");
if (f) {
if (fgetc(f) == '0') {
customKeycodesDefault = TRUE;
from = X_PROBED;
verb = 1;
}
fclose(f);
}
}
#endif
if (xf86FindOption(inputp->commonOptions, "CustomKeycodes")) {
from = X_CONFIG;
verb = 1;
}
xf86Info.kbdCustomKeycodes =
xf86SetBoolOption(inputp->commonOptions, "CustomKeycodes",
customKeycodesDefault);
xf86MsgVerb(from, verb, "Keyboard: CustomKeycode %s\n",
xf86Info.kbdCustomKeycodes ? "enabled" : "disabled");
return TRUE;
}
/*
* Locate the core input devices. These can be specified/located in
* the following ways, in order of priority:
@ -1653,10 +1340,6 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout)
confInput = xf86findInputByDriver("kbd",
xf86configptr->conf_input_lst);
}
if (!confInput) {
confInput = xf86findInputByDriver("keyboard",
xf86configptr->conf_input_lst);
}
if (confInput) {
foundKeyboard = TRUE;
from = X_DEFAULT;
@ -2563,10 +2246,6 @@ configInput(IDevPtr inputp, XF86ConfInputPtr conf_input, MessageType from)
inputp->commonOptions = conf_input->inp_option_lst;
inputp->extraOptions = NULL;
/* XXX This is required until the keyboard driver is converted */
if (!xf86NameCmp(inputp->driver, "keyboard"))
return configInputKbd(inputp);
return TRUE;
}

View File

@ -76,7 +76,7 @@ Bool foundMouse = FALSE;
#elif defined(__SCO__)
static char *DFLT_MOUSE_PROTO = "OSMouse";
#elif defined(__UNIXWARE__)
static char *DFLT_MOUSE_PROTO = "Xqueue";
static char *DFLT_MOUSE_PROTO = "OSMouse";
static char *DFLT_MOUSE_DEV = "/dev/mouse";
#elif defined(QNX4)
static char *DFLT_MOUSE_PROTO = "OSMouse";
@ -265,11 +265,7 @@ configureInputSection (void)
parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
ptr->inp_identifier = "Keyboard0";
#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
ptr->inp_driver = "keyboard";
#else
ptr->inp_driver = "kbd";
#endif
ptr->list.next = NULL;
/* Crude mechanism to auto-detect mouse (os dependent) */

View File

@ -77,14 +77,9 @@ static miPointerScreenFuncRec xf86PointerScreenFuncs = {
xf86CursorOffScreen,
xf86CrossScreen,
xf86WarpCursor,
#ifdef XINPUT
xf86eqEnqueue,
xf86eqSwitchScreen
#else
/* let miPointerInitialize take care of these */
NULL,
NULL
#endif
};
static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];

View File

@ -921,7 +921,7 @@ DGAStealKeyEvent(int index, xEvent *e)
de.u.u.type = e->u.u.type + *XDGAEventBase;
de.u.u.detail = e->u.u.detail;
de.u.event.time = e->u.keyButtonPointer.time;
xf86eqEnqueue ((xEvent *) &de);
mieqEnqueue ((xEvent *) &de);
return TRUE;
}
@ -958,7 +958,7 @@ DGAStealMouseEvent(int index, xEvent *e, int dx, int dy)
de.u.event.dy = dy;
de.u.event.pad1 = DGAMouseX;
de.u.event.pad2 = DGAMouseY;
xf86eqEnqueue ((xEvent *) &de);
mieqEnqueue ((xEvent *) &de);
return TRUE;
}

View File

@ -163,6 +163,7 @@ void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v)
}
#if 0
_X_EXPORT void
xf86STimestamp(xf86TsPtr* timestamp)
{
@ -194,3 +195,4 @@ xf86SPTimestamp(xf86TsPtr* timestamp, char *str)
gettimeofday((struct timeval*)*timestamp,NULL);
}
}
#endif

View File

@ -104,11 +104,7 @@ extern Bool noXkbExtension;
#define XE_POINTER 1
#define XE_KEYBOARD 2
#ifdef XINPUT
#define __EqEnqueue(ev) xf86eqEnqueue(ev)
#else
#define __EqEnqueue(ev) mieqEnqueue(ev)
#endif
#define EqEnqueue(ev) { \
int __sigstate = xf86BlockSIGIO (); \
@ -146,9 +142,6 @@ Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
extern fd_set EnabledDevices;
#if defined(XQUEUE)
extern void xf86XqueRequest(void);
#endif
#ifdef XF86PM
extern void (*xf86OSPMClose)(void);
#endif
@ -170,6 +163,12 @@ typedef struct x_IHRec {
static IHPtr InputHandlers = NULL;
Bool
LegalModifier(unsigned int key, DeviceIntPtr pDev)
{
return TRUE;
}
/*
* TimeSinceLastInputEvent --
* Function used for screensaver purposes by the os module. Returns the
@ -253,11 +252,7 @@ ProcessInputEvents ()
xf86Info.inputPending = FALSE;
#ifdef XINPUT
xf86eqProcessInputEvents();
#else
mieqProcessInputEvents();
#endif
miPointerUpdate();
miPointerPosition(&x, &y);
@ -403,679 +398,6 @@ xf86ProcessActionEvent(ActionEvent action, void *arg)
}
}
/*
* xf86PostKbdEvent --
* Translate the raw hardware KbdEvent into an XEvent, and tell DIX
* about it. Scancode preprocessing and so on is done ...
*
* OS/2 specific xf86PostKbdEvent(key) has been moved to os-support/os2/os2_kbd.c
* as some things differ, and I did not want to scatter this routine with
* ifdefs further (hv).
*/
#ifdef __linux__
extern u_char SpecialServerMap[];
#endif
#if !defined(__UNIXOS2__)
void
xf86PostKbdEvent(unsigned key)
{
int scanCode = (key & 0x7f);
int specialkey = 0;
Bool down = (key & 0x80 ? FALSE : TRUE);
KeyClassRec *keyc = ((DeviceIntPtr)xf86Info.pKeyboard)->key;
Bool updateLeds = FALSE;
Bool UsePrefix = FALSE;
Bool Direction = FALSE;
xEvent kevent;
KeySym *keysym;
int keycode;
static int lockkeys = 0;
#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
static Bool first_time = TRUE;
#endif
#if defined(__sparc__) && defined(__linux__)
static int kbdSun = -1;
#endif
/* Disable any keyboard processing while in suspend */
if (xf86inSuspend)
return;
#if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
if (first_time)
{
first_time = FALSE;
VTSwitchEnabled = (xf86Info.consType == SYSCONS)
|| (xf86Info.consType == PCVT);
}
#endif
#if defined (__sparc__) && defined(__linux__)
if (kbdSun == -1) {
if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun"))
|| (xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun")))
kbdSun = 1;
else
kbdSun = 0;
}
if (kbdSun)
goto special;
#endif /* __sparc__ && __linux__ */
#ifdef __linux__
if (xf86Info.kbdCustomKeycodes) {
specialkey = SpecialServerMap[scanCode];
goto customkeycodes;
}
#endif
/*
* First do some special scancode remapping ...
*/
if (xf86Info.scanPrefix == 0) {
switch (scanCode) {
case KEY_Prefix0:
case KEY_Prefix1:
#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
if (xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
|| xf86Info.consType == PCVT
#ifdef WSCONS_SUPPORT
|| (xf86Info.consType == WSCONS && xf86Info.kbdEvents != xf86WSKbdEvents)
#endif
) {
#endif
xf86Info.scanPrefix = scanCode; /* special prefixes */
return;
#if defined(PCCONS_SUPPORT) || defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
}
break;
#endif
}
#if defined (i386) && defined (SVR4)
/*
* PANIX returns DICOP standards based keycodes in using 106jp
* keyboard. We need to remap some keys.
*/
if(xf86Info.panix106 == TRUE){
switch (scanCode) {
case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */
case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/
case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */
case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */
case 0x6B: scanCode = KEY_Left; break; /* Cur Left */
case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */
case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */
case 0x73: scanCode = KEY_RCtrl; break; /* not needed */
}
} else
#endif /* i386 && SVR4 */
{
switch (scanCode) {
case 0x59: scanCode = KEY_0x59; break;
case 0x5a: scanCode = KEY_0x5A; break;
case 0x5b: scanCode = KEY_0x5B; break;
case 0x5c: scanCode = KEY_KP_Equal; break; /* Keypad Equal */
case 0x5d: scanCode = KEY_0x5D; break;
case 0x5e: scanCode = KEY_0x5E; break;
case 0x5f: scanCode = KEY_0x5F; break;
case 0x62: scanCode = KEY_0x62; break;
case 0x63: scanCode = KEY_0x63; break;
case 0x64: scanCode = KEY_0x64; break;
case 0x65: scanCode = KEY_0x65; break;
case 0x66: scanCode = KEY_0x66; break;
case 0x67: scanCode = KEY_0x67; break;
case 0x68: scanCode = KEY_0x68; break;
case 0x69: scanCode = KEY_0x69; break;
case 0x6a: scanCode = KEY_0x6A; break;
case 0x6b: scanCode = KEY_0x6B; break;
case 0x6c: scanCode = KEY_0x6C; break;
case 0x6d: scanCode = KEY_0x6D; break;
case 0x6e: scanCode = KEY_0x6E; break;
case 0x6f: scanCode = KEY_0x6F; break;
case 0x70: scanCode = KEY_0x70; break;
case 0x71: scanCode = KEY_0x71; break;
case 0x72: scanCode = KEY_0x72; break;
case 0x73: scanCode = KEY_0x73; break;
case 0x74: scanCode = KEY_0x74; break;
case 0x75: scanCode = KEY_0x75; break;
case 0x76: scanCode = KEY_0x76; break;
}
}
}
else if (
#ifdef CSRG_BASED
(xf86Info.consType == PCCONS || xf86Info.consType == SYSCONS
|| xf86Info.consType == PCVT
#ifdef WSCONS_SUPPORT
|| (xf86Info.consType == WSCONS && xf86Info.kbdEvents !=
xf86WSKbdEvents)
#endif
) &&
#endif
(xf86Info.scanPrefix == KEY_Prefix0)) {
xf86Info.scanPrefix = 0;
switch (scanCode) {
case KEY_KP_7: scanCode = KEY_Home; break; /* curs home */
case KEY_KP_8: scanCode = KEY_Up; break; /* curs up */
case KEY_KP_9: scanCode = KEY_PgUp; break; /* curs pgup */
case KEY_KP_4: scanCode = KEY_Left; break; /* curs left */
case KEY_KP_5: scanCode = KEY_Begin; break; /* curs begin */
case KEY_KP_6: scanCode = KEY_Right; break; /* curs right */
case KEY_KP_1: scanCode = KEY_End; break; /* curs end */
case KEY_KP_2: scanCode = KEY_Down; break; /* curs down */
case KEY_KP_3: scanCode = KEY_PgDown; break; /* curs pgdown */
case KEY_KP_0: scanCode = KEY_Insert; break; /* curs insert */
case KEY_KP_Decimal: scanCode = KEY_Delete; break; /* curs delete */
case KEY_Enter: scanCode = KEY_KP_Enter; break; /* keypad enter */
case KEY_LCtrl: scanCode = KEY_RCtrl; break; /* right ctrl */
case KEY_KP_Multiply: scanCode = KEY_Print; break; /* print */
case KEY_Slash: scanCode = KEY_KP_Divide; break; /* keyp divide */
case KEY_Alt: scanCode = KEY_AltLang; break; /* right alt */
case KEY_ScrollLock: scanCode = KEY_Break; break; /* curs break */
case 0x5b: scanCode = KEY_LMeta; break;
case 0x5c: scanCode = KEY_RMeta; break;
case 0x5d: scanCode = KEY_Menu; break;
case KEY_F3: scanCode = KEY_F13; break;
case KEY_F4: scanCode = KEY_F14; break;
case KEY_F5: scanCode = KEY_F15; break;
case KEY_F6: scanCode = KEY_F16; break;
case KEY_F7: scanCode = KEY_F17; break;
case KEY_KP_Plus: scanCode = KEY_KP_DEC; break;
/*
* Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6)
*/
case 0x2A:
case 0x36:
return;
default:
xf86MsgVerb(X_INFO, 4, "Unreported Prefix0 scancode: 0x%02x\n",
scanCode);
/*
* "Internet" keyboards are generating lots of new codes. Let them
* pass. There is little consistency between them, so don't bother
* with symbolic names at this level.
*/
scanCode += 0x78;
}
}
else if (xf86Info.scanPrefix == KEY_Prefix1)
{
xf86Info.scanPrefix = (scanCode == KEY_LCtrl) ? KEY_LCtrl : 0;
return;
}
else if (xf86Info.scanPrefix == KEY_LCtrl)
{
xf86Info.scanPrefix = 0;
if (scanCode != KEY_NumLock) return;
scanCode = KEY_Pause; /* pause */
}
#ifndef __sparc64__
/*
* PC keyboards generate separate key codes for
* Alt+Print and Control+Pause but in the X keyboard model
* they need to get the same key code as the base key on the same
* physical keyboard key.
*/
if (scanCode == KEY_SysReqest)
scanCode = KEY_Print;
else if (scanCode == KEY_Break)
scanCode = KEY_Pause;
#endif
/*
* and now get some special keysequences
*/
specialkey = scanCode;
#ifdef __linux__
customkeycodes:
#endif
#if defined(i386) || defined(__i386__)
if (xf86IsPc98()) {
switch (scanCode) {
case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */
case 0x40: specialkey = 0x4a; break; /* KEY_KP_Minus */
case 0x49: specialkey = 0x4e; break; /* KEY_KP_Plus */
/* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
case 0x62: specialkey = 0x3b; break; /* KEY_F1 */
case 0x63: specialkey = 0x3c; break; /* KEY_F2 */
case 0x64: specialkey = 0x3d; break; /* KEY_F3 */
case 0x65: specialkey = 0x3e; break; /* KEY_F4 */
case 0x66: specialkey = 0x3f; break; /* KEY_F5 */
case 0x67: specialkey = 0x40; break; /* KEY_F6 */
case 0x68: specialkey = 0x41; break; /* KEY_F7 */
case 0x69: specialkey = 0x42; break; /* KEY_F8 */
case 0x6a: specialkey = 0x43; break; /* KEY_F9 */
case 0x6b: specialkey = 0x44; break; /* KEY_F10 */
/* case 0x73: specialkey = 0x38; break; KEY_Alt */
/* case 0x74: specialkey = 0x1d; break; KEY_LCtrl */
default: specialkey = 0x00; break;
}
}
#endif
#if defined (__sparc__) && defined(__linux__)
special:
if (kbdSun) {
switch (scanCode) {
case 0x2b: specialkey = KEY_BackSpace; break;
case 0x47: specialkey = KEY_KP_Minus; break;
case 0x7d: specialkey = KEY_KP_Plus; break;
/* XXX needs cases for KEY_KP_Divide and KEY_KP_Multiply */
case 0x05: specialkey = KEY_F1; break;
case 0x06: specialkey = KEY_F2; break;
case 0x08: specialkey = KEY_F3; break;
case 0x0a: specialkey = KEY_F4; break;
case 0x0c: specialkey = KEY_F5; break;
case 0x0e: specialkey = KEY_F6; break;
case 0x10: specialkey = KEY_F7; break;
case 0x11: specialkey = KEY_F8; break;
case 0x12: specialkey = KEY_F9; break;
case 0x07: specialkey = KEY_F10; break;
case 0x09: specialkey = KEY_F11; break;
case 0x0b: specialkey = KEY_F12; break;
default: specialkey = 0; break;
}
/*
* XXX XXX XXX:
*
* I really don't know what's wrong here, but passing the real
* scanCode offsets by one from XKB's point of view.
*
* (ecd@skynet.be, 980405)
*/
scanCode--;
}
#endif /* defined (__sparc__) && defined(__linux__) */
#ifdef XKB
if ((xf86Info.ddxSpecialKeys == SKWhenNeeded &&
!xf86Info.ActionKeyBindingsSet) ||
noXkbExtension || xf86Info.ddxSpecialKeys == SKAlways) {
#endif
if (!(ModifierDown(ShiftMask)) &&
((ModifierDown(ControlMask | AltMask)) ||
(ModifierDown(ControlMask | AltLangMask))))
{
switch (specialkey) {
case KEY_BackSpace:
xf86ProcessActionEvent(ACTION_TERMINATE, NULL);
break;
/*
* Check grabs
*/
case KEY_KP_Divide:
xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL);
break;
case KEY_KP_Multiply:
xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL);
break;
/*
* Video mode switches
*/
case KEY_KP_Minus: /* Keypad - */
if (down) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL);
if (!xf86Info.dontZoom) return;
break;
case KEY_KP_Plus: /* Keypad + */
if (down) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL);
if (!xf86Info.dontZoom) return;
break;
/* Under QNX4, we set the vtPending flag for VT switching and
* let the VT switch function do the rest...
* This is a little different from the other OS'es.
*/
#if defined(QNX4)
case KEY_1:
case KEY_2:
case KEY_3:
case KEY_4:
case KEY_5:
case KEY_6:
case KEY_7:
case KEY_8:
case KEY_9:
if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
if (down) {
int vtno = specialkey - KEY_1 + 1;
xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
}
return;
}
break;
#endif
#if defined(linux) || (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT))) || defined(__SCO__) || defined(__UNIXWARE__)
/*
* Under Linux, the raw keycodes are consumed before the kernel
* does any processing on them, so we must emulate the vt switching
* we want ourselves.
*/
case KEY_F1:
case KEY_F2:
case KEY_F3:
case KEY_F4:
case KEY_F5:
case KEY_F6:
case KEY_F7:
case KEY_F8:
case KEY_F9:
case KEY_F10:
case KEY_F11:
case KEY_F12:
if ((VTSwitchEnabled && !xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
#if (defined(CSRG_BASED) && (defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)))
&& (xf86Info.consType == SYSCONS || xf86Info.consType == PCVT)
#endif
) {
int vtno = specialkey - KEY_F1 + 1;
if (specialkey == KEY_F11 || specialkey == KEY_F12)
vtno = specialkey - KEY_F11 + 11;
if (down)
xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
return;
}
break;
#endif /* linux || BSD with VTs */
/* just worth mentioning here: any 386bsd keyboard driver
* (pccons.c or co_kbd.c) catches CTRL-ALT-DEL and CTRL-ALT-ESC
* before any application (e.g. XF86) will see it
* OBS: syscons does not, nor does pcvt !
*/
}
}
/*
* Start of actual Solaris VT switching code.
* This should pretty much emulate standard SVR4 switching keys.
*
* DWH 12/2/93
*/
#ifdef USE_VT_SYSREQ
if (VTSwitchEnabled && xf86Info.vtSysreq && !xf86Info.dontVTSwitch)
{
switch (specialkey)
{
/*
* syscons on *BSD doesn't have a VT #0 -- don't think Linux does
* either
*/
#if defined (sun) && defined (i386) && defined (SVR4)
case KEY_H:
if (VTSysreqToggle && down)
{
xf86ProcessActionEvent(ACTION_SWITCHSCREEN, NULL);
VTSysreqToggle = 0;
return;
}
break;
/*
* Yah, I know the N, and P keys seem backwards, however that's
* how they work under Solaris
* XXXX N means go to next active VT not necessarily vtno+1 (or vtno-1)
*/
case KEY_N:
if (VTSysreqToggle && down)
{
xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
VTSysreqToggle = FALSE;
return;
}
break;
case KEY_P:
if (VTSysreqToggle && down)
{
xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
VTSysreqToggle = FALSE;
return;
}
break;
#endif
case KEY_F1:
case KEY_F2:
case KEY_F3:
case KEY_F4:
case KEY_F5:
case KEY_F6:
case KEY_F7:
case KEY_F8:
case KEY_F9:
case KEY_F10:
case KEY_F11:
case KEY_F12:
if (VTSysreqToggle && down)
{ int vtno = specialkey - KEY_F1 + 1;
if (specialkey == KEY_F11 || specialkey == KEY_F12)
vtno = specialkey - KEY_F11 + 11;
xf86ProcessActionEvent(ACTION_SWITCHSCREEN, (void *) &vtno);
VTSysreqToggle = FALSE;
return;
}
break;
/* Ignore these keys -- ie don't let them cancel an alt-sysreq */
case KEY_Alt:
case KEY_AltLang:
break;
case KEY_SysReqest:
if (down && (ModifierDown(AltMask) || ModifierDown(AltLangMask)))
VTSysreqToggle = TRUE;
break;
default:
if (VTSysreqToggle)
{
/*
* We only land here when Alt-SysReq is followed by a
* non-switching key.
*/
VTSysreqToggle = FALSE;
}
}
}
#endif /* USE_VT_SYSREQ */
#ifdef __SCO__
/*
* With the console in raw mode, SCO will not switch consoles,
* you get around this by activating the next console along, if
* this fails then go back to console 0, if there is only one
* then it doesn't matter, switching to yourself is a nop as far
* as the console driver is concerned.
* We could do something similar to linux here but SCO ODT uses
* Ctrl-PrintScrn, so why change?
*/
if (specialkey == KEY_Print && ModifierDown(ControlMask)) {
if (down)
xf86ProcessActionEvent(ACTION_SWITCHSCREEN_NEXT, NULL);
return;
}
#endif /* __SCO__ */
#ifdef XKB
}
#endif
/*
* Now map the scancodes to real X-keycodes ...
*/
keycode = scanCode + MIN_KEYCODE;
keysym = (keyc->curKeySyms.map +
keyc->curKeySyms.mapWidth *
(keycode - keyc->curKeySyms.minKeyCode));
#ifdef XKB
if (noXkbExtension) {
#endif
/*
* Filter autorepeated caps/num/scroll lock keycodes.
*/
#define CAPSFLAG 0x01
#define NUMFLAG 0x02
#define SCROLLFLAG 0x04
#define MODEFLAG 0x08
if( down ) {
switch( keysym[0] ) {
case XK_Caps_Lock :
if (lockkeys & CAPSFLAG)
return;
else
lockkeys |= CAPSFLAG;
break;
case XK_Num_Lock :
if (lockkeys & NUMFLAG)
return;
else
lockkeys |= NUMFLAG;
break;
case XK_Scroll_Lock :
if (lockkeys & SCROLLFLAG)
return;
else
lockkeys |= SCROLLFLAG;
break;
}
if (keysym[1] == XF86XK_ModeLock)
{
if (lockkeys & MODEFLAG)
return;
else
lockkeys |= MODEFLAG;
}
}
else {
switch( keysym[0] ) {
case XK_Caps_Lock :
lockkeys &= ~CAPSFLAG;
break;
case XK_Num_Lock :
lockkeys &= ~NUMFLAG;
break;
case XK_Scroll_Lock :
lockkeys &= ~SCROLLFLAG;
break;
}
if (keysym[1] == XF86XK_ModeLock)
lockkeys &= ~MODEFLAG;
}
/*
* LockKey special handling:
* ignore releases, toggle on & off on presses.
* Don't deal with the Caps_Lock keysym directly, but check the lock modifier
*/
if (keyc->modifierMap[keycode] & LockMask ||
keysym[0] == XK_Scroll_Lock ||
keysym[1] == XF86XK_ModeLock ||
keysym[0] == XK_Num_Lock)
{
Bool flag;
if (!down) return;
if (KeyPressed(keycode)) {
down = !down;
flag = FALSE;
}
else
flag = TRUE;
if (keyc->modifierMap[keycode] & LockMask) xf86Info.capsLock = flag;
if (keysym[0] == XK_Num_Lock) xf86Info.numLock = flag;
if (keysym[0] == XK_Scroll_Lock) xf86Info.scrollLock = flag;
if (keysym[1] == XF86XK_ModeLock) xf86Info.modeSwitchLock = flag;
updateLeds = TRUE;
}
if (!xf86Info.kbdCustomKeycodes) {
/*
* normal, non-keypad keys
*/
if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) {
#if !defined(CSRG_BASED) && \
!defined(__GNU__) && \
defined(KB_84)
/*
* magic ALT_L key on AT84 keyboards for multilingual support
*/
if (xf86Info.kbdType == KB_84 &&
ModifierDown(AltMask) &&
keysym[2] != NoSymbol)
{
UsePrefix = TRUE;
Direction = TRUE;
}
#endif /* !CSRG_BASED && ... */
}
}
if (updateLeds) xf86UpdateKbdLeds();
#ifdef XKB
}
#endif
/*
* check for an autorepeat-event
*/
if (down && KeyPressed(keycode)) {
KbdFeedbackClassRec *kbdfeed = ((DeviceIntPtr)xf86Info.pKeyboard)->kbdfeed;
if ((xf86Info.autoRepeat != AutoRepeatModeOn) ||
keyc->modifierMap[keycode] ||
(kbdfeed && !(kbdfeed->ctrl.autoRepeats[keycode>>3] & ( 1<<(keycode&7) ))))
return;
}
xf86Info.lastEventTime = kevent.u.keyButtonPointer.time = GetTimeInMillis();
/*
* And now send these prefixes ...
* NOTE: There cannot be multiple Mode_Switch keys !!!!
*/
if (UsePrefix)
{
ENQUEUE(&kevent,
keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
(Direction ? KeyPress : KeyRelease),
XE_KEYBOARD);
ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
ENQUEUE(&kevent,
keyc->modifierKeyMap[keyc->maxKeysPerModifier*7],
(Direction ? KeyRelease : KeyPress),
XE_KEYBOARD);
}
else
{
ENQUEUE(&kevent, keycode, (down ? KeyPress : KeyRelease), XE_KEYBOARD);
}
}
#endif /* !__UNIXOS2__ */
#define ModifierIsSet(k) ((modifiers & (k)) == (k))
_X_EXPORT Bool
@ -1137,8 +459,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
if (XFD_ANYSET(&devicesWithInput)) {
if (xf86Info.kbdEvents)
(xf86Info.kbdEvents)();
pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->read_input && pInfo->fd >= 0 &&
@ -1161,8 +481,6 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask)
InputInfoPtr pInfo;
(xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */
pInfo = xf86InputDevs;
while (pInfo) {
if (pInfo->read_input && pInfo->fd >= 0) {
@ -1470,6 +788,67 @@ xf86SigMemDebug(int signo)
}
#endif
static void
xf86ReleaseKeys(DeviceIntPtr pDev)
{
KeyClassPtr keyc = NULL;
KeySym *map = NULL;
xEvent *events = NULL, ke;
int i = 0, j = 0, nevents = 0;
ErrorF("releasekeys: called on device %s (%d)\n", pDev->name, pDev->id);
if (!pDev || !pDev->key)
return;
keyc = pDev->key;
map = keyc->curKeySyms.map;
/*
* Hmm... here is the biggest hack of every time !
* It may be possible that a switch-vt procedure has finished BEFORE
* you released all keys neccessary to do this. That peculiar behavior
* can fool the X-server pretty much, cause it assumes that some keys
* were not released. TWM may stuck alsmost completly....
* OK, what we are doing here is after returning from the vt-switch
* exeplicitely unrelease all keyboard keys before the input-devices
* are reenabled.
*/
for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
i < keyc->curKeySyms.maxKeyCode;
i++, map += keyc->curKeySyms.mapWidth) {
ErrorF("key %d: pressed is %s\n", i, KeyPressed(i) ? "true" : "false");
if (KeyPressed(i)) {
switch (*map) {
/* Don't release the lock keys */
case XK_Caps_Lock:
case XK_Shift_Lock:
case XK_Num_Lock:
case XK_Scroll_Lock:
case XK_Kana_Lock:
break;
default:
if (pDev == inputInfo.keyboard) {
ke.u.keyButtonPointer.time = GetTimeInMillis();
ke.u.keyButtonPointer.rootX = 0;
ke.u.keyButtonPointer.rootY = 0;
ke.u.u.type = KeyRelease;
ke.u.u.detail = i;
(*pDev->public.processInputProc) (&ke, pDev, 1);
}
else {
nevents = GetKeyboardEvents(&events, pDev, KeyRelease, i);
ErrorF("device %s: got %d events for %d key\n", pDev->name, nevents, i);
for (j = 0; j < nevents; j++)
mieqEnqueue(events++);
}
break;
}
}
}
}
/*
* xf86VTSwitch --
* Handle requests for switching the vt.
@ -1515,7 +894,6 @@ xf86VTSwitch()
* Keep the order: Disable Device > LeaveVT
* EnterVT > EnableDevice
*/
DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
DisableDevice(pInfo->dev);
@ -1556,12 +934,14 @@ xf86VTSwitch()
SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset);
#if !defined(__UNIXOS2__)
EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
xf86ReleaseKeys(pInfo->dev);
EnableDevice(pInfo->dev);
pInfo = pInfo->next;
}
/* XXX HACK */
xf86ReleaseKeys(inputInfo.keyboard);
#endif /* !__UNIXOS2__ */
for (ih = InputHandlers; ih; ih = ih->next)
xf86EnableInputHandler(ih);
@ -1618,12 +998,14 @@ xf86VTSwitch()
SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset);
#if !defined(__UNIXOS2__)
EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
xf86ReleaseKeys(pInfo->dev);
EnableDevice(pInfo->dev);
pInfo = pInfo->next;
}
/* XXX HACK */
xf86ReleaseKeys(inputInfo.keyboard);
#endif /* !__UNIXOS2__ */
for (ih = InputHandlers; ih; ih = ih->next)
@ -1745,9 +1127,6 @@ xf86ReloadInputDevs(int sig)
signal(sig, (void(*)(int))xf86ReloadInputDevs);
DisableDevice((DeviceIntPtr)xf86Info.pKeyboard);
EnableDevice((DeviceIntPtr)xf86Info.pKeyboard);
pInfo = xf86InputDevs;
while (pInfo) {
DisableDevice(pInfo->dev);

View File

@ -93,36 +93,11 @@ InputInfoPtr xf86InputDevs = NULL;
/* Globals that video drivers may not access */
xf86InfoRec xf86Info = {
NULL, /* pKeyboard */
NULL, /* kbdProc */
NULL, /* kbdEvents */
-1, /* consoleFd */
-1, /* kbdFd */
-1, /* vtno */
-1, /* kbdType */
-1, /* kbdRate */
-1, /* kbdDelay */
-1, /* bell_pitch */
-1, /* bell_duration */
TRUE, /* autoRepeat */
0, /* leds */
0, /* xleds */
NULL, /* vtinit */
0, /* scanPrefix */
FALSE, /* capsLock */
FALSE, /* numLock */
FALSE, /* scrollLock */
FALSE, /* modeSwitchLock */
FALSE, /* composeLock */
FALSE, /* vtSysreq */
SKWhenNeeded, /* ddxSpecialKeys */
FALSE, /* ActionKeyBindingsSet */
#if defined(SVR4) && defined(i386)
FALSE, /* panix106 */
#endif
#if defined(__OpenBSD__) || defined(__NetBSD__)
0, /* wskbdType */
#endif
NULL, /* pMouse */
#ifdef XINPUT
NULL, /* mouseLocal */
@ -140,20 +115,6 @@ xf86InfoRec xf86Info = {
#ifdef CSRG_BASED
-1, /* screenFd */
-1, /* consType */
#endif
#ifdef XKB
NULL, /* xkbkeymap */
NULL, /* xkbkeycodes */
NULL, /* xkbtypes */
NULL, /* xkbcompat */
NULL, /* xkbsymbols */
NULL, /* xkbgeometry */
FALSE, /* xkbcomponents_specified */
NULL, /* xkbrules */
NULL, /* xkbmodel */
NULL, /* xkblayout */
NULL, /* xkbvariant */
NULL, /* xkboptions */
#endif
FALSE, /* allowMouseOpenFail */
TRUE, /* vidModeEnabled */

View File

@ -141,6 +141,32 @@ xf86DeleteInputDriver(int drvIndex)
xf86InputDriverList[drvIndex] = NULL;
}
InputDriverPtr
xf86LookupInputDriver(const char *name)
{
int i;
for (i = 0; i < xf86NumInputDrivers; i++) {
if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
xf86NameCmp(name, xf86InputDriverList[i]->driverName) == 0)
return xf86InputDriverList[i];
}
return NULL;
}
InputInfoPtr
xf86LookupInput(const char *name)
{
InputInfoPtr p;
for (p = xf86InputDevs; p != NULL; p = p->next) {
if (strcmp(name, p->name) == 0)
return p;
}
return NULL;
}
_X_EXPORT void
xf86AddModuleInfo(ModuleInfoPtr info, pointer module)
{
@ -2550,7 +2576,7 @@ xf86SetSilkenMouse (ScreenPtr pScreen)
/*
* XXX quick hack to report correctly for OSs that can't do SilkenMouse
* yet. Should handle this differently so that alternate async methods
* like Xqueue work correctly with this too.
* work correctly with this too.
*/
pScrn->silkenMouse = useSM && xf86SIGIOSupported();
if (serverGeneration == 1)

View File

@ -40,4 +40,7 @@ extern int xf86NumInputDrivers;
/* xf86Xinput.c */
void xf86ActivateDevice(InputInfoPtr pInfo);
/* xf86Helper.c */
InputDriverPtr xf86LookupInputDriver(const char *name);
#endif /* _xf86InPriv_h */

View File

@ -135,18 +135,6 @@ static int numFormats = 6;
#endif
static Bool formatsDone = FALSE;
#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
static InputDriverRec XF86KEYBOARD = {
1,
"keyboard",
NULL,
NULL,
NULL,
NULL,
0
};
#endif
static Bool
xf86CreateRootWindow(WindowPtr pWin)
{
@ -409,10 +397,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xfree(modulelist);
}
#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
/* Setup the builtin input drivers */
xf86AddInputDriver(&XF86KEYBOARD, NULL, 0);
#endif
/* Load all input driver modules specified in the config file. */
if ((modulelist = xf86InputDriverlistFromConfig())) {
xf86LoadModules(modulelist, NULL);
@ -984,21 +968,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
NULL);
}
static InputDriverPtr
MatchInput(IDevPtr pDev)
{
int i;
for (i = 0; i < xf86NumInputDrivers; i++) {
if (xf86InputDriverList[i] && xf86InputDriverList[i]->driverName &&
xf86NameCmp(pDev->driver, xf86InputDriverList[i]->driverName) == 0)
return xf86InputDriverList[i];
}
return NULL;
}
/*
* InitInput --
* Initialize all supported input devices.
@ -1020,19 +989,7 @@ InitInput(argc, argv)
if (serverGeneration == 1) {
/* Call the PreInit function for each input device instance. */
for (pDev = xf86ConfigLayout.inputs; pDev && pDev->identifier; pDev++) {
#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
/* XXX The keyboard driver is a special case for now. */
if (!xf86NameCmp(pDev->driver, "keyboard")) {
xf86MsgVerb(X_WARNING, 0, "*** WARNING the legacy keyboard driver \"keyboard\" is deprecated\n");
xf86MsgVerb(X_WARNING, 0, "*** and will be removed in the next release of the Xorg server.\n");
xf86MsgVerb(X_WARNING, 0, "*** Please consider using the the new \"kbd\" driver for \"%s\".\n",
pDev->identifier);
continue;
}
#endif
if ((pDrv = MatchInput(pDev)) == NULL) {
if ((pDrv = xf86LookupInputDriver(pDev->driver)) == NULL) {
xf86Msg(X_ERROR, "No Input driver matching `%s'\n", pDev->driver);
/* XXX For now, just continue. */
continue;
@ -1054,80 +1011,18 @@ InitInput(argc, argv)
xf86DeleteInput(pInfo, 0);
continue;
}
if (pInfo->flags & XI86_CORE_KEYBOARD) {
if (coreKeyboard) {
xf86Msg(X_ERROR,
"Attempt to register more than one core keyboard (%s)\n",
pInfo->name);
pInfo->flags &= ~XI86_CORE_KEYBOARD;
} else {
if (!(pInfo->flags & XI86_KEYBOARD_CAPABLE)) {
/* XXX just a warning for now */
xf86Msg(X_WARNING,
"%s: does not have core keyboard capabilities\n",
pInfo->name);
}
coreKeyboard = pInfo;
}
}
if (pInfo->flags & XI86_CORE_POINTER) {
if (corePointer) {
xf86Msg(X_ERROR,
"Attempt to register more than one core pointer (%s)\n",
pInfo->name);
pInfo->flags &= ~XI86_CORE_POINTER;
} else {
if (!(pInfo->flags & XI86_POINTER_CAPABLE)) {
/* XXX just a warning for now */
xf86Msg(X_WARNING,
"%s: does not have core pointer capabilities\n",
pInfo->name);
}
corePointer = pInfo;
}
}
}
if (!corePointer) {
xf86Msg(X_WARNING, "No core pointer registered\n");
/* XXX register a dummy core pointer */
}
#ifdef NEW_KBD
if (!coreKeyboard) {
xf86Msg(X_WARNING, "No core keyboard registered\n");
/* XXX register a dummy core keyboard */
}
#endif
}
/* Initialise all input devices. */
pInfo = xf86InputDevs;
while (pInfo) {
xf86Msg(X_INFO, "evaluating device (%s)\n", pInfo->name);
xf86ActivateDevice(pInfo);
pInfo = pInfo->next;
}
if (coreKeyboard) {
xf86Info.pKeyboard = coreKeyboard->dev;
xf86Info.kbdEvents = NULL; /* to prevent the internal keybord driver usage*/
}
else {
#ifdef USE_DEPRECATED_KEYBOARD_DRIVER
/* Only set this if we're allowing the old driver. */
if (xf86Info.kbdProc != NULL)
xf86Info.pKeyboard = AddInputDevice(xf86Info.kbdProc, TRUE);
#endif
}
if (corePointer)
xf86Info.pMouse = corePointer->dev;
if (xf86Info.pKeyboard)
RegisterKeyboardDevice(xf86Info.pKeyboard);
miRegisterPointerDevice(screenInfo.screens[0], xf86Info.pMouse);
#ifdef XINPUT
xf86eqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
#else
mieqInit ((DevicePtr)xf86Info.pKeyboard, (DevicePtr)xf86Info.pMouse);
#endif
mieqInit();
}
#ifndef SET_STDERR_NONBLOCKING
@ -1246,12 +1141,6 @@ AbortDDX()
{
int i;
/*
* try to deinitialize all input devices
*/
if (xf86Info.kbdProc && xf86Info.pKeyboard)
(xf86Info.kbdProc)(xf86Info.pKeyboard, DEVICE_CLOSE);
/*
* try to restore the original video state
*/

View File

@ -1,470 +0,0 @@
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Thomas Roell not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Thomas Roell makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* Copyright (c) 1992-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/* $XConsortium: xf86Io.c /main/27 1996/10/19 17:58:55 kaleb $ */
#define NEED_EVENTS
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xproto.h>
#include "inputstr.h"
#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
#include "xf86Priv.h"
#define XF86_OS_PRIVS
#include "xf86_OSlib.h"
#include "mipointer.h"
#ifdef XINPUT
#include "xf86Xinput.h"
#include <X11/extensions/XIproto.h>
#include "exevents.h"
#endif
#ifdef XKB
#include <X11/extensions/XKB.h>
#include <X11/extensions/XKBstr.h>
#include <X11/extensions/XKBsrv.h>
#endif
unsigned int xf86InitialCaps = 0;
unsigned int xf86InitialNum = 0;
unsigned int xf86InitialScroll = 0;
#include "atKeynames.h"
/*
* xf86KbdBell --
* Ring the terminal/keyboard bell for an amount of time proportional to
* "loudness".
*/
void
xf86KbdBell(percent, pKeyboard, ctrl, unused)
int percent; /* Percentage of full volume */
DeviceIntPtr pKeyboard; /* Keyboard to ring */
pointer ctrl;
int unused;
{
xf86SoundKbdBell(percent, xf86Info.bell_pitch, xf86Info.bell_duration);
}
void
xf86UpdateKbdLeds()
{
int leds = 0;
if (xf86Info.capsLock) leds |= XLED1;
if (xf86Info.numLock) leds |= XLED2;
if (xf86Info.scrollLock || xf86Info.modeSwitchLock) leds |= XLED3;
if (xf86Info.composeLock) leds |= XLED4;
xf86Info.leds = (xf86Info.leds & xf86Info.xleds) | (leds & ~xf86Info.xleds);
xf86KbdLeds();
}
void
xf86KbdLeds ()
{
int leds, real_leds = 0;
#if defined (__sparc__) && defined(__linux__)
static int kbdSun = -1;
if (kbdSun == -1) {
if ((xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) ||
(xf86Info.xkbrules && !strcmp(xf86Info.xkbrules, "sun")))
kbdSun = 1;
else
kbdSun = 0;
}
if (kbdSun) {
if (xf86Info.leds & 0x08) real_leds |= XLED1;
if (xf86Info.leds & 0x04) real_leds |= XLED3;
if (xf86Info.leds & 0x02) real_leds |= XLED4;
if (xf86Info.leds & 0x01) real_leds |= XLED2;
leds = real_leds;
real_leds = 0;
} else {
leds = xf86Info.leds;
}
#else
leds = xf86Info.leds;
#endif /* defined (__sparc__) */
#ifdef LED_CAP
if (leds & XLED1) real_leds |= LED_CAP;
if (leds & XLED2) real_leds |= LED_NUM;
if (leds & XLED3) real_leds |= LED_SCR;
#ifdef LED_COMP
if (leds & XLED4) real_leds |= LED_COMP;
#else
if (leds & XLED4) real_leds |= LED_SCR;
#endif
#endif
#ifdef sun
/* Pass through any additional LEDs, such as Kana LED on Sun Japanese kbd */
real_leds |= (leds & 0xFFFFFFF0);
#endif
xf86SetKbdLeds(real_leds);
(void)leds;
}
/*
* xf86KbdCtrl --
* Alter some of the keyboard control parameters. All special protocol
* values are handled by dix (ProgChangeKeyboardControl)
*/
void
xf86KbdCtrl (pKeyboard, ctrl)
DevicePtr pKeyboard; /* Keyboard to alter */
KeybdCtrl *ctrl;
{
int leds;
xf86Info.bell_pitch = ctrl->bell_pitch;
xf86Info.bell_duration = ctrl->bell_duration;
xf86Info.autoRepeat = ctrl->autoRepeat;
xf86Info.composeLock = (ctrl->leds & XCOMP) ? TRUE : FALSE;
leds = (ctrl->leds & ~(XCAPS | XNUM | XSCR));
#ifdef XKB
if (noXkbExtension) {
#endif
xf86Info.leds = (leds & xf86Info.xleds)|(xf86Info.leds & ~xf86Info.xleds);
#ifdef XKB
} else {
xf86Info.leds = leds;
}
#endif
xf86KbdLeds();
}
/*
* xf86InitKBD --
* Reinitialize the keyboard. Only set Lockkeys according to ours leds.
* Depress all other keys.
*/
void
xf86InitKBD(init)
Bool init;
{
char leds = 0, rad;
unsigned int i;
xEvent kevent;
DeviceIntPtr pKeyboard = xf86Info.pKeyboard;
KeyClassRec *keyc = xf86Info.pKeyboard->key;
KeySym *map = keyc->curKeySyms.map;
kevent.u.keyButtonPointer.time = GetTimeInMillis();
kevent.u.keyButtonPointer.rootX = 0;
kevent.u.keyButtonPointer.rootY = 0;
/*
* Hmm... here is the biggest hack of every time !
* It may be possible that a switch-vt procedure has finished BEFORE
* you released all keys neccessary to do this. That peculiar behavior
* can fool the X-server pretty much, cause it assumes that some keys
* were not released. TWM may stuck alsmost completly....
* OK, what we are doing here is after returning from the vt-switch
* exeplicitely unrelease all keyboard keys before the input-devices
* are reenabled.
*/
for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
i < keyc->curKeySyms.maxKeyCode;
i++, map += keyc->curKeySyms.mapWidth)
if (KeyPressed(i))
{
switch (*map) {
/* Don't release the lock keys */
case XK_Caps_Lock:
case XK_Shift_Lock:
case XK_Num_Lock:
case XK_Scroll_Lock:
case XK_Kana_Lock:
break;
default:
kevent.u.u.detail = i;
kevent.u.u.type = KeyRelease;
(* pKeyboard->public.processInputProc)(&kevent, pKeyboard, 1);
}
}
xf86Info.scanPrefix = 0;
if (init)
{
/*
* we must deal here with the fact, that on some cases the numlock or
* capslock key are enabled BEFORE the server is started up. So look
* here at the state on the according LEDS to determine whether a
* lock-key is already set.
*/
xf86Info.capsLock = FALSE;
xf86Info.numLock = FALSE;
xf86Info.scrollLock = FALSE;
xf86Info.modeSwitchLock = FALSE;
xf86Info.composeLock = FALSE;
#ifdef LED_CAP
#ifdef INHERIT_LOCK_STATE
leds = xf86Info.leds;
for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
i < keyc->curKeySyms.maxKeyCode;
i++, map += keyc->curKeySyms.mapWidth)
switch(*map) {
case XK_Caps_Lock:
case XK_Shift_Lock:
if (leds & LED_CAP)
{
xf86InitialCaps = i;
xf86Info.capsLock = TRUE;
}
break;
case XK_Num_Lock:
if (leds & LED_NUM)
{
xf86InitialNum = i;
xf86Info.numLock = TRUE;
}
break;
case XK_Scroll_Lock:
case XK_Kana_Lock:
if (leds & LED_SCR)
{
xf86InitialScroll = i;
xf86Info.scrollLock = TRUE;
}
break;
}
#endif /* INHERIT_LOCK_STATE */
xf86SetKbdLeds(leds);
#endif /* LED_CAP */
(void)leds;
if (xf86Info.kbdDelay <= 375) rad = 0x00;
else if (xf86Info.kbdDelay <= 625) rad = 0x20;
else if (xf86Info.kbdDelay <= 875) rad = 0x40;
else rad = 0x60;
if (xf86Info.kbdRate <= 2) rad |= 0x1F;
else if (xf86Info.kbdRate >= 30) rad |= 0x00;
else rad |= ((58 / xf86Info.kbdRate) - 2);
xf86SetKbdRepeat(rad);
}
}
/*
* xf86KbdProc --
* Handle the initialization, etc. of a keyboard.
*/
int
xf86KbdProc (pKeyboard, what)
DeviceIntPtr pKeyboard; /* Keyboard to manipulate */
int what; /* What to do to it */
{
KeySymsRec keySyms;
CARD8 modMap[MAP_LENGTH];
int kbdFd;
switch (what) {
case DEVICE_INIT:
/*
* First open and find the current state of the keyboard.
*/
xf86KbdInit();
xf86KbdGetMapping(&keySyms, modMap);
#ifndef XKB
defaultKeyboardControl.leds = xf86GetKbdLeds();
#else
defaultKeyboardControl.leds = 0;
#endif
/*
* Perform final initialization of the system private keyboard
* structure and fill in various slots in the device record
* itself which couldn't be filled in before.
*/
pKeyboard->public.on = FALSE;
#ifdef XKB
if (noXkbExtension) {
#endif
InitKeyboardDeviceStruct((DevicePtr)xf86Info.pKeyboard,
&keySyms,
modMap,
xf86KbdBell,
(KbdCtrlProcPtr)xf86KbdCtrl);
#ifdef XKB
} else {
XkbComponentNamesRec names;
XkbDescPtr desc;
Bool foundTerminate = FALSE;
int keyc;
if (xf86Info.xkbkeymap) {
names.keymap = xf86Info.xkbkeymap;
names.keycodes = NULL;
names.types = NULL;
names.compat = NULL;
names.symbols = NULL;
names.geometry = NULL;
} else {
names.keymap = NULL;
names.keycodes = xf86Info.xkbkeycodes;
names.types = xf86Info.xkbtypes;
names.compat = xf86Info.xkbcompat;
names.symbols = xf86Info.xkbsymbols;
names.geometry = xf86Info.xkbgeometry;
}
if ((xf86Info.xkbkeymap || xf86Info.xkbcomponents_specified)
&& (xf86Info.xkbmodel == NULL || xf86Info.xkblayout == NULL)) {
xf86Info.xkbrules = NULL;
}
XkbSetRulesDflts(xf86Info.xkbrules, xf86Info.xkbmodel,
xf86Info.xkblayout, xf86Info.xkbvariant,
xf86Info.xkboptions);
XkbInitKeyboardDeviceStruct(pKeyboard,
&names,
&keySyms,
modMap,
xf86KbdBell,
(KbdCtrlProcPtr)xf86KbdCtrl);
/* Search keymap for Terminate action */
desc = pKeyboard->key->xkbInfo->desc;
for (keyc = desc->min_key_code; keyc <= desc->max_key_code; keyc++) {
int i;
for (i = 1; i <= XkbKeyNumActions(desc, keyc); i++) {
if (XkbKeyAction(desc, keyc, i)
&& XkbKeyAction(desc, keyc, i)->type == XkbSA_Terminate) {
foundTerminate = TRUE;
goto searchdone;
}
}
}
searchdone:
xf86Info.ActionKeyBindingsSet = foundTerminate;
if (!foundTerminate)
xf86Msg(X_INFO, "Server_Terminate keybinding not found\n");
}
#endif
xf86InitKBD(TRUE);
break;
case DEVICE_ON:
/*
* Set the keyboard into "direct" mode and turn on
* event translation.
*/
kbdFd = xf86KbdOn();
/*
* Discard any pending input after a VT switch to prevent the server
* passing on parts of the VT switch sequence.
*/
sleep(1);
#if defined(WSCONS_SUPPORT)
if (xf86Info.consType != WSCONS) {
#endif
if (kbdFd != -1) {
char buf[16];
read(kbdFd, buf, 16);
}
#if defined(WSCONS_SUPPORT)
}
#endif
#if !defined(__UNIXOS2__) /* Under EMX, keyboard cannot be select()'ed */
if (kbdFd != -1)
AddEnabledDevice(kbdFd);
#endif /* __UNIXOS2__ */
pKeyboard->public.on = TRUE;
xf86InitKBD(FALSE);
break;
case DEVICE_CLOSE:
case DEVICE_OFF:
/*
* Restore original keyboard directness and translation.
*/
kbdFd = xf86KbdOff();
if (kbdFd != -1)
RemoveEnabledDevice(kbdFd);
pKeyboard->public.on = FALSE;
break;
}
return (Success);
}

View File

@ -1,394 +0,0 @@
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Thomas Roell not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Thomas Roell makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* Copyright (c) 1992-2003 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/* $XConsortium: xf86Kbd.c /main/10 1996/02/21 17:38:32 kaleb $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#ifdef __UNIXOS2__
#define I_NEED_OS2_H
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "input.h"
#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "atKeynames.h"
#include "xf86Config.h"
#include "xf86Keymap.h"
#if defined(KDGKBTYPE) && \
!defined(Lynx) && \
!defined(__UNIXOS2__) && !defined(__mips__) && \
!defined(__arm32__) && !defined(__GNU__) && !defined(__QNX__)
#define HAS_GETKBTYPE
#endif
#if defined(GIO_KEYMAP) && \
!defined(Lynx) && \
!defined(__UNIXOS2__) && !defined(__mips__) && \
!defined(__arm32__) && !defined(__GNU__) && !defined(DGUX) && \
!defined(__QNX__)
#define HAS_GETKEYMAP
#define KD_GET_ENTRY(i,n) \
eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]]
/*
* NOTE: Not all possible remappable symbols are remapped. There are two main
* reasons:
* a) The mapping between scancode and SYSV/386 - symboltable
* is inconsistent between different versions and has some
* BIG mistakes.
* b) In X-Windows there is a difference between numpad-keys
* and normal keys. SYSV/386 uses for both kinds of keys
* the same symbol.
*
* Thus only the alpha keypad and the function keys are translated.
* Also CapsLock, NumLock, ScrollLock, Shift, Control & Alt.
*/
static unsigned char remap[128] = {
0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, /* 0x18 - 0x1f */
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, /* 0x20 - 0x27 */
0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, /* 0x28 - 0x2f */
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0, /* 0x30 - 0x37 */
0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, /* 0x38 - 0x3f */
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0, /* 0x40 - 0x47 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x48 - 0x4f */
0, 0, 0, 0, 0, 0, 0x56, 0x57, /* 0x50 - 0x57 */
0x58, 0, 0, 0, 0, 0, 0, 0, /* 0x58 - 0x5f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x60 - 0x67 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x68 - 0x6f */
0, 0, 0x69, 0x65, 0, 0, 0, 0, /* 0x70 - 0x77 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x78 - 0x7f */
};
static KeySym eascii_to_x[512] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
NoSymbol, XK_Return, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, XK_Escape,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
XK_comma, XK_minus, XK_period, XK_slash,
XK_0, XK_1, XK_2, XK_3,
XK_4, XK_5, XK_6, XK_7,
XK_8, XK_9, XK_colon, XK_semicolon,
XK_less, XK_equal, XK_greater, XK_question,
XK_at, XK_A, XK_B, XK_C,
XK_D, XK_E, XK_F, XK_G,
XK_H, XK_I, XK_J, XK_K,
XK_L, XK_M, XK_N, XK_O,
XK_P, XK_Q, XK_R, XK_S,
XK_T, XK_U, XK_V, XK_W,
XK_X, XK_Y, XK_Z, XK_bracketleft,
XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
XK_grave, XK_a, XK_b, XK_c,
XK_d, XK_e, XK_f, XK_g,
XK_h, XK_i, XK_j, XK_k,
XK_l, XK_m, XK_n, XK_o,
XK_p, XK_q, XK_r, XK_s,
XK_t, XK_u, XK_v, XK_w,
XK_x, XK_y, XK_z, XK_braceleft,
XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
XK_sterling, XK_yen, XK_paragraph, XK_section,
XK_aacute, XK_iacute, XK_oacute, XK_uacute,
XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
XK_degree, NoSymbol, NoSymbol, XK_radical,
XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
/*
* special marked entries (256 + x)
*/
NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R,
XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L,
NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R,
XK_Control_L, XK_Control_R, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, XK_F1,
XK_F2, XK_F3, XK_F4, XK_F5,
XK_F6, XK_F7, XK_F8, XK_F9,
XK_F10, XK_F11, XK_F12, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
};
#endif /* HAS_GETKEYMAP */
/*
* LegalModifier --
* determine whether a key is a legal modifier key, i.e send a
* press/release sequence.
*/
/*ARGSUSED*/
Bool
LegalModifier(key, pDev)
unsigned int key;
DevicePtr pDev;
{
return (TRUE);
}
/*
* xf86KbdGetMapping --
* Get the national keyboard mapping. The keyboard type is set, a new map
* and the modifiermap is computed.
*/
void
xf86KbdGetMapping (pKeySyms, pModMap)
KeySymsPtr pKeySyms;
CARD8 *pModMap;
{
KeySym *k;
#ifdef HAS_GETKEYMAP
keymap_t keymap;
#endif
int i;
KeySym *pMap;
#ifdef HAS_GETKBTYPE
char type;
xf86Info.kbdType =
ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
if (xf86Info.kbdType == KB_84)
pMap = map84;
else
pMap = map;
#else
/* OS/2 sets the keyboard type during xf86OpenKbd */
#ifndef __UNIXOS2__
xf86Info.kbdType = 0;
#endif
pMap = map;
#endif
#ifdef HAS_GETKEYMAP
/*
* use the keymap, which can be gotten from our oringinal vt??.
* ( ttymap(1) !!!! )
*/
if (ioctl(xf86Info.consoleFd, GIO_KEYMAP, &keymap) != -1) {
for (i = 0; i < keymap.n_keys && i < NUM_KEYCODES; i++)
if (remap[i]) {
k = pMap + (remap[i] << 2);
k[0] = KD_GET_ENTRY(i,0); /* non-shifed */
k[1] = KD_GET_ENTRY(i,1); /* shifted */
k[2] = KD_GET_ENTRY(i,4); /* alt */
k[3] = KD_GET_ENTRY(i,5); /* alt - shifted */
if (k[3] == k[2]) k[3] = NoSymbol;
if (k[2] == k[1]) k[2] = NoSymbol;
if (k[1] == k[0]) k[1] = NoSymbol;
if (k[0] == k[2] && k[1] == k[3]) k[2] = k[3] = NoSymbol;
}
}
#endif
/*
* compute the modifier map
*/
for (i = 0; i < MAP_LENGTH; i++)
pModMap[i] = NoSymbol; /* make sure it is restored */
for (k = pMap, i = MIN_KEYCODE;
i < (NUM_KEYCODES + MIN_KEYCODE);
i++, k += 4)
switch(*k) {
case XK_Shift_L:
case XK_Shift_R:
pModMap[i] = ShiftMask;
break;
case XK_Control_L:
case XK_Control_R:
pModMap[i] = ControlMask;
break;
case XK_Caps_Lock:
pModMap[i] = LockMask;
break;
case XK_Alt_L:
case XK_Alt_R:
pModMap[i] = AltMask;
break;
case XK_Num_Lock:
pModMap[i] = NumLockMask;
break;
case XK_Scroll_Lock:
pModMap[i] = ScrollLockMask;
break;
/* kana support */
case XK_Kana_Lock:
case XK_Kana_Shift:
pModMap[i] = KanaMask;
break;
/* alternate toggle for multinational support */
case XK_Mode_switch:
pModMap[i] = AltLangMask;
break;
}
pKeySyms->map = pMap;
pKeySyms->mapWidth = GLYPHS_PER_KEY;
pKeySyms->minKeyCode = MIN_KEYCODE;
pKeySyms->maxKeyCode = MAX_KEYCODE;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,650 +0,0 @@
/*
* Linux version of keymapping setup. The kernel (since 0.99.14) has support
* for fully remapping the keyboard, but there are some differences between
* the Linux map and the SVR4 map (esp. in the extended keycodes). We also
* remove the restriction on what keycodes can be remapped.
* Orest Zborowski.
*/
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Thomas Roell not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Thomas Roell makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* Copyright (c) 1994-2001 by The XFree86 Project, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Except as contained in this notice, the name of the copyright holder(s)
* and author(s) shall not be used in advertising or otherwise to promote
* the sale, use or other dealings in this Software without prior written
* authorization from the copyright holder(s) and author(s).
*/
/* $XConsortium: xf86KbdLnx.c /main/7 1996/10/19 17:59:00 kaleb $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "input.h"
#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "atKeynames.h"
#include "xf86Keymap.h"
/*
* LegalModifier --
* determine whether a key is a legal modifier key, i.e send a
* press/release sequence.
*/
/*ARGSUSED*/
Bool
LegalModifier(unsigned int key, DevicePtr pDev)
{
return (TRUE);
}
/*
* xf86KbdGetMapping --
* Get the national keyboard mapping. The keyboard type is set, a new map
* and the modifiermap is computed.
*/
static void readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap);
void
xf86KbdGetMapping (KeySymsPtr pKeySyms, CARD8 *pModMap)
{
KeySym *k;
char type;
int i;
readKernelMapping(pKeySyms, pModMap);
/*
* compute the modifier map
*/
for (i = 0; i < MAP_LENGTH; i++)
pModMap[i] = NoSymbol; /* make sure it is restored */
for (k = map, i = MIN_KEYCODE;
i < (NUM_KEYCODES + MIN_KEYCODE);
i++, k += 4)
switch(*k) {
case XK_Shift_L:
case XK_Shift_R:
pModMap[i] = ShiftMask;
break;
case XK_Control_L:
case XK_Control_R:
pModMap[i] = ControlMask;
break;
case XK_Caps_Lock:
pModMap[i] = LockMask;
break;
case XK_Alt_L:
case XK_Alt_R:
pModMap[i] = AltMask;
break;
case XK_Num_Lock:
pModMap[i] = NumLockMask;
break;
case XK_Scroll_Lock:
pModMap[i] = ScrollLockMask;
break;
/* kana support */
case XK_Kana_Lock:
case XK_Kana_Shift:
pModMap[i] = KanaMask;
break;
/* alternate toggle for multinational support */
case XK_Mode_switch:
pModMap[i] = AltLangMask;
break;
}
xf86Info.kbdType =
ioctl(xf86Info.consoleFd, KDGKBTYPE, &type) != -1 ? type : KB_101;
pKeySyms->map = map;
pKeySyms->mapWidth = GLYPHS_PER_KEY;
pKeySyms->minKeyCode = MIN_KEYCODE;
pKeySyms->maxKeyCode = MAX_KEYCODE;
}
#include <linux/keyboard.h>
static KeySym linux_to_x[256] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, XK_Escape,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
XK_comma, XK_minus, XK_period, XK_slash,
XK_0, XK_1, XK_2, XK_3,
XK_4, XK_5, XK_6, XK_7,
XK_8, XK_9, XK_colon, XK_semicolon,
XK_less, XK_equal, XK_greater, XK_question,
XK_at, XK_A, XK_B, XK_C,
XK_D, XK_E, XK_F, XK_G,
XK_H, XK_I, XK_J, XK_K,
XK_L, XK_M, XK_N, XK_O,
XK_P, XK_Q, XK_R, XK_S,
XK_T, XK_U, XK_V, XK_W,
XK_X, XK_Y, XK_Z, XK_bracketleft,
XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
XK_grave, XK_a, XK_b, XK_c,
XK_d, XK_e, XK_f, XK_g,
XK_h, XK_i, XK_j, XK_k,
XK_l, XK_m, XK_n, XK_o,
XK_p, XK_q, XK_r, XK_s,
XK_t, XK_u, XK_v, XK_w,
XK_x, XK_y, XK_z, XK_braceleft,
XK_bar, XK_braceright, XK_asciitilde, XK_BackSpace,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
XK_nobreakspace,XK_exclamdown, XK_cent, XK_sterling,
XK_currency, XK_yen, XK_brokenbar, XK_section,
XK_diaeresis, XK_copyright, XK_ordfeminine, XK_guillemotleft,
XK_notsign, XK_hyphen, XK_registered, XK_macron,
XK_degree, XK_plusminus, XK_twosuperior, XK_threesuperior,
XK_acute, XK_mu, XK_paragraph, XK_periodcentered,
XK_cedilla, XK_onesuperior, XK_masculine, XK_guillemotright,
XK_onequarter, XK_onehalf, XK_threequarters,XK_questiondown,
XK_Agrave, XK_Aacute, XK_Acircumflex, XK_Atilde,
XK_Adiaeresis, XK_Aring, XK_AE, XK_Ccedilla,
XK_Egrave, XK_Eacute, XK_Ecircumflex, XK_Ediaeresis,
XK_Igrave, XK_Iacute, XK_Icircumflex, XK_Idiaeresis,
XK_ETH, XK_Ntilde, XK_Ograve, XK_Oacute,
XK_Ocircumflex, XK_Otilde, XK_Odiaeresis, XK_multiply,
XK_Ooblique, XK_Ugrave, XK_Uacute, XK_Ucircumflex,
XK_Udiaeresis, XK_Yacute, XK_THORN, XK_ssharp,
XK_agrave, XK_aacute, XK_acircumflex, XK_atilde,
XK_adiaeresis, XK_aring, XK_ae, XK_ccedilla,
XK_egrave, XK_eacute, XK_ecircumflex, XK_ediaeresis,
XK_igrave, XK_iacute, XK_icircumflex, XK_idiaeresis,
XK_eth, XK_ntilde, XK_ograve, XK_oacute,
XK_ocircumflex, XK_otilde, XK_odiaeresis, XK_division,
XK_oslash, XK_ugrave, XK_uacute, XK_ucircumflex,
XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis
};
/*
* Maps the AT keycodes to Linux keycodes
*/
static unsigned char at2lnx[NUM_KEYCODES] =
{
0x01, /* KEY_Escape */ 0x02, /* KEY_1 */
0x03, /* KEY_2 */ 0x04, /* KEY_3 */
0x05, /* KEY_4 */ 0x06, /* KEY_5 */
0x07, /* KEY_6 */ 0x08, /* KEY_7 */
0x09, /* KEY_8 */ 0x0a, /* KEY_9 */
0x0b, /* KEY_0 */ 0x0c, /* KEY_Minus */
0x0d, /* KEY_Equal */ 0x0e, /* KEY_BackSpace */
0x0f, /* KEY_Tab */ 0x10, /* KEY_Q */
0x11, /* KEY_W */ 0x12, /* KEY_E */
0x13, /* KEY_R */ 0x14, /* KEY_T */
0x15, /* KEY_Y */ 0x16, /* KEY_U */
0x17, /* KEY_I */ 0x18, /* KEY_O */
0x19, /* KEY_P */ 0x1a, /* KEY_LBrace */
0x1b, /* KEY_RBrace */ 0x1c, /* KEY_Enter */
0x1d, /* KEY_LCtrl */ 0x1e, /* KEY_A */
0x1f, /* KEY_S */ 0x20, /* KEY_D */
0x21, /* KEY_F */ 0x22, /* KEY_G */
0x23, /* KEY_H */ 0x24, /* KEY_J */
0x25, /* KEY_K */ 0x26, /* KEY_L */
0x27, /* KEY_SemiColon */ 0x28, /* KEY_Quote */
0x29, /* KEY_Tilde */ 0x2a, /* KEY_ShiftL */
0x2b, /* KEY_BSlash */ 0x2c, /* KEY_Z */
0x2d, /* KEY_X */ 0x2e, /* KEY_C */
0x2f, /* KEY_V */ 0x30, /* KEY_B */
0x31, /* KEY_N */ 0x32, /* KEY_M */
0x33, /* KEY_Comma */ 0x34, /* KEY_Period */
0x35, /* KEY_Slash */ 0x36, /* KEY_ShiftR */
0x37, /* KEY_KP_Multiply */ 0x38, /* KEY_Alt */
0x39, /* KEY_Space */ 0x3a, /* KEY_CapsLock */
0x3b, /* KEY_F1 */ 0x3c, /* KEY_F2 */
0x3d, /* KEY_F3 */ 0x3e, /* KEY_F4 */
0x3f, /* KEY_F5 */ 0x40, /* KEY_F6 */
0x41, /* KEY_F7 */ 0x42, /* KEY_F8 */
0x43, /* KEY_F9 */ 0x44, /* KEY_F10 */
0x45, /* KEY_NumLock */ 0x46, /* KEY_ScrollLock */
0x47, /* KEY_KP_7 */ 0x48, /* KEY_KP_8 */
0x49, /* KEY_KP_9 */ 0x4a, /* KEY_KP_Minus */
0x4b, /* KEY_KP_4 */ 0x4c, /* KEY_KP_5 */
0x4d, /* KEY_KP_6 */ 0x4e, /* KEY_KP_Plus */
0x4f, /* KEY_KP_1 */ 0x50, /* KEY_KP_2 */
0x51, /* KEY_KP_3 */ 0x52, /* KEY_KP_0 */
0x53, /* KEY_KP_Decimal */ 0x54, /* KEY_SysReqest */
0x00, /* 0x55 */ 0x56, /* KEY_Less */
0x57, /* KEY_F11 */ 0x58, /* KEY_F12 */
0x66, /* KEY_Home */ 0x67, /* KEY_Up */
0x68, /* KEY_PgUp */ 0x69, /* KEY_Left */
0x5d, /* KEY_Begin */ 0x6a, /* KEY_Right */
0x6b, /* KEY_End */ 0x6c, /* KEY_Down */
0x6d, /* KEY_PgDown */ 0x6e, /* KEY_Insert */
0x6f, /* KEY_Delete */ 0x60, /* KEY_KP_Enter */
0x61, /* KEY_RCtrl */ 0x77, /* KEY_Pause */
0x63, /* KEY_Print */ 0x62, /* KEY_KP_Divide */
0x64, /* KEY_AltLang */ 0x65, /* KEY_Break */
0x00, /* KEY_LMeta */ 0x00, /* KEY_RMeta */
0x7A, /* KEY_Menu/FOCUS_PF11*/0x00, /* 0x6e */
0x7B, /* FOCUS_PF12 */ 0x00, /* 0x70 */
0x00, /* 0x71 */ 0x00, /* 0x72 */
0x59, /* FOCUS_PF2 */ 0x78, /* FOCUS_PF9 */
0x00, /* 0x75 */ 0x00, /* 0x76 */
0x5A, /* FOCUS_PF3 */ 0x5B, /* FOCUS_PF4 */
0x5C, /* FOCUS_PF5 */ 0x5D, /* FOCUS_PF6 */
0x5E, /* FOCUS_PF7 */ 0x5F, /* FOCUS_PF8 */
0x7C, /* JAP_86 */ 0x79, /* FOCUS_PF10 */
0x00, /* 0x7f */
};
#define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0]))
#define NUM_CUSTOMKEYS NR_KEYS
u_char SpecialServerMap[NUM_CUSTOMKEYS];
static void
readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap)
{
KeySym *k;
int i;
int maxkey;
static unsigned char tbl[GLYPHS_PER_KEY] =
{
0, /* unshifted */
1, /* shifted */
0, /* modeswitch unshifted */
0 /* modeswitch shifted */
};
/*
* Read the mapping from the kernel.
* Since we're still using the XFree86 scancode->AT keycode mapping
* routines, we need to convert the AT keycodes to Linux keycodes,
* then translate the Linux keysyms into X keysyms.
*
* First, figure out which tables to use for the modeswitch columns
* above, from the XF86Config fields.
*/
tbl[2] = 8; /* alt */
tbl[3] = tbl[2] | 1;
if (xf86Info.kbdCustomKeycodes) {
k = map;
maxkey = NUM_CUSTOMKEYS;
}
else {
k = map+GLYPHS_PER_KEY;
maxkey = NUM_AT2LNX;
}
for (i = 0; i < maxkey; ++i)
{
struct kbentry kbe;
int j;
if (xf86Info.kbdCustomKeycodes)
kbe.kb_index = i;
else
kbe.kb_index = at2lnx[i];
for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k)
{
unsigned short kval;
*k = NoSymbol;
kbe.kb_table = tbl[j];
if (
(!xf86Info.kbdCustomKeycodes && kbe.kb_index == 0) ||
ioctl(xf86Info.consoleFd, KDGKBENT, &kbe))
continue;
kval = KVAL(kbe.kb_value);
switch (KTYP(kbe.kb_value))
{
case KT_LATIN:
case KT_LETTER:
*k = linux_to_x[kval];
break;
case KT_FN:
if (kval <= 19)
*k = XK_F1 + kval;
else switch (kbe.kb_value)
{
case K_FIND:
*k = XK_Home; /* or XK_Find */
break;
case K_INSERT:
*k = XK_Insert;
break;
case K_REMOVE:
*k = XK_Delete;
break;
case K_SELECT:
*k = XK_End; /* or XK_Select */
break;
case K_PGUP:
*k = XK_Prior;
break;
case K_PGDN:
*k = XK_Next;
break;
case K_HELP:
*k = XK_Help;
break;
case K_DO:
*k = XK_Execute;
break;
case K_PAUSE:
*k = XK_Pause;
break;
case K_MACRO:
*k = XK_Menu;
break;
default:
break;
}
break;
case KT_SPEC:
switch (kbe.kb_value)
{
case K_ENTER:
*k = XK_Return;
break;
case K_BREAK:
*k = XK_Break;
break;
case K_CAPS:
*k = XK_Caps_Lock;
break;
case K_NUM:
*k = XK_Num_Lock;
break;
case K_HOLD:
*k = XK_Scroll_Lock;
break;
case K_COMPOSE:
*k = XK_Multi_key;
break;
default:
break;
}
break;
case KT_PAD:
switch (kbe.kb_value)
{
case K_PPLUS:
*k = XK_KP_Add;
break;
case K_PMINUS:
*k = XK_KP_Subtract;
break;
case K_PSTAR:
*k = XK_KP_Multiply;
break;
case K_PSLASH:
*k = XK_KP_Divide;
break;
case K_PENTER:
*k = XK_KP_Enter;
break;
case K_PCOMMA:
*k = XK_KP_Separator;
break;
case K_PDOT:
*k = XK_KP_Decimal;
break;
case K_PPLUSMINUS:
*k = XK_KP_Subtract;
break;
default:
if (kval <= 9)
*k = XK_KP_0 + kval;
break;
}
break;
/*
* KT_DEAD keys are for accelerated diacritical creation.
*/
case KT_DEAD:
switch (kbe.kb_value)
{
case K_DGRAVE:
*k = XK_dead_grave;
break;
case K_DACUTE:
*k = XK_dead_acute;
break;
case K_DCIRCM:
*k = XK_dead_circumflex;
break;
case K_DTILDE:
*k = XK_dead_tilde;
break;
case K_DDIERE:
*k = XK_dead_diaeresis;
break;
}
break;
case KT_CUR:
switch (kbe.kb_value)
{
case K_DOWN:
*k = XK_Down;
break;
case K_LEFT:
*k = XK_Left;
break;
case K_RIGHT:
*k = XK_Right;
break;
case K_UP:
*k = XK_Up;
break;
}
break;
case KT_SHIFT:
switch (kbe.kb_value)
{
case K_ALTGR:
*k = XK_Alt_R;
break;
case K_ALT:
*k = (kbe.kb_index == 0x64 ?
XK_Alt_R : XK_Alt_L);
break;
case K_CTRL:
*k = (kbe.kb_index == 0x61 ?
XK_Control_R : XK_Control_L);
break;
case K_CTRLL:
*k = XK_Control_L;
break;
case K_CTRLR:
*k = XK_Control_R;
break;
case K_SHIFT:
*k = (kbe.kb_index == 0x36 ?
XK_Shift_R : XK_Shift_L);
break;
case K_SHIFTL:
*k = XK_Shift_L;
break;
case K_SHIFTR:
*k = XK_Shift_R;
break;
default:
break;
}
break;
/*
* KT_ASCII keys accumulate a 3 digit decimal number that gets
* emitted when the shift state changes. We can't emulate that.
*/
case KT_ASCII:
break;
case KT_LOCK:
if (kbe.kb_value == K_SHIFTLOCK)
*k = XK_Shift_Lock;
break;
default:
break;
}
}
if (k[-1] == k[-2]) k[-1] = NoSymbol;
if (k[-2] == k[-3]) k[-2] = NoSymbol;
if (k[-3] == k[-4]) k[-3] = NoSymbol;
if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol;
if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol;
}
if (!xf86Info.kbdCustomKeycodes)
return;
/*
* Find the Mapping for the special server functions
*/
for (i = 0; i < NUM_CUSTOMKEYS; ++i) {
struct kbentry kbe;
int special = 0;
kbe.kb_index = i;
kbe.kb_table = 0; /* Plain map */
if (!ioctl(xf86Info.consoleFd, KDGKBENT, &kbe))
switch (kbe.kb_value) {
case K(KT_LATIN,0x7f): /* This catches DEL too... But who cares? */
special = KEY_BackSpace;
break;
case K_PMINUS:
special = KEY_KP_Minus;
break;
case K_PPLUS:
special = KEY_KP_Plus;
break;
case K_F1:
special = KEY_F1;
break;
case K_F2:
special = KEY_F2;
break;
case K_F3:
special = KEY_F3;
break;
case K_F4:
special = KEY_F4;
break;
case K_F5:
special = KEY_F5;
break;
case K_F6:
special = KEY_F6;
break;
case K_F7:
special = KEY_F7;
break;
case K_F8:
special = KEY_F8;
break;
case K_F9:
special = KEY_F9;
break;
case K_F10:
special = KEY_F10;
break;
case K_F11:
special = KEY_F11;
break;
case K_F12:
special = KEY_F12;
break;
case K_ALT:
special = KEY_Alt;
break;
case K_ALTGR:
special = KEY_AltLang;
break;
case K_CONS:
special = KEY_SysReqest;
break;
}
SpecialServerMap[i] = special;
}
}

View File

@ -1,316 +0,0 @@
/*
*****************************************************************************
* HISTORY
* Log: xf86KbdMach.c,v
* Revision 2.1.2.1 92/06/25 10:32:08 moore
* Incorporate the Elliot Dresselhaus's, Ernest Hua's and local changes
* to run Thomas Roell's I386 color X11R5. Original code only worked
* with SCO Unix. New code works with 2.5 and 3.0 Mach
* [92/06/24 rvb]
*
* EndLog
*
*****************************************************************************
*/
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Thomas Roell not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Thomas Roell makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
*/
/* $XConsortium: xf86KbdMach.c /main/9 1996/02/21 17:38:43 kaleb $ */
#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include <X11/X.h>
#include <X11/Xmd.h>
#include "input.h"
#include "scrnintstr.h"
#include "compiler.h"
#include "xf86.h"
#include "xf86Priv.h"
#include "xf86_OSlib.h"
#include "atKeynames.h"
#include "xf86Config.h"
#include "xf86Keymap.h"
static KeySym ascii_to_x[256] = {
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
XK_BackSpace, XK_Tab, XK_Linefeed, NoSymbol,
NoSymbol, XK_Return, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, XK_Escape,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
XK_space, XK_exclam, XK_quotedbl, XK_numbersign,
XK_dollar, XK_percent, XK_ampersand, XK_apostrophe,
XK_parenleft, XK_parenright, XK_asterisk, XK_plus,
XK_comma, XK_minus, XK_period, XK_slash,
XK_0, XK_1, XK_2, XK_3,
XK_4, XK_5, XK_6, XK_7,
XK_8, XK_9, XK_colon, XK_semicolon,
XK_less, XK_equal, XK_greater, XK_question,
XK_at, XK_A, XK_B, XK_C,
XK_D, XK_E, XK_F, XK_G,
XK_H, XK_I, XK_J, XK_K,
XK_L, XK_M, XK_N, XK_O,
XK_P, XK_Q, XK_R, XK_S,
XK_T, XK_U, XK_V, XK_W,
XK_X, XK_Y, XK_Z, XK_bracketleft,
XK_backslash, XK_bracketright,XK_asciicircum, XK_underscore,
XK_grave, XK_a, XK_b, XK_c,
XK_d, XK_e, XK_f, XK_g,
XK_h, XK_i, XK_j, XK_k,
XK_l, XK_m, XK_n, XK_o,
XK_p, XK_q, XK_r, XK_s,
XK_t, XK_u, XK_v, XK_w,
XK_x, XK_y, XK_z, XK_braceleft,
XK_bar, XK_braceright, XK_asciitilde, XK_Delete,
XK_Ccedilla, XK_udiaeresis, XK_eacute, XK_acircumflex,
XK_adiaeresis, XK_agrave, XK_aring, XK_ccedilla,
XK_ecircumflex, XK_ediaeresis, XK_egrave, XK_idiaeresis,
XK_icircumflex, XK_igrave, XK_Adiaeresis, XK_Aring,
XK_Eacute, XK_ae, XK_AE, XK_ocircumflex,
XK_odiaeresis, XK_ograve, XK_ucircumflex, XK_ugrave,
XK_ydiaeresis, XK_Odiaeresis, XK_Udiaeresis, XK_cent,
XK_sterling, XK_yen, XK_paragraph, XK_section,
XK_aacute, XK_iacute, XK_oacute, XK_uacute,
XK_ntilde, XK_Ntilde, XK_ordfeminine, XK_masculine,
XK_questiondown,XK_hyphen, XK_notsign, XK_onehalf,
XK_onequarter, XK_exclamdown, XK_guillemotleft,XK_guillemotright,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
NoSymbol, NoSymbol, NoSymbol, NoSymbol,
XK_Greek_alpha, XK_ssharp, XK_Greek_GAMMA, XK_Greek_pi,
XK_Greek_SIGMA, XK_Greek_sigma, XK_mu, XK_Greek_tau,
XK_Greek_PHI, XK_Greek_THETA, XK_Greek_OMEGA, XK_Greek_delta,
XK_infinity, XK_Ooblique, XK_Greek_epsilon, XK_intersection,
XK_identical, XK_plusminus, XK_greaterthanequal, XK_lessthanequal,
XK_topintegral, XK_botintegral, XK_division, XK_similarequal,
XK_degree, NoSymbol, NoSymbol, XK_radical,
XK_Greek_eta, XK_twosuperior, XK_periodcentered, NoSymbol,
};
/*
* LegalModifier --
* determine whether a key is a legal modifier key, i.e send a
* press/release sequence.
*/
/*ARGSUSED*/
Bool
LegalModifier(key, pDev)
unsigned int key;
DevicePtr pDev;
{
return (TRUE);
}
/*
* xf86KbdGetMapping --
* Get the national keyboard mapping. The keyboard type is set, a new map
* and the modifiermap is computed.
*/
void
xf86KbdGetMapping (pKeySyms, pModMap)
KeySymsPtr pKeySyms;
CARD8 *pModMap;
{
KeySym *k;
struct kbentry kbe;
char type;
int i, j;
for (i = 0; i < NUMKEYS; i++)
{
static int states[] = { NORM_STATE, SHIFT_STATE, ALT_STATE, SHIFT_ALT };
int j;
k = &map[i*4];
kbe.kb_index = i;
for (j = 0; j < 4; j++)
{
kbe.kb_state = states[j];
if (ioctl (xf86Info.consoleFd, KDGKBENT, &kbe) != -1)
continue;
if (kbe.kb_value [0] == K_SCAN)
{
int keycode = -1;
switch (kbe.kb_value [1])
{
case K_CTLSC: keycode = XK_Control_L; break;
case K_LSHSC: keycode = XK_Shift_L; break;
case K_RSHSC: keycode = XK_Shift_R; break;
case K_ALTSC: keycode = XK_Alt_L; break;
case K_CLCKSC: keycode = XK_Caps_Lock; break;
case K_NLCKSC: keycode = XK_Num_Lock; break;
default: break;
}
if (keycode > 0)
k[j] = keycode;
}
else if (kbe.kb_value[1] != NC)
{
/* How to handle multiple characters?
Ignore them for now. */
}
else
{
k[j] = ascii_to_x[kbe.kb_value[0]];
}
}
}
/*
* Apply the special key mapping specified in XF86Config
*/
for (k = map, i = MIN_KEYCODE;
i < (NUM_KEYCODES + MIN_KEYCODE);
i++, k += 4) {
switch (k[0]) {
case XK_Alt_L:
j = K_INDEX_LEFTALT;
break;
case XK_Alt_R:
j = K_INDEX_RIGHTALT;
break;
case XK_Scroll_Lock:
j = K_INDEX_SCROLLLOCK;
break;
case XK_Control_R:
j = K_INDEX_RIGHTCTL;
break;
default:
j = -1;
}
if (j >= 0)
switch (xf86Info.specialKeyMap[j]) {
case KM_META:
if (k[0] == XK_Alt_R)
k[1] = XK_Meta_R;
else {
k[0] = XK_Alt_L;
k[1] = XK_Meta_L;
}
break;
case KM_COMPOSE:
k[0] = XK_Multi_key;
break;
case KM_MODESHIFT:
k[0] = XK_Mode_switch;
k[1] = NoSymbol;
break;
case KM_MODELOCK:
k[0] = XK_Mode_switch;
k[1] = XF86XK_ModeLock;
break;
case KM_SCROLLLOCK:
k[0] = XK_Scroll_Lock;
break;
case KM_CONTROL:
k[0] = XK_Control_R;
break;
}
}
/*
* compute the modifier map
*/
for (i = 0; i < MAP_LENGTH; i++)
pModMap[i] = NoSymbol; /* make sure it is restored */
for (k = map, i = MIN_KEYCODE;
i < (NUM_KEYCODES + MIN_KEYCODE);
i++, k += 4)
switch(*k) {
case XK_Shift_L:
case XK_Shift_R:
pModMap[i] = ShiftMask;
break;
case XK_Control_L:
case XK_Control_R:
pModMap[i] = ControlMask;
break;
case XK_Caps_Lock:
pModMap[i] = LockMask;
break;
case XK_Alt_L:
case XK_Alt_R:
pModMap[i] = AltMask;
break;
case XK_Num_Lock:
if (!xf86Info.serverNumLock) pModMap[i] = NumLockMask;
break;
case XK_Scroll_Lock:
pModMap[i] = ScrollLockMask;
break;
/* kana support */
case XK_Kana_Lock:
case XK_Kana_Shift:
pModMap[i] = KanaMask;
break;
/* alternate toggle for multinational support */
case XK_Mode_switch:
pModMap[i] = AltLangMask;
break;
}
xf86Info.kbdType =
ioctl(xf86Info.kbdFd, KDGKBDTYPE, &type) != -1 ? type : KB_VANILLAKB;
pKeySyms->map = map;
pKeySyms->mapWidth = GLYPHS_PER_KEY;
pKeySyms->minKeyCode = MIN_KEYCODE;
if (xf86Info.serverNumLock)
pKeySyms->maxKeyCode = MAX_KEYCODE;
else
pKeySyms->maxKeyCode = MAX_STD_KEYCODE;
}

View File

@ -89,6 +89,7 @@ typedef struct {
int rate;
int delay;
int serverNumLock; /* obsolete */
pointer private;
} kbdParamsRec, *kbdParamsPtr;
/*
@ -256,53 +257,22 @@ _X_EXPORT Bool
MiscExtGetKbdSettings(pointer *kbd)
{
kbdParamsPtr kbdptr;
InputInfoPtr pInfo;
DEBUG_P("MiscExtGetKbdSettings");
kbdptr = MiscExtCreateStruct(MISC_KEYBOARD);
if (!kbdptr)
return FALSE;
kbdptr->type = xf86Info.kbdType;
kbdptr->rate = xf86Info.kbdRate;
kbdptr->delay = xf86Info.kbdDelay;
*kbd = kbdptr;
return TRUE;
return FALSE;
}
_X_EXPORT int
MiscExtGetKbdValue(pointer keyboard, MiscExtKbdValType valtype)
{
kbdParamsPtr kbd = keyboard;
DEBUG_P("MiscExtGetKbdValue");
switch (valtype) {
case MISC_KBD_TYPE: return kbd->type;
case MISC_KBD_RATE: return kbd->rate;
case MISC_KBD_DELAY: return kbd->delay;
case MISC_KBD_SERVNUMLOCK: return 0;
}
return 0;
}
_X_EXPORT Bool
MiscExtSetKbdValue(pointer keyboard, MiscExtKbdValType valtype, int value)
{
kbdParamsPtr kbd = keyboard;
DEBUG_P("MiscExtSetKbdValue");
switch (valtype) {
case MISC_KBD_TYPE:
kbd->type = value;
return TRUE;
case MISC_KBD_RATE:
kbd->rate = value;
return TRUE;
case MISC_KBD_DELAY:
kbd->delay = value;
return TRUE;
case MISC_KBD_SERVNUMLOCK:
return TRUE;
}
return FALSE;
}
@ -365,7 +335,7 @@ MiscExtCreateStruct(MiscExtStructType mse_or_kbd)
InputInfoPtr pInfo = xf86InputDevs;
while (pInfo) {
if (xf86IsCorePointer(pInfo->dev))
if (pInfo->dev == inputInfo.pointer)
break;
pInfo = pInfo->next;
}
@ -463,15 +433,13 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
if (!xf86MouseProtocolIDToName)
return MISC_RET_NOMODULE;
if (mse->type < MTYPE_MICROSOFT
|| ( mse->type > MTYPE_EXPPS2
&& (mse->type!=MTYPE_OSMOUSE && mse->type!=MTYPE_XQUEUE)))
|| (mse->type > MTYPE_EXPPS2
&& (mse->type != MTYPE_OSMOUSE)))
return MISC_RET_BADMSEPROTO;
#ifdef OSMOUSE_ONLY
if (mse->type != MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#else
if (mse->type == MTYPE_XQUEUE)
return MISC_RET_BADMSEPROTO;
if (mse->type == MTYPE_OSMOUSE)
return MISC_RET_BADMSEPROTO;
#endif /* OSMOUSE_ONLY */
@ -492,7 +460,6 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
mse->flags &= ~MF_REOPEN;
}
if (mse->type != MTYPE_OSMOUSE
&& mse->type != MTYPE_XQUEUE
&& mse->type != MTYPE_PS_2
&& mse->type != MTYPE_BUSMOUSE
&& mse->type != MTYPE_IMPS2
@ -513,7 +480,6 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
return MISC_RET_BADFLAGS;
if (mse->type != MTYPE_OSMOUSE
&& mse->type != MTYPE_XQUEUE
&& mse->type != MTYPE_BUSMOUSE)
{
if (mse->samplerate < 0)
@ -586,37 +552,7 @@ MiscExtApply(pointer structure, MiscExtStructType mse_or_kbd)
xf86ReplaceBoolOption(pInfo->options, "ClearRTS",
pMse->mouseFlags | MF_CLEAR_RTS);
}
if (mse_or_kbd == MISC_KEYBOARD) {
kbdParamsPtr kbd = structure;
if (kbd->rate < 0)
return MISC_RET_BADVAL;
if (kbd->delay < 0)
return MISC_RET_BADVAL;
if (kbd->type < KTYPE_UNKNOWN || kbd->type > KTYPE_XQUEUE)
return MISC_RET_BADKBDTYPE;
if (xf86Info.kbdRate!=kbd->rate || xf86Info.kbdDelay!=kbd->delay) {
char rad;
xf86Info.kbdRate = kbd->rate;
xf86Info.kbdDelay = kbd->delay;
if (xf86Info.kbdDelay <= 375) rad = 0x00;
else if (xf86Info.kbdDelay <= 625) rad = 0x20;
else if (xf86Info.kbdDelay <= 875) rad = 0x40;
else rad = 0x60;
if (xf86Info.kbdRate <= 2) rad |= 0x1F;
else if (xf86Info.kbdRate >= 30) rad |= 0x00;
else rad |= ((58/xf86Info.kbdRate)-2);
xf86SetKbdRepeat(rad);
}
#if 0 /* Not done yet */
xf86Info.kbdType = kbd->kbdtype;
#endif
}
return MISC_RET_SUCCESS;
return MISC_RET_BADVAL;
}
_X_EXPORT Bool

View File

@ -193,20 +193,6 @@ Bool xf86LoadModules(char **list, pointer *optlist);
int xf86SetVerbosity(int verb);
int xf86SetLogVerbosity(int verb);
/* xf86Io.c */
void xf86KbdBell(int percent, DeviceIntPtr pKeyboard, pointer ctrl,
int unused);
void xf86KbdLeds(void);
void xf86UpdateKbdLeds(void);
void xf86KbdCtrl(DevicePtr pKeyboard, KeybdCtrl *ctrl);
void xf86InitKBD(Bool init);
int xf86KbdProc(DeviceIntPtr pKeyboard, int what);
/* xf86Kbd.c */
void xf86KbdGetMapping(KeySymsPtr pKeySyms, CARD8 *pModMap);
/* xf86Lock.c */
#ifdef USE_XF86_SERVERLOCK

View File

@ -67,38 +67,11 @@ typedef enum {
*/
typedef struct {
/* keyboard part */
DeviceIntPtr pKeyboard;
DeviceProc kbdProc; /* procedure for initializing */
void (* kbdEvents)(void); /* proc for processing events */
int consoleFd;
int kbdFd;
int vtno;
int kbdType; /* AT84 / AT101 */
int kbdRate;
int kbdDelay;
int bell_pitch;
int bell_duration;
Bool autoRepeat;
unsigned long leds;
unsigned long xleds;
char * vtinit;
int scanPrefix; /* scancode-state */
Bool capsLock;
Bool numLock;
Bool scrollLock;
Bool modeSwitchLock;
Bool composeLock;
Bool vtSysreq;
SpecialKeysInDDX ddxSpecialKeys;
Bool ActionKeyBindingsSet;
#if defined(SVR4) && defined(i386)
Bool panix106;
#endif /* SVR4 && i386 */
#if defined(__OpenBSD__) || defined(__NetBSD__)
int wsKbdType;
#endif
/* mouse part */
DeviceIntPtr pMouse;
@ -125,25 +98,6 @@ typedef struct {
int consType; /* Which console driver? */
#endif
#ifdef XKB
/*
* would like to use an XkbComponentNamesRec here but can't without
* pulling in a bunch of header files. :-(
*/
char * xkbkeymap;
char * xkbkeycodes;
char * xkbtypes;
char * xkbcompat;
char * xkbsymbols;
char * xkbgeometry;
Bool xkbcomponents_specified;
char * xkbrules;
char * xkbmodel;
char * xkblayout;
char * xkbvariant;
char * xkboptions;
#endif
/* Other things */
Bool allowMouseOpenFail;
Bool vidModeEnabled; /* VidMode extension enabled */

View File

@ -31,7 +31,6 @@
#include "xf86.h"
#include "xf86OSmouse.h"
#include "xf86OSKbd.h"
static CARD32 registeredVersions[NUM_BUILTIN_IFS];
@ -51,8 +50,6 @@ xf86GetBuiltinInterfaceVersion(BuiltinInterface iface, int flags)
switch (iface) {
case BUILTIN_IF_OSMOUSE:
return OS_MOUSE_VERSION_CURRENT;
case BUILTIN_IF_OSKBD:
return OS_KBD_VERSION_CURRENT;
default:
xf86Msg(X_ERROR, "xf86GetBuiltinInterfaceVersion: internal error: "
"interface %d not handled\n", iface);

File diff suppressed because it is too large Load Diff

View File

@ -146,8 +146,6 @@ typedef struct _LocalDeviceRec {
unsigned int last;
int old_x;
int old_y;
float dxremaind;
float dyremaind;
char * type_name;
IntegerFeedbackPtr always_core_feedback;
IDevPtr conf_idev;
@ -166,16 +164,7 @@ typedef struct _DeviceAssocRec
extern InputInfoPtr xf86InputDevs;
/* xf86Xinput.c */
int xf86IsCorePointer(DeviceIntPtr dev);
int xf86IsCoreKeyboard(DeviceIntPtr dev);
void xf86XInputSetSendCoreEvents(LocalDevicePtr local, Bool always);
#define xf86AlwaysCore(a,b) xf86XInputSetSendCoreEvents(a,b)
void InitExtInput(void);
Bool xf86eqInit(DevicePtr pKbd, DevicePtr pPtr);
void xf86eqEnqueue(struct _xEvent *event);
void xf86eqProcessInputEvents (void);
void xf86eqSwitchScreen(ScreenPtr pScreen, Bool fromDIX);
void xf86PostMotionEvent(DeviceIntPtr device, int is_absolute,
int first_valuator, int num_valuators, ...);
void xf86PostProximityEvent(DeviceIntPtr device, int is_in,
@ -211,10 +200,16 @@ void xf86RemoveEnabledDevice(InputInfoPtr pInfo);
void xf86AddInputDriver(InputDriverPtr driver, pointer module, int flags);
void xf86DeleteInputDriver(int drvIndex);
InputInfoPtr xf86AllocateInput(InputDriverPtr drv, int flags);
InputDriverPtr xf86LookupInputDriver(const char *name);
InputInfoPtr xf86LookupInput(const char *name);
void xf86DeleteInput(InputInfoPtr pInp, int flags);
/* xf86Option.c */
void xf86CollectInputOptions(InputInfoPtr pInfo, const char **defaultOpts,
pointer extraOpts);
/* Legacy hatred */
#define SendCoreEvents 59
#define DontSendCoreEvents 60
#endif /* _xf86Xinput_h */

View File

@ -70,7 +70,6 @@
# include "xf86Xinput.h"
#endif
#include "xf86OSmouse.h"
#include "xf86OSKbd.h"
#include "xf86xv.h"
#include "xf86xvmc.h"
#include "xf86cmap.h"
@ -280,7 +279,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86SerialModemClearBits)
SYMFUNC(xf86LoadKernelModule)
SYMFUNC(xf86OSMouseInit)
SYMFUNC(xf86OSKbdPreInit)
SYMFUNC(xf86AgpGARTSupported)
SYMFUNC(xf86GetAGPInfo)
SYMFUNC(xf86AcquireGART)
@ -290,10 +288,8 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86BindGARTMemory)
SYMFUNC(xf86UnbindGARTMemory)
SYMFUNC(xf86EnableAGP)
SYMFUNC(xf86SoundKbdBell)
SYMFUNC(xf86GARTCloseScreen)
#ifdef XINPUT
/* XISB routines (Merged from Metrolink tree) */
SYMFUNC(XisbNew)
SYMFUNC(XisbFree)
SYMFUNC(XisbRead)
@ -695,7 +691,6 @@ _X_HIDDEN void *xfree86LookupTab[] = {
/* xf86Xinput.c */
#ifdef XINPUT
SYMFUNC(xf86ProcessCommonOptions)
SYMFUNC(xf86IsCorePointer)
SYMFUNC(xf86PostMotionEvent)
SYMFUNC(xf86PostProximityEvent)
SYMFUNC(xf86PostButtonEvent)
@ -704,13 +699,9 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86GetMotionEvents)
SYMFUNC(xf86MotionHistoryAllocate)
SYMFUNC(xf86FirstLocalDevice)
SYMFUNC(xf86eqEnqueue)
SYMFUNC(xf86ActivateDevice)
/* The following segment merged from Metrolink tree */
SYMFUNC(xf86XInputSetScreen)
SYMFUNC(xf86ScaleAxis)
SYMFUNC(xf86XInputSetSendCoreEvents)
/* End merged segment */
#endif
#ifdef DPMSExtension
SYMFUNC(DPMSGet)

Some files were not shown because too many files have changed in this diff Show More