Merge branch 'mi-cleanup' into next

This commit is contained in:
Peter Hutterer 2011-02-23 08:44:42 +10:00
commit 579ee8f5d8
57 changed files with 791 additions and 428 deletions

View File

@ -710,10 +710,13 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
if (rc != Success) if (rc != Success)
return; /* Device has disappeared */ return; /* Device has disappeared */
if (!slave->u.master) if (IsMaster(slave))
return;
if (IsFloating(slave))
return; /* set floating since the event */ return; /* set floating since the event */
if (slave->u.master->id != dce->masterid) if (GetMaster(slave, MASTER_ATTACHED)->id != dce->masterid)
return; /* not our slave anymore, don't care */ return; /* not our slave anymore, don't care */
/* FIXME: we probably need to send a DCE for the new slave now */ /* FIXME: we probably need to send a DCE for the new slave now */
@ -866,7 +869,7 @@ UpdateDeviceState(DeviceIntPtr device, DeviceEvent* event)
* event being delivered through the slave first * event being delivered through the slave first
*/ */
for (sd = inputInfo.devices; sd; sd = sd->next) { for (sd = inputInfo.devices; sd; sd = sd->next) {
if (IsMaster(sd) || sd->u.master != device) if (IsMaster(sd) || GetMaster(sd, MASTER_POINTER) != device)
continue; continue;
if (!sd->button) if (!sd->button)
continue; continue;
@ -1006,7 +1009,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
b = device->button; b = device->button;
k = device->key; k = device->key;
if (IsMaster(device) || !device->u.master) if (IsMaster(device) || IsFloating(device))
CheckMotion(event, device); CheckMotion(event, device);
switch (event->type) switch (event->type)
@ -1221,7 +1224,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
DeviceIntPtr mouse; DeviceIntPtr mouse;
int btlen, len, i; int btlen, len, i;
mouse = (IsMaster(dev) || dev->u.master) ? GetMaster(dev, MASTER_POINTER) : dev; mouse = IsFloating(dev) ? dev : GetMaster(dev, MASTER_POINTER);
/* XI 2 event */ /* XI 2 event */
btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0; btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0;

View File

@ -284,12 +284,12 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
for (attached = inputInfo.devices; attached; attached = attached->next) for (attached = inputInfo.devices; attached; attached = attached->next)
{ {
if (!IsMaster(attached)) { if (!IsMaster(attached)) {
if (attached->u.master == ptr) if (GetMaster(attached, MASTER_ATTACHED) == ptr)
{ {
AttachDevice(client, attached, newptr); AttachDevice(client, attached, newptr);
flags[attached->id] |= XISlaveAttached; flags[attached->id] |= XISlaveAttached;
} }
if (attached->u.master == keybd) if (GetMaster(attached, MASTER_ATTACHED) == keybd)
{ {
AttachDevice(client, attached, newkeybd); AttachDevice(client, attached, newkeybd);
flags[attached->id] |= XISlaveAttached; flags[attached->id] |= XISlaveAttached;

View File

@ -162,10 +162,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
if (!modifiers_failed) if (!modifiers_failed)
return BadAlloc; return BadAlloc;
if (!IsMaster(dev) && dev->u.master) mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
mod_dev = GetMaster(dev, MASTER_KEYBOARD);
else
mod_dev = dev;
for (i = 0; i < stuff->num_modifiers; i++, modifiers++) for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
{ {
@ -280,10 +277,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
if (rc != Success) if (rc != Success)
return rc; return rc;
if (!IsMaster(dev) && dev->u.master) mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
mod_dev = GetMaster(dev, MASTER_KEYBOARD);
else
mod_dev = dev;
tempGrab.resource = client->clientAsMask; tempGrab.resource = client->clientAsMask;
tempGrab.device = dev; tempGrab.device = dev;

View File

@ -701,7 +701,7 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
int int
XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type, XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
int format, int mode, unsigned long len, int format, int mode, unsigned long len,
pointer value, Bool sendevent) const pointer value, Bool sendevent)
{ {
XIPropertyPtr prop; XIPropertyPtr prop;
int size_in_bytes; int size_in_bytes;

View File

@ -375,7 +375,7 @@ SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment) int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
{ {
DeviceIntPtr master = dev->u.master; DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
int use; int use;
if (IsMaster(dev)) if (IsMaster(dev))
@ -383,7 +383,7 @@ int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
DeviceIntPtr paired = GetPairedDevice(dev); DeviceIntPtr paired = GetPairedDevice(dev);
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard; use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
*attachment = (paired ? paired->id : 0); *attachment = (paired ? paired->id : 0);
} else if (master) } else if (!IsFloating(dev))
{ {
use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard; use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard;
*attachment = master->id; *attachment = master->id;

View File

@ -93,7 +93,7 @@ ProcXIQueryPointer(ClientPtr client)
} }
if (pDev->valuator == NULL || IsKeyboardDevice(pDev) || if (pDev->valuator == NULL || IsKeyboardDevice(pDev) ||
(!IsMaster(pDev) && pDev->u.master)) /* no attached devices */ (!IsMaster(pDev) && !IsFloating(pDev))) /* no attached devices */
{ {
client->errorValue = stuff->deviceid; client->errorValue = stuff->deviceid;
return BadDevice; return BadDevice;
@ -129,7 +129,7 @@ ProcXIQueryPointer(ClientPtr client)
if (kbd) if (kbd)
{ {
state = &kbd->key->xkbInfo->prev_state; state = &kbd->key->xkbInfo->state;
rep.mods.base_mods = state->base_mods; rep.mods.base_mods = state->base_mods;
rep.mods.latched_mods = state->latched_mods; rep.mods.latched_mods = state->latched_mods;
rep.mods.locked_mods = state->locked_mods; rep.mods.locked_mods = state->locked_mods;

View File

@ -97,7 +97,7 @@ ProcXIWarpPointer(ClientPtr client)
return rc; return rc;
} }
if ((!IsMaster(pDev) && pDev->u.master) || if ((!IsMaster(pDev) && !IsFloating(pDev)) ||
(IsMaster(pDev) && !IsPointerDevice(pDev))) (IsMaster(pDev) && !IsPointerDevice(pDev)))
{ {
client->errorValue = stuff->deviceid; client->errorValue = stuff->deviceid;

View File

@ -26,8 +26,8 @@ dnl
dnl Process this file with autoconf to create configure. dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57) AC_PREREQ(2.57)
AC_INIT([xorg-server], 1.9.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) AC_INIT([xorg-server], 1.9.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
RELEASE_DATE="2010-12-06" RELEASE_DATE="2011-2-18"
AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE AM_MAINTAINER_MODE

View File

@ -446,7 +446,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
{ {
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if (other->u.master == dev) if (!IsMaster(other) && GetMaster(other, MASTER_ATTACHED) == dev)
{ {
AttachDevice(NULL, other, NULL); AttachDevice(NULL, other, NULL);
flags[other->id] |= XISlaveDetached; flags[other->id] |= XISlaveDetached;
@ -457,8 +457,8 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
{ {
for (other = inputInfo.devices; other; other = other->next) for (other = inputInfo.devices; other; other = other->next)
{ {
if (IsMaster(other) && other->u.lastSlave == dev) if (IsMaster(other) && other->lastSlave == dev)
other->u.lastSlave = NULL; other->lastSlave = NULL;
} }
} }
@ -987,8 +987,8 @@ CloseDownDevices(void)
*/ */
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
if (!IsMaster(dev) && dev->u.master) if (!IsMaster(dev) && !IsFloating(dev))
dev->u.master = NULL; dev->master = NULL;
} }
CloseDeviceList(&inputInfo.devices); CloseDeviceList(&inputInfo.devices);
@ -1643,7 +1643,7 @@ ProcChangeKeyboardMapping(ClientPtr client)
stuff->keyCodes, NULL, client); stuff->keyCodes, NULL, client);
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
if (IsMaster(tmp) || tmp->u.master != pDev) if (IsMaster(tmp) || GetMaster(tmp, MASTER_KEYBOARD) != pDev)
continue; continue;
if (!tmp->key) if (!tmp->key)
continue; continue;
@ -2306,7 +2306,7 @@ RecalculateMasterButtons(DeviceIntPtr slave)
for (dev = inputInfo.devices; dev; dev = dev->next) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
if (IsMaster(dev) || if (IsMaster(dev) ||
dev->u.master != master || GetMaster(dev, MASTER_ATTACHED) != master ||
!dev->button) !dev->button)
continue; continue;
@ -2376,19 +2376,19 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
return BadDevice; return BadDevice;
/* set from floating to floating? */ /* set from floating to floating? */
if (!dev->u.master && !master && dev->enabled) if (IsFloating(dev) && !master && dev->enabled)
return Success; return Success;
/* free the existing sprite. */ /* free the existing sprite. */
if (!dev->u.master && dev->spriteInfo->paired == dev) if (IsFloating(dev) && dev->spriteInfo->paired == dev)
{ {
screen = miPointerGetScreen(dev); screen = miPointerGetScreen(dev);
screen->DeviceCursorCleanup(dev, screen); screen->DeviceCursorCleanup(dev, screen);
free(dev->spriteInfo->sprite); free(dev->spriteInfo->sprite);
} }
oldmaster = dev->u.master; oldmaster = GetMaster(dev, MASTER_ATTACHED);
dev->u.master = master; dev->master = master;
/* If device is set to floating, we need to create a sprite for it, /* If device is set to floating, we need to create a sprite for it,
* otherwise things go bad. However, we don't want to render the cursor, * otherwise things go bad. However, we don't want to render the cursor,
@ -2438,8 +2438,8 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
DeviceIntPtr DeviceIntPtr
GetPairedDevice(DeviceIntPtr dev) GetPairedDevice(DeviceIntPtr dev)
{ {
if (!IsMaster(dev) && dev->u.master) if (!IsMaster(dev) && !IsFloating(dev))
dev = dev->u.master; dev = GetMaster(dev, MASTER_ATTACHED);
return dev->spriteInfo->paired; return dev->spriteInfo->paired;
} }
@ -2452,7 +2452,10 @@ GetPairedDevice(DeviceIntPtr dev)
* returned master is either the device itself or the paired master device. * returned master is either the device itself or the paired master device.
* If dev is a floating slave device, NULL is returned. * If dev is a floating slave device, NULL is returned.
* *
* @type ::MASTER_KEYBOARD or ::MASTER_POINTER * @type ::MASTER_KEYBOARD or ::MASTER_POINTER or ::MASTER_ATTACHED
* @return The requested master device. In the case of MASTER_ATTACHED, this
* is the directly attached master to this device, regardless of the type.
* Otherwise, it is either the master keyboard or pointer for this device.
*/ */
DeviceIntPtr DeviceIntPtr
GetMaster(DeviceIntPtr dev, int which) GetMaster(DeviceIntPtr dev, int which)
@ -2462,9 +2465,9 @@ GetMaster(DeviceIntPtr dev, int which)
if (IsMaster(dev)) if (IsMaster(dev))
master = dev; master = dev;
else else
master = dev->u.master; master = dev->master;
if (master) if (master && which != MASTER_ATTACHED)
{ {
if (which == MASTER_KEYBOARD) if (which == MASTER_KEYBOARD)
{ {
@ -2517,7 +2520,7 @@ AllocDevicePair (ClientPtr client, char* name,
pointer->coreEvents = TRUE; pointer->coreEvents = TRUE;
pointer->spriteInfo->spriteOwner = TRUE; pointer->spriteInfo->spriteOwner = TRUE;
pointer->u.lastSlave = NULL; pointer->lastSlave = NULL;
pointer->last.slave = NULL; pointer->last.slave = NULL;
pointer->type = (master) ? MASTER_POINTER : SLAVE; pointer->type = (master) ? MASTER_POINTER : SLAVE;
@ -2543,7 +2546,7 @@ AllocDevicePair (ClientPtr client, char* name,
keyboard->coreEvents = TRUE; keyboard->coreEvents = TRUE;
keyboard->spriteInfo->spriteOwner = FALSE; keyboard->spriteInfo->spriteOwner = FALSE;
keyboard->u.lastSlave = NULL; keyboard->lastSlave = NULL;
keyboard->last.slave = NULL; keyboard->last.slave = NULL;
keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE; keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;

View File

@ -284,8 +284,20 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
num_events = (countValuators(ev, &first) + 5)/6; /* valuator ev */ num_events = (countValuators(ev, &first) + 5)/6; /* valuator ev */
if (num_events <= 0) if (num_events <= 0)
{ {
*count = 0; switch (ev->type)
return BadMatch; {
case ET_KeyPress:
case ET_KeyRelease:
case ET_ButtonPress:
case ET_ButtonRelease:
/* no axes is ok */
break;
case ET_Motion:
case ET_ProximityIn:
case ET_ProximityOut:
*count = 0;
return BadMatch;
}
} }
num_events++; /* the actual event event */ num_events++; /* the actual event event */

View File

@ -328,6 +328,13 @@ IsMaster(DeviceIntPtr dev)
return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD; return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD;
} }
Bool
IsFloating(DeviceIntPtr dev)
{
return GetMaster(dev, MASTER_KEYBOARD) == NULL;
}
/** /**
* Max event opcode. * Max event opcode.
*/ */
@ -1397,10 +1404,10 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
static void static void
DetachFromMaster(DeviceIntPtr dev) DetachFromMaster(DeviceIntPtr dev)
{ {
if (!dev->u.master) if (!IsFloating(dev))
return; return;
dev->saved_master_id = dev->u.master->id; dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id;
AttachDevice(NULL, dev, NULL); AttachDevice(NULL, dev, NULL);
} }
@ -2825,7 +2832,7 @@ WindowsRestructured(void)
DeviceIntPtr pDev = inputInfo.devices; DeviceIntPtr pDev = inputInfo.devices;
while(pDev) while(pDev)
{ {
if (IsMaster(pDev) || !pDev->u.master) if (IsMaster(pDev) || IsFloating(pDev))
CheckMotion(NULL, pDev); CheckMotion(NULL, pDev);
pDev = pDev->next; pDev = pDev->next;
} }
@ -3256,15 +3263,15 @@ ProcWarpPointer(ClientPtr client)
dev = PickPointer(client); dev = PickPointer(client);
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
if ((tmp == dev) || (!IsMaster(tmp) && tmp->u.master == dev)) { if (GetMaster(tmp, MASTER_ATTACHED) == dev) {
rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixWriteAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
} }
} }
if (dev->u.lastSlave) if (dev->lastSlave)
dev = dev->u.lastSlave; dev = dev->lastSlave;
pSprite = dev->spriteInfo->sprite; pSprite = dev->spriteInfo->sprite;
#ifdef PANORAMIX #ifdef PANORAMIX
@ -3420,7 +3427,7 @@ CheckPassiveGrabsOnWindow(
* attached master keyboard. Since the slave may have been * attached master keyboard. Since the slave may have been
* reattached after the grab, the modifier device may not be the * reattached after the grab, the modifier device may not be the
* same. */ * same. */
if (!IsMaster(grab->device) && device->u.master) if (!IsMaster(grab->device) && !IsFloating(device))
gdev = GetMaster(device, MASTER_KEYBOARD); gdev = GetMaster(device, MASTER_KEYBOARD);
} }
@ -4309,7 +4316,7 @@ DeviceEnterLeaveEvent(
if (BitIsOn(mouse->button->down, i)) if (BitIsOn(mouse->button->down, i))
SetBit(&event[1], i); SetBit(&event[1], i);
kbd = (IsMaster(mouse) || mouse->u.master) ? GetPairedDevice(mouse) : NULL; kbd = GetMaster(mouse, MASTER_KEYBOARD);
if (kbd && kbd->key) if (kbd && kbd->key)
{ {
event->mods.base_mods = kbd->key->xkbInfo->state.base_mods; event->mods.base_mods = kbd->key->xkbInfo->state.base_mods;

View File

@ -767,7 +767,7 @@ moveRelative(DeviceIntPtr dev, int *x, int *y, ValuatorMask *mask)
/* if attached, clip both x and y to the defined limits (usually /* if attached, clip both x and y to the defined limits (usually
* co-ord space limit). If it is attached, we need x/y to go over the * co-ord space limit). If it is attached, we need x/y to go over the
* limits to be able to change screens. */ * limits to be able to change screens. */
if(dev->u.master && dev->valuator) { if(dev->valuator && IsMaster(dev) || !IsFloating(dev)) {
if (valuator_get_mode(dev, 0) == Absolute) if (valuator_get_mode(dev, 0) == Absolute)
clipAxis(dev, 0, x); clipAxis(dev, 0, x);
if (valuator_get_mode(dev, 1) == Absolute) if (valuator_get_mode(dev, 1) == Absolute)
@ -865,11 +865,12 @@ positionSprite(DeviceIntPtr dev, int *x, int *y, float x_frac, float y_frac,
* to the current screen. */ * to the current screen. */
miPointerSetPosition(dev, screenx, screeny); miPointerSetPosition(dev, screenx, screeny);
if (dev->u.master) { if(!IsMaster(dev) || !IsFloating(dev)) {
dev->u.master->last.valuators[0] = *screenx; DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
dev->u.master->last.valuators[1] = *screeny; master->last.valuators[0] = *screenx;
dev->u.master->last.remainder[0] = *screenx_frac; master->last.valuators[1] = *screeny;
dev->u.master->last.remainder[1] = *screeny_frac; master->last.remainder[0] = *screenx_frac;
master->last.remainder[1] = *screeny_frac;
} }
if (dev->valuator) if (dev->valuator)
@ -911,7 +912,7 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
return; return;
updateMotionHistory(dev, ms, mask, dev->last.valuators); updateMotionHistory(dev, ms, mask, dev->last.valuators);
if (dev->u.master) if(!IsMaster(dev) || !IsFloating(dev))
{ {
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER); DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
updateMotionHistory(master, ms, mask, dev->last.valuators); updateMotionHistory(master, ms, mask, dev->last.valuators);

View File

@ -268,15 +268,15 @@ change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap,
/* Change any attached masters/slaves. */ /* Change any attached masters/slaves. */
if (IsMaster(dev)) { if (IsMaster(dev)) {
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) { for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
if (!IsMaster(tmp) && tmp->u.master == dev) if (!IsMaster(tmp) && GetMaster(tmp, MASTER_KEYBOARD) == dev)
if (check_modmap_change_slave(client, dev, tmp, modmap)) if (check_modmap_change_slave(client, dev, tmp, modmap))
do_modmap_change(client, tmp, modmap); do_modmap_change(client, tmp, modmap);
} }
} }
else if (dev->u.master && dev->u.master->u.lastSlave == dev) { else if (!IsFloating(dev) && GetMaster(dev, MASTER_KEYBOARD)->lastSlave == dev) {
/* If this fails, expect the results to be weird. */ /* If this fails, expect the results to be weird. */
if (check_modmap_change(client, dev->u.master, modmap)) if (check_modmap_change(client, dev->master, modmap))
do_modmap_change(client, dev->u.master, modmap); do_modmap_change(client, dev->master, modmap);
} }
return Success; return Success;

View File

@ -138,7 +138,6 @@ void
exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure) exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{ {
PixmapPtr pPixmap = closure; PixmapPtr pPixmap = closure;
ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaPixmapPriv(pPixmap); ExaPixmapPriv(pPixmap);
/* Move back results of software rendering on system memory copy of mixed driver /* Move back results of software rendering on system memory copy of mixed driver
@ -150,18 +149,10 @@ exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure)
if (!pExaPixmap->use_gpu_copy && exaPixmapHasGpuCopy(pPixmap)) { if (!pExaPixmap->use_gpu_copy && exaPixmapHasGpuCopy(pPixmap)) {
ExaScreenPriv(pPixmap->drawable.pScreen); ExaScreenPriv(pPixmap->drawable.pScreen);
/* Front buffer: Don't wait for the block handler to copy back the data. if (pExaScr->deferred_mixed_pixmap &&
* This avoids annoying latency if you encounter a lot of software rendering. pExaScr->deferred_mixed_pixmap != pPixmap)
*/ exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
if (pPixmap == pScreen->GetScreenPixmap(pScreen)) pExaScr->deferred_mixed_pixmap = pPixmap;
exaMoveInPixmap_mixed(pPixmap);
else {
if (pExaScr->deferred_mixed_pixmap &&
pExaScr->deferred_mixed_pixmap != pPixmap)
exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
pExaScr->deferred_mixed_pixmap = pPixmap;
}
} }
} }

View File

@ -1,9 +1,5 @@
noinst_LTLIBRARIES = libfb.la libwfb.la noinst_LTLIBRARIES = libfb.la libwfb.la
INCLUDES = \
-I$(top_srcdir)/hw/xfree86/os-support \
-I$(top_srcdir)/hw/xfree86/os-support/bus \
-I$(top_srcdir)/hw/xfree86/common
AM_CFLAGS = $(DIX_CFLAGS) AM_CFLAGS = $(DIX_CFLAGS)
if XORG if XORG

View File

@ -1132,7 +1132,8 @@ int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
{ {
ClientPtr client = cl->client; ClientPtr client = cl->client;
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
REQUEST_SIZE_MATCH(xGLXGetFBConfigsSGIXReq); /* work around mesa bug, don't use REQUEST_SIZE_MATCH */
REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
return DoGetFBConfigs(cl, req->screen); return DoGetFBConfigs(cl, req->screen);
} }
@ -1356,7 +1357,9 @@ int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client; ClientPtr client = cl->client;
xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc; xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc;
REQUEST_SIZE_MATCH(xGLXDestroyPixmapReq); /* should be REQUEST_SIZE_MATCH, but mesa's glXDestroyPixmap used to set
* length to 3 instead of 2 */
REQUEST_AT_LEAST_SIZE(xGLXDestroyPixmapReq);
return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP); return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP);
} }
@ -1436,7 +1439,7 @@ int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client; ClientPtr client = cl->client;
xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
REQUEST_SIZE_MATCH(xGLXCreateGLXPbufferSGIXReq); REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig, return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
req->width, req->height, req->pbuffer); req->width, req->height, req->pbuffer);
@ -1498,7 +1501,13 @@ int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
client->errorValue = req->numAttribs; client->errorValue = req->numAttribs;
return BadValue; return BadValue;
} }
#if 0
/* mesa sends an additional 8 bytes */
REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3); REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3);
#else
if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len)
return BadLength;
#endif
return DoChangeDrawableAttributes(cl->client, req->drawable, return DoChangeDrawableAttributes(cl->client, req->drawable,
req->numAttribs, (CARD32 *) (req + 1)); req->numAttribs, (CARD32 *) (req + 1));
@ -1563,7 +1572,8 @@ int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client; ClientPtr client = cl->client;
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
REQUEST_SIZE_MATCH(xGLXDestroyWindowReq); /* mesa's glXDestroyWindow used to set length to 3 instead of 2 */
REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq);
return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW); return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW);
} }
@ -1697,13 +1707,21 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
GLXDrawable drawId; GLXDrawable drawId;
int buffer; int buffer;
int error; int error;
CARD32 num_attribs;
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len)
return BadLength;
pc += __GLX_VENDPRIV_HDR_SIZE; pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = *((CARD32 *) (pc)); drawId = *((CARD32 *) (pc));
buffer = *((INT32 *) (pc + 4)); buffer = *((INT32 *) (pc + 4));
num_attribs = *((CARD32 *) (pc + 8));
if (num_attribs > (UINT32_MAX >> 3)) {
client->errorValue = num_attribs;
return BadValue;
}
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 12 + (num_attribs << 3));
if (buffer != GLX_FRONT_LEFT_EXT) if (buffer != GLX_FRONT_LEFT_EXT)
return __glXError(GLXBadPixmap); return __glXError(GLXBadPixmap);
@ -1864,7 +1882,8 @@ int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client; ClientPtr client = cl->client;
xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesReq); /* this should be REQUEST_SIZE_MATCH, but mesa sends an additional 4 bytes */
REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
return DoGetDrawableAttributes(cl, req->drawable); return DoGetDrawableAttributes(cl, req->drawable);
} }

