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

This commit is contained in:
Zephaniah E. Hull 2006-10-21 04:26:14 -04:00
commit e26a494f41
29 changed files with 334 additions and 207 deletions

View File

@ -359,7 +359,12 @@ __glXDRIbindTexImage(__GLXcontext *baseContext,
if (pixmap->drawable.depth >= 24) {
bpp = 4;
format = GL_BGRA;
type = GL_UNSIGNED_BYTE;
type =
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
GL_UNSIGNED_BYTE;
#else
GL_UNSIGNED_INT_8_8_8_8_REV;
#endif
} else {
bpp = 2;
format = GL_RGB;

View File

@ -107,6 +107,7 @@ ProcXChangeDeviceControl(ClientPtr client)
xDeviceAbsCalibCtl *calib;
xDeviceAbsAreaCtl *area;
xDeviceCoreCtl *c;
xDeviceEnableCtl *e;
REQUEST(xChangeDeviceControlReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq);
@ -245,6 +246,28 @@ ProcXChangeDeviceControl(ClientPtr client)
return Success;
}
break;
case DEVICE_ENABLE:
e = (xDeviceEnableCtl *)&stuff[1];
status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e);
if (status == Success) {
if (e->enable)
EnableDevice(dev);
else
DisableDevice(dev);
} 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);

View File

