xserver: Branch 'xorg-server-1.5-apple' - 5 commits
Jeremy Huddleston
jeremyhu at kemper.freedesktop.org
Thu Mar 27 19:16:54 PDT 2008
fb/fb.h | 7 +
fb/fbbltone.c | 32 ++++++-
hw/xquartz/darwinEvents.c | 3
hw/xquartz/darwinXinput.c | 186 ++++++++++++++--------------------------------
4 files changed, 96 insertions(+), 132 deletions(-)
New commits:
commit 8c9b183683b33b4bd5a99a20ed1906aa6ea23ef5
Author: Ben Byer <bbyer at bbyer.local>
Date: Sat Dec 8 23:33:27 2007 -0800
Fixed bad calculation of dstEnd, which caused truncation of some bitblts
(cherry picked from commit 8a057bc9e2eadd5b3296643e1b2337a5ef647cb2)
diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index 6dcc982..0569ede 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -191,7 +191,7 @@ fbBltOne (FbStip *src,
* Do not read or write past the end of the buffer!
*/
srcEnd = src + height * srcStride;
- dstEnd = dst + height * dstStride;
+ dstEnd = dst + dstX + height * dstStride;
/*
* Number of destination units in FbBits == number of stipple pixels
@@ -612,7 +612,7 @@ fbBltOne24 (FbStip *srcLine,
* Do not read or write past the end of the buffer!
*/
srcEnd = srcLine + height * srcStride;
- dstEnd = dst + height * dstStride;
+ dstEnd = dst + dstX + height * dstStride;
srcLine += srcX >> FB_STIP_SHIFT;
dst += dstX >> FB_SHIFT;
commit ac1009fdcbddd57fdb3ff5901eac70695b45858b
Author: Ben Byer <bbyer at bbyer.local>
Date: Fri Dec 7 22:26:17 2007 -0800
Added code to check for null pointers on fb* invocations
(cherry picked from commit 6f441d79c7c884c8cd9315f490f7833a877344aa)
(cherry picked from commit 1e1073334af05288158469e0241367144634fe4e)
diff --git a/fb/fb.h b/fb/fb.h
index 01000d7..2500133 100644
--- a/fb/fb.h
+++ b/fb/fb.h
@@ -169,6 +169,11 @@ typedef CARD32 FbStip;
typedef int FbStride;
+#define CHECK_NULL(ptr) \
+ if ((ptr) == NULL) {\
+ ErrorF("%s:%d: null pointer\n", __FILE__, __LINE__); \
+ return; \
+ }
#ifdef FB_DEBUG
extern void fbValidateDrawable(DrawablePtr d);
@@ -713,6 +718,7 @@ typedef struct {
(pointer) = (FbBits *) _pPix->devPrivate.ptr; \
(stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \
(bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
+ CHECK_NULL(pointer); \
}
#define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \
@@ -730,6 +736,7 @@ typedef struct {
(pointer) = (FbStip *) _pPix->devPrivate.ptr; \
(stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \
(bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \
+ CHECK_NULL(pointer); \
}
/*
commit 5dcdb2f7483ebef2c14dcfcbb53a3fb3f3c26194
Author: Ben Byer <bbyer at bbyer.local>
Date: Fri Dec 7 21:56:45 2007 -0800
Added checks to avoid writing past the end of the buffer in fbBltOne
(cherry picked from commit e5f54f122b2068ff7b94a979ebadac4cf8eef20f)
(cherry picked from commit 24c54f53ff97b7bc814f7cb33d88e28b9bf536dc)
diff --git a/fb/fbbltone.c b/fb/fbbltone.c
index ffe6977..6dcc982 100644
--- a/fb/fbbltone.c
+++ b/fb/fbbltone.c
@@ -56,6 +56,13 @@
} else \
bits = (src < srcEnd ? READ(src++) : 0); \
}
+
+#define CHECK_BOUNDS(pointer, limit) \
+ if (dst > dstEnd) { \
+ ErrorF("WARNING: fbbltone tried to write over end of buffer (dst=%p dstEnd=%p)\n", \
+ dst, dstEnd); \
+ return; \
+ }
#ifndef FBNOPIXADDR
@@ -148,7 +155,7 @@ fbBltOne (FbStip *src,
FbBits bgxor)
{
const FbBits *fbBits;
- FbBits *srcEnd;
+ FbBits *srcEnd, *dstEnd;
int pixelsPerDst; /* dst pixels per FbBits */
int unitsPerSrc; /* src patterns per FbStip */
int leftShift, rightShift; /* align source with dest */
@@ -181,9 +188,10 @@ fbBltOne (FbStip *src,
#endif
/*
- * Do not read past the end of the buffer!
+ * Do not read or write past the end of the buffer!
*/
srcEnd = src + height * srcStride;
+ dstEnd = dst + height * dstStride;
/*
* Number of destination units in FbBits == number of stipple pixels
@@ -296,6 +304,7 @@ fbBltOne (FbStip *src,
*/
if (startmask)
{
+ CHECK_BOUNDS(dst, dstEnd);
#if FB_UNIT > 32
if (pixelsPerDst == 16)
mask = FbStipple16Bits(FbLeftStipBits(bits,16));
@@ -336,6 +345,7 @@ fbBltOne (FbStip *src,
else
#endif
mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)];
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, FbOpaqueStipple (mask, fgxor, bgxor));
dst++;
bits = FbStipLeft(bits, pixelsPerDst);
@@ -346,6 +356,7 @@ fbBltOne (FbStip *src,
#ifndef FBNOPIXADDR
if (fbLane)
{
+ CHECK_BOUNDS(dst, dstEnd);
while (bits && n)
{
switch (fbLane[FbLeftStipBits(bits,pixelsPerDst)]) {
@@ -366,6 +377,7 @@ fbBltOne (FbStip *src,
if (left || !transparent)
{
mask = fbBits[left];
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, FbStippleRRop (READ(dst), mask,
fgand, fgxor, bgand, bgxor));
}
@@ -586,7 +598,7 @@ fbBltOne24 (FbStip *srcLine,
FbBits bgand,
FbBits bgxor)
{
- FbStip *src, *srcEnd;
+ FbStip *src, *srcEnd, *dstEnd;
FbBits leftMask, rightMask, mask;
int nlMiddle, nl;
FbStip stip, bits;
@@ -597,9 +609,10 @@ fbBltOne24 (FbStip *srcLine,
int nDst;
/*
- * Do not read past the end of the buffer!
+ * Do not read or write past the end of the buffer!
*/
srcEnd = srcLine + height * srcStride;
+ dstEnd = dst + height * dstStride;
srcLine += srcX >> FB_STIP_SHIFT;
dst += dstX >> FB_SHIFT;
@@ -629,6 +642,7 @@ fbBltOne24 (FbStip *srcLine,
if (leftMask)
{
mask = fbStipple24Bits[rot >> 3][stip];
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, (READ(dst) & ~leftMask) |
(FbOpaqueStipple (mask,
FbRot24(fgxor, rot),
@@ -641,6 +655,7 @@ fbBltOne24 (FbStip *srcLine,
while (nl--)
{
mask = fbStipple24Bits[rot>>3][stip];
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, FbOpaqueStipple (mask,
FbRot24(fgxor, rot),
FbRot24(bgxor, rot)));
@@ -650,6 +665,7 @@ fbBltOne24 (FbStip *srcLine,
if (rightMask)
{
mask = fbStipple24Bits[rot >> 3][stip];
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, (READ(dst) & ~rightMask) |
(FbOpaqueStipple (mask,
FbRot24(fgxor, rot),
@@ -674,7 +690,8 @@ fbBltOne24 (FbStip *srcLine,
if (stip)
{
mask = fbStipple24Bits[rot >> 3][stip] & leftMask;
- WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
+ CHECK_BOUNDS(dst, dstEnd);
+ WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
}
dst++;
fbNextStipBits (rot, stip);
@@ -685,6 +702,7 @@ fbBltOne24 (FbStip *srcLine,
if (stip)
{
mask = fbStipple24Bits[rot>>3][stip];
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor,rot) & mask));
}
dst++;
@@ -695,6 +713,7 @@ fbBltOne24 (FbStip *srcLine,
if (stip)
{
mask = fbStipple24Bits[rot >> 3][stip] & rightMask;
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, (READ(dst) & ~mask) | (FbRot24(fgxor, rot) & mask));
}
}
@@ -712,6 +731,7 @@ fbBltOne24 (FbStip *srcLine,
if (leftMask)
{
mask = fbStipple24Bits[rot >> 3][stip];
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, FbStippleRRopMask (READ(dst), mask,
FbRot24(fgand, rot),
FbRot24(fgxor, rot),
@@ -725,6 +745,7 @@ fbBltOne24 (FbStip *srcLine,
while (nl--)
{
mask = fbStipple24Bits[rot >> 3][stip];
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, FbStippleRRop (READ(dst), mask,
FbRot24(fgand, rot),
FbRot24(fgxor, rot),
@@ -736,6 +757,7 @@ fbBltOne24 (FbStip *srcLine,
if (rightMask)
{
mask = fbStipple24Bits[rot >> 3][stip];
+ CHECK_BOUNDS(dst, dstEnd);
WRITE(dst, FbStippleRRopMask (READ(dst), mask,
FbRot24(fgand, rot),
FbRot24(fgxor, rot),
commit 8688356dba0f6f4c9f189bb2df42f27ce2a84769
Author: Ben Byer <bbyer at bushing.apple.com>
Date: Tue Mar 25 19:25:00 2008 -0700
xquartz: copy in new stubs from Xi/stubs.c to replace our old
Xinput stubs. Hey, it's a start.
(cherry picked from commit 566412b4aece24ae6af8c7c835986b685aa456a2)
diff --git a/hw/xquartz/darwinXinput.c b/hw/xquartz/darwinXinput.c
index e62ec0a..50ba656 100644
--- a/hw/xquartz/darwinXinput.c
+++ b/hw/xquartz/darwinXinput.c
@@ -1,8 +1,7 @@
-
/*
- * X server support of the XINPUT extension for Darwin
+ * X server support of the XINPUT extension for xquartz
*
- * This is currently a copy of mi/stubs.c, but eventually this
+ * This is currently a copy of Xi/stubs.c, but eventually this
* should include more complete XINPUT support.
*/
@@ -52,100 +51,17 @@ SOFTWARE.
********************************************************/
+#define NEED_EVENTS
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif
-#define NEED_EVENTS
#include <X11/X.h>
#include <X11/Xproto.h>
#include "inputstr.h"
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "XIstubs.h"
-#include "chgkbd.h"
-
-/***********************************************************************
- *
- * Caller: ProcXChangeKeyboardDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the keyboard device.
- *
- * The X keyboard device has a FocusRec. If the device that has been
- * made into the new X keyboard did not have a FocusRec,
- * ProcXChangeKeyboardDevice will allocate one for it.
- *
- * If you do not want clients to be able to focus the old X keyboard
- * device, call DeleteFocusClassDeviceStruct to free the FocusRec.
- *
- * If you support input devices with keys that you do not want to be
- * used as the X keyboard, you need to check for them here and return
- * a BadDevice error.
- *
- * The default implementation is to do nothing (assume you do want
- * clients to be able to focus the old X keyboard). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int ChangeKeyboardDevice (DeviceIntPtr old_dev, DeviceIntPtr new_dev) {
- /***********************************************************************
- DeleteFocusClassDeviceStruct(old_dev); * defined in xchgptr.c *
- **********************************************************************/
- return BadMatch;
-}
-
-
-/***********************************************************************
- *
- * Caller: ProcXChangePointerDevice
- *
- * This procedure does the implementation-dependent portion of the work
- * needed to change the pointer device.
- *
- * The X pointer device does not have a FocusRec. If the device that
- * has been made into the new X pointer had a FocusRec,
- * ProcXChangePointerDevice will free it.
- *
- * If you want clients to be able to focus the old pointer device that
- * has now become accessible through the input extension, you need to
- * add a FocusRec to it here.
- *
- * The XChangePointerDevice protocol request also allows the client
- * to choose which axes of the new pointer device are used to move
- * the X cursor in the X- and Y- directions. If the axes are different
- * than the default ones, you need to keep track of that here.
- *
- * If you support input devices with valuators that you do not want to be
- * used as the X pointer, you need to check for them here and return a
- * BadDevice error.
- *
- * The default implementation is to do nothing (assume you don't want
- * clients to be able to focus the old X pointer). The commented-out
- * sample code shows what you might do if you don't want the default.
- *
- */
-
-int
-ChangePointerDevice (
- DeviceIntPtr old_dev,
- DeviceIntPtr new_dev,
- unsigned char x,
- unsigned char y)
- {
- /***********************************************************************
- InitFocusClassDeviceStruct(old_dev); * allow focusing old ptr*
-
- x_axis = x; * keep track of new x-axis*
- y_axis = y; * keep track of new y-axis*
- if (x_axis != 0 || y_axis != 1)
- axes_changed = TRUE; * remember axes have changed*
- else
- axes_changed = FALSE;
- *************************************************************************/
- return BadMatch;
- }
/***********************************************************************
*
@@ -161,11 +77,9 @@ ChangePointerDevice (
*/
void
-CloseInputDevice (d, client)
- DeviceIntPtr d;
- ClientPtr client;
- {
- }
+CloseInputDevice(DeviceIntPtr d, ClientPtr client)
+{
+}
/***********************************************************************
*
@@ -194,8 +108,8 @@ CloseInputDevice (d, client)
*/
void
-AddOtherInputDevices ()
- {
+AddOtherInputDevices(void)
+{
/**********************************************************************
for each uninitialized device, do something like:
@@ -209,7 +123,7 @@ AddOtherInputDevices ()
dev->inited = ((*dev->deviceProc)(dev, DEVICE_INIT) == Success);
************************************************************************/
- }
+}
/***********************************************************************
*
@@ -234,12 +148,9 @@ AddOtherInputDevices ()
*/
void
-OpenInputDevice (dev, client, status)
- DeviceIntPtr dev;
- ClientPtr client;
- int *status;
- {
- }
+OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
+{
+}
/****************************************************************************
*
@@ -254,13 +165,10 @@ OpenInputDevice (dev, client, status)
*/
int
-SetDeviceMode (client, dev, mode)
- register ClientPtr client;
- DeviceIntPtr dev;
- int mode;
- {
+SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode)
+{
return BadMatch;
- }
+}
/****************************************************************************
*
@@ -275,15 +183,11 @@ SetDeviceMode (client, dev, mode)
*/
int
-SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
- register ClientPtr client;
- DeviceIntPtr dev;
- int *valuators;
- int first_valuator;
- int num_valuators;
- {
+SetDeviceValuators(ClientPtr client, DeviceIntPtr dev,
+ int *valuators, int first_valuator, int num_valuators)
+{
return BadMatch;
- }
+}
/****************************************************************************
*
@@ -294,16 +198,44 @@ SetDeviceValuators (client, dev, valuators, first_valuator, num_valuators)
*/
int
-ChangeDeviceControl (client, dev, control)
- register ClientPtr client;
- DeviceIntPtr dev;
- xDeviceCtl *control;
- {
- switch (control->control)
- {
- case DEVICE_RESOLUTION:
- return (BadMatch);
- default:
- return (BadMatch);
- }
+ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev,
+ xDeviceCtl * control)
+{
+ switch (control->control) {
+ case DEVICE_RESOLUTION:
+ return (BadMatch);
+ case DEVICE_ABS_CALIB:
+ case DEVICE_ABS_AREA:
+ return (BadMatch);
+ case DEVICE_CORE:
+ return (BadMatch);
+ default:
+ return (BadMatch);
}
+}
+
+
+/****************************************************************************
+ *
+ * Caller: configAddDevice (and others)
+ *
+ * Add a new device with the specified options.
+ *
+ */
+int
+NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev)
+{
+ return BadValue;
+}
+
+/****************************************************************************
+ *
+ * Caller: configRemoveDevice (and others)
+ *
+ * Remove the specified device previously added.
+ *
+ */
+void
+DeleteInputDeviceRequest(DeviceIntPtr dev)
+{
+}
commit 1fc0c7b877d83712928648e3d36970fce8cc9721
Author: Ben Byer <bbyer at bushing.apple.com>
Date: Mon Mar 24 22:43:10 2008 -0700
prevent "fake mouse clicks" from generating spurious extra events
(cherry picked from commit bd85a24969427e41389688663ead2d4dd41c9999)
diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c
index 827fd81..22d8957 100644
--- a/hw/xquartz/darwinEvents.c
+++ b/hw/xquartz/darwinEvents.c
@@ -391,10 +391,12 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask);
darwinFakeMouseButtonDown = 2;
darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
+ return;
} else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask);
darwinFakeMouseButtonDown = 3;
darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
+ return;
}
}
if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
@@ -406,6 +408,7 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin
// Bring modifiers back up to date
DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
darwinFakeMouseButtonMask = 0;
+ return;
}
num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
More information about the xorg-commit
mailing list