Skip to content

Commit

Permalink
don't take over focus so easily (e.g. with pressing TAB)
Browse files Browse the repository at this point in the history
  • Loading branch information
knoxfighter committed Mar 1, 2021
1 parent d749cc6 commit 74bc90a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
9 changes: 7 additions & 2 deletions KillproofUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ void KillproofUI::openInBrowser(const char* username) {
ShellExecuteA(nullptr, nullptr, buf, nullptr, nullptr, SW_SHOW);
}

void KillproofUI::draw(const char* title, bool* p_open, ImGuiWindowFlags flags) {
void KillproofUI::draw(bool* p_open, ImGuiWindowFlags flags) {
// ImGui::SetNextWindowSizeConstraints(ImVec2(150, 50), ImVec2(windowWidth, windowsHeight));
ImGui::Begin(title, p_open, flags);
std::string title = Lang::translate(LangKey::KpWindowName);
title.append("##Killproof.me");

flags |= ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;

ImGui::Begin(title.c_str(), p_open, flags);

// lock the mutexes, before we access sensible data
std::scoped_lock<std::mutex, std::mutex> lock(trackedPlayersMutex, cachedPlayersMutex);
Expand Down
2 changes: 1 addition & 1 deletion KillproofUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class KillproofUI
public:
std::atomic_bool needSort = false;

void draw(const char* title, bool* p_open, ImGuiWindowFlags flags);
void draw(bool* p_open, ImGuiWindowFlags flags);
void AlignedTextColumn(const char* text, ...) const;
void TableHeader(const char* label, bool show_text);

Expand Down
3 changes: 1 addition & 2 deletions dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ void ShowKillproof(bool* p_open) {
std::string title = Lang::translate(LangKey::KpWindowName);
title.append("##Killproof.me");

killproofUi.draw(title.c_str(), p_open,
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_AlwaysAutoResize | (!canMoveWindows() ? ImGuiWindowFlags_NoMove : 0));
killproofUi.draw(p_open, (!canMoveWindows() ? ImGuiWindowFlags_NoMove : 0));
}
}

Expand Down

0 comments on commit 74bc90a

Please sign in to comment.