summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-02-23 08:44:42 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-02-23 08:44:42 +1000
commit579ee8f5d84c3a523b7b3e3941eabb226d1d19e2 (patch)
treea822eae1c534e6616aafad8e0139828c2d2b1fc1
parentb636893137da1695e235e3a9354bfd9243fdddc2 (diff)
parent17265ccb027e3f956bf7409106174f44621d1cb8 (diff)
Merge branch 'mi-cleanup' into next
-rw-r--r--Xi/exevents.c13
-rw-r--r--Xi/xichangehierarchy.c4
-rw-r--r--Xi/xipassivegrab.c10
-rw-r--r--Xi/xiproperty.c2
-rw-r--r--Xi/xiquerydevice.c4
-rw-r--r--Xi/xiquerypointer.c4
-rw-r--r--Xi/xiwarppointer.c2
-rw-r--r--configure.ac4
-rw-r--r--dix/devices.c39
-rw-r--r--dix/eventconvert.c16
-rw-r--r--dix/events.c23
-rw-r--r--dix/getevents.c15
-rw-r--r--dix/inpututils.c8
-rw-r--r--exa/exa_migration_mixed.c17
-rw-r--r--fb/Makefile.am4
-rw-r--r--glx/glxcmds.c31
-rw-r--r--glx/glxcmdsswap.c20
-rw-r--r--hw/xfree86/common/xf86Init.c2
-rw-r--r--hw/xfree86/common/xf86RandR.c37
-rw-r--r--hw/xfree86/common/xf86VidMode.c2
-rw-r--r--hw/xfree86/common/xf86xv.c210
-rw-r--r--hw/xfree86/common/xf86xv.h3
-rw-r--r--hw/xfree86/common/xf86xvpriv.h6
-rw-r--r--hw/xfree86/dri2/dri2.c2
-rw-r--r--hw/xfree86/fbdevhw/fbdevhw.c56
-rw-r--r--hw/xfree86/int10/helper_exec.c2
-rw-r--r--hw/xfree86/modes/xf86Crtc.c1
-rw-r--r--hw/xfree86/modes/xf86RandR12.c36
-rw-r--r--hw/xfree86/ramdac/xf86Cursor.c6
-rw-r--r--hw/xwin/winclipboardxevents.c3
-rw-r--r--hw/xwin/winconfig.c77
-rw-r--r--hw/xwin/winkeybd.c8
-rw-r--r--hw/xwin/winkeybd.h16
-rw-r--r--hw/xwin/winkeyhook.c4
-rw-r--r--hw/xwin/winkeynames.h13
-rw-r--r--hw/xwin/winlayouts.h8
-rw-r--r--include/dix.h1
-rw-r--r--include/exevents.h2
-rw-r--r--include/inputstr.h7
-rw-r--r--mi/midispcur.c2
-rw-r--r--mi/mieq.c18
-rw-r--r--mi/mipointer.c196
-rw-r--r--mi/mipointrst.h1
-rw-r--r--mi/misprite.c16
-rw-r--r--miext/damage/Makefile.am2
-rw-r--r--miext/rootless/Makefile.am1
-rw-r--r--miext/shadow/Makefile.am2
-rw-r--r--randr/rrdispatch.c2
-rw-r--r--randr/rrmode.c2
-rw-r--r--test/input.c139
-rw-r--r--test/xi2/protocol-xiquerypointer.c2
-rw-r--r--test/xi2/protocol-xiwarppointer.c2
-rw-r--r--xfixes/cursor.c2
-rw-r--r--xkb/ddxLoad.c76
-rw-r--r--xkb/xkb.c26
-rw-r--r--xkb/xkbAccessX.c2
-rw-r--r--xkb/xkbActions.c8
57 files changed, 790 insertions, 427 deletions
diff --git a/Xi/exevents.c b/Xi/exevents.c
index cf38967ba..c7089bb69 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -710,10 +710,13 @@ ChangeMasterDeviceClasses(DeviceIntPtr device, DeviceChangedEvent *dce)
if (rc != Success)
return; /* Device has disappeared */
- if (!slave->u.master)
+ if (IsMaster(slave))
+ return;
+
+ if (IsFloating(slave))
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 */
/* 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
*/
for (sd = inputInfo.devices; sd; sd = sd->next) {
- if (IsMaster(sd) || sd->u.master != device)
+ if (IsMaster(sd) || GetMaster(sd, MASTER_POINTER) != device)
continue;
if (!sd->button)
continue;
@@ -1006,7 +1009,7 @@ ProcessOtherEvent(InternalEvent *ev, DeviceIntPtr device)
b = device->button;
k = device->key;
- if (IsMaster(device) || !device->u.master)
+ if (IsMaster(device) || IsFloating(device))
CheckMotion(event, device);
switch (event->type)
@@ -1221,7 +1224,7 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
DeviceIntPtr mouse;
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 */
btlen = (mouse->button) ? bits_to_bytes(mouse->button->numButtons) : 0;
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 21c74ed7a..a3dcab57e 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -284,12 +284,12 @@ remove_master(ClientPtr client, xXIRemoveMasterInfo *r,
for (attached = inputInfo.devices; attached; attached = attached->next)
{
if (!IsMaster(attached)) {
- if (attached->u.master == ptr)
+ if (GetMaster(attached, MASTER_ATTACHED) == ptr)
{
AttachDevice(client, attached, newptr);
flags[attached->id] |= XISlaveAttached;
}
- if (attached->u.master == keybd)
+ if (GetMaster(attached, MASTER_ATTACHED) == keybd)
{
AttachDevice(client, attached, newkeybd);
flags[attached->id] |= XISlaveAttached;
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index e99b6e554..8663d12a1 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -162,10 +162,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
if (!modifiers_failed)
return BadAlloc;
- if (!IsMaster(dev) && dev->u.master)
- mod_dev = GetMaster(dev, MASTER_KEYBOARD);
- else
- mod_dev = dev;
+ mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
for (i = 0; i < stuff->num_modifiers; i++, modifiers++)
{
@@ -280,10 +277,7 @@ ProcXIPassiveUngrabDevice(ClientPtr client)
if (rc != Success)
return rc;
- if (!IsMaster(dev) && dev->u.master)
- mod_dev = GetMaster(dev, MASTER_KEYBOARD);
- else
- mod_dev = dev;
+ mod_dev = (IsFloating(dev)) ? dev : GetMaster(dev, MASTER_KEYBOARD);
tempGrab.resource = client->clientAsMask;
tempGrab.device = dev;
diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
index b9f53f7dc..17835e2cd 100644
--- a/Xi/xiproperty.c
+++ b/Xi/xiproperty.c
@@ -701,7 +701,7 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient)
int
XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type,
int format, int mode, unsigned long len,
- pointer value, Bool sendevent)
+ const pointer value, Bool sendevent)
{
XIPropertyPtr prop;
int size_in_bytes;
diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c
index fdd2c051d..8b5421130 100644
--- a/Xi/xiquerydevice.c
+++ b/Xi/xiquerydevice.c
@@ -375,7 +375,7 @@ SwapValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info)
int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
{
- DeviceIntPtr master = dev->u.master;
+ DeviceIntPtr master = GetMaster(dev, MASTER_ATTACHED);
int use;
if (IsMaster(dev))
@@ -383,7 +383,7 @@ int GetDeviceUse(DeviceIntPtr dev, uint16_t *attachment)
DeviceIntPtr paired = GetPairedDevice(dev);
use = IsPointerDevice(dev) ? XIMasterPointer : XIMasterKeyboard;
*attachment = (paired ? paired->id : 0);
- } else if (master)
+ } else if (!IsFloating(dev))
{
use = IsPointerDevice(master) ? XISlavePointer : XISlaveKeyboard;
*attachment = master->id;
diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
index b521c48ef..51317994b 100644
--- a/Xi/xiquerypointer.c
+++ b/Xi/xiquerypointer.c
@@ -93,7 +93,7 @@ ProcXIQueryPointer(ClientPtr client)
}
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;
return BadDevice;
@@ -129,7 +129,7 @@ ProcXIQueryPointer(ClientPtr client)
if (kbd)
{
- state = &kbd->key->xkbInfo->prev_state;
+ state = &kbd->key->xkbInfo->state;
rep.mods.base_mods = state->base_mods;
rep.mods.latched_mods = state->latched_mods;
rep.mods.locked_mods = state->locked_mods;
diff --git a/Xi/xiwarppointer.c b/Xi/xiwarppointer.c
index c01b115f3..a463ab94d 100644
--- a/Xi/xiwarppointer.c
+++ b/Xi/xiwarppointer.c
@@ -97,7 +97,7 @@ ProcXIWarpPointer(ClientPtr client)
return rc;
}
- if ((!IsMaster(pDev) && pDev->u.master) ||
+ if ((!IsMaster(pDev) && !IsFloating(pDev)) ||
(IsMaster(pDev) && !IsPointerDevice(pDev)))
{
client->errorValue = stuff->deviceid;
diff --git a/configure.ac b/configure.ac
index 9b3e2be2b..ac4bf8c74 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,8 +26,8 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.57)
-AC_INIT([xorg-server], 1.9.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2010-12-06"
+AC_INIT([xorg-server], 1.9.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2011-2-18"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
diff --git a/dix/devices.c b/dix/devices.c
index 3065319d0..293194726 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -446,7 +446,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
{
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);
flags[other->id] |= XISlaveDetached;
@@ -457,8 +457,8 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent)
{
for (other = inputInfo.devices; other; other = other->next)
{
- if (IsMaster(other) && other->u.lastSlave == dev)
- other->u.lastSlave = NULL;
+ if (IsMaster(other) && other->lastSlave == dev)
+ other->lastSlave = NULL;
}
}
@@ -987,8 +987,8 @@ CloseDownDevices(void)
*/
for (dev = inputInfo.devices; dev; dev = dev->next)
{
- if (!IsMaster(dev) && dev->u.master)
- dev->u.master = NULL;
+ if (!IsMaster(dev) && !IsFloating(dev))
+ dev->master = NULL;
}
CloseDeviceList(&inputInfo.devices);
@@ -1643,7 +1643,7 @@ ProcChangeKeyboardMapping(ClientPtr client)
stuff->keyCodes, NULL, client);
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
- if (IsMaster(tmp) || tmp->u.master != pDev)
+ if (IsMaster(tmp) || GetMaster(tmp, MASTER_KEYBOARD) != pDev)
continue;
if (!tmp->key)
continue;
@@ -2306,7 +2306,7 @@ RecalculateMasterButtons(DeviceIntPtr slave)
for (dev = inputInfo.devices; dev; dev = dev->next)
{
if (IsMaster(dev) ||
- dev->u.master != master ||
+ GetMaster(dev, MASTER_ATTACHED) != master ||
!dev->button)
continue;
@@ -2376,19 +2376,19 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
return BadDevice;
/* set from floating to floating? */
- if (!dev->u.master && !master && dev->enabled)
+ if (IsFloating(dev) && !master && dev->enabled)
return Success;
/* free the existing sprite. */
- if (!dev->u.master && dev->spriteInfo->paired == dev)
+ if (IsFloating(dev) && dev->spriteInfo->paired == dev)
{
screen = miPointerGetScreen(dev);
screen->DeviceCursorCleanup(dev, screen);
free(dev->spriteInfo->sprite);
}
- oldmaster = dev->u.master;
- dev->u.master = master;
+ oldmaster = GetMaster(dev, MASTER_ATTACHED);
+ dev->master = master;
/* 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,
@@ -2438,8 +2438,8 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
DeviceIntPtr
GetPairedDevice(DeviceIntPtr dev)
{
- if (!IsMaster(dev) && dev->u.master)
- dev = dev->u.master;
+ if (!IsMaster(dev) && !IsFloating(dev))
+ dev = GetMaster(dev, MASTER_ATTACHED);
return dev->spriteInfo->paired;
}
@@ -2452,7 +2452,10 @@ GetPairedDevice(DeviceIntPtr dev)
* returned master is either the device itself or the paired master device.
* 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
GetMaster(DeviceIntPtr dev, int which)
@@ -2462,9 +2465,9 @@ GetMaster(DeviceIntPtr dev, int which)
if (IsMaster(dev))
master = dev;
else
- master = dev->u.master;
+ master = dev->master;
- if (master)
+ if (master && which != MASTER_ATTACHED)
{
if (which == MASTER_KEYBOARD)
{
@@ -2517,7 +2520,7 @@ AllocDevicePair (ClientPtr client, char* name,
pointer->coreEvents = TRUE;
pointer->spriteInfo->spriteOwner = TRUE;
- pointer->u.lastSlave = NULL;
+ pointer->lastSlave = NULL;
pointer->last.slave = NULL;
pointer->type = (master) ? MASTER_POINTER : SLAVE;
@@ -2543,7 +2546,7 @@ AllocDevicePair (ClientPtr client, char* name,
keyboard->coreEvents = TRUE;
keyboard->spriteInfo->spriteOwner = FALSE;
- keyboard->u.lastSlave = NULL;
+ keyboard->lastSlave = NULL;
keyboard->last.slave = NULL;
keyboard->type = (master) ? MASTER_KEYBOARD : SLAVE;
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 897691946..760729beb 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -284,8 +284,20 @@ eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count)
num_events = (countValuators(ev, &first) + 5)/6; /* valuator ev */
if (num_events <= 0)
{
- *count = 0;
- return BadMatch;
+ switch (ev->type)
+ {
+ 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 */
diff --git a/dix/events.c b/dix/events.c
index de803f652..df62e839b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -328,6 +328,13 @@ IsMaster(DeviceIntPtr dev)
return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD;
}
+Bool
+IsFloating(DeviceIntPtr dev)
+{
+ return GetMaster(dev, MASTER_KEYBOARD) == NULL;
+}
+
+
/**
* Max event opcode.
*/
@@ -1397,10 +1404,10 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
static void
DetachFromMaster(DeviceIntPtr dev)
{
- if (!dev->u.master)
+ if (!IsFloating(dev))
return;
- dev->saved_master_id = dev->u.master->id;
+ dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id;
AttachDevice(NULL, dev, NULL);
}
@@ -2825,7 +2832,7 @@ WindowsRestructured(void)
DeviceIntPtr pDev = inputInfo.devices;
while(pDev)
{
- if (IsMaster(pDev) || !pDev->u.master)
+ if (IsMaster(pDev) || IsFloating(pDev))
CheckMotion(NULL, pDev);
pDev = pDev->next;
}
@@ -3256,15 +3263,15 @@ ProcWarpPointer(ClientPtr client)
dev = PickPointer(client);
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);
if (rc != Success)
return rc;
}
}
- if (dev->u.lastSlave)
- dev = dev->u.lastSlave;
+ if (dev->lastSlave)
+ dev = dev->lastSlave;
pSprite = dev->spriteInfo->sprite;
#ifdef PANORAMIX
@@ -3420,7 +3427,7 @@ CheckPassiveGrabsOnWindow(
* attached master keyboard. Since the slave may have been
* reattached after the grab, the modifier device may not be the
* same. */
- if (!IsMaster(grab->device) && device->u.master)
+ if (!IsMaster(grab->device) && !IsFloating(device))
gdev = GetMaster(device, MASTER_KEYBOARD);
}
@@ -4309,7 +4316,7 @@ DeviceEnterLeaveEvent(
if (BitIsOn(mouse->button->down, i))
SetBit(&event[1], i);
- kbd = (IsMaster(mouse) || mouse->u.master) ? GetPairedDevice(mouse) : NULL;
+ kbd = GetMaster(mouse, MASTER_KEYBOARD);
if (kbd && kbd->key)
{
event->mods.base_mods = kbd->key->xkbInfo->state.base_mods;
diff --git a/dix/getevents.c b/dix/getevents.c
index 794df420b..5b8e3798d 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -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
* co-ord space limit). If it is attached, we need x/y to go over the
* 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)
clipAxis(dev, 0, x);
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. */
miPointerSetPosition(dev, screenx, screeny);
- if (dev->u.master) {
- dev->u.master->last.valuators[0] = *screenx;
- dev->u.master->last.valuators[1] = *screeny;
- dev->u.master->last.remainder[0] = *screenx_frac;
- dev->u.master->last.remainder[1] = *screeny_frac;
+ if(!IsMaster(dev) || !IsFloating(dev)) {
+ DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
+ master->last.valuators[0] = *screenx;
+ master->last.valuators[1] = *screeny;
+ master->last.remainder[0] = *screenx_frac;
+ master->last.remainder[1] = *screeny_frac;
}
if (dev->valuator)
@@ -911,7 +912,7 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
return;
updateMotionHistory(dev, ms, mask, dev->last.valuators);
- if (dev->u.master)
+ if(!IsMaster(dev) || !IsFloating(dev))
{
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
updateMotionHistory(master, ms, mask, dev->last.valuators);
diff --git a/dix/inpututils.c b/dix/inpututils.c
index ef3142c84..077ffce01 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -268,15 +268,15 @@ change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap,
/* Change any attached masters/slaves. */
if (IsMaster(dev)) {
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))
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 (check_modmap_change(client, dev->u.master, modmap))
- do_modmap_change(client, dev->u.master, modmap);
+ if (check_modmap_change(client, dev->master, modmap))
+ do_modmap_change(client, dev->master, modmap);
}
return Success;
diff --git a/exa/exa_migration_mixed.c b/exa/exa_migration_mixed.c
index 4f49905d3..fb4715135 100644
--- a/exa/exa_migration_mixed.c
+++ b/exa/exa_migration_mixed.c
@@ -138,7 +138,6 @@ void
exaDamageReport_mixed(DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
PixmapPtr pPixmap = closure;
- ScreenPtr pScreen = pPixmap->drawable.pScreen;
ExaPixmapPriv(pPixmap);
/* 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)) {
ExaScreenPriv(pPixmap->drawable.pScreen);
- /* Front buffer: Don't wait for the block handler to copy back the data.
- * This avoids annoying latency if you encounter a lot of software rendering.
- */
- if (pPixmap == pScreen->GetScreenPixmap(pScreen))
- 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;
- }
+ if (pExaScr->deferred_mixed_pixmap &&
+ pExaScr->deferred_mixed_pixmap != pPixmap)
+ exaMoveInPixmap_mixed(pExaScr->deferred_mixed_pixmap);
+ pExaScr->deferred_mixed_pixmap = pPixmap;
}
}
diff --git a/fb/Makefile.am b/fb/Makefile.am
index f9f34c44c..89f3babb1 100644
--- a/fb/Makefile.am
+++ b/fb/Makefile.am
@@ -1,9 +1,5 @@
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)
if XORG
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 3ef567d10..9b4bc9ec3 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -1132,7 +1132,8 @@ int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
{
ClientPtr client = cl->client;
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);
}
@@ -1356,7 +1357,9 @@ int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client;
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);
}
@@ -1436,7 +1439,7 @@ int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client;
xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
- REQUEST_SIZE_MATCH(xGLXCreateGLXPbufferSGIXReq);
+ REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
return DoCreatePbuffer(cl->client, req->screen, req->fbconfig,
req->width, req->height, req->pbuffer);
@@ -1498,7 +1501,13 @@ int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
client->errorValue = req->numAttribs;
return BadValue;
}
+#if 0
+ /* mesa sends an additional 8 bytes */
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,
req->numAttribs, (CARD32 *) (req + 1));
@@ -1563,7 +1572,8 @@ int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client;
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);
}
@@ -1697,13 +1707,21 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
GLXDrawable drawId;
int buffer;
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;
drawId = *((CARD32 *) (pc));
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)
return __glXError(GLXBadPixmap);
@@ -1864,7 +1882,8 @@ int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
ClientPtr client = cl->client;
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);
}
diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c
index 3bb4cade9..76e6fb629 100644
--- a/glx/glxcmdsswap.c
+++ b/glx/glxcmdsswap.c
@@ -279,7 +279,7 @@ int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc)
xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXGetFBConfigsSGIXReq);
+ REQUEST_AT_LEAST_SIZE(xGLXGetFBConfigsSGIXReq);
__GLX_SWAP_INT(&req->screen);
return __glXDisp_GetFBConfigsSGIX(cl, pc);
@@ -368,7 +368,7 @@ int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc)
xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq);
+ REQUEST_AT_LEAST_SIZE(xGLXDestroyGLXPixmapReq);
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->glxpixmap);
@@ -421,7 +421,7 @@ int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc)
xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXCreateGLXPbufferSGIXReq);
+ REQUEST_AT_LEAST_SIZE(xGLXCreateGLXPbufferSGIXReq);
__GLX_SWAP_INT(&req->screen);
__GLX_SWAP_INT(&req->fbconfig);
@@ -476,7 +476,9 @@ int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
client->errorValue = req->numAttribs;
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);
__GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1);
@@ -542,7 +544,7 @@ int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc)
xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXDestroyWindowReq);
+ REQUEST_AT_LEAST_SIZE(xGLXDestroyWindowReq);
__GLX_SWAP_INT(&req->glxwindow);
@@ -648,19 +650,23 @@ int __glXDispSwap_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc)
xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc;
GLXDrawable *drawId;
int *buffer;
+ CARD32 *num_attribs;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8);
+ if ((sizeof(xGLXVendorPrivateReq) + 12) >> 2 > client->req_len)
+ return BadLength;
pc += __GLX_VENDPRIV_HDR_SIZE;
drawId = ((GLXDrawable *) (pc));
buffer = ((int *) (pc + 4));
+ num_attribs = ((CARD32 *) (pc + 8));
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->contextTag);
__GLX_SWAP_INT(drawId);
__GLX_SWAP_INT(buffer);
+ __GLX_SWAP_INT(num_attribs);
return __glXDisp_BindTexImageEXT(cl, (GLbyte *)pc);
}
@@ -738,7 +744,7 @@ int __glXDispSwap_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc;
__GLX_DECLARE_SWAP_VARIABLES;
- REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesReq);
+ REQUEST_AT_LEAST_SIZE(xGLXGetDrawableAttributesReq);
__GLX_SWAP_SHORT(&req->length);
__GLX_SWAP_INT(&req->drawable);
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index a1fda54cd..e664ce451 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -808,7 +808,7 @@ InitInput(int argc, char **argv)
GetEventList(&xf86Events);
- /* Call the PreInit function for each input device instance. */
+ /* Initialize all configured input devices */
for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
/* Replace obsolete keyboard driver with kbd */
if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
diff --git a/hw/xfree86/common/xf86RandR.c b/hw/xfree86/common/xf86RandR.c
index d7ffff4ca..4663d0366 100644
--- a/hw/xfree86/common/xf86RandR.c
+++ b/hw/xfree86/common/xf86RandR.c
@@ -242,11 +242,20 @@ xf86RandRSetConfig (ScreenPtr pScreen,
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
- int px, py;
+ int pos[MAXDEVICES][2];
Bool useVirtual = FALSE;
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)
{
if (mode->HDisplay == pSize->width &&
@@ -303,17 +312,31 @@ xf86RandRSetConfig (ScreenPtr pScreen,
}
return FALSE;
}
+
/*
* 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);
- py = (py >= pScreen->height ? (pScreen->height - 1) : py);
+ if (!IsMaster(dev) && !IsFloating(dev))
+ 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;
diff --git a/hw/xfree86/common/xf86VidMode.c b/hw/xfree86/common/xf86VidMode.c
index 1788fa192..4dd454d8b 100644
--- a/hw/xfree86/common/xf86VidMode.c
+++ b/hw/xfree86/common/xf86VidMode.c
@@ -634,7 +634,7 @@ VidModeSetModeValue(pointer mode, int valtyp, int val)
vidMonitorValue
VidModeGetMonitorValue(pointer monitor, int valtyp, int indx)
{
- vidMonitorValue ret;
+ vidMonitorValue ret = { NULL, };
switch (valtyp) {
case VIDMODE_MON_VENDOR:
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 016db1f04..53ebe8f88 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -97,8 +97,11 @@ static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
static Bool xf86XVDestroyWindow(WindowPtr pWin);
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);
+#define PostValidateTreeUndefined ((PostValidateTreeProcPtr)-1)
+
/* ScrnInfoRec functions */
static Bool xf86XVEnterVT(int, int);
@@ -280,10 +283,9 @@ xf86XVScreenInit(
pScrn = xf86Screens[pScreen->myNum];
- ScreenPriv->videoGC = NULL; /* for the helper */
-
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
ScreenPriv->WindowExposures = pScreen->WindowExposures;
+ ScreenPriv->PostValidateTree = PostValidateTreeUndefined;
ScreenPriv->ClipNotify = pScreen->ClipNotify;
ScreenPriv->EnterVT = pScrn->EnterVT;
ScreenPriv->LeaveVT = pScrn->LeaveVT;
@@ -333,6 +335,8 @@ xf86XVFreeAdaptor(XvAdaptorPtr pAdaptor)
RegionDestroy(pPriv->clientClip);
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
RegionDestroy(pPriv->pCompositeClip);
+ if (pPriv->ckeyFilled)
+ RegionDestroy(pPriv->ckeyFilled);
free(pPriv);
}
}
@@ -1018,7 +1022,6 @@ static void
xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
{
XF86XVWindowPtr winPriv, prevPriv = NULL;
-
winPriv = GET_XF86XV_WINDOW(pWin);
while(winPriv) {
@@ -1035,6 +1038,11 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
winPriv = winPriv->next;
}
portPriv->pDraw = NULL;
+ if (portPriv->ckeyFilled) {
+ RegionDestroy(portPriv->ckeyFilled);
+ portPriv->ckeyFilled = NULL;
+ }
+ portPriv->clipChanged = FALSE;
}
static void
@@ -1069,7 +1077,7 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
}
static void
-xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
+xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
{
ScreenPtr pScreen = pScrn->pScreen;
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
@@ -1087,6 +1095,9 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
if (pPriv->isOn == XV_OFF || !pWin)
continue;
+ if (onlyChanged && !pPriv->clipChanged)
+ continue;
+
visible = pWin->visibility == VisibilityUnobscured ||
pWin->visibility == VisibilityPartiallyObscured;
@@ -1098,6 +1109,8 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
visible = FALSE;
xf86XVReputOrStopPort(pPriv, pWin, visible);
+
+ pPriv->clipChanged = FALSE;
}
}
}
@@ -1123,9 +1136,6 @@ xf86XVDestroyWindow(WindowPtr pWin)
pPriv->pDraw = NULL;
tmp = WinPriv;
- if(WinPriv->pGC) {
- FreeGC(WinPriv->pGC, 0);
- }
WinPriv = WinPriv->next;
free(tmp);
}
@@ -1139,6 +1149,29 @@ xf86XVDestroyWindow(WindowPtr pWin)
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
xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
@@ -1170,12 +1203,28 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
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;
xf86XVReputOrStopPort(pPriv, pWin, visible);
+
+ pPriv->clipChanged = FALSE;
}
}
-
static void
xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
{
@@ -1185,9 +1234,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
XvPortRecPrivatePtr pPriv;
while(WinPriv) {
- Bool visible = pWin->visibility == VisibilityUnobscured ||
- pWin->visibility == VisibilityPartiallyObscured;
-
pPriv = WinPriv->PortRec;
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
@@ -1199,15 +1245,14 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
(*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr,
pWin, dx, dy);
- /*
- * Stop and remove still/images if
- * ReputImage isn't supported.
- */
- if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
- visible = FALSE;
+ pPriv->clipChanged = TRUE;
+
+ if (ScreenPriv->PostValidateTree == PostValidateTreeUndefined) {
+ ScreenPriv->PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = xf86XVPostValidateTree;
+ }
WinPriv = WinPriv->next;
- xf86XVReputOrStopPort(pPriv, pWin, visible);
}
if(ScreenPriv->ClipNotify) {
@@ -1232,11 +1277,6 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
if(!ScreenPriv) return TRUE;
- if(ScreenPriv->videoGC) {
- FreeGC(ScreenPriv->videoGC, 0);
- ScreenPriv->videoGC = NULL;
- }
-
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
pScreen->WindowExposures = ScreenPriv->WindowExposures;
pScreen->ClipNotify = ScreenPriv->ClipNotify;
@@ -1345,7 +1385,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
pScrn->AdjustFrame = xf86XVAdjustFrame;
}
- xf86XVReputOrStopAllPorts(pScrn);
+ xf86XVReputOrStopAllPorts(pScrn, FALSE);
}
static void
@@ -1366,7 +1406,7 @@ xf86XVModeSet(ScrnInfoPtr pScrn)
pScrn->ModeSet = xf86XVModeSet;
}
- xf86XVReputOrStopAllPorts(pScrn);
+ xf86XVReputOrStopAllPorts(pScrn, FALSE);
}
/**** XvAdaptorRec fields ****/
@@ -1869,92 +1909,92 @@ xf86XVQueryImageAttributes(
format->id, width, height, pitches, offsets);
}
-
void
-xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
+xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
{
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];
- BoxPtr pbox = RegionRects(clipboxes);
- int i, nbox = RegionNumRects(clipboxes);
+ BoxPtr pbox = RegionRects(fillboxes);
+ int i, nbox = RegionNumRects(fillboxes);
xRectangle *rects;
GCPtr gc;
if(!xf86Screens[pScreen->myNum]->vtSema) return;
- gc = GetScratchGC(root->depth, pScreen);
+ gc = GetScratchGC(pDraw->depth, pScreen);
pval[0].val = key;
pval[1].val = IncludeInferiors;
(void) ChangeGC(NullClient, gc, GCForeground|GCSubwindowMode, pval);
- ValidateGC(root, gc);
+ ValidateGC(pDraw, gc);
rects = malloc(nbox * sizeof(xRectangle));
for(i = 0; i < nbox; i++, pbox++)
{
- rects[i].x = pbox->x1;
- rects[i].y = pbox->y1;
+ rects[i].x = pbox->x1 - pDraw->x;
+ rects[i].y = pbox->y1 - pDraw->y;
rects[i].width = pbox->x2 - pbox->x1;
rects[i].height = pbox->y2 - pbox->y1;
}
- (*gc->ops->PolyFillRect)(root, gc, nbox, rects);
+ (*gc->ops->PolyFillRect)(pDraw, gc, nbox, rects);
free(rects);
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 -
Takes the dst box in standard X BoxRec form (top and left
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index 47061fed2..f0d8495c6 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -244,6 +244,9 @@ xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
extern _X_EXPORT void
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
xf86XVClipVideoHelper(
BoxPtr dst,
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index 88e7a0e59..2a459f1b4 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -40,10 +40,10 @@ typedef struct {
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify;
WindowExposuresProcPtr WindowExposures;
+ PostValidateTreeProcPtr PostValidateTree;
void (*AdjustFrame)(int, int, int, int);
Bool (*EnterVT)(int, int);
void (*LeaveVT)(int, int);
- GCPtr videoGC;
xf86ModeSetProc *ModeSet;
} XF86XVScreenRec, *XF86XVScreenPtr;
@@ -69,11 +69,12 @@ typedef struct {
unsigned char type;
unsigned int subWindowMode;
RegionPtr clientClip;
+ RegionPtr ckeyFilled;
RegionPtr pCompositeClip;
Bool FreeCompositeClip;
XvAdaptorRecPrivatePtr AdaptorRec;
XvStatus isOn;
- Bool moved;
+ Bool clipChanged;
int vid_x, vid_y, vid_w, vid_h;
int drw_x, drw_y, drw_w, drw_h;
DevUnion DevPriv;
@@ -82,7 +83,6 @@ typedef struct {
typedef struct _XF86XVWindowRec{
XvPortRecPrivatePtr PortRec;
struct _XF86XVWindowRec *next;
- GCPtr pGC;
} XF86XVWindowRec, *XF86XVWindowPtr;
#endif /* _XF86XVPRIV_H_ */
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 39996f946..9ca378fed 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -403,7 +403,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int *height,
&& (pDraw->height == pPriv->height)
&& (pPriv->serialNumber == DRI2DrawableSerial(pDraw));
- buffers = malloc((count + 1) * sizeof(buffers[0]));
+ buffers = calloc((count + 1), sizeof(buffers[0]));
for (i = 0; i < count; i++) {
const unsigned attachment = *(attachments++);
diff --git a/hw/xfree86/fbdevhw/fbdevhw.c b/hw/xfree86/fbdevhw/fbdevhw.c
index a5b59e762..17fba36d0 100644
--- a/hw/xfree86/fbdevhw/fbdevhw.c
+++ b/hw/xfree86/fbdevhw/fbdevhw.c
@@ -264,14 +264,7 @@ fbdev_open_pci(struct pci_device * pPci, char **namep)
{
struct fb_fix_screeninfo fix;
char filename[256];
- int fd,i,j;
-
-
- /* 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*"
- */
+ int fd, i;
for (i = 0; i < 8; i++) {
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)
*namep = NULL;
- xf86DrvMsg(-1, X_ERROR,
- "Unable to find a valid framebuffer device\n");
+ xf86DrvMsg(-1, X_ERROR, "Unable to find a valid framebuffer device\n");
return -1;
}
diff --git a/hw/xfree86/int10/helper_exec.c b/hw/xfree86/int10/helper_exec.c
index b9af473b1..ec8420040 100644
--- a/hw/xfree86/int10/helper_exec.c
+++ b/hw/xfree86/int10/helper_exec.c
@@ -504,7 +504,7 @@ pciCfg1in(CARD16 addr, CARD32 *val)
}
if (addr == 0xCFC) {
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())
ErrorF(" cfg_inl(%#lx) = %8.8lx\n", PciCfg1Addr, *val);
return 1;
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 47d3ad14c..b5e9dc26f 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1542,7 +1542,6 @@ struct det_monrec_parameter {
static void handle_detailed_monrec(struct detailed_monitor_section *det_mon,
void *data)
{
- enum { sync_config, sync_edid, sync_default };
struct det_monrec_parameter *p;
p = (struct det_monrec_parameter *)data;
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 407bf3567..82d180bb0 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -584,10 +584,12 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
ScrnInfoPtr scrp = XF86SCRNINFO(pScreen);
XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen);
DisplayModePtr mode;
- int px, py;
+ int pos[MAXDEVICES][2];
Bool useVirtual = FALSE;
int maxX = 0, maxY = 0;
Rotation oldRotation = randrp->rotation;
+ DeviceIntPtr dev;
+ Bool view_adjusted = FALSE;
randrp->rotation = rotation;
@@ -597,7 +599,14 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
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)
{
if (randrp->maxX == 0 || randrp->maxY == 0)
@@ -643,15 +652,28 @@ xf86RandR12SetConfig (ScreenPtr pScreen,
/*
* 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);
- py = (py >= pScreen->height ? (pScreen->height - 1) : py);
+ if (!IsMaster(dev) && !IsFloating(dev))
+ 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;
diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
index ec781aad8..24c91cc37 100644
--- a/hw/xfree86/ramdac/xf86Cursor.c
+++ b/hw/xfree86/ramdac/xf86Cursor.c
@@ -317,8 +317,7 @@ xf86CursorSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs,
/* only update for VCP, otherwise we get cursor jumps when removing a
sprite. The second cursor is never HW rendered anyway. */
- if (pDev == inputInfo.pointer ||
- (!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
+ if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
{
pCurs->refcnt++;
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
when removing a sprite. The second sprite is never HW rendered anyway */
- if (pDev == inputInfo.pointer ||
- (!IsMaster(pDev) && pDev->u.master == inputInfo.pointer))
+ if (GetMaster(pDev, MASTER_POINTER) == inputInfo.pointer)
{
ScreenPriv->x = x;
ScreenPriv->y = y;
diff --git a/hw/xwin/winclipboardxevents.c b/hw/xwin/winclipboardxevents.c
index 2f042fd0b..8b502b117 100644
--- a/hw/xwin/winclipboardxevents.c
+++ b/hw/xwin/winclipboardxevents.c
@@ -789,6 +789,9 @@ winClipboardFlushXEvents (HWND hwnd,
case PropertyNotify:
break;
+ case MappingNotify:
+ break;
+
default:
ErrorF ("winClipboardFlushXEvents - unexpected event type %d\n", event.type);
break;
diff --git a/hw/xwin/winconfig.c b/hw/xwin/winconfig.c
index 758c54d89..76bf8e2de 100644
--- a/hw/xwin/winconfig.c
+++ b/hw/xwin/winconfig.c
@@ -240,6 +240,7 @@ Bool
winConfigKeyboard (DeviceIntPtr pDevice)
{
char layoutName[KL_NAMELENGTH];
+ unsigned char layoutFriendlyName[256];
static unsigned int layoutNum = 0;
int keyboardType;
#ifdef XWIN_XF86CONFIG
@@ -299,11 +300,32 @@ winConfigKeyboard (DeviceIntPtr pDevice)
if (LoadKeyboardLayout("00000409", KLF_ACTIVATE) != NULL)
winMsg (X_INFO, "Loading US keyboard layout.\n");
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++)
{
@@ -311,46 +333,35 @@ winConfigKeyboard (DeviceIntPtr pDevice)
continue;
if (pLayout->winkbtype > 0 && pLayout->winkbtype != keyboardType)
continue;
-
+
bfound = TRUE;
winMsg (X_PROBED,
- "Using preset keyboard for \"%s\" (%x), type \"%d\"\n",
- pLayout->layoutname, pLayout->winlayout, keyboardType);
-
+ "Found matching XKB configuration \"%s\"\n",
+ 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.layout = pLayout->xkblayout;
g_winInfo.xkb.variant = pLayout->xkbvariant;
- g_winInfo.xkb.options = pLayout->xkboptions;
+ g_winInfo.xkb.options = pLayout->xkboptions;
+
+
break;
}
-
+
if (!bfound)
{
- HKEY regkey = NULL;
- 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);
+ winMsg (X_ERROR, "Keyboardlayout \"%s\" (%s) is unknown, using X server default layout\n", layoutFriendlyName, layoutName);
}
- }
-
+ }
+
/* parse the configuration */
#ifdef XWIN_XF86CONFIG
if (g_cmdline.keyboard)
diff --git a/hw/xwin/winkeybd.c b/hw/xwin/winkeybd.c
index 83fea21cd..9e5a9b02a 100644
--- a/hw/xwin/winkeybd.c
+++ b/hw/xwin/winkeybd.c
@@ -73,6 +73,8 @@ winTranslateKey (WPARAM wParam, LPARAM lParam, int *piScanCode)
int iParam = HIWORD (lParam);
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
* scan code.
*
@@ -488,10 +490,8 @@ winSendKeyEvent (DWORD dwKey, Bool fDown)
for (i = 0; i < nevents; i++)
mieqEnqueue(g_pwinKeyboard, (InternalEvent*)events[i].event);
-#if CYGDEBUG
- ErrorF("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n",
- dwKey, fDown, nevents);
-#endif
+ winDebug("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n",
+ dwKey, fDown, nevents);
}
BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam)
diff --git a/hw/xwin/winkeybd.h b/hw/xwin/winkeybd.h
index 5b2a5892f..4e4c35c37 100644
--- a/hw/xwin/winkeybd.h
+++ b/hw/xwin/winkeybd.h
@@ -216,13 +216,13 @@ g_iKeyMap [] = {
/* 170 */ 0, 0, 0,
/* 171 */ 0, 0, 0,
/* 172 */ 0, 0, 0,
- /* 173 */ 0, 0, 0,
- /* 174 */ 0, 0, 0,
- /* 175 */ 0, 0, 0,
- /* 176 */ 0, 0, 0,
- /* 177 */ 0, 0, 0,
- /* 178 */ 0, 0, 0,
- /* 179 */ 0, 0, 0,
+ /* 173 */ VK_VOLUME_MUTE, 0, KEY_Mute,
+ /* 174 */ VK_VOLUME_DOWN, 0, KEY_AudioLower,
+ /* 175 */ VK_VOLUME_UP, 0, KEY_AudioRaise,
+ /* 176 */ VK_MEDIA_NEXT_TRACK, 0, KEY_NEXTSONG,
+ /* 177 */ VK_MEDIA_PREV_TRACK, 0, KEY_PREVIOUSSONG,
+ /* 178 */ VK_MEDIA_STOP, 0, KEY_STOPCD,
+ /* 179 */ VK_MEDIA_PLAY_PAUSE, 0, KEY_PLAYPAUSE,
/* 180 */ 0, 0, 0,
/* 181 */ 0, 0, 0,
/* 182 */ 0, 0, 0,
@@ -266,7 +266,7 @@ g_iKeyMap [] = {
/* 220 */ 0, 0, 0,
/* 221 */ 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,
/* 225 */ 0, 0, 0,
/* 226 */ 0, 0, 0,
diff --git a/hw/xwin/winkeyhook.c b/hw/xwin/winkeyhook.c
index fe1156dcf..cbee7cbda 100644
--- a/hw/xwin/winkeyhook.c
+++ b/hw/xwin/winkeyhook.c
@@ -88,9 +88,7 @@ winKeyboardMessageHookLL (int iCode, WPARAM wParam, LPARAM lParam)
/* Pass keystrokes on to our main message loop */
if (iCode == HC_ACTION)
{
-#if 0
- ErrorF ("vkCode: %08x\tscanCode: %08x\n", p->vkCode, p->scanCode);
-#endif
+ winDebug("winKeyboardMessageHook: vkCode: %08x scanCode: %08x\n", p->vkCode, p->scanCode);
switch (wParam)
{
diff --git a/hw/xwin/winkeynames.h b/hw/xwin/winkeynames.h
index 3d5938348..914016a76 100644
--- a/hw/xwin/winkeynames.h
+++ b/hw/xwin/winkeynames.h
@@ -23,10 +23,6 @@
*
*/
-#define XK_TECHNICAL
-#define XK_KATAKANA
-#include <X11/keysym.h>
-
#define GLYPHS_PER_KEY 4
#define NUM_KEYCODES 248
#define MIN_KEYCODE 8
@@ -194,6 +190,15 @@
#define KEY_HKTG /* Hirugana/Katakana tog 0xc8 */ 200
#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. */
#define KEY_NOTUSED 0
#define KEY_UNKNOWN 255
diff --git a/hw/xwin/winlayouts.h b/hw/xwin/winlayouts.h
index 9500689bc..ce502a005 100644
--- a/hw/xwin/winlayouts.h
+++ b/hw/xwin/winlayouts.h
@@ -55,13 +55,15 @@ WinKBLayoutRec winKBLayouts[] =
{ 0x00010409, -1, "pc105", "dvorak", NULL, NULL, "English (USA,Dvorak)"},
{ 0x00020409, -1, "pc105", "us_intl", NULL, NULL, "English (USA,International)"},
{ 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"},
{ 0x0000040a, -1, "pc105", "es", NULL, NULL, "Spanish (Spain,Traditional Sort)"},
{ 0x0000080a, -1, "pc105", "latam", NULL, NULL, "Latin American"},
{ 0x0000040b, -1, "pc105", "fi", NULL, NULL, "Finnish"},
{ 0x0000040c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"},
{ 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)"},
{ 0x0000040d, -1, "pc105", "il", NULL, NULL, "Hebrew"},
{ 0x0000040e, -1, "pc105", "hu", NULL, NULL, "Hungarian"},
@@ -79,6 +81,8 @@ WinKBLayoutRec winKBLayouts[] =
{ 0x00000816, -1, "pc105", "pt", NULL, NULL, "Portuguese (Portugal)"},
{ 0x0000041a, -1, "pc105", "hr", NULL, NULL, "Croatian"},
{ 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"},
{ 0x00000425, -1, "pc105", "ee", NULL, NULL, "Estonian"},
{ 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
for a listing of input locale (keyboard layout) codes
*/
-
-
diff --git a/include/dix.h b/include/dix.h
index 12e4b5977..3f99098a2 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -570,6 +570,7 @@ extern Bool _X_EXPORT IsPointerDevice( DeviceIntPtr dev);
extern Bool _X_EXPORT IsKeyboardDevice(DeviceIntPtr dev);
extern Bool IsPointerEvent(InternalEvent *event);
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 int CorePointerProc(DeviceIntPtr dev, int what);
diff --git a/include/exevents.h b/include/exevents.h
index dc594304f..2b226986b 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -69,7 +69,7 @@ extern _X_EXPORT int XIChangeDeviceProperty(
int /* format*/,
int /* mode*/,
unsigned long /* len*/,
- pointer /* value*/,
+ const pointer /* value*/,
Bool /* sendevent*/
);
diff --git a/include/inputstr.h b/include/inputstr.h
index 65b9ef9f4..8509eb024 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -494,6 +494,7 @@ typedef struct _SpriteInfoRec {
#define MASTER_POINTER 1
#define MASTER_KEYBOARD 2
#define SLAVE 3
+#define MASTER_ATTACHED 4 /* special type for GetMaster */
typedef struct _DeviceIntRec {
DeviceRec public;
@@ -530,10 +531,8 @@ typedef struct _DeviceIntRec {
PrivateRec *devPrivates;
DeviceUnwrapProc unwrapProc;
SpriteInfoPtr spriteInfo;
- union {
- DeviceIntPtr master; /* master device */
- DeviceIntPtr lastSlave; /* last slave device used */
- } u;
+ DeviceIntPtr master; /* master device */
+ DeviceIntPtr lastSlave; /* last slave device used */
/* last valuator values recorded, not posted to client;
* for slave devices, valuators is in device coordinates
diff --git a/mi/midispcur.c b/mi/midispcur.c
index 48feb8823..9b3e87a57 100644
--- a/mi/midispcur.c
+++ b/mi/midispcur.c
@@ -76,7 +76,7 @@ typedef struct {
#define miGetDCDevice(dev, screen) \
((DevHasCursor(dev)) ? \
(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
diff --git a/mi/mieq.c b/mi/mieq.c
index 01da52a6c..08a0c8758 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -321,11 +321,12 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
DeviceIntPtr mdev;
int len = original->any.length;
int type = original->any.type;
+ int mtype; /* which master type? */
CHECKEVENT(original);
/* ET_XQuartz has sdev == NULL */
- if (!sdev || !sdev->u.master)
+ if (!sdev || IsMaster(sdev) || IsFloating(sdev))
return NULL;
#if XFreeXDGA
@@ -337,20 +338,21 @@ CopyGetMasterEvent(DeviceIntPtr sdev,
{
case ET_KeyPress:
case ET_KeyRelease:
- mdev = GetMaster(sdev, MASTER_KEYBOARD);
+ mtype = MASTER_KEYBOARD;
break;
case ET_ButtonPress:
case ET_ButtonRelease:
case ET_Motion:
case ET_ProximityIn:
case ET_ProximityOut:
- mdev = GetMaster(sdev, MASTER_POINTER);
+ mtype = MASTER_POINTER;
break;
default:
- mdev = sdev->u.master;
+ mtype = MASTER_ATTACHED;
break;
}
+ mdev = GetMaster(sdev, mtype);
memcpy(copy, original, len);
ChangeDeviceID(mdev, copy);
FixUpEventForMaster(mdev, sdev, original, copy);
@@ -400,7 +402,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
master = CopyGetMasterEvent(dev, event, &mevent);
if (master)
- master->u.lastSlave = dev;
+ master->lastSlave = dev;
/* If someone's registered a custom event handler, let them
* steal it. */
@@ -410,7 +412,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
handler(screenNum, event, dev);
/* Check for the SD's master in case the device got detached
* during event processing */
- if (master && dev->u.master)
+ if (master && !IsFloating(dev))
handler(screenNum, &mevent, master);
} else
{
@@ -419,7 +421,7 @@ mieqProcessDeviceEvent(DeviceIntPtr dev,
/* Check for the SD's master in case the device got detached
* during event processing */
- if (master && dev->u.master)
+ if (master && !IsFloating(dev))
master->public.processInputProc(&mevent, master);
}
}
@@ -466,7 +468,7 @@ mieqProcessInputEvents(void)
pthread_mutex_unlock(&miEventQueueMutex);
#endif
- master = (dev && !IsMaster(dev) && dev->u.master) ? dev->u.master : NULL;
+ master = (dev) ? GetMaster(dev, MASTER_ATTACHED) : NULL;
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 554397a3b..209ea06be 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -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.
*/
+/**
+ * @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
#include <dix-config.h>
#endif
@@ -50,7 +73,7 @@ DevPrivateKeyRec miPointerScreenKeyRec;
DevPrivateKeyRec miPointerPrivKeyRec;
#define MIPOINTER(dev) \
- ((!IsMaster(dev) && !dev->u.master) ? \
+ (IsFloating(dev) ? \
(miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \
(miPointerPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miPointerPrivKey))
@@ -126,36 +149,17 @@ miPointerInitialize (ScreenPtr pScreen,
return TRUE;
}
+/**
+ * Destroy screen-specific information.
+ *
+ * @param index Screen index of the screen in screenInfo.screens[]
+ * @param pScreen The actual screen pointer
+ */
static Bool
miPointerCloseScreen (int index, ScreenPtr pScreen)
{
-#if 0
- miPointerPtr pPointer;
- DeviceIntPtr pDev;
-#endif
-
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;
free((pointer) pScreenPriv);
FreeEventList(events, GetMaximumEventsNum());
@@ -189,8 +193,7 @@ miPointerDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
miPointerPtr pPointer;
/* return for keyboards */
- if ((IsMaster(pDev) && !DevHasCursor(pDev)) ||
- (!IsMaster(pDev) && pDev->u.master && !DevHasCursor(pDev->u.master)))
+ if (!IsPointerDevice(pDev))
return FALSE;
pPointer = MIPOINTER(pDev);
@@ -201,6 +204,15 @@ miPointerDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
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
miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
{
@@ -212,7 +224,17 @@ miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
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
miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
BoxPtr pHotBox, BoxPtr pTopLeftBox)
@@ -220,15 +242,36 @@ miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
*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
miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
int x, int y, Bool generateEvent)
{
SetupScreen (pScreen);
+ miPointerPtr pPointer = MIPOINTER(pDev);
+
+ pPointer->generateEvent = generateEvent;
- GenerateEvent = generateEvent;
/* device dependent - must pend signal and call miPointerWarpCursor */
(*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y);
if (!generateEvent)
@@ -236,9 +279,13 @@ miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
return TRUE;
}
-/* Set up sprite information for the device.
- This function will be called once for each device after it is initialized
- in the DIX.
+/**
+ * Set up sprite information for the device.
+ * 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
miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
@@ -261,6 +308,7 @@ miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
pPointer->confined = FALSE;
pPointer->x = 0;
pPointer->y = 0;
+ pPointer->generateEvent = FALSE;
if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen)))
{
@@ -272,15 +320,19 @@ miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
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
miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
SetupScreen(pScreen);
- if (!IsMaster(pDev) && pDev->u.master)
+ if (!IsMaster(pDev) && !IsFloating(pDev))
return;
(*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
miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
@@ -306,7 +368,7 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
changedScreen = TRUE;
}
- if (GenerateEvent)
+ if (pPointer->generateEvent)
miPointerMove (pDev, pScreen, x, y);
else
miPointerMoveNoEvent(pDev, pScreen, x, y);
@@ -322,16 +384,11 @@ miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
UpdateSpriteForScreen (pDev, pScreen) ;
}
-/*
- * Pointer/CursorDisplay interface routines
- */
-
-/*
- * miPointerUpdateSprite
+/**
+ * Syncronize the sprite with the cursor.
*
- * Syncronize the sprite with the cursor - called from ProcessInputEvents
+ * @param pDev The device to sync
*/
-
void
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
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;
}
+/**
+ * @return The current screen of the VCP
+ */
ScreenPtr
miPointerCurrentScreen (void)
{
return miPointerGetScreen(inputInfo.pointer);
}
+/**
+ * @return The current screen of the given device or NULL.
+ */
ScreenPtr
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
* 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)
{
pPointer->devx = x;
@@ -483,6 +554,18 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr 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
miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
{
@@ -536,6 +619,12 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *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
miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
{
@@ -549,6 +638,15 @@ void darwinEvents_lock(void);
void darwinEvents_unlock(void);
#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
miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
diff --git a/mi/mipointrst.h b/mi/mipointrst.h
index bd9c24a00..c912a17da 100644
--- a/mi/mipointrst.h
+++ b/mi/mipointrst.h
@@ -44,6 +44,7 @@ typedef struct {
Bool confined; /* pointer can't change screens */
int x, y; /* hot spot location */
int devx, devy; /* sprite position */
+ Bool generateEvent; /* generate an event during warping? */
} miPointerRec, *miPointerPtr;
typedef struct {
diff --git a/mi/misprite.c b/mi/misprite.c
index 770951e8f..b0290af29 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -143,7 +143,7 @@ typedef struct {
#endif
#define MISPRITE(dev) \
- ((!IsMaster(dev) && !dev->u.master) ? \
+ (IsFloating(dev) ? \
(miCursorInfoPtr)dixLookupPrivate(&dev->devPrivates, miSpriteDevPrivatesKey) : \
(miCursorInfoPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miSpriteDevPrivatesKey))
@@ -766,7 +766,7 @@ miSpriteRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
miCursorInfoPtr pCursorInfo;
- if (!IsMaster(pDev) && !pDev->u.master)
+ if (IsFloating(pDev))
return FALSE;
pCursorInfo = MISPRITE(pDev);
@@ -790,7 +790,7 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
miCursorInfoPtr pPointer;
miSpriteScreenPtr pScreenPriv;
- if (!IsMaster(pDev) && !pDev->u.master)
+ if (IsFloating(pDev))
return;
pPointer = MISPRITE(pDev);
@@ -848,7 +848,7 @@ miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
CursorPtr pCursor;
- if (!IsMaster(pDev) && !pDev->u.master)
+ if (IsFloating(pDev))
return;
pCursor = MISPRITE(pDev)->pCursor;
@@ -905,7 +905,7 @@ miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
miCursorInfoPtr pCursorInfo;
- if (!IsMaster(pDev) && !pDev->u.master)
+ if (IsFloating(pDev))
return;
DamageDrawInternal (pScreen, TRUE);
@@ -944,7 +944,7 @@ miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
CursorPtr pCursor;
miCursorInfoPtr pCursorInfo;
- if (!IsMaster(pDev) && !pDev->u.master)
+ if (IsFloating(pDev))
return;
DamageDrawInternal (pScreen, TRUE);
@@ -985,7 +985,7 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
CursorPtr pCursor;
miCursorInfoPtr pCursorInfo;
- if (!IsMaster(pDev) && !pDev->u.master)
+ if (IsFloating(pDev))
return;
DamageDrawInternal (pScreen, TRUE);
@@ -1025,7 +1025,7 @@ miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen)
CursorPtr pCursor;
miCursorInfoPtr pCursorInfo;
- if (!IsMaster(pDev) && !pDev->u.master)
+ if (IsFloating(pDev))
return;
pCursorInfo = MISPRITE(pDev);
diff --git a/miext/damage/Makefile.am b/miext/damage/Makefile.am
index 595835731..767a65aee 100644
--- a/miext/damage/Makefile.am
+++ b/miext/damage/Makefile.am
@@ -2,7 +2,7 @@ noinst_LTLIBRARIES = libdamage.la
AM_CFLAGS = $(DIX_CFLAGS)
-INCLUDES = -I$(srcdir)/../cw -I$(top_srcdir)/hw/xfree86/os-support
+INCLUDES = -I$(srcdir)/../cw
if XORG
sdk_HEADERS = damage.h damagestr.h
diff --git a/miext/rootless/Makefile.am b/miext/rootless/Makefile.am
index f09300d5c..c97bebebe 100644
--- a/miext/rootless/Makefile.am
+++ b/miext/rootless/Makefile.am
@@ -1,5 +1,4 @@
AM_CFLAGS = $(DIX_CFLAGS) $(XSERVER_CFLAGS)
-AM_CPPFLAGS = -I$(top_srcdir)/hw/xfree86/os-support
noinst_LTLIBRARIES = librootless.la
librootless_la_SOURCES = \
diff --git a/miext/shadow/Makefile.am b/miext/shadow/Makefile.am
index a73d0ec78..30f7bda96 100644
--- a/miext/shadow/Makefile.am
+++ b/miext/shadow/Makefile.am
@@ -2,8 +2,6 @@ noinst_LTLIBRARIES = libshadow.la
AM_CFLAGS = $(DIX_CFLAGS)
-INCLUDES = -I$(top_srcdir)/hw/xfree86/os-support
-
if XORG
sdk_HEADERS = shadow.h
endif
diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c
index aed746bac..b0b451c2a 100644
--- a/randr/rrdispatch.c
+++ b/randr/rrdispatch.c
@@ -35,7 +35,7 @@ RRClientKnowsRates (ClientPtr pClient)
static int
ProcRRQueryVersion (ClientPtr client)
{
- xRRQueryVersionReply rep;
+ xRRQueryVersionReply rep = {0};
register int n;
REQUEST(xRRQueryVersionReq);
rrClientPriv(client);
diff --git a/randr/rrmode.c b/randr/rrmode.c
index 5ffa4006f..d7560dcb2 100644
--- a/randr/rrmode.c
+++ b/randr/rrmode.c
@@ -288,7 +288,7 @@ int
ProcRRCreateMode (ClientPtr client)
{
REQUEST(xRRCreateModeReq);
- xRRCreateModeReply rep;
+ xRRCreateModeReply rep = {0};
WindowPtr pWin;
ScreenPtr pScreen;
rrScrPrivPtr pScrPriv;
diff --git a/test/input.c b/test/input.c
index e7300a102..c13b4f213 100644
--- a/test/input.c
+++ b/test/input.c
@@ -36,6 +36,7 @@
#include "inputstr.h"
#include "eventconvert.h"
#include "exevents.h"
+#include "exglobals.h"
#include "dixgrabs.h"
#include "eventstr.h"
#include "inpututils.h"
@@ -295,6 +296,143 @@ static void dix_event_to_core_conversion(void)
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)
{
#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/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-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/xi2-struct-sizes", xi2_struct_sizes);
g_test_add_func("/dix/input/grab_matching", dix_grab_matching);
diff --git a/test/xi2/protocol-xiquerypointer.c b/test/xi2/protocol-xiquerypointer.c
index 810c61575..a42d59515 100644
--- a/test/xi2/protocol-xiquerypointer.c
+++ b/test/xi2/protocol-xiquerypointer.c
@@ -185,7 +185,7 @@ static void test_XIQueryPointer(void)
request_XIQueryPointer(&client_request, &request, BadDevice);
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_XIQueryPointer(&client_request, &request, Success);
diff --git a/test/xi2/protocol-xiwarppointer.c b/test/xi2/protocol-xiwarppointer.c
index 4f8860ea0..75b7617a0 100644
--- a/test/xi2/protocol-xiwarppointer.c
+++ b/test/xi2/protocol-xiwarppointer.c
@@ -145,7 +145,7 @@ static void test_XIWarpPointer(void)
request.deviceid = devices.kbd->id;
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_XIWarpPointer(&client_request, &request, Success);
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 54e5d755e..fb608f694 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -1045,7 +1045,7 @@ XFixesCursorInit (void)
ScreenPtr pScreen = screenInfo.screens[i];
CursorScreenPtr cs;
- cs = (CursorScreenPtr) malloc(sizeof (CursorScreenRec));
+ cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
if (!cs)
return FALSE;
Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c
index 9686ea85d..dc3c844c9 100644
--- a/xkb/ddxLoad.c
+++ b/xkb/ddxLoad.c
@@ -426,35 +426,79 @@ XkbRF_RulesPtr rules;
return complete;
}
-XkbDescPtr
-XkbCompileKeymap(DeviceIntPtr dev, XkbRMLVOSet *rmlvo)
+static Bool
+XkbRMLVOtoKcCGST(DeviceIntPtr dev, XkbRMLVOSet *rmlvo, XkbComponentNamesPtr kccgst)
{
- XkbComponentNamesRec kccgst;
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.layout = rmlvo->layout;
mlvo.variant = rmlvo->variant;
mlvo.options = rmlvo->options;
- /* XDNFR already logs for us. */
- if (!XkbDDXNamesFromRules(dev, rmlvo->rules, &mlvo, &kccgst))
+ return 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;
- /* XDLKBN too, but it might return 0 as well as allocating. */
- if (!XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, 0, &xkb, name,
- PATH_MAX)) {
- if (xkb)
+ provided = XkbDDXLoadKeymapByNames(dev, &kccgst, XkmAllIndicesMask, need,
+ &xkb, name, PATH_MAX);
+ if ((need & provided) != need) {
+ if (xkb) {
XkbFreeKeyboard(xkb, 0, TRUE);
+ 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;
}
diff --git a/xkb/xkb.c b/xkb/xkb.c
index d98e35296..d701ea13c 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -3644,7 +3644,7 @@ register int n;
swapl(&rep->indicators,n);
}
- start = desc = malloc(length);
+ start = desc = calloc(1, length);
if ( !start )
return BadAlloc;
if (xkb->names) {
@@ -5569,13 +5569,13 @@ ProcXkbGetKbdByName(ClientPtr client)
{
DeviceIntPtr dev;
DeviceIntPtr tmpd;
- xkbGetKbdByNameReply rep;
- xkbGetMapReply mrep;
- xkbGetCompatMapReply crep;
- xkbGetIndicatorMapReply irep;
- xkbGetNamesReply nrep;
- xkbGetGeometryReply grep;
- XkbComponentNamesRec names;
+ xkbGetKbdByNameReply rep = {0};
+ xkbGetMapReply mrep = {0};
+ xkbGetCompatMapReply crep = {0};
+ xkbGetIndicatorMapReply irep = {0};
+ xkbGetNamesReply nrep = {0};
+ xkbGetGeometryReply grep = {0};
+ XkbComponentNamesRec names = {0};
XkbDescPtr xkb, new;
unsigned char * str;
char mapFile[PATH_MAX];
@@ -5883,12 +5883,10 @@ ProcXkbGetKbdByName(ClientPtr client)
nkn.changed|= XkbNKN_GeometryMask;
XkbSendNewKeyboardNotify(dev,&nkn);
- if (!IsMaster(dev) && dev->u.master)
- {
- DeviceIntPtr master = dev->u.master;
- if (master->u.lastSlave == dev)
- {
- XkbCopyDeviceKeymap(dev->u.master, dev);
+ if (!IsMaster(dev)) {
+ DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
+ if (master && master->lastSlave == dev) {
+ XkbCopyDeviceKeymap(master, dev);
XkbSendNewKeyboardNotify(dev,&nkn);
}
}
diff --git a/xkb/xkbAccessX.c b/xkb/xkbAccessX.c
index 10c38ca47..12fe2a1f5 100644
--- a/xkb/xkbAccessX.c
+++ b/xkb/xkbAccessX.c
@@ -694,7 +694,7 @@ ProcessInputProc backupproc;
xkbDeviceInfoPtr xkbPrivPtr = XKBDEVICEINFO(mouse);
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)
{
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 8d7c124e8..65c678af8 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1365,9 +1365,9 @@ InjectPointerKeyEvents(DeviceIntPtr dev, int type, int button, int flags, Valuat
if (IsMaster(dev)) {
mpointer = GetMaster(dev, MASTER_POINTER);
- lastSlave = mpointer->u.lastSlave;
+ lastSlave = mpointer->lastSlave;
ptr = GetXTestDevice(mpointer);
- } else if (!dev->u.master)
+ } else if (IsFloating(dev))
ptr = dev;
else
return;
@@ -1397,7 +1397,7 @@ XkbFakePointerMotion(DeviceIntPtr dev, unsigned flags,int x,int y)
int gpe_flags = 0;
/* ignore attached SDs */
- if (!IsMaster(dev) && GetMaster(dev, MASTER_POINTER) != NULL)
+ if (!IsMaster(dev) && !IsFloating(dev))
return;
if (flags & XkbSA_MoveAbsoluteX || flags & XkbSA_MoveAbsoluteY)
@@ -1427,7 +1427,7 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
if (IsMaster(dev)) {
DeviceIntPtr mpointer = GetMaster(dev, MASTER_POINTER);
ptr = GetXTestDevice(mpointer);
- } else if (!dev->u.master)
+ } else if (IsFloating(dev))
ptr = dev;
else
return;