瀏覽代碼

Removed IRIX/Solaris overlay support

Legacy systems.
tags/v1.8.90
Peter Åstrand (astrand) 6 年之前
父節點
當前提交
dcd0b13965

+ 2
- 193
unix/x0vncserver/Image.cxx 查看文件

@@ -319,181 +319,14 @@ void ShmImage::get(Window wnd, int x, int y, int w, int h,
XGetSubImage(dpy, wnd, x, y, w, h, AllPlanes, ZPixmap, xim, dst_x, dst_y);
}

#ifdef HAVE_READDISPLAY

//
// IrixOverlayShmImage class implementation.
//

IrixOverlayShmImage::IrixOverlayShmImage(Display *d)
: ShmImage(d), readDisplayBuf(NULL)
{
}

IrixOverlayShmImage::IrixOverlayShmImage(Display *d, int width, int height)
: ShmImage(d), readDisplayBuf(NULL)
{
Init(width, height);
}

void IrixOverlayShmImage::Init(int width, int height)
{
// First determine the pixel format used by XReadDisplay.
XVisualInfo vinfo;
if (!getOverlayVisualInfo(&vinfo))
return;

// Create an SHM image of the same format.
ShmImage::Init(width, height, &vinfo);
if (xim == NULL)
return;

// FIXME: Check if the extension is available at run time.
readDisplayBuf = XShmCreateReadDisplayBuf(dpy, NULL, shminfo, width, height);
}

bool IrixOverlayShmImage::getOverlayVisualInfo(XVisualInfo *vinfo_ret)
{
// First, get an image in the format returned by XReadDisplay.
unsigned long hints = 0, hints_ret;
XImage *testImage = XReadDisplay(dpy, DefaultRootWindow(dpy),
0, 0, 8, 8, hints, &hints_ret);
if (testImage == NULL)
return false;

// Fill in a template for matching visuals.
XVisualInfo tmpl;
tmpl.c_class = TrueColor;
tmpl.depth = 24;
tmpl.red_mask = testImage->red_mask;
tmpl.green_mask = testImage->green_mask;
tmpl.blue_mask = testImage->blue_mask;

// List fields in template that make sense.
long mask = (VisualClassMask |
VisualRedMaskMask |
VisualGreenMaskMask |
VisualBlueMaskMask);

// We don't need that image any more.
XDestroyImage(testImage);

// Now, get a list of matching visuals available.
int nVisuals;
XVisualInfo *vinfo = XGetVisualInfo(dpy, mask, &tmpl, &nVisuals);
if (vinfo == NULL || nVisuals <= 0) {
if (vinfo != NULL) {
XFree(vinfo);
}
return false;
}

// Use first visual from the list.
*vinfo_ret = vinfo[0];

XFree(vinfo);

return true;
}

IrixOverlayShmImage::~IrixOverlayShmImage()
{
if (readDisplayBuf != NULL)
XShmDestroyReadDisplayBuf(readDisplayBuf);
}

void IrixOverlayShmImage::get(Window wnd, int x, int y)
{
get(wnd, x, y, xim->width, xim->height);
}

void IrixOverlayShmImage::get(Window wnd, int x, int y, int w, int h,
int dst_x, int dst_y)
{
XRectangle rect;
unsigned long hints = XRD_TRANSPARENT | XRD_READ_POINTER;

rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;

XShmReadDisplayRects(dpy, wnd,
&rect, 1, readDisplayBuf,
dst_x - x, dst_y - y,
hints, &hints);
}

#endif // HAVE_READDISPLAY

#ifdef HAVE_SUN_OVL

//
// SolarisOverlayImage class implementation
//

SolarisOverlayImage::SolarisOverlayImage(Display *d)
: Image(d)
{
}

SolarisOverlayImage::SolarisOverlayImage(Display *d, int width, int height)
: Image(d)
{
Init(width, height);
}

void SolarisOverlayImage::Init(int width, int height)
{
// FIXME: Check if the extension is available at run time.
// FIXME: Maybe just read a small (e.g. 8x8) screen area then
// reallocate xim->data[] and correct width and height?
xim = XReadScreen(dpy, DefaultRootWindow(dpy), 0, 0, width, height, True);
if (xim == NULL) {
vlog.error("XReadScreen() failed");
return;
}
}

SolarisOverlayImage::~SolarisOverlayImage()
{
}

void SolarisOverlayImage::get(Window wnd, int x, int y)
{
get(wnd, x, y, xim->width, xim->height);
}

void SolarisOverlayImage::get(Window wnd, int x, int y, int w, int h,
int dst_x, int dst_y)
{
XImage *tmp_xim = XReadScreen(dpy, wnd, x, y, w, h, True);
if (tmp_xim == NULL)
return;

updateRect(tmp_xim, dst_x, dst_y);

XDestroyImage(tmp_xim);
}

#endif // HAVE_SUN_OVL

//
// ImageFactory class implementation
//
// FIXME: Make ImageFactory always create images of the same class?
//

// Prepare useful shortcuts for compile-time options.
#if defined(HAVE_READDISPLAY)
#define HAVE_SHM_READDISPLAY
#endif
#if defined(HAVE_SHM_READDISPLAY) || defined(HAVE_SUN_OVL)
#define HAVE_OVERLAY_EXT
#endif

ImageFactory::ImageFactory(bool allowShm, bool allowOverlay)
: mayUseShm(allowShm), mayUseOverlay(allowOverlay)
ImageFactory::ImageFactory(bool allowShm)
: mayUseShm(allowShm)
{
}