View File

@ -279,7 +279,7 @@ int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_VARIABLES;
REQUEST_SIZE_MATCH(xGLXGetFBConfigsSGIXReq); REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
__GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->screen);
return __glXDisp_GetFBConfigsSGIX(cl, pc); return __glXDisp_GetFBConfigsSGIX(cl, pc);
@ -368,7 +368,7 @@ int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_VARIABLES;
REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq); REQUEST_AT_LEAST_SIZE(xGLXDestroyGLXPixmapReq);
__GLX_SWAP_SHORT(&req->length); __GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->glxpixmap); __GLX_SWAP_INT(&req->glxpixmap);
@ -421,7 +421,7 @@ int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_VARIABLES;
REQUEST_SIZE_MATCH(xGLXCreateGLXPbufferSGIXReq); REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
__GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->screen);
__GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->fbconfig);
@ -476,7 +476,9 @@ int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
client->errorValue = req->numAttribs; client->errorValue = req->numAttribs;
return BadValue; return BadValue;
} }
REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3); if (((sizeof(xGLXChangeDrawableAttributesReq) + (req->numAttribs << 3)) >> 2) < client->req_len)
return BadLength;
attribs = (CARD32*)(req + 1); attribs = (CARD32*)(req + 1);
__GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
@ -542,7 +544,7 @@ int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_VARIABLES;
REQUEST_SIZE_MATCH(xGLXDestroyWindowReq); REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq);
__GLX_SWAP_INT(&req->glxwindow); __GLX_SWAP_INT(&req->glxwindow);
@ -648,19 +650,23 @@ int __glXDispSwap_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
GLXDrawable *drawId; GLXDrawable *drawId;
int *buffer; int *buffer;
CARD32 *num_attribs;
__GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_VARIABLES;
REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len)
return BadLength;
pc += __GLX_VENDPRIV_HDR_SIZE; pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = ((GLXDrawable *) (pc)); drawId = ((GLXDrawable *) (pc));
buffer = ((int *) (pc + 4)); buffer = ((int *) (pc + 4));
num_attribs = ((CARD32 *) (pc + 8));
__GLX_SWAP_SHORT(&req->length); __GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(&req->contextTag);
__GLX_SWAP_INT(drawId); __GLX_SWAP_INT(drawId);
__GLX_SWAP_INT(buffer); __GLX_SWAP_INT(buffer);
__GLX_SWAP_INT(num_attribs);
return __glXDisp_BindTexImageEXT(cl, (GLbyte *)pc); return __glXDisp_BindTexImageEXT(cl, (GLbyte *)pc);
} }
@ -738,7 +744,7 @@ int __glXDispSwap_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
__GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_VARIABLES;
REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesReq); REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
__GLX_SWAP_SHORT(&req->length); __GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->drawable);

