From cd5c6a889c7c504c133868726a4e742a29d22b75 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Fri, 21 Mar 2025 00:00:19 +0300 Subject: [PATCH] fix and cleanup --- src/audio/audio.cpp | 12 ++++++------ src/frontend/ContentGfxCache.cpp | 1 - src/frontend/ContentGfxCache.hpp | 5 +---- src/frontend/locale.cpp | 4 ++-- src/window/Window.cpp | 26 -------------------------- 5 files changed, 9 insertions(+), 39 deletions(-) diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index 761557af..f98c436e 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -17,12 +17,12 @@ static debug::Logger logger("audio"); using namespace audio; namespace { - static speakerid_t nextId = 1; - static Backend* backend; - static std::unordered_map> speakers; - static std::unordered_map> streams; - static std::vector> channels; - static util::ObjectsKeeper objects_keeper {}; + speakerid_t nextId = 1; + Backend* backend; + std::unordered_map> speakers; + std::unordered_map> streams; + std::vector> channels; + util::ObjectsKeeper objects_keeper {}; } Channel::Channel(std::string name) : name(std::move(name)) { diff --git a/src/frontend/ContentGfxCache.cpp b/src/frontend/ContentGfxCache.cpp index 7d61227b..844fd4e6 100644 --- a/src/frontend/ContentGfxCache.cpp +++ b/src/frontend/ContentGfxCache.cpp @@ -7,7 +7,6 @@ #include "content/Content.hpp" #include "content/ContentPack.hpp" #include "graphics/core/Atlas.hpp" -#include "graphics/commons/Model.hpp" #include "maths/UVRegion.hpp" #include "voxels/Block.hpp" #include "core_defs.hpp" diff --git a/src/frontend/ContentGfxCache.hpp b/src/frontend/ContentGfxCache.hpp index e5965148..c1b17db3 100644 --- a/src/frontend/ContentGfxCache.hpp +++ b/src/frontend/ContentGfxCache.hpp @@ -7,6 +7,7 @@ #include #include "maths/UVRegion.hpp" +#include "graphics/commons/Model.hpp" class Content; class Assets; @@ -15,10 +16,6 @@ class Block; struct UVRegion; struct GraphicsSettings; -namespace model { - struct Model; -} - class ContentGfxCache { const Content& content; const Assets& assets; diff --git a/src/frontend/locale.cpp b/src/frontend/locale.cpp index 53d8ce8c..2bae106a 100644 --- a/src/frontend/locale.cpp +++ b/src/frontend/locale.cpp @@ -16,8 +16,8 @@ using namespace std::literals; using namespace langs; namespace { - static std::unique_ptr current; - static std::unordered_map locales_info; + std::unique_ptr current; + std::unordered_map locales_info; } langs::Lang::Lang(std::string locale) : locale(std::move(locale)) { diff --git a/src/window/Window.cpp b/src/window/Window.cpp index b553cc65..8533f522 100644 --- a/src/window/Window.cpp +++ b/src/window/Window.cpp @@ -533,32 +533,6 @@ void Window::setClipboardText(const char* text) { glfwSetClipboardString(window, text); } -static bool try_to_maximize(GLFWwindow* window, GLFWmonitor* monitor) { - glm::ivec4 windowFrame(0); - glm::ivec4 workArea(0); - glfwGetWindowFrameSize( - window, &windowFrame.x, &windowFrame.y, &windowFrame.z, &windowFrame.w - ); - glfwGetMonitorWorkarea( - monitor, &workArea.x, &workArea.y, &workArea.z, &workArea.w - ); - if (Window::width > (uint)workArea.z) Window::width = (uint)workArea.z; - if (Window::height > (uint)workArea.w) Window::height = (uint)workArea.w; - if (Window::width >= (uint)(workArea.z - (windowFrame.x + windowFrame.z)) && - Window::height >= - (uint)(workArea.w - (windowFrame.y + windowFrame.w))) { - glfwMaximizeWindow(window); - return true; - } - glfwSetWindowSize(window, Window::width, Window::height); - glfwSetWindowPos( - window, - workArea.x + (workArea.z - Window::width) / 2, - workArea.y + (workArea.w - Window::height) / 2 + windowFrame.y / 2 - ); - return false; -} - void Window::setIcon(const ImageData* image) { GLFWimage icon { static_cast(image->getWidth()),