Browse Source

Remove vfb references from symbol names

Xvnc was originally based on Xvfb, but it's just confusing to keep the
names. So change all prefix to "vnc" instead to clearly mark things as
part of TigerVNC.
tags/v1.11.90
Pierre Ossman 2 years ago
parent
commit
ed079a4049

+ 2
- 2
unix/xserver/hw/vnc/vncExtInit.cc View File

} }
} }


void vncSetCursor(int width, int height, int hotX, int hotY,
const unsigned char *rgbaData)
void vncSetCursorSprite(int width, int height, int hotX, int hotY,
const unsigned char *rgbaData)
{ {
for (int scr = 0; scr < vncGetScreenCount(); scr++) for (int scr = 0; scr < vncGetScreenCount(); scr++)
desktop[scr]->setCursor(width, height, hotX, hotY, rgbaData); desktop[scr]->setCursor(width, height, hotX, hotY, rgbaData);

+ 2
- 2
unix/xserver/hw/vnc/vncExtInit.h View File

const struct UpdateRect *rects, const struct UpdateRect *rects,
int dx, int dy); int dx, int dy);


void vncSetCursor(int width, int height, int hotX, int hotY,
const unsigned char *rgbaData);
void vncSetCursorSprite(int width, int height, int hotX, int hotY,
const unsigned char *rgbaData);
void vncSetCursorPos(int scrIdx, int x, int y); void vncSetCursorPos(int scrIdx, int x, int y);


void vncPreScreenResize(int scrIdx); void vncPreScreenResize(int scrIdx);

+ 1
- 1
unix/xserver/hw/vnc/vncHooks.c View File

} }
} }


vncSetCursor(width, height, hotX, hotY, rgbaData);
vncSetCursorSprite(width, height, hotX, hotY, rgbaData);


free(rgbaData); free(rgbaData);
} }

+ 64
- 64
unix/xserver/hw/vnc/xvnc.c View File

#define XVNCCOPYRIGHT ("Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)\n" \ #define XVNCCOPYRIGHT ("Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)\n" \
"See https://www.tigervnc.org for information on TigerVNC.\n") "See https://www.tigervnc.org for information on TigerVNC.\n")


#define VFB_DEFAULT_WIDTH 1024
#define VFB_DEFAULT_HEIGHT 768
#define VFB_DEFAULT_DEPTH 24
#define VNC_DEFAULT_WIDTH 1024
#define VNC_DEFAULT_HEIGHT 768
#define VNC_DEFAULT_DEPTH 24


typedef struct { typedef struct {
int width; int width;
int depth; int depth;
int bitsPerPixel; int bitsPerPixel;
void *pfbMemory; void *pfbMemory;
} vfbFramebufferInfo, *vfbFramebufferInfoPtr;
} VncFramebufferInfo, *VncFramebufferInfoPtr;


typedef struct { typedef struct {
vfbFramebufferInfo fb;
VncFramebufferInfo fb;


Bool pixelFormatDefined; Bool pixelFormatDefined;
Bool rgbNotBgr; Bool rgbNotBgr;
int redBits, greenBits, blueBits; int redBits, greenBits, blueBits;
} vfbScreenInfo, *vfbScreenInfoPtr;
} VncScreenInfo, *VncScreenInfoPtr;


static vfbScreenInfo vncScreenInfo = {
.fb.width = VFB_DEFAULT_WIDTH,
.fb.height = VFB_DEFAULT_HEIGHT,
.fb.depth = VFB_DEFAULT_DEPTH,
static VncScreenInfo vncScreenInfo = {
.fb.width = VNC_DEFAULT_WIDTH,
.fb.height = VNC_DEFAULT_HEIGHT,
.fb.depth = VNC_DEFAULT_DEPTH,
.fb.pfbMemory = NULL, .fb.pfbMemory = NULL,
.pixelFormatDefined = FALSE, .pixelFormatDefined = FALSE,
}; };


static Bool vfbPixmapDepths[33];
static Bool vncPixmapDepths[33];
static Bool Render = TRUE; static Bool Render = TRUE;