View File

@ -808,7 +808,7 @@ InitInput(int argc, char **argv)
GetEventList(&xf86Events); GetEventList(&xf86Events);
/* Call the PreInit function for each input device instance. */ /* Initialize all configured input devices */
for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) { for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
/* Replace obsolete keyboard driver with kbd */ /* Replace obsolete keyboard driver with kbd */
if (!xf86NameCmp((*pDev)->driver, "keyboard")) { if (!xf86NameCmp((*pDev)->driver, "keyboard")) {

View File

@ -242,11 +242,20 @@ xf86RandRSetConfig (ScreenPtr pScreen,
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode; DisplayModePtr mode;
int px, py; int pos[MAXDEVICES][2];
Bool useVirtual = FALSE; Bool useVirtual = FALSE;
Rotation oldRotation = randrp->rotation; Rotation oldRotation = randrp->rotation;
DeviceIntPtr dev;
Bool view_adjusted = FALSE;
for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (!IsMaster(dev) && !IsFloating(dev))
continue;
miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
}
miPointerGetPosition(inputInfo.pointer, &px, &py);
for (mode = scrp->modes; ; mode = mode->next) for (mode = scrp->modes; ; mode = mode->next)
{ {
if (mode->HDisplay == pSize->width && if (mode->HDisplay == pSize->width &&
@ -303,17 +312,31 @@ xf86RandRSetConfig (ScreenPtr pScreen,
} }
return FALSE; return FALSE;
} }
/* /*
* Move the cursor back where it belongs; SwitchMode repositions it * Move the cursor back where it belongs; SwitchMode repositions it
* FIXME: duplicated code, see modes/xf86RandR12.c
*/ */
if (pScreen == miPointerCurrentScreen ()) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
px = (px >= pScreen->width ? (pScreen->width - 1) : px); if (!IsMaster(dev) && !IsFloating(dev))
py = (py >= pScreen->height ? (pScreen->height - 1) : py); continue;
xf86SetViewport(pScreen, px, py); if (pScreen == miPointerGetScreen(dev)) {
int px = pos[dev->id][0];
int py = pos[dev->id][1];
(*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE); px = (px >= pScreen->width ? (pScreen->width - 1) : px);
py = (py >= pScreen->height ? (pScreen->height - 1) : py);
/* Setting the viewpoint makes only sense on one device */
if (!view_adjusted && IsMaster(dev)) {
xf86SetViewport(pScreen, px, py);
view_adjusted = TRUE;
}
(*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
}
} }
return TRUE; return TRUE;

View File

@ -634,7 +634,7 @@ VidModeSetModeValue(pointer mode, int valtyp, int val)
vidMonitorValue vidMonitorValue
VidModeGetMonitorValue(pointer monitor, int valtyp, int indx) VidModeGetMonitorValue(pointer monitor, int valtyp, int indx)
{ {
vidMonitorValue ret; vidMonitorValue ret = { NULL, };
switch (valtyp) { switch (valtyp) {
case VIDMODE_MON_VENDOR: case VIDMODE_MON_VENDOR:

View File

@ -97,8 +97,11 @@ static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
static Bool xf86XVDestroyWindow(WindowPtr pWin); static Bool xf86XVDestroyWindow(WindowPtr pWin);
static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2); static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind);
static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy); static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
#define PostValidateTreeUndefined ((PostValidateTreeProcPtr)-1)
/* ScrnInfoRec functions */ /* ScrnInfoRec functions */
static Bool xf86XVEnterVT(int, int); static Bool xf86XVEnterVT(int, int);
@ -280,10 +283,9 @@ xf86XVScreenInit(
pScrn = xf86Screens[pScreen->myNum]; pScrn = xf86Screens[pScreen->myNum];
ScreenPriv->videoGC = NULL; /* for the helper */
ScreenPriv->DestroyWindow = pScreen->DestroyWindow; ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
ScreenPriv->WindowExposures = pScreen->WindowExposures; ScreenPriv->WindowExposures = pScreen->WindowExposures;
ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
ScreenPriv->ClipNotify = pScreen->ClipNotify; ScreenPriv->ClipNotify = pScreen->ClipNotify;
ScreenPriv->EnterVT = pScrn->EnterVT; ScreenPriv->EnterVT = pScrn->EnterVT;
ScreenPriv->LeaveVT = pScrn->LeaveVT; ScreenPriv->LeaveVT = pScrn->LeaveVT;
@ -333,6 +335,8 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
RegionDestroy(pPriv->clientClip); RegionDestroy(pPriv->clientClip);
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
RegionDestroy(pPriv->pCompositeClip); RegionDestroy(pPriv->pCompositeClip);
if (pPriv->ckeyFilled)
RegionDestroy(pPriv->ckeyFilled);
free(pPriv); free(pPriv);
} }
} }
@ -1018,7 +1022,6 @@ static void
xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
{ {
XF86XVWindowPtr winPriv, prevPriv = NULL; XF86XVWindowPtr winPriv, prevPriv = NULL;
winPriv = GET_XF86XV_WINDOW(pWin); winPriv = GET_XF86XV_WINDOW(pWin);
while(winPriv) { while(winPriv) {
@ -1035,6 +1038,11 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
winPriv = winPriv->next; winPriv = winPriv->next;
} }
portPriv->pDraw = NULL; portPriv->pDraw = NULL;
if (portPriv->ckeyFilled) {
RegionDestroy(portPriv->ckeyFilled);
portPriv->ckeyFilled = NULL;
}
portPriv->clipChanged = FALSE;
} }
static void static void
@ -1069,7 +1077,7 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
} }
static void static void
xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn) xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
{ {
ScreenPtr pScreen = pScrn->pScreen; ScreenPtr pScreen = pScrn->pScreen;
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen); XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
@ -1087,6 +1095,9 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
if (pPriv->isOn == XV_OFF || !pWin) if (pPriv->isOn == XV_OFF || !pWin)
continue; continue;
if (onlyChanged && !pPriv->clipChanged)
continue;
visible = pWin->visibility == VisibilityUnobscured || visible = pWin->visibility == VisibilityUnobscured ||
pWin->visibility == VisibilityPartiallyObscured; pWin->visibility == VisibilityPartiallyObscured;
@ -1098,6 +1109,8 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
visible = FALSE; visible = FALSE;
xf86XVReputOrStopPort(pPriv, pWin, visible); xf86XVReputOrStopPort(pPriv, pWin, visible);
pPriv->clipChanged = FALSE;
} }
} }
} }
@ -1123,9 +1136,6 @@ xf86XVDestroyWindow(WindowPtr pWin)
pPriv->pDraw = NULL; pPriv->pDraw = NULL;
tmp = WinPriv; tmp = WinPriv;
if(WinPriv->pGC) {
FreeGC(WinPriv->pGC, 0);
}
WinPriv = WinPriv->next; WinPriv = WinPriv->next;
free(tmp); free(tmp);
} }
@ -1139,6 +1149,29 @@ xf86XVDestroyWindow(WindowPtr pWin)
return ret; return ret;
} }
static void
xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
{
ScreenPtr pScreen;
XF86XVScreenPtr ScreenPriv;
ScrnInfoPtr pScrn;
if (pWin)
pScreen = pWin->drawable.pScreen;
else
pScreen = pLayerWin->drawable.pScreen;
ScreenPriv = GET_XF86XV_SCREEN(pScreen);
pScrn = xf86Screens[pScreen->myNum];
xf86XVReputOrStopAllPorts(pScrn, TRUE);
pScreen->PostValidateTree = ScreenPriv->PostValidateTree;
if (pScreen->PostValidateTree) {
(*pScreen->PostValidateTree)(pWin, pLayerWin, kind);
}
ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
}
static void static void
xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
@ -1170,12 +1203,28 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
if (!pPriv->type && !pPriv->AdaptorRec->ReputImage) if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
visible = !AreasExposed; visible = !AreasExposed;
/*
* Subtract exposed areas from overlaid image to match textured video
* behavior.
*/
if (!pPriv->type && pPriv->clientClip)
RegionSubtract(pPriv->clientClip, pPriv->clientClip, reg1);
if (visible && pPriv->ckeyFilled) {
RegionRec tmp;
RegionNull(&tmp);
RegionCopy(&tmp, reg1);
RegionTranslate(&tmp, pWin->drawable.x, pWin->drawable.y);
RegionSubtract(pPriv->ckeyFilled, pPriv->ckeyFilled, &tmp);
}
WinPriv = WinPriv->next; WinPriv = WinPriv->next;
xf86XVReputOrStopPort(pPriv, pWin, visible); xf86XVReputOrStopPort(pPriv, pWin, visible);
pPriv->clipChanged = FALSE;
} }
} }
static void static void
xf86XVClipNotify(WindowPtr pWin, int dx, int dy) xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
{ {
@ -1185,9 +1234,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
XvPortRecPrivatePtr pPriv; XvPortRecPrivatePtr pPriv;
while(WinPriv) { while(WinPriv) {
Bool visible = pWin->visibility == VisibilityUnobscured ||
pWin->visibility == VisibilityPartiallyObscured;
pPriv = WinPriv->PortRec; pPriv = WinPriv->PortRec;
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
@ -1199,15 +1245,14 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
(*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr, (*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr,
pWin, dx, dy); pWin, dx, dy);
/* pPriv->clipChanged = TRUE;
* Stop and remove still/images if
* ReputImage isn't supported. if (ScreenPriv->PostValidateTree == PostValidateTreeUndefined) {
*/ ScreenPriv->PostValidateTree = pScreen->PostValidateTree;
if (!pPriv->type && !pPriv->AdaptorRec->ReputImage) pScreen->PostValidateTree = xf86XVPostValidateTree;
visible = FALSE; }
WinPriv = WinPriv->next; WinPriv = WinPriv->next;
xf86XVReputOrStopPort(pPriv, pWin, visible);
} }
if(ScreenPriv->ClipNotify) { if(ScreenPriv->ClipNotify) {
@ -1232,11 +1277,6 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
if(!ScreenPriv) return TRUE; if(!ScreenPriv) return TRUE;
if(ScreenPriv->videoGC) {
FreeGC(ScreenPriv->videoGC, 0);
ScreenPriv->videoGC = NULL;
}
pScreen->DestroyWindow = ScreenPriv->DestroyWindow; pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
pScreen->WindowExposures = ScreenPriv->WindowExposures; pScreen->WindowExposures = ScreenPriv->WindowExposures;
pScreen->ClipNotify = ScreenPriv->ClipNotify; pScreen->ClipNotify = ScreenPriv->ClipNotify;
@ -1345,7 +1385,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
pScrn->AdjustFrame = xf86XVAdjustFrame; pScrn->AdjustFrame = xf86XVAdjustFrame;
} }
xf86XVReputOrStopAllPorts(pScrn); xf86XVReputOrStopAllPorts(pScrn, FALSE);
} }
static void static void
@ -1366,7 +1406,7 @@ xf86XVModeSet(ScrnInfoPtr pScrn)
pScrn->ModeSet = xf86XVModeSet; pScrn->ModeSet = xf86XVModeSet;
} }
xf86XVReputOrStopAllPorts(pScrn); xf86XVReputOrStopAllPorts(pScrn, FALSE);
} }
/**** XvAdaptorRec fields ****/ /**** XvAdaptorRec fields ****/
@ -1869,92 +1909,92 @@ xf86XVQueryImageAttributes(
format->id, width, height, pitches, offsets); format->id, width, height, pitches, offsets);
} }
void void
xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes) xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
{ {
ScreenPtr pScreen = pDraw->pScreen; ScreenPtr pScreen = pDraw->pScreen;
WindowPtr pWin = (WindowPtr)pDraw;
XF86XVWindowPtr pPriv = GET_XF86XV_WINDOW(pWin);
GCPtr pGC = NULL;
BoxPtr pbox = RegionRects(clipboxes);
int i, nbox = RegionNumRects(clipboxes);
xRectangle *rects;
if(!xf86Screens[pScreen->myNum]->vtSema) return;
if(pPriv)
pGC = pPriv->pGC;
if(!pGC) {
int status;
XID pval[2];
pval[0] = key;
pval[1] = IncludeInferiors;
pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status,
(XID)0, serverClient);
if(!pGC) return;
ValidateGC(pDraw, pGC);
if (pPriv) pPriv->pGC = pGC;
} else if (key != pGC->fgPixel){
ChangeGCVal val;
val.val = key;
ChangeGC(NullClient, pGC, GCForeground, &val);
ValidateGC(pDraw, pGC);
}
RegionTranslate(clipboxes, -pDraw->x, -pDraw->y);
rects = malloc(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);
free(rects);
}
void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
{
DrawablePtr root = &pScreen->root->drawable;
ChangeGCVal pval[2]; ChangeGCVal pval[2];
BoxPtr pbox = RegionRects(clipboxes); BoxPtr pbox = RegionRects(fillboxes);
int i, nbox = RegionNumRects(clipboxes); int i, nbox = RegionNumRects(fillboxes);
xRectangle *rects; xRectangle *rects;
GCPtr gc; GCPtr gc;
if(!xf86Screens[pScreen->myNum]->vtSema) return; if(!xf86Screens[pScreen->myNum]->vtSema) return;
gc = GetScratchGC(root->depth, pScreen); gc = GetScratchGC(pDraw->depth, pScreen);
pval[0].val = key; pval[0].val = key;
pval[1].val = IncludeInferiors; pval[1].val = IncludeInferiors;
(void) ChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, pval); (void) ChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, pval);
ValidateGC(root, gc); ValidateGC(pDraw, gc);
rects = malloc(nbox * sizeof(xRectangle)); rects = malloc(nbox * sizeof(xRectangle));
for(i = 0; i < nbox; i++, pbox++) for(i = 0; i < nbox; i++, pbox++)
{ {
rects[i].x = pbox->x1; rects[i].x = pbox->x1 - pDraw->x;
rects[i].y = pbox->y1; rects[i].y = pbox->y1 - pDraw->y;
rects[i].width = pbox->x2 - pbox->x1; rects[i].width = pbox->x2 - pbox->x1;
rects[i].height = pbox->y2 - pbox->y1; rects[i].height = pbox->y2 - pbox->y1;
} }
(*gc->ops->PolyFillRect)(root, gc, nbox, rects); (*gc->ops->PolyFillRect)(pDraw, gc, nbox, rects);
free(rects); free(rects);
FreeScratchGC (gc); FreeScratchGC (gc);
} }
void
xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr fillboxes)
{
xf86XVFillKeyHelperDrawable (&pScreen->root->drawable, key, fillboxes);
}
void
xf86XVFillKeyHelperPort (DrawablePtr pDraw, pointer data, CARD32 key, RegionPtr clipboxes, Bool fillEverything)
{
WindowPtr pWin = (WindowPtr)pDraw;
XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
XvPortRecPrivatePtr portPriv = NULL;
RegionRec reg;
RegionPtr fillboxes;
while (WinPriv) {
XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
if (data == pPriv->DevPriv.ptr) {
portPriv = pPriv;
break;
}
WinPriv = WinPriv->next;
}
if (!portPriv)
return;
if (!portPriv->ckeyFilled)
portPriv->ckeyFilled = RegionCreate(NULL, 0);
if (!fillEverything) {
RegionNull(&reg);
fillboxes = &reg;
RegionSubtract(fillboxes, clipboxes, portPriv->ckeyFilled);
if (!RegionNotEmpty(fillboxes))
goto out;
} else
fillboxes = clipboxes;
RegionCopy(portPriv->ckeyFilled, clipboxes);
xf86XVFillKeyHelperDrawable(pDraw, key, fillboxes);
out:
if (!fillEverything)
RegionUninit(&reg);
}
/* xf86XVClipVideoHelper - /* xf86XVClipVideoHelper -
Takes the dst box in standard X BoxRec form (top and left Takes the dst box in standard X BoxRec form (top and left

View File

@ -244,6 +244,9 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
extern _X_EXPORT void extern _X_EXPORT void
xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes); xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
extern _X_EXPORT void
xf86XVFillKeyHelperPort (DrawablePtr pDraw, pointer data, CARD32 key, RegionPtr clipboxes, Bool fillEverything);
extern _X_EXPORT Bool extern _X_EXPORT Bool
xf86XVClipVideoHelper( xf86XVClipVideoHelper(
BoxPtr dst, BoxPtr dst,

View File

@ -40,10 +40,10 @@ typedef struct {
DestroyWindowProcPtr DestroyWindow; DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify; ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures; WindowExposuresProcPtr WindowExposures;
PostValidateTreeProcPtr PostValidateTree;
void (*AdjustFrame)(int, int, int, int); void (*AdjustFrame)(int, int, int, int);
Bool (*EnterVT)(int, int); Bool (*EnterVT)(int, int);
void (*LeaveVT)(int, int); void (*LeaveVT)(int, int);
GCPtr videoGC;
xf86ModeSetProc *ModeSet; xf86ModeSetProc *ModeSet;
} XF86XVScreenRec, *XF86XVScreenPtr; } XF86XVScreenRec, *XF86XVScreenPtr;
@ -69,11 +69,12 @@ typedef struct {
unsigned char type; unsigned char type;
unsigned int subWindowMode; unsigned int subWindowMode;
RegionPtr clientClip; RegionPtr clientClip;
RegionPtr ckeyFilled;
RegionPtr pCompositeClip; RegionPtr pCompositeClip;
Bool FreeCompositeClip; Bool FreeCompositeClip;
XvAdaptorRecPrivatePtr AdaptorRec; XvAdaptorRecPrivatePtr AdaptorRec;
XvStatus isOn; XvStatus isOn;
Bool moved; Bool clipChanged;
int vid_x, vid_y, vid_w, vid_h; int vid_x, vid_y, vid_w, vid_h;
int drw_x, drw_y, drw_w, drw_h; int drw_x, drw_y, drw_w, drw_h;
DevUnion DevPriv; DevUnion DevPriv;
@ -82,7 +83,6 @@ typedef struct {
typedef struct _XF86XVWindowRec{ typedef struct _XF86XVWindowRec{
XvPortRecPrivatePtr PortRec; XvPortRecPrivatePtr PortRec;
struct _XF86XVWindowRec *next; struct _XF86XVWindowRec *next;
GCPtr pGC;
} XF86XVWindowRec, *XF86XVWindowPtr; } XF86XVWindowRec, *XF86XVWindowPtr;
#endif /* _XF86XVPRIV_H_ */ #endif /* _XF86XVPRIV_H_ */

