diff --git a/assets/config_default.ini b/assets/config_default.ini index 4f1d689..4bbdd0b 100644 --- a/assets/config_default.ini +++ b/assets/config_default.ini @@ -52,7 +52,7 @@ DetachedTransformHMD=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] DetachedTransformRightHand=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] DetachedTransformLeftHand=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] DetachedTransformAux=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] -ActionBarOrderCustom=1 1;2 0;1000 1;1001 0;1002 0;1003 1; +ActionBarOrderCustom=1 1;2 0;6 1;1000 0;1001 0;1002 1; [Interface] ;Don't want DesktopPlusUI.exe to run automatically? Set this to true @@ -72,7 +72,7 @@ WarningCompositorQualityHidden=false WarningProcessElevationHidden=false WarningElevatedModeHidden=false WarningWelcomeHidden=false -ActionOrder=1 1;2 0;1000 1;1001 0;1002 0;1003 1; +ActionOrder=1 1;2 0;6 1;1000 0;1001 0;1002 1; [Input] GoHomeButtonActionID=1002 @@ -129,28 +129,22 @@ PerformanceMonitorShowViveWireless=false PerformanceMonitorDisableGPUCounters=false [CustomActions] -Count=4 -Action0Name=Switch Task +Count=3 +Action0Name=Middle Mouse Button Action0FunctionType=PressKeys -Action0KeyCode1=91 -Action0KeyCode2=9 +Action0KeyCode1=4 +Action0KeyCode2=0 Action0KeyCode3=0 -Action0IconFilename=images/icons/task_switch.png -Action1Name=Middle Mouse Button +Action0IconFilename= +Action1Name=Back Mouse Button Action1FunctionType=PressKeys -Action1KeyCode1=4 +Action1KeyCode1=5 Action1KeyCode2=0 Action1KeyCode3=0 Action1IconFilename= -Action2Name=Back Mouse Button -Action2FunctionType=PressKeys -Action2KeyCode1=5 -Action2KeyCode2=0 -Action2KeyCode3=0 +Action2Name=  Open ReadMe +Action2FunctionType=LaunchApplication +Action2ExecutablePath=readme.txt +Action2ExecutableArg= Action2IconFilename= -Action3Name=  Open ReadMe -Action3FunctionType=LaunchApplication -Action3ExecutablePath=readme.txt -Action3ExecutableArg= -Action3IconFilename= diff --git a/src/DesktopPlus/OutputManager.cpp b/src/DesktopPlus/OutputManager.cpp index 5f21a09..b2603f5 100644 --- a/src/DesktopPlus/OutputManager.cpp +++ b/src/DesktopPlus/OutputManager.cpp @@ -2,6 +2,7 @@ #include #include +#include using namespace DirectX; #include @@ -2157,6 +2158,11 @@ void OutputManager::DoAction(ActionID action_id) ToggleOverlayGroupEnabled(1 + ((int)action_id - action_toggle_overlay_enabled_group_1) ); break; } + case action_switch_task: + { + ShowWindowSwitcher(); + break; + } default: break; } } @@ -4066,6 +4072,17 @@ bool OutputManager::HandleOverlayProfileLoadMessage(LPARAM lparam) return false; } +void OutputManager::InitComIfNeeded() +{ + if (!m_ComInitDone) + { + if (::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) != RPC_E_CHANGED_MODE) + { + m_ComInitDone = true; + } + } +} + void OutputManager::LaunchApplication(const std::string& path_utf8, const std::string& arg_utf8) { if (ConfigManager::Get().GetConfigBool(configid_bool_state_misc_elevated_mode_active)) @@ -4081,24 +4098,31 @@ void OutputManager::LaunchApplication(const std::string& path_utf8, const std::s return; } - if (!m_ComInitDone) //Let's only do this if really needed - { - if (::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE) != RPC_E_CHANGED_MODE) - { - m_ComInitDone = true; - } - } - //Convert path and arg to utf16 std::wstring path_wstr = WStringConvertFromUTF8(path_utf8.c_str()); std::wstring arg_wstr = WStringConvertFromUTF8(arg_utf8.c_str()); if (!path_wstr.empty()) - { + { + InitComIfNeeded(); + ::ShellExecute(nullptr, nullptr, path_wstr.c_str(), arg_wstr.c_str(), nullptr, SW_SHOWNORMAL); } } +void OutputManager::ShowWindowSwitcher() +{ + InitComIfNeeded(); + + Microsoft::WRL::ComPtr shell_dispatch; + HRESULT sc = ::CoCreateInstance(CLSID_Shell, nullptr, CLSCTX_SERVER, IID_IDispatch, &shell_dispatch); + + if (SUCCEEDED(sc)) + { + shell_dispatch->WindowSwitcher(); + } +} + void OutputManager::ResetMouseLastLaserPointerPos() { //Set last pointer values to current to not trip the movement detection up diff --git a/src/DesktopPlus/OutputManager.h b/src/DesktopPlus/OutputManager.h index 999681d..e4a3494 100644 --- a/src/DesktopPlus/OutputManager.h +++ b/src/DesktopPlus/OutputManager.h @@ -94,7 +94,9 @@ class OutputManager void HandleKeyboardHelperMessage(LPARAM lparam); bool HandleOverlayProfileLoadMessage(LPARAM lparam); + void InitComIfNeeded(); void LaunchApplication(const std::string& path_utf8, const std::string& arg_utf8); + void ShowWindowSwitcher(); void ResetMouseLastLaserPointerPos(); void CropToActiveWindow(); void CropToDisplay(int display_id, bool do_not_apply_setting = false); diff --git a/src/DesktopPlusUI/TextureManager.cpp b/src/DesktopPlusUI/TextureManager.cpp index cb48112..c46bdda 100644 --- a/src/DesktopPlusUI/TextureManager.cpp +++ b/src/DesktopPlusUI/TextureManager.cpp @@ -35,6 +35,7 @@ const wchar_t* TextureManager::s_TextureFilenames[] = L"images/icons/desktop_previous.png", L"images/icons/settings.png", L"images/icons/keyboard.png", + L"images/icons/task_switch.png", L"images/icons/small_close.png", L"images/icons/small_move.png", L"images/icons/small_actionbar.png", diff --git a/src/DesktopPlusUI/TextureManager.h b/src/DesktopPlusUI/TextureManager.h index c86a5e1..fec8ef3 100644 --- a/src/DesktopPlusUI/TextureManager.h +++ b/src/DesktopPlusUI/TextureManager.h @@ -24,6 +24,7 @@ enum TMNGRTexID tmtex_icon_desktop_prev, tmtex_icon_settings, tmtex_icon_keyboard, + tmtex_icon_switch_task, tmtex_icon_small_close, tmtex_icon_small_move, tmtex_icon_small_actionbar, diff --git a/src/DesktopPlusUI/WindowMainBar.cpp b/src/DesktopPlusUI/WindowMainBar.cpp index 3c3b107..3554a65 100644 --- a/src/DesktopPlusUI/WindowMainBar.cpp +++ b/src/DesktopPlusUI/WindowMainBar.cpp @@ -240,7 +240,8 @@ void WindowMainBar::UpdateActionButtons(unsigned int overlay_id) //Button action is always the same but we want to use icons if available switch (order_data.action_id) { - case action_show_keyboard: TextureManager::Get().GetTextureInfo(tmtex_icon_keyboard, b_size, b_uv_min, b_uv_max); break; + case action_show_keyboard: TextureManager::Get().GetTextureInfo(tmtex_icon_keyboard, b_size, b_uv_min, b_uv_max); break; + case action_switch_task: TextureManager::Get().GetTextureInfo(tmtex_icon_switch_task, b_size, b_uv_min, b_uv_max); break; default: has_icon = false; } diff --git a/src/Shared/Actions.cpp b/src/Shared/Actions.cpp index 016d39a..c36c7e8 100644 --- a/src/Shared/Actions.cpp +++ b/src/Shared/Actions.cpp @@ -12,6 +12,7 @@ const char* g_ActionNames[] = "Toggle Overlay Group 1 Enabled State", "Toggle Overlay Group 2 Enabled State", "Toggle Overlay Group 3 Enabled State", + "Switch Task", //Custom }; @@ -24,6 +25,7 @@ const char* g_ActionButtonLabel[] = "Toggle Overlay Group 1", "Toggle Overlay Group 2", "Toggle Overlay Group 3 ", + "", //Custom }; diff --git a/src/Shared/Actions.h b/src/Shared/Actions.h index 7803c7a..81a32d4 100644 --- a/src/Shared/Actions.h +++ b/src/Shared/Actions.h @@ -18,6 +18,7 @@ enum ActionID: int action_toggle_overlay_enabled_group_1, action_toggle_overlay_enabled_group_2, action_toggle_overlay_enabled_group_3, + action_switch_task, action_built_in_MAX, //Leaving some room here, as we don't want to mess with user order later action_custom = 1000 //+ Custom Action ID