Deskflow 1.26.0.0
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
ISecondaryScreen.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2025 - 2026 Deskflow Developers
4 * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
5 * SPDX-FileCopyrightText: (C) 2003 Chris Schoeneman
6 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
7 */
8
9#pragma once
10
11#include "common/Coordinate.h"
12#include "common/Settings.h"
13#include "deskflow/MouseTypes.h"
14
16
21{
22public:
24 {
25 m_invertYScroll = Settings::value(Settings::Client::InvertYScroll).toBool();
26 m_yScrollScale = std::clamp(Settings::value(Settings::Client::YScrollScale).toDouble(), 0.1, 10.0);
27 m_invertXScroll = Settings::value(Settings::Client::InvertXScroll).toBool();
28 m_xScrollScale = std::clamp(Settings::value(Settings::Client::XScrollScale).toDouble(), 0.1, 10.0);
29 }
30
31 virtual ~ISecondaryScreen() = default;
33
34
36
39 virtual void fakeMouseButton(ButtonID id, bool press) = 0;
40
42
45 virtual void fakeMouseMove(int32_t x, int32_t y) = 0;
46
48
51 virtual void fakeMouseRelativeMove(int32_t dx, int32_t dy) const = 0;
52
58 virtual void fakeMouseWheel(ScrollDelta delta) const = 0;
59
67 {
68 delta.y = static_cast<int32_t>(m_invertYScroll ? delta.y * -m_yScrollScale : delta.y * m_yScrollScale);
69 delta.x = static_cast<int32_t>(m_invertXScroll ? delta.x * -m_xScrollScale : delta.x * m_xScrollScale);
70 return delta;
71 }
72
73private:
78 bool m_invertYScroll = false;
79
84 double m_yScrollScale = 1.0;
85
90 bool m_invertXScroll = false;
91
96 double m_xScrollScale = 1.0;
98};
Coordinate ScrollDelta
Definition Coordinate.h:21
uint8_t ButtonID
Mouse button ID.
Definition MouseTypes.h:16
int y
Definition ServerConfig.cpp:25
int x
Definition ServerConfig.cpp:24
virtual void fakeMouseWheel(ScrollDelta delta) const =0
Synthesize a mouse wheel event of amount This Implmentation for this method should call applyScrollMo...
virtual ~ISecondaryScreen()=default
virtual void fakeMouseRelativeMove(int32_t dx, int32_t dy) const =0
Fake mouse move.
virtual void fakeMouseButton(ButtonID id, bool press)=0
Fake mouse press/release.
virtual void fakeMouseMove(int32_t x, int32_t y)=0
Fake mouse move.
ScrollDelta applyScrollModifier(ScrollDelta delta) const
Applies any scroll modfifers to the provided delta, This should only be done inside the subclasses fa...
Definition ISecondaryScreen.h:66
ISecondaryScreen()
Definition ISecondaryScreen.h:23
static QVariant value(const QString &key=QString())
Definition Settings.cpp:298
int32_t x
Definition Coordinate.h:17
int32_t y
Definition Coordinate.h:18
static const auto InvertXScroll
Definition Settings.h:38
static const auto XScrollScale
Definition Settings.h:40
static const auto YScrollScale
Definition Settings.h:39
static const auto InvertYScroll
Definition Settings.h:37