View File

@ -403,7 +403,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
&& (pDraw->height == pPriv->height) && (pDraw->height == pPriv->height)
&& (pPriv->serialNumber == DRI2DrawableSerial(pDraw)); && (pPriv->serialNumber == DRI2DrawableSerial(pDraw));
buffers = malloc((count + 1) * sizeof(buffers[0])); buffers = calloc((count + 1), sizeof(buffers[0]));
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
const unsigned attachment = *(attachments++); const unsigned attachment = *(attachments++);

View File

@ -264,14 +264,7 @@ fbdev_open_pci(struct pci_device * pPci, char **namep)
{ {
struct fb_fix_screeninfo fix; struct fb_fix_screeninfo fix;
char filename[256]; char filename[256];
int fd,i,j; int fd, i;
/* There are two ways to that we can determine which fb device is
* associated with this PCI device. The more modern way is to look in
* the sysfs directory for the PCI device for a file named
* "graphics/fb*"
*/
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
sprintf(filename, sprintf(filename,
@ -304,55 +297,10 @@ fbdev_open_pci(struct pci_device * pPci, char **namep)
} }
} }
/* The other way is to examine the resources associated with each fb
* device and see if there is a match with the PCI device. This technique
* has some problems on certain mixed 64-bit / 32-bit architectures.
* There is a flaw in the fb_fix_screeninfo structure in that it only
* returns the low 32-bits of the address of the resources associated with
* a device. However, on a mixed architecture the base addresses of PCI
* devices, even for 32-bit applications, may be higher than 0x0f0000000.
*/
for (i = 0; i < 8; i++) {
sprintf(filename,"/dev/fb%d",i);
if (-1 == (fd = open(filename,O_RDWR,0))) {
xf86DrvMsg(-1, X_WARNING,
"open %s: %s\n", filename, strerror(errno));
continue;
}
if (-1 == ioctl(fd,FBIOGET_FSCREENINFO,(void*)&fix)) {
close(fd);
continue;
}
for (j = 0; j < 6; j++) {
const pciaddr_t res_start = pPci->regions[j].base_addr;
const pciaddr_t res_end = res_start + pPci->regions[j].size;
if ((0 != fix.smem_len &&
(pciaddr_t) fix.smem_start >= res_start &&
(pciaddr_t) fix.smem_start < res_end) ||
(0 != fix.mmio_len &&
(pciaddr_t) fix.mmio_start >= res_start &&
(pciaddr_t) fix.mmio_start < res_end))
break;
}
if (j == 6) {
close(fd);
continue;
}
if (namep) {
*namep = xnfalloc(16);
strncpy(*namep,fix.id,16);
}
return fd;
}
if (namep) if (namep)
*namep = NULL; *namep = NULL;
xf86DrvMsg(-1, X_ERROR, xf86DrvMsg(-1, X_ERROR, "Unable to find a valid framebuffer device\n");
"Unable to find a valid framebuffer device\n");
return -1; return -1;
} }

View File

@ -504,7 +504,7 @@ pciCfg1in(CARD16 addr, CARD32 *val)
} }
if (addr == 0xCFC) { if (addr == 0xCFC) {
pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr), pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
val, PCI_OFFSET(PciCfg1Addr)); (uint32_t *)val, PCI_OFFSET(PciCfg1Addr));
if (PRINT_PORT && DEBUG_IO_TRACE()) if (PRINT_PORT && DEBUG_IO_TRACE())
ErrorF(" cfg_inl(%#lx) = %8.8lx\n", PciCfg1Addr, *val); ErrorF(" cfg_inl(%#lx) = %8.8lx\n", PciCfg1Addr, *val);
return 1; return 1;

View File

