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 { RowLayout {
spacing: 18 spacing: 18
Layout.fillWidth: true
MyPushButton { MyPushButton {
text: "Keyboard Input" text: "Keyboard Input"
Layout.preferredWidth: 200 Layout.fillWidth: true
onClicked: { onClicked: {
OverlayController.showKeyboard("", 601) OverlayController.showKeyboard("", 601)
} }
@@ -61,7 +62,7 @@ MyStackViewPage {
MyPushButton { MyPushButton {
text: "Enter" text: "Enter"
Layout.preferredWidth: 200 Layout.fillWidth: true
onClicked: { onClicked: {
UtilitiesTabController.sendKeyboardEnter() UtilitiesTabController.sendKeyboardEnter()
} }
@@ -69,7 +70,7 @@ MyStackViewPage {
MyPushButton { MyPushButton {
text: "Alt-Tab" text: "Alt-Tab"
Layout.preferredWidth: 200 Layout.fillWidth: true
onClicked: { onClicked: {
UtilitiesTabController.sendKeyboardAltTab() UtilitiesTabController.sendKeyboardAltTab()
} }
@@ -77,7 +78,7 @@ MyStackViewPage {
MyPushButton { MyPushButton {
text: "Backspace" text: "Backspace"
Layout.preferredWidth: 200 Layout.fillWidth: true
onClicked: { onClicked: {
UtilitiesTabController.sendKeyboardBackspace(1) UtilitiesTabController.sendKeyboardBackspace(1)
} }
@@ -85,11 +86,19 @@ MyStackViewPage {
MyPushButton { MyPushButton {
text: "10x Backspace" text: "10x Backspace"
Layout.preferredWidth: 200 Layout.fillWidth: true
onClicked: { onClicked: {
UtilitiesTabController.sendKeyboardBackspace(10) 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 sendKeyboardEnter() = 0;
virtual void sendKeyboardBackspace( const int count ) = 0; virtual void sendKeyboardBackspace( const int count ) = 0;
virtual void sendKeyboardAltTab() = 0; virtual void sendKeyboardAltTab() = 0;
virtual void sendKeyboardAltEnter() = 0;
virtual void sendMediaNextSong() = 0; virtual void sendMediaNextSong() = 0;
virtual void sendMediaPreviousSong() = 0; virtual void sendMediaPreviousSong() = 0;
virtual void sendMediaPausePlay() = 0; virtual void sendMediaPausePlay() = 0;
@@ -78,6 +78,11 @@ void UtilitiesTabController::sendKeyboardEnter()
keyboardInput->sendKeyboardEnter(); keyboardInput->sendKeyboardEnter();
} }
void UtilitiesTabController::sendKeyboardAltEnter()
{
keyboardInput->sendKeyboardAltEnter();
}
void UtilitiesTabController::sendKeyboardAltTab() void UtilitiesTabController::sendKeyboardAltTab()
{ {
keyboardInput->sendKeyboardAltTab(); keyboardInput->sendKeyboardAltTab();
@@ -69,6 +69,7 @@ public slots:
void sendKeyboardInput( QString input ); void sendKeyboardInput( QString input );
void sendKeyboardEnter(); void sendKeyboardEnter();
void sendKeyboardAltTab(); void sendKeyboardAltTab();
void sendKeyboardAltEnter();
void sendKeyboardBackspace( const int count ); void sendKeyboardBackspace( const int count );
void sendMediaNextSong(); void sendMediaNextSong();
void sendMediaPreviousSong(); void sendMediaPreviousSong();
@@ -28,6 +28,11 @@ void KeyboardInputDummy::sendKeyboardAltTab()
// noop // noop
} }
void KeyboardInputDummy::sendKeyboardAltEnter()
{
// noop
}
void KeyboardInputDummy::sendMediaNextSong() void KeyboardInputDummy::sendMediaNextSong()
{ {
// noop // noop
@@ -13,6 +13,7 @@ public:
virtual void sendKeyboardEnter() override; virtual void sendKeyboardEnter() override;
virtual void sendKeyboardBackspace( const int count ) override; virtual void sendKeyboardBackspace( const int count ) override;
virtual void sendKeyboardAltTab() override; virtual void sendKeyboardAltTab() override;
virtual void sendKeyboardAltEnter() override;
virtual void sendMediaNextSong() override; virtual void sendMediaNextSong() override;
virtual void sendMediaPreviousSong() override; virtual void sendMediaPreviousSong() override;
virtual void sendMediaPausePlay() override; virtual void sendMediaPausePlay() override;
@@ -234,11 +234,13 @@ a music player.
*/ */
void KeyboardInputWindows::sendKeyboardAltTab() void KeyboardInputWindows::sendKeyboardAltTab()
{ {
// VK_MENU is Alt. constexpr auto altKey = VK_MENU;
const auto pressAlt = createInputStruct( VK_MENU, KeyStatus::Down ); constexpr auto tabKey = VK_TAB;
const auto pressTab = createInputStruct( VK_TAB, KeyStatus::Down );
const auto releaseAlt = createInputStruct( VK_MENU, KeyStatus::Up ); const auto pressAlt = createInputStruct( altKey, KeyStatus::Down );
const auto releaseTab = createInputStruct( VK_TAB, KeyStatus::Up ); 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; constexpr auto numberOfActions = 4;
@@ -248,6 +250,30 @@ void KeyboardInputWindows::sendKeyboardAltTab()
sendKeyboardInputRaw( numberOfActions, actions ); 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. Sends a media key Next Song button to Windows.
*/ */
@@ -13,6 +13,7 @@ public:
virtual void sendKeyboardEnter() override; virtual void sendKeyboardEnter() override;
virtual void sendKeyboardBackspace( const int count ) override; virtual void sendKeyboardBackspace( const int count ) override;
virtual void sendKeyboardAltTab() override; virtual void sendKeyboardAltTab() override;
virtual void sendKeyboardAltEnter() override;
virtual void sendMediaNextSong() override; virtual void sendMediaNextSong() override;
virtual void sendMediaPreviousSong() override; virtual void sendMediaPreviousSong() override;
virtual void sendMediaPausePlay() override; virtual void sendMediaPausePlay() override;