forked from pool/xorg-x11-server
* obsolete patches: - dmx-silly.patch - fixed-SYNC-extension-trigger-BlockHandler-test.diff - sw_cursor_on_randr.patch - xorg-evdev-conf.diff - xorg-server-commit-21ed660.diff - xorg-server-revert-event-mask.patch - xorg-x11-server-gl-apps-crash.patch * adjusted patches - 0001-Fix-segfault-when-killing-X-with-ctrl-alt-backspace.patch - 0001-Xinput-Catch-missing-configlayout-when-deleting-dev.patch - CVE-2010-2240-tree_depth_limit.patch - cache-xkbcomp-output-for-fast-start-up.patch - confine_to_shape.diff - driver-autoconfig.diff - fpic.diff - xorg-detect-psb.patch - xorg-server-1.8.0.diff - xorg-server-nohwaccess.diff - xorg-server-option_libxf86config.diff - xorg-server-xf4vnc.patch - xserver-1.6.1-nouveau.patch - xserver-bg-none-root.patch * vbe-bufferoverflow.diff - fixes vbe buffer overflow - disabled vnc build for now (standalone server + module) OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=281
109 lines
2.7 KiB
Diff
109 lines
2.7 KiB
Diff
Index: dix/events.c
|
|
================================================================================
|
|
--- dix/events.c
|
|
+++ dix/events.c
|
|
@@ -661,37 +661,80 @@
|
|
{
|
|
BoxRec box;
|
|
int x = *px, y = *py;
|
|
- int incx = 1, incy = 1;
|
|
SpritePtr pSprite;
|
|
+ int nbox;
|
|
+ BoxPtr pbox;
|
|
+ int d, min = (~0U >> 1), dx2, dy2, x_r, y_r;
|
|
|
|
pSprite = pDev->spriteInfo->sprite;
|
|
if (RegionContainsPoint(shape, x, y, &box))
|
|
return;
|
|
- box = *RegionExtents(shape);
|
|
- /* this is rather crude */
|
|
- do {
|
|
- x += incx;
|
|
- if (x >= box.x2)
|
|
- {
|
|
- incx = -1;
|
|
- x = *px - 1;
|
|
+
|
|
+ for (nbox = REGION_NUM_RECTS (shape),
|
|
+ pbox = REGION_RECTS(shape);
|
|
+ nbox--;
|
|
+ pbox++)
|
|
+ {
|
|
+ if (pbox->x1 < x && pbox->x2 > x) {
|
|
+ d = pbox->y1 - y;
|
|
+ if (d >= 0) {
|
|
+ d *= d;
|
|
+ if (d < min) {
|
|
+ *px = x;
|
|
+ *py = pbox->y1 + 1;
|
|
+ min = d;
|
|
+ }
|
|
+ } else {
|
|
+ d = pbox->y2 - y; d *= d;
|
|
+ if (d < min) {
|
|
+ *px = x;
|
|
+ *py = pbox->y2 - 1;
|
|
+ min = d;
|
|
+ }
|
|
+ }
|
|
}
|
|
- else if (x < box.x1)
|
|
- {
|
|
- incx = 1;
|
|
- x = *px;
|
|
- y += incy;
|
|
- if (y >= box.y2)
|
|
- {
|
|
- incy = -1;
|
|
- y = *py - 1;
|
|
+ else if (pbox->y1 < y && pbox->y2 > y) {
|
|
+ d = pbox->x1 - x;
|
|
+ if (d >= 0) {
|
|
+ d *= d;
|
|
+ if (d < min) {
|
|
+ *px = pbox->x1 + 1;
|
|
+ *py = y;
|
|
+ min = d;
|
|
+ }
|
|
+ } else {
|
|
+ d = pbox->x2 - x; d *= d;
|
|
+ if (d < min) {
|
|
+ *px = pbox->x2 - 1;
|
|
+ *py = y;
|
|
+ min = d;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ } else {
|
|
+ dx2 = pbox->x1 - x;
|
|
+ if (dx2 >= 0) {
|
|
+ dx2 *= dx2;
|
|
+ x_r = pbox->x1 + 1;
|
|
+ } else {
|
|
+ dx2 = pbox->x2 - x; dx2 *= dx2;
|
|
+ x_r = pbox->x2 - 1;
|
|
+ }
|
|
+ dy2 = pbox->y1 - y;
|
|
+ if (dy2 >= 0) {
|
|
+ dy2 *= dy2;
|
|
+ y_r = pbox->y1 + 1;
|
|
+ } else {
|
|
+ dy2 = pbox->y2 - y; dy2 *= dy2;
|
|
+ y_r = pbox->y2 - 1;
|
|
+ }
|
|
+ if ((d = dx2 + dy2) < min) {
|
|
+ *px = x_r;
|
|
+ *py = y_r;
|
|
+ min = d;
|
|
}
|
|
- else if (y < box.y1)
|
|
- return; /* should never get here! */
|
|
}
|
|
- } while (!RegionContainsPoint(shape, x, y, &box));
|
|
- *px = x;
|
|
- *py = y;
|
|
+ }
|
|
}
|
|
|
|
static void
|