Merge commit 'origin/server-1.6-branch' into xorg-server-1.6-apple

This commit is contained in:
Jeremy Huddleston 2009-01-30 17:53:05 -08:00
commit d4414649f2
20 changed files with 148 additions and 84 deletions

View file

@ -396,7 +396,7 @@ ProcXTestFakeInput(client)
OsBlockSignals();
for (i = 0; i < nevents; i++)
mieqEnqueue(dev, events->event);
mieqEnqueue(dev, (events+i)->event);
OsReleaseSignals();
return client->noClientException;

View file

@ -895,10 +895,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
*kptr |= bit;
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
b->buttonsDown++;
b->motionMask = DeviceButtonMotionMask;
if (!b->map[key])
return DONT_PROCESS;
b->buttonsDown++;
b->motionMask = DeviceButtonMotionMask;
if (b->map[key] <= 5)
b->state |= (Button1Mask >> 1) << b->map[key];
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
@ -927,10 +927,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
*kptr &= ~bit;
if (device->valuator)
device->valuator->motionHintWindow = NullWindow;
if (b->buttonsDown >= 1 && !--b->buttonsDown)
b->motionMask = 0;
if (!b->map[key])
return DONT_PROCESS;
if (b->buttonsDown >= 1 && !--b->buttonsDown)
b->motionMask = 0;
if (b->map[key] <= 5)
b->state &= ~((Button1Mask >> 1) << b->map[key]);
SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
@ -1069,7 +1069,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
xE->u.u.detail = key;
return;
}
if (!b->state && device->deviceGrab.fromPassiveGrab)
if (!b->buttonsDown && device->deviceGrab.fromPassiveGrab)
deactivateDeviceGrab = TRUE;
}
@ -1138,11 +1138,9 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
ev->num_valuators = 0;
if (b) {
int i;
ev->classes_reported |= (1 << ButtonClass);
ev->num_buttons = b->numButtons;
for (i = 0; i < 32; i++)
SetBitIf(ev->buttons, b->down, i);
memcpy((char*)ev->buttons, (char*)b->down, 4);
} else if (k) {
ev->classes_reported |= (1 << KeyClass);
ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
@ -1257,13 +1255,11 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
first += 3;
nval -= 3;
if (nbuttons > 32) {
int i;
(ev - 1)->deviceid |= MORE_EVENTS;
bev = (deviceButtonStateNotify *) ev++;
bev->type = DeviceButtonStateNotify;
bev->deviceid = dev->id;
for (i = 32; i < MAP_LENGTH; i++)
SetBitIf(bev->buttons, b->down, i);
memcpy((char*)&bev->buttons[4], (char*)&b->down[4], DOWN_LENGTH - 4);
}
if (nval > 0) {
(ev - 1)->deviceid |= MORE_EVENTS;
@ -1678,7 +1674,7 @@ SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map)
if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
return BadValue;
for (i = 0; i < nElts; i++)
if ((b->map[i + 1] != map[i]) && (b->down[i + 1]))
if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1))
return MappingBusy;
for (i = 0; i < nElts; i++)
b->map[i + 1] = map[i];

View file

@ -139,8 +139,7 @@ ProcXQueryDeviceState(ClientPtr client)
tb->class = ButtonClass;
tb->length = sizeof(xButtonState);
tb->num_buttons = b->numButtons;
for (i = 0; i < MAP_LENGTH; i++)
SetBitIf(tb->buttons, b->down, i);
memcpy(tb->buttons, b->down, sizeof(b->down));
buf += sizeof(xButtonState);
}

View file

