fix c++ access violation

This commit is contained in:
Matt McClaskey 2026-05-22 11:43:12 +00:00
parent 6880b03c04
commit a34b523b56
No known key found for this signature in database
3 changed files with 29 additions and 13 deletions

View file

@ -997,6 +997,27 @@ void VNCServerST::translateDLPRegion(rdr::U16 &x1, rdr::U16 &y1, rdr::U16 &x2, r
//slog.info("DLP_Region vals %u,%u %u,%u", x1, y1, x2, y2);
}
void VNCServerST::getDLPRegionSkipFlags(const Point& pos,
bool& skipclick, bool& skiprelease) const
{
skipclick = false;
skiprelease = false;
if (!DLPRegion.enabled)
return;
rdr::U16 x1, y1, x2, y2;
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;
}
}
void VNCServerST::blackOut()
{
// Compute the region, since the resolution may have changed

View file

@ -208,6 +208,11 @@ namespace rfb {
enum UserActionType {Join, Leave};
void notifyUserAction(const VNCSConnectionST* newConnection, std::string& user_name, const UserActionType action_type);
// Compute whether a pointer click/release at the given framebuffer
// position should be suppressed by the DLP region policy.
void getDLPRegionSkipFlags(const Point& pos,
bool& skipclick, bool& skiprelease) const;
protected:
friend class VNCSConnectionST;

View file

@ -548,19 +548,9 @@ rfb::Point XserverDesktop::directMouseEventWithPosition(int dx, int dy,
vncPointerMoveRelative(dx, dy, cursorX, cursorY);
bool skipclick = false, skiprelease = false;
if (server->DLPRegion.enabled) {
rdr::U16 x1, y1, x2, y2;
server->translateDLPRegion(x1, y1, x2, y2);
rfb::Point cursorPos(cursorX - screenX, cursorY - screenY);
if (cursorPos.x < x1 || cursorPos.x >= x2 ||
cursorPos.y < y1 || cursorPos.y >= y2) {
if (!rfb::Server::DLP_RegionAllowClick)
skipclick = true;
if (!rfb::Server::DLP_RegionAllowRelease)
skiprelease = true;
}
}
server->getDLPRegionSkipFlags(rfb::Point(cursorX - screenX,
cursorY - screenY),
skipclick, skiprelease);
vncPointerButtonAction(buttonMask, skipclick, skiprelease);
} else {