1
0
xorg-x11-server/u_confine_to_shape.diff
Egbert Eich 7286d85738 - Dropped:
* N_0001-Check-harder-for-primary-PCI-device.patch
    Whith libpciaccess code path irrelevant for Linux. 
  * N_0001-Fix-segfault-when-killing-X-with-ctrl-alt-backspace.patch
    Solved differently upstream
  * N_bug-197858_dpms.diff
    This one is upstream already - apparently nobody check this when
    it no longer applied...
  * N_bug534768-prefer_local_symbols.patch
    Upstream has a better suggestion how to solve this. However this
    patch is no longer needed     
  * N_dpms_screensaver.diff
    This topic was solved slightly differently upstream - still patch
    got ported without checking it's context.
  * N_randr1_1-sig11.diff
    No longer needed. Problem was fixed differently upstream.
  * u_vgaHW-no-legacy.patch
    Problem solved in the nv driver.
- Renamed:
  Those patches will go upstream, thus they are prefixed by a u_:
  * n__confine_to_shape.diff ->  u_confine_to_shape.diff
  * N_fbdevhw.diff -> u_fbdevhw.diff
  * n_x86emu-include-order.patch -> u_x86emu-include-order.patch
  * N_xorg-server-xdmcp.patchA -> u_xorg-server-xdmcp.patch
  Those patches no longer apply but are kept for reference thus prefixed by b_:
  * N_0001-Prevent-XSync-Alarms-from-senslessly-calling-CheckTr.patch ->
    b_0001-Prevent-XSync-Alarms-from-senslessly-calling-CheckTr.patch
  * N_cache-xkbcomp-output-for-fast-start-up.patch ->
    b_cache-xkbcomp-output-for-fast-start-up.patch
  * N_sync-fix.patch -> b_sync-fix.patch

OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=478
2013-12-11 15:46:05 +00:00

101 lines
2.7 KiB
Diff

--- dix/events.c.orig 2012-04-17 11:34:39.714915372 -0500
+++ dix/events.c 2012-04-17 11:26:54.735728478 -0500
@@ -671,32 +671,77 @@
{
BoxRec box;
int x = *px, y = *py;
- int incx = 1, incy = 1;
+ int nbox;
+ BoxPtr pbox;
+ int d, min = (~0U >> 1), dx2, dy2, x_r, y_r;
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