Changeset View
Changeset View
Standalone View
Standalone View
krfb/rfbserver.cpp
Show All 18 Lines | |||||
19 | */ | 19 | */ | ||
20 | #include "rfbserver.h" | 20 | #include "rfbserver.h" | ||
21 | #include "rfbservermanager.h" | 21 | #include "rfbservermanager.h" | ||
22 | #include <QSocketNotifier> | 22 | #include <QSocketNotifier> | ||
23 | #include <QApplication> | 23 | #include <QApplication> | ||
24 | #include <QClipboard> | 24 | #include <QClipboard> | ||
25 | #include <QPointer> | 25 | #include <QPointer> | ||
26 | #include <QDebug> | 26 | #include <QDebug> | ||
27 | #include <QX11Info> | ||||
27 | 28 | | |||
28 | struct RfbServer::Private | 29 | struct RfbServer::Private | ||
29 | { | 30 | { | ||
30 | QByteArray listeningAddress; | 31 | QByteArray listeningAddress; | ||
31 | int listeningPort; | 32 | int listeningPort; | ||
32 | bool passwordRequired; | 33 | bool passwordRequired; | ||
33 | rfbScreenInfoPtr screen; | 34 | rfbScreenInfoPtr screen; | ||
34 | QPointer<QSocketNotifier> ipv4notifier; | 35 | QPointer<QSocketNotifier> ipv4notifier; | ||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Line(s) | 91 | { | |||
138 | 139 | | |||
139 | d->ipv4notifier = new QSocketNotifier(d->screen->listenSock, QSocketNotifier::Read, this); | 140 | d->ipv4notifier = new QSocketNotifier(d->screen->listenSock, QSocketNotifier::Read, this); | ||
140 | connect(d->ipv4notifier, &QSocketNotifier::activated, this, &RfbServer::onListenSocketActivated); | 141 | connect(d->ipv4notifier, &QSocketNotifier::activated, this, &RfbServer::onListenSocketActivated); | ||
141 | if (d->screen->listen6Sock > 0) { | 142 | if (d->screen->listen6Sock > 0) { | ||
142 | // we're also listening on additional IPv6 socket, get events from there | 143 | // we're also listening on additional IPv6 socket, get events from there | ||
143 | d->ipv6notifier = new QSocketNotifier(d->screen->listen6Sock, QSocketNotifier::Read, this); | 144 | d->ipv6notifier = new QSocketNotifier(d->screen->listen6Sock, QSocketNotifier::Read, this); | ||
144 | connect(d->ipv6notifier, &QSocketNotifier::activated, this, &RfbServer::onListenSocketActivated); | 145 | connect(d->ipv6notifier, &QSocketNotifier::activated, this, &RfbServer::onListenSocketActivated); | ||
145 | } | 146 | } | ||
147 | | ||||
148 | if (QX11Info::isPlatformX11()) { | ||||
146 | connect(QApplication::clipboard(), &QClipboard::dataChanged, | 149 | connect(QApplication::clipboard(), &QClipboard::dataChanged, | ||
Kanedias: Doesn't QClipboard work on Wayland? | |||||
Nope, or at least this way it was breaking VNC protocol and I wasn't able to connect. jgrulich: Nope, or at least this way it was breaking VNC protocol and I wasn't able to connect. | |||||
Hmm I think I know the reason. Try to write the password without copying it from anywhere or selecting anything. Kanedias: Hmm I think I know the reason. Try to write the password without copying it from anywhere or… | |||||
I always type the password, I don't paste it and I don't have any text selected. jgrulich: I always type the password, I don't paste it and I don't have any text selected. | |||||
147 | this, &RfbServer::krfbSendServerCutText); | 150 | this, &RfbServer::krfbSendServerCutText); | ||
151 | } | ||||
148 | 152 | | |||
149 | return true; | 153 | return true; | ||
150 | } | 154 | } | ||
151 | 155 | | |||
152 | void RfbServer::stop() | 156 | void RfbServer::stop() | ||
153 | { | 157 | { | ||
154 | if (d->screen) { | 158 | if (d->screen) { | ||
155 | rfbShutdownServer(d->screen, true); | 159 | rfbShutdownServer(d->screen, true); | ||
156 | for (auto notifier : {d->ipv4notifier, d->ipv6notifier}) { | 160 | for (auto notifier : {d->ipv4notifier, d->ipv6notifier}) { | ||
157 | if (notifier) { | 161 | if (notifier) { | ||
158 | notifier->setEnabled(false); | 162 | notifier->setEnabled(false); | ||
159 | notifier->deleteLater(); | 163 | notifier->deleteLater(); | ||
160 | } | 164 | } | ||
161 | } | 165 | } | ||
162 | } | 166 | } | ||
163 | } | 167 | } | ||
164 | 168 | | |||
169 | void RfbServer::updateFrameBuffer(char *fb, int width, int height, int depth) | ||||
170 | { | ||||
171 | int bpp = depth >> 3; | ||||
172 | | ||||
173 | if (bpp != 1 && bpp != 2 && bpp != 4) { | ||||
174 | bpp = 4; | ||||
175 | } | ||||
176 | | ||||
177 | rfbNewFramebuffer(d->screen, fb, width, height, 8, 3, bpp); | ||||
178 | } | ||||
179 | | ||||
165 | void RfbServer::updateScreen(const QList<QRect> & modifiedTiles) | 180 | void RfbServer::updateScreen(const QList<QRect> & modifiedTiles) | ||
166 | { | 181 | { | ||
167 | if (d->screen) { | 182 | if (d->screen) { | ||
168 | QList<QRect>::const_iterator it = modifiedTiles.constBegin(); | 183 | QList<QRect>::const_iterator it = modifiedTiles.constBegin(); | ||
169 | for(; it != modifiedTiles.constEnd(); ++it) { | 184 | for(; it != modifiedTiles.constEnd(); ++it) { | ||
170 | rfbMarkRectAsModified(d->screen, it->x(), it->y(), it->right(), it->bottom()); | 185 | rfbMarkRectAsModified(d->screen, it->x(), it->y(), it->right(), it->bottom()); | ||
171 | } | 186 | } | ||
172 | } | 187 | } | ||
▲ Show 20 Lines • Show All 114 Lines • Show Last 20 Lines |
Doesn't QClipboard work on Wayland?