Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ deskflow-config.toml
/scripts/*.egg-info
/*.user
*.ui.autosave

# local strategy docs and tracking (not for upstream)
/local/
10 changes: 9 additions & 1 deletion src/gui/src/ServerConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ bool ServerConfig::operator==(const ServerConfig &sc) const
m_SwitchCornerSize == sc.m_SwitchCornerSize && m_SwitchCorners == sc.m_SwitchCorners &&
m_Hotkeys == sc.m_Hotkeys && m_pAppConfig == sc.m_pAppConfig &&
m_DisableLockToScreen == sc.m_DisableLockToScreen && m_ClipboardSharing == sc.m_ClipboardSharing &&
m_ClipboardSharingSize == sc.m_ClipboardSharingSize && m_pMainWindow == sc.m_pMainWindow;
m_ClipboardSharingSize == sc.m_ClipboardSharingSize && m_TouchActivateScreen == sc.m_TouchActivateScreen &&
m_pMainWindow == sc.m_pMainWindow;
}

void ServerConfig::save(QFile &file) const
Expand Down Expand Up @@ -127,6 +128,7 @@ void ServerConfig::commit()
settings().setValue("disableLockToScreen", disableLockToScreen());
settings().setValue("clipboardSharing", clipboardSharing());
settings().setValue("clipboardSharingSize", QVariant::fromValue(clipboardSharingSize()));
settings().setValue("touchActivateScreen", touchActivateScreen());

if (!getClientAddress().isEmpty()) {
settings().setValue("clientAddress", getClientAddress());
Expand Down Expand Up @@ -182,6 +184,9 @@ void ServerConfig::recall()
settings().value("clipboardSharingSize", (int)ServerConfig::defaultClipboardSharingSize()).toULongLong()
);
setClipboardSharing(settings().value("clipboardSharing", true).toBool());
setTouchActivateScreen(
settings().value("touchActivateScreen",
settings().value("touchInputLocal", false)).toBool());
setClientAddress(settings().value("clientAddress", "").toString());

readSettings(settings(), switchCorners(), "switchCorner", 0, static_cast<int>(NumSwitchCorners));
Expand Down Expand Up @@ -310,6 +315,9 @@ QTextStream &operator<<(QTextStream &outStream, const ServerConfig &config)
outStream << "\t"
<< "switchCornerSize = " << config.switchCornerSize() << Qt::endl;

outStream << "\t"
<< "touchActivateScreen = " << (config.touchActivateScreen() ? "true" : "false") << Qt::endl;

foreach (const Hotkey &hotkey, config.hotkeys())
outStream << hotkey;

Expand Down
9 changes: 9 additions & 0 deletions src/gui/src/ServerConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ class ServerConfig : public ScreenConfig, public deskflow::gui::IServerConfig
{
return m_ClipboardSharingSize;
}
bool touchActivateScreen() const
{
return m_TouchActivateScreen;
}
static size_t defaultClipboardSharingSize();

//
Expand Down Expand Up @@ -224,6 +228,10 @@ class ServerConfig : public ScreenConfig, public deskflow::gui::IServerConfig
{
m_ClipboardSharing = on;
}
void setTouchActivateScreen(bool on)
{
m_TouchActivateScreen = on;
}
void setConfigFile(const QString &configFile);
void setUseExternalConfig(bool useExternalConfig);
size_t setClipboardSharingSize(size_t size);
Expand Down Expand Up @@ -253,6 +261,7 @@ class ServerConfig : public ScreenConfig, public deskflow::gui::IServerConfig
int m_SwitchCornerSize = 0;
bool m_DisableLockToScreen = false;
bool m_ClipboardSharing = true;
bool m_TouchActivateScreen = false;
QString m_ClientAddress = "";
QList<bool> m_SwitchCorners;
HotkeyList m_Hotkeys;
Expand Down
9 changes: 9 additions & 0 deletions src/gui/src/ServerConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config, Ap
m_pCheckBoxCornerBottomRight->setChecked(serverConfig().switchCorner(static_cast<int>(BottomRight)));
m_pSpinBoxSwitchCornerSize->setValue(serverConfig().switchCornerSize());
m_pCheckBoxDisableLockToScreen->setChecked(serverConfig().disableLockToScreen());
m_pCheckBoxTouchActivateScreen->setChecked(serverConfig().touchActivateScreen());

m_pCheckBoxEnableClipboard->setChecked(serverConfig().clipboardSharing());
int clipboardSharingSizeM = static_cast<int>(serverConfig().clipboardSharingSize() / 1024);
Expand Down Expand Up @@ -142,6 +143,10 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config, Ap
serverConfig().setDisableLockToScreen(v);
onChange();
});
connect(m_pCheckBoxTouchActivateScreen, &QCheckBox::stateChanged, this, [this](const int &v) {
serverConfig().setTouchActivateScreen(v);
onChange();
});
connect(m_pCheckBoxCornerTopLeft, &QCheckBox::stateChanged, this, [this](const int &v) {
serverConfig().setSwitchCorner(static_cast<int>(TopLeft), v);
onChange();
Expand Down Expand Up @@ -192,6 +197,10 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config, Ap
serverConfig().setDisableLockToScreen(v == Qt::Checked);
onChange();
});
connect(m_pCheckBoxTouchActivateScreen, &QCheckBox::checkStateChanged, this, [this](const Qt::CheckState &v) {
serverConfig().setTouchActivateScreen(v == Qt::Checked);
onChange();
});
connect(m_pCheckBoxCornerTopLeft, &QCheckBox::checkStateChanged, this, [this](const Qt::CheckState &v) {
serverConfig().setSwitchCorner(static_cast<int>(TopLeft), v == Qt::Checked);
onChange();
Expand Down
11 changes: 11 additions & 0 deletions src/gui/src/ServerConfigDialogBase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,16 @@
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="m_pCheckBoxTouchActivateScreen">
<property name="text">
<string>Switch screens on touch</string>
</property>
<property name="toolTip">
<string>Touch any screen to switch to that computer</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="m_pCheckBoxWin32KeepForeground">
<property name="enabled">
Expand Down Expand Up @@ -1168,6 +1178,7 @@ Enabling this setting will disable the server config GUI.</string>
<tabstop>m_pCheckBoxWin32KeepForeground</tabstop>
<tabstop>m_pCheckBoxIgnoreAutoConfigClient</tabstop>
<tabstop>m_pCheckBoxDisableLockToScreen</tabstop>
<tabstop>m_pCheckBoxTouchActivateScreen</tabstop>
<tabstop>m_pCheckBoxCornerTopLeft</tabstop>
<tabstop>m_pCheckBoxCornerBottomLeft</tabstop>
<tabstop>m_pCheckBoxCornerTopRight</tabstop>
Expand Down
5 changes: 4 additions & 1 deletion src/lib/base/EventTypes.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2013-2016 Symless Ltd.
* Copyright (C) 2013-2026 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -115,6 +115,7 @@ REGISTER_EVENT(ClientListener, connected)

REGISTER_EVENT(ClientProxy, ready)
REGISTER_EVENT(ClientProxy, disconnected)
REGISTER_EVENT(ClientProxy, grabInput)

//
// ClientProxyUnknown
Expand Down Expand Up @@ -167,6 +168,7 @@ REGISTER_EVENT(IPrimaryScreen, hotKeyDown)
REGISTER_EVENT(IPrimaryScreen, hotKeyUp)
REGISTER_EVENT(IPrimaryScreen, fakeInputBegin)
REGISTER_EVENT(IPrimaryScreen, fakeInputEnd)
REGISTER_EVENT(IPrimaryScreen, touchActivatedPrimary)

//
// IScreen
Expand All @@ -176,6 +178,7 @@ REGISTER_EVENT(IScreen, error)
REGISTER_EVENT(IScreen, shapeChanged)
REGISTER_EVENT(IScreen, suspend)
REGISTER_EVENT(IScreen, resume)
REGISTER_EVENT(IScreen, grabInput)

//
// IpcServer
Expand Down
19 changes: 15 additions & 4 deletions src/lib/base/EventTypes.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2013-2016 Symless Ltd.
* Copyright (C) 2013-2026 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -388,7 +388,7 @@ class ClientListenerEvents : public EventTypes
class ClientProxyEvents : public EventTypes
{
public:
ClientProxyEvents() : m_ready(Event::kUnknown), m_disconnected(Event::kUnknown)
ClientProxyEvents() : m_ready(Event::kUnknown), m_disconnected(Event::kUnknown), m_grabInput(Event::kUnknown)
{
}

Expand All @@ -410,11 +410,14 @@ class ClientProxyEvents : public EventTypes
*/
Event::Type disconnected();