@ -1831,36 +1831,23 @@ static int
DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n)
{
int rc, i = 0;
DeviceIntPtr dev = NULL;
if (!device || !device->button)
return BadDevice;
for (dev = inputInfo.devices; dev; dev = dev->next) {
if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
if (rc != Success)
return rc;
}
}
rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixManageAccess);
if (rc != Success)
return rc;
for (dev = inputInfo.devices; dev; dev = dev->next) {
if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
for (i = 0; i < n; i++) {
if ((device->button->map[i + 1] != map[i]) &&
device->button->down[i + 1]) {
return MappingBusy;
}
}
for (i = 0; i < n; i++) {
if ((device->button->map[i + 1] != map[i]) &&
BitIsOn(device->button->down, i + 1)) {
return MappingBusy;
}
}
for (dev = inputInfo.devices; dev; dev = dev->next) {
if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
for (i = 0; i < n; i++)
dev->button->map[i + 1] = map[i];
}
}
for (i = 0; i < n; i++)
device->button->map[i + 1] = map[i];
return Success;
}
@ -1917,7 +1904,6 @@ ProcSetPointerMapping(ClientPtr client)
return Success;
}
/* FIXME: Send mapping notifies for all the extended devices as well. */
SendMappingNotify(ptr, MappingPointer, 0, 0, client);
WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
return Success;

View file

