aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2024-11-09 15:00:30 +0100
committerPierre Ossman <ossman@cendio.se>2025-02-13 11:12:56 +0100
commitdc6b4acab4dae5ce1ef88ea3f183cc66ac71f23c (patch)
treed0923db9181f7ca3049cf68362604ee687644942
parent3a616d24c91797098bf90a3352b694da04a81fbb (diff)
downloadtigervnc-dc6b4acab4dae5ce1ef88ea3f183cc66ac71f23c.tar.gz
tigervnc-dc6b4acab4dae5ce1ef88ea3f183cc66ac71f23c.zip
Use initializer lists for basic data types
Try to keep the code more compact for the simple things where the type should be obvious from the context. Helps us avoid line wrapping. Also remove explicit conversions to Region where the compiler is able to figure it out by itself, again to reduce line length.
-rw-r--r--common/rfb/CConnection.cxx6
-rw-r--r--common/rfb/ClientParams.cxx2
-rw-r--r--common/rfb/ComparingUpdateTracker.cxx6
-rw-r--r--common/rfb/CopyRectDecoder.cxx6
-rw-r--r--common/rfb/Cursor.cxx10
-rw-r--r--common/rfb/EncodeManager.cxx16
-rw-r--r--common/rfb/PixelBuffer.h4
-rw-r--r--common/rfb/RREDecoder.cxx2
-rw-r--r--common/rfb/SMsgReader.cxx4
-rw-r--r--common/rfb/ServerParams.cxx2
-rw-r--r--common/rfb/UpdateTracker.h2
-rw-r--r--common/rfb/VNCSConnectionST.cxx16
-rw-r--r--common/rfb/VNCServerST.cxx4
-rw-r--r--tests/perf/encperf.cxx2
-rw-r--r--tests/unit/emulatemb.cxx64
-rw-r--r--unix/x0vncserver/XDesktop.cxx12
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.cc4
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.cc12
-rw-r--r--vncviewer/PlatformPixelBuffer.cxx2
-rw-r--r--vncviewer/Viewport.cxx8
-rw-r--r--win/rfb_win32/DeviceContext.cxx2
-rw-r--r--win/rfb_win32/DeviceFrameBuffer.cxx4
-rw-r--r--win/rfb_win32/DeviceFrameBuffer.h2
-rw-r--r--win/rfb_win32/SDisplay.cxx4
-rw-r--r--win/rfb_win32/WMCursor.cxx2
-rw-r--r--win/rfb_win32/WMHooks.cxx18
-rw-r--r--win/rfb_win32/WMPoller.cxx2
-rw-r--r--win/rfb_win32/WMWindowCopyRect.cxx4
28 files changed, 112 insertions, 110 deletions
diff --git a/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index e58645db..4b97d7ac 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -896,9 +896,9 @@ void CConnection::requestNewUpdate()
if (forceNonincremental || !continuousUpdates) {
pendingUpdate = true;
- writer()->writeFramebufferUpdateRequest(Rect(0, 0,
- server.width(),
- server.height()),
+ writer()->writeFramebufferUpdateRequest({0, 0,
+ server.width(),
+ server.height()},
!forceNonincremental);
}
diff --git a/common/rfb/ClientParams.cxx b/common/rfb/ClientParams.cxx
index 2b2dd2c2..02bcae87 100644
--- a/common/rfb/ClientParams.cxx
+++ b/common/rfb/ClientParams.cxx
@@ -47,7 +47,7 @@ ClientParams::ClientParams()
pf_ = new PixelFormat();
- cursor_ = new Cursor(0, 0, Point(), nullptr);
+ cursor_ = new Cursor(0, 0, {}, nullptr);
clipFlags = clipboardUTF8 | clipboardRTF | clipboardHTML |
clipboardRequest | clipboardNotify | clipboardProvide;
diff --git a/common/rfb/ComparingUpdateTracker.cxx b/common/rfb/ComparingUpdateTracker.cxx
index 3457a18b..3c7e94ad 100644
--- a/common/rfb/ComparingUpdateTracker.cxx
+++ b/common/rfb/ComparingUpdateTracker.cxx
@@ -223,8 +223,10 @@ void ComparingUpdateTracker::compareRect(const Rect& r, Region* newChanged)
}
endOfChangeRight:
- // Block change extends from (changeLeft, y) to (changeRight, y + changeHeight)
- newChanged->assign_union(Region(Rect(changeLeft, y, changeRight, y + changeHeight)));
+ // Block change extends from (changeLeft, y) to (changeRight,
+ // y + changeHeight)
+ newChanged->assign_union({{changeLeft, y,
+ changeRight, y + changeHeight}});
// Copy the change from fb to oldFb to allow future changes to be identified
for (int row = 0; row < changeHeight; row++)
diff --git a/common/rfb/CopyRectDecoder.cxx b/common/rfb/CopyRectDecoder.cxx
index a7383881..f7c72123 100644
--- a/common/rfb/CopyRectDecoder.cxx
+++ b/common/rfb/CopyRectDecoder.cxx
@@ -60,8 +60,8 @@ void CopyRectDecoder::getAffectedRegion(const Rect& rect,
Decoder::getAffectedRegion(rect, buffer, buflen, server, region);
- region->assign_union(Region(rect.translate(Point(srcX-rect.tl.x,
- srcY-rect.tl.y))));
+ region->assign_union(rect.translate({srcX-rect.tl.x,
+ srcY-rect.tl.y}));
}
void CopyRectDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
@@ -72,5 +72,5 @@ void CopyRectDecoder::decodeRect(const Rect& r, const uint8_t* buffer,
rdr::MemInStream is(buffer, buflen);
int srcX = is.readU16();
int srcY = is.readU16();
- pb->copyRect(r, Point(r.tl.x-srcX, r.tl.y-srcY));
+ pb->copyRect(r, {r.tl.x-srcX, r.tl.y-srcY});
}
diff --git a/common/rfb/Cursor.cxx b/common/rfb/Cursor.cxx
index 94844144..0c75eb86 100644
--- a/common/rfb/Cursor.cxx
+++ b/common/rfb/Cursor.cxx
@@ -215,9 +215,9 @@ std::vector<uint8_t> Cursor::getMask() const
void Cursor::crop()
{
- Rect busy = Rect(0, 0, width_, height_);
- busy = busy.intersect(Rect(hotspot_.x, hotspot_.y,
- hotspot_.x+1, hotspot_.y+1));
+ Rect busy(0, 0, width_, height_);
+ busy = busy.intersect({hotspot_.x, hotspot_.y,
+ hotspot_.x+1, hotspot_.y+1});
int x, y;
uint8_t *data_ptr = data;
for (y = 0; y < height(); y++) {
@@ -313,7 +313,7 @@ void RenderedCursor::update(PixelBuffer* framebuffer,
else if (fg[3] == 0xff) {
memcpy(rgb, fg, 3);
} else {
- buffer.getImage(bg, Rect(x, y, x+1, y+1));
+ buffer.getImage(bg, {x, y, x+1, y+1});
format.rgbFromBuffer(rgb, bg, 1);
// FIXME: Gamma aware blending
for (int i = 0;i < 3;i++) {
@@ -323,7 +323,7 @@ void RenderedCursor::update(PixelBuffer* framebuffer,
}
format.bufferFromRGB(bg, rgb, 1);
- buffer.imageRect(Rect(x, y, x+1, y+1), bg);
+ buffer.imageRect({x, y, x+1, y+1}, bg);
}
}
}
diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx
index 8e4a37d0..e60e02b1 100644
--- a/common/rfb/EncodeManager.cxx
+++ b/common/rfb/EncodeManager.cxx
@@ -293,7 +293,7 @@ void EncodeManager::writeLosslessRefresh(const Region& req, const PixelBuffer* p
size_t maxUpdateSize)
{
doUpdate(false, getLosslessRefresh(req, maxUpdateSize),
- Region(), Point(), pb, renderedCursor);
+ {}, {}, pb, renderedCursor);
}
void EncodeManager::handleTimeout(Timer* t)
@@ -521,12 +521,12 @@ Region EncodeManager::getLosslessRefresh(const Region& req,
int height = (maxUpdateSize - area) / rect.width();
rect.br.y = rect.tl.y + __rfbmax(1, height);
}
- refresh.assign_union(Region(rect));
+ refresh.assign_union(rect);
break;
}
area += rect.area();
- refresh.assign_union(Region(rect));
+ refresh.assign_union(rect);
rects.erase(rects.begin() + idx);
}
@@ -589,13 +589,13 @@ Encoder *EncodeManager::startRect(const Rect& rect, int type)
if ((encoder->flags & EncoderLossy) &&
((encoder->losslessQuality == -1) ||
(encoder->getQualityLevel() < encoder->losslessQuality)))
- lossyRegion.assign_union(Region(rect));
+ lossyRegion.assign_union(rect);
else
- lossyRegion.assign_subtract(Region(rect));
+ lossyRegion.assign_subtract(rect);
// This was either a rect getting refreshed, or a rect that just got
// new content. Either way we should not try to refresh it anymore.
- pendingRefreshRegion.assign_subtract(Region(rect));
+ pendingRefreshRegion.assign_subtract(rect);
return encoder;
}
@@ -679,7 +679,7 @@ void EncodeManager::findSolidRect(const Rect& rect, Region *changed,
if (dx + dw > rect.br.x)
dw = rect.br.x - dx;
- pb->getImage(colourValue, Rect(dx, dy, dx+1, dy+1));
+ pb->getImage(colourValue, {dx, dy, dx+1, dy+1});
sr.setXYWH(dx, dy, dw, dh);
if (checkSolidTile(sr, colourValue, pb)) {
@@ -723,7 +723,7 @@ void EncodeManager::findSolidRect(const Rect& rect, Region *changed,
}
endRect();
- changed->assign_subtract(Region(erp));
+ changed->assign_subtract(erp);
// Search remaining areas by recursion
// FIXME: Is this the best way to divide things up?
diff --git a/common/rfb/PixelBuffer.h b/common/rfb/PixelBuffer.h
index 963fbbf6..4db91d14 100644
--- a/common/rfb/PixelBuffer.h
+++ b/common/rfb/PixelBuffer.h
@@ -52,9 +52,9 @@ namespace rfb {
// Get rectangle encompassing this buffer
// Top-left of rectangle is either at (0,0), or the specified point.
- Rect getRect() const { return Rect(0, 0, width_, height_); }
+ Rect getRect() const { return {0, 0, width_, height_}; }
Rect getRect(const Point& pos) const {
- return Rect(pos, pos.translate(Point(width_, height_)));
+ return {pos, pos.translate({width_, height_})};
}
///////////////////////////////////////////////
diff --git a/common/rfb/RREDecoder.cxx b/common/rfb/RREDecoder.cxx
index 53ddc2da..fb8681f5 100644
--- a/common/rfb/RREDecoder.cxx
+++ b/common/rfb/RREDecoder.cxx
@@ -109,6 +109,6 @@ void RREDecoder::rreDecode(const Rect& r, rdr::InStream* is,
if (((x+w) > r.width()) || ((y+h) > r.height()))
throw protocol_error("RRE decode error");
- pb->fillRect(pf, Rect(r.tl.x+x, r.tl.y+y, r.tl.x+x+w, r.tl.y+y+h), &pix);
+ pb->fillRect(pf, {r.tl.x+x, r.tl.y+y, r.tl.x+x+w, r.tl.y+y+h}, &pix);
}
}
diff --git a/common/rfb/SMsgReader.cxx b/common/rfb/SMsgReader.cxx
index 15549ed3..3909c476 100644
--- a/common/rfb/SMsgReader.cxx
+++ b/common/rfb/SMsgReader.cxx
@@ -203,7 +203,7 @@ bool SMsgReader::readFramebufferUpdateRequest()
int y = is->readU16();
int w = is->readU16();
int h = is->readU16();
- handler->framebufferUpdateRequest(Rect(x, y, x+w, y+h), inc);
+ handler->framebufferUpdateRequest({x, y, x+w, y+h}, inc);
return true;
}
@@ -300,7 +300,7 @@ bool SMsgReader::readPointerEvent()
}
is->clearRestorePoint();
- handler->pointerEvent(Point(x, y), mask);
+ handler->pointerEvent({x, y}, mask);
return true;
}
diff --git a/common/rfb/ServerParams.cxx b/common/rfb/ServerParams.cxx
index ed3ac7eb..3eb7f6de 100644
--- a/common/rfb/ServerParams.cxx
+++ b/common/rfb/ServerParams.cxx
@@ -46,7 +46,7 @@ ServerParams::ServerParams()
pf_ = new PixelFormat();
- cursor_ = new Cursor(0, 0, Point(), nullptr);
+ cursor_ = new Cursor(0, 0, {}, nullptr);
clipFlags = 0;
memset(clipSizes, 0, sizeof(clipSizes));
diff --git a/common/rfb/UpdateTracker.h b/common/rfb/UpdateTracker.h
index fd597964..e6e98086 100644
--- a/common/rfb/UpdateTracker.h
+++ b/common/rfb/UpdateTracker.h
@@ -53,7 +53,7 @@ namespace rfb {
class ClippingUpdateTracker : public UpdateTracker {
public:
ClippingUpdateTracker() : ut(nullptr) {}
- ClippingUpdateTracker(UpdateTracker* ut_, const Rect& r=Rect()) : ut(ut_), clipRect(r) {}
+ ClippingUpdateTracker(UpdateTracker* ut_, const Rect& r={}) : ut(ut_), clipRect(r) {}
void setUpdateTracker(UpdateTracker* ut_) {ut = ut_;}
void setClipRect(const Rect& cr) {clipRect = cr;}
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index abfc3504..1e7363c0 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -54,7 +54,7 @@ using namespace rfb;
static LogWriter vlog("VNCSConnST");
-static Cursor emptyCursor(0, 0, Point(0, 0), nullptr);
+static Cursor emptyCursor(0, 0, {0, 0}, nullptr);
VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s,
bool reverse, AccessRights ar)
@@ -220,11 +220,11 @@ void VNCSConnectionST::pixelBufferChange()
//updates.intersect(server->pb->getRect());
//
//if (server->pb->width() > client.width())
- // updates.add_changed(Rect(client.width(), 0, server->pb->width(),
- // server->pb->height()));
+ // updates.add_changed({client.width(), 0, server->pb->width(),
+ // server->pb->height()});
//if (server->pb->height() > client.height())
- // updates.add_changed(Rect(0, client.height(), client.width(),
- // server->pb->height()));
+ // updates.add_changed({0, client.height(), client.width(),
+ // server->pb->height()});
damagedCursorRegion.assign_intersect(server->getPixelBuffer()->getRect());
@@ -240,7 +240,7 @@ void VNCSConnectionST::pixelBufferChange()
}
// Drop any lossy tracking that is now outside the framebuffer
- encodeManager.pruneLosslessRefresh(Region(server->getPixelBuffer()->getRect()));
+ encodeManager.pruneLosslessRefresh(server->getPixelBuffer()->getRect());
}
// Just update the whole screen at the moment because we're too lazy to
// work out what's actually changed.
@@ -618,11 +618,11 @@ void VNCSConnectionST::framebufferUpdateRequest(const Rect& r,bool incremental)
SConnection::framebufferUpdateRequest(r, incremental);
// Check that the client isn't sending crappy requests
- if (!r.enclosed_by(Rect(0, 0, client.width(), client.height()))) {
+ if (!r.enclosed_by({0, 0, client.width(), client.height()})) {
vlog.error("FramebufferUpdateRequest %dx%d at %d,%d exceeds framebuffer %dx%d",
r.width(), r.height(), r.tl.x, r.tl.y,
client.width(), client.height());
- safeRect = r.intersect(Rect(0, 0, client.width(), client.height()));
+ safeRect = r.intersect({0, 0, client.width(), client.height()});
} else {
safeRect = r;
}
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index bf9e6524..6e327129 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -88,7 +88,7 @@ VNCServerST::VNCServerST(const char* name_, SDesktop* desktop_)
blockCounter(0), pb(nullptr), ledState(ledUnknown),
name(name_), pointerClient(nullptr), clipboardClient(nullptr),
pointerClientTime(0),
- comparer(nullptr), cursor(new Cursor(0, 0, Point(), nullptr)),
+ comparer(nullptr), cursor(new Cursor(0, 0, {}, nullptr)),
renderedCursorInvalid(false),
keyRemapper(&KeyRemapper::defInstance),
idleTimer(this), disconnectTimer(this), connectTimer(this),
@@ -879,7 +879,7 @@ Region VNCServerST::getPendingRegion()
// Block client from updating if there are pending updates
if (comparer->is_empty())
- return Region();
+ return {};
comparer->getUpdateInfo(&ui, pb->getRect());
diff --git a/tests/perf/encperf.cxx b/tests/perf/encperf.cxx
index fe22787a..dc5a5db3 100644
--- a/tests/perf/encperf.cxx
+++ b/tests/perf/encperf.cxx
@@ -262,7 +262,7 @@ bool CConn::dataRect(const rfb::Rect &r, int encoding)
return false;
if (encoding != rfb::encodingCopyRect) // FIXME
- updates.add_changed(rfb::Region(r));
+ updates.add_changed(r);
return true;
}
diff --git a/tests/unit/emulatemb.cxx b/tests/unit/emulatemb.cxx
index 6db8ea38..ecff356d 100644
--- a/tests/unit/emulatemb.cxx
+++ b/tests/unit/emulatemb.cxx
@@ -69,7 +69,7 @@ void testDisabledOption()
printf("%s: ", __func__);
emulateMiddleButton.setParam(false);
- test.filterPointerEvent(rfb::Point(0, 10), left);
+ test.filterPointerEvent({0, 10}, left);
ASSERT_EQ(test.results.size(), 1);
@@ -87,8 +87,8 @@ void testLeftClick()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(0, 0), left);
- test.filterPointerEvent(rfb::Point(0, 0), empty);
+ test.filterPointerEvent({0, 0}, left);
+ test.filterPointerEvent({0, 0}, empty);
ASSERT_EQ(test.results.size(), 3);
@@ -114,7 +114,7 @@ void testNormalLeftPress()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(10, 20), left);
+ test.filterPointerEvent({10, 20}, left);
usleep(100000); // 0.1s
rfb::Timer::checkTimeouts();
@@ -138,7 +138,7 @@ void testNormalMiddlePress()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(0, 0), middle);
+ test.filterPointerEvent({0, 0}, middle);
ASSERT_EQ(test.results.size(), 1);
@@ -156,7 +156,7 @@ void testNormalRightPress()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(0, 0), right);
+ test.filterPointerEvent({0, 0}, right);
usleep(100000); // 0.1s
rfb::Timer::checkTimeouts();
@@ -180,8 +180,8 @@ void testEmulateMiddleMouseButton()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(20, 30), right);
- test.filterPointerEvent(rfb::Point(20, 30), both);
+ test.filterPointerEvent({20, 30}, right);
+ test.filterPointerEvent({20, 30}, both);
ASSERT_EQ(test.results.size(), 2);
@@ -203,9 +203,9 @@ void testLeftReleaseAfterEmulate()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(20, 30), left);
- test.filterPointerEvent(rfb::Point(20, 30), both);
- test.filterPointerEvent(rfb::Point(20, 30), right); // left released
+ test.filterPointerEvent({20, 30}, left);
+ test.filterPointerEvent({20, 30}, both);
+ test.filterPointerEvent({20, 30}, right); // left released
ASSERT_EQ(test.results.size(), 3);
@@ -231,9 +231,9 @@ void testRightReleaseAfterEmulate()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(20, 30), right);
- test.filterPointerEvent(rfb::Point(20, 30), both);
- test.filterPointerEvent(rfb::Point(20, 30), left); // right released
+ test.filterPointerEvent({20, 30}, right);
+ test.filterPointerEvent({20, 30}, both);
+ test.filterPointerEvent({20, 30}, left); // right released
ASSERT_EQ(test.results.size(), 3);
@@ -259,10 +259,10 @@ void testLeftRepressAfterEmulate()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(20, 30), left);
- test.filterPointerEvent(rfb::Point(20, 30), both);
- test.filterPointerEvent(rfb::Point(20, 30), right); // left released
- test.filterPointerEvent(rfb::Point(20, 30), both);
+ test.filterPointerEvent({20, 30}, left);
+ test.filterPointerEvent({20, 30}, both);
+ test.filterPointerEvent({20, 30}, right); // left released
+ test.filterPointerEvent({20, 30}, both);
ASSERT_EQ(test.results.size(), 4);
@@ -292,10 +292,10 @@ void testRightRepressAfterEmulate()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(20, 30), right);
- test.filterPointerEvent(rfb::Point(20, 30), both);
- test.filterPointerEvent(rfb::Point(20, 30), left); // right released
- test.filterPointerEvent(rfb::Point(20, 30), both);
+ test.filterPointerEvent({20, 30}, right);
+ test.filterPointerEvent({20, 30}, both);
+ test.filterPointerEvent({20, 30}, left); // right released
+ test.filterPointerEvent({20, 30}, both);
ASSERT_EQ(test.results.size(), 4);
@@ -325,10 +325,10 @@ void testBothPressAfterLeftTimeout()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(10, 20), left);
+ test.filterPointerEvent({10, 20}, left);
usleep(100000); // 0.1s
rfb::Timer::checkTimeouts();
- test.filterPointerEvent(rfb::Point(10, 20), both);
+ test.filterPointerEvent({10, 20}, both);
ASSERT_EQ(test.results.size(), 3);
@@ -354,10 +354,10 @@ void testBothPressAfterRightTimeout()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(10, 20), right);
+ test.filterPointerEvent({10, 20}, right);
usleep(100000); // 0.1s
rfb::Timer::checkTimeouts();
- test.filterPointerEvent(rfb::Point(10, 20), both);
+ test.filterPointerEvent({10, 20}, both);
ASSERT_EQ(test.results.size(), 3);
@@ -383,10 +383,10 @@ void testTimeoutAndDrag()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(0, 0), left);
+ test.filterPointerEvent({0, 0}, left);
usleep(100000); //0.1s
rfb::Timer::checkTimeouts();
- test.filterPointerEvent(rfb::Point(10, 10), left);
+ test.filterPointerEvent({10, 10}, left);
ASSERT_EQ(test.results.size(), 3);
@@ -412,8 +412,8 @@ void testDragAndTimeout()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(10, 10), left);
- test.filterPointerEvent(rfb::Point(30, 30), left);
+ test.filterPointerEvent({10, 10}, left);
+ test.filterPointerEvent({30, 30}, left);
usleep(100000); //0.1s
rfb::Timer::checkTimeouts();
@@ -441,8 +441,8 @@ void testDragAndRelease()
printf("%s: ", __func__);
emulateMiddleButton.setParam(true);
- test.filterPointerEvent(rfb::Point(10, 10), left);
- test.filterPointerEvent(rfb::Point(20, 20), empty);
+ test.filterPointerEvent({10, 10}, left);
+ test.filterPointerEvent({20, 20}, empty);
ASSERT_EQ(test.results.size(), 3);
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx
index 938c5374..a1968b65 100644
--- a/unix/x0vncserver/XDesktop.cxx
+++ b/unix/x0vncserver/XDesktop.cxx
@@ -235,7 +235,7 @@ void XDesktop::poll() {
&x, &y, &wx, &wy, &mask)) {
x -= geometry->offsetLeft();
y -= geometry->offsetTop();
- server->setCursorPos(rfb::Point(x, y), false);
+ server->setCursorPos({x, y}, false);
}
}
}
@@ -869,8 +869,8 @@ bool XDesktop::handleGlobalEvent(XEvent* ev) {
dev = (XDamageNotifyEvent*)ev;
rect.setXYWH(dev->area.x, dev->area.y, dev->area.width, dev->area.height);
- rect = rect.translate(Point(-geometry->offsetLeft(),
- -geometry->offsetTop()));
+ rect = rect.translate({-geometry->offsetLeft(),
+ -geometry->offsetTop()});
server->add_changed(rect);
return true;
@@ -941,7 +941,7 @@ bool XDesktop::handleGlobalEvent(XEvent* ev) {
server->setPixelBuffer(pb, computeScreenLayout());
// Mark entire screen as changed
- server->add_changed(rfb::Region(Rect(0, 0, cev->width, cev->height)));
+ server->add_changed({{0, 0, cev->width, cev->height}});
}
return true;
@@ -986,7 +986,7 @@ bool XDesktop::handleGlobalEvent(XEvent* ev) {
if (cev->window == cev->root)
return false;
- server->setCursor(0, 0, Point(), nullptr);
+ server->setCursor(0, 0, {}, nullptr);
return true;
#endif
}
@@ -1047,7 +1047,7 @@ bool XDesktop::setCursor()
}
try {
- server->setCursor(cim->width, cim->height, Point(cim->xhot, cim->yhot),
+ server->setCursor(cim->width, cim->height, {cim->xhot, cim->yhot},
cursorData);
} catch (std::exception& e) {
vlog.error("XserverDesktop::setCursor: %s",e.what());
diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
index 5b87d50f..578bfa11 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.cc
+++ b/unix/xserver/hw/vnc/XserverDesktop.cc
@@ -268,7 +268,7 @@ void XserverDesktop::setCursor(int width, int height, int hotX, int hotY,
}
try {
- server->setCursor(width, height, Point(hotX, hotY), cursorData);
+ server->setCursor(width, height, {hotX, hotY}, cursorData);
} catch (std::exception& e) {
vlog.error("XserverDesktop::setCursor: %s",e.what());
}
@@ -279,7 +279,7 @@ void XserverDesktop::setCursor(int width, int height, int hotX, int hotY,
void XserverDesktop::setCursorPos(int x, int y, bool warped)
{
try {
- server->setCursorPos(Point(x, y), warped);
+ server->setCursorPos({x, y}, warped);
} catch (std::exception& e) {
vlog.error("XserverDesktop::setCursorPos: %s",e.what());
}
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc
index 0ffce041..f51399e2 100644
--- a/unix/xserver/hw/vnc/vncExtInit.cc
+++ b/unix/xserver/hw/vnc/vncExtInit.cc
@@ -416,8 +416,8 @@ void vncAddChanged(int scrIdx, int nRects,
const struct UpdateRect *rects)
{
for (int i = 0;i < nRects;i++) {
- desktop[scrIdx]->add_changed(Region(Rect(rects[i].x1, rects[i].y1,
- rects[i].x2, rects[i].y2)));
+ desktop[scrIdx]->add_changed({{rects[i].x1, rects[i].y1,
+ rects[i].x2, rects[i].y2}});
}
}
@@ -426,9 +426,9 @@ void vncAddCopied(int scrIdx, int nRects,
int dx, int dy)
{
for (int i = 0;i < nRects;i++) {
- desktop[scrIdx]->add_copied(Region(Rect(rects[i].x1, rects[i].y1,
- rects[i].x2, rects[i].y2)),
- Point(dx, dy));
+ desktop[scrIdx]->add_copied({{rects[i].x1, rects[i].y1,
+ rects[i].x2, rects[i].y2}},
+ {dx, dy});
}
}
@@ -470,7 +470,7 @@ void vncPostScreenResize(int scrIdx, int success, int width, int height)
if (success) {
// Mark entire screen as changed
- desktop[scrIdx]->add_changed(Region(Rect(0, 0, width, height)));
+ desktop[scrIdx]->add_changed({{0, 0, width, height}});
}
}
diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx
index 0f152e11..faec9716 100644
--- a/vncviewer/PlatformPixelBuffer.cxx
+++ b/vncviewer/PlatformPixelBuffer.cxx
@@ -95,7 +95,7 @@ void PlatformPixelBuffer::commitBufferRW(const rfb::Rect& r)
{
FullFramePixelBuffer::commitBufferRW(r);
mutex.lock();
- damage.assign_union(rfb::Region(r));
+ damage.assign_union(r);
mutex.unlock();
}
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 653057da..48751e62 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -129,7 +129,7 @@ Viewport::Viewport(int w, int h, const rfb::PixelFormat& /*serverPF*/, CConn* cc
OptionsDialog::addCallback(handleOptions, this);
// Make sure we have an initial blank cursor set
- setCursor(0, 0, rfb::Point(0, 0), nullptr);
+ setCursor(0, 0, {0, 0}, nullptr);
}
@@ -430,7 +430,7 @@ int Viewport::handle(int event)
case FL_LEAVE:
window()->cursor(FL_CURSOR_DEFAULT);
// We want a last move event to help trigger edge stuff
- handlePointerEvent(Point(Fl::event_x() - x(), Fl::event_y() - y()), 0);
+ handlePointerEvent({Fl::event_x() - x(), Fl::event_y() - y()}, 0);
return 1;
case FL_PUSH:
@@ -473,11 +473,11 @@ int Viewport::handle(int event)
// A quick press of the wheel "button", followed by a immediate
// release below
- handlePointerEvent(Point(Fl::event_x() - x(), Fl::event_y() - y()),
+ handlePointerEvent({Fl::event_x() - x(), Fl::event_y() - y()},
buttonMask | wheelMask);
}
- handlePointerEvent(Point(Fl::event_x() - x(), Fl::event_y() - y()), buttonMask);
+ handlePointerEvent({Fl::event_x() - x(), Fl::event_y() - y()}, buttonMask);
return 1;
case FL_FOCUS:
diff --git a/win/rfb_win32/DeviceContext.cxx b/win/rfb_win32/DeviceContext.cxx
index 092279fb..15f02a6b 100644
--- a/win/rfb_win32/DeviceContext.cxx
+++ b/win/rfb_win32/DeviceContext.cxx
@@ -152,7 +152,7 @@ Rect DeviceContext::getClipBox(HDC dc) {
RECT cr;
if (!GetClipBox(dc, &cr))
throw rdr::win32_error("GetClipBox", GetLastError());
- return Rect(cr.left, cr.top, cr.right, cr.bottom);
+ return {cr.left, cr.top, cr.right, cr.bottom};
}
diff --git a/win/rfb_win32/DeviceFrameBuffer.cxx b/win/rfb_win32/DeviceFrameBuffer.cxx
index 9d215041..418e320d 100644
--- a/win/rfb_win32/DeviceFrameBuffer.cxx
+++ b/win/rfb_win32/DeviceFrameBuffer.cxx
@@ -123,7 +123,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
// - If hCursor is null then there is no cursor - clear the old one
if (hCursor == nullptr) {
- server->setCursor(0, 0, Point(), nullptr);
+ server->setCursor(0, 0, {}, nullptr);
return;
}
@@ -151,7 +151,7 @@ void DeviceFrameBuffer::setCursor(HCURSOR hCursor, VNCServer* server)
buffer.resize(width * height * 4);
- Point hotspot = Point(iconInfo.xHotspot, iconInfo.yHotspot);
+ Point hotspot(iconInfo.xHotspot, iconInfo.yHotspot);
if (iconInfo.hbmColor) {
// Colour cursor
diff --git a/win/rfb_win32/DeviceFrameBuffer.h b/win/rfb_win32/DeviceFrameBuffer.h
index e9f06cb0..bb9fd678 100644
--- a/win/rfb_win32/DeviceFrameBuffer.h
+++ b/win/rfb_win32/DeviceFrameBuffer.h
@@ -63,7 +63,7 @@ namespace rfb {
class DeviceFrameBuffer : public DIBSectionBuffer {
public:
- DeviceFrameBuffer(HDC deviceContext, const Rect& area_=Rect());
+ DeviceFrameBuffer(HDC deviceContext, const Rect& area_={});
virtual ~DeviceFrameBuffer();
// - FrameBuffer overrides
diff --git a/win/rfb_win32/SDisplay.cxx b/win/rfb_win32/SDisplay.cxx
index 05817562..09f2c6d1 100644
--- a/win/rfb_win32/SDisplay.cxx
+++ b/win/rfb_win32/SDisplay.cxx
@@ -461,8 +461,8 @@ SDisplay::recreatePixelBuffer(bool force) {
Rect newScreenRect;
if (strlen(displayDevice) > 0) {
MonitorInfo info(displayDevice);
- newScreenRect = Rect(info.rcMonitor.left, info.rcMonitor.top,
- info.rcMonitor.right, info.rcMonitor.bottom);
+ newScreenRect = {info.rcMonitor.left, info.rcMonitor.top,
+ info.rcMonitor.right, info.rcMonitor.bottom};
} else {
newScreenRect = new_device->getClipBox();
}
diff --git a/win/rfb_win32/WMCursor.cxx b/win/rfb_win32/WMCursor.cxx
index 65d7a9d7..466461ca 100644
--- a/win/rfb_win32/WMCursor.cxx
+++ b/win/rfb_win32/WMCursor.cxx
@@ -47,7 +47,7 @@ WMCursor::getCursorInfo() {
if (!GetCursorInfo(&info))
throw rdr::win32_error("GetCursorInfo failed", GetLastError());
result.cursor = info.hCursor;
- result.position = Point(info.ptScreenPos.x, info.ptScreenPos.y);
+ result.position = {info.ptScreenPos.x, info.ptScreenPos.y};
result.visible = info.flags & CURSOR_SHOWING;
return result;
}
diff --git a/win/rfb_win32/WMHooks.cxx b/win/rfb_win32/WMHooks.cxx
index e1840eef..ce536de9 100644
--- a/win/rfb_win32/WMHooks.cxx
+++ b/win/rfb_win32/WMHooks.cxx
@@ -236,8 +236,8 @@ WMHooksThread::worker() {
hwnd = (HWND) msg.lParam;
if (IsWindow(hwnd) && IsWindowVisible(hwnd) && !IsIconic(hwnd) &&
GetWindowRect(hwnd, &wrect) && !IsRectEmpty(&wrect)) {
- updates[activeRgn].assign_union(Rect(wrect.left, wrect.top,
- wrect.right, wrect.bottom));
+ updates[activeRgn].assign_union({{wrect.left, wrect.top,
+ wrect.right, wrect.bottom}});
updateDelayTimer.start(updateDelayMs);
}
@@ -249,8 +249,8 @@ WMHooksThread::worker() {
{
POINT pt = {0,0};
if (ClientToScreen(hwnd, &pt)) {
- updates[activeRgn].assign_union(Rect(wrect.left+pt.x, wrect.top+pt.y,
- wrect.right+pt.x, wrect.bottom+pt.y));
+ updates[activeRgn].assign_union({{wrect.left+pt.x, wrect.top+pt.y,
+ wrect.right+pt.x, wrect.bottom+pt.y}});
updateDelayTimer.start(updateDelayMs);
}
}
@@ -260,14 +260,14 @@ WMHooksThread::worker() {
if (IsWindow(hwnd) && IsWindowVisible(hwnd) && !IsIconic(hwnd) &&
GetWindowRect(hwnd, &wrect) && !IsRectEmpty(&wrect))
{
- Region changed(Rect(wrect.left, wrect.top, wrect.right, wrect.bottom));
+ Region changed({wrect.left, wrect.top, wrect.right, wrect.bottom});
RECT crect;
POINT pt = {0,0};
if (GetClientRect(hwnd, &crect) && ClientToScreen(hwnd, &pt) &&
!IsRectEmpty(&crect))
{
- changed.assign_subtract(Rect(crect.left+pt.x, crect.top+pt.y,
- crect.right+pt.x, crect.bottom+pt.y));
+ changed.assign_subtract({{crect.left+pt.x, crect.top+pt.y,
+ crect.right+pt.x, crect.bottom+pt.y}});
}
if (!changed.is_empty()) {
updates[activeRgn].assign_union(changed);
@@ -275,8 +275,8 @@ WMHooksThread::worker() {
}
}
} else if (msg.message == rectangleMsg) {
- Rect r = Rect(LOWORD(msg.wParam), HIWORD(msg.wParam),
- LOWORD(msg.lParam), HIWORD(msg.lParam));
+ Rect r(LOWORD(msg.wParam), HIWORD(msg.wParam),
+ LOWORD(msg.lParam), HIWORD(msg.lParam));
if (!r.is_empty()) {
updates[activeRgn].assign_union(r);
updateDelayTimer.start(updateDelayMs);
diff --git a/win/rfb_win32/WMPoller.cxx b/win/rfb_win32/WMPoller.cxx
index e2ff0ac6..28c19069 100644
--- a/win/rfb_win32/WMPoller.cxx
+++ b/win/rfb_win32/WMPoller.cxx
@@ -71,7 +71,7 @@ rfb::win32::WMPoller::pollWindow(HWND w, PollInfo* i) {
RECT r;
if (IsWindowVisible(w) && GetWindowRect(w, &r)) {
if (IsRectEmpty(&r)) return;
- Region wrgn(Rect(r.left, r.top, r.right, r.bottom));
+ Region wrgn({r.left, r.top, r.right, r.bottom});
if (checkPollWindow(w)) {
wrgn.assign_subtract(i->poll_exclude);
i->poll_include.assign_union(wrgn);
diff --git a/win/rfb_win32/WMWindowCopyRect.cxx b/win/rfb_win32/WMWindowCopyRect.cxx
index ec6e1fdc..c8fa7a11 100644
--- a/win/rfb_win32/WMWindowCopyRect.cxx
+++ b/win/rfb_win32/WMWindowCopyRect.cxx
@@ -49,8 +49,8 @@ rfb::win32::WMCopyRect::processEvent() {
// Window has moved - mark both the previous and new position as changed
// (we can't use add_copied() here because we aren't that properly synced
// with the actual state of the framebuffer)
- ut->add_changed(Region(winrect));
- ut->add_changed(Region(fg_window_rect));
+ ut->add_changed(winrect);
+ ut->add_changed(fg_window_rect);
}
}
fg_window = window;