Event::Type grabInput();

//@}

private:
Event::Type m_ready;
Event::Type m_disconnected;
Event::Type m_grabInput;
};

class ClientProxyUnknownEvents : public EventTypes
Expand Down Expand Up @@ -603,7 +606,8 @@ class IPrimaryScreenEvents : public EventTypes
m_hotKeyDown(Event::kUnknown),
m_hotKeyUp(Event::kUnknown),
m_fakeInputBegin(Event::kUnknown),
m_fakeInputEnd(Event::kUnknown)
m_fakeInputEnd(Event::kUnknown),
m_touchActivatedPrimary(Event::kUnknown)
{
}

Expand Down Expand Up @@ -650,6 +654,8 @@ class IPrimaryScreenEvents : public EventTypes
//! end of fake input event type
Event::Type fakeInputEnd();

Event::Type touchActivatedPrimary();

//@}

private:
Expand All @@ -664,6 +670,7 @@ class IPrimaryScreenEvents : public EventTypes
Event::Type m_hotKeyUp;
Event::Type m_fakeInputBegin;
Event::Type m_fakeInputEnd;
Event::Type m_touchActivatedPrimary;
};

class IScreenEvents : public EventTypes
Expand All @@ -673,7 +680,8 @@ class IScreenEvents : public EventTypes
: m_error(Event::kUnknown),
m_shapeChanged(Event::kUnknown),
m_suspend(Event::kUnknown),
m_resume(Event::kUnknown)
m_resume(Event::kUnknown),
m_grabInput(Event::kUnknown)
{
}