static Bool displaySpecified = FALSE; static Bool displaySpecified = FALSE;
} }


static void static void
vfbInitializePixmapDepths(void)
vncInitializePixmapDepths(void)
{ {
int i; int i;


vfbPixmapDepths[1] = TRUE; /* always need bitmaps */
vncPixmapDepths[1] = TRUE; /* always need bitmaps */
for (i = 2; i <= 32; i++) for (i = 2; i <= 32; i++)
vfbPixmapDepths[i] = FALSE;
vncPixmapDepths[i] = FALSE;
} }


static int static int
vfbBitsPerPixel(int depth)
vncBitsPerPixel(int depth)
{ {
if (depth == 1) if (depth == 1)
return 1; return 1;
return 32; return 32;
} }


static void vfbFreeFramebufferMemory(vfbFramebufferInfoPtr pfb);
static void vncFreeFramebufferMemory(VncFramebufferInfoPtr pfb);


#ifdef DPMSExtension #ifdef DPMSExtension
#if XORG_OLDER_THAN(1, 20, 0) #if XORG_OLDER_THAN(1, 20, 0)
ddxGiveUp(enum ExitCode error) ddxGiveUp(enum ExitCode error)
{ {
/* clean up the framebuffers */ /* clean up the framebuffers */
vfbFreeFramebufferMemory(&vncScreenInfo.fb);
vncFreeFramebufferMemory(&vncScreenInfo.fb);
} }


void void
/* Force -noreset as default until we properly handle resets */ /* Force -noreset as default until we properly handle resets */
dispatchExceptionAtReset = 0; dispatchExceptionAtReset = 0;


vfbInitializePixmapDepths();
vncInitializePixmapDepths();
firstTime = FALSE; firstTime = FALSE;
vncInitRFB(); vncInitRFB();
} }
FatalError("Invalid pixmap depth %d passed to -pixdepths\n", FatalError("Invalid pixmap depth %d passed to -pixdepths\n",
depth); depth);
} }
vfbPixmapDepths[depth] = TRUE;
vncPixmapDepths[depth] = TRUE;
ret++; ret++;
} }
return ret; return ret;
} }


static Bool static Bool
vfbSaveScreen(ScreenPtr pScreen, int on)
vncSaveScreen(ScreenPtr pScreen, int on)
{ {
return TRUE; return TRUE;
} }


static void * static void *
vfbAllocateFramebufferMemory(vfbFramebufferInfoPtr pfb)
vncAllocateFramebufferMemory(VncFramebufferInfoPtr pfb)
{ {
size_t sizeInBytes; size_t sizeInBytes;




/* Compute memory layout */ /* Compute memory layout */
pfb->paddedBytesWidth = PixmapBytePad(pfb->width, pfb->depth); pfb->paddedBytesWidth = PixmapBytePad(pfb->width, pfb->depth);
pfb->bitsPerPixel = vfbBitsPerPixel(pfb->depth);
pfb->bitsPerPixel = vncBitsPerPixel(pfb->depth);
pfb->paddedWidth = pfb->paddedBytesWidth * 8 / pfb->bitsPerPixel; pfb->paddedWidth = pfb->paddedBytesWidth * 8 / pfb->bitsPerPixel;


/* And allocate buffer */ /* And allocate buffer */
} }


static void static void
vfbFreeFramebufferMemory(vfbFramebufferInfoPtr pfb)
vncFreeFramebufferMemory(VncFramebufferInfoPtr pfb)
{ {
if ((pfb == NULL) || (pfb->pfbMemory == NULL)) if ((pfb == NULL) || (pfb->pfbMemory == NULL))
return; return;
} }


static Bool static Bool
vfbCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
vncCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y)
{ {
return FALSE; return FALSE;
} }


static void static void
vfbCrossScreen(ScreenPtr pScreen, Bool entering)
vncCrossScreen(ScreenPtr pScreen, Bool entering)
{ {
} }


static Bool static Bool
vfbRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
vncRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{ {
return TRUE; return TRUE;
} }


static Bool static Bool
vfbUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
vncUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{ {
return TRUE; return TRUE;
} }


