summaryrefslogtreecommitdiffstats
path: root/src/client/net/serverconnection.cpp
diff options
context:
space:
mode:
authorSimon Rettberg2016-10-19 23:56:34 +0200
committerSimon Rettberg2016-10-19 23:56:34 +0200
commit6534027c5ce5579c4293aa346cadf0850aa02157 (patch)
treef9974a9dbed4ca33a4e167e05cde1dc7915b31a4 /src/client/net/serverconnection.cpp
parent[client] Update translations (diff)
downloadpvs2-6534027c5ce5579c4293aa346cadf0850aa02157.tar.gz
pvs2-6534027c5ce5579c4293aa346cadf0850aa02157.tar.xz
pvs2-6534027c5ce5579c4293aa346cadf0850aa02157.zip
Implement "Attention" feature (virtual hand-raising)
Diffstat (limited to 'src/client/net/serverconnection.cpp')
-rw-r--r--src/client/net/serverconnection.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/client/net/serverconnection.cpp b/src/client/net/serverconnection.cpp
index 1275921..02c35fd 100644
--- a/src/client/net/serverconnection.cpp
+++ b/src/client/net/serverconnection.cpp
@@ -66,6 +66,14 @@ void ServerConnection::sendMessage(NetworkMessage& message)
}
}
+void ServerConnection::sendAttention(bool on)
+{
+ NetworkMessage msg;
+ msg.setField(_ID, _ATTENTION);
+ msg.setField(_ENABLE, _BOOL(on));
+ sendMessage(msg);
+}
+
/**
* Disconnect from current server.
* Do some cleanup also, like stopping any VNC server/client
@@ -177,18 +185,21 @@ void ServerConnection::handleMsg()
}
int x = _fromServer.getFieldString(_X).toInt();
int y = _fromServer.getFieldString(_Y).toInt();
- if (x < 32)
- x = 32;
- else if (x > 400)
- x = 400;
- if (y < 18)
- y = 18;
- else if (y > 300)
- y = 300;
// Get rect of primary screen
const QDesktopWidget primary;
const QRect primaryRect = primary.screenGeometry();
+ // Limit requested size so it won't easily leak sensitive information
+ if (x < 32) {
+ x = 32;
+ } else if (x > primaryRect.width() / 8) {
+ x = primaryRect.width() / 8;
+ }
+ if (y < 18) {
+ y = 18;
+ } else if (y > primaryRect.height() / 8) {
+ y = primaryRect.height() / 8;
+ }
QPixmap desktop(
QPixmap::grabWindow(
@@ -255,6 +266,8 @@ void ServerConnection::handleMsg()
_blank->lock(_fromServer.getFieldString("MESSAGE"));
else
_blank->unlock();
+ } else if (id == _ATTENTION) {
+ emit attentionChanged(_fromServer.getFieldString(_ENABLE) == __TRUE);
}
}