Added toggleScreen function, using hot key to loop in all screens.
Comparing to switchToScreen, it is more handy since the user only need to hit one hotkey.
This commit is contained in:
parent
dbd10820c3
commit
018857c190
|
@ -32,3 +32,6 @@ CMakeCache.txt
|
||||||
# Transient in-project-directory dependencies
|
# Transient in-project-directory dependencies
|
||||||
/deps/
|
/deps/
|
||||||
/out/build/x64-Debug
|
/out/build/x64-Debug
|
||||||
|
.clangd/
|
||||||
|
tags
|
||||||
|
compile_commands.json
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* barrier -- mouse and keyboard sharing utility
|
* barrier -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2012-2016 Symless Ltd.
|
* Copyright (C) 2012-2016 Symless Ltd.
|
||||||
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -24,7 +24,8 @@
|
||||||
const char* Action::m_ActionTypeNames[] =
|
const char* Action::m_ActionTypeNames[] =
|
||||||
{
|
{
|
||||||
"keyDown", "keyUp", "keystroke",
|
"keyDown", "keyUp", "keystroke",
|
||||||
"switchToScreen", "switchInDirection", "lockCursorToScreen",
|
"switchToScreen", "toggleScreen",
|
||||||
|
"switchInDirection", "lockCursorToScreen",
|
||||||
"mouseDown", "mouseUp", "mousebutton"
|
"mouseDown", "mouseUp", "mousebutton"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,7 +46,8 @@ Action::Action() :
|
||||||
|
|
||||||
QString Action::text() const
|
QString Action::text() const
|
||||||
{
|
{
|
||||||
QString text = QString(m_ActionTypeNames[keySequence().isMouseButton() ? type() + 6 : type() ]) + "(";
|
/* The server config parser don't support () with no argument inside, but support no () */
|
||||||
|
QString text = QString(m_ActionTypeNames[keySequence().isMouseButton() ? type() + 6 : type() ]);
|
||||||
|
|
||||||
switch (type())
|
switch (type())
|
||||||
{
|
{
|
||||||
|
@ -53,6 +55,7 @@ QString Action::text() const
|
||||||
case keyUp:
|
case keyUp:
|
||||||
case keystroke:
|
case keystroke:
|
||||||
{
|
{
|
||||||
|
text += "(";
|
||||||
text += keySequence().toString();
|
text += keySequence().toString();
|
||||||
|
|
||||||
if (!keySequence().isMouseButton())
|
if (!keySequence().isMouseButton())
|
||||||
|
@ -72,19 +75,29 @@ QString Action::text() const
|
||||||
else
|
else
|
||||||
text += ",*";
|
text += ",*";
|
||||||
}
|
}
|
||||||
|
text += ")";
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case switchToScreen:
|
case switchToScreen:
|
||||||
|
text += "(";
|
||||||
text += switchScreenName();
|
text += switchScreenName();
|
||||||
|
text += ")";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case toggleScreen:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case switchInDirection:
|
case switchInDirection:
|
||||||
|
text += "(";
|
||||||
text += m_SwitchDirectionNames[m_SwitchDirection];
|
text += m_SwitchDirectionNames[m_SwitchDirection];
|
||||||
|
text += ")";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lockCursorToScreen:
|
case lockCursorToScreen:
|
||||||
|
text += "(";
|
||||||
text += m_LockCursorModeNames[m_LockCursorMode];
|
text += m_LockCursorModeNames[m_LockCursorMode];
|
||||||
|
text += ")";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -92,7 +105,6 @@ QString Action::text() const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
text += ")";
|
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* barrier -- mouse and keyboard sharing utility
|
* barrier -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2012-2016 Symless Ltd.
|
* Copyright (C) 2012-2016 Symless Ltd.
|
||||||
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -36,7 +36,7 @@ class Action
|
||||||
friend QTextStream& operator<<(QTextStream& outStream, const Action& action);
|
friend QTextStream& operator<<(QTextStream& outStream, const Action& action);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum ActionType { keyDown, keyUp, keystroke, switchToScreen, switchInDirection, lockCursorToScreen, mouseDown, mouseUp, mousebutton };
|
enum ActionType { keyDown, keyUp, keystroke, switchToScreen, toggleScreen, switchInDirection, lockCursorToScreen, mouseDown, mouseUp, mousebutton };
|
||||||
enum SwitchDirection { switchLeft, switchRight, switchUp, switchDown };
|
enum SwitchDirection { switchLeft, switchRight, switchUp, switchDown };
|
||||||
enum LockCursorMode { lockCursorToggle, lockCursonOn, lockCursorOff };
|
enum LockCursorMode { lockCursorToggle, lockCursonOn, lockCursorOff };
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* barrier -- mouse and keyboard sharing utility
|
* barrier -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2012-2016 Symless Ltd.
|
* Copyright (C) 2012-2016 Symless Ltd.
|
||||||
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
* Copyright (C) 2008 Volker Lanz (vl@fidra.de)
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -39,7 +39,7 @@ ActionDialog::ActionDialog(QWidget* parent, ServerConfig& config, Hotkey& hotkey
|
||||||
|
|
||||||
// work around Qt Designer's lack of a QButtonGroup; we need it to get
|
// work around Qt Designer's lack of a QButtonGroup; we need it to get
|
||||||
// at the button id of the checked radio button
|
// at the button id of the checked radio button
|
||||||
QRadioButton* const typeButtons[] = { m_pRadioPress, m_pRadioRelease, m_pRadioPressAndRelease, m_pRadioSwitchToScreen, m_pRadioSwitchInDirection, m_pRadioLockCursorToScreen };
|
QRadioButton* const typeButtons[] = { m_pRadioPress, m_pRadioRelease, m_pRadioPressAndRelease, m_pRadioSwitchToScreen, m_pRadioToggleScreen, m_pRadioSwitchInDirection, m_pRadioLockCursorToScreen };
|
||||||
|
|
||||||
for (unsigned int i = 0; i < sizeof(typeButtons) / sizeof(typeButtons[0]); i++)
|
for (unsigned int i = 0; i < sizeof(typeButtons) / sizeof(typeButtons[0]); i++)
|
||||||
m_pButtonGroupType->addButton(typeButtons[i], i);
|
m_pButtonGroupType->addButton(typeButtons[i], i);
|
||||||
|
|
|
@ -142,6 +142,17 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="m_pRadioToggleScreen">
|
||||||
|
<property name="text">
|
||||||
|
<string>Toggle screen</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* barrier -- mouse and keyboard sharing utility
|
* barrier -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2013-2016 Symless Ltd.
|
* Copyright (C) 2013-2016 Symless Ltd.
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -133,6 +133,7 @@ REGISTER_EVENT(Server, error)
|
||||||
REGISTER_EVENT(Server, connected)
|
REGISTER_EVENT(Server, connected)
|
||||||
REGISTER_EVENT(Server, disconnected)
|
REGISTER_EVENT(Server, disconnected)
|
||||||
REGISTER_EVENT(Server, switchToScreen)
|
REGISTER_EVENT(Server, switchToScreen)
|
||||||
|
REGISTER_EVENT(Server, toggleScreen)
|
||||||
REGISTER_EVENT(Server, switchInDirection)
|
REGISTER_EVENT(Server, switchInDirection)
|
||||||
REGISTER_EVENT(Server, keyboardBroadcast)
|
REGISTER_EVENT(Server, keyboardBroadcast)
|
||||||
REGISTER_EVENT(Server, lockCursorToScreen)
|
REGISTER_EVENT(Server, lockCursorToScreen)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*
|
/*
|
||||||
* barrier -- mouse and keyboard sharing utility
|
* barrier -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2013-2016 Symless Ltd.
|
* Copyright (C) 2013-2016 Symless Ltd.
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -134,7 +134,7 @@ public:
|
||||||
Event::Type outputShutdown();
|
Event::Type outputShutdown();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event::Type m_inputReady;
|
Event::Type m_inputReady;
|
||||||
Event::Type m_outputFlushed;
|
Event::Type m_outputFlushed;
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
Event::Type messageReceived();
|
Event::Type messageReceived();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event::Type m_connected;
|
Event::Type m_connected;
|
||||||
Event::Type m_messageReceived;
|
Event::Type m_messageReceived;
|
||||||
|
@ -179,7 +179,7 @@ public:
|
||||||
|
|
||||||
//! Raised when the client disconnects from the server.
|
//! Raised when the client disconnects from the server.
|
||||||
Event::Type disconnected();
|
Event::Type disconnected();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -198,7 +198,7 @@ public:
|
||||||
|
|
||||||
//! Raised when we have created the client proxy.
|
//! Raised when we have created the client proxy.
|
||||||
Event::Type clientConnected();
|
Event::Type clientConnected();
|
||||||
|
|
||||||
//! Raised when a message is received through a client proxy.
|
//! Raised when a message is received through a client proxy.
|
||||||
Event::Type messageReceived();
|
Event::Type messageReceived();
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ public:
|
||||||
event when a remote connection has been established.
|
event when a remote connection has been established.
|
||||||
*/
|
*/
|
||||||
Event::Type connected();
|
Event::Type connected();
|
||||||
|
|
||||||
//! Get secure connected event type
|
//! Get secure connected event type
|
||||||
/*!
|
/*!
|
||||||
Returns the secure socket connected event type. A secure socket sends
|
Returns the secure socket connected event type. A secure socket sends
|
||||||
|
@ -342,14 +342,14 @@ public:
|
||||||
|
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
//! Get accepted event type
|
//! Get accepted event type
|
||||||
/*!
|
/*!
|
||||||
Returns the accepted event type. This is sent whenever a server
|
Returns the accepted event type. This is sent whenever a server
|
||||||
accepts a client.
|
accepts a client.
|
||||||
*/
|
*/
|
||||||
Event::Type accepted();
|
Event::Type accepted();
|
||||||
|
|
||||||
//! Get connected event type
|
//! Get connected event type
|
||||||
/*!
|
/*!
|
||||||
Returns the connected event type. This is sent whenever a
|
Returns the connected event type. This is sent whenever a
|
||||||
|
@ -419,7 +419,7 @@ public:
|
||||||
Event::Type failure();
|
Event::Type failure();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event::Type m_success;
|
Event::Type m_success;
|
||||||
Event::Type m_failure;
|
Event::Type m_failure;
|
||||||
|
@ -432,6 +432,7 @@ public:
|
||||||
m_connected(Event::kUnknown),
|
m_connected(Event::kUnknown),
|
||||||
m_disconnected(Event::kUnknown),
|
m_disconnected(Event::kUnknown),
|
||||||
m_switchToScreen(Event::kUnknown),
|
m_switchToScreen(Event::kUnknown),
|
||||||
|
m_toggleScreen(Event::kUnknown),
|
||||||
m_switchInDirection(Event::kUnknown),
|
m_switchInDirection(Event::kUnknown),
|
||||||
m_keyboardBroadcast(Event::kUnknown),
|
m_keyboardBroadcast(Event::kUnknown),
|
||||||
m_lockCursorToScreen(Event::kUnknown),
|
m_lockCursorToScreen(Event::kUnknown),
|
||||||
|
@ -470,6 +471,13 @@ public:
|
||||||
*/
|
*/
|
||||||
Event::Type switchToScreen();
|
Event::Type switchToScreen();
|
||||||
|
|
||||||
|
//! Get toggle screen event type
|
||||||
|
/*!
|
||||||
|
Returns the toggle screen event type. The server responds to this
|
||||||
|
by toggling screens. There is no event data.
|
||||||
|
*/
|
||||||
|
Event::Type toggleScreen();
|
||||||
|
|
||||||
//! Get switch in direction event type
|
//! Get switch in direction event type
|
||||||
/*!
|
/*!
|
||||||
Returns the switch in direction event type. The server responds to this
|
Returns the switch in direction event type. The server responds to this
|
||||||
|
@ -502,12 +510,13 @@ public:
|
||||||
Event::Type screenSwitched();
|
Event::Type screenSwitched();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event::Type m_error;
|
Event::Type m_error;
|
||||||
Event::Type m_connected;
|
Event::Type m_connected;
|
||||||
Event::Type m_disconnected;
|
Event::Type m_disconnected;
|
||||||
Event::Type m_switchToScreen;
|
Event::Type m_switchToScreen;
|
||||||
|
Event::Type m_toggleScreen;
|
||||||
Event::Type m_switchInDirection;
|
Event::Type m_switchInDirection;
|
||||||
Event::Type m_keyboardBroadcast;
|
Event::Type m_keyboardBroadcast;
|
||||||
Event::Type m_lockCursorToScreen;
|
Event::Type m_lockCursorToScreen;
|
||||||
|
@ -520,16 +529,16 @@ public:
|
||||||
m_reloadConfig(Event::kUnknown),
|
m_reloadConfig(Event::kUnknown),
|
||||||
m_forceReconnect(Event::kUnknown),
|
m_forceReconnect(Event::kUnknown),
|
||||||
m_resetServer(Event::kUnknown) { }
|
m_resetServer(Event::kUnknown) { }
|
||||||
|
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
Event::Type reloadConfig();
|
Event::Type reloadConfig();
|
||||||
Event::Type forceReconnect();
|
Event::Type forceReconnect();
|
||||||
Event::Type resetServer();
|
Event::Type resetServer();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event::Type m_reloadConfig;
|
Event::Type m_reloadConfig;
|
||||||
Event::Type m_forceReconnect;
|
Event::Type m_forceReconnect;
|
||||||
|
@ -556,7 +565,7 @@ public:
|
||||||
Event::Type keyRepeat();
|
Event::Type keyRepeat();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event::Type m_keyDown;
|
Event::Type m_keyDown;
|
||||||
Event::Type m_keyUp;
|
Event::Type m_keyUp;
|
||||||
|
@ -580,7 +589,7 @@ public:
|
||||||
|
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
//! button down event type. Event data is ButtonInfo*.
|
//! button down event type. Event data is ButtonInfo*.
|
||||||
Event::Type buttonDown();
|
Event::Type buttonDown();
|
||||||
|
|
||||||
|
@ -668,7 +677,7 @@ public:
|
||||||
to sleep or a user session is deactivated (fast user switching).
|
to sleep or a user session is deactivated (fast user switching).
|
||||||
*/
|
*/
|
||||||
Event::Type suspend();
|
Event::Type suspend();
|
||||||
|
|
||||||
//! Get resume event type
|
//! Get resume event type
|
||||||
/*!
|
/*!
|
||||||
Returns the resume event type. This is sent whenever the system wakes
|
Returns the resume event type. This is sent whenever the system wakes
|
||||||
|
@ -677,7 +686,7 @@ public:
|
||||||
Event::Type resume();
|
Event::Type resume();
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event::Type m_error;
|
Event::Type m_error;
|
||||||
Event::Type m_shapeChanged;
|
Event::Type m_shapeChanged;
|
||||||
|
@ -713,7 +722,7 @@ public:
|
||||||
|
|
||||||
//! Clipboard sending event type
|
//! Clipboard sending event type
|
||||||
/*!
|
/*!
|
||||||
Returns the clipboard sending event type. This is used to send
|
Returns the clipboard sending event type. This is used to send
|
||||||
clipboard chunks.
|
clipboard chunks.
|
||||||
*/
|
*/
|
||||||
Event::Type clipboardSending();
|
Event::Type clipboardSending();
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* barrier -- mouse and keyboard sharing utility
|
* barrier -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2012-2016 Symless Ltd.
|
* Copyright (C) 2012-2016 Symless Ltd.
|
||||||
* Copyright (C) 2002 Chris Schoeneman
|
* Copyright (C) 2002 Chris Schoeneman
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -1182,6 +1182,10 @@ Config::parseAction(ConfigReadContext& s,
|
||||||
action = new InputFilter::SwitchToScreenAction(m_events, screen);
|
action = new InputFilter::SwitchToScreenAction(m_events, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (name == "toggleScreen") {
|
||||||
|
action = new InputFilter::ToggleScreenAction(m_events);
|
||||||
|
}
|
||||||
|
|
||||||
else if (name == "switchInDirection") {
|
else if (name == "switchInDirection") {
|
||||||
if (args.size() != 1) {
|
if (args.size() != 1) {
|
||||||
throw XConfigRead(s, "syntax for action: switchInDirection(<left|right|up|down>)");
|
throw XConfigRead(s, "syntax for action: switchInDirection(<left|right|up|down>)");
|
||||||
|
@ -1808,7 +1812,7 @@ operator<<(std::ostream& s, const Config& config)
|
||||||
|
|
||||||
for (Config::link_const_iterator
|
for (Config::link_const_iterator
|
||||||
link = config.beginNeighbor(*screen),
|
link = config.beginNeighbor(*screen),
|
||||||
nend = config.endNeighbor(*screen); link != nend; ++link) {
|
nend = config.endNeighbor(*screen); link != nend; ++link) {
|
||||||
s << "\t\t" << Config::dirName(link->first.getSide()) <<
|
s << "\t\t" << Config::dirName(link->first.getSide()) <<
|
||||||
Config::formatInterval(link->first.getInterval()) <<
|
Config::formatInterval(link->first.getInterval()) <<
|
||||||
" = " << link->second.getName().c_str() <<
|
" = " << link->second.getName().c_str() <<
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* barrier -- mouse and keyboard sharing utility
|
* barrier -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2012-2016 Symless Ltd.
|
* Copyright (C) 2012-2016 Symless Ltd.
|
||||||
* Copyright (C) 2005 Chris Schoeneman
|
* Copyright (C) 2005 Chris Schoeneman
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -193,7 +193,7 @@ InputFilter::MouseButtonCondition::format() const
|
||||||
return barrier::string::sprintf("mousebutton(%s%d)", key.c_str(), m_button);
|
return barrier::string::sprintf("mousebutton(%s%d)", key.c_str(), m_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
InputFilter::EFilterStatus
|
InputFilter::EFilterStatus
|
||||||
InputFilter::MouseButtonCondition::match(const Event& event)
|
InputFilter::MouseButtonCondition::match(const Event& event)
|
||||||
{
|
{
|
||||||
static const KeyModifierMask s_ignoreMask =
|
static const KeyModifierMask s_ignoreMask =
|
||||||
|
@ -255,7 +255,7 @@ InputFilter::EFilterStatus
|
||||||
InputFilter::ScreenConnectedCondition::match(const Event& event)
|
InputFilter::ScreenConnectedCondition::match(const Event& event)
|
||||||
{
|
{
|
||||||
if (event.getType() == m_events->forServer().connected()) {
|
if (event.getType() == m_events->forServer().connected()) {
|
||||||
Server::ScreenConnectedInfo* info =
|
Server::ScreenConnectedInfo* info =
|
||||||
static_cast<Server::ScreenConnectedInfo*>(event.getData());
|
static_cast<Server::ScreenConnectedInfo*>(event.getData());
|
||||||
if (m_screen == info->m_screen || m_screen.empty()) {
|
if (m_screen == info->m_screen || m_screen.empty()) {
|
||||||
return kActivate;
|
return kActivate;
|
||||||
|
@ -316,7 +316,7 @@ InputFilter::LockCursorToScreenAction::perform(const Event& event)
|
||||||
};
|
};
|
||||||
|
|
||||||
// send event
|
// send event
|
||||||
Server::LockCursorToScreenInfo* info =
|
Server::LockCursorToScreenInfo* info =
|
||||||
Server::LockCursorToScreenInfo::alloc(s_state[m_mode]);
|
Server::LockCursorToScreenInfo::alloc(s_state[m_mode]);
|
||||||
m_events->addEvent(Event(m_events->forServer().lockCursorToScreen(),
|
m_events->addEvent(Event(m_events->forServer().lockCursorToScreen(),
|
||||||
event.getTarget(), info,
|
event.getTarget(), info,
|
||||||
|
@ -356,7 +356,7 @@ InputFilter::SwitchToScreenAction::perform(const Event& event)
|
||||||
// event if it has one.
|
// event if it has one.
|
||||||
String screen = m_screen;
|
String screen = m_screen;
|
||||||
if (screen.empty() && event.getType() == m_events->forServer().connected()) {
|
if (screen.empty() && event.getType() == m_events->forServer().connected()) {
|
||||||
Server::ScreenConnectedInfo* info =
|
Server::ScreenConnectedInfo* info =
|
||||||
static_cast<Server::ScreenConnectedInfo*>(event.getData());
|
static_cast<Server::ScreenConnectedInfo*>(event.getData());
|
||||||
screen = info->m_screen;
|
screen = info->m_screen;
|
||||||
}
|
}
|
||||||
|
@ -369,6 +369,32 @@ InputFilter::SwitchToScreenAction::perform(const Event& event)
|
||||||
Event::kDeliverImmediately));
|
Event::kDeliverImmediately));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
InputFilter::ToggleScreenAction::ToggleScreenAction(IEventQueue* events) :
|
||||||
|
m_events(events)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
InputFilter::Action*
|
||||||
|
InputFilter::ToggleScreenAction::clone() const
|
||||||
|
{
|
||||||
|
return new ToggleScreenAction(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
String
|
||||||
|
InputFilter::ToggleScreenAction::format() const
|
||||||
|
{
|
||||||
|
return barrier::string::sprintf("toggleScreen");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
InputFilter::ToggleScreenAction::perform(const Event& event)
|
||||||
|
{
|
||||||
|
m_events->addEvent(Event(m_events->forServer().toggleScreen(),
|
||||||
|
event.getTarget(), nullptr,
|
||||||
|
Event::kDeliverImmediately));
|
||||||
|
}
|
||||||
|
|
||||||
InputFilter::SwitchInDirectionAction::SwitchInDirectionAction(
|
InputFilter::SwitchInDirectionAction::SwitchInDirectionAction(
|
||||||
IEventQueue* events, EDirection direction) :
|
IEventQueue* events, EDirection direction) :
|
||||||
m_direction(direction),
|
m_direction(direction),
|
||||||
|
@ -478,7 +504,7 @@ InputFilter::KeyboardBroadcastAction::perform(const Event& event)
|
||||||
};
|
};
|
||||||
|
|
||||||
// send event
|
// send event
|
||||||
Server::KeyboardBroadcastInfo* info =
|
Server::KeyboardBroadcastInfo* info =
|
||||||
Server::KeyboardBroadcastInfo::alloc(s_state[m_mode], m_screens);
|
Server::KeyboardBroadcastInfo::alloc(s_state[m_mode], m_screens);
|
||||||
m_events->addEvent(Event(m_events->forServer().keyboardBroadcast(),
|
m_events->addEvent(Event(m_events->forServer().keyboardBroadcast(),
|
||||||
event.getTarget(), info,
|
event.getTarget(), info,
|
||||||
|
@ -555,7 +581,7 @@ InputFilter::KeystrokeAction::perform(const Event& event)
|
||||||
Event::Type type = m_press ?
|
Event::Type type = m_press ?
|
||||||
m_events->forIKeyState().keyDown() :
|
m_events->forIKeyState().keyDown() :
|
||||||
m_events->forIKeyState().keyUp();
|
m_events->forIKeyState().keyUp();
|
||||||
|
|
||||||
m_events->addEvent(Event(m_events->forIPrimaryScreen().fakeInputBegin(),
|
m_events->addEvent(Event(m_events->forIPrimaryScreen().fakeInputBegin(),
|
||||||
event.getTarget(), NULL,
|
event.getTarget(), NULL,
|
||||||
Event::kDeliverImmediately));
|
Event::kDeliverImmediately));
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* barrier -- mouse and keyboard sharing utility
|
* barrier -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2012-2016 Symless Ltd.
|
* Copyright (C) 2012-2016 Symless Ltd.
|
||||||
* Copyright (C) 2005 Chris Schoeneman
|
* Copyright (C) 2005 Chris Schoeneman
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
virtual void enablePrimary(PrimaryClient*);
|
virtual void enablePrimary(PrimaryClient*);
|
||||||
virtual void disablePrimary(PrimaryClient*);
|
virtual void disablePrimary(PrimaryClient*);
|
||||||
};
|
};
|
||||||
|
|
||||||
// KeystrokeCondition
|
// KeystrokeCondition
|
||||||
class KeystrokeCondition : public Condition {
|
class KeystrokeCondition : public Condition {
|
||||||
public:
|
public:
|
||||||
|
@ -119,7 +119,7 @@ public:
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
// Input Filter Action Classes
|
// Input Filter Action Classes
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
class Action {
|
class Action {
|
||||||
public:
|
public:
|
||||||
Action();
|
Action();
|
||||||
|
@ -130,7 +130,7 @@ public:
|
||||||
|
|
||||||
virtual void perform(const Event&) = 0;
|
virtual void perform(const Event&) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// LockCursorToScreenAction
|
// LockCursorToScreenAction
|
||||||
class LockCursorToScreenAction : public Action {
|
class LockCursorToScreenAction : public Action {
|
||||||
public:
|
public:
|
||||||
|
@ -149,7 +149,7 @@ public:
|
||||||
Mode m_mode;
|
Mode m_mode;
|
||||||
IEventQueue* m_events;
|
IEventQueue* m_events;
|
||||||
};
|
};
|
||||||
|
|
||||||
// SwitchToScreenAction
|
// SwitchToScreenAction
|
||||||
class SwitchToScreenAction : public Action {
|
class SwitchToScreenAction : public Action {
|
||||||
public:
|
public:
|
||||||
|
@ -166,7 +166,22 @@ public:
|
||||||
String m_screen;
|
String m_screen;
|
||||||
IEventQueue* m_events;
|
IEventQueue* m_events;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ToggleScreenAction
|
||||||
|
class ToggleScreenAction : public Action {
|
||||||
|
public:
|
||||||
|
ToggleScreenAction(IEventQueue* events);
|
||||||
|
|
||||||
|
// Action overrides
|
||||||
|
virtual Action* clone() const;
|
||||||
|
virtual String format() const;
|
||||||
|
virtual void perform(const Event&);
|
||||||
|
|
||||||
|
private:
|
||||||
|
IEventQueue* m_events;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// SwitchInDirectionAction
|
// SwitchInDirectionAction
|
||||||
class SwitchInDirectionAction : public Action {
|
class SwitchInDirectionAction : public Action {
|
||||||
public:
|
public:
|
||||||
|
@ -183,7 +198,7 @@ public:
|
||||||
EDirection m_direction;
|
EDirection m_direction;
|
||||||
IEventQueue* m_events;
|
IEventQueue* m_events;
|
||||||
};
|
};
|
||||||
|
|
||||||
// KeyboardBroadcastAction
|
// KeyboardBroadcastAction
|
||||||
class KeyboardBroadcastAction : public Action {
|
class KeyboardBroadcastAction : public Action {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -163,6 +163,10 @@ Server::Server(
|
||||||
m_inputFilter,
|
m_inputFilter,
|
||||||
new TMethodEventJob<Server>(this,
|
new TMethodEventJob<Server>(this,
|
||||||
&Server::handleSwitchToScreenEvent));
|
&Server::handleSwitchToScreenEvent));
|
||||||
|
m_events->adoptHandler(m_events->forServer().toggleScreen(),
|
||||||
|
m_inputFilter,
|
||||||
|
new TMethodEventJob<Server>(this,
|
||||||
|
&Server::handleToggleScreenEvent));
|
||||||
m_events->adoptHandler(m_events->forServer().switchInDirection(),
|
m_events->adoptHandler(m_events->forServer().switchInDirection(),
|
||||||
m_inputFilter,
|
m_inputFilter,
|
||||||
new TMethodEventJob<Server>(this,
|
new TMethodEventJob<Server>(this,
|
||||||
|
@ -1407,6 +1411,22 @@ Server::handleSwitchToScreenEvent(const Event& event, void*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Server::handleToggleScreenEvent(const Event& event, void*)
|
||||||
|
{
|
||||||
|
std::string current = getName(m_active);
|
||||||
|
ClientList::const_iterator index = m_clients.find(current);
|
||||||
|
if (index == m_clients.end()) {
|
||||||
|
LOG((CLOG_DEBUG1 "screen \"%s\" not active", current.c_str()));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
++index;
|
||||||
|
if (index == m_clients.end()) index = m_clients.begin();
|
||||||
|
jumpToScreen(index->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Server::handleSwitchInDirectionEvent(const Event& event, void*)
|
Server::handleSwitchInDirectionEvent(const Event& event, void*)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
* barrier -- mouse and keyboard sharing utility
|
* barrier -- mouse and keyboard sharing utility
|
||||||
* Copyright (C) 2012-2016 Symless Ltd.
|
* Copyright (C) 2012-2016 Symless Ltd.
|
||||||
* Copyright (C) 2002 Chris Schoeneman
|
* Copyright (C) 2002 Chris Schoeneman
|
||||||
*
|
*
|
||||||
* This package is free software; you can redistribute it and/or
|
* This package is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* found in the file LICENSE that should have accompanied this file.
|
* found in the file LICENSE that should have accompanied this file.
|
||||||
*
|
*
|
||||||
* This package is distributed in the hope that it will be useful,
|
* This package is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
@ -150,7 +150,7 @@ public:
|
||||||
|
|
||||||
//! Store ClientListener pointer
|
//! Store ClientListener pointer
|
||||||
void setListener(ClientListener* p) { m_clientListener = p; }
|
void setListener(ClientListener* p) { m_clientListener = p; }
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
@ -166,7 +166,7 @@ public:
|
||||||
Set the \c list to the names of the currently connected clients.
|
Set the \c list to the names of the currently connected clients.
|
||||||
*/
|
*/
|
||||||
void getClients(std::vector<String>& list) const;
|
void getClients(std::vector<String>& list) const;
|
||||||
|
|
||||||
//! Return true if recieved file size is valid
|
//! Return true if recieved file size is valid
|
||||||
bool isReceivedFileSizeValid();
|
bool isReceivedFileSizeValid();
|
||||||
|
|
||||||
|
@ -308,6 +308,7 @@ private:
|
||||||
void handleClientDisconnected(const Event&, void*);
|
void handleClientDisconnected(const Event&, void*);
|
||||||
void handleClientCloseTimeout(const Event&, void*);
|
void handleClientCloseTimeout(const Event&, void*);
|
||||||
void handleSwitchToScreenEvent(const Event&, void*);
|
void handleSwitchToScreenEvent(const Event&, void*);
|
||||||
|
void handleToggleScreenEvent(const Event&, void*);
|
||||||
void handleSwitchInDirectionEvent(const Event&, void*);
|
void handleSwitchInDirectionEvent(const Event&, void*);
|
||||||
void handleKeyboardBroadcastEvent(const Event&,void*);
|
void handleKeyboardBroadcastEvent(const Event&,void*);
|
||||||
void handleLockCursorToScreenEvent(const Event&, void*);
|
void handleLockCursorToScreenEvent(const Event&, void*);
|
||||||
|
@ -355,10 +356,10 @@ private:
|
||||||
|
|
||||||
// force the cursor off of \p client
|
// force the cursor off of \p client
|
||||||
void forceLeaveClient(BaseClientProxy* client);
|
void forceLeaveClient(BaseClientProxy* client);
|
||||||
|
|
||||||
// thread funciton for sending file
|
// thread funciton for sending file
|
||||||
void sendFileThread(void*);
|
void sendFileThread(void*);
|
||||||
|
|
||||||
// thread function for writing file to drop directory
|
// thread function for writing file to drop directory
|
||||||
void writeToDropDirThread(void*);
|
void writeToDropDirThread(void*);
|
||||||
|
|
||||||
|
@ -447,7 +448,7 @@ private:
|
||||||
bool m_switchNeedsShift;
|
bool m_switchNeedsShift;
|
||||||
bool m_switchNeedsControl;
|
bool m_switchNeedsControl;
|
||||||
bool m_switchNeedsAlt;
|
bool m_switchNeedsAlt;
|
||||||
|
|
||||||
// relative mouse move option
|
// relative mouse move option
|
||||||
bool m_relativeMoves;
|
bool m_relativeMoves;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue