fix: Command palette not appearing on Linux
This commit is contained in:
parent
32276b820f
commit
b619744093
@ -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() {
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user