Merge branch 'master' into compiler/readme-updates

This commit is contained in:
username223
2019-01-23 22:51:44 +01:00
committed by GitHub
9 changed files with 59 additions and 10 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 42 KiB

+14 -5
View File
@@ -42,10 +42,11 @@ MyStackViewPage {
RowLayout {
spacing: 18
Layout.fillWidth: true
MyPushButton {
text: "Keyboard Input"
Layout.preferredWidth: 200
Layout.fillWidth: true
onClicked: {
OverlayController.showKeyboard("", 601)
}
@@ -61,7 +62,7 @@ MyStackViewPage {
MyPushButton {
text: "Enter"
Layout.preferredWidth: 200
Layout.fillWidth: true
onClicked: {
UtilitiesTabController.sendKeyboardEnter()
}
@@ -69,7 +70,7 @@ MyStackViewPage {
MyPushButton {
text: "Alt-Tab"
Layout.preferredWidth: 200
Layout.fillWidth: true
onClicked: {
UtilitiesTabController.sendKeyboardAltTab()
}
@@ -77,7 +78,7 @@ MyStackViewPage {
MyPushButton {
text: "Backspace"
Layout.preferredWidth: 200
Layout.fillWidth: true
onClicked: {
UtilitiesTabController.sendKeyboardBackspace(1)
}
@@ -85,11 +86,19 @@ MyStackViewPage {
MyPushButton {
text: "10x Backspace"
Layout.preferredWidth: 200
Layout.fillWidth: true
onClicked: {
UtilitiesTabController.sendKeyboardBackspace(10)
}
}
MyPushButton {
text: "Alt-Enter"
Layout.fillWidth: true
onClicked: {
UtilitiesTabController.sendKeyboardAltEnter()
}
}
}
}
}
+1
View File
@@ -17,6 +17,7 @@ public:
virtual void sendKeyboardEnter() = 0;
virtual void sendKeyboardBackspace( const int count ) = 0;
virtual void sendKeyboardAltTab() = 0;
virtual void sendKeyboardAltEnter() = 0;
virtual void sendMediaNextSong() = 0;
virtual void sendMediaPreviousSong() = 0;
virtual void sendMediaPausePlay() = 0;
@@ -78,6 +78,11 @@ void UtilitiesTabController::sendKeyboardEnter()
keyboardInput->sendKeyboardEnter();
}
void UtilitiesTabController::sendKeyboardAltEnter()
{
keyboardInput->sendKeyboardAltEnter();
}
void UtilitiesTabController::sendKeyboardAltTab()
{
keyboardInput->sendKeyboardAltTab();
@@ -69,6 +69,7 @@ public slots:
void sendKeyboardInput( QString input );
void sendKeyboardEnter();
void sendKeyboardAltTab();
void sendKeyboardAltEnter();
void sendKeyboardBackspace( const int count );
void sendMediaNextSong();
void sendMediaPreviousSong();
@@ -28,6 +28,11 @@ void KeyboardInputDummy::sendKeyboardAltTab()
// noop
}
void KeyboardInputDummy::sendKeyboardAltEnter()
{
// noop
}
void KeyboardInputDummy::sendMediaNextSong()
{
// noop
@@ -13,6 +13,7 @@ public:
virtual void sendKeyboardEnter() override;
virtual void sendKeyboardBackspace( const int count ) override;
virtual void sendKeyboardAltTab() override;
virtual void sendKeyboardAltEnter() override;
virtual void sendMediaNextSong() override;
virtual void sendMediaPreviousSong() override;
virtual void sendMediaPausePlay() override;
@@ -234,11 +234,13 @@ a music player.
*/
void KeyboardInputWindows::sendKeyboardAltTab()
{
// VK_MENU is Alt.
const auto pressAlt = createInputStruct( VK_MENU, KeyStatus::Down );
const auto pressTab = createInputStruct( VK_TAB, KeyStatus::Down );
const auto releaseAlt = createInputStruct( VK_MENU, KeyStatus::Up );
const auto releaseTab = createInputStruct( VK_TAB, KeyStatus::Up );
constexpr auto altKey = VK_MENU;
constexpr auto tabKey = VK_TAB;
const auto pressAlt = createInputStruct( altKey, KeyStatus::Down );
const auto pressTab = createInputStruct( tabKey, KeyStatus::Down );
const auto releaseAlt = createInputStruct( altKey, KeyStatus::Up );
const auto releaseTab = createInputStruct( tabKey, KeyStatus::Up );
constexpr auto numberOfActions = 4;
@@ -248,6 +250,30 @@ void KeyboardInputWindows::sendKeyboardAltTab()
sendKeyboardInputRaw( numberOfActions, actions );
}
/*!
Sends an Alt + Tab combination to Windows.
Used for toggling full screen on games and various applications that appear on
the desktop.
*/
void KeyboardInputWindows::sendKeyboardAltEnter()
{
constexpr auto altKey = VK_MENU;
constexpr auto enterKey = VK_RETURN;
const auto pressAlt = createInputStruct( altKey, KeyStatus::Down );
const auto pressEnter = createInputStruct( enterKey, KeyStatus::Down );
const auto releaseAlt = createInputStruct( altKey, KeyStatus::Up );
const auto releaseEnter = createInputStruct( enterKey, KeyStatus::Up );
constexpr auto numberOfActions = 4;
INPUT actions[numberOfActions]
= { pressAlt, pressEnter, releaseAlt, releaseEnter };
sendKeyboardInputRaw( numberOfActions, actions );
}
/*!
Sends a media key Next Song button to Windows.
*/
@@ -13,6 +13,7 @@ public:
virtual void sendKeyboardEnter() override;
virtual void sendKeyboardBackspace( const int count ) override;
virtual void sendKeyboardAltTab() override;
virtual void sendKeyboardAltEnter() override;
virtual void sendMediaNextSong() override;
virtual void sendMediaPreviousSong() override;
virtual void sendMediaPausePlay() override;