flightlessmango / MangoHud

A Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more. Discord: https://discordapp.com/invite/Gj5YmBb
MIT License
6.52k stars 287 forks source link

Network does not follow the horizontal rule #1461

Open holmes1d opened 4 weeks ago

holmes1d commented 4 weeks ago

Describe the bug When the network variable is added to a horizontal config it will always appear on a new row and not inline.

List relevant hardware/software information

To Reproduce Steps to reproduce the behavior:

  1. Add horizontal and network variables to the config
  2. Network will always show on a new row below even if there is space on the first row

Expected behavior I would expect the network information to appear in the same horizontal bar if space is available

Screenshots Network forced to new row network-new-row If network changed to code below network-same-row

Additional context Changed the hub_elements.cpp to the following for fix

void HudElements::network() {
#ifdef __linux__
    if (HUDElements.net && HUDElements.net->should_reset)
        HUDElements.net.reset(new Net);

    if (!HUDElements.net)
        HUDElements.net = std::make_unique<Net>();

    for (auto& iface : HUDElements.net->interfaces){
        ImguiNextColumnFirstItem();
        HUDElements.TextColored(HUDElements.colors.network, "%.8s", iface.name.c_str());
        ImguiNextColumnOrNewRow();
        right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.0f", iface.txBps / 1000.f);
        ImGui::SameLine(0,1.0f);
        ImGui::PushFont(HUDElements.sw_stats->font1);
        HUDElements.TextColored(HUDElements.colors.text, "KB/s %s", ICON_FK_ARROW_UP);
        ImGui::PopFont();
        ImguiNextColumnOrNewRow();
        right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, "%.0f", iface.rxBps / 1000.f);
        ImGui::SameLine(0,1.0f);
        ImGui::PushFont(HUDElements.sw_stats->font1);
        HUDElements.TextColored(HUDElements.colors.text, "KB/s %s", ICON_FK_ARROW_DOWN);
        ImGui::PopFont();
    }
#endif
}
flightlessmango commented 11 hours ago

Your changes look good, feel free to make a PR