@ -145,6 +145,9 @@ ProcXGetDeviceControl(ClientPtr client)
case DEVICE_CORE:
total_length = sizeof(xDeviceCoreCtl);
break;
case DEVICE_ENABLE:
total_length = sizeof(xDeviceEnableCtl);
break;
default:
SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue);
return Success;
@ -169,6 +172,10 @@ ProcXGetDeviceControl(ClientPtr client)
break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
break;
case DEVICE_ENABLE:
CopySwapDeviceEnable(client, dev, buf);
break;
default:
break;
}
@ -284,6 +291,7 @@ void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
c->control = DEVICE_CORE;
c->length = sizeof(c);
c->status = dev->coreEvents;
c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer);
if (client->swapped) {
swaps(&c->control, n);
@ -292,6 +300,22 @@ void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
}
}
void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
{
register char n;
xDeviceEnableState *e = (xDeviceEnableState *) buf;
e->control = DEVICE_ENABLE;
e->length = sizeof(e);
e->enable = dev->enabled;
if (client->swapped) {
swaps(&e->control, n);
swaps(&e->length, n);
swaps(&e->enable, n);
}
}
/***********************************************************************
*

View File

@ -55,6 +55,11 @@ void CopySwapDeviceCore(ClientPtr /* client */ ,
char * /* buf */
);
void CopySwapDeviceEnable(ClientPtr /* client */ ,
DeviceIntPtr /* dev */ ,
char * /* buf */
);
void SRepXGetDeviceControl(ClientPtr /* client */ ,
int /* size */ ,
xGetDeviceControlReply * /* rep */

View File

@ -301,7 +301,7 @@ typedef unsigned int *glyphPointer;
#define StorePixels(o,p) dst[o] = p
#define Loop dst += widthDst;
#else
#define StorePixels(o,p) *dst++ = (p)
#define StorePixels(o,p) do { *dst = (p); dst++; } while (0)
#define Loop dst += widthLeft;
#endif

View File

@ -251,7 +251,7 @@ configInitialise()
{
DBusConnection *bus = NULL;
DBusError error;
DBusObjectPathVTable vtable;
DBusObjectPathVTable vtable = { .message_function = configMessage };
configConnection = NULL;
@ -265,7 +265,7 @@ configInitialise()
}
if (!dbus_connection_get_unix_fd(bus, &configfd)) {
dbus_connection_close(bus);
dbus_connection_unref(bus);
configfd = -1;
FatalError("[dbus] couldn't get fd for bus\n");
return;
@ -275,7 +275,7 @@ configInitialise()
if (!dbus_bus_request_name(bus, busname, 0, &error) ||
dbus_error_is_set(&error)) {
dbus_error_free(&error);
dbus_connection_close(bus);
dbus_connection_unref(bus);
configfd = -1;
FatalError("[dbus] couldn't take over org.x.config: %s (%s)\n",
error.name, error.message);
@ -287,20 +287,19 @@ configInitialise()
if (dbus_error_is_set(&error)) {
dbus_error_free(&error);
dbus_bus_release_name(bus, busname, &error);
dbus_connection_close(bus);
dbus_connection_unref(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, bus)) {
configfd = -1;
dbus_bus_release_name(bus, busname, &error);
dbus_bus_remove_match(bus, MATCH_RULE, &error);
dbus_connection_close(bus);
dbus_connection_unref(bus);
FatalError("[dbus] couldn't register object path\n");
return;
}
@ -319,10 +318,7 @@ configFini()
if (configConnection) {
dbus_error_init(&error);
/* This causes a segfault inside libdbus. Sigh. */
#if 0
dbus_connection_unregister_object_path(configConnection, busobject);
#endif
dbus_bus_remove_match(configConnection, MATCH_RULE, &error);
dbus_bus_release_name(configConnection, busname, &error);
dbus_connection_unref(configConnection);

View File

@ -82,7 +82,8 @@ AC_TYPE_PID_T
dnl Checks for library functions.
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \
strtol getopt getopt_long vsnprintf walkcontext backtrace])
strtol getopt getopt_long vsnprintf walkcontext backtrace \
getisax])
AC_FUNC_ALLOCA
dnl Old HAS_* names used in os/*.c.
AC_CHECK_FUNC([getdtablesize],
@ -835,6 +836,7 @@ VENDOR_MAN_VERSION="Version ${VENDOR_VERSION_STRING}"
AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path])
AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name])
AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_STRING_SHORT"], [Short vendor name])
@ -1665,13 +1667,9 @@ fi
dnl xorgcfg GUI configuration utility
AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg],
[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
[Build xorgcfg GUI configuration utility (default: no)]),
[XORGCFG=$enableval],[XORGCFG=no])
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],

View File

@ -130,6 +130,8 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart)
dev->devPrivates = NULL;
dev->unwrapProc = NULL;
dev->coreEvents = TRUE;
dev->inited = FALSE;
dev->enabled = FALSE;
for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next)
;
@ -154,6 +156,7 @@ EnableDevice(register DeviceIntPtr dev)
ErrorF("couldn't enable device %d\n", dev->id);
return FALSE;
}
dev->enabled = TRUE;
*prev = dev->next;
for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next)
@ -176,6 +179,7 @@ DisableDevice(register DeviceIntPtr dev)
if (*prev != dev)
return FALSE;
(void)(*dev->deviceProc)(dev, DEVICE_OFF);
dev->enabled = FALSE;
*prev = dev->next;
dev->next = inputInfo.off_devices;
inputInfo.off_devices = dev;

View File

@ -481,19 +481,19 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
xv->deviceid = kbp->deviceid;
switch (final_valuator - i) {
case 6:
xv->valuator5 = valuators[i+5];
xv->valuator5 = valuators[i + 5];
case 5:
xv->valuator4 = valuators[i+4];
xv->valuator4 = valuators[i + 4];
case 4:
xv->valuator3 = valuators[i+3];
xv->valuator3 = valuators[i + 3];
case 3:
xv->valuator2 = valuators[i+2];
xv->valuator2 = valuators[i + 2];
case 2:
/* x and y may have been accelerated. */
if (i == 0)
xv->valuator1 = kbp->root_y;
else
xv->valuator1 = valuators[i+1];
xv->valuator1 = valuators[i + 1];
case 1:
/* x and y may have been accelerated. */
if (i == 0)
@ -520,11 +520,47 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons,
else {
events->u.u.detail = 0;
}
if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr !=
pDev)
inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
}
return num_events;
}
void SwitchCoreKeyboard(DeviceIntPtr pDev)
{
KeyClassPtr ckeyc = inputInfo.keyboard->key;
if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) {
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;
}
}
/* Currently a no-op. */
void SwitchCorePointer(DeviceIntPtr pDev)
{
if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev)
inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev;
}

View File

