Skip to content
Draft
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: 1 addition & 2 deletions src/gui/src/KeySequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class KeySequence
bool operator==(const KeySequence &ks) const;

private:
static QString keyToString(int key);
void setValid(bool b)
{
m_IsValid = b;
Expand All @@ -74,8 +75,6 @@ class KeySequence
inline static const int kStrSize = 4;
inline static const int kBase = 16;
inline static const QChar kFillChar = QChar('0');

static QString keyToString(int key);
};

#endif
4 changes: 4 additions & 0 deletions src/gui/src/ScreenSettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ ScreenSettingsDialog::ScreenSettingsDialog(QWidget *parent, Screen *pScreen, con
m_pCheckBoxNumLock->setChecked(m_pScreen->fix(NumLock));
m_pCheckBoxScrollLock->setChecked(m_pScreen->fix(ScrollLock));
m_pCheckBoxXTest->setChecked(m_pScreen->fix(XTest));

m_pLineEditAnchoredKeys->setText(m_pScreen->anchoredKeys());
}

void ScreenSettingsDialog::accept()
Expand Down Expand Up @@ -122,6 +124,8 @@ void ScreenSettingsDialog::accept()
m_pScreen->setFix(static_cast<int>(ScrollLock), m_pCheckBoxScrollLock->isChecked());
m_pScreen->setFix(static_cast<int>(XTest), m_pCheckBoxXTest->isChecked());

m_pScreen->setAnchoredKeys(m_pLineEditAnchoredKeys->text());

QDialog::accept();
}

Expand Down
65 changes: 65 additions & 0 deletions src/gui/src/ScreenSettingsDialogBase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,71 @@
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_pLabelAnchoredKeys">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Anchored keys</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="m_pGroupAnchoredKeys">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayoutAnchoredKeys">
<property name="topMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QLineEdit" name="m_pLineEditAnchoredKeys">
<property name="placeholderText">
<string>e.g. F13, Ctrl+A, Alt+Tab, LeftCtrl</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabelAnchoredKeysHelp">
<property name="text">
<string>Keys that stay on this computer when focus is elsewhere.
Comma-separated. Use + for combos (e.g. Alt+Tab, Ctrl+A).</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_10">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>3</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="m_pLabelAliases">
<property name="sizePolicy">
Expand Down
26 changes: 26 additions & 0 deletions src/lib/deskflow/option_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,32 @@ static const OptionID kOptionWin32KeepForeground = OPTION_CODE("_KFW");
static const OptionID kOptionDisableLockToScreen = OPTION_CODE("DLTS");
static const OptionID kOptionClipboardSharing = OPTION_CODE("CLPS");
static const OptionID kOptionClipboardSharingSize = OPTION_CODE("CLSZ");
static const OptionID kOptionAnchoredKeys = OPTION_CODE("ANKK");
static const OptionID kOptionAnchoredKeys0 = OPTION_CODE("AK_0");
static const OptionID kOptionAnchoredKeys1 = OPTION_CODE("AK_1");
static const OptionID kOptionAnchoredKeys2 = OPTION_CODE("AK_2");
static const OptionID kOptionAnchoredKeys3 = OPTION_CODE("AK_3");
static const OptionID kOptionAnchoredKeys4 = OPTION_CODE("AK_4");
static const OptionID kOptionAnchoredKeys5 = OPTION_CODE("AK_5");
static const OptionID kOptionAnchoredKeys6 = OPTION_CODE("AK_6");
static const OptionID kOptionAnchoredKeys7 = OPTION_CODE("AK_7");
static const OptionID kOptionAnchoredCombos0 = OPTION_CODE("AC_0");
static const OptionID kOptionAnchoredCombos1 = OPTION_CODE("AC_1");
static const OptionID kOptionAnchoredCombos2 = OPTION_CODE("AC_2");
static const OptionID kOptionAnchoredCombos3 = OPTION_CODE("AC_3");
static const OptionID kOptionAnchoredCombos4 = OPTION_CODE("AC_4");
static const OptionID kOptionAnchoredCombos5 = OPTION_CODE("AC_5");
static const OptionID kOptionAnchoredCombos6 = OPTION_CODE("AC_6");
static const OptionID kOptionAnchoredCombos7 = OPTION_CODE("AC_7");
static const OptionID kOptionAnchoredCombos8 = OPTION_CODE("AC_8");
static const OptionID kOptionAnchoredCombos9 = OPTION_CODE("AC_9");
static const OptionID kOptionAnchoredCombos10 = OPTION_CODE("AC10");
static const OptionID kOptionAnchoredCombos11 = OPTION_CODE("AC11");
static const OptionID kOptionAnchoredCombos12 = OPTION_CODE("AC12");
static const OptionID kOptionAnchoredCombos13 = OPTION_CODE("AC13");
static const OptionID kOptionAnchoredCombos14 = OPTION_CODE("AC14");
static const OptionID kOptionAnchoredCombos15 = OPTION_CODE("AC15");
static const OptionID kOptionAnchoredCombosCount = OPTION_CODE("ACCN");
//@}

//! @name Screen switch corner enumeration
Expand Down
13 changes: 12 additions & 1 deletion src/lib/gui/config/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ void Screen::init()

for (int i = 0; i < static_cast<int>(NumFixes); i++)
fixes() << false;

setAnchoredKeys(QString());
}

