diff options
author | Pierre Ossman <ossman@cendio.se> | 2016-08-18 16:19:30 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2016-08-18 16:19:30 +0200 |
commit | 6ec09fe34b704157fe51908cbfe2723d4ab8ca9f (patch) | |
tree | 6887a199904a0a5c9dea277a4060bb866efa6a2d | |
parent | 3fb9479caac55202b3b39d065bb34d4b2bc36b89 (diff) | |
download | tigervnc-6ec09fe34b704157fe51908cbfe2723d4ab8ca9f.tar.gz tigervnc-6ec09fe34b704157fe51908cbfe2723d4ab8ca9f.zip |
Proper multi-screen support in Xvnc
Xvnc didn't handle multiple screens properly as it forgot to place
them without overlap and didn't handle cursor movement between them.
-rw-r--r-- | unix/xserver/hw/vnc/xvnc.c | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c index 80148ca2..c5b684de 100644 --- a/unix/xserver/hw/vnc/xvnc.c +++ b/unix/xserver/hw/vnc/xvnc.c @@ -854,6 +854,40 @@ vfbFreeFramebufferMemory(vfbFramebufferInfoPtr pfb) static Bool vfbCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y) { + int absX, absY; + int i; + + if (screenInfo.numScreens == 1) + return FALSE; + + if ((*x >= 0) && (*x < (*ppScreen)->width) && + (*y >= 0) && (*y < (*ppScreen)->height)) + return FALSE; + + absX = *x + (*ppScreen)->x; + absY = *y + (*ppScreen)->y; + + for (i = 0;i < screenInfo.numScreens;i++) { + ScreenPtr newScreen; + + newScreen = screenInfo.screens[i]; + + if (absX < newScreen->x) + continue; + if (absY < newScreen->y) + continue; + if (absX >= (newScreen->x + newScreen->width)) + continue; + if (absY >= (newScreen->y + newScreen->height)) + continue; + + *ppScreen = newScreen; + *x = absX - newScreen->x; + *y = absY - newScreen->y; + + return TRUE; + } + return FALSE; } @@ -1456,11 +1490,10 @@ vfbScreenInit(int index, ScreenPtr pScreen, int argc, char **argv) vfbScreenInit(ScreenPtr pScreen, int argc, char **argv) #endif { -#if XORG < 113 - vfbScreenInfoPtr pvfb = &vfbScreens[index]; -#else - vfbScreenInfoPtr pvfb = &vfbScreens[pScreen->myNum]; +#if XORG >= 113 + int index = pScreen->myNum; #endif + vfbScreenInfoPtr pvfb = &vfbScreens[index]; int dpi; int ret; void *pbits; @@ -1481,13 +1514,8 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv) pbits = vfbAllocateFramebufferMemory(&pvfb->fb); if (!pbits) return FALSE; -#if XORG < 113 vncFbptr[index] = pbits; vncFbstride[index] = pvfb->fb.paddedWidth; -#else - vncFbptr[pScreen->myNum] = pbits; - vncFbstride[pScreen->myNum] = pvfb->fb.paddedWidth; -#endif miSetPixmapDepths(); @@ -1524,6 +1552,12 @@ vfbScreenInit(ScreenPtr pScreen, int argc, char **argv) return FALSE; } + if (index > 0) { + ScreenPtr prevScreen = screenInfo.screens[index-1]; + pScreen->x = prevScreen->x + prevScreen->width; + pScreen->y = 0; + } + ret = fbScreenInit(pScreen, pbits, pvfb->fb.width, pvfb->fb.height, dpi, dpi, pvfb->fb.paddedWidth, pvfb->fb.bitsPerPixel); |