@ -1435,6 +1435,10 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
*/
#if !defined(__amd64__) && !defined(__x86_64__)
#ifdef HAVE_GETISAX
#include <sys/auxv.h>
#endif
enum CPUFeatures {
NoFeatures = 0,
MMX = 0x1,
@ -1445,7 +1449,23 @@ enum CPUFeatures {
};
static unsigned int detectCPUFeatures(void) {
unsigned int features = 0;
unsigned int result;
#ifdef HAVE_GETISAX
if (getisax(&result, 1)) {
if (result & AV_386_CMOV)
features |= CMOV;
if (result & AV_386_MMX)
features |= MMX;
if (result & AV_386_AMD_MMX)
features |= MMX_Extensions;
if (result & AV_386_SSE)
features |= SSE;
if (result & AV_386_SSE2)
features |= SSE2;
}
#else
char vendor[13];
vendor[0] = 0;
vendor[12] = 0;
@ -1454,7 +1474,8 @@ static unsigned int detectCPUFeatures(void) {
* %esp here. We can't declare either one as clobbered
* since they are special registers (%ebx is the "PIC
* register" holding an offset to global data, %esp the
* stack pointer), so we need to make sure they have their+ * original values when we access the output operands.
* stack pointer), so we need to make sure they have their
* original values when we access the output operands.
*/
__asm__ ("pushf\n"
"pop %%eax\n"
@ -1490,7 +1511,6 @@ static unsigned int detectCPUFeatures(void) {
: "%eax", "%ecx", "%edx"
);
unsigned int features = 0;
if (result) {
/* result now contains the standard feature bits */
if (result & (1 << 15))
@ -1524,6 +1544,7 @@ static unsigned int detectCPUFeatures(void) {
features |= MMX_Extensions;
}
}
#endif /* HAVE_GETISAX */
return features;
}

View File

@ -1656,10 +1656,10 @@ char *kdActionNames[] = {
#endif
static void
KdQueueEvent (xEvent *ev)
KdQueueEvent (DeviceIntPtr pDev, xEvent *ev)
{
KdAssertSigioBlocked ("KdQueueEvent");
mieqEnqueue (ev);
mieqEnqueue (pDev, ev);
}
/* We return true if we're stealing the event. */
@ -1862,7 +1862,7 @@ KdReleaseAllKeys (void)
KdHandleKeyboardEvent(ki, KeyRelease, key);
nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key);
for (i = 0; i < nEvents; i++)
KdQueueEvent (kdEvents + i);
KdQueueEvent (ki->dixdev, kdEvents + i);
}
}
}
@ -1934,7 +1934,7 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
ErrorF("KdEnqueueKeyboardEvent: got %d events from GKE\n", nEvents);
#endif
for (i = 0; i < nEvents; i++)
KdQueueEvent(kdEvents + i);
KdQueueEvent(ki->dixdev, kdEvents + i);
}
else {
ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n",
@ -2052,7 +2052,7 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z,
nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, 0, 3,
valuators);
for (i = 0; i < nEvents; i++)
KdQueueEvent(kdEvents + i);
KdQueueEvent(pi->dixdev, kdEvents + i);
}
void

View File

@ -1,3 +1,5 @@
include $(top_srcdir)/cpprules.in
if DRI
DRI_SUBDIR = dri
endif
@ -82,7 +84,23 @@ endif
optionsdir = $(libdir)/X11
dist_options_DATA = Options
BUILT_SOURCES = xorg.conf.example
CLEAN = xorg.conf.example xorg.conf.example.pre
EXTRA_DIST = xorgconf.cpp
CPP_FILES_FLAGS = \
-DRGBPATH=\"$(RGB_DB)\" \
-DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \
-DMISCFONTPATH="\"$(BASE_FONT_PATH)/misc\"" \
-DT1FONTPATH="\"$(BASE_FONT_PATH)/Type1\"" \
-DTRUETYPEFONTPATH="\"$(BASE_FONT_PATH)/TTF\"" \
-DCIDFONTPATH="\"$(BASE_FONT_PATH)/CID\"" \
-DDPI75FONTPATH="\"$(BASE_FONT_PATH)/75dpi\"" \
-DDPI100FONTPATH="\"$(BASE_FONT_PATH)/100dpi\"" \
-DMODULEPATH=\"$(DEFAULT_MODULE_PATH)\"
relink:
rm -f Xorg && $(MAKE) Xorg
xorg.conf.example.pre: xorgconf.cpp
cp $< $@