static void static void
vfbSetCursor(DeviceIntPtr pDev,
vncSetCursor(DeviceIntPtr pDev,
ScreenPtr pScreen, CursorPtr pCursor, int x, int y) ScreenPtr pScreen, CursorPtr pCursor, int x, int y)
{ {
} }


static void static void
vfbMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
vncMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{ {
} }


static Bool static Bool
vfbDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
vncDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{ {
return TRUE; return TRUE;
} }


static void static void
vfbDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
vncDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{ {
} }


static miPointerSpriteFuncRec vfbPointerSpriteFuncs = {
vfbRealizeCursor,
vfbUnrealizeCursor,
vfbSetCursor,
vfbMoveCursor,
vfbDeviceCursorInitialize,
vfbDeviceCursorCleanup
static miPointerSpriteFuncRec vncPointerSpriteFuncs = {
vncRealizeCursor,
vncUnrealizeCursor,
vncSetCursor,
vncMoveCursor,
vncDeviceCursorInitialize,
vncDeviceCursorCleanup
}; };


static miPointerScreenFuncRec vfbPointerCursorFuncs = {
vfbCursorOffScreen,
vfbCrossScreen,
static miPointerScreenFuncRec vncPointerCursorFuncs = {
vncCursorOffScreen,
vncCrossScreen,
miPointerWarpCursor miPointerWarpCursor
}; };


CARD16 width, CARD16 height, CARD16 width, CARD16 height,
CARD32 mmWidth, CARD32 mmHeight) CARD32 mmWidth, CARD32 mmHeight)
{ {
vfbFramebufferInfo fb;
VncFramebufferInfo fb;
rrScrPrivPtr rp = rrGetScrPriv(pScreen); rrScrPrivPtr rp = rrGetScrPriv(pScreen);
PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen); PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen);
void *pbits; void *pbits;
pScreen->mmHeight = mmHeight; pScreen->mmHeight = mmHeight;


/* Allocate a new framebuffer */ /* Allocate a new framebuffer */
memset(&fb, 0, sizeof(vfbFramebufferInfo));
memset(&fb, 0, sizeof(VncFramebufferInfo));


fb.width = pScreen->width; fb.width = pScreen->width;
fb.height = pScreen->height; fb.height = pScreen->height;
fb.depth = vncScreenInfo.fb.depth; fb.depth = vncScreenInfo.fb.depth;


pbits = vfbAllocateFramebufferMemory(&fb);
pbits = vncAllocateFramebufferMemory(&fb);
if (!pbits) { if (!pbits) {
/* Allocation failed. Restore old state */ /* Allocation failed. Restore old state */
pScreen->width = oldwidth; pScreen->width = oldwidth;
-1, -1, fb.paddedBytesWidth, pbits); -1, -1, fb.paddedBytesWidth, pbits);
if (!ret) { if (!ret) {
/* Update failed. Free the new framebuffer and restore old state */ /* Update failed. Free the new framebuffer and restore old state */
vfbFreeFramebufferMemory(&fb);
vncFreeFramebufferMemory(&fb);


pScreen->width = oldwidth; pScreen->width = oldwidth;
pScreen->height = oldheight; pScreen->height = oldheight;
} }


/* Free the old framebuffer and keep the info about the new one */ /* Free the old framebuffer and keep the info about the new one */
vfbFreeFramebufferMemory(&vncScreenInfo.fb);
vncFreeFramebufferMemory(&vncScreenInfo.fb);
vncScreenInfo.fb = fb; vncScreenInfo.fb = fb;


/* Let VNC get the new framebuffer (actual update is in vncHooks.cc) */ /* Let VNC get the new framebuffer (actual update is in vncHooks.cc) */
} }