void Screen::loadSettings(QSettingsProxy &settings)
Expand All @@ -73,6 +75,8 @@ void Screen::loadSettings(QSettingsProxy &settings)
readSettings(settings, modifiers(), "modifier", static_cast<int>(DefaultMod), static_cast<int>(NumModifiers));
readSettings(settings, switchCorners(), "switchCorner", 0, static_cast<int>(NumSwitchCorners));
readSettings(settings, fixes(), "fix", 0, static_cast<int>(NumFixes));

setAnchoredKeys(settings.value("anchoredKeys").toString());
}

void Screen::saveSettings(QSettingsProxy &settings) const
Expand All @@ -88,6 +92,8 @@ void Screen::saveSettings(QSettingsProxy &settings) const
writeSettings(settings, modifiers(), "modifier");
writeSettings(settings, switchCorners(), "switchCorner");
writeSettings(settings, fixes(), "fix");

settings.setValue("anchoredKeys", anchoredKeys());
}

QTextStream &Screen::writeScreensSection(QTextStream &outStream) const
Expand All @@ -111,6 +117,10 @@ QTextStream &Screen::writeScreensSection(QTextStream &outStream) const
outStream << "\t\t"
<< "switchCornerSize = " << switchCornerSize() << Qt::endl;

if (!anchoredKeys().isEmpty())
outStream << "\t\t"
<< "anchoredKeys = " << anchoredKeys() << Qt::endl;

return outStream;
}

Expand All @@ -130,5 +140,6 @@ bool Screen::operator==(const Screen &screen) const
{
return m_Name == screen.m_Name && m_Aliases == screen.m_Aliases && m_Modifiers == screen.m_Modifiers &&
m_SwitchCorners == screen.m_SwitchCorners && m_SwitchCornerSize == screen.m_SwitchCornerSize &&
m_Fixes == screen.m_Fixes && m_Swapped == screen.m_Swapped && m_isServer == screen.m_isServer;
m_Fixes == screen.m_Fixes && m_AnchoredKeys == screen.m_AnchoredKeys && m_Swapped == screen.m_Swapped &&
m_isServer == screen.m_isServer;
}
13 changes: 11 additions & 2 deletions src/lib/gui/config/Screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ class Screen : public ScreenConfig
friend QDataStream &operator<<(QDataStream &outStream, const Screen &screen)
{
return outStream << screen.name() << screen.switchCornerSize() << screen.aliases() << screen.modifiers()
<< screen.switchCorners() << screen.fixes() << screen.isServer();
<< screen.switchCorners() << screen.fixes() << screen.isServer() << screen.anchoredKeys();
}

friend QDataStream &operator>>(QDataStream &inStream, Screen &screen)
{
return inStream >> screen.m_Name >> screen.m_SwitchCornerSize >> screen.m_Aliases >> screen.m_Modifiers >>
screen.m_SwitchCorners >> screen.m_Fixes >> screen.m_isServer;
screen.m_SwitchCorners >> screen.m_Fixes >> screen.m_isServer >> screen.m_AnchoredKeys;
}

public:
Expand Down Expand Up @@ -106,6 +106,10 @@ class Screen : public ScreenConfig
QTextStream &writeScreensSection(QTextStream &outStream) const;
QTextStream &writeAliasesSection(QTextStream &outStream) const;

const QString &anchoredKeys() const
{
return m_AnchoredKeys;
}
bool swapped() const
{
return m_Swapped;
Expand Down Expand Up @@ -172,6 +176,10 @@ class Screen : public ScreenConfig
{
m_Swapped = on;
}
void setAnchoredKeys(const QString &keys)
{
m_AnchoredKeys = keys;
}

private:
QPixmap m_Pixmap = QPixmap(":res/icons/64x64/video-display.png");
Expand All @@ -181,6 +189,7 @@ class Screen : public ScreenConfig
QList<bool> m_SwitchCorners;
int m_SwitchCornerSize;
QList<bool> m_Fixes;
QString m_AnchoredKeys;
bool m_Swapped = false;
bool m_isServer = false;
};
3 changes: 3 additions & 0 deletions src/lib/platform/MSWindowsDesks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "deskflow/win32/AppUtilWindows.h"
#include "mt/Lock.h"
#include "mt/Thread.h"
#include "platform/MSWindowsHook.h"
#include "platform/MSWindowsScreen.h"
#include "platform/dfwhook.h"

Expand Down Expand Up @@ -538,6 +539,7 @@ void MSWindowsDesks::deskEnter(Desk *desk)
AttachThreadInput(thatThread, thisThread, FALSE);
EnableWindow(desk->m_window, desk->m_lowLevel ? FALSE : TRUE);
desk->m_foregroundWindow = NULL;
MSWindowsHook::setAnchorTargets(NULL, NULL);
}

void MSWindowsDesks::deskLeave(Desk *desk, HKL keyLayout)
Expand Down Expand Up @@ -597,6 +599,7 @@ void MSWindowsDesks::deskLeave(Desk *desk, HKL keyLayout)
AttachThreadInput(thatThread, thisThread, TRUE);
SetForegroundWindow(desk->m_window);
AttachThreadInput(thatThread, thisThread, FALSE);
MSWindowsHook::setAnchorTargets(desk->m_foregroundWindow, desk->m_window);
}
}
} else {
Expand Down
Loading
Loading