View File

@ -208,7 +208,6 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
ScreenPtr pCursorScreen;
Bool Switched;
int px, py;
int sigstate;
if (!pScr->vtSema || !mode || !pScr->SwitchMode)
return FALSE;
@ -228,10 +227,8 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
if (pScreen == pCursorScreen)
miPointerGetPosition(inputInfo.pointer, &px, &py);
sigstate = xf86BlockSIGIO ();
xf86EnterServerState(SETUP);
Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
xf86EnterServerState(OPERATING);
if (Switched) {
pScr->currentMode = mode;
@ -266,7 +263,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
pScr->frameY1 = pScr->virtualY - 1;
}
}
xf86UnblockSIGIO (sigstate);
xf86EnterServerState(OPERATING);
if (pScr->AdjustFrame)
(*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);

View File

@ -909,22 +909,6 @@ DGAVTSwitch(void)
Bool
DGAStealKeyEvent(int index, xEvent *e)
{
DGAScreenPtr pScreenPriv;
dgaEvent de;
if(DGAScreenIndex < 0) /* no DGA */
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */
return FALSE;
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;
mieqEnqueue ((xEvent *) &de);
return TRUE;
}
static int DGAMouseX, DGAMouseY;
@ -932,36 +916,6 @@ static int DGAMouseX, DGAMouseY;
Bool
DGAStealMouseEvent(int index, xEvent *e, int dx, int dy)
{
DGAScreenPtr pScreenPriv;
dgaEvent de;
if(DGAScreenIndex < 0) /* no DGA */
return FALSE;
pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]);
if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */
return FALSE;
DGAMouseX += dx;
if (DGAMouseX < 0)
DGAMouseX = 0;
else if (DGAMouseX > screenInfo.screens[index]->width)
DGAMouseX = screenInfo.screens[index]->width;
DGAMouseY += dy;
if (DGAMouseY < 0)
DGAMouseY = 0;
else if (DGAMouseY > screenInfo.screens[index]->height)
DGAMouseY = screenInfo.screens[index]->height;
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;
de.u.event.dx = dx;
de.u.event.dy = dy;
de.u.event.pad1 = DGAMouseX;
de.u.event.pad2 = DGAMouseY;
mieqEnqueue ((xEvent *) &de);
return TRUE;
}
Bool

View File

@ -104,19 +104,12 @@ extern Bool noXkbExtension;
#define XE_POINTER 1
#define XE_KEYBOARD 2
#define __EqEnqueue(ev) mieqEnqueue(ev)
#define EqEnqueue(ev) { \
#define EqEnqueue(pDev, ev) { \
int __sigstate = xf86BlockSIGIO (); \
__EqEnqueue (ev); \
mieqEnqueue (pDev, ev); \
xf86UnblockSIGIO(__sigstate); \
}
#define ENQUEUE(ev, code, direction, dev_type) \
(ev)->u.u.detail = (code); \
(ev)->u.u.type = (direction); \
EqEnqueue((ev))
/*
* The first of many hacks to get VT switching to work under
* Solaris 2.1 for x86. The basic problem is that Solaris is supposed
@ -839,7 +832,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev)
else {
nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
for (j = 0; j < nevents; j++)
mieqEnqueue(xf86Events + i);
EqEnqueue(pDev, xf86Events + i);
}
break;
}

View File

@ -1651,8 +1651,8 @@ xf86PrintBanner()
"Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
"Select the \"xorg\" product for bugs you find in this release.\n"
"Before reporting bugs in pre-release versions please check the\n"
"latest version in the X.Org Foundation CVS repository.\n"
"See http://wiki.x.org/wiki/CvsPage for CVS access instructions.\n");
"latest version in the X.Org Foundation git repository.\n"
"See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
#endif
ErrorF("\nX Window System Version %d.%d.%d",
XORG_VERSION_MAJOR,

View File

@ -84,7 +84,7 @@ typedef enum {
* mask is 0xFFFF0000.
*/
#define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 0)
#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 1)
#define ABI_XINPUT_VERSION SET_ABI_VERSION(1, 0)
#define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3)
#define ABI_FONT_VERSION SET_ABI_VERSION(0, 5)