@ -1160,14 +1160,14 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
* the data that GetCurrentRootWindow relies on hasn't been
* updated yet.
*/
if (xE->u.u.type == MotionNotify)
if (xE->u.u.type == DeviceMotionNotify)
XE_KBPTR.root =
WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id;
eventinfo.events = xE;
eventinfo.count = count;
CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
}
if (xE->u.u.type == MotionNotify)
if (xE->u.u.type == DeviceMotionNotify)
{
#ifdef PANORAMIX
if(!noPanoramiXExtension) {
@ -1181,7 +1181,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
pSprite->hotPhys.y = XE_KBPTR.rootY;
/* do motion compression, but not if from different devices */
if (tail &&
(tail->event->u.u.type == MotionNotify) &&
(tail->event->u.u.type == DeviceMotionNotify) &&
(tail->device == device) &&
(tail->pScreen == pSprite->hotPhys.pScreen))
{
@ -1248,7 +1248,7 @@ PlayReleasedEvents(void)
pDev = qe->device;
if (*syncEvents.pendtail == *prev)
syncEvents.pendtail = prev;
if (qe->event->u.u.type == MotionNotify)
if (qe->event->u.u.type == DeviceMotionNotify)
CheckVirtualMotion(pDev, qe, NullWindow);
syncEvents.time.months = qe->months;
/* XXX: Hack! We can't reliably get the time from GenericEvents,
@ -3073,8 +3073,8 @@ ProcWarpPointer(ClientPtr client)
WindowPtr dest = NULL;
int x, y, rc;
ScreenPtr newScreen;
DeviceIntPtr dev = PickPointer(client);
SpritePtr pSprite = dev->spriteInfo->sprite;
DeviceIntPtr dev;
SpritePtr pSprite;
REQUEST(xWarpPointerReq);
REQUEST_SIZE_MATCH(xWarpPointerReq);
@ -3087,6 +3087,12 @@ ProcWarpPointer(ClientPtr client)
return rc;
}
}
dev = PickPointer(client);
if (dev->u.lastSlave)
dev = dev->u.lastSlave;
pSprite = dev->spriteInfo->sprite;
#ifdef PANORAMIX
if(!noPanoramiXExtension)
return XineramaWarpPointer(client);
@ -3153,13 +3159,12 @@ ProcWarpPointer(ClientPtr client)
else if (y >= pSprite->physLimits.y2)
y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
(*newScreen->SetCursorPosition)(PickPointer(client), newScreen, x, y,
TRUE);
ConfineToShape(dev, pSprite->hotShape, &x, &y);
(*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE);
}
else if (!PointerConfinedToScreen(PickPointer(client)))
else if (!PointerConfinedToScreen(dev))
{
NewCurrentScreen(PickPointer(client), newScreen, x, y);
NewCurrentScreen(dev, newScreen, x, y);
}
return Success;
}
@ -3843,7 +3848,7 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
if (xE->u.u.detail == 0)
return;
filters[mouse->id][Motion_Filter(butc)] = MotionNotify;
if (!butc->state && mouse->deviceGrab.fromPassiveGrab)
if (!butc->buttonsDown && mouse->deviceGrab.fromPassiveGrab)
deactivateGrab = TRUE;
break;
default:

View file

@ -973,8 +973,20 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
events = updateFromMaster(events, pDev, &num_events);
if (flags & POINTER_ABSOLUTE)
{
if (flags & POINTER_SCREEN) /* valuators are in screen coords */
{
valuators[0] = rescaleValuatorAxis(valuators[0], NULL,
pDev->valuator->axes + 0,
scr->width);
valuators[1] = rescaleValuatorAxis(valuators[1], NULL,
pDev->valuator->axes + 1,
scr->height);
}
moveAbsolute(pDev, &x, &y, first_valuator, num_valuators, valuators);
else {
} else {
if (flags & POINTER_ACCELERATE)
accelPointer(pDev, first_valuator, num_valuators, valuators, ms);
moveRelative(pDev, &x, &y, first_valuator, num_valuators, valuators);

View file

@ -140,6 +140,8 @@ exaUnrealizeGlyphCaches(ScreenPtr pScreen,
}
}
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
/* All caches for a single format share a single pixmap for glyph storage,
* allowing mixing glyphs of different sizes without paying a penalty
* for switching between source pixmaps. (Note that for a size of font
@ -159,6 +161,7 @@ exaRealizeGlyphCaches(ScreenPtr pScreen,
PictFormatPtr pPictFormat;
PixmapPtr pPixmap;
PicturePtr pPicture;
CARD32 component_alpha;
int height;
int i;
int error;
@ -191,8 +194,10 @@ exaRealizeGlyphCaches(ScreenPtr pScreen,
if (!pPixmap)
return FALSE;
component_alpha = NeedsComponent(pPictFormat->format);
pPicture = CreatePicture(0, &pPixmap->drawable, pPictFormat,
0, 0, serverClient, &error);
CPComponentAlpha, &component_alpha, serverClient,
&error);
(*pScreen->DestroyPixmap) (pPixmap); /* picture holds a refcount */
@ -741,8 +746,6 @@ exaGlyphsIntersect(int nlist, GlyphListPtr list, GlyphPtr *glyphs)
return FALSE;
}
#define NeedsComponent(f) (PICT_FORMAT_A(f) != 0 && PICT_FORMAT_RGB(f) != 0)
void
exaGlyphs (CARD8 op,
PicturePtr pSrc,

View file

@ -291,6 +291,8 @@ xf86RotateBlockHandler(int screenNum, pointer blockData,
/* Re-wrap if rotation is still happening */
xf86_config->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = xf86RotateBlockHandler;
} else {
xf86_config->BlockHandler = NULL;
}
}
@ -477,8 +479,10 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
goto bail2;
/* Wrap block handler */
xf86_config->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = xf86RotateBlockHandler;
if (!xf86_config->BlockHandler) {
xf86_config->BlockHandler = pScreen->BlockHandler;
pScreen->BlockHandler = xf86RotateBlockHandler;
}
}
#ifdef RANDR_12_INTERFACE
if (transform)

View file

@ -62,3 +62,5 @@ endif
AM_CFLAGS = $(DIX_CFLAGS)
EXTRA_DIST = \
dix-config-apple-verbatim.h

View file

@ -0,0 +1,8 @@
/* Do not include this file directly. It is included at the end of <dix-config.h> */
/* Correctly set _XSERVER64 for OSX fat binaries */
#if defined(__LP64__) && !defined(_XSERVER64)
#define _XSERVER64 1
#elif !defined(__LP64__) && defined(_XSERVER64)
#undef _XSERVER64
#endif

View file

@ -431,12 +431,7 @@
/* Correctly set _XSERVER64 for OSX fat binaries */
#ifdef __APPLE__
#if defined(__LP64__) && !defined(_XSERVER64)
#define _XSERVER64 1
#elif !defined(__LP64__) && defined(_XSERVER64)
/* configure mangles #undef, so we fix this in AC_CONFIG_HEADERS post process */
/undef _XSERVER64
#endif
#include "dix-config-apple-verbatim.h"
#endif
#endif /* _DIX_CONFIG_H_ */

View file

@ -62,6 +62,7 @@ SOFTWARE.
#define POINTER_RELATIVE (1 << 1)
#define POINTER_ABSOLUTE (1 << 2)
#define POINTER_ACCELERATE (1 << 3)
#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
/*int constants for pointer acceleration schemes*/
#define PtrAccelNoOp 0

View file

@ -57,9 +57,6 @@ SOFTWARE.
#include "privates.h"
#define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
/* If byte[i] in src is non-zero, set bit i in dst, otherwise set bit to 0 */
#define SetBitIf(dst, src, i) \
(src[i]) ? (dst[i/8] |= (1 << (i % 8))) : (dst[i/8] &= ~(1 << (i % 8)));
#define SameClient(obj,client) \
(CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
@ -188,7 +185,11 @@ typedef struct _ValuatorClassRec {
typedef struct _ButtonClassRec {
CARD8 numButtons;
CARD8 buttonsDown; /* number of buttons currently down */
CARD8 buttonsDown; /* number of buttons currently down
This counts logical buttons, not
physical ones, i.e if some buttons
are mapped to 0, they're not counted
here */
unsigned short state;
Mask motionMask;
CARD8 down[DOWN_LENGTH];

View file

@ -175,6 +175,10 @@ extern void mieqProcessInputEvents(
typedef void (*mieqHandler)(int, xEventPtr, DeviceIntPtr, int);
void mieqSetHandler(int event, mieqHandler handler);
void
CopyGetMasterEvent(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
EventListPtr master, int count);
/* miexpose.c */
extern RegionPtr miHandleExposures(

View file

@ -327,15 +327,32 @@ ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
DebugF("[mi] Unknown event type (%d), cannot change id.\n", type);
}
static void
FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
EventListPtr master, int count)
{
/* Ensure chained button mappings, i.e. that the detail field is the
* value of the mapped button on the SD, not the physical button */
if (original->u.u.type == DeviceButtonPress || original->u.u.type == DeviceButtonRelease)
{
int btn = original->u.u.detail;
if (!sdev->button)
return; /* Should never happen */
master->event->u.u.detail = sdev->button->map[btn];
}
}
/**
* Copy the given event into master.
* @param mdev The master device
* @param sdev The slave device the original event comes from
* @param original The event as it came from the EQ
* @param master The event after being copied
* @param count Number of events in original.
*/
void
CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original,
CopyGetMasterEvent(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
EventListPtr master, int count)
{
int len = count * sizeof(xEvent);
@ -350,11 +367,16 @@ CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original,
memcpy(master->event, original, len);
while (count--)
{
ChangeDeviceID(mdev, &master->event[count]);
FixUpEventForMaster(mdev, sdev, original, master, count);
}
}
extern void
CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
/* Call this from ProcessInputEvents(). */
void
mieqProcessInputEvents(void)
@ -431,7 +453,7 @@ mieqProcessInputEvents(void)
event->u.u.type == DeviceKeyRelease)
CopyKeyClass(dev, master);
CopyGetMasterEvent(master, event, masterEvents, nevents);
CopyGetMasterEvent(master, dev, event, masterEvents, nevents);
}
/* If someone's registered a custom event handler, let them

View file

@ -576,7 +576,7 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
}
}
nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_ABSOLUTE, 0, 2, valuators);
nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_SCREEN | POINTER_ABSOLUTE, 0, 2, valuators);
OsBlockSignals();
#ifdef XQUARTZ

View file

@ -632,6 +632,7 @@ ProcRRGetCrtcInfo (ClientPtr client)
RROutput *possible;
int i, j, k, n;
int width, height;
BoxRec panned_area;
REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
crtc = LookupCrtc(client, stuff->crtc, DixReadAccess);
@ -652,11 +653,23 @@ ProcRRGetCrtcInfo (ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.timestamp = pScrPriv->lastSetTime.milliseconds;
rep.x = crtc->x;
rep.y = crtc->y;
RRCrtcGetScanoutSize (crtc, &width, &height);
rep.width = width;
rep.height = height;
if (pScrPriv->rrGetPanning &&
pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&
(panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
{
rep.x = panned_area.x1;
rep.y = panned_area.y1;
rep.width = panned_area.x2 - panned_area.x1;
rep.height = panned_area.y2 - panned_area.y1;
}
else
{
RRCrtcGetScanoutSize (crtc, &width, &height);
rep.x = crtc->x;
rep.y = crtc->y;
rep.width = width;
rep.height = height;
}
rep.mode = mode ? mode->mode.id : 0;
rep.rotation = crtc->rotation;
rep.rotations = crtc->rotations;

View file

@ -267,12 +267,26 @@ RRXineramaWriteCrtc(ClientPtr client, RRCrtcPtr crtc)
if (RRXineramaCrtcActive (crtc))
{
int width, height;
RRCrtcGetScanoutSize (crtc, &width, &height);
scratch.x_org = crtc->x;
scratch.y_org = crtc->y;
scratch.width = width;
scratch.height = height;
ScreenPtr pScreen = crtc->pScreen;
rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
BoxRec panned_area;
/* Check to see if crtc is panned and return the full area when applicable. */
if (pScrPriv && pScrPriv->rrGetPanning &&
pScrPriv->rrGetPanning (pScreen, crtc, &panned_area, NULL, NULL) &&
(panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1)) {
scratch.x_org = panned_area.x1;
scratch.y_org = panned_area.y1;
scratch.width = panned_area.x2 - panned_area.x1;
scratch.height = panned_area.y2 - panned_area.y1;
} else {
int width, height;
RRCrtcGetScanoutSize (crtc, &width, &height);
scratch.x_org = crtc->x;
scratch.y_org = crtc->y;
scratch.width = width;
scratch.height = height;
}
if(client->swapped) {
register int n;
swaps(&scratch.x_org, n);
@ -313,7 +327,6 @@ ProcRRXineramaQueryScreens(ClientPtr client)
if(rep.number) {
rrScrPriv(pScreen);
xXineramaScreenInfo scratch;
int i;
int has_primary = (pScrPriv->primaryOutput != NULL);

View file

@ -117,7 +117,7 @@ DeviceIntPtr master = NULL;
if (!IsPointerDevice(master))
master = GetPairedDevice(dev->u.master);
CopyGetMasterEvent(master, &events, masterEvents, count);
CopyGetMasterEvent(master, dev, &events, masterEvents, count);
}
(*dev->public.processInputProc)((xEventPtr)btn, dev, count);

View file

@ -1043,7 +1043,7 @@ int button;
switch (pAction->type) {
case XkbSA_LockDeviceBtn:
if ((pAction->devbtn.flags&XkbSA_LockNoLock)||
(dev->button->down[button]))
BitIsOn(dev->button->down, button))
return 0;
XkbDDXFakeDeviceButton(dev,True,button);
filter->upAction.type= XkbSA_NoAction;
@ -1075,7 +1075,7 @@ int button;
switch (filter->upAction.type) {
case XkbSA_LockDeviceBtn:
if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)||
((dev->button->down[button])==0))
!BitIsOn(dev->button->down, button))
return 0;
XkbDDXFakeDeviceButton(dev,False,button);
break;