1
0
mirror of synced 2025-02-17 18:59:21 +01:00

fix: Command palette not appearing on Linux

This commit is contained in:
WerWolv 2023-11-23 09:33:47 +01:00
parent 32276b820f
commit b619744093
3 changed files with 10 additions and 6 deletions

View File

@ -484,7 +484,10 @@ namespace hex {
ImVec2 getMainWindowPosition() {
return impl::s_mainWindowPos;
if ((ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable) != ImGuiConfigFlags_None)
return impl::s_mainWindowPos;
else
return { 0, 0 };
}
ImVec2 getMainWindowSize() {

View File

@ -741,10 +741,7 @@ namespace hex {
const auto flags = currPopup->getFlags() | (!hasConstraints ? (ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize) : ImGuiWindowFlags_None);
if (!positionSet) {
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
ImGui::SetNextWindowPos(ImHexApi::System::getMainWindowPosition() + (ImHexApi::System::getMainWindowSize() / 2.0F), ImGuiCond_Always, ImVec2(0.5F, 0.5F));
else
ImGui::SetNextWindowPos(ImHexApi::System::getMainWindowSize() / 2.0F, ImGuiCond_Always, ImVec2(0.5F, 0.5F));
ImGui::SetNextWindowPos(ImHexApi::System::getMainWindowPosition() + (ImHexApi::System::getMainWindowSize() / 2.0F), ImGuiCond_Always, ImVec2(0.5F, 0.5F));
if (sizeSet)
positionSet = true;

View File

@ -28,7 +28,11 @@ namespace hex::plugin::builtin {
auto windowSize = ImHexApi::System::getMainWindowSize();
ImGui::SetNextWindowPos(ImVec2(windowPos.x + windowSize.x * 0.5F, windowPos.y), ImGuiCond_Always, ImVec2(0.5F, 0.0F));
ImGui::SetNextWindowSizeConstraints(this->getMinSize(), this->getMaxSize());
if (ImGui::BeginPopup("hex.builtin.view.command_palette.name"_lang)) {
ImGui::BringWindowToDisplayFront(ImGui::GetCurrentWindowRead());
ImGui::BringWindowToFocusFront(ImGui::GetCurrentWindowRead());
// Close the popup if the user presses ESC
if (ImGui::IsKeyDown(ImGui::GetKeyIndex(ImGuiKey_Escape)))
ImGui::CloseCurrentPopup();
@ -106,8 +110,8 @@ namespace hex::plugin::builtin {
break;
}
}
ImGui::EndChild();
}
ImGui::EndChild();
ImGui::EndPopup();
} else {