aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-01-30 07:51:51 +0100
committerPierre Ossman <ossman@cendio.se>2024-08-12 16:32:53 +0200
commit5c3371d8e7e58fd873699c5309e5a74ed0e9fac4 (patch)
treeee0440cbd2128bd2c50a5c2aa2fda4a8d063da10
parent685d85a39d1ecc2b9061805a39fff15f0aeef497 (diff)
downloadtigervnc-5c3371d8e7e58fd873699c5309e5a74ed0e9fac4.tar.gz
tigervnc-5c3371d8e7e58fd873699c5309e5a74ed0e9fac4.zip
Remove InputHandler interface
The different uses of this interface are not that closely related and there is no need for them to have a common interface class.
-rw-r--r--common/rfb/InputHandler.h43
-rw-r--r--common/rfb/SDesktop.h16
-rw-r--r--common/rfb/SMsgHandler.cxx14
-rw-r--r--common/rfb/SMsgHandler.h13
-rw-r--r--unix/x0vncserver/XDesktop.cxx3
-rw-r--r--unix/x0vncserver/XDesktop.h1
6 files changed, 32 insertions, 58 deletions
diff --git a/common/rfb/InputHandler.h b/common/rfb/InputHandler.h
deleted file mode 100644
index ad6c4be5..00000000
--- a/common/rfb/InputHandler.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-//
-// InputHandler - abstract interface for accepting keyboard &
-// pointer input and clipboard data.
-//
-
-#ifndef __RFB_INPUTHANDLER_H__
-#define __RFB_INPUTHANDLER_H__
-
-#include <stdint.h>
-
-#include <rfb/Rect.h>
-
-namespace rfb {
-
- class InputHandler {
- public:
- virtual ~InputHandler() {}
- virtual void keyEvent(uint32_t /*keysym*/, uint32_t /*keycode*/,
- bool /*down*/) { }
- virtual void pointerEvent(const Point& /*pos*/,
- int /*buttonMask*/) { }
- virtual void clientCutText(const char* /*str*/) { }
- };
-
-}
-#endif
diff --git a/common/rfb/SDesktop.h b/common/rfb/SDesktop.h
index 94fcaa28..bcdee93c 100644
--- a/common/rfb/SDesktop.h
+++ b/common/rfb/SDesktop.h
@@ -40,14 +40,13 @@
#include <rfb/PixelBuffer.h>
#include <rfb/VNCServer.h>
-#include <rfb/InputHandler.h>
#include <rfb/screenTypes.h>
namespace network { class Socket; }
namespace rfb {
- class SDesktop : public InputHandler {
+ class SDesktop {
public:
// init() is called immediately when the VNCServer gets a reference
// to the SDesktop, so that a reverse reference can be set up.
@@ -91,10 +90,15 @@ namespace rfb {
// signalling that a good time to render new data
virtual void frameTick(uint64_t msc) { (void)msc; }
- // InputHandler interface
- // pointerEvent(), keyEvent() and clientCutText() are called in response to
- // the relevant RFB protocol messages from clients.
- // See InputHandler for method signatures.
+ // keyEvent() is called whenever a client sends an event that a
+ // key was pressed or released.
+ virtual void keyEvent(uint32_t /*keysym*/, uint32_t /*keycode*/,
+ bool /*down*/) {};
+
+ // pointerEvent() is called whenever a client sends an event that
+ // the pointer moved, or a button was pressed or released.
+ virtual void pointerEvent(const Point& /*pos*/,
+ int /*buttonMask*/) {};
// handleClipboardRequest() is called whenever a client requests
// the server to send over its clipboard data. It will only be
diff --git a/common/rfb/SMsgHandler.cxx b/common/rfb/SMsgHandler.cxx
index 4ecfc2b2..a5f1b7cf 100644
--- a/common/rfb/SMsgHandler.cxx
+++ b/common/rfb/SMsgHandler.cxx
@@ -74,6 +74,20 @@ void SMsgHandler::setEncodings(int nEncodings, const int32_t* encodings)
supportsQEMUKeyEvent();
}
+void SMsgHandler::keyEvent(uint32_t /*keysym*/, uint32_t /*keycode*/,
+ bool /*down*/)
+{
+}
+
+void SMsgHandler::pointerEvent(const Point& /*pos*/,
+ int /*buttonMask*/)
+{
+}
+
+void SMsgHandler::clientCutText(const char* /*str*/)
+{
+}
+
void SMsgHandler::handleClipboardCaps(uint32_t flags, const uint32_t* lengths)
{
int i;
diff --git a/common/rfb/SMsgHandler.h b/common/rfb/SMsgHandler.h
index 20dc066f..de14d626 100644
--- a/common/rfb/SMsgHandler.h
+++ b/common/rfb/SMsgHandler.h
@@ -27,14 +27,13 @@
#include <rfb/PixelFormat.h>
#include <rfb/ClientParams.h>
-#include <rfb/InputHandler.h>
#include <rfb/ScreenSet.h>
namespace rdr { class InStream; }
namespace rfb {
- class SMsgHandler : public InputHandler {
+ class SMsgHandler {
public:
SMsgHandler();
virtual ~SMsgHandler();
@@ -55,6 +54,13 @@ namespace rfb {
virtual void enableContinuousUpdates(bool enable,
int x, int y, int w, int h) = 0;
+ virtual void keyEvent(uint32_t keysym, uint32_t keycode,
+ bool down);
+ virtual void pointerEvent(const Point& pos,
+ int buttonMask);
+
+ virtual void clientCutText(const char* str);
+
virtual void handleClipboardCaps(uint32_t flags,
const uint32_t* lengths);
virtual void handleClipboardRequest(uint32_t flags);
@@ -64,9 +70,6 @@ namespace rfb {
const size_t* lengths,
const uint8_t* const* data);
- // InputHandler interface
- // The InputHandler methods will be called for the corresponding messages.
-
// supportsLocalCursor() is called whenever the status of
// cp.supportsLocalCursor has changed. At the moment this happens on a
// setEncodings message, but in the future this may be due to a message
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx
index a00f2bc2..24cba0df 100644
--- a/unix/x0vncserver/XDesktop.cxx
+++ b/unix/x0vncserver/XDesktop.cxx
@@ -600,9 +600,6 @@ void XDesktop::keyEvent(uint32_t keysym, uint32_t xtcode, bool down) {
#endif
}
-void XDesktop::clientCutText(const char* /*str*/) {
-}
-
ScreenSet XDesktop::computeScreenLayout()
{
ScreenSet layout;
diff --git a/unix/x0vncserver/XDesktop.h b/unix/x0vncserver/XDesktop.h
index 4d922bf0..e952fba9 100644
--- a/unix/x0vncserver/XDesktop.h
+++ b/unix/x0vncserver/XDesktop.h
@@ -62,7 +62,6 @@ public:
const char* userName) override;
void pointerEvent(const rfb::Point& pos, int buttonMask) override;
void keyEvent(uint32_t keysym, uint32_t xtcode, bool down) override;
- void clientCutText(const char* str) override;
unsigned int setScreenLayout(int fb_width, int fb_height,
const rfb::ScreenSet& layout) override;