Expand Down Expand Up @@ -708,13 +716,16 @@ class IScreenEvents : public EventTypes
*/
Event::Type resume();

Event::Type grabInput();

//@}

private:
Event::Type m_error;
Event::Type m_shapeChanged;
Event::Type m_suspend;
Event::Type m_resume;
Event::Type m_grabInput;
};

class ClipboardEvents : public EventTypes
Expand Down
29 changes: 28 additions & 1 deletion src/lib/client/Client.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012-2026 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
Expand Down Expand Up @@ -29,6 +29,7 @@
#include "deskflow/DropHelper.h"
#include "deskflow/FileChunk.h"
#include "deskflow/IPlatformScreen.h"
#include "deskflow/IPrimaryScreen.h"
#include "deskflow/PacketStreamFilter.h"
#include "deskflow/ProtocolUtil.h"
#include "deskflow/Screen.h"
Expand Down Expand Up @@ -87,6 +88,10 @@ Client::Client(
m_events->adoptHandler(
m_events->forIScreen().resume(), getEventTarget(), new TMethodEventJob<Client>(this, &Client::handleResume)
);
m_events->adoptHandler(
m_events->forIScreen().grabInput(), m_screen->getEventTarget(),
new TMethodEventJob<Client>(this, &Client::handleGrabInput)
);

if (m_args.m_enableDragDrop) {
m_events->adoptHandler(
Expand All @@ -107,6 +112,7 @@ Client::~Client()

m_events->removeHandler(m_events->forIScreen().suspend(), getEventTarget());
m_events->removeHandler(m_events->forIScreen().resume(), getEventTarget());
m_events->removeHandler(m_events->forIScreen().grabInput(), m_screen->getEventTarget());

cleanupTimer();
cleanupScreen();
Expand Down Expand Up @@ -240,6 +246,15 @@ void Client::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool)
m_screen->mouseMove(xAbs, yAbs);
m_screen->enter(mask);

if (m_pendingTouchActivation) {
m_pendingTouchActivation = false;
LOG((CLOG_DEBUG1 "touch: replaying click at %d,%d (cursor at %d,%d)",
m_touchActivateX, m_touchActivateY, xAbs, yAbs));
m_screen->activateWindowAt(m_touchActivateX, m_touchActivateY);
m_screen->mouseDown(kButtonLeft);
m_screen->mouseUp(kButtonLeft);
}

if (m_sendFileThread) {
StreamChunker::interruptFile();
m_sendFileThread.reset(nullptr);
Expand Down Expand Up @@ -737,6 +752,18 @@ void Client::handleResume(const Event &, void *)
}
}

void Client::handleGrabInput(const Event &event, void *)
{
IPrimaryScreen::MotionInfo *info = static_cast<IPrimaryScreen::MotionInfo *>(event.getData());
if (m_server != NULL) {
LOG((CLOG_DEBUG1 "requesting grab input at %d,%d", info->m_x, info->m_y));
m_pendingTouchActivation = true;
m_touchActivateX = info->m_x;
m_touchActivateY = info->m_y;
m_server->grabInput(info->m_x, info->m_y);
}
}

void Client::handleFileChunkSending(const Event &event, void *)
{
sendFileChunk(event.getDataObject());
Expand Down
6 changes: 5 additions & 1 deletion src/lib/client/Client.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012-2026 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
Expand Down Expand Up @@ -221,6 +221,7 @@ class Client : public IClient, public INode
void handleHello(const Event &, void *);
void handleSuspend(const Event &event, void *);
void handleResume(const Event &event, void *);
void handleGrabInput(const Event &event, void *);
void handleFileChunkSending(const Event &, void *);
void handleFileRecieveCompleted(const Event &, void *);
void handleStopRetry(const Event &, void *);
Expand Down Expand Up @@ -260,4 +261,7 @@ class Client : public IClient, public INode
size_t m_maximumClipboardSize;
deskflow::ClientArgs m_args;
size_t m_resolvedAddressesCount = 0;
bool m_pendingTouchActivation = false;
SInt32 m_touchActivateX = 0;
SInt32 m_touchActivateY = 0;
};
8 changes: 7 additions & 1 deletion src/lib/client/ServerProxy.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012-2026 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
Expand Down Expand Up @@ -372,6 +372,12 @@ bool ServerProxy::onGrabClipboard(ClipboardID id)
return true;
}