@@ -505,30 +338,6 @@ Image *ImageFactory::newImage(Display *d, int width, int height)
{
Image *image = NULL;

// First, try to create an image with overlay support.

#ifdef HAVE_OVERLAY_EXT
if (mayUseOverlay) {
#if defined(HAVE_SHM_READDISPLAY)
if (mayUseShm) {
image = new IrixOverlayShmImage(d, width, height);
if (image->xim != NULL) {
return image;
}
}
#elif defined(HAVE_SUN_OVL)
image = new SolarisOverlayImage(d, width, height);
if (image->xim != NULL) {
return image;
}
#endif
if (image != NULL) {
delete image;
vlog.error("Failed to create overlay image, trying other options");
}
}
#endif // HAVE_OVERLAY_EXT

// Now, try to use shared memory image.

if (mayUseShm) {

+ 1
- 85
unix/x0vncserver/Image.h 查看文件

@@ -121,88 +121,6 @@ protected:

};

//
// IrixOverlayShmImage uses ReadDisplay extension of an X server to
// get truecolor image data, regardless of the default X visual type.
// This method is available on Irix only.
//

#ifdef HAVE_READDISPLAY

#include <X11/extensions/readdisplay.h>

class IrixOverlayShmImage : public ShmImage {

public:

IrixOverlayShmImage(Display *d);
IrixOverlayShmImage(Display *d, int width, int height);
virtual ~IrixOverlayShmImage();

virtual const char *className() const {
return "IrixOverlayShmImage";
}
virtual const char *classDesc() const {
return "IRIX-specific SHM-aware overlay image";
}

virtual void get(Window wnd, int x = 0, int y = 0);
virtual void get(Window wnd, int x, int y, int w, int h,
int dst_x = 0, int dst_y = 0);

protected:

void Init(int width, int height);

// This method searches available X visuals for one that matches
// actual pixel format returned by XReadDisplay(). Returns true on
// success, false if there is no matching visual. On success, visual
// information is placed into the structure pointed by vinfo_ret.
bool getOverlayVisualInfo(XVisualInfo *vinfo_ret);

ShmReadDisplayBuf *readDisplayBuf;

};

#endif // HAVE_READDISPLAY

//
// SolarisOverlayImage uses SUN_OVL extension of an X server to get
// truecolor image data, regardless of the default X visual type. This
// method is available on Solaris only.
//

#ifdef HAVE_SUN_OVL

#include <X11/extensions/transovl.h>

class SolarisOverlayImage : public Image {

public:

SolarisOverlayImage(Display *d);
SolarisOverlayImage(Display *d, int width, int height);
virtual ~SolarisOverlayImage();

virtual const char *className() const {
return "SolarisOverlayImage";
}
virtual const char *classDesc() const {
return "Solaris-specific non-SHM overlay image";
}

virtual void get(Window wnd, int x = 0, int y = 0);
virtual void get(Window wnd, int x, int y, int w, int h,
int dst_x = 0, int dst_y = 0);

protected:

void Init(int width, int height);

};

#endif // HAVE_SUN_OVL

//
// ImageFactory class is used to produce instances of Image-derived
// objects that are most appropriate for current X server and user
@@ -213,18 +131,16 @@ class ImageFactory {

public:

ImageFactory(bool allowShm, bool allowOverlay);
ImageFactory(bool allowShm);
virtual ~ImageFactory();

bool isShmAllowed() { return mayUseShm; }
bool isOverlayAllowed() { return mayUseOverlay; }

virtual Image *newImage(Display *d, int width, int height);

protected:

bool mayUseShm;
bool mayUseOverlay;

};


+ 1
- 2
unix/x0vncserver/XDesktop.cxx 查看文件

@@ -43,7 +43,6 @@ extern const unsigned short code_map_qnum_to_xorgkbd[];
extern const unsigned int code_map_qnum_to_xorgkbd_len;

extern rfb::BoolParameter useShm;
extern rfb::BoolParameter useOverlay;
extern rfb::BoolParameter rawKeyboard;

static rfb::LogWriter vlog("XDesktop");
@@ -192,7 +191,7 @@ void XDesktop::start(VNCServer* vs) {
maxButtons, (maxButtons != 1) ? "s" : "");

// Create an ImageFactory instance for producing Image objects.
ImageFactory factory((bool)useShm, (bool)useOverlay);
ImageFactory factory((bool)useShm);

// Create pixel buffer and provide it to the server object.
pb = new XPixelBuffer(dpy, factory, geometry->getRect());

+ 0
- 2
unix/x0vncserver/x0vncserver.cxx 查看文件

@@ -57,8 +57,6 @@ IntParameter pollingCycle("PollingCycle", "Milliseconds per one polling "
IntParameter maxProcessorUsage("MaxProcessorUsage", "Maximum percentage of "
"CPU time to be consumed", 35);
BoolParameter useShm("UseSHM", "Use MIT-SHM extension if available", true);
BoolParameter useOverlay("OverlayMode", "Use overlay mode under "
"IRIX or Solaris", true);
StringParameter displayname("display", "The X display", "");
IntParameter rfbport("rfbport", "TCP port to listen for RFB protocol",5900);
IntParameter queryConnectTimeout("QueryConnectTimeout",

+ 0
- 7
unix/x0vncserver/x0vncserver.man 查看文件

@@ -227,13 +227,6 @@ Use MIT-SHM extension if available. Using that extension accelerates reading
the screen. Default is on.
.
.TP
.B OverlayMode
Use overlay mode in IRIX or Solaris (does not have effect in other systems).
This enables system-specific access to complete full-color version of the
screen (the default X visual often provides 256 colors). Also, in overlay
mode, \fBx0vncserver\fP can show correct mouse cursor. Default is on.
.
.TP
.B ZlibLevel
Zlib compression level for ZRLE encoding (it does not affect Tight encoding).
Acceptable values are between 0 and 9. Default is to use the standard

Loading…
取消
儲存