[pkg-remote-commits] [nx-libs] 01/02: debian/patches: Cherry-pick upstream-proposed patch 0002_xinerama-bbox-corner-cases.patch. Correct sending RandR events when the agent window is moved into invisible parts of the real Xserver.

Mike Gabriel sunweaver at debian.org
Fri Mar 2 13:19:41 UTC 2018


This is an automated email from the git hooks/post-receive script.

sunweaver pushed a commit to branch master
in repository nx-libs.

commit c14cf8f9496764a941faaa30a8e13ac3d99bdb65
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Mar 2 14:11:20 2018 +0100

    debian/patches: Cherry-pick upstream-proposed patch 0002_xinerama-bbox-corner-cases.patch. Correct sending RandR events when the agent window is moved into invisible parts of the real Xserver.
---
 .../patches/0002_xinerama-bbox-corner-cases.patch  | 355 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 2 files changed, 356 insertions(+)

diff --git a/debian/patches/0002_xinerama-bbox-corner-cases.patch b/debian/patches/0002_xinerama-bbox-corner-cases.patch
new file mode 100644
index 0000000..512d60a
--- /dev/null
+++ b/debian/patches/0002_xinerama-bbox-corner-cases.patch
@@ -0,0 +1,355 @@
+From dffb7169b21adc5f0dad245ce9e70de2b55f0df7 Mon Sep 17 00:00:00 2001
+From: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
+Date: Fri, 2 Mar 2018 14:01:29 +0100
+Subject: [PATCH] hw/nxagent/Screen.c: Cover Xinerama bounding box corner
+ cases.
+
+  If the agent window is moved around on screen, it can happen
+  that it is moved into an invisible area of the real Xserver,
+  we calls this "beyond the bounding box".
+  .
+  If the agent window is partially beyond the bounding box, we
+  don't want Xinerama to re-adjust the RandR parameters inside the
+  agent. Near the bounding box, the session shall stay intact.
+  .
+  This means, desktop env wise, the desktop session control
+  elements can be moved (with the agent window) into the invisible
+  areas of the real Xserver and moved out again without RandR
+  events arriving inside the agent session.
+
+Fixes ArcticaProject/nx-libs#662.
+---
+ nx-X11/programs/Xserver/hw/nxagent/Screen.c | 299 ++++++++++++++++++++++++++--
+ 1 file changed, 285 insertions(+), 14 deletions(-)
+
+diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+index 628bf990a4..16d31a8d55 100644
+--- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c
++++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c
+@@ -3674,24 +3674,292 @@ Bool intersect_bb(int ax1, int ay1, unsigned int aw, unsigned int ah,
+ 	       int bbx1, int bby1, int bbx2, int bby2,
+ 	       int *x, int *y, unsigned int *w, unsigned int *h)
+ {
++
++  int width = -1;
++  int height = -1;
++
++  #ifdef DEBUG
++  fprintf(stderr, "intersect_bb: session window: ([%d],[%d]) [%d x %d ]\n", ax1, ay1, aw, ah);
++  fprintf(stderr, "intersect_bb: crtc: ([%d],[%d]) [%d x %d ]\n", bx1, by1, bw, bh);
++  fprintf(stderr, "intersect_bb: bounding box: ([%d],[%d]) [%d x %d ]\n", bbx1, bby1, bbx2-bbx1, bby2-bby1);
++  #endif
++
+   Bool result = intersect(ax1, ay1, aw, ah, bx1, by1, bw, bh, x, y, w, h);
++
+   if (result == TRUE) {
+-    /* check if outside of bounding box */
+-    if (ax1 < bbx1 || ax1 + aw > bbx2) {
+-        #ifdef DEBUG
+-        fprintf(stderr, "intersect: box has parts outside bounding box - width stays unchanged [%d]\n", aw);
+-        #endif
+-	*w = aw;
++
++    /*
++     * ###### The X-Coordinate ######
++     */
++
++    /* check if outside-left of bounding box */
++    if (ax1 < bbx1) {
++
++	/* ax1 outside bounding box is negative, our
++         * x parameter shall never be negative, so zeroing it out...
++         */
++	*x = 0;
++
++	#ifdef DEBUG
++	fprintf(stderr, "intersect_bb: box is outside-left of bounding box - width gets adapted (see below)\n");
++	#endif
++
++	if (bx1 == bbx1 && ax1 + aw > bx1 + bw) {
++	    /* The session window width starts outside-left of
++	     * the bounding box and spreads across the left CRTC into
++	     * another CRTC further on the right.
++	     *
++	     *
++	     *  full CRTC width   plus: offset outside-left of the bounding box
++	     *      |                     |
++	     *      v                     v
++	     */
++	    width = bw            + (bbx1 - ax1);
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: width = bw + (bbx1 - ax1) = [%d]\n", width);
++	    #endif
++	} else if (bx1 > bbx1 && ax1 + aw > bx1 + bw) {
++	    /* The session window width spreads across this
++	     * whole CRTC coming from the left into the one
++	     * on the right.
++	     */
++	    width = bw;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: width = bw = [%d]\n", width);
++	    #endif
++	} else if (bx1 > bbx1 && ax1 + aw < bx1 + bw) {
++	    /* The session window width ends in this CRTC.
++	     *
++	     * Left of this CRTC is assumed to be another CRTC.
++	     *
++	     *
++	     * right session window border    minus: left border of this CRTC
++	     *           |                       |
++	     *           v                       v
++	     */
++	    width = (ax1 + aw)                - bx1;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: width = (ax1 + aw) - bx1 = [%d]\n", width);
++	    #endif
++	} else if (bx1 > bbx1 && ax1 + aw > bx1 + bw && bx1 + bw == bbx2) {
++	    /* The session window width spreads beyond the
++	     * right side of the bounding box. (It starts and ends
++	     * in the bounding box x-wise.
++	     *
++	     * (Same calculation as above...)
++	     * right session window border    minus: left border of this CRTC
++	     *           |                       |
++	     *           v                       v
++	     */
++	    width = (ax1 + aw)                - bx1;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: width = (ax1 + aw) - bx1 = [%d]\n", width);
++	    #endif
++	}
+     }
+ 
+-    if (ay1 < bby1 || ay1 + ah > bby2) {
+-        #ifdef DEBUG
+-        fprintf(stderr, "intersect: box has parts outside bounding box - height stays unchanged [%d]\n", ah);
+-        #endif
+-	*h = ah;
++    /* check if outside-right of bounding box */
++    else if (ax1 + aw > bbx2) {
++
++	#ifdef DEBUG
++	fprintf(stderr, "intersect_bb: box is outside-right of the bounding box - width gets adapted (see below)\n");
++	#endif
++
++	if (bx1 + bw < bbx2 && bx1 < ax1 && ax1 < bx1 + bw) {
++	    /* The session window width starts in this CRTC and
++	     * spreads over into the next CRTC to the right and
++	     * and beyond into the right side of the bounding
++	     * box.
++	     *
++	     * Left of this CRTC is assumed to be another CRTC.
++	     *
++	     * right border of this CRTC    minus: left border of session window
++	     *           |                       |
++	     *           v                       v
++	     */
++	    width = (bx1 + bw)                - ax1;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: width = (bx1 + bw) - ax1 = [%d]\n", width);
++	    #endif
++	} else if (bx1 + bw < bbx2 && ax1 < bx1) {
++	    /* The session window width spreads across this
++	     * whole CRTC coming from the left into the one
++	     * on the right.
++	     */
++	    width = bw;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: width = bw = [%d]\n", width);
++	    #endif
++	} else if (bx1 + bw == bbx2 && ax1 < bx1) {
++	    /* The session window width spreads across the whole
++	     * CRTC and has some rest-width outside-right of the
++	     * bounding box.
++	     *
++	     * right border of session window  minus: left border of CRTC
++	     *           |                       |
++	     *           v                       v
++	     */
++	    width = (ax1 + aw)                   - bx1;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: width = (ax1 + aw) - bx1 = [%d]\n", width);
++	    #endif
++	}
+     }
+-  }
+ 
++    if ((ax1 < bbx1 || ax1 + aw > bbx2) && width == -1) {
++      #ifdef DEBUG
++      fprintf(stderr, "intersect_bb: width stays unchanged [%d]\n", aw);
++      #endif
++
++      /* Catch all other beyond-bounding-box cases.
++       *
++       * This mainly is: session window is x-wise on one CRTC only.
++       */
++      *w = aw;
++
++    } else if (ax1 < bbx1 || ax1 + aw > bbx2) {
++      #ifdef DEBUG
++      fprintf(stderr, "intersect_bb: bounding box adapted width gets set to [%d]\n", width);
++      #endif
++      *w = abs(width);
++    }
++
++    /*
++     * ###### The Y-Coordinate ######
++     */
++
++    /* check if outside-above of bounding box */
++    if (ay1 < bby1) {
++
++	/* ay1 outside bounding box is negative, our
++         * y parameter shall never be negative, so zeroing it out...
++         */
++	*y = 0;
++
++	#ifdef DEBUG
++	fprintf(stderr, "intersect_bb: box is outside-above of bounding box - height gets adapted (see below)\n");
++	#endif
++
++	if (by1 == bby1 && ay1 + ah > by1 + bh) {
++	    /* The session window height starts outside-above of
++	     * the bounding box and spreads across the CRTC above into
++	     * another CRTC further below.
++	     *
++	     *
++	     *  full CRTC height   plus: offset outside-above of the bounding box
++	     *      |                     |
++	     *      v                     v
++	     */
++	    height = bh            + (bby1 - ay1);
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: height = bh + (bby1 - ay1) = [%d]\n", height);
++	    #endif
++	} else if (by1 > bby1 && ay1 + ah > by1 + bh) {
++	    /* The session window height spreads across this
++	     * whole CRTC coming from above into the one
++	     * below.
++	     */
++	    height = bh;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: height = bh = [%d]\n", height);
++	    #endif
++	} else if (by1 > bby1 && ay1 + ah < by1 + bh) {
++	    /* The session window height ends in this CRTC.
++	     *
++	     * Above of this CRTC is assumed to be another CRTC.
++	     *
++	     *
++	     * bottom session window border   minus: top border of this CRTC
++	     *           |                       |
++	     *           v                       v
++	     */
++	    height = (ay1 + ah)                - by1;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: height = (ay1 + ah) - by1 = [%d]\n", height);
++	    #endif
++	} else if (by1 > bby1 && ay1 + ah > by1 + bh && by1 + bh == bby2) {
++	    /* The session window height spreads below the bottom of the
++	     * bounding box. (It starts and ends in the bounding box y-wise).
++	     *
++	     * (Same calculation as above...)
++	     * bottom session window border    minus: top border of this CRTC
++	     *           |                       |
++	     *           v                       v
++	     */
++	    height = (ay1 + ah)                - by1;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: height = (ay1 + ah) - by1 = [%d]\n", height);
++	    #endif
++	}
++    }
++
++    /* check if outside-below of bounding box */
++    else if (ay1 + ah > bby2) {
++
++	#ifdef DEBUG
++	fprintf(stderr, "intersect_bb: box is outside-below of the bounding box - height gets adapted (see below)\n");
++	#endif
++
++	if (by1 + bh < bby2 && by1 < ay1 && ay1 < by1 + bh) {
++	    /* The session window height starts in this CRTC and
++	     * spreads over into the next CRTC to the right and
++	     * and beyond into the right side of the bounding
++	     * box.
++	     *
++	     * Above this CRTC is assumed to be another CRTC.
++	     *
++	     * bottom border of this CRTC     minus: top border of session window
++	     *           |                       |
++	     *           v                       v
++	     */
++	    height = (by1 + bh)                - ay1;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: height = (by1 + bh) - ay1 = [%d]\n", height);
++	    #endif
++	} else if (by1 + bh < bby2 && ay1 < by1) {
++	    /* The session window height spreads across this
++	     * whole CRTC coming from above into the one
++	     * below.
++	     */
++	    height = bh;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: height = bh = [%d]\n", height);
++	    #endif
++	} else if (by1 + bh == bby2 && ay1 < by1) {
++	    /* The session window height spreads across the whole
++	     * CRTC and has some rest-height outside-below of the
++	     * bottom bounding box border.
++	     *
++	     * bottom border of session window  minus: top border of CRTC
++	     *           |                       |
++	     *           v                       v
++	     */
++	    height = (ay1 + ah)                   - by1;
++	    #ifdef DEBUG
++	    fprintf(stderr, "intersect_bb: height = (ay1 + ah) - by1 = [%d]\n", height);
++	    #endif
++	}
++    }
++
++    if ((ay1 < bby1 || ay1 + ah > bby2) && height == -1) {
++      #ifdef DEBUG
++      fprintf(stderr, "intersect_bb: height stays unchanged [%d]\n", ah);
++      #endif
++
++      /* Catch all other beyond-bounding-box cases.
++       *
++       * This mainly is: session window is y-wise on one CRTC only.
++       */
++      *h = ah;
++
++    } else if (ay1 < bby1 || ay1 + ah > bby2) {
++      #ifdef DEBUG
++      fprintf(stderr, "intersect_bb: bounding box adapted height gets set to [%d]\n", height);
++      #endif
++      *h = abs(height);
++    }
++
++  }
+   return result;
+ }
+ #endif
+@@ -4057,8 +4325,10 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
+     for (i = 0; i < pScrPriv->numOutputs; i++) {
+       Bool disable_output = FALSE;
+       RRModePtr mymode, prevmode;
+-      int new_x, new_y;
+-      unsigned int new_w, new_h;
++      int new_x = 0;
++      int new_y = 0;
++      unsigned int new_w = 0;
++      unsigned int new_h = 0;
+ 
+       /*
+       if ((nxagentOption(X) < bbx1 || (nxagentOption(X) + width >= bbx2 )) {
+@@ -4179,6 +4449,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen)
+ 	     refcnt by 1. We decrease it again by calling only
+ 	     RRModeDestroy() and forget about prevmode */
+ 	  RRModeDestroy(mymode);
++	  RRCrtcSet(pScrPriv->crtcs[i], mymode, new_x, new_y, RR_Rotate_0, 1, &(pScrPriv->outputs[i]));
+         }
+         else
+ 	{ 
+
diff --git a/debian/patches/series b/debian/patches/series
index 80ac554..e3d4378 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 2001_nx-X11_install-location.debian.patch
 2002_xserver-xext_set-securitypolicy-path.debian.patch
 0001_default-dpi-96.patch
+0002_xinerama-bbox-corner-cases.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-remote/nx-libs.git



More information about the pkg-remote-commits mailing list