refactor: XWindowsScreen use a fixed minimum step value in place of the scroll speed setting
This commit is contained in:
parent
857326b274
commit
0f6ec6c196
4 changed files with 7 additions and 18 deletions
|
|
@ -130,8 +130,7 @@ deskflow::Screen *ClientApp::createScreen()
|
|||
LOG_INFO("using legacy x windows screen");
|
||||
return new deskflow::Screen(
|
||||
new XWindowsScreen(
|
||||
qPrintable(Settings::value(Settings::Core::Display).toString()), false,
|
||||
Settings::value(Settings::Client::ScrollSpeed).toInt(), getEvents(), invertScrolling
|
||||
qPrintable(Settings::value(Settings::Core::Display).toString()), false, getEvents(), invertScrolling
|
||||
),
|
||||
getEvents()
|
||||
);
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ deskflow::Screen *ServerApp::createScreen()
|
|||
#if WINAPI_XWINDOWS
|
||||
LOG_INFO("using legacy x windows screen");
|
||||
return new deskflow::Screen(
|
||||
new XWindowsScreen(qPrintable(Settings::value(Settings::Core::Display).toString()), true, 0, getEvents()),
|
||||
new XWindowsScreen(qPrintable(Settings::value(Settings::Core::Display).toString()), true, getEvents()),
|
||||
getEvents()
|
||||
);
|
||||
#elif WINAPI_CARBON
|
||||
|
|
|
|||
|
|
@ -82,19 +82,13 @@ static int xi_opcode;
|
|||
|
||||
XWindowsScreen *XWindowsScreen::s_screen = nullptr;
|
||||
|
||||
XWindowsScreen::XWindowsScreen(
|
||||
const char *displayName, bool isPrimary, int mouseScrollDelta, IEventQueue *events, bool invertScrolling
|
||||
)
|
||||
XWindowsScreen::XWindowsScreen(const char *displayName, bool isPrimary, IEventQueue *events, bool invertScrolling)
|
||||
: PlatformScreen(events, invertScrolling),
|
||||
m_isPrimary(isPrimary),
|
||||
m_mouseScrollDelta(mouseScrollDelta),
|
||||
m_isOnScreen(m_isPrimary),
|
||||
m_events(events)
|
||||
{
|
||||
assert(s_screen == nullptr);
|
||||
|
||||
if (mouseScrollDelta == 0)
|
||||
m_mouseScrollDelta = 120;
|
||||
s_screen = this;
|
||||
|
||||
if (XInitThreads() == 0) {
|
||||
|
|
@ -823,12 +817,11 @@ void XWindowsScreen::fakeMouseWheel(int32_t, int32_t yDelta) const
|
|||
yDelta = -yDelta;
|
||||
}
|
||||
|
||||
if (yDelta < m_mouseScrollDelta) {
|
||||
LOG_WARN("wheel scroll delta (%d) smaller than threshold (%d)", yDelta, m_mouseScrollDelta);
|
||||
}
|
||||
// Delta for a "click"
|
||||
static const auto s_mouseDelta = 120;
|
||||
|
||||
// send as many clicks as necessary
|
||||
for (; yDelta >= m_mouseScrollDelta; yDelta -= m_mouseScrollDelta) {
|
||||
for (; yDelta >= 0; yDelta -= s_mouseDelta) {
|
||||
XTestFakeButtonEvent(m_display, xButton, True, CurrentTime);
|
||||
XTestFakeButtonEvent(m_display, xButton, False, CurrentTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ class XWindowsScreenSaver;
|
|||
class XWindowsScreen : public PlatformScreen
|
||||
{
|
||||
public:
|
||||
XWindowsScreen(
|
||||
const char *displayName, bool isPrimary, int mouseScrollDelta, IEventQueue *events, bool invertScrolling = false
|
||||
);
|
||||
XWindowsScreen(const char *displayName, bool isPrimary, IEventQueue *events, bool invertScrolling = false);
|
||||
~XWindowsScreen() override;
|
||||
|
||||
//! @name manipulators
|
||||
|
|
@ -167,7 +165,6 @@ private:
|
|||
|
||||
// true if screen is being used as a primary screen, false otherwise
|
||||
bool m_isPrimary;
|
||||
int m_mouseScrollDelta;
|
||||
|
||||
Display *m_display = nullptr;
|
||||
Window m_root = None;
|
||||
|
|
|
|||
Loading…
Reference in a new issue