@ -1542,7 +1542,6 @@ struct det_monrec_parameter {
static void handle_detailed_monrec(struct detailed_monitor_section *det_mon, static void handle_detailed_monrec(struct detailed_monitor_section *det_mon,
void *data) void *data)
{ {
enum { sync_config, sync_edid, sync_default };
struct det_monrec_parameter *p; struct det_monrec_parameter *p;
p = (struct det_monrec_parameter *)data; p = (struct det_monrec_parameter *)data;

View File

@ -584,10 +584,12 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen); ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode; DisplayModePtr mode;
int px, py; int pos[MAXDEVICES][2];
Bool useVirtual = FALSE; Bool useVirtual = FALSE;
int maxX = 0, maxY = 0; int maxX = 0, maxY = 0;
Rotation oldRotation = randrp->rotation; Rotation oldRotation = randrp->rotation;
DeviceIntPtr dev;
Bool view_adjusted = FALSE;
randrp->rotation = rotation; randrp->rotation = rotation;
@ -597,7 +599,14 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
randrp->virtualY = scrp->virtualY; randrp->virtualY = scrp->virtualY;
} }
miPointerGetPosition (inputInfo.pointer, &px, &py); for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (!IsMaster(dev) && !IsFloating(dev))
continue;
miPointerGetPosition(dev, &pos[dev->id][0], &pos[dev->id][1]);
}
for (mode = scrp->modes; ; mode = mode->next) for (mode = scrp->modes; ; mode = mode->next)
{ {
if (randrp->maxX == 0 || randrp->maxY == 0) if (randrp->maxX == 0 || randrp->maxY == 0)
@ -643,15 +652,28 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
/* /*
* Move the cursor back where it belongs; SwitchMode repositions it * Move the cursor back where it belongs; SwitchMode repositions it
* FIXME: duplicated code, see modes/xf86RandR12.c
*/ */
if (pScreen == miPointerGetScreen(inputInfo.pointer)) for (dev = inputInfo.devices; dev; dev = dev->next)
{ {
px = (px >= pScreen->width ? (pScreen->width - 1) : px); if (!IsMaster(dev) && !IsFloating(dev))
py = (py >= pScreen->height ? (pScreen->height - 1) : py); continue;
xf86SetViewport(pScreen, px, py); if (pScreen == miPointerGetScreen(dev)) {
int px = pos[dev->id][0];
int py = pos[dev->id][1];
(*pScreen->SetCursorPosition) (inputInfo.pointer, pScreen, px, py, FALSE); px = (px >= pScreen->width ? (pScreen->width - 1) : px);
py = (py >= pScreen->height ? (pScreen->height - 1) : py);
/* Setting the viewpoint makes only sense on one device */
if (!view_adjusted && IsMaster(dev)) {
xf86SetViewport(pScreen, px, py);
view_adjusted = TRUE;
}
(*pScreen->SetCursorPosition) (dev, pScreen, px, py, FALSE);
}
} }
return TRUE; return TRUE;

View File

@ -317,8 +317,7 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
/* only update for VCP, otherwise we get cursor jumps when removing a /* only update for VCP, otherwise we get cursor jumps when removing a
sprite. The second cursor is never HW rendered anyway. */ sprite. The second cursor is never HW rendered anyway. */
if (pDev == inputInfo.pointer || if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
(!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
{ {
pCurs->refcnt++; pCurs->refcnt++;
if (ScreenPriv->CurrentCursor) if (ScreenPriv->CurrentCursor)
@ -386,8 +385,7 @@ xf86CursorMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
/* only update coordinate state for first sprite, otherwise we get jumps /* only update coordinate state for first sprite, otherwise we get jumps
when removing a sprite. The second sprite is never HW rendered anyway */ when removing a sprite. The second sprite is never HW rendered anyway */
if (pDev == inputInfo.pointer || if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
(!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
{ {
ScreenPriv->x = x; ScreenPriv->x = x;
ScreenPriv->y = y; ScreenPriv->y = y;

View File

@ -789,6 +789,9 @@ winClipboardFlushXEvents (HWND hwnd,
case PropertyNotify: case PropertyNotify:
break; break;
case MappingNotify:
break;
default: default:
ErrorF ("winClipboardFlushXEvents - unexpected event type %d\n", event.type); ErrorF ("winClipboardFlushXEvents - unexpected event type %d\n", event.type);
break; break;

View File

@ -240,6 +240,7 @@ Bool
winConfigKeyboard (DeviceIntPtr pDevice) winConfigKeyboard (DeviceIntPtr pDevice)
{ {
char layoutName[KL_NAMELENGTH]; char layoutName[KL_NAMELENGTH];
unsigned char layoutFriendlyName[256];
static unsigned int layoutNum = 0; static unsigned int layoutNum = 0;
int keyboardType; int keyboardType;
#ifdef XWIN_XF86CONFIG #ifdef XWIN_XF86CONFIG
@ -299,11 +300,32 @@ winConfigKeyboard (DeviceIntPtr pDevice)
if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL) if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
winMsg (X_INFO, "Loading US keyboard layout.\n"); winMsg (X_INFO, "Loading US keyboard layout.\n");
else else
winMsg (X_ERROR, "LoadKeyboardLaout failed.\n"); winMsg (X_ERROR, "LoadKeyboardLayout failed.\n");
} }
} }
winMsg (X_PROBED, "winConfigKeyboard - Layout: \"%s\" (%08x) \n",
layoutName, layoutNum); /* Discover the friendly name of the current layout */
{
HKEY regkey = NULL;
const char regtempl[] = "SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
char *regpath;
DWORD namesize = sizeof(layoutFriendlyName);
regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1);
strcpy(regpath, regtempl);
strcat(regpath, layoutName);
if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, &regkey))
RegQueryValueEx(regkey, "Layout Text", 0, NULL, layoutFriendlyName, &namesize);
/* Close registry key */
if (regkey)
RegCloseKey (regkey);
free(regpath);
}
winMsg (X_PROBED, "Windows keyboard layout: \"%s\" (%08x) \"%s\", type %d\n",
layoutName, layoutNum, layoutFriendlyName, keyboardType);
for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++) for (pLayout = winKBLayouts; pLayout->winlayout != -1; pLayout++)
{ {
@ -311,46 +333,35 @@ winConfigKeyboard (DeviceIntPtr pDevice)
continue; continue;
if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType) if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
continue; continue;
bfound = TRUE; bfound = TRUE;
winMsg (X_PROBED, winMsg (X_PROBED,
"Using preset keyboard for \"%s\" (%x), type \"%d\"\n", "Found matching XKB configuration \"%s\"\n",
pLayout->layoutname, pLayout->winlayout, keyboardType); pLayout->layoutname);
winMsg(X_PROBED,
"Model = \"%s\" Layout = \"%s\""
" Variant = \"%s\" Options = \"%s\"\n",
pLayout->xkbmodel ? pLayout->xkbmodel : "none",
pLayout->xkblayout ? pLayout->xkblayout : "none",
pLayout->xkbvariant ? pLayout->xkbvariant : "none",
pLayout->xkboptions ? pLayout->xkboptions : "none");
g_winInfo.xkb.model = pLayout->xkbmodel; g_winInfo.xkb.model = pLayout->xkbmodel;
g_winInfo.xkb.layout = pLayout->xkblayout; g_winInfo.xkb.layout = pLayout->xkblayout;
g_winInfo.xkb.variant = pLayout->xkbvariant; g_winInfo.xkb.variant = pLayout->xkbvariant;
g_winInfo.xkb.options = pLayout->xkboptions; g_winInfo.xkb.options = pLayout->xkboptions;
break; break;
} }
if (!bfound) if (!bfound)
{ {
HKEY regkey = NULL; winMsg (X_ERROR, "Keyboardlayout \"%s\" (%s) is unknown, using X server default layout\n", layoutFriendlyName, layoutName);
const char regtempl[] =
"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
char *regpath;
unsigned char lname[256];
DWORD namesize = sizeof(lname);
regpath = malloc(sizeof(regtempl) + KL_NAMELENGTH + 1);
strcpy(regpath, regtempl);
strcat(regpath, layoutName);
if (!RegOpenKey(HKEY_LOCAL_MACHINE, regpath, &regkey) &&
!RegQueryValueEx(regkey, "Layout Text", 0, NULL, lname, &namesize))
{
winMsg (X_ERROR,
"Keyboardlayout \"%s\" (%s) is unknown\n", lname, layoutName);
}
/* Close registry key */
if (regkey)
RegCloseKey (regkey);
free(regpath);
} }
} }
/* parse the configuration */ /* parse the configuration */
#ifdef XWIN_XF86CONFIG #ifdef XWIN_XF86CONFIG
if (g_cmdline.keyboard) if (g_cmdline.keyboard)

View File

@ -73,6 +73,8 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
int iParam = HIWORD (lParam); int iParam = HIWORD (lParam);
int iParamScanCode = LOBYTE (iParam); int iParamScanCode = LOBYTE (iParam);
winDebug("winTranslateKey: wParam %08x lParam %08x\n", wParam, lParam);
/* WM_ key messages faked by Vista speech recognition (WSR) don't have a /* WM_ key messages faked by Vista speech recognition (WSR) don't have a
* scan code. * scan code.
* *
@ -488,10 +490,8 @@ winSendKeyEvent (DWORD dwKey, Bool fDown)
for (i = 0; i < nevents; i++) for (i = 0; i < nevents; i++)
mieqEnqueue(g_pwinKeyboard, (InternalEvent*)events[i].event); mieqEnqueue(g_pwinKeyboard, (InternalEvent*)events[i].event);
#if CYGDEBUG winDebug("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n",
ErrorF("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n", dwKey, fDown, nevents);
dwKey, fDown, nevents);
#endif
} }
BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam) BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam)

View File

@ -216,13 +216,13 @@ g_iKeyMap [] = {
/* 170 */ 0, 0, 0, /* 170 */ 0, 0, 0,
/* 171 */ 0, 0, 0, /* 171 */ 0, 0, 0,
/* 172 */ 0, 0, 0, /* 172 */ 0, 0, 0,
/* 173 */ 0, 0, 0, /* 173 */ VK_VOLUME_MUTE, 0, KEY_Mute,
/* 174 */ 0, 0, 0, /* 174 */ VK_VOLUME_DOWN, 0, KEY_AudioLower,
/* 175 */ 0, 0, 0, /* 175 */ VK_VOLUME_UP, 0, KEY_AudioRaise,
/* 176 */ 0, 0, 0, /* 176 */ VK_MEDIA_NEXT_TRACK, 0, KEY_NEXTSONG,
/* 177 */ 0, 0, 0, /* 177 */ VK_MEDIA_PREV_TRACK, 0, KEY_PREVIOUSSONG,
/* 178 */ 0, 0, 0, /* 178 */ VK_MEDIA_STOP, 0, KEY_STOPCD,
/* 179 */ 0, 0, 0, /* 179 */ VK_MEDIA_PLAY_PAUSE, 0, KEY_PLAYPAUSE,
/* 180 */ 0, 0, 0, /* 180 */ 0, 0, 0,
/* 181 */ 0, 0, 0, /* 181 */ 0, 0, 0,
/* 182 */ 0, 0, 0, /* 182 */ 0, 0, 0,
@ -266,7 +266,7 @@ g_iKeyMap [] = {
/* 220 */ 0, 0, 0, /* 220 */ 0, 0, 0,
/* 221 */ 0, 0, 0, /* 221 */ 0, 0, 0,
/* 222 */ 0, 0, 0, /* 222 */ 0, 0, 0,
/* 223 */ 0, 0, 0, /* 223 */ VK_OEM_8, 0, KEY_RCtrl, /* at least on Candian Multilingual Standard layout */
/* 224 */ 0, 0, 0, /* 224 */ 0, 0, 0,
/* 225 */ 0, 0, 0, /* 225 */ 0, 0, 0,
/* 226 */ 0, 0, 0, /* 226 */ 0, 0, 0,

View File

@ -88,9 +88,7 @@ winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
/* Pass keystrokes on to our main message loop */ /* Pass keystrokes on to our main message loop */
if (iCode == HC_ACTION) if (iCode == HC_ACTION)
{ {
#if 0 winDebug("winKeyboardMessageHook: vkCode: %08x scanCode: %08x\n", p->vkCode, p->scanCode);
ErrorF ("vkCode: %08x\tscanCode: %08x\n", p->vkCode, p->scanCode);
#endif
switch (wParam) switch (wParam)
{ {

View File

@ -23,10 +23,6 @@
* *
*/ */
#define XK_TECHNICAL
#define XK_KATAKANA
#include <X11/keysym.h>
#define GLYPHS_PER_KEY 4 #define GLYPHS_PER_KEY 4
#define NUM_KEYCODES 248 #define NUM_KEYCODES 248
#define MIN_KEYCODE 8 #define MIN_KEYCODE 8
@ -194,6 +190,15 @@
#define KEY_HKTG /* Hirugana/Katakana tog 0xc8 */ 200 #define KEY_HKTG /* Hirugana/Katakana tog 0xc8 */ 200
#define KEY_BSlash2 /* \ _ 0xcb */ 203 #define KEY_BSlash2 /* \ _ 0xcb */ 203
#define KEY_Mute /* Audio Mute */ 152
#define KEY_AudioLower /* Audio Lower */ 168
#define KEY_AudioRaise /* Audio Raise */ 166
#define KEY_NEXTSONG /* Media next */ 145
#define KEY_PLAYPAUSE /* Media play/pause toggle */ 154
#define KEY_PREVIOUSSONG /* Media previous */ 136
#define KEY_STOPCD /* Media stop */ 156
/* These are for "notused" and "unknown" entries in translation maps. */ /* These are for "notused" and "unknown" entries in translation maps. */
#define KEY_NOTUSED 0 #define KEY_NOTUSED 0
#define KEY_UNKNOWN 255 #define KEY_UNKNOWN 255

View File

@ -55,13 +55,15 @@ WinKBLayoutRec winKBLayouts[] =
{ 0x00010409, -1, "pc105", "dvorak", NULL, NULL, "English (USA,Dvorak)"}, { 0x00010409, -1, "pc105", "dvorak", NULL, NULL, "English (USA,Dvorak)"},
{ 0x00020409, -1, "pc105", "us_intl", NULL, NULL, "English (USA,International)"}, { 0x00020409, -1, "pc105", "us_intl", NULL, NULL, "English (USA,International)"},
{ 0x00000809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"}, { 0x00000809, -1, "pc105", "gb", NULL, NULL, "English (United Kingdom)"},
{ 0x00001009, -1, "pc105", "ca", "fr", NULL, "French (Canada)"},
{ 0x00011009, -1, "pc105", "ca", "multix", NULL, "Canadian Multilingual Standard"},
{ 0x00001809, -1, "pc105", "ie", NULL, NULL, "Irish"}, { 0x00001809, -1, "pc105", "ie", NULL, NULL, "Irish"},
{ 0x0000040a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain,Traditional Sort)"}, { 0x0000040a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain,Traditional Sort)"},
{ 0x0000080a, -1, "pc105", "latam", NULL, NULL, "Latin American"}, { 0x0000080a, -1, "pc105", "latam", NULL, NULL, "Latin American"},
{ 0x0000040b, -1, "pc105", "fi", NULL, NULL, "Finnish"}, { 0x0000040b, -1, "pc105", "fi", NULL, NULL, "Finnish"},
{ 0x0000040c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"}, { 0x0000040c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"},
{ 0x0000080c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"}, { 0x0000080c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"},
{ 0x00000c0c, -1, "pc105", "ca", "fr", NULL, "French (Canada)"}, { 0x00000c0c, -1, "pc105", "ca", "fr-legacy", NULL, "French (Canada, Legacy)"},
{ 0x0000100c, -1, "pc105", "ch", "fr", NULL, "French (Switzerland)"}, { 0x0000100c, -1, "pc105", "ch", "fr", NULL, "French (Switzerland)"},
{ 0x0000040d, -1, "pc105", "il", NULL, NULL, "Hebrew"}, { 0x0000040d, -1, "pc105", "il", NULL, NULL, "Hebrew"},
{ 0x0000040e, -1, "pc105", "hu", NULL, NULL, "Hungarian"}, { 0x0000040e, -1, "pc105", "hu", NULL, NULL, "Hungarian"},
@ -79,6 +81,8 @@ WinKBLayoutRec winKBLayouts[] =
{ 0x00000816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"}, { 0x00000816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"},
{ 0x0000041a, -1, "pc105", "hr", NULL, NULL, "Croatian"}, { 0x0000041a, -1, "pc105", "hr", NULL, NULL, "Croatian"},
{ 0x0000041d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"}, { 0x0000041d, -1, "pc105", "se", NULL, NULL, "Swedish (Sweden)"},
{ 0x0000041f, -1, "pc105", "tr", NULL, NULL, "Turkish (Q)"},
{ 0x0001041f, -1, "pc105", "tr", "f", NULL, "Turkish (F)"},
{ 0x00000424, -1, "pc105", "si", NULL, NULL, "Slovenian"}, { 0x00000424, -1, "pc105", "si", NULL, NULL, "Slovenian"},
{ 0x00000425, -1, "pc105", "ee", NULL, NULL, "Estonian"}, { 0x00000425, -1, "pc105", "ee", NULL, NULL, "Estonian"},
{ 0x00000452, -1, "pc105", "gb", "intl", NULL, "United Kingdom (Extended)"}, { 0x00000452, -1, "pc105", "gb", "intl", NULL, "United Kingdom (Extended)"},
@ -89,5 +93,3 @@ WinKBLayoutRec winKBLayouts[] =
See http://technet.microsoft.com/en-us/library/cc766503%28WS.10%29.aspx See http://technet.microsoft.com/en-us/library/cc766503%28WS.10%29.aspx
for a listing of input locale (keyboard layout) codes for a listing of input locale (keyboard layout) codes
*/ */

View File

@ -570,6 +570,7 @@ extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev);
extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev); extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev);
extern Bool IsPointerEvent(InternalEvent *event); extern Bool IsPointerEvent(InternalEvent *event);
extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev); extern _X_EXPORT Bool IsMaster(DeviceIntPtr dev);
extern _X_EXPORT Bool IsFloating(DeviceIntPtr dev);
extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master); extern _X_HIDDEN void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what); extern _X_HIDDEN int CorePointerProc(DeviceIntPtr dev, int what);

View File

@ -69,7 +69,7 @@ extern _X_EXPORT int XIChangeDeviceProperty(
int /* format*/, int /* format*/,
int /* mode*/, int /* mode*/,
unsigned long /* len*/, unsigned long /* len*/,
pointer /* value*/, const pointer /* value*/,
Bool /* sendevent*/ Bool /* sendevent*/
); );