static Bool static Bool
vfbScreenInit(ScreenPtr pScreen, int argc, char **argv)
vncScreenInit(ScreenPtr pScreen, int argc, char **argv)
{ {
int dpi; int dpi;
int ret; int ret;
if (monitorResolution) if (monitorResolution)
dpi = monitorResolution; dpi = monitorResolution;


pbits = vfbAllocateFramebufferMemory(&vncScreenInfo.fb);
pbits = vncAllocateFramebufferMemory(&vncScreenInfo.fb);
if (!pbits) if (!pbits)
return FALSE; return FALSE;
vncFbptr[0] = pbits; vncFbptr[0] = pbits;
if (!ret) if (!ret)
return FALSE; return FALSE;


pScreen->SaveScreen = vfbSaveScreen;
pScreen->SaveScreen = vncSaveScreen;


miPointerInitialize(pScreen, &vfbPointerSpriteFuncs, &vfbPointerCursorFuncs,
miPointerInitialize(pScreen, &vncPointerSpriteFuncs, &vncPointerCursorFuncs,
FALSE); FALSE);


if (!vncScreenInfo.pixelFormatDefined) { if (!vncScreenInfo.pixelFormatDefined) {


return TRUE; return TRUE;


} /* end vfbScreenInit */
} /* end vncScreenInit */


static void static void
vfbClientStateChange(CallbackListPtr *a, void *b, void *c)
vncClientStateChange(CallbackListPtr *a, void *b, void *c)
{ {
if (dispatchException & DE_RESET) { if (dispatchException & DE_RESET) {
ErrorF("Warning: VNC extension does not support -reset, terminating instead. Use -noreset to prevent termination.\n"); ErrorF("Warning: VNC extension does not support -reset, terminating instead. Use -noreset to prevent termination.\n");
/* initialize pixmap formats */ /* initialize pixmap formats */


/* must have a pixmap depth to match every screen depth */ /* must have a pixmap depth to match every screen depth */
vfbPixmapDepths[vncScreenInfo.fb.depth] = TRUE;
vncPixmapDepths[vncScreenInfo.fb.depth] = TRUE;


/* RENDER needs a good set of pixmaps. */ /* RENDER needs a good set of pixmaps. */
if (Render) { if (Render) {
vfbPixmapDepths[1] = TRUE;
vfbPixmapDepths[4] = TRUE;
vfbPixmapDepths[8] = TRUE;
/* vfbPixmapDepths[15] = TRUE; */
vfbPixmapDepths[16] = TRUE;
vfbPixmapDepths[24] = TRUE;
vfbPixmapDepths[32] = TRUE;
vncPixmapDepths[1] = TRUE;
vncPixmapDepths[4] = TRUE;
vncPixmapDepths[8] = TRUE;
/* vncPixmapDepths[15] = TRUE; */
vncPixmapDepths[16] = TRUE;
vncPixmapDepths[24] = TRUE;
vncPixmapDepths[32] = TRUE;
} }


for (i = 1; i <= 32; i++) { for (i = 1; i <= 32; i++) {
if (vfbPixmapDepths[i]) {
if (vncPixmapDepths[i]) {
if (NumFormats >= MAXFORMATS) if (NumFormats >= MAXFORMATS)
FatalError("MAXFORMATS is too small for this server\n"); FatalError("MAXFORMATS is too small for this server\n");
scrInfo->formats[NumFormats].depth = i; scrInfo->formats[NumFormats].depth = i;
scrInfo->formats[NumFormats].bitsPerPixel = vfbBitsPerPixel(i);
scrInfo->formats[NumFormats].bitsPerPixel = vncBitsPerPixel(i);
scrInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD; scrInfo->formats[NumFormats].scanlinePad = BITMAP_SCANLINE_PAD;
NumFormats++; NumFormats++;
} }


/* initialize screen */ /* initialize screen */


if (AddScreen(vfbScreenInit, argc, argv) == -1) {
if (AddScreen(vncScreenInit, argc, argv) == -1) {
FatalError("Couldn't add screen\n"); FatalError("Couldn't add screen\n");
} }


if (!AddCallback(&ClientStateCallback, vfbClientStateChange, 0)) {
if (!AddCallback(&ClientStateCallback, vncClientStateChange, 0)) {
FatalError("AddCallback failed\n"); FatalError("AddCallback failed\n");
} }
} /* end InitOutput */ } /* end InitOutput */

Loading…
Cancel
Save