xfree86: mouse and keyboard hotplugging support. New mouse devices will get
new cursors, keyboard devices use VCP's focus until paired.
This commit is contained in:
parent
25104ed2e6
commit
f6c3b9fa97
102
dix/events.c
102
dix/events.c
|
@ -2043,7 +2043,7 @@ XYToWindow(int x, int y)
|
|||
return spriteTrace[spriteTraceGood-1];
|
||||
}
|
||||
|
||||
static Bool
|
||||
Bool
|
||||
CheckMotion(xEvent *xE, DeviceIntPtr pDev)
|
||||
{
|
||||
WindowPtr prevSpriteWin;
|
||||
|
@ -2190,63 +2190,67 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff)
|
|||
void
|
||||
DefineInitialRootWindow(register WindowPtr win)
|
||||
{
|
||||
register ScreenPtr pScreen = win->drawable.pScreen;
|
||||
SpritePtr pSprite;
|
||||
DeviceIntPtr pDev = inputInfo.devices;
|
||||
|
||||
#ifdef XEVIE
|
||||
xeviewin = win;
|
||||
#endif
|
||||
ROOT = win;
|
||||
|
||||
while (pDev)
|
||||
{
|
||||
if (DevHasCursor(pDev))
|
||||
{
|
||||
pSprite = pDev->pSprite;
|
||||
|
||||
pSprite->hotPhys.pScreen = pScreen;
|
||||
pSprite->hotPhys.x = pScreen->width / 2;
|
||||
pSprite->hotPhys.y = pScreen->height / 2;
|
||||
pSprite->hot = pSprite->hotPhys;
|
||||
pSprite->hotLimits.x2 = pScreen->width;
|
||||
pSprite->hotLimits.y2 = pScreen->height;
|
||||
#ifdef XEVIE
|
||||
xeviewin =
|
||||
#endif
|
||||
pSprite->win = win;
|
||||
pSprite->current = wCursor (win);
|
||||
pSprite->current->refcnt++;
|
||||
spriteTraceGood = 1;
|
||||
ROOT = win;
|
||||
(*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current,
|
||||
&pSprite->hotLimits, &pSprite->physLimits);
|
||||
pSprite->confined = FALSE;
|
||||
|
||||
(*pScreen->ConstrainCursor) (pDev, pScreen,
|
||||
&pSprite->physLimits);
|
||||
(*pScreen->SetCursorPosition) (pDev, pScreen, pSprite->hot.x,
|
||||
pSprite->hot.y,
|
||||
FALSE);
|
||||
(*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current);
|
||||
|
||||
#ifdef PANORAMIX
|
||||
if(!noPanoramiXExtension) {
|
||||
pSprite->hotLimits.x1 = -panoramiXdataPtr[0].x;
|
||||
pSprite->hotLimits.y1 = -panoramiXdataPtr[0].y;
|
||||
pSprite->hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x;
|
||||
pSprite->hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y;
|
||||
pSprite->physLimits = pSprite->hotLimits;
|
||||
pSprite->confineWin = NullWindow;
|
||||
#ifdef SHAPE
|
||||
pSprite->hotShape = NullRegion;
|
||||
#endif
|
||||
pSprite->screen = pScreen;
|
||||
/* gotta UNINIT these someplace */
|
||||
REGION_NULL(pScreen, &pSprite->Reg1);
|
||||
REGION_NULL(pScreen, &pSprite->Reg2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
InitializeSprite(pDev, win);
|
||||
pDev = pDev->next;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
|
||||
{
|
||||
SpritePtr pSprite;
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
|
||||
pSprite = pDev->pSprite;
|
||||
pSprite->hotPhys.pScreen = pScreen;
|
||||
pSprite->hotPhys.x = pScreen->width / 2;
|
||||
pSprite->hotPhys.y = pScreen->height / 2;
|
||||
pSprite->hot = pSprite->hotPhys;
|
||||
pSprite->hotLimits.x2 = pScreen->width;
|
||||
pSprite->hotLimits.y2 = pScreen->height;
|
||||
pSprite->win = pWin;
|
||||
pSprite->current = wCursor (pWin);
|
||||
pSprite->current->refcnt++;
|
||||
|
||||
(*pScreen->CursorLimits) ( pDev, pScreen, pSprite->current,
|
||||
&pSprite->hotLimits, &pSprite->physLimits);
|
||||
pSprite->confined = FALSE;
|
||||
|
||||
(*pScreen->ConstrainCursor) (pDev, pScreen,
|
||||
&pSprite->physLimits);
|
||||
(*pScreen->SetCursorPosition) (pDev, pScreen, pSprite->hot.x,
|
||||
pSprite->hot.y,
|
||||
FALSE);
|
||||
(*pScreen->DisplayCursor) (pDev, pScreen, pSprite->current);
|
||||
#ifdef PANORAMIX
|
||||
if(!noPanoramiXExtension) {
|
||||
pSprite->hotLimits.x1 = -panoramiXdataPtr[0].x;
|
||||
pSprite->hotLimits.y1 = -panoramiXdataPtr[0].y;
|
||||
pSprite->hotLimits.x2 = PanoramiXPixWidth - panoramiXdataPtr[0].x;
|
||||
pSprite->hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y;
|
||||
pSprite->physLimits = pSprite->hotLimits;
|
||||
pSprite->confineWin = NullWindow;
|
||||
#ifdef SHAPE
|
||||
pSprite->hotShape = NullRegion;
|
||||
#endif
|
||||
pSprite->screen = pScreen;
|
||||
/* gotta UNINIT these someplace */
|
||||
REGION_NULL(pScreen, &pSprite->Reg1);
|
||||
REGION_NULL(pScreen, &pSprite->Reg2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* This does not take any shortcuts, and even ignores its argument, since
|
||||
* it does not happen very often, and one has to walk up the tree since
|
||||
|
|
|
@ -129,7 +129,6 @@ xf86ProcessCommonOptions(LocalDevicePtr local,
|
|||
xf86SetBoolOption(list, "CorePointer", 0) ||
|
||||
xf86SetBoolOption(list, "CoreKeyboard", 0)) {
|
||||
local->flags |= XI86_ALWAYS_CORE;
|
||||
local->flags |= XI86_SHARED_POINTER;
|
||||
xf86Msg(X_CONFIG, "%s: always reports core events\n", local->name);
|
||||
}
|
||||
|
||||
|
@ -378,6 +377,16 @@ NewInputDeviceRequest (InputOption *options)
|
|||
}
|
||||
}
|
||||
|
||||
if (!drv) {
|
||||
xf86Msg(X_ERROR, "No input driver specified (ignoring)\n");
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
if (!idev->identifier) {
|
||||
xf86Msg(X_ERROR, "No device identifier specified (ignoring)\n");
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
if (!drv->PreInit) {
|
||||
xf86Msg(X_ERROR,
|
||||
"Input driver `%s' has no PreInit function (ignoring)\n",
|
||||
|
@ -407,10 +416,14 @@ NewInputDeviceRequest (InputOption *options)
|
|||
xf86ActivateDevice(pInfo);
|
||||
|
||||
dev = pInfo->dev;
|
||||
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
|
||||
ActivateDevice(dev);
|
||||
if (dev->inited && dev->startup)
|
||||
EnableDevice(dev);
|
||||
|
||||
/* send enter/leave event, update sprite window */
|
||||
InitializeSprite(dev, GetCurrentRootWindow());
|
||||
CheckMotion(NULL, dev);
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
|
|
@ -494,6 +494,10 @@ extern int DeliverDeviceEvents(
|
|||
extern void DefineInitialRootWindow(
|
||||
WindowPtr /* win */);
|
||||
|
||||
extern void InitializeSprite(
|
||||
DeviceIntPtr /* pDev */,
|
||||
WindowPtr /* pWin */);
|
||||
|
||||
extern void WindowHasNewCursor(
|
||||
WindowPtr /* pWin */);
|
||||
|
||||
|
@ -578,6 +582,10 @@ extern int DeliverEvents(
|
|||
int /*count*/,
|
||||
WindowPtr /*otherParent*/);
|
||||
|
||||
extern Bool
|
||||
CheckMotion(
|
||||
xEvent* /* xE */,
|
||||
DeviceIntPtr /* pDev */);
|
||||
|
||||
extern void WriteEventsToClient(
|
||||
ClientPtr /*pClient*/,
|
||||
|
|
Loading…
Reference in New Issue