mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2024-11-28 19:14:14 +01:00
Manually merged region changes
This commit is contained in:
parent
c3e30dcea1
commit
46e03289be
@ -36,7 +36,9 @@ namespace rfb {
|
|||||||
rdr::U32 __unused_attr keycode,
|
rdr::U32 __unused_attr keycode,
|
||||||
bool __unused_attr down) { }
|
bool __unused_attr down) { }
|
||||||
virtual void pointerEvent(const Point& __unused_attr pos,
|
virtual void pointerEvent(const Point& __unused_attr pos,
|
||||||
int __unused_attr buttonMask) { }
|
int __unused_attr buttonMask,
|
||||||
|
const bool __unused_attr skipClick,
|
||||||
|
const bool __unused_attr skipRelease) { }
|
||||||
virtual void clientCutText(const char* __unused_attr str,
|
virtual void clientCutText(const char* __unused_attr str,
|
||||||
int __unused_attr len) { }
|
int __unused_attr len) { }
|
||||||
};
|
};
|
||||||
|
@ -217,7 +217,7 @@ void SMsgReader::readPointerEvent()
|
|||||||
int mask = is->readU8();
|
int mask = is->readU8();
|
||||||
int x = is->readU16();
|
int x = is->readU16();
|
||||||
int y = is->readU16();
|
int y = is->readU16();
|
||||||
handler->pointerEvent(Point(x, y), mask);
|
handler->pointerEvent(Point(x, y), mask, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,6 +168,15 @@ rfb::StringParameter rfb::Server::DLP_Region
|
|||||||
"Black out anything outside this region",
|
"Black out anything outside this region",
|
||||||
"");
|
"");
|
||||||
|
|
||||||
|
rfb::BoolParameter rfb::Server::DLP_RegionAllowClick
|
||||||
|
("DLP_RegionAllowClick",
|
||||||
|
"Allow clicks inside the blacked-out region",
|
||||||
|
false);
|
||||||
|
rfb::BoolParameter rfb::Server::DLP_RegionAllowRelease
|
||||||
|
("DLP_RegionAllowRelease",
|
||||||
|
"Allow click releases inside the blacked-out region",
|
||||||
|
true);
|
||||||
|
|
||||||
rfb::StringParameter rfb::Server::maxVideoResolution
|
rfb::StringParameter rfb::Server::maxVideoResolution
|
||||||
("MaxVideoResolution",
|
("MaxVideoResolution",
|
||||||
"When in video mode, downscale the screen to max this size.",
|
"When in video mode, downscale the screen to max this size.",
|
||||||
|
@ -50,6 +50,8 @@ namespace rfb {
|
|||||||
static IntParameter DLP_KeyRateLimit;
|
static IntParameter DLP_KeyRateLimit;
|
||||||
static StringParameter DLP_ClipLog;
|
static StringParameter DLP_ClipLog;
|
||||||
static StringParameter DLP_Region;
|
static StringParameter DLP_Region;
|
||||||
|
static BoolParameter DLP_RegionAllowClick;
|
||||||
|
static BoolParameter DLP_RegionAllowRelease;
|
||||||
static IntParameter jpegVideoQuality;
|
static IntParameter jpegVideoQuality;
|
||||||
static IntParameter webpVideoQuality;
|
static IntParameter webpVideoQuality;
|
||||||
static StringParameter maxVideoResolution;
|
static StringParameter maxVideoResolution;
|
||||||
|
@ -637,7 +637,7 @@ void VNCSConnectionST::setPixelFormat(const PixelFormat& pf)
|
|||||||
setCursor();
|
setCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask)
|
void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask, const bool skipClick, const bool skipRelease)
|
||||||
{
|
{
|
||||||
pointerEventTime = lastEventTime = time(0);
|
pointerEventTime = lastEventTime = time(0);
|
||||||
server->lastUserInputTime = lastEventTime;
|
server->lastUserInputTime = lastEventTime;
|
||||||
@ -649,7 +649,23 @@ void VNCSConnectionST::pointerEvent(const Point& pos, int buttonMask)
|
|||||||
server->pointerClient = this;
|
server->pointerClient = this;
|
||||||
else
|
else
|
||||||
server->pointerClient = 0;
|
server->pointerClient = 0;
|
||||||
server->desktop->pointerEvent(pointerEventPos, buttonMask);
|
|
||||||
|
bool skipclick = false, skiprelease = false;
|
||||||
|
if (server->DLPRegion.enabled) {
|
||||||
|
rdr::U16 x1, y1, x2, y2;
|
||||||
|
server->translateDLPRegion(x1, y1, x2, y2);
|
||||||
|
|
||||||
|
if (pos.x < x1 || pos.x >= x2 ||
|
||||||
|
pos.y < y1 || pos.y >= y2) {
|
||||||
|
|
||||||
|
if (!Server::DLP_RegionAllowClick)
|
||||||
|
skipclick = true;
|
||||||
|
if (!Server::DLP_RegionAllowRelease)
|
||||||
|
skiprelease = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
server->desktop->pointerEvent(pointerEventPos, buttonMask, skipclick, skiprelease);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ namespace rfb {
|
|||||||
virtual void queryConnection(const char* userName);
|
virtual void queryConnection(const char* userName);
|
||||||
virtual void clientInit(bool shared);
|
virtual void clientInit(bool shared);
|
||||||
virtual void setPixelFormat(const PixelFormat& pf);
|
virtual void setPixelFormat(const PixelFormat& pf);
|
||||||
virtual void pointerEvent(const Point& pos, int buttonMask);
|
virtual void pointerEvent(const Point& pos, int buttonMask, const bool skipClick, const bool skipRelease);
|
||||||
virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
|
virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
|
||||||
virtual void clientCutText(const char* str, int len);
|
virtual void clientCutText(const char* str, int len);
|
||||||
virtual void framebufferUpdateRequest(const Rect& r, bool incremental);
|
virtual void framebufferUpdateRequest(const Rect& r, bool incremental);
|
||||||
|
@ -123,7 +123,7 @@ static void parseRegionPart(const bool percents, rdr::U16 &pcdest, int &dest,
|
|||||||
|
|
||||||
VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_)
|
VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_)
|
||||||
: blHosts(&blacklist), desktop(desktop_), desktopStarted(false),
|
: blHosts(&blacklist), desktop(desktop_), desktopStarted(false),
|
||||||
blockCounter(0), pb(0), ledState(ledUnknown),
|
blockCounter(0), pb(0), blackedpb(0), ledState(ledUnknown),
|
||||||
name(strDup(name_)), pointerClient(0), comparer(0),
|
name(strDup(name_)), pointerClient(0), comparer(0),
|
||||||
cursor(new Cursor(0, 0, Point(), NULL)),
|
cursor(new Cursor(0, 0, Point(), NULL)),
|
||||||
renderedCursorInvalid(false),
|
renderedCursorInvalid(false),
|
||||||
@ -800,11 +800,8 @@ static void checkAPIMessages(network::GetAPIMessager *apimessager)
|
|||||||
pthread_mutex_unlock(&apimessager->userMutex);
|
pthread_mutex_unlock(&apimessager->userMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VNCServerST::blackOut()
|
void VNCServerST::translateDLPRegion(rdr::U16 &x1, rdr::U16 &y1, rdr::U16 &x2, rdr::U16 &y2) const
|
||||||
{
|
{
|
||||||
// Compute the region, since the resolution may have changed
|
|
||||||
rdr::U16 x1, y1, x2, y2;
|
|
||||||
|
|
||||||
if (DLPRegion.percents) {
|
if (DLPRegion.percents) {
|
||||||
x1 = DLPRegion.pcx1 ? DLPRegion.pcx1 * pb->getRect().width() / 100 : 0;
|
x1 = DLPRegion.pcx1 ? DLPRegion.pcx1 * pb->getRect().width() / 100 : 0;
|
||||||
y1 = DLPRegion.pcy1 ? DLPRegion.pcy1 * pb->getRect().height() / 100 : 0;
|
y1 = DLPRegion.pcy1 ? DLPRegion.pcy1 * pb->getRect().height() / 100 : 0;
|
||||||
@ -834,11 +831,25 @@ void VNCServerST::blackOut()
|
|||||||
|
|
||||||
//slog.info("DLP_Region vals %u,%u %u,%u", x1, y1, x2, y2);
|
//slog.info("DLP_Region vals %u,%u %u,%u", x1, y1, x2, y2);
|
||||||
|
|
||||||
ManagedPixelBuffer *mpb = (ManagedPixelBuffer *) pb;
|
void VNCServerST::blackOut()
|
||||||
|
{
|
||||||
|
// Compute the region, since the resolution may have changed
|
||||||
|
rdr::U16 x1, y1, x2, y2;
|
||||||
|
|
||||||
|
translateDLPRegion(x1, y1, x2, y2);
|
||||||
|
|
||||||
|
if (blackedpb)
|
||||||
|
delete blackedpb;
|
||||||
|
blackedpb = new ManagedPixelBuffer(pb->getPF(), pb->getRect().width(), pb->getRect().height());
|
||||||
|
|
||||||
int stride;
|
int stride;
|
||||||
|
const rdr::U8 *src = pb->getBuffer(pb->getRect(), &stride);
|
||||||
|
rdr::U8 *data = blackedpb->getBufferRW(pb->getRect(), &stride);
|
||||||
rdr::U8 *data = mpb->getBufferRW(mpb->getRect(), &stride);
|
rdr::U8 *data = mpb->getBufferRW(mpb->getRect(), &stride);
|
||||||
stride *= 4;
|
stride *= 4;
|
||||||
|
|
||||||
|
memcpy(data, src, stride * pb->getRect().height());
|
||||||
|
|
||||||
rdr::U16 y;
|
rdr::U16 y;
|
||||||
const rdr::U16 w = pb->getRect().width();
|
const rdr::U16 w = pb->getRect().width();
|
||||||
const rdr::U16 h = pb->getRect().height();
|
const rdr::U16 h = pb->getRect().height();
|
||||||
@ -873,8 +884,10 @@ void VNCServerST::writeUpdate()
|
|||||||
assert(blockCounter == 0);
|
assert(blockCounter == 0);
|
||||||
assert(desktopStarted);
|
assert(desktopStarted);
|
||||||
|
|
||||||
if (DLPRegion.enabled)
|
if (DLPRegion.enabled) {
|
||||||
|
comparer->enable_copyrect(false);
|
||||||
blackOut();
|
blackOut();
|
||||||
|
}
|
||||||
|
|
||||||
comparer->getUpdateInfo(&ui, pb->getRect());
|
comparer->getUpdateInfo(&ui, pb->getRect());
|
||||||
toCheck = ui.changed.union_(ui.copied);
|
toCheck = ui.changed.union_(ui.copied);
|
||||||
|
@ -95,7 +95,7 @@ namespace rfb {
|
|||||||
virtual void setPixelBuffer(PixelBuffer* pb, const ScreenSet& layout);
|
virtual void setPixelBuffer(PixelBuffer* pb, const ScreenSet& layout);
|
||||||
virtual void setPixelBuffer(PixelBuffer* pb);
|
virtual void setPixelBuffer(PixelBuffer* pb);
|
||||||
virtual void setScreenLayout(const ScreenSet& layout);
|
virtual void setScreenLayout(const ScreenSet& layout);
|
||||||
virtual PixelBuffer* getPixelBuffer() const { return pb; }
|
virtual PixelBuffer* getPixelBuffer() const { if (DLPRegion.enabled && blackedpb) return blackedpb; else return pb; }
|
||||||
virtual void serverCutText(const char* str, int len);
|
virtual void serverCutText(const char* str, int len);
|
||||||
virtual void add_changed(const Region ®ion);
|
virtual void add_changed(const Region ®ion);
|
||||||
virtual void add_copied(const Region &dest, const Point &delta);
|
virtual void add_copied(const Region &dest, const Point &delta);
|
||||||
@ -209,6 +209,7 @@ namespace rfb {
|
|||||||
bool desktopStarted;
|
bool desktopStarted;
|
||||||
int blockCounter;
|
int blockCounter;
|
||||||
PixelBuffer* pb;
|
PixelBuffer* pb;
|
||||||
|
ManagedPixelBuffer *blackedpb;
|
||||||
ScreenSet screenLayout;
|
ScreenSet screenLayout;
|
||||||
unsigned int ledState;
|
unsigned int ledState;
|
||||||
|
|
||||||
@ -264,6 +265,8 @@ namespace rfb {
|
|||||||
bool percents;
|
bool percents;
|
||||||
rdr::U16 pcx1, pcy1, pcx2, pcy2;
|
rdr::U16 pcx1, pcy1, pcx2, pcy2;
|
||||||
} DLPRegion;
|
} DLPRegion;
|
||||||
|
|
||||||
|
void translateDLPRegion(rdr::U16 &x1, rdr::U16 &y1, rdr::U16 &x2, rdr::U16 &y2) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -155,7 +155,8 @@ static void enqueueEvents(DeviceIntPtr dev, int n)
|
|||||||
}
|
}
|
||||||
#endif /* XORG < 111 */
|
#endif /* XORG < 111 */
|
||||||
|
|
||||||
void vncPointerButtonAction(int buttonMask)
|
void vncPointerButtonAction(int buttonMask, const unsigned char skipclick,
|
||||||
|
const unsigned char skiprelease)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#if XORG < 111
|
#if XORG < 111
|
||||||
@ -169,6 +170,14 @@ void vncPointerButtonAction(int buttonMask)
|
|||||||
if ((buttonMask ^ oldButtonMask) & (1 << i)) {
|
if ((buttonMask ^ oldButtonMask) & (1 << i)) {
|
||||||
int action = (buttonMask & (1<<i)) ?
|
int action = (buttonMask & (1<<i)) ?
|
||||||
ButtonPress : ButtonRelease;
|
ButtonPress : ButtonRelease;
|
||||||
|
|
||||||
|
if (action == ButtonPress && skipclick) {
|
||||||
|
buttonMask &= ~(1<<i);
|
||||||
|
continue;
|
||||||
|
} else if (action == ButtonRelease && skiprelease) {
|
||||||
|
buttonMask |= (1<<i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
#if XORG < 110
|
#if XORG < 110
|
||||||
n = GetPointerEvents(eventq, vncPointerDev,
|
n = GetPointerEvents(eventq, vncPointerDev,
|
||||||
action, i + 1,
|
action, i + 1,
|
||||||
|
@ -32,7 +32,8 @@ extern "C" {
|
|||||||
|
|
||||||
void vncInitInputDevice(void);
|
void vncInitInputDevice(void);
|
||||||
|
|
||||||
void vncPointerButtonAction(int buttonMask);
|
void vncPointerButtonAction(int buttonMask, const unsigned char skipclick,
|
||||||
|
const unsigned char skiprelease);
|
||||||
void vncPointerMove(int x, int y);
|
void vncPointerMove(int x, int y);
|
||||||
void vncGetPointerPos(int *x, int *y);
|
void vncGetPointerPos(int *x, int *y);
|
||||||
|
|
||||||
|
@ -418,11 +418,12 @@ void XserverDesktop::approveConnection(uint32_t opaqueId, bool accept,
|
|||||||
// SDesktop callbacks
|
// SDesktop callbacks
|
||||||
|
|
||||||
|
|
||||||
void XserverDesktop::pointerEvent(const Point& pos, int buttonMask)
|
void XserverDesktop::pointerEvent(const Point& pos, int buttonMask,
|
||||||
|
const bool skipClick, const bool skipRelease)
|
||||||
{
|
{
|
||||||
vncPointerMove(pos.x + vncGetScreenX(screenIndex),
|
vncPointerMove(pos.x + vncGetScreenX(screenIndex),
|
||||||
pos.y + vncGetScreenY(screenIndex));
|
pos.y + vncGetScreenY(screenIndex));
|
||||||
vncPointerButtonAction(buttonMask);
|
vncPointerButtonAction(buttonMask, skipClick, skipRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XserverDesktop::clientCutText(const char* str, int len)
|
void XserverDesktop::clientCutText(const char* str, int len)
|
||||||
|
@ -86,7 +86,8 @@ public:
|
|||||||
const char* rejectMsg=0);
|
const char* rejectMsg=0);
|
||||||
|
|
||||||
// rfb::SDesktop callbacks
|
// rfb::SDesktop callbacks
|
||||||
virtual void pointerEvent(const rfb::Point& pos, int buttonMask);
|
virtual void pointerEvent(const rfb::Point& pos, int buttonMask,
|
||||||
|
const bool skipClick, const bool skipRelease);
|
||||||
virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
|
virtual void keyEvent(rdr::U32 keysym, rdr::U32 keycode, bool down);
|
||||||
virtual void clientCutText(const char* str, int len);
|
virtual void clientCutText(const char* str, int len);
|
||||||
virtual unsigned int setScreenLayout(int fb_width, int fb_height,
|
virtual unsigned int setScreenLayout(int fb_width, int fb_height,
|
||||||
|
@ -286,6 +286,14 @@ and x2,y2 the lower-left. In addition to absolute pixel values, percentages
|
|||||||
are allowed, zero means "default", and a negative number means "border".
|
are allowed, zero means "default", and a negative number means "border".
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
.B \-DLP_RegionAllowClick \fIbool\fP
|
||||||
|
Allow clicks inside the blacked-out region.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
.B \-DLP_RegionAllowRelease \fIbool\fP
|
||||||
|
Allow click releases inside the blacked-out region.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
.B \-DLP_ClipSendMax \fIbytes\fP
|
.B \-DLP_ClipSendMax \fIbytes\fP
|
||||||
Limit clipboard bytes to send to clients in one transaction. Default 10,000.
|
Limit clipboard bytes to send to clients in one transaction. Default 10,000.
|
||||||
0 disables the limit, use \fBSendCutText\fP to disable clipboard sending entirely.
|
0 disables the limit, use \fBSendCutText\fP to disable clipboard sending entirely.
|
||||||
|
Loading…
Reference in New Issue
Block a user