View File

@ -657,20 +657,7 @@ xf86PostMotionEvent(DeviceIntPtr device,
valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(xf86Events + i);
#if 0
if (HAS_MOTION_HISTORY(local)) {
buff = ((char *)local->motion_history +
(sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last);
}
if (HAS_MOTION_HISTORY(local)) {
local->last = (local->last + 1) % device->valuator->numMotionEvents;
if (local->last == local->first)
local->first = (local->first + 1) % device->valuator->numMotionEvents;
}
#endif
mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT void
@ -796,7 +783,7 @@ xf86PostButtonEvent(DeviceIntPtr device,
first_valuator, num_valuators, valuators);
for (i = 0; i < nevents; i++)
mieqEnqueue(xf86Events + i);
mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT void
@ -840,7 +827,7 @@ xf86PostKeyEvent(DeviceIntPtr device,
}
for (i = 0; i < nevents; i++)
mieqEnqueue(xf86Events + i);
mieqEnqueue(device, xf86Events + i);
}
_X_EXPORT void
@ -859,7 +846,7 @@ xf86PostKeyboardEvent(DeviceIntPtr device,
is_down ? KeyPress : KeyRelease, key_code);
for (i = 0; i < nevents; i++)
mieqEnqueue(xf86Events + i);
mieqEnqueue(device, xf86Events + i);
}
/*

View File

@ -974,6 +974,7 @@ xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
if(!winPriv) {
winPriv = xalloc(sizeof(XF86XVWindowRec));
if(!winPriv) return BadAlloc;
memset(winPriv, 0, sizeof(XF86XVWindowRec));
winPriv->PortRec = portPriv;
winPriv->next = PrivRoot;
pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv;
@ -1026,6 +1027,9 @@ xf86XVDestroyWindow(WindowPtr pWin)
pPriv->pDraw = NULL;
tmp = WinPriv;
if(WinPriv->pGC) {
FreeGC(WinPriv->pGC, 0);
}
WinPriv = WinPriv->next;
xfree(tmp);
}
@ -1118,6 +1122,8 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
while(WinPriv) {
pPriv = WinPriv->PortRec;
if(!pPriv) goto next;
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
REGION_DESTROY(pScreen, pPriv->pCompositeClip);
@ -1148,6 +1154,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
}
}
next:
pPrev = WinPriv;
WinPriv = WinPriv->next;
}
@ -1739,9 +1746,13 @@ xf86XVPutImage(
REGION_UNINIT(pScreen, &VPReg);
}
if(portPriv->pDraw) {
/* If we are changing windows, unregister our port in the old window */
if(portPriv->pDraw && (portPriv->pDraw != pDraw))
xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv);
}
/* Register our port with the new window */
ret = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
if(ret != Success) goto PUT_IMAGE_BAILOUT;
if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) {
clippedAway = TRUE;
@ -1772,7 +1783,6 @@ xf86XVPutImage(
if((ret == Success) &&
(portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
portPriv->isOn = XV_ON;
portPriv->pDraw = pDraw;
portPriv->drw_x = drw_x; portPriv->drw_y = drw_y;
@ -1813,6 +1823,56 @@ xf86XVQueryImageAttributes(
format->id, width, height, pitches, offsets);
}
_X_EXPORT void
xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
{
ScreenPtr pScreen = pDraw->pScreen;
WindowPtr pWin = (WindowPtr)pDraw;
XF86XVWindowPtr pPriv = GET_XF86XV_WINDOW(pWin);
GCPtr pGC = NULL;
XID pval[2];
BoxPtr pbox = REGION_RECTS(clipboxes);
int i, nbox = REGION_NUM_RECTS(clipboxes);
xRectangle *rects;
if(!xf86Screens[pScreen->myNum]->vtSema) return;
if(pPriv)
pGC = pPriv->pGC;
if(!pGC) {
int status;
pval[0] = key;
pval[1] = IncludeInferiors;
pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status);
if(!pGC) return;
ValidateGC(pDraw, pGC);
if (pPriv) pPriv->pGC = pGC;
} else if (key != pGC->fgPixel){
pval[0] = key;
ChangeGC(pGC, GCForeground, pval);
ValidateGC(pDraw, pGC);
}
REGION_TRANSLATE(pDraw->pScreen, clipboxes, -pDraw->x, -pDraw->y);
rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle));
for(i = 0; i < nbox; i++, pbox++) {
rects[i].x = pbox->x1;
rects[i].y = pbox->y1;
rects[i].width = pbox->x2 - pbox->x1;
rects[i].height = pbox->y2 - pbox->y1;
}
(*pGC->ops->PolyFillRect)(pDraw, pGC, nbox, rects);
if (!pPriv) FreeGC(pGC, 0);
DEALLOCATE_LOCAL(rects);
}
_X_EXPORT void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
{

View File

@ -232,6 +232,9 @@ void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
void
xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
Bool
xf86XVClipVideoHelper(
BoxPtr dst,

View File

@ -80,6 +80,7 @@ typedef struct {
typedef struct _XF86XVWindowRec{
XvPortRecPrivatePtr PortRec;
struct _XF86XVWindowRec *next;
GCPtr pGC;
} XF86XVWindowRec, *XF86XVWindowPtr;
#endif /* _XF86XVPRIV_H_ */

View File

@ -621,6 +621,7 @@ _X_HIDDEN void *xfree86LookupTab[] = {
SYMFUNC(xf86XVAllocateVideoAdaptorRec)
SYMFUNC(xf86XVFreeVideoAdaptorRec)
SYMFUNC(xf86XVFillKeyHelper)
SYMFUNC(xf86XVFillKeyHelperDrawable)
SYMFUNC(xf86XVClipVideoHelper)
SYMFUNC(xf86XVCopyYUV12ToPacked)
SYMFUNC(xf86XVCopyPacked)

View File

@ -56,6 +56,7 @@ endif
if NEED_STRLCAT
STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c
endif
endif BUILD_XORGCFG
xorgcfg_SOURCES = \
accessx.c \
@ -95,10 +96,7 @@ xorgcfg_SOURCES = \
xf86config.h \
$(STRL_SRCS)
XBMdir = $(includedir)/X11/bitmaps
XPMdir = $(includedir)/X11/pixmaps
XBM_DATA = \
BITMAPS = \
card.xbm \
keyboard.xbm \
monitor.xbm \
@ -112,7 +110,7 @@ XBM_DATA = \
shorter.xbm \
taller.xbm
XPM_DATA = \
PIXMAPS = \
card.xpm \
computer.xpm \
keyboard.xpm \
@ -122,6 +120,13 @@ XPM_DATA = \
# Rules needed to cpp man page & app-defaults
include $(top_srcdir)/cpprules.in
if BUILD_XORGCFG
XBMdir = $(includedir)/X11/bitmaps
XPMdir = $(includedir)/X11/pixmaps
XBM_DATA = $(BITMAPS)
XPM_DATA = $(PIXMAPS)
# App default files (*.ad)
appdefaultdir = @APPDEFAULTDIR@
@ -146,7 +151,6 @@ appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@)
all-local: $(appman_PRE) $(appman_DATA)
EXTRA_DIST = $(XBM_DATA) $(XPM_DATA) XOrgCfg.pre xorgcfg.man.pre
BUILT_SOURCES = $(appman_PRE)
CLEANFILES = $(APPDEFAULTFILES) $(BUILT_SOURCES) $(appman_DATA)
@ -156,4 +160,6 @@ SUFFIXES += .$(APP_MAN_SUFFIX) .man
-rm -f $@
$(LN_S) $< $@
endif
endif BUILD_XORGCFG
EXTRA_DIST = $(BITMAPS) $(PIXMAPS) XOrgCfg.pre xorgcfg.man.pre

View File

@ -54,12 +54,9 @@ XCOMM command (or a combination of both methods)
FontPath LOCALFONTPATH
FontPath MISCFONTPATH
FontPath DPI75USFONTPATH
FontPath DPI100USFONTPATH
FontPath T1FONTPATH
FontPath TRUETYPEFONTPATH
FontPath TRUETYPEFONTPATH
FontPath CIDFONTPATH
FontPath SPFONTPATH
FontPath DPI75FONTPATH
FontPath DPI100FONTPATH

View File

@ -112,6 +112,9 @@
/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
/* Define to 1 if you have the `getisax' function. */
#undef HAVE_GETISAX
/* Define to 1 if you have the `getopt' function. */
#undef HAVE_GETOPT

View File

@ -406,6 +406,9 @@ extern int GetKeyboardValuatorEvents(
int num_valuator,
int *valuators);
extern void SwitchCoreKeyboard(DeviceIntPtr pDev);
extern void SwitchCorePointer(DeviceIntPtr pDev);
extern DeviceIntPtr LookupDeviceIntRec(
CARD8 deviceid);

View File

@ -277,6 +277,7 @@ typedef struct _DeviceIntRec {
used to initialize, turn on, or
turn off the device */
Bool inited; /* TRUE if INIT returns Success */
Bool enabled; /* TRUE if ON returns Success */
Bool coreEvents; /* TRUE if device also sends core */
GrabPtr grab; /* the grabber - used by DIX */
struct {

View File

@ -173,6 +173,7 @@ extern Bool mieqInit(
);
extern void mieqEnqueue(
DeviceIntPtr /*pDev*/,
xEventPtr /*e*/
);

146
mi/mieq.c
View File

@ -73,14 +73,14 @@ typedef struct _EventQueue {
static EventQueueRec miEventQueue;
Bool
mieqInit ()
mieqInit()
{
miEventQueue.head = miEventQueue.tail = 0;
miEventQueue.lastEventTime = GetTimeInMillis ();
miEventQueue.lastMotion = FALSE;
miEventQueue.pEnqueueScreen = screenInfo.screens[0];
miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen;
SetInputCheck (&miEventQueue.head, &miEventQueue.tail);
SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
return TRUE;
}
@ -92,57 +92,39 @@ mieqInit ()
*/
void
mieqEnqueue (xEvent *e)
mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
{
HWEventQueueType oldtail = miEventQueue.tail, newtail;
int isMotion = 0;
DeviceIntPtr pDev = NULL;
deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) e;
deviceValuator *v = (deviceValuator *) e;
EventPtr laste = &miEventQueue.events[oldtail - 1];
deviceKeyButtonPointer *lastkbp = (deviceKeyButtonPointer *)
&laste->event[0];
if (e->u.u.type == MotionNotify) {
pDev = inputInfo.pointer;
isMotion = inputInfo.pointer->id & DEVICE_BITS;
}
else if (e->u.u.type == KeyPress || e->u.u.type == KeyRelease) {
pDev = inputInfo.keyboard;
}
else if (e->u.u.type == ButtonPress || e->u.u.type == ButtonRelease) {
pDev = inputInfo.pointer;
}
else {
pDev = LookupDeviceIntRec(kbp->deviceid & DEVICE_BITS);
if (e->u.u.type == MotionNotify)
isMotion = inputInfo.pointer->id;
else if (e->u.u.type == DeviceMotionNotify)
isMotion = pDev->id;
/* We silently steal valuator events: just tack them on to the last
* motion event they need to be attached to. Sigh. */
if (e->u.u.type == DeviceValuator) {
if (laste->nevents > 6) {
ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
return;
}
if (oldtail == miEventQueue.head ||
!(lastkbp->type == DeviceMotionNotify ||
lastkbp->type == DeviceButtonPress ||
lastkbp->type == DeviceButtonRelease) ||
((lastkbp->deviceid & DEVICE_BITS) !=
(v->deviceid & DEVICE_BITS))) {
ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n");
return;
}
memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent));
/* We silently steal valuator events: just tack them on to the last
* motion event they need to be attached to. Sigh. */
if (e->u.u.type == DeviceValuator) {
if (laste->nevents > 6) {
ErrorF("mieqEnqueue: more than six valuator events; dropping.\n");
return;
}
else if (e->u.u.type == DeviceMotionNotify) {
isMotion = pDev->id & DEVICE_BITS;
if (oldtail == miEventQueue.head ||
!(lastkbp->type == DeviceMotionNotify ||
lastkbp->type == DeviceButtonPress ||
lastkbp->type == DeviceButtonRelease) ||
(lastkbp->deviceid != v->deviceid)) {
ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n");
return;
}
memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent));
return;
}
if (!pDev)
FatalError("Couldn't find device for event!\n");
if (isMotion && isMotion == miEventQueue.lastMotion &&
oldtail != miEventQueue.head) {
if (oldtail == 0)
@ -164,10 +146,8 @@ mieqEnqueue (xEvent *e)
memcpy(&(miEventQueue.events[oldtail].event[0]), e, sizeof(xEvent));
miEventQueue.events[oldtail].nevents = 1;
/*
* Make sure that event times don't go backwards - this
* is "unnecessary", but very useful
*/
/* Make sure that event times don't go backwards - this
* is "unnecessary", but very useful. */
if (e->u.keyButtonPointer.time < miEventQueue.lastEventTime &&
miEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
miEventQueue.events[oldtail].event[0].u.keyButtonPointer.time =
@ -182,49 +162,59 @@ mieqEnqueue (xEvent *e)
}
void
mieqSwitchScreen (ScreenPtr pScreen, Bool fromDIX)
mieqSwitchScreen(ScreenPtr pScreen, Bool fromDIX)
{
miEventQueue.pEnqueueScreen = pScreen;
if (fromDIX)
miEventQueue.pDequeueScreen = pScreen;
}
/*
* Call this from ProcessInputEvents()
*/
void mieqProcessInputEvents ()
/* Call this from ProcessInputEvents(). */
void
mieqProcessInputEvents()
{
EventRec *e;
int x, y;
EventRec *e = NULL;
int x = 0, y = 0;
DeviceIntPtr dev = NULL;
while (miEventQueue.head != miEventQueue.tail)
{
if (screenIsSaved == SCREEN_SAVER_ON)
SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
while (miEventQueue.head != miEventQueue.tail) {
if (screenIsSaved == SCREEN_SAVER_ON)
SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset);
e = &miEventQueue.events[miEventQueue.head];
/*
* Assumption - screen switching can only occur on motion events
*/
if (e->pScreen != miEventQueue.pDequeueScreen)
{
miEventQueue.pDequeueScreen = e->pScreen;
x = e->event[0].u.keyButtonPointer.rootX;
y = e->event[0].u.keyButtonPointer.rootY;
if (miEventQueue.head == QUEUE_SIZE - 1)
miEventQueue.head = 0;
else
++miEventQueue.head;
NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
}
else
{
if (miEventQueue.head == QUEUE_SIZE - 1)
miEventQueue.head = 0;
else
++miEventQueue.head;
(*e->pDev->public.processInputProc)(e->event, e->pDev, e->nevents);
}
e = &miEventQueue.events[miEventQueue.head];
/* Assumption - screen switching can only occur on motion events. */
if (e->pScreen != miEventQueue.pDequeueScreen) {
miEventQueue.pDequeueScreen = e->pScreen;
x = e->event[0].u.keyButtonPointer.rootX;
y = e->event[0].u.keyButtonPointer.rootY;
if (miEventQueue.head == QUEUE_SIZE - 1)
miEventQueue.head = 0;
else
++miEventQueue.head;
NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
}
else {
if (miEventQueue.head == QUEUE_SIZE - 1)
miEventQueue.head = 0;
else
++miEventQueue.head;
if (e->event[0].u.u.type == KeyPress ||
e->event[0].u.u.type == KeyRelease) {
SwitchCoreKeyboard(e->pDev);
dev = inputInfo.keyboard;
}
else if (e->event[0].u.u.type == MotionNotify ||
e->event[0].u.u.type == ButtonPress ||
e->event[0].u.u.type == ButtonRelease) {
SwitchCorePointer(e->pDev);
dev = inputInfo.pointer;
}
else {
dev = e->pDev;
}
dev->public.processInputProc(e->event, dev, e->nevents);
}
}
}