add headless mode settings in GUI, cursor no jump while reconnect
This commit is contained in:
parent
833904e3bf
commit
5e77cb4577
|
@ -61,7 +61,8 @@ AppConfig::AppConfig(QSettings* settings) :
|
|||
m_CryptoEnabled(false),
|
||||
m_AutoHide(false),
|
||||
m_AutoStart(false),
|
||||
m_MinimizeToTray(false)
|
||||
m_MinimizeToTray(false),
|
||||
m_HeadlessMode(false)
|
||||
{
|
||||
Q_ASSERT(m_pSettings);
|
||||
|
||||
|
@ -161,6 +162,7 @@ void AppConfig::loadSettings()
|
|||
m_AutoHide = settings().value("autoHide", false).toBool();
|
||||
m_AutoStart = settings().value("autoStart", false).toBool();
|
||||
m_MinimizeToTray = settings().value("minimizeToTray", false).toBool();
|
||||
m_HeadlessMode = settings().value("headlessMode", false).toBool();
|
||||
}
|
||||
|
||||
void AppConfig::saveSettings()
|
||||
|
@ -184,6 +186,7 @@ void AppConfig::saveSettings()
|
|||
settings().setValue("autoHide", m_AutoHide);
|
||||
settings().setValue("autoStart", m_AutoStart);
|
||||
settings().setValue("minimizeToTray", m_MinimizeToTray);
|
||||
settings().setValue("headlessMode", m_HeadlessMode);
|
||||
settings().sync();
|
||||
}
|
||||
|
||||
|
@ -236,3 +239,7 @@ bool AppConfig::getAutoStart() { return m_AutoStart; }
|
|||
void AppConfig::setMinimizeToTray(bool b) { m_MinimizeToTray = b; }
|
||||
|
||||
bool AppConfig::getMinimizeToTray() { return m_MinimizeToTray; }
|
||||
|
||||
void AppConfig::setHeadlessMode(bool b) { m_HeadlessMode = b; }
|
||||
|
||||
bool AppConfig::getHeadlessMode() { return m_HeadlessMode; }
|
||||
|
|
|
@ -100,6 +100,9 @@ class AppConfig: public QObject
|
|||
void setMinimizeToTray(bool b);
|
||||
bool getMinimizeToTray();
|
||||
|
||||
void setHeadlessMode(bool b);
|
||||
bool getHeadlessMode();
|
||||
|
||||
void saveSettings();
|
||||
|
||||
protected:
|
||||
|
@ -135,6 +138,7 @@ protected:
|
|||
bool m_AutoHide;
|
||||
bool m_AutoStart;
|
||||
bool m_MinimizeToTray;
|
||||
bool m_HeadlessMode;
|
||||
|
||||
static const char m_BarriersName[];
|
||||
static const char m_BarriercName[];
|
||||
|
|
|
@ -519,6 +519,9 @@ void MainWindow::startBarrier()
|
|||
args << "--enable-crypto";
|
||||
}
|
||||
|
||||
if (m_AppConfig->getHeadlessMode()) {
|
||||
args << "--headless-mode";
|
||||
}
|
||||
#if defined(Q_OS_WIN)
|
||||
// on windows, the profile directory changes depending on the user that
|
||||
// launched the process (e.g. when launched with elevation). setting the
|
||||
|
|
|
@ -51,6 +51,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
|||
m_pCheckBoxAutoStart->setChecked(appConfig().getAutoStart());
|
||||
m_pCheckBoxMinimizeToTray->setChecked(appConfig().getMinimizeToTray());
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||
m_pCheckBoxHeadlessMode->setChecked(m_appConfig.getHeadlessMode());
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
m_pComboElevate->setCurrentIndex(static_cast<int>(appConfig().elevateMode()));
|
||||
|
@ -75,6 +76,7 @@ void SettingsDialog::accept()
|
|||
m_appConfig.setAutoHide(m_pCheckBoxAutoHide->isChecked());
|
||||
m_appConfig.setAutoStart(m_pCheckBoxAutoStart->isChecked());
|
||||
m_appConfig.setMinimizeToTray(m_pCheckBoxMinimizeToTray->isChecked());
|
||||
m_appConfig.setHeadlessMode(m_pCheckBoxHeadlessMode->isChecked());
|
||||
m_appConfig.saveSettings();
|
||||
QDialog::accept();
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>368</width>
|
||||
<height>428</height>
|
||||
<height>454</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -133,6 +133,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="m_pCheckBoxHeadlessMode">
|
||||
<property name="text">
|
||||
<string>Headless &mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -164,7 +164,7 @@ ClientApp::createScreen()
|
|||
{
|
||||
#if WINAPI_MSWINDOWS
|
||||
return new barrier::Screen(new MSWindowsScreen(
|
||||
false, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
|
||||
false, args().m_noHooks, args().m_stopOnDeskSwitch, args().m_headlessMode, m_events), m_events);
|
||||
#elif WINAPI_XWINDOWS
|
||||
return new barrier::Screen(new XWindowsScreen(
|
||||
new XWindowsImpl(),
|
||||
|
|
|
@ -616,7 +616,7 @@ ServerApp::createScreen()
|
|||
{
|
||||
#if WINAPI_MSWINDOWS
|
||||
return new barrier::Screen(new MSWindowsScreen(
|
||||
true, args().m_noHooks, args().m_stopOnDeskSwitch, m_events), m_events);
|
||||
true, args().m_noHooks, args().m_stopOnDeskSwitch, args().m_headlessMode, m_events), m_events);
|
||||
#elif WINAPI_XWINDOWS
|
||||
return new barrier::Screen(new XWindowsScreen(
|
||||
new XWindowsImpl(),
|
||||
|
|
|
@ -240,6 +240,7 @@ void
|
|||
Client::enter(SInt32 xAbs, SInt32 yAbs, UInt32, KeyModifierMask mask, bool)
|
||||
{
|
||||
m_active = true;
|
||||
if (!m_args.m_headlessMode)
|
||||
m_screen->mouseMove(xAbs, yAbs);
|
||||
m_screen->enter(mask);
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@
|
|||
MSWindowsDesks::MSWindowsDesks(
|
||||
bool isPrimary, bool noHooks,
|
||||
const IScreenSaver* screensaver, IEventQueue* events,
|
||||
IJob* updateKeys, bool stopOnDeskSwitch) :
|
||||
IJob* updateKeys, bool stopOnDeskSwitch, bool headlessMode) :
|
||||
m_isPrimary(isPrimary),
|
||||
m_noHooks(noHooks),
|
||||
m_isOnScreen(m_isPrimary),
|
||||
|
@ -117,7 +117,8 @@ MSWindowsDesks::MSWindowsDesks(
|
|||
m_deskReady(&m_mutex, false),
|
||||
m_updateKeys(updateKeys),
|
||||
m_events(events),
|
||||
m_stopOnDeskSwitch(stopOnDeskSwitch)
|
||||
m_stopOnDeskSwitch(stopOnDeskSwitch),
|
||||
m_headlessMode(headlessMode)
|
||||
{
|
||||
m_cursor = createBlankCursor();
|
||||
m_deskClass = createDeskWindowClass(m_isPrimary);
|
||||
|
@ -596,11 +597,13 @@ MSWindowsDesks::deskLeave(Desk* desk, HKL keyLayout)
|
|||
// we aren't notified when the mouse leaves our window.
|
||||
SetCapture(desk->m_window);
|
||||
|
||||
if (!m_headlessMode) {
|
||||
// warp the mouse to the cursor center
|
||||
LOG((CLOG_DEBUG2 "warping cursor to center: %+d,%+d", m_xCenter, m_yCenter));
|
||||
deskMouseMove(m_xCenter, m_yCenter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MSWindowsDesks::deskThread(void* vdesk)
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
MSWindowsDesks(
|
||||
bool isPrimary, bool noHooks,
|
||||
const IScreenSaver* screensaver, IEventQueue* events,
|
||||
IJob* updateKeys, bool stopOnDeskSwitch);
|
||||
IJob* updateKeys, bool stopOnDeskSwitch, bool headlessMode);
|
||||
~MSWindowsDesks();
|
||||
|
||||
//! @name manipulators
|
||||
|
@ -294,4 +294,6 @@ private:
|
|||
|
||||
// true if program should stop on desk switch.
|
||||
bool m_stopOnDeskSwitch;
|
||||
|
||||
bool m_headlessMode;
|
||||
};
|
||||
|
|
|
@ -93,6 +93,7 @@ MSWindowsScreen::MSWindowsScreen(
|
|||
bool isPrimary,
|
||||
bool noHooks,
|
||||
bool stopOnDeskSwitch,
|
||||
bool headlessMode,
|
||||
IEventQueue* events) :
|
||||
PlatformScreen(events),
|
||||
m_isPrimary(isPrimary),
|
||||
|
@ -136,7 +137,8 @@ MSWindowsScreen::MSWindowsScreen(
|
|||
m_events,
|
||||
new TMethodJob<MSWindowsScreen>(
|
||||
this, &MSWindowsScreen::updateKeysCB),
|
||||
stopOnDeskSwitch);
|
||||
stopOnDeskSwitch,
|
||||
headlessMode);
|
||||
m_keyState = new MSWindowsKeyState(m_desks, getEventTarget(), m_events);
|
||||
|
||||
updateScreenShape();
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
bool isPrimary,
|
||||
bool noHooks,
|
||||
bool stopOnDeskSwitch,
|
||||
bool headlessMode,
|
||||
IEventQueue* events);
|
||||
virtual ~MSWindowsScreen();
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ protected:
|
|||
return new MSWindowsDesks(
|
||||
true, false, m_screensaver, eventQueue,
|
||||
new TMethodJob<MSWindowsKeyStateTests>(
|
||||
this, &MSWindowsKeyStateTests::updateKeysCB), false);
|
||||
this, &MSWindowsKeyStateTests::updateKeysCB), false, false);
|
||||
}
|
||||
|
||||
void* getEventTarget() const
|
||||
|
|
Loading…
Reference in New Issue