keyboard & mouse forwarding
This commit is contained in:
committed by
Patrick Nicolas
parent
efde4bf247
commit
2063cae3ae
@@ -230,6 +230,16 @@ Kirigami.ScrollablePage {
|
||||
id: show_system_checks
|
||||
text: i18n("Check system configuration on start")
|
||||
}
|
||||
RowLayout {
|
||||
visible: config.hid_forwarding_supported
|
||||
Controls.CheckBox {
|
||||
id: hid_forwarding
|
||||
text: i18n("Forward keyboard & mouse from headset")
|
||||
}
|
||||
Kirigami.ContextualHelpButton {
|
||||
toolTipText: i18n("Keyboard and mouse connected to the client will act as if connected to the server. Client OS may reserve specific keys and combinations, which cannot be forwarded.")
|
||||
}
|
||||
}
|
||||
Controls.CheckBox {
|
||||
id: debug_gui
|
||||
text: i18n("Enable debug window")
|
||||
@@ -389,6 +399,7 @@ Kirigami.ScrollablePage {
|
||||
|
||||
config.debugGui = debug_gui.checked;
|
||||
config.steamVrLh = steamvr_lh.checked;
|
||||
config.hidForwarding = hid_forwarding.checked;
|
||||
}
|
||||
|
||||
function load() {
|
||||
@@ -400,6 +411,7 @@ Kirigami.ScrollablePage {
|
||||
|
||||
debug_gui.checked = config.debugGui;
|
||||
steamvr_lh.checked = config.steamVrLh;
|
||||
hid_forwarding.checked = config.hidForwarding;
|
||||
|
||||
openvr_combobox.load()
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <cassert>
|
||||
#include <fcntl.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <qqmlintegration.h>
|
||||
|
||||
@@ -120,6 +121,7 @@ void Settings::emitAllChanged()
|
||||
openvrChanged();
|
||||
debugGuiChanged();
|
||||
steamVrLhChanged();
|
||||
hidForwardingChanged();
|
||||
}
|
||||
|
||||
void Settings::load(const wivrn_server * server)
|
||||
@@ -384,6 +386,22 @@ void Settings::set_application(const QString & value)
|
||||
applicationChanged();
|
||||
}
|
||||
|
||||
bool Settings::hidForwarding() const
|
||||
{
|
||||
auto it = m_jsonSettings.find("hid-forwarding");
|
||||
if (it != m_jsonSettings.end() and it->is_boolean())
|
||||
return *it;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Settings::set_hidForwarding(const bool & value)
|
||||
{
|
||||
auto old = hidForwarding();
|
||||
m_jsonSettings["hid-forwarding"] = value;
|
||||
if (old != value)
|
||||
hidForwardingChanged();
|
||||
}
|
||||
|
||||
bool Settings::debugGui() const
|
||||
{
|
||||
// Advanced options (debug window, steamvr_lh)
|
||||
@@ -504,6 +522,7 @@ void Settings::restore_defaults()
|
||||
m_jsonSettings.erase("scale");
|
||||
m_jsonSettings.erase("bitrate");
|
||||
m_jsonSettings.erase("application");
|
||||
m_jsonSettings.erase("hid-forwarding");
|
||||
m_jsonSettings.erase("debug-gui");
|
||||
m_jsonSettings.erase("use-steamvr-lh");
|
||||
m_jsonSettings.erase("tcp-only");
|
||||
@@ -532,5 +551,26 @@ bool Settings::steamvr_lh() const
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
bool Settings::hid_forwarding() const
|
||||
{
|
||||
// only called from the UI thread → no locking needed
|
||||
static std::optional<bool> can_open_uinput;
|
||||
if (can_open_uinput.has_value())
|
||||
return can_open_uinput.value();
|
||||
|
||||
can_open_uinput = false;
|
||||
constexpr std::array paths = {"/dev/uinput", "/dev/input/uinput"};
|
||||
for (const char * p: paths)
|
||||
{
|
||||
int fd = ::open(p, O_WRONLY | O_NONBLOCK);
|
||||
if (fd >= 0)
|
||||
{
|
||||
::close(fd);
|
||||
can_open_uinput = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return can_open_uinput.value();
|
||||
}
|
||||
|
||||
#include "moc_settings.cpp"
|
||||
|
||||
@@ -72,10 +72,12 @@ public:
|
||||
Q_PROPERTY(QString application READ application WRITE set_application NOTIFY applicationChanged)
|
||||
Q_PROPERTY(QString openvr READ openvr WRITE set_openvr NOTIFY openvrChanged)
|
||||
|
||||
Q_PROPERTY(bool hidForwarding READ hidForwarding WRITE set_hidForwarding NOTIFY hidForwardingChanged)
|
||||
Q_PROPERTY(bool debugGui READ debugGui WRITE set_debugGui NOTIFY debugGuiChanged)
|
||||
Q_PROPERTY(bool steamVrLh READ steamVrLh WRITE set_steamVrLh NOTIFY steamVrLhChanged)
|
||||
|
||||
Q_PROPERTY(bool flatpak READ flatpak CONSTANT)
|
||||
Q_PROPERTY(bool hid_forwarding_supported READ hid_forwarding CONSTANT)
|
||||
Q_PROPERTY(bool debug_gui_supported READ debug_gui CONSTANT)
|
||||
Q_PROPERTY(bool steamvr_lh_supported READ steamvr_lh CONSTANT)
|
||||
|
||||
@@ -86,6 +88,7 @@ public:
|
||||
SETTER_GETTER_NOTIFY(int, bitrate)
|
||||
SETTER_GETTER_NOTIFY(float, scale)
|
||||
SETTER_GETTER_NOTIFY(QString, application)
|
||||
SETTER_GETTER_NOTIFY(bool, hidForwarding)
|
||||
SETTER_GETTER_NOTIFY(bool, debugGui)
|
||||
SETTER_GETTER_NOTIFY(bool, steamVrLh)
|
||||
SETTER_GETTER_NOTIFY(bool, tcpOnly)
|
||||
@@ -108,6 +111,7 @@ public:
|
||||
bool flatpak() const;
|
||||
bool debug_gui() const;
|
||||
bool steamvr_lh() const;
|
||||
bool hid_forwarding() const;
|
||||
|
||||
static encoder_name encoder_id_from_string(std::string_view s);
|
||||
static video_codec codec_id_from_string(std::string_view s);
|
||||
|
||||
Reference in New Issue
Block a user