aboutsummaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
Diffstat (limited to 'unix')
-rw-r--r--unix/tx/TXDialog.h4
-rw-r--r--unix/vncconfig/vncconfig.cxx6
-rw-r--r--unix/x0vncserver/XDesktop.cxx15
-rw-r--r--unix/x0vncserver/XDesktop.h4
-rw-r--r--unix/x0vncserver/x0vncserver.cxx6
-rw-r--r--unix/xserver/hw/vnc/RFBGlue.cc2
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.cc43
-rw-r--r--unix/xserver/hw/vnc/XserverDesktop.h2
-rw-r--r--unix/xserver/hw/vnc/Xvnc.man4
-rw-r--r--unix/xserver/hw/vnc/vncExtInit.cc38
-rw-r--r--unix/xserver/hw/vnc/vncInput.c19
11 files changed, 80 insertions, 63 deletions
diff --git a/unix/tx/TXDialog.h b/unix/tx/TXDialog.h
index 3a22fd07..6533377f 100644
--- a/unix/tx/TXDialog.h
+++ b/unix/tx/TXDialog.h
@@ -28,6 +28,8 @@
#ifndef __TXDIALOG_H__
#define __TXDIALOG_H__
+#include <rdr/Exception.h>
+
#include "TXWindow.h"
#include <errno.h>
@@ -63,7 +65,7 @@ public:
FD_ZERO(&rfds);
FD_SET(ConnectionNumber(dpy), &rfds);
int n = select(FD_SETSIZE, &rfds, nullptr, nullptr, nullptr);
- if (n < 0) throw rdr::SocketException("select", errno);
+ if (n < 0) throw rdr::socket_error("select", errno);
}
}
return true;
diff --git a/unix/vncconfig/vncconfig.cxx b/unix/vncconfig/vncconfig.cxx
index 545271ce..d74d18a6 100644
--- a/unix/vncconfig/vncconfig.cxx
+++ b/unix/vncconfig/vncconfig.cxx
@@ -330,13 +330,13 @@ int main(int argc, char** argv)
FD_ZERO(&rfds);
FD_SET(ConnectionNumber(dpy), &rfds);
int n = select(FD_SETSIZE, &rfds, nullptr, nullptr, tvp);
- if (n < 0) throw rdr::SocketException("select", errno);
+ if (n < 0) throw rdr::socket_error("select", errno);
}
XCloseDisplay(dpy);
- } catch (rdr::Exception &e) {
- vlog.error("%s", e.str());
+ } catch (std::exception& e) {
+ vlog.error("%s", e.what());
}
return 0;
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx
index 3e78a83f..b43e3f79 100644
--- a/unix/x0vncserver/XDesktop.cxx
+++ b/unix/x0vncserver/XDesktop.cxx
@@ -31,7 +31,6 @@
#include <network/Socket.h>
#include <rfb/LogWriter.h>
-#include <rfb/Exception.h>
#include <x0vncserver/XDesktop.h>
@@ -98,7 +97,7 @@ XDesktop::XDesktop(Display* dpy_, Geometry *geometry_)
if (!XkbQueryExtension(dpy, &xkbOpcode, &xkbEventBase,
&xkbErrorBase, &major, &minor)) {
vlog.error("XKEYBOARD extension not present");
- throw Exception();
+ throw std::runtime_error("XKEYBOARD extension not present");
}
XkbSelectEvents(dpy, XkbUseCoreKbd, XkbIndicatorStateNotifyMask,
@@ -248,9 +247,9 @@ void XDesktop::init(VNCServer* vs)
void XDesktop::start()
{
// Determine actual number of buttons of the X pointer device.
- unsigned char btnMap[8];
- int numButtons = XGetPointerMapping(dpy, btnMap, 8);
- maxButtons = (numButtons > 8) ? 8 : numButtons;
+ unsigned char btnMap[9];
+ int numButtons = XGetPointerMapping(dpy, btnMap, 9);
+ maxButtons = (numButtons > 9) ? 9 : numButtons;
vlog.info("Enabling %d button%s of X pointer device",
maxButtons, (maxButtons != 1) ? "s" : "");
@@ -348,7 +347,7 @@ void XDesktop::queryConnection(network::Socket* sock,
queryConnectDialog->map();
}
-void XDesktop::pointerEvent(const Point& pos, uint8_t buttonMask) {
+void XDesktop::pointerEvent(const Point& pos, uint16_t buttonMask) {
#ifdef HAVE_XTEST
if (!haveXtest) return;
XTestFakeMotionEvent(dpy, DefaultScreen(dpy),
@@ -1049,8 +1048,8 @@ bool XDesktop::setCursor()
try {
server->setCursor(cim->width, cim->height, Point(cim->xhot, cim->yhot),
cursorData);
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::setCursor: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::setCursor: %s",e.what());
}
delete [] cursorData;
diff --git a/unix/x0vncserver/XDesktop.h b/unix/x0vncserver/XDesktop.h
index cadc695f..a27a1eae 100644
--- a/unix/x0vncserver/XDesktop.h
+++ b/unix/x0vncserver/XDesktop.h
@@ -63,7 +63,7 @@ public:
bool isRunning();
void queryConnection(network::Socket* sock,
const char* userName) override;
- void pointerEvent(const rfb::Point& pos, uint8_t buttonMask) override;
+ void pointerEvent(const rfb::Point& pos, uint16_t buttonMask) override;
void keyEvent(uint32_t keysym, uint32_t xtcode, bool down) override;
unsigned int setScreenLayout(int fb_width, int fb_height,
const rfb::ScreenSet& layout) override;
@@ -90,7 +90,7 @@ protected:
QueryConnectDialog* queryConnectDialog;
network::Socket* queryConnectSock;
XSelection selection;
- uint8_t oldButtonMask;
+ uint16_t oldButtonMask;
bool haveXtest;
bool haveDamage;
int maxButtons;
diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx
index 0c3f5b93..f67bdcc9 100644
--- a/unix/x0vncserver/x0vncserver.cxx
+++ b/unix/x0vncserver/x0vncserver.cxx
@@ -436,7 +436,7 @@ int main(int argc, char** argv)
vlog.debug("Interrupted select() system call");
continue;
} else {
- throw rdr::SocketException("select", errno);
+ throw rdr::socket_error("select", errno);
}
}
@@ -475,8 +475,8 @@ int main(int argc, char** argv)
}
}
- } catch (rdr::Exception &e) {
- vlog.error("%s", e.str());
+ } catch (std::exception& e) {
+ vlog.error("%s", e.what());
return 1;
}
diff --git a/unix/xserver/hw/vnc/RFBGlue.cc b/unix/xserver/hw/vnc/RFBGlue.cc
index 2cbee35c..2295bee8 100644
--- a/unix/xserver/hw/vnc/RFBGlue.cc
+++ b/unix/xserver/hw/vnc/RFBGlue.cc
@@ -216,7 +216,7 @@ int vncIsTCPPortUsed(int port)
delete dummy.back();
dummy.pop_back();
}
- } catch (rdr::Exception& e) {
+ } catch (std::exception& e) {
return 1;
}
return 0;
diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc
index c872a6ba..260ed3a6 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.cc
+++ b/unix/xserver/hw/vnc/XserverDesktop.cc
@@ -38,7 +38,6 @@
#include <sys/utsname.h>
#include <network/Socket.h>
-#include <rfb/Exception.h>
#include <rfb/VNCServerST.h>
#include <rfb/LogWriter.h>
#include <rfb/Configuration.h>
@@ -195,8 +194,8 @@ void XserverDesktop::requestClipboard()
{
try {
server->requestClipboard();
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::requestClipboard: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::requestClipboard: %s",e.what());
}
}
@@ -204,8 +203,8 @@ void XserverDesktop::announceClipboard(bool available)
{
try {
server->announceClipboard(available);
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::announceClipboard: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::announceClipboard: %s",e.what());
}
}
@@ -213,8 +212,8 @@ void XserverDesktop::sendClipboardData(const char* data_)
{
try {
server->sendClipboardData(data_);
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::sendClipboardData: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::sendClipboardData: %s",e.what());
}
}
@@ -232,8 +231,8 @@ void XserverDesktop::setDesktopName(const char* name)
{
try {
server->setName(name);
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::setDesktopName: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::setDesktopName: %s",e.what());
}
}
@@ -267,8 +266,8 @@ void XserverDesktop::setCursor(int width, int height, int hotX, int hotY,
try {
server->setCursor(width, height, Point(hotX, hotY), cursorData);
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::setCursor: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::setCursor: %s",e.what());
}
delete [] cursorData;
@@ -278,8 +277,8 @@ void XserverDesktop::setCursorPos(int x, int y, bool warped)
{
try {
server->setCursorPos(Point(x, y), warped);
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::setCursorPos: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::setCursorPos: %s",e.what());
}
}
@@ -287,8 +286,8 @@ void XserverDesktop::add_changed(const rfb::Region &region)
{
try {
server->add_changed(region);
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::add_changed: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::add_changed: %s",e.what());
}
}
@@ -296,8 +295,8 @@ void XserverDesktop::add_copied(const rfb::Region &dest, const rfb::Point &delta
{
try {
server->add_copied(dest, delta);
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::add_copied: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::add_copied: %s",e.what());
}
}
@@ -313,8 +312,8 @@ void XserverDesktop::handleSocketEvent(int fd, bool read, bool write)
return;
vlog.error("Cannot find file descriptor for socket event");
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::handleSocketEvent: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::handleSocketEvent: %s",e.what());
}
}
@@ -406,8 +405,8 @@ void XserverDesktop::blockHandler(int* timeout)
int nextTimeout = Timer::checkTimeouts();
if (nextTimeout >= 0 && (*timeout == -1 || nextTimeout < *timeout))
*timeout = nextTimeout;
- } catch (rdr::Exception& e) {
- vlog.error("XserverDesktop::blockHandler: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("XserverDesktop::blockHandler: %s", e.what());
}
}
@@ -463,7 +462,7 @@ void XserverDesktop::terminate()
kill(getpid(), SIGTERM);
}
-void XserverDesktop::pointerEvent(const Point& pos, uint8_t buttonMask)
+void XserverDesktop::pointerEvent(const Point& pos, uint16_t buttonMask)
{
vncPointerMove(pos.x + vncGetScreenX(screenIndex),
pos.y + vncGetScreenY(screenIndex));
diff --git a/unix/xserver/hw/vnc/XserverDesktop.h b/unix/xserver/hw/vnc/XserverDesktop.h
index d287b72f..8c543db7 100644
--- a/unix/xserver/hw/vnc/XserverDesktop.h
+++ b/unix/xserver/hw/vnc/XserverDesktop.h
@@ -95,7 +95,7 @@ public:
void terminate() override;
void queryConnection(network::Socket* sock,
const char* userName) override;
- void pointerEvent(const rfb::Point& pos, uint8_t buttonMask) override;
+ void pointerEvent(const rfb::Point& pos, uint16_t buttonMask) override;
void keyEvent(uint32_t keysym, uint32_t keycode, bool down) override;
unsigned int setScreenLayout(int fb_width, int fb_height,
const rfb::ScreenSet& layout) override;
diff --git a/unix/xserver/hw/vnc/Xvnc.man b/unix/xserver/hw/vnc/Xvnc.man
index d76b2cb2..49b1dc8a 100644
--- a/unix/xserver/hw/vnc/Xvnc.man
+++ b/unix/xserver/hw/vnc/Xvnc.man
@@ -361,8 +361,8 @@ localhost -once securitytypes=none
In this example a viewer connection to :50 will result in a new Xvnc for that
connection which should display the standard XDM login screen on that machine.
-Because the user needs to login via XDM, it is usually OK to accept connections
-without a VNC password in this case.
+It is usually OK to accept connections without a VNC password, since the user
+still needs to log in via XDM in this case.
In the wait mode, when the first connection comes in, inetd gives the listening
socket to Xvnc. This means that for a given TCP port, there is only ever one
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc
index 7576619e..9b8cfe5b 100644
--- a/unix/xserver/hw/vnc/vncExtInit.cc
+++ b/unix/xserver/hw/vnc/vncExtInit.cc
@@ -250,7 +250,7 @@ void vncExtensionInit(void)
}
if (!inetd && listeners.empty())
- throw rdr::Exception("No path or port configured for incoming connections");
+ throw std::runtime_error("No path or port configured for incoming connections");
PixelFormat pf = vncGetPixelFormat(scr);
@@ -274,8 +274,8 @@ void vncExtensionInit(void)
vncHooksInit(scr);
}
- } catch (rdr::Exception& e) {
- vncFatalError("vncExtInit: %s\n",e.str());
+ } catch (std::exception& e) {
+ vncFatalError("vncExtInit: %s\n",e.what());
}
vncRegisterBlockHandlers();
@@ -288,8 +288,8 @@ void vncExtensionClose(void)
delete desktop[scr];
desktop[scr] = nullptr;
}
- } catch (rdr::Exception& e) {
- vncFatalError("vncExtInit: %s\n",e.str());
+ } catch (std::exception& e) {
+ vncFatalError("vncExtInit: %s\n",e.what());
}
}
@@ -348,8 +348,8 @@ int vncConnectClient(const char *addr, int viewOnly)
if (strlen(addr) == 0) {
try {
desktop[0]->disconnectClients();
- } catch (rdr::Exception& e) {
- vlog.error("Disconnecting all clients: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("Disconnecting all clients: %s", e.what());
return -1;
}
return 0;
@@ -365,8 +365,8 @@ int vncConnectClient(const char *addr, int viewOnly)
vlog.info("Reverse connection: %s:%d%s", host.c_str(), port,
viewOnly ? " (view only)" : "");
desktop[0]->addClient(sock, true, (bool)viewOnly);
- } catch (rdr::Exception& e) {
- vlog.error("Reverse connection: %s",e.str());
+ } catch (std::exception& e) {
+ vlog.error("Reverse connection: %s", e.what());
return -1;
}
@@ -462,8 +462,8 @@ void vncPostScreenResize(int scrIdx, int success, int width, int height)
desktop[scrIdx]->setFramebuffer(width, height,
vncFbptr[scrIdx],
vncFbstride[scrIdx]);
- } catch (rdr::Exception& e) {
- vncFatalError("vncPostScreenResize: %s\n", e.str());
+ } catch (std::exception& e) {
+ vncFatalError("vncPostScreenResize: %s\n", e.what());
}
}
@@ -479,8 +479,8 @@ void vncRefreshScreenLayout(int scrIdx)
{
try {
desktop[scrIdx]->refreshScreenLayout();
- } catch (rdr::Exception& e) {
- vncFatalError("vncRefreshScreenLayout: %s\n", e.str());
+ } catch (std::exception& e) {
+ vncFatalError("vncRefreshScreenLayout: %s\n", e.what());
}
}
@@ -488,8 +488,8 @@ uint64_t vncGetMsc(int scrIdx)
{
try {
return desktop[scrIdx]->getMsc();
- } catch (rdr::Exception& e) {
- vncFatalError("vncGetMsc: %s\n", e.str());
+ } catch (std::exception& e) {
+ vncFatalError("vncGetMsc: %s\n", e.what());
}
}
@@ -497,8 +497,8 @@ void vncQueueMsc(int scrIdx, uint64_t id, uint64_t msc)
{
try {
desktop[scrIdx]->queueMsc(id, msc);
- } catch (rdr::Exception& e) {
- vncFatalError("vncQueueMsc: %s\n", e.str());
+ } catch (std::exception& e) {
+ vncFatalError("vncQueueMsc: %s\n", e.what());
}
}
@@ -506,8 +506,8 @@ void vncAbortMsc(int scrIdx, uint64_t id)
{
try {
desktop[scrIdx]->abortMsc(id);
- } catch (rdr::Exception& e) {
- vncFatalError("vncAbortMsc: %s\n", e.str());
+ } catch (std::exception& e) {
+ vncFatalError("vncAbortMsc: %s\n", e.what());
}
}
diff --git a/unix/xserver/hw/vnc/vncInput.c b/unix/xserver/hw/vnc/vncInput.c
index 1de41430..a705a85a 100644
--- a/unix/xserver/hw/vnc/vncInput.c
+++ b/unix/xserver/hw/vnc/vncInput.c
@@ -50,7 +50,7 @@ extern const unsigned int code_map_qnum_to_xorgevdev_len;
extern const unsigned short code_map_qnum_to_xorgkbd[];
extern const unsigned int code_map_qnum_to_xorgkbd_len;
-#define BUTTONS 7
+#define BUTTONS 9
DeviceIntPtr vncKeyboardDev;
DeviceIntPtr vncPointerDev;
@@ -207,6 +207,23 @@ static int vncPointerProc(DeviceIntPtr pDevice, int onoff)
btn_labels[5] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_LEFT);
btn_labels[6] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_HWHEEL_RIGHT);
+ /*
+ * The labels BTN_LABEL_PROP_BTN_SIDE and BTN_LABEL_PROP_BTN_EXTRA
+ * represent the side buttons on mice that are typically used to
+ * navigate back/forward respectively in web browsers.
+ *
+ * In X11, these labels are mapped to the BTN_SIDE and BTN_EXTRA
+ * input codes, which are mapped in the Linux HID driver. These
+ * are not to be confused with the BTN_FORWARD and BTN_BACK input
+ * codes, which some applications also use for back/forward
+ * navigation.
+ *
+ * It seems like most mice have their side buttons mapped to
+ * BTN_SIDE and BTN_EXTRA.
+ */
+ btn_labels[7] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_SIDE);
+ btn_labels[8] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_EXTRA);
+
axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);