View File

@ -494,6 +494,7 @@ typedef struct _SpriteInfoRec {
#define MASTER_POINTER 1 #define MASTER_POINTER 1
#define MASTER_KEYBOARD 2 #define MASTER_KEYBOARD 2
#define SLAVE 3 #define SLAVE 3
#define MASTER_ATTACHED 4 /* special type for GetMaster */
typedef struct _DeviceIntRec { typedef struct _DeviceIntRec {
DeviceRec public; DeviceRec public;
@ -530,10 +531,8 @@ typedef struct _DeviceIntRec {
PrivateRec *devPrivates; PrivateRec *devPrivates;
DeviceUnwrapProc unwrapProc; DeviceUnwrapProc unwrapProc;
SpriteInfoPtr spriteInfo; SpriteInfoPtr spriteInfo;
union { DeviceIntPtr master; /* master device */
DeviceIntPtr master; /* master device */ DeviceIntPtr lastSlave; /* last slave device used */
DeviceIntPtr lastSlave; /* last slave device used */
} u;
/* last valuator values recorded, not posted to client; /* last valuator values recorded, not posted to client;
* for slave devices, valuators is in device coordinates * for slave devices, valuators is in device coordinates

View File

@ -76,7 +76,7 @@ typedef struct {
#define miGetDCDevice(dev, screen) \ #define miGetDCDevice(dev, screen) \
((DevHasCursor(dev)) ? \ ((DevHasCursor(dev)) ? \
(miDCBufferPtr)dixLookupScreenPrivate(&dev->devPrivates, miDCDeviceKey, screen) : \ (miDCBufferPtr)dixLookupScreenPrivate(&dev->devPrivates, miDCDeviceKey, screen) : \
(miDCBufferPtr)dixLookupScreenPrivate(&dev->u.master->devPrivates, miDCDeviceKey, screen)) (miDCBufferPtr)dixLookupScreenPrivate(&GetMaster(dev, MASTER_POINTER)->devPrivates, miDCDeviceKey, screen))
/* /*
* The core pointer buffer will point to the index of the virtual core pointer * The core pointer buffer will point to the index of the virtual core pointer

View File

@ -321,11 +321,12 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
DeviceIntPtr mdev; DeviceIntPtr mdev;
int len = original->any.length; int len = original->any.length;
int type = original->any.type; int type = original->any.type;
int mtype; /* which master type? */
CHECKEVENT(original); CHECKEVENT(original);
/* ET_XQuartz has sdev == NULL */ /* ET_XQuartz has sdev == NULL */
if (!sdev || !sdev->u.master) if (!sdev || IsMaster(sdev) || IsFloating(sdev))
return NULL; return NULL;
#if XFreeXDGA #if XFreeXDGA
@ -337,20 +338,21 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
{ {
case ET_KeyPress: case ET_KeyPress:
case ET_KeyRelease: case ET_KeyRelease:
mdev = GetMaster(sdev, MASTER_KEYBOARD); mtype = MASTER_KEYBOARD;
break; break;
case ET_ButtonPress: case ET_ButtonPress:
case ET_ButtonRelease: case ET_ButtonRelease:
case ET_Motion: case ET_Motion:
case ET_ProximityIn: case ET_ProximityIn:
case ET_ProximityOut: case ET_ProximityOut:
mdev = GetMaster(sdev, MASTER_POINTER); mtype = MASTER_POINTER;
break; break;
default: default:
mdev = sdev->u.master; mtype = MASTER_ATTACHED;
break; break;
} }
mdev = GetMaster(sdev, mtype);
memcpy(copy, original, len); memcpy(copy, original, len);
ChangeDeviceID(mdev, copy); ChangeDeviceID(mdev, copy);
FixUpEventForMaster(mdev, sdev, original, copy); FixUpEventForMaster(mdev, sdev, original, copy);
@ -400,7 +402,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
master = CopyGetMasterEvent(dev, event, &mevent); master = CopyGetMasterEvent(dev, event, &mevent);
if (master) if (master)
master->u.lastSlave = dev; master->lastSlave = dev;
/* If someone's registered a custom event handler, let them /* If someone's registered a custom event handler, let them
* steal it. */ * steal it. */
@ -410,7 +412,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
handler(screenNum, event, dev); handler(screenNum, event, dev);
/* Check for the SD's master in case the device got detached /* Check for the SD's master in case the device got detached
* during event processing */ * during event processing */
if (master && dev->u.master) if (master && !IsFloating(dev))
handler(screenNum, &mevent, master); handler(screenNum, &mevent, master);
} else } else
{ {
@ -419,7 +421,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
/* Check for the SD's master in case the device got detached /* Check for the SD's master in case the device got detached
* during event processing */ * during event processing */
if (master && dev->u.master) if (master && !IsFloating(dev))
master->public.processInputProc(&mevent, master); master->public.processInputProc(&mevent, master);
} }
} }
@ -466,7 +468,7 @@ mieqProcessInputEvents(void)
pthread_mutex_unlock(&miEventQueueMutex); pthread_mutex_unlock(&miEventQueueMutex);
#endif #endif
master = (dev && !IsMaster(dev) && dev->u.master) ? dev->u.master : NULL; master = (dev) ? GetMaster(dev, MASTER_ATTACHED) : NULL;
if (screenIsSaved == SCREEN_SAVER_ON) if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);

View File

