- Add 50-extensions.conf

Disable the DGA extension by default (boo#947695).

- Replaced u_confine_to_shape.diff
  by u_01-Improved-ConfineToShape.patch
  and u_02-DIX-ConfineTo-Don-t-bother-about-the-bounding-box-when-grabbing-a-shaped-window.patch.

OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=612
This commit is contained in:
Egbert Eich 2016-02-25 20:56:47 +00:00 committed by Git OBS Bridge
parent f4c37c56fd
commit 33b0155469
6 changed files with 286 additions and 110 deletions

9
50-extensions.conf Normal file
View File

@ -0,0 +1,9 @@
# Add extensions to be disabled. This may be needed as some
# extra modules may add extensions which cause the maximum
# number of extensions possible to be exceeded.
#
# SUSE Default: disable DGA.
Section "Extensions"
Option "XFree86-DGA" "Disable"
EndSection

View File

@ -0,0 +1,109 @@
From: Keith Packard <keithp@keithp.com>
Date: Fri Oct 4 16:00:49 2013 -0700
Subject: [PATCH 1/2]Improved ConfineToShape
Patch-mainline: to be upstreamed
Git-commit: 0d0951624db7ae4686b362c7c6307f1ed46c8579
References: bnc#62146
Signed-off-by: Egbert Eich <eich@suse.com>
Find the box within the region which is closest to the point and move
there.
Signed-off-by: Keith Packard <keithp@keithp.com>
---
dix/events.c | 74 ++++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 50 insertions(+), 24 deletions(-)
diff --git a/dix/events.c b/dix/events.c
index efaf91d..5244781 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -666,37 +666,63 @@ SetCriticalEvent(int event)
criticalEvents[event >> 3] |= 1 << (event & 7);
}
+static uint32_t
+ConfineToBox(int x, int y, BoxPtr box, int *px, int *py)
+{
+ int dx, dy;
+
+ *px = x;
+ *py = y;
+
+ if (*px < box->x1)
+ *px = box->x1;
+ else if (*px >= box->x2)
+ *px = box->x2 - 1;
+
+ if (*py < box->y1)
+ *py = box->y1;
+ else if (*py >= box->y2)
+ *py = box->y2 - 1;
+
+ dx = x - *px;
+ if (dx < 0) dx = -dx;
+ if (dx > 32767)
+ dx = 32767;
+ dy = y - *py;
+ if (dy < 0) dy = -dy;
+ if (dy > 32767)
+ dy = 32767;
+
+ return (uint32_t) dx * (uint32_t) dx + (uint32_t) dy * (uint32_t) dy;
+}
+
void
ConfineToShape(DeviceIntPtr pDev, RegionPtr shape, int *px, int *py)
{
- BoxRec box;
+ BoxPtr box;
+ int nbox;
int x = *px, y = *py;
- int incx = 1, incy = 1;
+ int bx, by;
+ uint32_t box_dist_2;
+ int best_x = 0, best_y = 0;
+ uint32_t best_dist_2 = 0;
+ int i;
- if (RegionContainsPoint(shape, x, y, &box))
+ if (RegionContainsPoint(shape, x, y, NULL))
return;
- box = *RegionExtents(shape);
- /* this is rather crude */
- do {
- x += incx;
- if (x >= box.x2) {
- incx = -1;
- x = *px - 1;
- }
- else if (x < box.x1) {
- incx = 1;
- x = *px;
- y += incy;
- if (y >= box.y2) {
- incy = -1;
- y = *py - 1;
- }
- else if (y < box.y1)
- return; /* should never get here! */
+ box = REGION_RECTS(shape);
+ nbox = REGION_NUM_RECTS(shape);
+ for (i = 0; i < nbox; i++) {
+ box_dist_2 = ConfineToBox(x, y, &box[i], &bx, &by);
+ if (i == 0 || box_dist_2 < best_dist_2) {
+ best_dist_2 = box_dist_2;
+ best_x = bx;
+ best_y = by;
}
- } while (!RegionContainsPoint(shape, x, y, &box));
- *px = x;
- *py = y;
+ }
+
+ *px = best_x;
+ *py = best_y;
}
static void

View File

@ -0,0 +1,148 @@
From: Egbert Eich <eich@freedesktop.org>
Date: Fri Feb 7 09:19:45 2014 +0100
Subject: [PATCH 2/2]DIX/ConfineTo: Don't bother about the bounding box when grabbing a shaped window
Patch-mainline: to be upstreamed
Git-commit: 3f7cc03e47a35d05ffb3f7a6de521c41638b4c7a
References: bnc#62146
Signed-off-by: Egbert Eich <eich@suse.com>
Limiting the the cursor coordinates on the bounding box of a shaped
window before applying ConfineTo leads to strange cursor placement
when the pointer is located outside the vertial and horizontal
strip of this bounding box.
Ignoring the bounding box when a shape is set leads to the correct
behavior.
Signed-off-by: Egbert Eich <eich@freedesktop.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
---
dix/events.c | 78 +++++++++++++++++++++++++++++++++---------------------------
1 file changed, 43 insertions(+), 35 deletions(-)
diff --git a/dix/events.c b/dix/events.c
index 5244781..8aa4af7 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -753,17 +753,19 @@ CheckPhysLimits(DeviceIntPtr pDev, CursorPtr cursor, Bool generateEvents,
(*pScreen->ConstrainCursor) (pDev, pScreen, &pSprite->physLimits);
}
- /* constrain the pointer to those limits */
- if (new.x < pSprite->physLimits.x1)
- new.x = pSprite->physLimits.x1;
- else if (new.x >= pSprite->physLimits.x2)
- new.x = pSprite->physLimits.x2 - 1;
- if (new.y < pSprite->physLimits.y1)
- new.y = pSprite->physLimits.y1;
- else if (new.y >= pSprite->physLimits.y2)
- new.y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y);
+ else {
+ /* constrain the pointer to those limits */
+ if (new.x < pSprite->physLimits.x1)
+ new.x = pSprite->physLimits.x1;
+ else if (new.x >= pSprite->physLimits.x2)
+ new.x = pSprite->physLimits.x2 - 1;
+ if (new.y < pSprite->physLimits.y1)
+ new.y = pSprite->physLimits.y1;
+ else if (new.y >= pSprite->physLimits.y2)
+ new.y = pSprite->physLimits.y2 - 1;
+ }
if ((
#ifdef PANORAMIX
noPanoramiXExtension &&
@@ -914,7 +916,8 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents,
return;
}
#endif
- pSprite->hotLimits = *RegionExtents(&pWin->borderSize);
+// if (!wBoundingShape(pWin))
+ pSprite->hotLimits = *RegionExtents(&pWin->borderSize);
pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize
: NullRegion;
CheckPhysLimits(pDev, pSprite->current, generateEvents,
@@ -3039,17 +3042,19 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
pSprite->hot.x = ev->root_x;
pSprite->hot.y = ev->root_y;
- if (pSprite->hot.x < pSprite->physLimits.x1)
- pSprite->hot.x = pSprite->physLimits.x1;
- else if (pSprite->hot.x >= pSprite->physLimits.x2)
- pSprite->hot.x = pSprite->physLimits.x2 - 1;
- if (pSprite->hot.y < pSprite->physLimits.y1)
- pSprite->hot.y = pSprite->physLimits.y1;
- else if (pSprite->hot.y >= pSprite->physLimits.y2)
- pSprite->hot.y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x,
&pSprite->hot.y);
+ else {
+ if (pSprite->hot.x < pSprite->physLimits.x1)
+ pSprite->hot.x = pSprite->physLimits.x1;
+ else if (pSprite->hot.x >= pSprite->physLimits.x2)
+ pSprite->hot.x = pSprite->physLimits.x2 - 1;
+ if (pSprite->hot.y < pSprite->physLimits.y1)
+ pSprite->hot.y = pSprite->physLimits.y1;
+ else if (pSprite->hot.y >= pSprite->physLimits.y2)
+ pSprite->hot.y = pSprite->physLimits.y2 - 1;
+ }
pSprite->hotPhys = pSprite->hot;
if ((pSprite->hotPhys.x != ev->root_x) ||
@@ -3516,17 +3521,18 @@ XineramaWarpPointer(ClientPtr client)
x += stuff->dstX;
y += stuff->dstY;
- if (x < pSprite->physLimits.x1)
- x = pSprite->physLimits.x1;
- else if (x >= pSprite->physLimits.x2)
- x = pSprite->physLimits.x2 - 1;
- if (y < pSprite->physLimits.y1)
- y = pSprite->physLimits.y1;
- else if (y >= pSprite->physLimits.y2)
- y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
-
+ else {
+ if (x < pSprite->physLimits.x1)
+ x = pSprite->physLimits.x1;
+ else if (x >= pSprite->physLimits.x2)
+ x = pSprite->physLimits.x2 - 1;
+ if (y < pSprite->physLimits.y1)
+ y = pSprite->physLimits.y1;
+ else if (y >= pSprite->physLimits.y2)
+ y = pSprite->physLimits.y2 - 1;
+ }
XineramaSetCursorPosition(PickPointer(client), x, y, TRUE);
return Success;
@@ -3619,16 +3625,18 @@ ProcWarpPointer(ClientPtr client)
y = newScreen->height - 1;
if (newScreen == pSprite->hotPhys.pScreen) {
- if (x < pSprite->physLimits.x1)
- x = pSprite->physLimits.x1;
- else if (x >= pSprite->physLimits.x2)
- x = pSprite->physLimits.x2 - 1;
- if (y < pSprite->physLimits.y1)
- y = pSprite->physLimits.y1;
- else if (y >= pSprite->physLimits.y2)
- y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
ConfineToShape(dev, pSprite->hotShape, &x, &y);
+ else {
+ if (x < pSprite->physLimits.x1)
+ x = pSprite->physLimits.x1;
+ else if (x >= pSprite->physLimits.x2)
+ x = pSprite->physLimits.x2 - 1;
+ if (y < pSprite->physLimits.y1)
+ y = pSprite->physLimits.y1;
+ else if (y >= pSprite->physLimits.y2)
+ y = pSprite->physLimits.y2 - 1;
+ }
(*newScreen->SetCursorPosition) (dev, newScreen, x, y, TRUE);
}
else if (!PointerConfinedToScreen(dev)) {

View File

@ -1,108 +0,0 @@
From: Egbert Eich <eich@suse.de>
DIX/ConfineTo: Improve algorithm to jump to the nearest point inside
ConfineToShape does not work well: The cursor often times doesn't jump
to the point closest to the current cursor position outside the shape.
This patch fixes this.
--- 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

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Thu Feb 25 20:54:32 UTC 2016 - eich@suse.com
- Add 50-extensions.conf
Disable the DGA extension by default (boo#947695).
-------------------------------------------------------------------
Thu Feb 25 20:53:20 UTC 2016 - eich@suse.com
- Replaced u_confine_to_shape.diff
by u_01-Improved-ConfineToShape.patch
and u_02-DIX-ConfineTo-Don-t-bother-about-the-bounding-box-when-grabbing-a-shaped-window.patch.
-------------------------------------------------------------------
Wed Feb 10 15:07:32 UTC 2016 - eich@suse.com

View File

@ -37,6 +37,7 @@ Source1: sysconfig.displaymanager.template
Source2: README.updates
Source3: xorgcfg.tar.bz2
Source4: xorg-backtrace
Source5: 50-extensions.conf
# RPM Macros to be installed. The ABI Versions will be injected by configure.
Source90: xorg-x11-server.macros.in
# Source91 and Source99 are used to ensure proper ABI provides.
@ -163,7 +164,8 @@ Patch3: N_driver-autoconfig.diff
Patch4: N_fix_fglrx_screendepth_issue.patch
Patch6: N_fix-dpi-values.diff
Patch101: u_confine_to_shape.diff
Patch100: u_01-Improved-ConfineToShape.patch
Patch101: u_02-DIX-ConfineTo-Don-t-bother-about-the-bounding-box-when-grabbing-a-shaped-window.patch
# PATCH-FIX-UPSTREAM u_x86emu-include-order.patch schwab@suse.de -- Change include order to avoid conflict with system header, remove duplicate definitions
Patch102: u_x86emu-include-order.patch
Patch104: u_xorg-server-xdmcp.patch
@ -268,7 +270,8 @@ sh %{SOURCE92} --verify . %{SOURCE91}
%patch4 -p0
%patch6 -p0
#
%patch101
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch104 -p1
%patch106 -p1
@ -376,6 +379,7 @@ rm -f %{buildroot}/%{_datadir}/X11/xorg.conf.d/10-evdev.conf
%ifnarch s390 s390x
mkdir -p %{buildroot}%{_sysconfdir}/X11/xorg.conf.d
cp %{buildroot}/%{_datadir}/X11/xorg.conf.d/10-quirks.conf %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/
%{__install} -m 644 %{S:5} %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/
%endif
%endif
%if 0%{?suse_version} < 1315
@ -459,6 +463,7 @@ fi
%if 0%{?suse_version} > 1120
%dir %{_sysconfdir}/X11/xorg.conf.d
%config(noreplace) %{_sysconfdir}/X11/xorg.conf.d/10-quirks.conf
%config(noreplace) %{_sysconfdir}/X11/xorg.conf.d/50-extensions.conf
%dir %{_datadir}/X11/xorg.conf.d
%{_datadir}/X11/xorg.conf.d/10-*.conf
%endif