void ServerProxy::grabInput(SInt32 x, SInt32 y)
{
LOG((CLOG_DEBUG1 "requesting grab input at %d,%d", x, y));
ProtocolUtil::writef(m_stream, kMsgCGrabInput, x, y);
}

void ServerProxy::onClipboardChanged(ClipboardID id, const IClipboard *clipboard)
{
String data = IClipboard::marshall(clipboard);
Expand Down
4 changes: 3 additions & 1 deletion src/lib/client/ServerProxy.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012-2026 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
Expand Down Expand Up @@ -61,6 +61,8 @@ class ServerProxy
bool onGrabClipboard(ClipboardID);
void onClipboardChanged(ClipboardID, const IClipboard *);

void grabInput(SInt32 x, SInt32 y);

//@}

// sending file chunk to server
Expand Down
4 changes: 3 additions & 1 deletion src/lib/deskflow/IPlatformScreen.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012-2026 Symless Ltd.
* Copyright (C) 2002 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
Expand Down Expand Up @@ -200,6 +200,8 @@ class IPlatformScreen : public IScreen, public IPrimaryScreen, public ISecondary
virtual void pollPressedKeys(KeyButtonSet &pressedKeys) const = 0;
virtual void clearStaleModifiers() = 0;

virtual void activateWindowAt(SInt32 x, SInt32 y) { /* do nothing */ }

// Drag-and-drop overrides
virtual String &getDraggingFilename() = 0;
virtual void clearDraggingFilename() = 0;
Expand Down
Loading
Loading