@ -23,6 +23,29 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group. in this Software without prior written authorization from The Open Group.
*/ */
/**
* @file
* This file contains functions to move the pointer on the screen and/or
* restrict its movement. These functions are divided into two sets:
* Screen-specific functions that are used as function pointers from other
* parts of the server (and end up heavily wrapped by e.g. animcur and
* xfixes):
* miPointerConstrainCursor
* miPointerCursorLimits
* miPointerDisplayCursor
* miPointerRealizeCursor
* miPointerUnrealizeCursor
* miPointerSetCursorPosition
* miRecolorCursor
* miPointerDeviceInitialize
* miPointerDeviceCleanup
* If wrapped, these are the last element in the wrapping chain. They may
* call into sprite-specific code through further function pointers though.
*
* The second type of functions are those that are directly called by the
* DIX, DDX and some drivers.
*/
#ifdef HAVE_DIX_CONFIG_H #ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h> #include <dix-config.h>
#endif #endif
@ -50,7 +73,7 @@ DevPrivateKeyRec miPointerScreenKeyRec;
DevPrivateKeyRec miPointerPrivKeyRec; DevPrivateKeyRec miPointerPrivKeyRec;
#define MIPOINTER(dev) \ #define MIPOINTER(dev) \
((!IsMaster(dev) && !dev->u.master) ? \ (IsFloating(dev) ? \
(miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \ (miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \
(miPointerPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miPointerPrivKey)) (miPointerPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miPointerPrivKey))
@ -126,36 +149,17 @@ miPointerInitialize (ScreenPtr pScreen,
return TRUE; return TRUE;
} }
/**
* Destroy screen-specific information.
*
* @param index Screen index of the screen in screenInfo.screens[]
* @param pScreen The actual screen pointer
*/
static Bool static Bool
miPointerCloseScreen (int index, ScreenPtr pScreen) miPointerCloseScreen (int index, ScreenPtr pScreen)
{ {
#if 0
miPointerPtr pPointer;
DeviceIntPtr pDev;
#endif
SetupScreen(pScreen); SetupScreen(pScreen);
#if 0
for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
if (DevHasCursor(pDev))
{
pPointer = MIPOINTER(pDev);
if (pScreen == pPointer->pScreen)
pPointer->pScreen = 0;
if (pScreen == pPointer->pSpriteScreen)
pPointer->pSpriteScreen = 0;
}
}
if (MIPOINTER(inputInfo.pointer)->pScreen == pScreen)
MIPOINTER(inputInfo.pointer)->pScreen = 0;
if (MIPOINTER(inputInfo.pointer)->pSpriteScreen == pScreen)
MIPOINTER(inputInfo.pointer)->pSpriteScreen = 0;
#endif
pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CloseScreen = pScreenPriv->CloseScreen;
free((pointer) pScreenPriv); free((pointer) pScreenPriv);
FreeEventList(events, GetMaximumEventsNum()); FreeEventList(events, GetMaximumEventsNum());
@ -189,8 +193,7 @@ miPointerDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
miPointerPtr pPointer; miPointerPtr pPointer;
/* return for keyboards */ /* return for keyboards */
if ((IsMaster(pDev) && !DevHasCursor(pDev)) || if (!IsPointerDevice(pDev))
(!IsMaster(pDev) && pDev->u.master && !DevHasCursor(pDev->u.master)))
return FALSE; return FALSE;
pPointer = MIPOINTER(pDev); pPointer = MIPOINTER(pDev);
@ -201,6 +204,15 @@ miPointerDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
return TRUE; return TRUE;
} }
/**
* Set up the constraints for the given device. This function does not
* actually constrain the cursor but merely copies the given box to the
* internal constraint storage.
*
* @param pDev The device to constrain to the box
* @param pBox The rectangle to constrain the cursor to
* @param pScreen Used for copying screen confinement
*/
static void static void
miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox) miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
{ {
@ -212,7 +224,17 @@ miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
pPointer->confined = PointerConfinedToScreen(pDev); pPointer->confined = PointerConfinedToScreen(pDev);
} }
/*ARGSUSED*/ /**
* Should calculate the box for the given cursor, based on screen and the
* confinement given. But we assume that whatever box is passed in is valid
* anyway.
*
* @param pDev The device to calculate the cursor limits for
* @param pScreen The screen the confinement happens on
* @param pCursor The screen the confinement happens on
* @param pHotBox The confinement box for the cursor
* @param[out] pTopLeftBox The new confinement box, always *pHotBox.
*/
static void static void
miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
BoxPtr pHotBox, BoxPtr pTopLeftBox) BoxPtr pHotBox, BoxPtr pTopLeftBox)
@ -220,15 +242,36 @@ miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
*pTopLeftBox = *pHotBox; *pTopLeftBox = *pHotBox;
} }
static Bool GenerateEvent; /**
* Set the device's cursor position to the x/y position on the given screen.
* Generates and event if required.
*
* This function is called from:
* - sprite init code to place onto initial position
* - the various WarpPointer implementations (core, XI, Xinerama, dmx,)
* - during the cursor update path in CheckMotion
* - in the Xinerama part of NewCurrentScreen
* - when a RandR/RandR1.2 mode was applied (it may have moved the pointer, so
* it's set back to the original pos)
*
* @param pDev The device to move
* @param pScreen The screen the device is on
* @param x The x coordinate in per-screen coordinates
* @param y The y coordinate in per-screen coordinates
* @param generateEvent True if the pointer movement should generate an
* event.
*
* @return TRUE in all cases
*/
static Bool static Bool
miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y, Bool generateEvent) int x, int y, Bool generateEvent)
{ {
SetupScreen (pScreen); SetupScreen (pScreen);
miPointerPtr pPointer = MIPOINTER(pDev);
pPointer->generateEvent = generateEvent;
GenerateEvent = generateEvent;
/* device dependent - must pend signal and call miPointerWarpCursor */ /* device dependent - must pend signal and call miPointerWarpCursor */
(*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y); (*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y);
if (!generateEvent) if (!generateEvent)
@ -236,9 +279,13 @@ miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
return TRUE; return TRUE;
} }
/* Set up sprite information for the device. /**
This function will be called once for each device after it is initialized * Set up sprite information for the device.
in the DIX. * This function will be called once for each device after it is initialized
* in the DIX.
*
* @param pDev The newly created device
* @param pScreen The initial sprite scree.
*/ */
static Bool static Bool
miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
@ -261,6 +308,7 @@ miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
pPointer->confined = FALSE; pPointer->confined = FALSE;
pPointer->x = 0; pPointer->x = 0;
pPointer->y = 0; pPointer->y = 0;
pPointer->generateEvent = FALSE;
if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen))) if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen)))
{ {
@ -272,15 +320,19 @@ miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
return TRUE; return TRUE;
} }
/* Clean up after device. /**
This function will be called once before the device is freed in the DIX * Clean up after device.
* This function will be called once before the device is freed in the DIX
*
* @param pDev The device to be removed from the server
* @param pScreen Current screen of the device
*/ */
static void static void
miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{ {
SetupScreen(pScreen); SetupScreen(pScreen);
if (!IsMaster(pDev) && pDev->u.master) if (!IsMaster(pDev) && !IsFloating(pDev))
return; return;
(*pScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen); (*pScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen);
@ -289,7 +341,17 @@ miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
} }
/* Once signals are ignored, the WarpCursor function can call this */ /**
* Warp the pointer to the given position on the given screen. May generate
* an event, depending on whether we're coming from miPointerSetPosition.
*
* Once signals are ignored, the WarpCursor function can call this
*
* @param pDev The device to warp
* @param pScreen Screen to warp on
* @param x The x coordinate in per-screen coordinates
* @param y The y coordinate in per-screen coordinates
*/
void void
miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
@ -306,7 +368,7 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
changedScreen = TRUE; changedScreen = TRUE;
} }
if (GenerateEvent) if (pPointer->generateEvent)
miPointerMove (pDev, pScreen, x, y); miPointerMove (pDev, pScreen, x, y);
else else
miPointerMoveNoEvent(pDev, pScreen, x, y); miPointerMoveNoEvent(pDev, pScreen, x, y);
@ -322,16 +384,11 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
UpdateSpriteForScreen (pDev, pScreen) ; UpdateSpriteForScreen (pDev, pScreen) ;
} }
/* /**
* Pointer/CursorDisplay interface routines * Syncronize the sprite with the cursor.
*/
/*
* miPointerUpdateSprite
* *
* Syncronize the sprite with the cursor - called from ProcessInputEvents * @param pDev The device to sync
*/ */
void void
miPointerUpdateSprite (DeviceIntPtr pDev) miPointerUpdateSprite (DeviceIntPtr pDev)
{ {
@ -408,6 +465,14 @@ miPointerUpdateSprite (DeviceIntPtr pDev)
} }
} }
/**
* Set the device to the coordinates on the given screen.
*
* @param pDev The device to move
* @param screen_no Index of the screen to move to
* @param x The x coordinate in per-screen coordinates
* @param y The y coordinate in per-screen coordinates
*/
void void
miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y) miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
{ {
@ -426,12 +491,18 @@ miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
pPointer->limits.y2 = pScreen->height; pPointer->limits.y2 = pScreen->height;
} }
/**
* @return The current screen of the VCP
*/
ScreenPtr ScreenPtr
miPointerCurrentScreen (void) miPointerCurrentScreen (void)
{ {
return miPointerGetScreen(inputInfo.pointer); return miPointerGetScreen(inputInfo.pointer);
} }
/**
* @return The current screen of the given device or NULL.
*/
ScreenPtr ScreenPtr
miPointerGetScreen(DeviceIntPtr pDev) miPointerGetScreen(DeviceIntPtr pDev)
{ {
@ -469,7 +540,7 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
* VCP, as this may cause a non-HW rendered cursor to be rendered during * VCP, as this may cause a non-HW rendered cursor to be rendered during
* SIGIO. This again leads to allocs during SIGIO which leads to SIGABRT. * SIGIO. This again leads to allocs during SIGIO which leads to SIGABRT.
*/ */
if ((pDev == inputInfo.pointer || (!IsMaster(pDev) && pDev->u.master == inputInfo.pointer)) if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer
&& !pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen) && !pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen)
{ {
pPointer->devx = x; pPointer->devx = x;
@ -483,6 +554,18 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
pPointer->pScreen = pScreen; pPointer->pScreen = pScreen;
} }
/**
* Set the devices' cursor position to the given x/y position.
*
* This function is called during the pointer update path in
* GetPointerEvents and friends (and the same in the xwin DDX).
*
* @param pDev The device to move
* @param[in,out] x The x coordiante in screen coordinates (in regards to total
* desktop size)
* @param[in,out] y The y coordiante in screen coordinates (in regards to total
* desktop size)
*/
void void
miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y) miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
{ {
@ -536,6 +619,12 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
miPointerMoveNoEvent(pDev, pScreen, *x, *y); miPointerMoveNoEvent(pDev, pScreen, *x, *y);
} }
/**
* Get the current position of the device in desktop coordinates.
*
* @param x Return value for the current x coordinate in desktop coordiates.
* @param y Return value for the current y coordinate in desktop coordiates.
*/
void void
miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y) miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
{ {
@ -549,6 +638,15 @@ void darwinEvents_lock(void);
void darwinEvents_unlock(void); void darwinEvents_unlock(void);
#endif #endif
/**
* Move the device's pointer to the x/y coordinates on the given screen.
* This function generates and enqueues pointer events.
*
* @param pDev The device to move
* @param pScreen The screen the device is on
* @param x The x coordinate in per-screen coordinates
* @param y The y coordinate in per-screen coordinates
*/
void void
miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{ {

View File

@ -44,6 +44,7 @@ typedef struct {
Bool confined; /* pointer can't change screens */ Bool confined; /* pointer can't change screens */
int x, y; /* hot spot location */ int x, y; /* hot spot location */
int devx, devy; /* sprite position */ int devx, devy; /* sprite position */
Bool generateEvent; /* generate an event during warping? */
} miPointerRec, *miPointerPtr; } miPointerRec, *miPointerPtr;
typedef struct { typedef struct {

View File

@ -143,7 +143,7 @@ typedef struct {
#endif #endif
#define MISPRITE(dev) \ #define MISPRITE(dev) \
((!IsMaster(dev) && !dev->u.master) ? \ (IsFloating(dev) ? \
(miCursorInfoPtr)dixLookupPrivate(&dev->devPrivates, miSpriteDevPrivatesKey) : \ (miCursorInfoPtr)dixLookupPrivate(&dev->devPrivates, miSpriteDevPrivatesKey) : \
(miCursorInfoPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miSpriteDevPrivatesKey)) (miCursorInfoPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miSpriteDevPrivatesKey))
@ -766,7 +766,7 @@ miSpriteRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{ {
miCursorInfoPtr pCursorInfo; miCursorInfoPtr pCursorInfo;
if (!IsMaster(pDev) && !pDev->u.master) if (IsFloating(pDev))
return FALSE; return FALSE;
pCursorInfo = MISPRITE(pDev); pCursorInfo = MISPRITE(pDev);
@ -790,7 +790,7 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
miCursorInfoPtr pPointer; miCursorInfoPtr pPointer;
miSpriteScreenPtr pScreenPriv; miSpriteScreenPtr pScreenPriv;
if (!IsMaster(pDev) && !pDev->u.master) if (IsFloating(pDev))
return; return;
pPointer = MISPRITE(pDev); pPointer = MISPRITE(pDev);
@ -848,7 +848,7 @@ miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{ {
CursorPtr pCursor; CursorPtr pCursor;
if (!IsMaster(pDev) && !pDev->u.master) if (IsFloating(pDev))
return; return;
pCursor = MISPRITE(pDev)->pCursor; pCursor = MISPRITE(pDev)->pCursor;
@ -905,7 +905,7 @@ miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
miCursorInfoPtr pCursorInfo; miCursorInfoPtr pCursorInfo;
if (!IsMaster(pDev) && !pDev->u.master) if (IsFloating(pDev))
return; return;
DamageDrawInternal (pScreen, TRUE); DamageDrawInternal (pScreen, TRUE);
@ -944,7 +944,7 @@ miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
CursorPtr pCursor; CursorPtr pCursor;
miCursorInfoPtr pCursorInfo; miCursorInfoPtr pCursorInfo;
if (!IsMaster(pDev) && !pDev->u.master) if (IsFloating(pDev))
return; return;
DamageDrawInternal (pScreen, TRUE); DamageDrawInternal (pScreen, TRUE);
@ -985,7 +985,7 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
CursorPtr pCursor; CursorPtr pCursor;
miCursorInfoPtr pCursorInfo; miCursorInfoPtr pCursorInfo;
if (!IsMaster(pDev) && !pDev->u.master) if (IsFloating(pDev))
return; return;
DamageDrawInternal (pScreen, TRUE); DamageDrawInternal (pScreen, TRUE);
@ -1025,7 +1025,7 @@ miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen)
CursorPtr pCursor; CursorPtr pCursor;
miCursorInfoPtr pCursorInfo; miCursorInfoPtr pCursorInfo;
if (!IsMaster(pDev) && !pDev->u.master) if (IsFloating(pDev))
return; return;
pCursorInfo = MISPRITE(pDev); pCursorInfo = MISPRITE(pDev);

View File

@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libdamage.la
AM_CFLAGS = $(DIX_CFLAGS) AM_CFLAGS = $(DIX_CFLAGS)
INCLUDES = -I$(srcdir)/../cw -I$(top_srcdir)/hw/xfree86/os-support INCLUDES = -I$(srcdir)/../cw
if XORG if XORG
sdk_HEADERS = damage.h damagestr.h sdk_HEADERS = damage.h damagestr.h

View File

@ -1,5 +1,4 @@
AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS) AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/hw/xfree86/os-support
noinst_LTLIBRARIES = librootless.la noinst_LTLIBRARIES = librootless.la
librootless_la_SOURCES = \ librootless_la_SOURCES = \

View File

@ -2,8 +2,6 @@ noinst_LTLIBRARIES = libshadow.la
AM_CFLAGS = $(DIX_CFLAGS) AM_CFLAGS = $(DIX_CFLAGS)
INCLUDES = -I$(top_srcdir)/hw/xfree86/os-support
if XORG if XORG
sdk_HEADERS = shadow.h sdk_HEADERS = shadow.h
endif endif

View File

@ -35,7 +35,7 @@ RRClientKnowsRates (ClientPtr pClient)
static int static int
ProcRRQueryVersion (ClientPtr client) ProcRRQueryVersion (ClientPtr client)
{ {
xRRQueryVersionReply rep; xRRQueryVersionReply rep = {0};
register int n; register int n;
REQUEST(xRRQueryVersionReq); REQUEST(xRRQueryVersionReq);
rrClientPriv(client); rrClientPriv(client);

View File

@ -288,7 +288,7 @@ int
ProcRRCreateMode (ClientPtr client) ProcRRCreateMode (ClientPtr client)
{ {
REQUEST(xRRCreateModeReq); REQUEST(xRRCreateModeReq);
xRRCreateModeReply rep; xRRCreateModeReply rep = {0};
WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;

View File

@ -36,6 +36,7 @@
#include "inputstr.h" #include "inputstr.h"
#include "eventconvert.h" #include "eventconvert.h"
#include "exevents.h" #include "exevents.h"
#include "exglobals.h"
#include "dixgrabs.h" #include "dixgrabs.h"
#include "eventstr.h" #include "eventstr.h"
#include "inpututils.h" #include "inpututils.h"
@ -295,6 +296,143 @@ static void dix_event_to_core_conversion(void)
dix_event_to_core(ET_Motion); dix_event_to_core(ET_Motion);
} }
static void
_dix_test_xi_convert(DeviceEvent *ev, int expected_rc, int expected_count)
{
xEvent *xi;
int count = 0;
int rc;
rc = EventToXI((InternalEvent*)ev, &xi, &count);
g_assert(rc == expected_rc);
g_assert(count >= expected_count);
if (count > 0){
deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer*)xi;
g_assert(kbp->type == IEventBase + ev->type);
g_assert(kbp->detail == ev->detail.key);
g_assert(kbp->time == ev->time);
g_assert((kbp->deviceid & ~MORE_EVENTS) == ev->deviceid);
g_assert(kbp->root_x == ev->root_x);
g_assert(kbp->root_y == ev->root_y);
g_assert(kbp->state == ev->corestate);
g_assert(kbp->event_x == 0);
g_assert(kbp->event_y == 0);
g_assert(kbp->root == ev->root);
g_assert(kbp->event == 0);
g_assert(kbp->child == 0);
g_assert(kbp->same_screen == FALSE);
while (--count > 0) {
deviceValuator *v = (deviceValuator*)&xi[count];
g_assert(v->type == DeviceValuator);
g_assert(v->num_valuators <= 6);
}
free(xi);
}
}
/**
* This tests for internal event XI1 event conversion
* - all conversions should generate the right XI event type
* - right number of events generated
* - extra events are valuators
*/
static void dix_event_to_xi1_conversion(void)
{
DeviceEvent ev = {0};
int time;
int x, y;
int state;
int detail;
const int ROOT_WINDOW_ID = 0x100;
int deviceid;
IEventBase = 80;
DeviceValuator = IEventBase - 1;
DeviceKeyPress = IEventBase + ET_KeyPress;
DeviceKeyRelease = IEventBase + ET_KeyRelease;
DeviceButtonPress = IEventBase + ET_ButtonPress;
DeviceButtonRelease = IEventBase + ET_ButtonRelease;
DeviceMotionNotify = IEventBase + ET_Motion;
DeviceFocusIn = IEventBase + ET_FocusIn;
DeviceFocusOut = IEventBase + ET_FocusOut;
ProximityIn = IEventBase + ET_ProximityIn;
ProximityOut = IEventBase + ET_ProximityOut;
/* EventToXI callocs */
x = 0;
y = 0;
time = 12345;
state = 0;
detail = 0;
deviceid = 4;
ev.header = 0xFF;
ev.header = 0xFF;
ev.length = sizeof(DeviceEvent);
ev.time = time;
ev.root_y = x;
ev.root_x = y;
SetBit(ev.valuators.mask, 0);
SetBit(ev.valuators.mask, 1);
ev.root = ROOT_WINDOW_ID;
ev.corestate = state;
ev.detail.key = detail;
ev.deviceid = deviceid;
/* test all types for bad match */
ev.type = ET_KeyPress; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_KeyRelease; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_ButtonPress; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_ButtonRelease; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_Motion; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_ProximityIn; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_ProximityOut; _dix_test_xi_convert(&ev, Success, 1);
/* No axes */
ClearBit(ev.valuators.mask, 0);
ClearBit(ev.valuators.mask, 1);
ev.type = ET_KeyPress; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_KeyRelease; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_ButtonPress; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_ButtonRelease; _dix_test_xi_convert(&ev, Success, 1);
ev.type = ET_Motion; _dix_test_xi_convert(&ev, BadMatch, 0);
ev.type = ET_ProximityIn; _dix_test_xi_convert(&ev, BadMatch, 0);
ev.type = ET_ProximityOut; _dix_test_xi_convert(&ev, BadMatch, 0);
/* more than 6 axes → 2 valuator events */
SetBit(ev.valuators.mask, 0);
SetBit(ev.valuators.mask, 1);
SetBit(ev.valuators.mask, 2);
SetBit(ev.valuators.mask, 3);
SetBit(ev.valuators.mask, 4);
SetBit(ev.valuators.mask, 5);
SetBit(ev.valuators.mask, 6);
ev.type = ET_KeyPress; _dix_test_xi_convert(&ev, Success, 2);
ev.type = ET_KeyRelease; _dix_test_xi_convert(&ev, Success, 2);
ev.type = ET_ButtonPress; _dix_test_xi_convert(&ev, Success, 2);
ev.type = ET_ButtonRelease; _dix_test_xi_convert(&ev, Success, 2);
ev.type = ET_Motion; _dix_test_xi_convert(&ev, Success, 2);
ev.type = ET_ProximityIn; _dix_test_xi_convert(&ev, Success, 2);
ev.type = ET_ProximityOut; _dix_test_xi_convert(&ev, Success, 2);
/* keycode too high */
ev.type = ET_KeyPress;
ev.detail.key = 256;
_dix_test_xi_convert(&ev, Success, 0);
/* deviceid too high */
ev.type = ET_KeyPress;
ev.detail.key = 18;
ev.deviceid = 128;
_dix_test_xi_convert(&ev, Success, 0);
}
static void xi2_struct_sizes(void) static void xi2_struct_sizes(void)
{ {
#define compare(req) \ #define compare(req) \
@ -1080,6 +1218,7 @@ int main(int argc, char** argv)
g_test_add_func("/dix/input/attributes", dix_input_attributes); g_test_add_func("/dix/input/attributes", dix_input_attributes);
g_test_add_func("/dix/input/init-valuators", dix_init_valuators); g_test_add_func("/dix/input/init-valuators", dix_init_valuators);
g_test_add_func("/dix/input/event-core-conversion", dix_event_to_core_conversion); g_test_add_func("/dix/input/event-core-conversion", dix_event_to_core_conversion);
g_test_add_func("/dix/input/event-xi1-conversion", dix_event_to_xi1_conversion);
g_test_add_func("/dix/input/check-grab-values", dix_check_grab_values); g_test_add_func("/dix/input/check-grab-values", dix_check_grab_values);
g_test_add_func("/dix/input/xi2-struct-sizes", xi2_struct_sizes); g_test_add_func("/dix/input/xi2-struct-sizes", xi2_struct_sizes);
g_test_add_func("/dix/input/grab_matching", dix_grab_matching); g_test_add_func("/dix/input/grab_matching", dix_grab_matching);

View File

@ -185,7 +185,7 @@ static void test_XIQueryPointer(void)
request_XIQueryPointer(&client_request, &request, BadDevice); request_XIQueryPointer(&client_request, &request, BadDevice);
test_data.dev = devices.mouse; test_data.dev = devices.mouse;
devices.mouse->u.master = NULL; /* Float, kind-of */ devices.mouse->master = NULL; /* Float, kind-of */
request.deviceid = devices.mouse->id; request.deviceid = devices.mouse->id;
request_XIQueryPointer(&client_request, &request, Success); request_XIQueryPointer(&client_request, &request, Success);

View File

@ -145,7 +145,7 @@ static void test_XIWarpPointer(void)
request.deviceid = devices.kbd->id; request.deviceid = devices.kbd->id;
request_XIWarpPointer(&client_request, &request, BadDevice); request_XIWarpPointer(&client_request, &request, BadDevice);
devices.mouse->u.master = NULL; /* Float, kind-of */ devices.mouse->master = NULL; /* Float, kind-of */
request.deviceid = devices.mouse->id; request.deviceid = devices.mouse->id;
request_XIWarpPointer(&client_request, &request, Success); request_XIWarpPointer(&client_request, &request, Success);

View File

@ -1045,7 +1045,7 @@ XFixesCursorInit (void)
ScreenPtr pScreen = screenInfo.screens[i]; ScreenPtr pScreen = screenInfo.screens[i];
CursorScreenPtr cs; CursorScreenPtr cs;
cs = (CursorScreenPtr) malloc(sizeof (CursorScreenRec)); cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
if (!cs) if (!cs)
return FALSE; return FALSE;
Wrap (cs, pScreen, CloseScreen, CursorCloseScreen); Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);

View File

@ -426,34 +426,78 @@ XkbRF_RulesPtr rules;
return complete; return complete;
} }
XkbDescPtr static Bool
XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet *rmlvo) XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbComponentNamesPtr kccgst)
{ {
XkbComponentNamesRec kccgst;
XkbRF_VarDefsRec mlvo; XkbRF_VarDefsRec mlvo;
XkbDescPtr xkb;
char name[PATH_MAX];
if (!dev || !rmlvo) {
LogMessage(X_ERROR, "XKB: No device or RMLVO specified\n");
return NULL;
}
mlvo.model = rmlvo->model; mlvo.model = rmlvo->model;
mlvo.layout = rmlvo->layout; mlvo.layout = rmlvo->layout;
mlvo.variant = rmlvo->variant; mlvo.variant = rmlvo->variant;
mlvo.options = rmlvo->options; mlvo.options = rmlvo->options;
/* XDNFR already logs for us. */ return XkbDDXNamesFromRules(dev, rmlvo->rules, &mlvo, kccgst);
if (!XkbDDXNamesFromRules(dev, rmlvo->rules, &mlvo, &kccgst)) }
/**
* Compile the given RMLVO keymap and return it. Returns the XkbDescPtr on
* success or NULL on failure. If the components compiled are not a superset
* or equal to need, the compiliation is treated as failure.
*/
static XkbDescPtr
XkbCompileKeymapForDevice(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, int need)
{
XkbDescPtr xkb;
unsigned int provided;
XkbComponentNamesRec kccgst;
char name[PATH_MAX];
if (!XkbRMLVOtoKcCGST(dev, rmlvo, &kccgst))
return NULL; return NULL;
/* XDLKBN too, but it might return 0 as well as allocating. */ provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
if (!XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, 0, &xkb, name, &xkb, name, PATH_MAX);
PATH_MAX)) { if ((need & provided) != need) {
if (xkb) if (xkb) {
XkbFreeKeyboard(xkb, 0, TRUE); XkbFreeKeyboard(xkb, 0, TRUE);
return NULL; xkb = NULL;
}
}
return xkb;
}
XkbDescPtr
XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet *rmlvo)
{
XkbDescPtr xkb;
unsigned int need;
if (!dev || !rmlvo) {
LogMessage(X_ERROR, "XKB: No device or RMLVO specified\n");
return NULL;
}
/* These are the components we really really need */
need = XkmSymbolsMask | XkmCompatMapMask | XkmTypesMask |
XkmKeyNamesMask | XkmVirtualModsMask;
xkb = XkbCompileKeymapForDevice(dev, rmlvo, need);
if (!xkb) {
XkbRMLVOSet dflts;
/* we didn't get what we really needed. And that will likely leave
* us with a keyboard that doesn't work. Use the defaults instead */
LogMessage(X_ERROR, "XKB: Failed to load keymap. Loading default "
"keymap instead.\n");
XkbGetRulesDflts(&dflts);
xkb = XkbCompileKeymapForDevice(dev, &dflts, 0);
XkbFreeRMLVOSet(&dflts, FALSE);
} }
return xkb; return xkb;

View File

@ -3644,7 +3644,7 @@ register int n;
swapl(&rep->indicators,n); swapl(&rep->indicators,n);
} }
start = desc = malloc(length); start = desc = calloc(1, length);
if ( !start ) if ( !start )
return BadAlloc; return BadAlloc;
if (xkb->names) { if (xkb->names) {
@ -5569,13 +5569,13 @@ ProcXkbGetKbdByName(ClientPtr client)
{ {
DeviceIntPtr dev; DeviceIntPtr dev;
DeviceIntPtr tmpd; DeviceIntPtr tmpd;
xkbGetKbdByNameReply rep; xkbGetKbdByNameReply rep = {0};
xkbGetMapReply mrep; xkbGetMapReply mrep = {0};
xkbGetCompatMapReply crep; xkbGetCompatMapReply crep = {0};
xkbGetIndicatorMapReply irep; xkbGetIndicatorMapReply irep = {0};
xkbGetNamesReply nrep; xkbGetNamesReply nrep = {0};
xkbGetGeometryReply grep; xkbGetGeometryReply grep = {0};
XkbComponentNamesRec names; XkbComponentNamesRec names = {0};
XkbDescPtr xkb, new; XkbDescPtr xkb, new;
unsigned char * str; unsigned char * str;
char mapFile[PATH_MAX]; char mapFile[PATH_MAX];
@ -5883,12 +5883,10 @@ ProcXkbGetKbdByName(ClientPtr client)
nkn.changed|= XkbNKN_GeometryMask; nkn.changed|= XkbNKN_GeometryMask;
XkbSendNewKeyboardNotify(dev,&nkn); XkbSendNewKeyboardNotify(dev,&nkn);
if (!IsMaster(dev) && dev->u.master) if (!IsMaster(dev)) {
{ DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
DeviceIntPtr master = dev->u.master; if (master && master->lastSlave == dev) {
if (master->u.lastSlave == dev) XkbCopyDeviceKeymap(master, dev);
{
XkbCopyDeviceKeymap(dev->u.master, dev);
XkbSendNewKeyboardNotify(dev,&nkn); XkbSendNewKeyboardNotify(dev,&nkn);
} }
} }

View File

@ -694,7 +694,7 @@ ProcessInputProc backupproc;
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse); xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
DeviceEvent *event = &ev->device_event; DeviceEvent *event = &ev->device_event;
dev = (IsMaster(mouse) || mouse->u.master) ? GetMaster(mouse, MASTER_KEYBOARD) : mouse; dev = IsFloating(mouse) ? mouse : GetMaster(mouse, MASTER_KEYBOARD);
if (dev && dev->key) if (dev && dev->key)
{ {

View File

@ -1365,9 +1365,9 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, Valuat
if (IsMaster(dev)) { if (IsMaster(dev)) {
mpointer = GetMaster(dev, MASTER_POINTER); mpointer = GetMaster(dev, MASTER_POINTER);
lastSlave = mpointer->u.lastSlave; lastSlave = mpointer->lastSlave;
ptr = GetXTestDevice(mpointer); ptr = GetXTestDevice(mpointer);
} else if (!dev->u.master) } else if (IsFloating(dev))
ptr = dev; ptr = dev;
else else
return; return;
@ -1397,7 +1397,7 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
int gpe_flags = 0; int gpe_flags = 0;
/* ignore attached SDs */ /* ignore attached SDs */
if (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) != NULL) if (!IsMaster(dev) && !IsFloating(dev))
return; return;
if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY) if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
@ -1427,7 +1427,7 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
if (IsMaster(dev)) { if (IsMaster(dev)) {
DeviceIntPtr mpointer = GetMaster(dev, MASTER_POINTER); DeviceIntPtr mpointer = GetMaster(dev, MASTER_POINTER);
ptr = GetXTestDevice(mpointer); ptr = GetXTestDevice(mpointer);
} else if (!dev->u.master) } else if (IsFloating(dev))
ptr = dev; ptr = dev;
else else
return; return;